From: Andrea Zagli Date: Sat, 9 Sep 2017 10:13:16 +0000 (+0200) Subject: First build. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=8bd62ee9cf46bb351387594e34c0b70f48e602b9;p=zakstorage%2Flibzakstorage First build. --- diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am index d4f3d3c..5784981 100644 --- a/docs/reference/Makefile.am +++ b/docs/reference/Makefile.am @@ -67,8 +67,8 @@ expand_content_files= # signals and properties. # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -INCLUDES=-I$(top_srcdir)/src $(LIBCONFI_CFLAGS) -GTKDOC_LIBS=$(top_builddir)/src/libzakstorage.la $(LIBCONFI_LIBS) +AM_CPPFLAGS=-I$(top_srcdir)/src $(LIBZAKSTORAGE_CFLAGS) +GTKDOC_LIBS=$(top_builddir)/src/libzakstorage.la $(LIBZAKSTORAGE_LIBS) # This includes the standard gtk-doc make rules, copied by gtkdocize. include $(top_srcdir)/gtk-doc.make diff --git a/src/commons.c b/src/commons.c index bd65922..e464bf3 100644 --- a/src/commons.c +++ b/src/commons.c @@ -20,57 +20,7 @@ */ #ifdef HAVE_STORAGEG_H -#include +#include #endif #include "commons.h" - -ZakStorageStorage -*zak_storage_storage_copy (ZakStorageStorage *storage) -{ - ZakStorageStorage *b; - - b = g_slice_new (ZakStorageStorage); - b->name = g_strdup (storage->name); - b->description = g_strdup (storage->description); - - return b; -} - -void -zak_storage_storage_free (ZakStorageStorage *storage) -{ - g_free (storage->name); - g_free (storage->description); - g_slice_free (ZakStorageStorage, storage); -} - -G_DEFINE_BOXED_TYPE (ZakStorageStorage, zak_storage_storage, zak_storage_storage_copy, zak_storage_storage_free) - -ZakStorageKey -*zak_storage_key_copy (ZakStorageKey *key) -{ - ZakStorageKey *b; - - b = g_slice_new (ZakStorageKey); - b->storageg = g_strdup (key->storageg); - b->path = g_strdup (key->path); - b->key = g_strdup (key->key); - b->value = g_strdup (key->value); - b->description = g_strdup (key->description); - - return b; -} - -void -zak_storage_key_free (ZakStorageKey *key) -{ - g_free (key->storageg); - g_free (key->path); - g_free (key->key); - g_free (key->value); - g_free (key->description); - g_slice_free (ZakStorageKey, key); -} - -G_DEFINE_BOXED_TYPE (ZakStorageKey, zak_storage_key, zak_storage_key_copy, zak_storage_key_free) diff --git a/src/commons.h b/src/commons.h index 5075f1d..4e841ee 100644 --- a/src/commons.h +++ b/src/commons.h @@ -25,36 +25,6 @@ G_BEGIN_DECLS -#define ZAK_STORAGE_TYPE_STORAGE (zak_storage_storage_get_type ()) - -GType zak_storage_storage_get_type (); - -typedef struct _ZakStorageStorage ZakStorageStorage; -struct _ZakStorageStorage - { - gchar *name; - gchar *description; - }; - -ZakStorageStorage *zak_storage_storage_copy (ZakStorageStorage *storage); -void zak_storage_storage_free (ZakStorageStorage *storage); - -#define ZAK_STORAGE_TYPE_KEY (zak_storage_key_get_type ()) - -GType zak_storage_key_get_type (); - -typedef struct _ZakStorageKey ZakStorageKey; -struct _ZakStorageKey - { - gchar *storageg; - gchar *path; - gchar *key; - gchar *value; - gchar *description; - }; - -ZakStorageKey *zak_storage_key_copy (ZakStorageKey *key); -void zak_storage_key_free (ZakStorageKey *key); G_END_DECLS diff --git a/src/libzakstorage.h b/src/libzakstorage.h index 9395836..6526bc8 100644 --- a/src/libzakstorage.h +++ b/src/libzakstorage.h @@ -57,55 +57,8 @@ ZakStorage *zak_storage_new (const gchar *cnc_string); PeasPluginInfo *zak_storage_get_plugin_info (ZakStorage *storage); -GList *zak_storage_get_storagegs_list (const gchar *cnc_string, - const gchar *filter); - -ZakStorageStorage *zak_storage_get_storage_storage (ZakStorage *storage); - -ZakStorageStorage *zak_storage_add_storageg (const gchar *cnc_string, - const gchar *name, - const gchar *description); - -ZakStorageStorage *zak_storage_add_storageg_from_storage (ZakStorage *storage_source, - const gchar *cnc_string, - const gchar *name_new, - const gchar *description_new); - -GNode *zak_storage_get_tree (ZakStorage *storage); - -gchar *zak_storage_normalize_root (const gchar *root); -gboolean zak_storage_set_root (ZakStorage *storage, const gchar *root); - -gboolean zak_storage_set_storageg (ZakStorage *storage, - const gchar *name, - const gchar *description); - -ZakStorageKey *zak_storage_add_key (ZakStorage *storage, - const gchar *parent, - const gchar *key, - const gchar *value); - -gboolean zak_storage_key_set_key (ZakStorage *storage, - ZakStorageKey *ck); - -gboolean zak_storage_remove_path (ZakStorage *storage, - const gchar *path); - -gchar *zak_storage_path_get_value (ZakStorage *storage, - const gchar *path); -gboolean zak_storage_path_set_value (ZakStorage *storage, - const gchar *path, - const gchar *value); - -ZakStorageKey *zak_storage_path_get_storage_key (ZakStorage *storage, - const gchar *path); - -gboolean zak_storage_remove (ZakStorage *storage); - void zak_storage_destroy (ZakStorage *storage); -gchar *zak_storage_path_normalize (ZakStoragePluggable *pluggable, const gchar *path); - G_END_DECLS diff --git a/src/storage.c b/src/storage.c index 469c248..a323733 100644 --- a/src/storage.c +++ b/src/storage.c @@ -61,12 +61,6 @@ static ZakStoragePluggable *zak_storage_get_storage_pluggable_from_cnc_string (c typedef struct _ZakStoragePrivate ZakStoragePrivate; struct _ZakStoragePrivate { - gint id_storageg; - gchar *name; - gchar *description; - gchar *root; - GHashTable *values; - ZakStoragePluggable *pluggable; }; @@ -243,465 +237,6 @@ PeasPluginInfo return ppinfo; } -/** - * zak_storage_get_storagegs_list: - * @cnc_string: the connection string to use to connect to database that - * contains storageguration. - * @filter: (nullable): - * - * Returns: (element-type ZakStorageStorage) (transfer container): a #GList of #ZakStorageStorage. If there's no storagegurations, returns a valid - * #GList but with a unique NULL element. - */ -GList -*zak_storage_get_storagegs_list (const gchar *cnc_string, - const gchar *filter) -{ - ZakStoragePluggable *pluggable; - GList *lst; - - pluggable = zak_storage_get_storage_pluggable_from_cnc_string (cnc_string); - - if (pluggable == NULL) - { - g_warning ("Not initialized."); - lst = NULL; - } - else - { - lst = zak_storage_pluggable_get_storagegs_list (pluggable, filter); - } - - return lst; -} - -/** - * zak_storage_get_storage_storage: - * @storage: - * - * Returns: a #ZakStorageStorage struct. - */ -ZakStorageStorage -*zak_storage_get_storage_storage (ZakStorage *storage) -{ - ZakStorageStorage *cc; - - ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - - cc = g_new0 (ZakStorageStorage, 1); - cc->name = g_strdup (priv->name); - cc->description = g_strdup (priv->description); - - return cc; -} - -/** - * zak_storage_add_storageg: - * @cnc_string: - * @name: - * @description: - * - * Returns: a #ZakStorageStorage struct just rceated. - */ -ZakStorageStorage -*zak_storage_add_storageg (const gchar *cnc_string, - const gchar *name, - const gchar *description) -{ - ZakStoragePluggable *pluggable; - ZakStorageStorage *cc; - - pluggable = zak_storage_get_storage_pluggable_from_cnc_string (cnc_string); - - if (pluggable == NULL) - { - g_warning ("Not initialized."); - cc = NULL; - } - else - { - cc = zak_storage_pluggable_add_storageg (pluggable, name, description); - } - - return cc; -} - -static gboolean -add_traverse_func (GNode *node, - gpointer data) -{ - ZakStorageKey *ck = (ZakStorageKey *)node->data; - - if (g_strcmp0 (ck->key, "") != 0 - && g_strcmp0 (ck->key, "/") != 0) - { - zak_storage_add_key ((ZakStorage *)data, ck->path, ck->key, ck->value); - } - - return FALSE; -} - -/** - * zak_storage_add_storageg_from_storage: - * @storage_source: - * @cnc_string: - * @name_new: - * @description_new: - * - * Returns: a #ZakStorageStorage struct just created. - */ -ZakStorageStorage -*zak_storage_add_storageg_from_storage (ZakStorage *storage_source, - const gchar *cnc_string, - const gchar *name_new, - const gchar *description_new) -{ - ZakStorage *storage; - ZakStorageStorage *cc; - - GNode *tree; - - gchar *storage_name; - - cc = zak_storage_add_storageg (cnc_string, name_new, description_new); - if (cc != NULL) - { - tree = zak_storage_get_tree (storage_source); - if (tree != NULL) - { - storage_name = g_strdup_printf ("%s;STORAGE_NAME=%s", cnc_string, cc->name); - - storage = zak_storage_new (storage_name); - - if (storage != NULL) - { - g_node_traverse (tree, G_PRE_ORDER, G_TRAVERSE_ALL, -1, add_traverse_func, (gpointer)storage); - } - - g_free (storage_name); - } - else - { - g_warning ("ZakStorage source is empty."); - } - } - - return cc; -} - -/** - * zak_storage_get_tree: - * @storage: a #ZakStorage object. - * - * Returns: a #GNode. - */ -GNode -*zak_storage_get_tree (ZakStorage *storage) -{ - ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - - if (priv->pluggable != NULL) - { - return zak_storage_pluggable_get_tree (priv->pluggable); - } - else - { - return NULL; - } -} - -/** - * zak_storage_normalize_set_root: - * @storage: a #ZakStorage object. - * @root: the root. - * - * Returns: a correct value for root property. - */ -gchar -*zak_storage_normalize_root (const gchar *root) -{ - GString *root_; - gchar *strret; - - if (root == NULL) - { - root_ = g_string_new ("/"); - } - else - { - root_ = g_string_new (root); - g_strstrip (root_->str); - if (g_strcmp0 (root_->str, "") == 0) - { - g_string_printf (root_, "/"); - } - else - { - if (root_->str[0] != '/') - { - g_string_prepend (root_, "/"); - } - if (root_->str[root_->len - 1] != '/') - { - g_string_append (root_, "/"); - } - } - } - - strret = g_strdup (root_->str); - g_string_free (root_, TRUE); - - return strret; -} - -/** - * zak_storage_set_root: - * @storage: a #ZakStorage object. - * @root: the root. - * - */ -gboolean -zak_storage_set_root (ZakStorage *storage, const gchar *root) -{ - gboolean ret; - - ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - - if (priv->pluggable == NULL) - { - g_warning ("Not initialized."); - ret = FALSE; - } - else - { - g_object_set (priv->pluggable, "root", root, NULL); - ret = TRUE; - } - - return ret; -} - -/** - * zak_storage_set_storageg: - * @storage: a #ZakStorage object. - * @name: - * @description: - * - * Returns: - */ -gboolean -zak_storage_set_storageg (ZakStorage *storage, - const gchar *name, - const gchar *description) -{ - ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - - if (priv->pluggable == NULL) - { - g_warning ("Not initialized."); - return FALSE; - } - else - { - return zak_storage_pluggable_set_storageg (priv->pluggable, - name, - description); - } -} - -/** - * zak_storage_add_key: - * @storage: a #ZakStorage object. - * @parent: the path where add the key. - * @key: the key's name. - * @value: the key's value. - * - * Returns: a #ZakStoragegKey struct filled with data from the key just added. - */ -ZakStorageKey -*zak_storage_add_key (ZakStorage *storage, const gchar *parent, const gchar *key, const gchar *value) -{ - ZakStorageKey *ck; - - ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - - if (priv->pluggable == NULL) - { - g_warning ("Not initialized."); - ck = NULL; - } - else - { - ck = zak_storage_pluggable_add_key (priv->pluggable, parent, key, value); - } - - return ck; -} - -/** - * zak_storage_key_set_key: - * @storage: a #ZakStorage object. - * @ck: a #ZakStorageKey struct. - * - */ -gboolean -zak_storage_key_set_key (ZakStorage *storage, - ZakStorageKey *ck) -{ - gboolean ret; - - ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - - if (priv->pluggable == NULL) - { - g_warning ("Not initialized."); - ret = FALSE; - } - else - { - ret = zak_storage_pluggable_key_set_key (priv->pluggable, ck); - } - - return ret; -} - -/** - * zak_storage_remove_path: - * @storage: a #ZakStorage object. - * @path: the path to remove. - * - * Removes @path and every child key. - */ -gboolean -zak_storage_remove_path (ZakStorage *storage, const gchar *path) -{ - gboolean ret; - ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - - if (priv->pluggable == NULL) - { - g_warning ("Not initialized."); - ret = FALSE; - } - else - { - ret = zak_storage_pluggable_remove_path (priv->pluggable, path); - } - - return ret; -} - -/** - * zak_storage_path_get_value: - * @storage: a #ZakStorage object. - * @path: the path from which retrieving the value. - * - * Returns: the storageguration's value as a string. - */ -gchar -*zak_storage_path_get_value (ZakStorage *storage, const gchar *path) -{ - gchar *ret; - - ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - - if (priv->pluggable == NULL) - { - g_warning ("Not initialized."); - ret = NULL; - } - else - { - ret = zak_storage_pluggable_path_get_value (priv->pluggable, path); - } - - return ret; -} - -/** - * zak_storage_path_set_value: - * @storage: a #ZakStorage object. - * @path: the key's path. - * @value: the value to set. - * - */ -gboolean -zak_storage_path_set_value (ZakStorage *storage, const gchar *path, const gchar *value) -{ - gboolean ret; - - ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - - if (priv->pluggable == NULL) - { - g_warning ("Not initialized."); - ret = FALSE; - } - else - { - ret = zak_storage_pluggable_path_set_value (priv->pluggable, path, value); - } - - return ret; -} - -/** - * zak_storage_path_get_storage_key: - * @storage: a #ZakStorage object. - * @path: the key's path to get. - * - * Returns: (transfer full): a #ZakStorageKey from @path - */ -ZakStorageKey -*zak_storage_path_get_storage_key (ZakStorage *storage, const gchar *path) -{ - ZakStorageKey *ck; - - ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - - if (priv->pluggable == NULL) - { - g_warning ("Not initialized."); - ck = NULL; - } - else - { - ck = zak_storage_pluggable_path_get_storage_key (priv->pluggable, path); - } - - return ck; -} - -/** - * zak_storage_remove: - * @storage: a #ZakStorage object. - * - * Remove a storageguration from databases and destroy the relative object. - */ -gboolean -zak_storage_remove (ZakStorage *storage) -{ - gboolean ret; - - ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - - if (priv->pluggable == NULL) - { - g_warning ("Not initialized."); - ret = FALSE; - } - else - { - ret = zak_storage_pluggable_remove (priv->pluggable); - } - - if (ret) - { - zak_storage_destroy (storage); - } - - return ret; -} - /** * zak_storage_destroy: * @storage: a #ZakStorage object. @@ -713,74 +248,13 @@ zak_storage_destroy (ZakStorage *storage) { ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); - g_free (priv->name); - g_free (priv->description); - g_free (priv->root); g_object_unref (priv->pluggable); } -/** - * zak_storage_path_normalize: - * @pluggable: a #ZakStoragePluggable object. - * - * Returns: a normalize path (with root). - */ -gchar -*zak_storage_path_normalize (ZakStoragePluggable *pluggable, const gchar *path) -{ - GString *ret; - gchar *strret; - - guint lead; - - gchar *root; - - if (path == NULL) - { - return NULL; - } - - ret = g_string_new (path); - g_strstrip (ret->str); - if (g_strcmp0 (ret->str, "") == 0) - { - return NULL; - } - else if (ret->str[strlen (ret->str) - 1] == '/') - { - return NULL; - } - - /* removing leading '/' */ - lead = 0; - for (lead = 0; lead < ret->len; lead++) - { - if (ret->str[lead] != '/') - { - break; - } - } - - if (lead < ret->len) - { - g_string_erase (ret, 0, lead++); - } - - g_object_get (pluggable, "root", &root, NULL); - g_string_prepend (ret, root); - - strret = g_strdup (ret->str); - g_string_free (ret, TRUE); - - return strret; -} - /* PRIVATE */ static void zak_storage_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - gchar *sql; - ZakStorage *storage = ZAK_STORAGE (object); ZakStoragePrivate *priv = ZAK_STORAGE_GET_PRIVATE (storage); diff --git a/src/storagepluggable.c b/src/storagepluggable.c index 0a3bb57..f33a8c4 100644 --- a/src/storagepluggable.c +++ b/src/storagepluggable.c @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include +#include #endif #include "storagepluggable.h" @@ -52,39 +52,6 @@ zak_storage_pluggable_default_init (ZakStoragePluggableInterface *iface) "", G_PARAM_READWRITE)); - /** - * ZakStoragePluggable:name: - * - */ - g_object_interface_install_property (iface, - g_param_spec_string ("name", - "Storageguraton Name", - "The storageguration name", - "", - G_PARAM_READABLE)); - - /** - * ZakStoragePluggable:description: - * - */ - g_object_interface_install_property (iface, - g_param_spec_string ("description", - "Storageguraton Description", - "The storageguration description", - "", - G_PARAM_READABLE)); - - /** - * ZakStoragePluggable:root: - * - */ - g_object_interface_install_property (iface, - g_param_spec_string ("root", - "Storageguraton Root", - "The storageguration root", - "/", - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); - initialized = TRUE; } } @@ -110,226 +77,3 @@ zak_storage_pluggable_initialize (ZakStoragePluggable *pluggable, const gchar *c return iface->initialize (pluggable, cnc_string); } - -/** - * zak_storage_pluggable_get_storagegs_list: - * @pluggable: A #ZakStoragePluggable. - * @filter: (nullable): - * - * Returns: (element-type ZakStorage) (transfer container): a #GList of #ZakStorage. If there's no storagegurations, returns a valid - * #GList but with a unique NULL element. -*/ -GList -*zak_storage_pluggable_get_storagegs_list (ZakStoragePluggable *pluggable, const gchar *filter) -{ - ZakStoragePluggableInterface *iface; - - g_return_val_if_fail (ZAK_STORAGE_IS_PLUGGABLE (pluggable), FALSE); - - iface = ZAK_STORAGE_PLUGGABLE_GET_IFACE (pluggable); - g_return_val_if_fail (iface->get_storagegs_list != NULL, FALSE); - - return iface->get_storagegs_list (pluggable, filter); -} - -/** - * zak_storage_pluggable_path_get_value: - * @pluggable: A #ZakStoragePluggable. - * @path: - * - * Returns: the value of the @path. -*/ -gchar -*zak_storage_pluggable_path_get_value (ZakStoragePluggable *pluggable, const gchar *path) -{ - ZakStoragePluggableInterface *iface; - - g_return_val_if_fail (ZAK_STORAGE_IS_PLUGGABLE (pluggable), FALSE); - - iface = ZAK_STORAGE_PLUGGABLE_GET_IFACE (pluggable); - g_return_val_if_fail (iface->path_get_value != NULL, FALSE); - - return iface->path_get_value (pluggable, path); -} - -/** - * zak_storage_pluggable_path_set_value: - * @pluggable: a #ZakStoragePluggable object. - * @path: the key's path. - * @value: the value to set. - * - */ -gboolean -zak_storage_pluggable_path_set_value (ZakStoragePluggable *pluggable, const gchar *path, const gchar *value) -{ - ZakStoragePluggableInterface *iface; - - g_return_val_if_fail (ZAK_STORAGE_IS_PLUGGABLE (pluggable), FALSE); - - iface = ZAK_STORAGE_PLUGGABLE_GET_IFACE (pluggable); - g_return_val_if_fail (iface->path_set_value != NULL, FALSE); - - return iface->path_set_value (pluggable, path, value); -} - -/** - * zak_storage_pluggable_get_tree: - * @pluggable: a #ZakStoragePluggable object. - * - * Returns: a #GNode with the entire tree of storagegurations. - */ -GNode -*zak_storage_pluggable_get_tree (ZakStoragePluggable *pluggable) -{ - ZakStoragePluggableInterface *iface; - - g_return_val_if_fail (ZAK_STORAGE_IS_PLUGGABLE (pluggable), FALSE); - - iface = ZAK_STORAGE_PLUGGABLE_GET_IFACE (pluggable); - g_return_val_if_fail (iface->get_tree != NULL, FALSE); - - return iface->get_tree (pluggable); -} - -/** - * zak_storage_pluggable_add_storageg: - * @pluggable: a #ZakStoragePluggable object. - * @name: the name of the storageg.. - * @description: the storageg's description. - * - * Returns: a #ZakStorageStorage struct filled with data from the key just added. - */ -ZakStorageStorage -*zak_storage_pluggable_add_storageg (ZakStoragePluggable *pluggable, const gchar *name, const gchar *description) -{ - ZakStoragePluggableInterface *iface; - - g_return_val_if_fail (ZAK_STORAGE_IS_PLUGGABLE (pluggable), FALSE); - - iface = ZAK_STORAGE_PLUGGABLE_GET_IFACE (pluggable); - g_return_val_if_fail (iface->add_storageg != NULL, FALSE); - - return iface->add_storageg (pluggable, name, description); -} - -/** - * zak_storage_pluggable_set_storageg: - * @pluggable: a #ZakStoragePluggable object. - * @name: the name of the storageg.. - * @description: the storageg's description. - * - * Returns: - */ -gboolean -zak_storage_pluggable_set_storageg (ZakStoragePluggable *pluggable, const gchar *name, const gchar *description) -{ - ZakStoragePluggableInterface *iface; - - g_return_val_if_fail (ZAK_STORAGE_IS_PLUGGABLE (pluggable), FALSE); - - iface = ZAK_STORAGE_PLUGGABLE_GET_IFACE (pluggable); - g_return_val_if_fail (iface->set_storageg != NULL, FALSE); - - return iface->set_storageg (pluggable, name, description); -} - -/** - * zak_storage_pluggable_add_key: - * @pluggable: a #ZakStoragePluggable object. - * @parent: the path where add the key. - * @key: the key's name. - * @value: the key's value. - * - * Returns: a #ZakStorageKey struct filled with data from the key just added. - */ -ZakStorageKey -*zak_storage_pluggable_add_key (ZakStoragePluggable *pluggable, const gchar *parent, const gchar *key, const gchar *value) -{ - ZakStoragePluggableInterface *iface; - - g_return_val_if_fail (ZAK_STORAGE_IS_PLUGGABLE (pluggable), FALSE); - - iface = ZAK_STORAGE_PLUGGABLE_GET_IFACE (pluggable); - g_return_val_if_fail (iface->add_key != NULL, FALSE); - - return iface->add_key (pluggable, parent, key, value); -} - -/** - * zak_storage_pluggable_key_set_key: - * @pluggable: a #ZakStoragePluggable object. - * @ck: a #ZakStorageKey struct. - * - */ -gboolean -zak_storage_pluggable_key_set_key (ZakStoragePluggable *pluggable, - ZakStorageKey *ck) -{ - ZakStoragePluggableInterface *iface; - - g_return_val_if_fail (ZAK_STORAGE_IS_PLUGGABLE (pluggable), FALSE); - - iface = ZAK_STORAGE_PLUGGABLE_GET_IFACE (pluggable); - g_return_val_if_fail (iface->key_set_key != NULL, FALSE); - - return iface->key_set_key (pluggable, ck); -} - -/** - * zak_storage_pluggable_path_get_storage_key: - * @pluggable: a #ZakStoragePluggable object. - * @path: the key's path to get. - * - * Returns: (transfer full): a #ZakStorageKey from @path - */ -ZakStorageKey -*zak_storage_pluggable_path_get_storage_key (ZakStoragePluggable *pluggable, const gchar *path) -{ - ZakStoragePluggableInterface *iface; - - g_return_val_if_fail (ZAK_STORAGE_IS_PLUGGABLE (pluggable), FALSE); - - iface = ZAK_STORAGE_PLUGGABLE_GET_IFACE (pluggable); - g_return_val_if_fail (iface->path_get_storage_key != NULL, FALSE); - - return iface->path_get_storage_key (pluggable, path); -} - -/** - * zak_storage_pluggable_remove_path: - * @pluggable: a #ZakStoragePluggable object. - * @path: the path to remove. - * - * Removes @path and every child key. - */ -gboolean -zak_storage_pluggable_remove_path (ZakStoragePluggable *pluggable, const gchar *path) -{ - ZakStoragePluggableInterface *iface; - - g_return_val_if_fail (ZAK_STORAGE_IS_PLUGGABLE (pluggable), FALSE); - - iface = ZAK_STORAGE_PLUGGABLE_GET_IFACE (pluggable); - g_return_val_if_fail (iface->remove_path != NULL, FALSE); - - return iface->remove_path (pluggable, path); -} - -/** - * zak_storage_pluggable_remove: - * @pluggable: a #ZakStoragePluggable object. - * - * Remove a storageguration from databases and destroy the relative object. - */ -gboolean -zak_storage_pluggable_remove (ZakStoragePluggable *pluggable) -{ - ZakStoragePluggableInterface *iface; - - g_return_val_if_fail (ZAK_STORAGE_IS_PLUGGABLE (pluggable), FALSE); - - iface = ZAK_STORAGE_PLUGGABLE_GET_IFACE (pluggable); - g_return_val_if_fail (iface->remove != NULL, FALSE); - - return iface->remove (pluggable); -} diff --git a/src/storagepluggable.h b/src/storagepluggable.h index 5dfe418..97cba41 100644 --- a/src/storagepluggable.h +++ b/src/storagepluggable.h @@ -57,29 +57,6 @@ struct _ZakStoragePluggableInterface { /* Virtual public methods */ gboolean (*initialize) (ZakStoragePluggable *pluggable, const gchar *cnc_string); - GList *(*get_storagegs_list) (ZakStoragePluggable *pluggable, - const gchar *filter); - gchar *(*path_get_value) (ZakStoragePluggable *pluggable, const gchar *path); - gboolean (*path_set_value) (ZakStoragePluggable *pluggable, - const gchar *path, - const gchar *value); - GNode *(*get_tree) (ZakStoragePluggable *pluggable); - ZakStorageStorage *(*add_storageg) (ZakStoragePluggable *pluggable, - const gchar *name, - const gchar *description); - gboolean (*set_storageg) (ZakStoragePluggable *pluggable, - const gchar *name, - const gchar *description); - ZakStorageKey *(*add_key) (ZakStoragePluggable *pluggable, - const gchar *parent, - const gchar *key, - const gchar *value); - ZakStorageKey *(*path_get_storage_key) (ZakStoragePluggable *pluggable, const gchar *path); - gboolean (*remove_path) (ZakStoragePluggable *pluggable, - const gchar *path); - gboolean (*remove) (ZakStoragePluggable *pluggable); - gboolean (*key_set_key) (ZakStoragePluggable *pluggable, - ZakStorageKey *ck); }; /* @@ -90,30 +67,6 @@ GType zak_storage_pluggable_get_type (void) G_GNUC_CONST; gboolean zak_storage_pluggable_initialize (ZakStoragePluggable *pluggable, const gchar *cnc_string); -GList *zak_storage_pluggable_get_storagegs_list (ZakStoragePluggable *pluggable, - const gchar *filter); -gchar *zak_storage_pluggable_path_get_value (ZakStoragePluggable *pluggable, - const gchar *path); -gboolean zak_storage_pluggable_path_set_value (ZakStoragePluggable *pluggable, - const gchar *path, - const gchar *value); -GNode *zak_storage_pluggable_get_tree (ZakStoragePluggable *pluggable); -ZakStorageStorage *zak_storage_pluggable_add_storageg (ZakStoragePluggable *pluggable, - const gchar *name, - const gchar *description); -gboolean zak_storage_pluggable_set_storageg (ZakStoragePluggable *pluggable, - const gchar *name, - const gchar *description); -ZakStorageKey *zak_storage_pluggable_add_key (ZakStoragePluggable *pluggable, - const gchar *parent, - const gchar *key, - const gchar *value); -gboolean zak_storage_pluggable_key_set_key (ZakStoragePluggable *pluggable, - ZakStorageKey *ck); -ZakStorageKey *zak_storage_pluggable_path_get_storage_key (ZakStoragePluggable *pluggable, const gchar *path); -gboolean zak_storage_pluggable_remove_path (ZakStoragePluggable *pluggable, const gchar *path); -gboolean zak_storage_pluggable_remove (ZakStoragePluggable *pluggable); - G_END_DECLS