From 31afde238ff9941165123c2ee58a8e213f171cc9 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 21 Jul 2019 09:34:50 +0200 Subject: [PATCH] Pluggable skeleton. --- plugins/db/plgdb.c | 522 +----------------------------------------- src/bkspluggable.c | 61 +++++ src/bkspluggable.h | 7 + src/commons.c | 50 +--- src/commons.h | 31 +-- src/libzakbookmarks.h | 8 +- 6 files changed, 102 insertions(+), 577 deletions(-) diff --git a/plugins/db/plgdb.c b/plugins/db/plgdb.c index a09db52..6d2c332 100644 --- a/plugins/db/plgdb.c +++ b/plugins/db/plgdb.c @@ -42,10 +42,6 @@ static void zak_bks_pluggable_iface_init (ZakBksPluggableInterface *iface); static gboolean zak_bks_db_plugin_initialize (ZakBksPluggable *pluggable, const gchar *cnc_string); -static GdaDataModel *zak_bks_db_plugin_path_get_data_model (ZakBksPluggable *pluggable, const gchar *path); -static gchar *zak_bks_db_plugin_path_get_value_from_db (ZakBksPluggable *pluggable, const gchar *path); -static void zak_bks_db_plugin_get_children (ZakBksPluggable *pluggable, GNode *parentNode, gint idParent, gchar *path); - #define ZAK_BKS_DB_PLUGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_BKS_TYPE_DB_PLUGIN, ZakBksDBPluginPrivate)) typedef struct _ZakBksDBPluginPrivate ZakBksDBPluginPrivate; @@ -54,13 +50,6 @@ struct _ZakBksDBPluginPrivate gchar *cnc_string; GdaEx *gdaex; - - gint id_bksg; - gchar *name; - gchar *description; - gchar *root; - - gchar chrquot; }; G_DEFINE_DYNAMIC_TYPE_EXTENDED (ZakBksDBPlugin, @@ -81,8 +70,6 @@ zak_bks_db_plugin_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - gchar *sql; - ZakBksDBPlugin *plugin = ZAK_BKS_DB_PLUGIN (object); ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (plugin); @@ -142,521 +129,29 @@ zak_bks_db_plugin_initialize (ZakBksPluggable *pluggable, const gchar *cnc_strin ZakBksDBPlugin *plugin = ZAK_BKS_DB_PLUGIN (pluggable); ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (plugin); - GString *gstr_cnc_string; - gchar **strs; - guint i; - guint l; - - gchar *sql; - GdaDataModel *dm; - - gchar *cnc_string_; - - cnc_string_ = g_strdup_printf ("%s;", cnc_string); - strs = g_strsplit (cnc_string_, ";", -1); - g_free (cnc_string_); - - gstr_cnc_string = g_string_new (""); - - l = g_strv_length (strs); - for (i = 0; i < l; i++) - { - if (g_str_has_prefix (strs[i], "BKS_NAME=")) - { - priv->name = g_strdup (strs[i] + strlen ("BKS_NAME=")); - if (priv->name[strlen (priv->name)] == ';') - { - priv->name[strlen (priv->name)] = '\0'; - } - } - else - { - g_string_append (gstr_cnc_string, strs[i]); - g_string_append (gstr_cnc_string, ";"); - } - } - if (priv->cnc_string != NULL) - { - g_free (priv->cnc_string); - } - priv->cnc_string = g_strdup (gstr_cnc_string->str); - - g_string_free (gstr_cnc_string, TRUE); - g_strfreev (strs); - - if (priv->name == NULL) - { - priv->name = g_strdup ("Default"); - } + priv->cnc_string = g_strdup (cnc_string); priv->gdaex = gdaex_new_from_string (priv->cnc_string); - priv->chrquot = gdaex_get_chr_quoting (priv->gdaex); - - /* check if bksg exists */ - sql = g_strdup_printf ("SELECT id, name" - " FROM bksgs" - " WHERE name = '%s'", - gdaex_strescape (priv->name, NULL)); - dm = gdaex_query (priv->gdaex, sql); - g_free (sql); - if (dm != NULL || gda_data_model_get_n_rows (dm) > 0) - { - priv->id_bksg = gdaex_data_model_get_value_integer_at (dm, 0, 0); - } - if (dm != NULL) - { - g_object_unref (dm); - } - - return (priv->gdaex != NULL && priv->name != NULL ? TRUE : FALSE); -} - -static GdaDataModel -*zak_bks_db_plugin_path_get_data_model (ZakBksPluggable *pluggable, const gchar *path) -{ - gchar **tokens; - gchar *sql; - gchar *token; - guint i; - guint id_parent; - GdaDataModel *dm; - - ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable); - - if (path == NULL) return NULL; - - dm = NULL; - - tokens = g_strsplit (path, "/", 0); - if (tokens == NULL) return NULL; - - i = 0; - id_parent = 0; - while (tokens[i] != NULL) - { - token = g_strstrip (g_strdup (tokens[i])); - if (strcmp (token, "") != 0) - { - sql = g_strdup_printf ("SELECT *" - " FROM %cvalues%c" - " WHERE id_bksgs = %d" - " AND id_parent = %d" - " AND %ckey%c = '%s'", - priv->chrquot, priv->chrquot, - priv->id_bksg, - id_parent, - priv->chrquot, priv->chrquot, - gdaex_strescape (token, NULL)); - dm = gdaex_query (priv->gdaex, sql); - g_free (sql); - if (dm == NULL || gda_data_model_get_n_rows (dm) != 1) - { - /* TO DO */ - g_warning ("Unable to find key «%s».", token); - if (dm != NULL) - { - g_object_unref (dm); - dm = NULL; - } - break; - } - id_parent = gdaex_data_model_get_field_value_integer_at (dm, 0, "id"); - } - g_free (token); - - i++; - } - g_strfreev (tokens); - - return dm; -} - -static gchar -*zak_bks_db_plugin_path_get_value_from_db (ZakBksPluggable *pluggable, const gchar *path) -{ - gchar *ret; - GdaDataModel *dm; - - ret = NULL; - - dm = zak_bks_db_plugin_path_get_data_model (pluggable, path); - if (dm != NULL) - { - ret = gdaex_data_model_get_field_value_stringify_at (dm, 0, "value"); - g_object_unref (dm); - } - return ret; -} - -static void -zak_bks_db_plugin_get_children (ZakBksPluggable *pluggable, GNode *parentNode, gint idParent, gchar *path) -{ - gchar *sql; - GdaDataModel *dm; - - ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable); - - sql = g_strdup_printf ("SELECT *" - " FROM %cvalues%c" - " WHERE id_bksgs = %d" - " AND id_parent = %d", - priv->chrquot, priv->chrquot, - priv->id_bksg, - idParent); - - dm = gdaex_query (priv->gdaex, sql); - g_free (sql); - if (dm != NULL) - { - guint i; - guint rows; - - rows = gda_data_model_get_n_rows (dm); - for (i = 0; i < rows; i++) - { - GNode *newNode; - /* ZakBksKey *ck = g_new0 (ZakBksKey, 1); */ - - /* ck->bksg = g_strdup (priv->name); */ - /* ck->key = g_strdup (gdaex_data_model_get_field_value_stringify_at (dm, i, "key")); */ - /* ck->value = g_strdup (gdaex_data_model_get_field_value_stringify_at (dm, i, "value")); */ - /* ck->description = g_strdup (gdaex_data_model_get_field_value_stringify_at (dm, i, "description")); */ - /* ck->path = g_strdup (path); */ - - /* newNode = g_node_append_data (parentNode, ck); */ - - /* zak_bks_db_plugin_get_children (pluggable, */ - /* newNode, */ - /* gdaex_data_model_get_field_value_integer_at (dm, i, "id"), */ - /* g_strconcat (path, (g_strcmp0 (path, "") == 0 ? "" : "/"), ck->key, NULL)); */ - } - g_object_unref (dm); - } + return (priv->gdaex != NULL ? TRUE : FALSE); } static GList -*zak_bks_db_plugin_get_bksgs_list (ZakBksPluggable *pluggable, - const gchar *filter) -{ - GList *lst; - - GdaDataModel *dmZakBksgs; - - gchar *sql; - gchar *where; - - guint row; - guint rows; - - ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable); - - lst = NULL; - - if (priv->gdaex == NULL) - { - return NULL; - } - - if (filter != NULL && strcmp (g_strstrip (g_strdup (filter)), "") != 0) - { - where = g_strdup_printf (" WHERE name LIKE '%s'", filter); - } - else - { - where = g_strdup (""); - } - - sql = g_strdup_printf ("SELECT * FROM bksgs%s", where); - g_free (where); - - dmZakBksgs = gdaex_query (priv->gdaex, sql); - g_free (sql); - if (dmZakBksgs != NULL) - { - rows = gda_data_model_get_n_rows (dmZakBksgs); - if (rows > 0) - { - for (row = 0; row < rows; row++) - { - /* ZakBksBks *bks; */ - /* bks = g_new0 (ZakBksBks, 1); */ - /* bks->name = gdaex_data_model_get_field_value_stringify_at (dmZakBksgs, row, "name"); */ - /* bks->description = gdaex_data_model_get_field_value_stringify_at (dmZakBksgs, row, "description"); */ - /* lst = g_list_append (lst, bks); */ - } - } - else - { - lst = g_list_append (lst, NULL); - } - } - - return lst; -} - -static gchar -*zak_bks_db_plugin_path_get_value (ZakBksPluggable *pluggable, const gchar *path) -{ - gchar *ret; - gchar *path_; - - ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable); - - ret = NULL; - - if (path_ == NULL) - { - return NULL; - } - - ret = zak_bks_db_plugin_path_get_value_from_db (pluggable, path_); - - return ret; -} - -static gboolean -zak_bks_db_plugin_path_set_value (ZakBksPluggable *pluggable, const gchar *path, const gchar *value) -{ - GdaDataModel *dm; - gchar *sql; - gboolean ret; - - dm = zak_bks_db_plugin_path_get_data_model (pluggable, path); - - ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable); - - ret = FALSE; - if (dm != NULL && gda_data_model_get_n_rows (dm) > 0) - { - sql = g_strdup_printf ("UPDATE %cvalues%c" - " SET value = '%s'" - " WHERE id_bksgs = %d" - " AND id = %d", - priv->chrquot, priv->chrquot, - gdaex_strescape (value, NULL), - priv->id_bksg, - gdaex_data_model_get_field_value_integer_at (dm, 0, "id")); - ret = (gdaex_execute (priv->gdaex, sql) >= 0); - g_free (sql); - } - else - { - g_warning ("Path %s doesn't exists.", path); - } - if (dm != NULL) - { - g_object_unref (dm); - } - - return ret; -} - -GNode -*zak_bks_db_plugin_get_tree (ZakBksPluggable *pluggable) -{ - gchar *path; - GNode *node; - - ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable); - - path = g_strdup (""); - - /* ZakBksKey *ck = g_new0 (ZakBksKey, 1); */ - - /* ck->bksg = g_strdup (priv->name); */ - /* ck->path = ""; */ - /* ck->key = g_strdup ("/"); */ - /* ck->value = ""; */ - /* ck->description = ""; */ - - /* node = g_node_new (ck); */ - - zak_bks_db_plugin_get_children (pluggable, node, 0, path); - - return node; -} - -static ZakBksBks -*zak_bks_db_plugin_add_bksg (ZakBksPluggable *pluggable, const gchar *name, const gchar *description) -{ - ZakBksBks *cc; - - gchar *sql; - gint id; - - ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable); - - cc = NULL; - - id = gdaex_get_new_id (priv->gdaex, "bksgs", "id", NULL); - - sql = g_strdup_printf ("INSERT INTO bksgs" - " VALUES (%d, '%s', '%s')", - id, - gdaex_strescape (name, NULL), - gdaex_strescape (description, NULL)); - if (gdaex_execute (priv->gdaex, sql) > 0) - { - /* cc = g_new0 (ZakBksBks, 1); */ - /* cc->name = g_strdup (name); */ - /* cc->description = g_strdup (description); */ - } - - g_free (sql); - - return cc; -} - -static gboolean -zak_bks_db_plugin_set_bksg (ZakBksPluggable *pluggable, - const gchar *name, - const gchar *description) -{ - gboolean ret; - gchar *sql; - - ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable); - - g_return_val_if_fail (name != NULL, FALSE); - - ret = TRUE; - - sql = g_strdup_printf ("UPDATE bksgs" - " SET name = '%s'" - " WHERE id = %d", - gdaex_strescape (name, NULL), - priv->id_bksg); - if (gdaex_execute (priv->gdaex, sql) < 1) - { - ret = FALSE; - } - g_free (sql); - priv->name = g_strdup (name); - - if (description != NULL) - { - sql = g_strdup_printf ("UPDATE bksgs" - " SET description = '%s'" - " WHERE id = %d", - gdaex_strescape (description, NULL), - priv->id_bksg); - if (gdaex_execute (priv->gdaex, sql) < 1) - { - ret = FALSE; - } - g_free (sql); - priv->description = g_strdup (description); - } - - return ret; -} - -static gboolean -zak_bks_db_plugin_delete_id_from_db_values (ZakBksPluggable *pluggable, gint id) +*zak_bks_db_plugin_get_bookmarks (ZakBksPluggable *pluggable) { - gboolean ret; - gchar *sql; - - ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable); - - sql = g_strdup_printf ("DELETE FROM %cvalues%c" - " WHERE id_bksgs = %d" - " AND id = %d", - priv->chrquot, priv->chrquot, - priv->id_bksg, - id); - if (gdaex_execute (priv->gdaex, sql) >= 0) - { - ret = TRUE; - } - else - { - ret = FALSE; - } - g_free (sql); - - return ret; } -static gboolean -zak_bks_db_plugin_remove_path (ZakBksPluggable *pluggable, const gchar *path) +static void +zak_bks_db_plugin_add_bookmark (ZakBksPluggable *pluggable, ZakBksBookmark *bk) { - gboolean ret = FALSE; - GdaDataModel *dm; - - ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable); - - dm = zak_bks_db_plugin_path_get_data_model (pluggable, path); - - if (dm != NULL && gda_data_model_get_n_rows (dm) > 0) - { - gchar *path_ = g_strdup (path); - - /* removing every child key */ - GNode *node; - gint id = gdaex_data_model_get_field_value_integer_at (dm, 0, "id"); - - /* ZakBksKey *ck = g_new0 (ZakBksKey, 1); */ - - /* ck->bksg = g_strdup (priv->name); */ - /* ck->path = path_; */ - /* ck->key = gdaex_data_model_get_field_value_stringify_at (dm, 0, "key"); */ - /* ck->value = ""; */ - /* ck->description = ""; */ - - /* node = g_node_new (ck); */ - zak_bks_db_plugin_get_children (pluggable, node, id, path_); - - /* g_node_traverse (node, G_POST_ORDER, G_TRAVERSE_ALL, -1, zak_bks_db_plugin_remove_path_traverse_func, (gpointer)pluggable); */ - - /* removing the path */ - ret = zak_bks_db_plugin_delete_id_from_db_values (pluggable, id); - } - else - { - g_warning ("Path %s doesn't exists.", path); - } - if (dm != NULL) - { - g_object_unref (dm); - } - return ret; } -static gboolean -zak_bks_db_plugin_remove (ZakBksPluggable *pluggable) +static void +zak_bks_db_plugin_remove_bookmark (ZakBksPluggable *pluggable, ZakBksBookmark *bk) { - gboolean ret; - gchar *sql; - - ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable); - - ret = TRUE; - sql = g_strdup_printf ("DELETE FROM %cvalues%c WHERE id_bksgs = %d", - priv->chrquot, - priv->chrquot, - priv->id_bksg); - if (gdaex_execute (priv->gdaex, sql) == -1) - { - g_free (sql); - ret = FALSE; - } - else - { - g_free (sql); - sql = g_strdup_printf ("DELETE FROM bksgs WHERE id = %d", - priv->id_bksg); - if (gdaex_execute (priv->gdaex, sql) == -1) - { - ret = FALSE; - } - g_free (sql); - } - return ret; } static void @@ -677,6 +172,9 @@ static void zak_bks_pluggable_iface_init (ZakBksPluggableInterface *iface) { iface->initialize = zak_bks_db_plugin_initialize; + iface->get_bookmarks = zak_bks_db_plugin_get_bookmarks; + iface->add_bookmark = zak_bks_db_plugin_add_bookmark; + iface->remove_bookmark = zak_bks_db_plugin_remove_bookmark; } static void diff --git a/src/bkspluggable.c b/src/bkspluggable.c index f7065e8..ad3fc79 100644 --- a/src/bkspluggable.c +++ b/src/bkspluggable.c @@ -77,3 +77,64 @@ zak_bks_pluggable_initialize (ZakBksPluggable *pluggable, const gchar *cnc_strin return iface->initialize (pluggable, cnc_string); } + +/** + * zak_bks_pluggable_get_bookmarks: + * @pluggable: A #ZakBksPluggable. + * + * Return the list of bookmarks. + * + * Returns: #GList of bookmarks as #ZakBksBookmark. + */ +GList +*zak_bks_pluggable_get_bookmarks (ZakBksPluggable *pluggable) +{ + ZakBksPluggableInterface *iface; + + g_return_val_if_fail (ZAK_BKS_IS_PLUGGABLE (pluggable), FALSE); + + iface = ZAK_BKS_PLUGGABLE_GET_IFACE (pluggable); + g_return_val_if_fail (iface->initialize != NULL, FALSE); + + return iface->get_bookmarks (pluggable); +} + +/** + * zak_bks_pluggable_add_bookmark: + * @pluggable: A #ZakBksPluggable. + * @bk: A #ZakBksBookmark. + * + * Add/update a bookmark. + */ +void +zak_bks_pluggable_add_bookmark (ZakBksPluggable *pluggable, ZakBksBookmark *bk) +{ + ZakBksPluggableInterface *iface; + + g_return_if_fail (ZAK_BKS_IS_PLUGGABLE (pluggable)); + + iface = ZAK_BKS_PLUGGABLE_GET_IFACE (pluggable); + g_return_if_fail (iface->add_bookmark != NULL); + + return iface->add_bookmark (pluggable, bk); +} + +/** + * zak_bks_pluggable_remove_bookmark: + * @pluggable: A #ZakBksPluggable. + * @bk: A #ZakBksBookmark. + * + * Remove a bookmark. + */ +void +zak_bks_pluggable_remove_bookmark (ZakBksPluggable *pluggable, ZakBksBookmark *bk) +{ + ZakBksPluggableInterface *iface; + + g_return_if_fail (ZAK_BKS_IS_PLUGGABLE (pluggable)); + + iface = ZAK_BKS_PLUGGABLE_GET_IFACE (pluggable); + g_return_if_fail (iface->remove_bookmark != NULL); + + return iface->remove_bookmark (pluggable, bk); +} diff --git a/src/bkspluggable.h b/src/bkspluggable.h index 77b6cf2..f7f2270 100644 --- a/src/bkspluggable.h +++ b/src/bkspluggable.h @@ -57,6 +57,10 @@ struct _ZakBksPluggableInterface { /* Virtual public methods */ gboolean (*initialize) (ZakBksPluggable *pluggable, const gchar *cnc_string); + + GList *(*get_bookmarks) (ZakBksPluggable *pluggable); + void (*add_bookmark) (ZakBksPluggable *pluggable, ZakBksBookmark *bk); + void (*remove_bookmark) (ZakBksPluggable *pluggable, ZakBksBookmark *bk); }; /* @@ -67,6 +71,9 @@ GType zak_bks_pluggable_get_type (void) G_GNUC_CONST; gboolean zak_bks_pluggable_initialize (ZakBksPluggable *pluggable, const gchar *cnc_string); +GList *zak_bks_pluggable_get_bookmarks (ZakBksPluggable *pluggable); +void zak_bks_pluggable_add_bookmark (ZakBksPluggable *pluggable, ZakBksBookmark *bk); +void zak_bks_pluggable_remove_bookmark (ZakBksPluggable *pluggable, ZakBksBookmark *bk); G_END_DECLS diff --git a/src/commons.c b/src/commons.c index 5a3a147..748ea91 100644 --- a/src/commons.c +++ b/src/commons.c @@ -25,52 +25,24 @@ #include "commons.h" -ZakConfiConfi -*zak_confi_confi_copy (ZakConfiConfi *confi) +ZakBksBookmark +*zak_bks_bookmark_copy (ZakBksBookmark *bk) { - ZakConfiConfi *b; + ZakBksBookmark *b; - b = g_slice_new (ZakConfiConfi); - b->name = g_strdup (confi->name); - b->description = g_strdup (confi->description); + b = g_slice_new (ZakBksBookmark); + b->name = g_strdup (bk->name); + b->url = g_strdup (bk->url); return b; } void -zak_confi_confi_free (ZakConfiConfi *confi) +zak_bks_bookmark_free (ZakBksBookmark *bk) { - g_free (confi->name); - g_free (confi->description); - g_slice_free (ZakConfiConfi, confi); + g_free (bk->name); + g_free (bk->url); + g_slice_free (ZakBksBookmark, bk); } -G_DEFINE_BOXED_TYPE (ZakConfiConfi, zak_confi_confi, zak_confi_confi_copy, zak_confi_confi_free) - -ZakConfiKey -*zak_confi_key_copy (ZakConfiKey *key) -{ - ZakConfiKey *b; - - b = g_slice_new (ZakConfiKey); - b->config = g_strdup (key->config); - 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_confi_key_free (ZakConfiKey *key) -{ - g_free (key->config); - g_free (key->path); - g_free (key->key); - g_free (key->value); - g_free (key->description); - g_slice_free (ZakConfiKey, key); -} - -G_DEFINE_BOXED_TYPE (ZakConfiKey, zak_confi_key, zak_confi_key_copy, zak_confi_key_free) +G_DEFINE_BOXED_TYPE (ZakBksBookmark, zak_bks_bookmark, zak_bks_bookmark_copy, zak_bks_bookmark_free) diff --git a/src/commons.h b/src/commons.h index ae2e6d2..fe94925 100644 --- a/src/commons.h +++ b/src/commons.h @@ -25,36 +25,19 @@ G_BEGIN_DECLS -#define ZAK_CONFI_TYPE_CONFI (zak_confi_confi_get_type ()) +#define ZAK_BKS_TYPE_BOOKMARK (zak_bks_bookmark_get_type ()) -GType zak_confi_confi_get_type (); +GType zak_bks_bookmark_get_type (); -typedef struct _ZakConfiConfi ZakConfiConfi; -struct _ZakConfiConfi +typedef struct _ZakBksBookmark ZakBksBookmark; +struct _ZakBksBookmark { gchar *name; - gchar *description; + gchar *url; }; -ZakConfiConfi *zak_confi_confi_copy (ZakConfiConfi *confi); -void zak_confi_confi_free (ZakConfiConfi *confi); - -#define ZAK_CONFI_TYPE_KEY (zak_confi_key_get_type ()) - -GType zak_confi_key_get_type (); - -typedef struct _ZakConfiKey ZakConfiKey; -struct _ZakConfiKey - { - gchar *config; - gchar *path; - gchar *key; - gchar *value; - gchar *description; - }; - -ZakConfiKey *zak_confi_key_copy (ZakConfiKey *key); -void zak_confi_key_free (ZakConfiKey *key); +ZakBksBookmark *zak_bks_bookmakr_copy (ZakBksBookmark *bk); +void zak_bks_bookmark_free (ZakBksBookmark *bk); G_END_DECLS diff --git a/src/libzakbookmarks.h b/src/libzakbookmarks.h index f317f01..c64a6ec 100644 --- a/src/libzakbookmarks.h +++ b/src/libzakbookmarks.h @@ -33,9 +33,13 @@ G_BEGIN_DECLS #define ZAK_BKS_TYPE_BKS zak_bks_bks_get_type () G_DECLARE_FINAL_TYPE (ZakBksBks, zak_bks_bks, ZAK_BKS, BKS, GObject) -ZakBksBks *zak_bks_new (const gchar *cnc_string); +ZakBksBks *zak_bks_bks_new (const gchar *cnc_string); -PeasPluginInfo *zak_bks_get_plugin_info (ZakBksBks *bks); +PeasPluginInfo *zak_bks_bks_get_plugin_info (ZakBksBks *bks); + +GList *zak_bks_bks_get_bookmarks (ZakBksBks *bks); +void zak_bks_bks_add_bookmark (ZakBksBks *bks, ZakBksBookmark *bk); +void zak_bks_bks_remove_bookmark (ZakBksBks *bks, ZakBksBookmark *bk); void zak_bks_destroy (ZakBksBks *bks); -- 2.49.0