* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifdef HAVE_CONFIG_H
+#ifdef HAVE_BKSG_H
#include <config.h>
#endif
#include <libgdaex/libgdaex.h>
-#include "../../src/libzakconfi.h"
-#include "../../src/confipluggable.h"
+#include "../../src/libzakbookmarks.h"
+#include "../../src/bkspluggable.h"
#include "plgdb.h"
-static void zak_confi_pluggable_iface_init (ZakConfiPluggableInterface *iface);
+static void zak_bks_pluggable_iface_init (ZakBksPluggableInterface *iface);
-static gboolean zak_confi_db_plugin_initialize (ZakConfiPluggable *pluggable, const gchar *cnc_string);
+static gboolean zak_bks_db_plugin_initialize (ZakBksPluggable *pluggable, const gchar *cnc_string);
-static GdaDataModel *zak_confi_db_plugin_path_get_data_model (ZakConfiPluggable *pluggable, const gchar *path);
-static gchar *zak_confi_db_plugin_path_get_value_from_db (ZakConfiPluggable *pluggable, const gchar *path);
-static void zak_confi_db_plugin_get_children (ZakConfiPluggable *pluggable, GNode *parentNode, gint idParent, gchar *path);
+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_CONFI_DB_PLUGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_CONFI_TYPE_DB_PLUGIN, ZakConfiDBPluginPrivate))
+#define ZAK_BKS_DB_PLUGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_BKS_TYPE_DB_PLUGIN, ZakBksDBPluginPrivate))
-typedef struct _ZakConfiDBPluginPrivate ZakConfiDBPluginPrivate;
-struct _ZakConfiDBPluginPrivate
+typedef struct _ZakBksDBPluginPrivate ZakBksDBPluginPrivate;
+struct _ZakBksDBPluginPrivate
{
gchar *cnc_string;
GdaEx *gdaex;
- gint id_config;
+ gint id_bksg;
gchar *name;
gchar *description;
gchar *root;
gchar chrquot;
};
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (ZakConfiDBPlugin,
- zak_confi_db_plugin,
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (ZakBksDBPlugin,
+ zak_bks_db_plugin,
PEAS_TYPE_EXTENSION_BASE,
0,
- G_IMPLEMENT_INTERFACE_DYNAMIC (ZAK_CONFI_TYPE_PLUGGABLE,
- zak_confi_pluggable_iface_init))
+ G_IMPLEMENT_INTERFACE_DYNAMIC (ZAK_BKS_TYPE_PLUGGABLE,
+ zak_bks_pluggable_iface_init))
enum {
PROP_0,
PROP_CNC_STRING,
- PROP_NAME,
- PROP_DESCRIPTION,
- PROP_ROOT
};
static void
-zak_confi_db_plugin_set_property (GObject *object,
+zak_bks_db_plugin_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
gchar *sql;
- ZakConfiDBPlugin *plugin = ZAK_CONFI_DB_PLUGIN (object);
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (plugin);
+ ZakBksDBPlugin *plugin = ZAK_BKS_DB_PLUGIN (object);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (plugin);
switch (prop_id)
{
case PROP_CNC_STRING:
- zak_confi_db_plugin_initialize ((ZakConfiPluggable *)plugin, g_value_get_string (value));
- break;
-
- case PROP_NAME:
- break;
-
- case PROP_DESCRIPTION:
- break;
-
- case PROP_ROOT:
- priv->root = zak_confi_normalize_root (g_value_get_string (value));
+ zak_bks_db_plugin_initialize ((ZakBksPluggable *)plugin, g_value_get_string (value));
break;
default:
}
static void
-zak_confi_db_plugin_get_property (GObject *object,
+zak_bks_db_plugin_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- ZakConfiDBPlugin *plugin = ZAK_CONFI_DB_PLUGIN (object);
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (plugin);
+ ZakBksDBPlugin *plugin = ZAK_BKS_DB_PLUGIN (object);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (plugin);
switch (prop_id)
{
g_value_set_string (value, priv->cnc_string);
break;
- case PROP_NAME:
- g_value_set_string (value, priv->name);
- break;
-
- case PROP_DESCRIPTION:
- g_value_set_string (value, priv->description);
- break;
-
- case PROP_ROOT:
- g_value_set_string (value, priv->root);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
static void
-zak_confi_db_plugin_init (ZakConfiDBPlugin *plugin)
+zak_bks_db_plugin_init (ZakBksDBPlugin *plugin)
{
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (plugin);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (plugin);
priv->cnc_string = NULL;
priv->gdaex = NULL;
- priv->name = NULL;
- priv->description = NULL;
}
static void
-zak_confi_db_plugin_finalize (GObject *object)
+zak_bks_db_plugin_finalize (GObject *object)
{
- ZakConfiDBPlugin *plugin = ZAK_CONFI_DB_PLUGIN (object);
+ ZakBksDBPlugin *plugin = ZAK_BKS_DB_PLUGIN (object);
- G_OBJECT_CLASS (zak_confi_db_plugin_parent_class)->finalize (object);
+ G_OBJECT_CLASS (zak_bks_db_plugin_parent_class)->finalize (object);
}
static gboolean
-zak_confi_db_plugin_initialize (ZakConfiPluggable *pluggable, const gchar *cnc_string)
+zak_bks_db_plugin_initialize (ZakBksPluggable *pluggable, const gchar *cnc_string)
{
- ZakConfiDBPlugin *plugin = ZAK_CONFI_DB_PLUGIN (pluggable);
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (plugin);
+ ZakBksDBPlugin *plugin = ZAK_BKS_DB_PLUGIN (pluggable);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (plugin);
GString *gstr_cnc_string;
gchar **strs;
l = g_strv_length (strs);
for (i = 0; i < l; i++)
{
- if (g_str_has_prefix (strs[i], "CONFI_NAME="))
+ if (g_str_has_prefix (strs[i], "BKS_NAME="))
{
- priv->name = g_strdup (strs[i] + strlen ("CONFI_NAME="));
+ priv->name = g_strdup (strs[i] + strlen ("BKS_NAME="));
if (priv->name[strlen (priv->name)] == ';')
{
priv->name[strlen (priv->name)] = '\0';
priv->gdaex = gdaex_new_from_string (priv->cnc_string);
priv->chrquot = gdaex_get_chr_quoting (priv->gdaex);
- /* check if config exists */
+ /* check if bksg exists */
sql = g_strdup_printf ("SELECT id, name"
- " FROM configs"
+ " 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_config = gdaex_data_model_get_value_integer_at (dm, 0, 0);
+ priv->id_bksg = gdaex_data_model_get_value_integer_at (dm, 0, 0);
}
if (dm != NULL)
{
}
static GdaDataModel
-*zak_confi_db_plugin_path_get_data_model (ZakConfiPluggable *pluggable, const gchar *path)
+*zak_bks_db_plugin_path_get_data_model (ZakBksPluggable *pluggable, const gchar *path)
{
gchar **tokens;
gchar *sql;
guint id_parent;
GdaDataModel *dm;
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable);
if (path == NULL) return NULL;
{
sql = g_strdup_printf ("SELECT *"
" FROM %cvalues%c"
- " WHERE id_configs = %d"
+ " WHERE id_bksgs = %d"
" AND id_parent = %d"
" AND %ckey%c = '%s'",
priv->chrquot, priv->chrquot,
- priv->id_config,
+ priv->id_bksg,
id_parent,
priv->chrquot, priv->chrquot,
gdaex_strescape (token, NULL));
}
static gchar
-*zak_confi_db_plugin_path_get_value_from_db (ZakConfiPluggable *pluggable, const gchar *path)
+*zak_bks_db_plugin_path_get_value_from_db (ZakBksPluggable *pluggable, const gchar *path)
{
gchar *ret;
GdaDataModel *dm;
ret = NULL;
- dm = zak_confi_db_plugin_path_get_data_model (pluggable, path);
+ 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");
}
static void
-zak_confi_db_plugin_get_children (ZakConfiPluggable *pluggable, GNode *parentNode, gint idParent, gchar *path)
+zak_bks_db_plugin_get_children (ZakBksPluggable *pluggable, GNode *parentNode, gint idParent, gchar *path)
{
gchar *sql;
GdaDataModel *dm;
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable);
sql = g_strdup_printf ("SELECT *"
" FROM %cvalues%c"
- " WHERE id_configs = %d"
+ " WHERE id_bksgs = %d"
" AND id_parent = %d",
priv->chrquot, priv->chrquot,
- priv->id_config,
+ priv->id_bksg,
idParent);
dm = gdaex_query (priv->gdaex, sql);
for (i = 0; i < rows; i++)
{
GNode *newNode;
- ZakConfiKey *ck = g_new0 (ZakConfiKey, 1);
+ /* ZakBksKey *ck = g_new0 (ZakBksKey, 1); */
- ck->config = 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);
+ /* 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);
+ /* newNode = g_node_append_data (parentNode, ck); */
- zak_confi_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));
+ /* 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);
}
}
static GList
-*zak_confi_db_plugin_get_configs_list (ZakConfiPluggable *pluggable,
+*zak_bks_db_plugin_get_bksgs_list (ZakBksPluggable *pluggable,
const gchar *filter)
{
GList *lst;
- GdaDataModel *dmZakConfigs;
+ GdaDataModel *dmZakBksgs;
gchar *sql;
gchar *where;
guint row;
guint rows;
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable);
lst = NULL;
where = g_strdup ("");
}
- sql = g_strdup_printf ("SELECT * FROM configs%s", where);
+ sql = g_strdup_printf ("SELECT * FROM bksgs%s", where);
g_free (where);
- dmZakConfigs = gdaex_query (priv->gdaex, sql);
+ dmZakBksgs = gdaex_query (priv->gdaex, sql);
g_free (sql);
- if (dmZakConfigs != NULL)
+ if (dmZakBksgs != NULL)
{
- rows = gda_data_model_get_n_rows (dmZakConfigs);
+ rows = gda_data_model_get_n_rows (dmZakBksgs);
if (rows > 0)
{
for (row = 0; row < rows; row++)
{
- ZakConfiConfi *confi;
- confi = g_new0 (ZakConfiConfi, 1);
- confi->name = gdaex_data_model_get_field_value_stringify_at (dmZakConfigs, row, "name");
- confi->description = gdaex_data_model_get_field_value_stringify_at (dmZakConfigs, row, "description");
- lst = g_list_append (lst, confi);
+ /* 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
}
static gchar
-*zak_confi_db_plugin_path_get_value (ZakConfiPluggable *pluggable, const gchar *path)
+*zak_bks_db_plugin_path_get_value (ZakBksPluggable *pluggable, const gchar *path)
{
gchar *ret;
gchar *path_;
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable);
ret = NULL;
- path_ = zak_confi_path_normalize (pluggable, path);
if (path_ == NULL)
{
return NULL;
}
- ret = zak_confi_db_plugin_path_get_value_from_db (pluggable, path_);
+ ret = zak_bks_db_plugin_path_get_value_from_db (pluggable, path_);
return ret;
}
static gboolean
-zak_confi_db_plugin_path_set_value (ZakConfiPluggable *pluggable, const gchar *path, const gchar *value)
+zak_bks_db_plugin_path_set_value (ZakBksPluggable *pluggable, const gchar *path, const gchar *value)
{
GdaDataModel *dm;
gchar *sql;
gboolean ret;
- dm = zak_confi_db_plugin_path_get_data_model (pluggable, zak_confi_path_normalize (pluggable, path));
+ dm = zak_bks_db_plugin_path_get_data_model (pluggable, path);
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
+ 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_configs = %d"
+ " WHERE id_bksgs = %d"
" AND id = %d",
priv->chrquot, priv->chrquot,
gdaex_strescape (value, NULL),
- priv->id_config,
+ priv->id_bksg,
gdaex_data_model_get_field_value_integer_at (dm, 0, "id"));
ret = (gdaex_execute (priv->gdaex, sql) >= 0);
g_free (sql);
}
GNode
-*zak_confi_db_plugin_get_tree (ZakConfiPluggable *pluggable)
+*zak_bks_db_plugin_get_tree (ZakBksPluggable *pluggable)
{
gchar *path;
GNode *node;
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable);
path = g_strdup ("");
- ZakConfiKey *ck = g_new0 (ZakConfiKey, 1);
+ /* ZakBksKey *ck = g_new0 (ZakBksKey, 1); */
- ck->config = g_strdup (priv->name);
- ck->path = "";
- ck->key = g_strdup ("/");
- ck->value = "";
- ck->description = "";
+ /* ck->bksg = g_strdup (priv->name); */
+ /* ck->path = ""; */
+ /* ck->key = g_strdup ("/"); */
+ /* ck->value = ""; */
+ /* ck->description = ""; */
- node = g_node_new (ck);
+ /* node = g_node_new (ck); */
- zak_confi_db_plugin_get_children (pluggable, node, 0, path);
+ zak_bks_db_plugin_get_children (pluggable, node, 0, path);
return node;
}
-static ZakConfiConfi
-*zak_confi_db_plugin_add_config (ZakConfiPluggable *pluggable, const gchar *name, const gchar *description)
+static ZakBksBks
+*zak_bks_db_plugin_add_bksg (ZakBksPluggable *pluggable, const gchar *name, const gchar *description)
{
- ZakConfiConfi *cc;
+ ZakBksBks *cc;
gchar *sql;
gint id;
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable);
cc = NULL;
- id = gdaex_get_new_id (priv->gdaex, "configs", "id", NULL);
+ id = gdaex_get_new_id (priv->gdaex, "bksgs", "id", NULL);
- sql = g_strdup_printf ("INSERT INTO configs"
- " VALUES (%d, '%s', '%s')",
- id,
- gdaex_strescape (name, NULL),
- gdaex_strescape (description, 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 (ZakConfiConfi, 1);
- cc->name = g_strdup (name);
- cc->description = g_strdup (description);
+ /* cc = g_new0 (ZakBksBks, 1); */
+ /* cc->name = g_strdup (name); */
+ /* cc->description = g_strdup (description); */
}
g_free (sql);
}
static gboolean
-zak_confi_db_plugin_set_config (ZakConfiPluggable *pluggable,
+zak_bks_db_plugin_set_bksg (ZakBksPluggable *pluggable,
const gchar *name,
const gchar *description)
{
gboolean ret;
gchar *sql;
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable);
g_return_val_if_fail (name != NULL, FALSE);
ret = TRUE;
- sql = g_strdup_printf ("UPDATE configs"
- " SET name = '%s'"
- " WHERE id = %d",
- gdaex_strescape (name, NULL),
- priv->id_config);
+ 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;
if (description != NULL)
{
- sql = g_strdup_printf ("UPDATE configs"
- " SET description = '%s'"
- " WHERE id = %d",
- gdaex_strescape (description, NULL),
- priv->id_config);
+ 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;
return ret;
}
-static ZakConfiKey
-*zak_confi_db_plugin_add_key (ZakConfiPluggable *pluggable, const gchar *parent, const gchar *key, const gchar *value)
-{
- ZakConfiKey *ck;
- GdaDataModel *dmParent;
-
- gchar *sql;
- gint id;
- GdaDataModel *dm;
-
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
-
- gint id_parent;
- gchar *parent_;
- gchar *key_;
-
- gchar *path;
-
- ck = NULL;
- if (parent == NULL)
- {
- id_parent = 0;
- }
- else
- {
- parent_ = g_strstrip (g_strdup (parent));
- if (strcmp (parent_, "") == 0)
- {
- id_parent = 0;
- }
- else
- {
- dmParent = zak_confi_db_plugin_path_get_data_model (pluggable, zak_confi_path_normalize (pluggable, parent_));
- if (dmParent == NULL)
- {
- id_parent = -1;
- }
- else
- {
- id_parent = gdaex_data_model_get_field_value_integer_at (dmParent, 0, "id");
- }
- }
- }
-
- if (id_parent > -1)
- {
- key_ = g_strdup (key);
- g_strstrip (key_);
-
- /* find if key exists */
- sql = g_strdup_printf ("SELECT id"
- " FROM %cvalues%c"
- " WHERE id_configs = %d"
- " AND id_parent = %d"
- " AND key = '%s'",
- priv->chrquot, priv->chrquot,
- priv->id_config,
- id_parent,
- gdaex_strescape (key_, NULL));
- dm = gdaex_query (priv->gdaex, sql);
- g_free (sql);
- if (dm == NULL
- || gda_data_model_get_n_rows (dm) < 1)
- {
- id = 0;
-
- /* find new id */
- sql = g_strdup_printf ("SELECT MAX(id)"
- " FROM %cvalues%c"
- " WHERE id_configs = %d",
- priv->chrquot, priv->chrquot,
- priv->id_config);
- dm = gdaex_query (priv->gdaex, sql);
- g_free (sql);
- if (dm != NULL)
- {
- id = gdaex_data_model_get_value_integer_at (dm, 0, 0);
- g_object_unref (dm);
- }
- id++;
-
- sql = g_strdup_printf ("INSERT INTO %cvalues%c"
- " (id_configs, id, id_parent, %ckey%c, value)"
- " VALUES (%d, %d, %d, '%s', '%s')",
- priv->chrquot, priv->chrquot,
- priv->chrquot, priv->chrquot,
- priv->id_config,
- id,
- id_parent,
- gdaex_strescape (key_, NULL),
- "");
- if (gdaex_execute (priv->gdaex, sql) == -1)
- {
- /* TO DO */
- g_free (sql);
- return NULL;
- }
- g_free (sql);
- }
-
- ck = g_new0 (ZakConfiKey, 1);
- ck->config = g_strdup (priv->name);
- if (id_parent == 0)
- {
- ck->path = g_strdup ("");
- }
- else
- {
- ck->path = g_strdup (parent_);
- }
- ck->key = g_strdup (key_);
- ck->value = g_strdup ("");
- ck->description = g_strdup ("");
-
- g_free (key_);
- }
- g_free (parent_);
-
- if (ck != NULL)
- {
- if (g_strcmp0 (ck->path, "") != 0)
- {
- path = g_strconcat (ck->path, "/", key, NULL);
- }
- else
- {
- path = g_strdup (ck->key);
- }
-
- if (!zak_confi_db_plugin_path_set_value (pluggable, path, value))
- {
- ck = NULL;
- }
- else
- {
- ck->value = g_strdup (value);
- }
- g_free (path);
- }
-
- return ck;
-}
-
static gboolean
-zak_confi_db_plugin_key_set_key (ZakConfiPluggable *pluggable,
- ZakConfiKey *ck)
+zak_bks_db_plugin_delete_id_from_db_values (ZakBksPluggable *pluggable, gint id)
{
gboolean ret;
gchar *sql;
- GdaDataModel *dm;
-
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
-
- dm = zak_confi_db_plugin_path_get_data_model (pluggable, g_strdup_printf ("%s/%s", ck->path, ck->key));
- if (dm == NULL)
- {
- return FALSE;
- }
-
- sql = g_strdup_printf ("UPDATE %cvalues%c"
- " SET %ckey%c = '%s',"
- " value = '%s',"
- " description = '%s'"
- " WHERE id_configs = %d"
- " AND id = %d",
- priv->chrquot, priv->chrquot,
- priv->chrquot, priv->chrquot,
- gdaex_strescape (ck->key, NULL),
- gdaex_strescape (ck->value, NULL),
- gdaex_strescape (ck->description, NULL),
- priv->id_config,
- gdaex_data_model_get_field_value_integer_at (dm, 0, "id"));
-
- ret = (gdaex_execute (priv->gdaex, sql) >= 0);
- g_free (sql);
-
- return ret;
-}
-
-static ZakConfiKey
-*zak_confi_db_plugin_path_get_confi_key (ZakConfiPluggable *pluggable, const gchar *path)
-{
- GdaDataModel *dm;
- gchar *path_;
- ZakConfiKey *ck;
-
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
-
- path_ = zak_confi_path_normalize (pluggable, path);
- if (path_ == NULL)
- {
- return NULL;
- }
-
- dm = zak_confi_db_plugin_path_get_data_model (pluggable, path_);
- if (dm == NULL || gda_data_model_get_n_rows (dm) <= 0)
- {
- if (dm != NULL)
- {
- g_object_unref (dm);
- }
- return NULL;
- }
-
- ck = g_new0 (ZakConfiKey, 1);
- ck->config = g_strdup (priv->name);
- ck->path = g_strdup (path_);
- ck->key = gdaex_data_model_get_field_value_stringify_at (dm, 0, "key");
- ck->value = gdaex_data_model_get_field_value_stringify_at (dm, 0, "value");
- ck->description = gdaex_data_model_get_field_value_stringify_at (dm, 0, "description");
-
- if (dm != NULL)
- {
- g_object_unref (dm);
- }
-
- return ck;
-}
-
-static gboolean
-zak_confi_db_plugin_delete_id_from_db_values (ZakConfiPluggable *pluggable, gint id)
-{
- gboolean ret;
- gchar *sql;
-
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable);
sql = g_strdup_printf ("DELETE FROM %cvalues%c"
- " WHERE id_configs = %d"
+ " WHERE id_bksgs = %d"
" AND id = %d",
priv->chrquot, priv->chrquot,
- priv->id_config,
+ priv->id_bksg,
id);
if (gdaex_execute (priv->gdaex, sql) >= 0)
}
static gboolean
-zak_confi_db_plugin_remove_path_traverse_func (GNode *node, gpointer data)
-{
- GdaDataModel *dm;
- ZakConfiPluggable* pluggable;
-
- pluggable = (ZakConfiPluggable *)data;
- ZakConfiKey *ck = (ZakConfiKey *)node->data;
- if (g_strcmp0 (ck->value, "") != 0)
- {
- dm = zak_confi_db_plugin_path_get_data_model (pluggable, g_strdup_printf ("%s/%s", ck->path, ck->key));
- zak_confi_db_plugin_delete_id_from_db_values (pluggable, gdaex_data_model_get_field_value_integer_at (dm, 0, "id"));
- }
-
- return FALSE;
-}
-
-static gboolean
-zak_confi_db_plugin_remove_path (ZakConfiPluggable *pluggable, const gchar *path)
+zak_bks_db_plugin_remove_path (ZakBksPluggable *pluggable, const gchar *path)
{
gboolean ret = FALSE;
GdaDataModel *dm;
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable);
- dm = zak_confi_db_plugin_path_get_data_model (pluggable, zak_confi_path_normalize (pluggable, path));
+ dm = zak_bks_db_plugin_path_get_data_model (pluggable, path);
if (dm != NULL && gda_data_model_get_n_rows (dm) > 0)
{
GNode *node;
gint id = gdaex_data_model_get_field_value_integer_at (dm, 0, "id");
- ZakConfiKey *ck = g_new0 (ZakConfiKey, 1);
+ /* ZakBksKey *ck = g_new0 (ZakBksKey, 1); */
- ck->config = g_strdup (priv->name);
- ck->path = path_;
- ck->key = gdaex_data_model_get_field_value_stringify_at (dm, 0, "key");
- ck->value = "";
- ck->description = "";
+ /* 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_confi_db_plugin_get_children (pluggable, node, id, path_);
+ /* 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_confi_db_plugin_remove_path_traverse_func, (gpointer)pluggable);
+ /* 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_confi_db_plugin_delete_id_from_db_values (pluggable, id);
+ ret = zak_bks_db_plugin_delete_id_from_db_values (pluggable, id);
}
else
{
}
static gboolean
-zak_confi_db_plugin_remove (ZakConfiPluggable *pluggable)
+zak_bks_db_plugin_remove (ZakBksPluggable *pluggable)
{
gboolean ret;
gchar *sql;
- ZakConfiDBPluginPrivate *priv = ZAK_CONFI_DB_PLUGIN_GET_PRIVATE (pluggable);
+ ZakBksDBPluginPrivate *priv = ZAK_BKS_DB_PLUGIN_GET_PRIVATE (pluggable);
ret = TRUE;
- sql = g_strdup_printf ("DELETE FROM %cvalues%c WHERE id_configs = %d",
+ sql = g_strdup_printf ("DELETE FROM %cvalues%c WHERE id_bksgs = %d",
priv->chrquot,
priv->chrquot,
- priv->id_config);
+ priv->id_bksg);
if (gdaex_execute (priv->gdaex, sql) == -1)
{
g_free (sql);
else
{
g_free (sql);
- sql = g_strdup_printf ("DELETE FROM configs WHERE id = %d",
- priv->id_config);
+ sql = g_strdup_printf ("DELETE FROM bksgs WHERE id = %d",
+ priv->id_bksg);
if (gdaex_execute (priv->gdaex, sql) == -1)
{
ret = FALSE;
}
static void
-zak_confi_db_plugin_class_init (ZakConfiDBPluginClass *klass)
+zak_bks_db_plugin_class_init (ZakBksDBPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (ZakConfiDBPluginPrivate));
+ g_type_class_add_private (object_class, sizeof (ZakBksDBPluginPrivate));
- object_class->set_property = zak_confi_db_plugin_set_property;
- object_class->get_property = zak_confi_db_plugin_get_property;
- object_class->finalize = zak_confi_db_plugin_finalize;
+ object_class->set_property = zak_bks_db_plugin_set_property;
+ object_class->get_property = zak_bks_db_plugin_get_property;
+ object_class->finalize = zak_bks_db_plugin_finalize;
g_object_class_override_property (object_class, PROP_CNC_STRING, "cnc_string");
- g_object_class_override_property (object_class, PROP_NAME, "name");
- g_object_class_override_property (object_class, PROP_DESCRIPTION, "description");
- g_object_class_override_property (object_class, PROP_ROOT, "root");
}
static void
-zak_confi_pluggable_iface_init (ZakConfiPluggableInterface *iface)
+zak_bks_pluggable_iface_init (ZakBksPluggableInterface *iface)
{
- iface->initialize = zak_confi_db_plugin_initialize;
- iface->get_configs_list = zak_confi_db_plugin_get_configs_list;
- iface->path_get_value = zak_confi_db_plugin_path_get_value;
- iface->path_set_value = zak_confi_db_plugin_path_set_value;
- iface->get_tree = zak_confi_db_plugin_get_tree;
- iface->add_config = zak_confi_db_plugin_add_config;
- iface->set_config = zak_confi_db_plugin_set_config;
- iface->add_key = zak_confi_db_plugin_add_key;
- iface->key_set_key = zak_confi_db_plugin_key_set_key;
- iface->path_get_confi_key = zak_confi_db_plugin_path_get_confi_key;
- iface->remove_path = zak_confi_db_plugin_remove_path;
- iface->remove = zak_confi_db_plugin_remove;
+ iface->initialize = zak_bks_db_plugin_initialize;
}
static void
-zak_confi_db_plugin_class_finalize (ZakConfiDBPluginClass *klass)
+zak_bks_db_plugin_class_finalize (ZakBksDBPluginClass *klass)
{
}
G_MODULE_EXPORT void
peas_register_types (PeasObjectModule *module)
{
- zak_confi_db_plugin_register_type (G_TYPE_MODULE (module));
+ zak_bks_db_plugin_register_type (G_TYPE_MODULE (module));
peas_object_module_register_extension_type (module,
- ZAK_CONFI_TYPE_PLUGGABLE,
- ZAK_CONFI_TYPE_DB_PLUGIN);
+ ZAK_BKS_TYPE_PLUGGABLE,
+ ZAK_BKS_TYPE_DB_PLUGIN);
}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __ZAK_CONFI_DB_PLUGIN_H__
-#define __ZAK_CONFI_DB_PLUGIN_H__
+#ifndef __ZAK_BKS_DB_PLUGIN_H__
+#define __ZAK_BKS_DB_PLUGIN_H__
#include <libpeas/peas.h>
G_BEGIN_DECLS
-#define ZAK_CONFI_TYPE_DB_PLUGIN (zak_confi_db_plugin_get_type ())
-#define ZAK_CONFI_DB_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ZAK_CONFI_TYPE_DB_PLUGIN, ZakConfiDBPlugin))
-#define ZAK_CONFI_DB_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ZAK_CONFI_TYPE_DB_PLUGIN, ZakConfiDBPlugin))
-#define ZAK_CONFI_IS_DB_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ZAK_CONFI_TYPE_DB_PLUGIN))
-#define ZAK_CONFI_IS_DB_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ZAK_CONFI_TYPE_DB_PLUGIN))
-#define ZAK_CONFI_DB_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ZAK_CONFI_TYPE_DB_PLUGIN, ZakConfiDBPluginClass))
+#define ZAK_BKS_TYPE_DB_PLUGIN (zak_bks_db_plugin_get_type ())
+#define ZAK_BKS_DB_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ZAK_BKS_TYPE_DB_PLUGIN, ZakBksDBPlugin))
+#define ZAK_BKS_DB_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ZAK_BKS_TYPE_DB_PLUGIN, ZakBksDBPlugin))
+#define ZAK_BKS_IS_DB_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ZAK_BKS_TYPE_DB_PLUGIN))
+#define ZAK_BKS_IS_DB_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ZAK_BKS_TYPE_DB_PLUGIN))
+#define ZAK_BKS_DB_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ZAK_BKS_TYPE_DB_PLUGIN, ZakBksDBPluginClass))
-typedef struct _ZakConfiDBPlugin ZakConfiDBPlugin;
-typedef struct _ZakConfiDBPluginClass ZakConfiDBPluginClass;
+typedef struct _ZakBksDBPlugin ZakBksDBPlugin;
+typedef struct _ZakBksDBPluginClass ZakBksDBPluginClass;
-struct _ZakConfiDBPlugin {
+struct _ZakBksDBPlugin {
PeasExtensionBase parent_instance;
};
-struct _ZakConfiDBPluginClass {
+struct _ZakBksDBPluginClass {
PeasExtensionBaseClass parent_class;
};
-GType zak_confi_db_plugin_get_type (void) G_GNUC_CONST;
+GType zak_bks_db_plugin_get_type (void) G_GNUC_CONST;
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
G_END_DECLS
-#endif /* __ZAK_CONFI_DB_PLUGIN_H__ */
+#endif /* __ZAK_BKS_DB_PLUGIN_H__ */
*/
#ifdef HAVE_BKSG_H
- #include <bksg.h>
+ #include <config.h>
#endif
#include <string.h>
static gchar *pluginsdir;
-enum
-{
- PROP_0,
- PROP_ID_BKSG,
- PROP_NAME,
- PROP_DESCRIPTION,
- PROP_ROOT
-};
-
-static void zak_bks_class_init (ZakBksClass *klass);
-static void zak_bks_init (ZakBks *bks);
+static void zak_bks_bks_class_init (ZakBksBksClass *klass);
+static void zak_bks_bks_init (ZakBksBks *bks);
-static void zak_bks_set_property (GObject *object,
+static void zak_bks_bks_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
-static void zak_bks_get_property (GObject *object,
+static void zak_bks_bks_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
-static ZakBksPluggable *zak_bks_get_bks_pluggable_from_cnc_string (const gchar *cnc_string);
-
-#define ZAK_BKS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_TYPE_BKS, ZakBksPrivate))
-
-typedef struct _ZakBksPrivate ZakBksPrivate;
-struct _ZakBksPrivate
+struct _ZakBksBks
{
- gint id_bksg;
- gchar *name;
- gchar *description;
- gchar *root;
- GHashTable *values;
+ GObject parent_instance;
ZakBksPluggable *pluggable;
};
-G_DEFINE_TYPE (ZakBks, zak_bks, G_TYPE_OBJECT)
+G_DEFINE_TYPE (ZakBksBks, zak_bks_bks, G_TYPE_OBJECT)
#ifdef G_OS_WIN32
static HMODULE backend_dll = NULL;
#endif
static void
-zak_bks_class_init (ZakBksClass *klass)
+zak_bks_bks_class_init (ZakBksBksClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (ZakBksPrivate));
-
- object_class->set_property = zak_bks_set_property;
- object_class->get_property = zak_bks_get_property;
+ object_class->set_property = zak_bks_bks_set_property;
+ object_class->get_property = zak_bks_bks_get_property;
}
static void
-zak_bks_init (ZakBks *bks)
+zak_bks_bks_init (ZakBksBks *bks)
{
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- priv->pluggable = NULL;
}
static ZakBksPluggable
}
/**
- * zak_bks_new:
+ * zak_bks_bks_new:
* @cnc_string: the connection string.
*
* Returns: (transfer none): the newly created #ZakBks object, or NULL if it fails.
*/
-ZakBks
-*zak_bks_new (const gchar *cnc_string)
+ZakBksBks
+*zak_bks_bks_new (const gchar *cnc_string)
{
- ZakBks *bks;
- ZakBksPrivate *priv;
+ ZakBksBks *bks;
ZakBksPluggable *pluggable;
g_return_val_if_fail (cnc_string != NULL, NULL);
pluggable = zak_bks_get_bks_pluggable_from_cnc_string (cnc_string);
if (pluggable != NULL)
{
- bks = ZAK_BKS (g_object_new (zak_bks_get_type (), NULL));
- priv = ZAK_BKS_GET_PRIVATE (bks);
- priv->pluggable = pluggable;
+ bks = ZAK_BKS_BKS (g_object_new (zak_bks_bks_get_type (), NULL));
+ bks->pluggable = pluggable;
}
return bks;
}
PeasPluginInfo
-*zak_bks_get_plugin_info (ZakBks *bks)
+*zak_bks_bks_get_plugin_info (ZakBksBks *bks)
{
PeasPluginInfo *ppinfo;
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- if (priv->pluggable == NULL)
+ if (bks->pluggable == NULL)
{
g_warning ("Not initialized.");
ppinfo = NULL;
}
else
{
- ppinfo = peas_extension_base_get_plugin_info ((PeasExtensionBase *)priv->pluggable);
+ ppinfo = peas_extension_base_get_plugin_info ((PeasExtensionBase *)bks->pluggable);
}
return ppinfo;
}
/**
- * zak_bks_get_bksgs_list:
- * @cnc_string: the connection string to use to connect to database that
- * contains bksguration.
- * @filter: (nullable):
- *
- * Returns: (element-type ZakBksBks) (transfer container): a #GList of #ZakBksBks. If there's no bksgurations, returns a valid
- * #GList but with a unique NULL element.
- */
-GList
-*zak_bks_get_bksgs_list (const gchar *cnc_string,
- const gchar *filter)
-{
- ZakBksPluggable *pluggable;
- GList *lst;
-
- pluggable = zak_bks_get_bks_pluggable_from_cnc_string (cnc_string);
-
- if (pluggable == NULL)
- {
- g_warning ("Not initialized.");
- lst = NULL;
- }
- else
- {
- lst = zak_bks_pluggable_get_bksgs_list (pluggable, filter);
- }
-
- return lst;
-}
-
-/**
- * zak_bks_get_bks_bks:
- * @bks:
- *
- * Returns: a #ZakBksBks struct.
- */
-ZakBksBks
-*zak_bks_get_bks_bks (ZakBks *bks)
-{
- ZakBksBks *cc;
-
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- cc = g_new0 (ZakBksBks, 1);
- cc->name = g_strdup (priv->name);
- cc->description = g_strdup (priv->description);
-
- return cc;
-}
-
-/**
- * zak_bks_add_bksg:
- * @cnc_string:
- * @name:
- * @description:
+ * zak_bks_bks_destroy:
+ * @bks: a #ZakBksBks object.
*
- * Returns: a #ZakBksBks struct just rceated.
- */
-ZakBksBks
-*zak_bks_add_bksg (const gchar *cnc_string,
- const gchar *name,
- const gchar *description)
-{
- ZakBksPluggable *pluggable;
- ZakBksBks *cc;
-
- pluggable = zak_bks_get_bks_pluggable_from_cnc_string (cnc_string);
-
- if (pluggable == NULL)
- {
- g_warning ("Not initialized.");
- cc = NULL;
- }
- else
- {
- cc = zak_bks_pluggable_add_bksg (pluggable, name, description);
- }
-
- return cc;
-}
-
-static gboolean
-add_traverse_func (GNode *node,
- gpointer data)
-{
- ZakBksKey *ck = (ZakBksKey *)node->data;
-
- if (g_strcmp0 (ck->key, "") != 0
- && g_strcmp0 (ck->key, "/") != 0)
- {
- zak_bks_add_key ((ZakBks *)data, ck->path, ck->key, ck->value);
- }
-
- return FALSE;
-}
-
-/**
- * zak_bks_add_bksg_from_bks:
- * @bks_source:
- * @cnc_string:
- * @name_new:
- * @description_new:
- *
- * Returns: a #ZakBksBks struct just created.
- */
-ZakBksBks
-*zak_bks_add_bksg_from_bks (ZakBks *bks_source,
- const gchar *cnc_string,
- const gchar *name_new,
- const gchar *description_new)
-{
- ZakBks *bks;
- ZakBksBks *cc;
-
- GNode *tree;
-
- gchar *bks_name;
-
- cc = zak_bks_add_bksg (cnc_string, name_new, description_new);
- if (cc != NULL)
- {
- tree = zak_bks_get_tree (bks_source);
- if (tree != NULL)
- {
- bks_name = g_strdup_printf ("%s;BKS_NAME=%s", cnc_string, cc->name);
-
- bks = zak_bks_new (bks_name);
-
- if (bks != NULL)
- {
- g_node_traverse (tree, G_PRE_ORDER, G_TRAVERSE_ALL, -1, add_traverse_func, (gpointer)bks);
- }
-
- g_free (bks_name);
- }
- else
- {
- g_warning ("ZakBks source is empty.");
- }
- }
-
- return cc;
-}
-
-/**
- * zak_bks_get_tree:
- * @bks: a #ZakBks object.
- *
- * Returns: a #GNode.
- */
-GNode
-*zak_bks_get_tree (ZakBks *bks)
-{
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- if (priv->pluggable != NULL)
- {
- return zak_bks_pluggable_get_tree (priv->pluggable);
- }
- else
- {
- return NULL;
- }
-}
-
-/**
- * zak_bks_normalize_set_root:
- * @bks: a #ZakBks object.
- * @root: the root.
- *
- * Returns: a correct value for root property.
- */
-gchar
-*zak_bks_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_bks_set_root:
- * @bks: a #ZakBks object.
- * @root: the root.
- *
- */
-gboolean
-zak_bks_set_root (ZakBks *bks, const gchar *root)
-{
- gboolean ret;
-
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- if (priv->pluggable == NULL)
- {
- g_warning ("Not initialized.");
- ret = FALSE;
- }
- else
- {
- g_object_set (priv->pluggable, "root", root, NULL);
- ret = TRUE;
- }
-
- return ret;
-}
-
-/**
- * zak_bks_set_bksg:
- * @bks: a #ZakBks object.
- * @name:
- * @description:
- *
- * Returns:
- */
-gboolean
-zak_bks_set_bksg (ZakBks *bks,
- const gchar *name,
- const gchar *description)
-{
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- if (priv->pluggable == NULL)
- {
- g_warning ("Not initialized.");
- return FALSE;
- }
- else
- {
- return zak_bks_pluggable_set_bksg (priv->pluggable,
- name,
- description);
- }
-}
-
-/**
- * zak_bks_add_key:
- * @bks: a #ZakBks object.
- * @parent: the path where add the key.
- * @key: the key's name.
- * @value: the key's value.
- *
- * Returns: a #ZakBksgKey struct filled with data from the key just added.
- */
-ZakBksKey
-*zak_bks_add_key (ZakBks *bks, const gchar *parent, const gchar *key, const gchar *value)
-{
- ZakBksKey *ck;
-
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- if (priv->pluggable == NULL)
- {
- g_warning ("Not initialized.");
- ck = NULL;
- }
- else
- {
- ck = zak_bks_pluggable_add_key (priv->pluggable, parent, key, value);
- }
-
- return ck;
-}
-
-/**
- * zak_bks_key_set_key:
- * @bks: a #ZakBks object.
- * @ck: a #ZakBksKey struct.
- *
- */
-gboolean
-zak_bks_key_set_key (ZakBks *bks,
- ZakBksKey *ck)
-{
- gboolean ret;
-
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- if (priv->pluggable == NULL)
- {
- g_warning ("Not initialized.");
- ret = FALSE;
- }
- else
- {
- ret = zak_bks_pluggable_key_set_key (priv->pluggable, ck);
- }
-
- return ret;
-}
-
-/**
- * zak_bks_remove_path:
- * @bks: a #ZakBks object.
- * @path: the path to remove.
- *
- * Removes @path and every child key.
- */
-gboolean
-zak_bks_remove_path (ZakBks *bks, const gchar *path)
-{
- gboolean ret;
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- if (priv->pluggable == NULL)
- {
- g_warning ("Not initialized.");
- ret = FALSE;
- }
- else
- {
- ret = zak_bks_pluggable_remove_path (priv->pluggable, path);
- }
-
- return ret;
-}
-
-/**
- * zak_bks_path_get_value:
- * @bks: a #ZakBks object.
- * @path: the path from which retrieving the value.
- *
- * Returns: the bksguration's value as a string.
- */
-gchar
-*zak_bks_path_get_value (ZakBks *bks, const gchar *path)
-{
- gchar *ret;
-
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- if (priv->pluggable == NULL)
- {
- g_warning ("Not initialized.");
- ret = NULL;
- }
- else
- {
- ret = zak_bks_pluggable_path_get_value (priv->pluggable, path);
- }
-
- return ret;
-}
-
-/**
- * zak_bks_path_set_value:
- * @bks: a #ZakBks object.
- * @path: the key's path.
- * @value: the value to set.
- *
- */
-gboolean
-zak_bks_path_set_value (ZakBks *bks, const gchar *path, const gchar *value)
-{
- gboolean ret;
-
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- if (priv->pluggable == NULL)
- {
- g_warning ("Not initialized.");
- ret = FALSE;
- }
- else
- {
- ret = zak_bks_pluggable_path_set_value (priv->pluggable, path, value);
- }
-
- return ret;
-}
-
-/**
- * zak_bks_path_get_bks_key:
- * @bks: a #ZakBks object.
- * @path: the key's path to get.
- *
- * Returns: (transfer full): a #ZakBksKey from @path
- */
-ZakBksKey
-*zak_bks_path_get_bks_key (ZakBks *bks, const gchar *path)
-{
- ZakBksKey *ck;
-
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- if (priv->pluggable == NULL)
- {
- g_warning ("Not initialized.");
- ck = NULL;
- }
- else
- {
- ck = zak_bks_pluggable_path_get_bks_key (priv->pluggable, path);
- }
-
- return ck;
-}
-
-/**
- * zak_bks_remove:
- * @bks: a #ZakBks object.
- *
- * Remove a bksguration from databases and destroy the relative object.
- */
-gboolean
-zak_bks_remove (ZakBks *bks)
-{
- gboolean ret;
-
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- if (priv->pluggable == NULL)
- {
- g_warning ("Not initialized.");
- ret = FALSE;
- }
- else
- {
- ret = zak_bks_pluggable_remove (priv->pluggable);
- }
-
- if (ret)
- {
- zak_bks_destroy (bks);
- }
-
- return ret;
-}
-
-/**
- * zak_bks_destroy:
- * @bks: a #ZakBks object.
- *
- * Destroy the #ZakBks object, freeing memory.
+ * Destroy the #ZakBksBks object, freeing memory.
*/
void
-zak_bks_destroy (ZakBks *bks)
-{
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
-
- g_free (priv->name);
- g_free (priv->description);
- g_free (priv->root);
- g_object_unref (priv->pluggable);
-}
-
-/**
- * zak_bks_path_normalize:
- * @pluggable: a #ZakBksPluggable object.
- *
- * Returns: a normalize path (with root).
- */
-gchar
-*zak_bks_path_normalize (ZakBksPluggable *pluggable, const gchar *path)
+zak_bks_bks_destroy (ZakBksBks *bks)
{
- 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;
+ g_object_unref (bks->pluggable);
}
/* PRIVATE */
static void
-zak_bks_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+zak_bks_bks_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
{
gchar *sql;
- ZakBks *bks = ZAK_BKS (object);
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
+ ZakBksBks *bks = ZAK_BKS_BKS (object);
switch (property_id)
{
}
static void
-zak_bks_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+zak_bks_bks_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
{
- ZakBks *bks = ZAK_BKS (object);
- ZakBksPrivate *priv = ZAK_BKS_GET_PRIVATE (bks);
+ ZakBksBks *bks = ZAK_BKS_BKS (object);
switch (property_id)
{
/*
- * confipluggable.c
- * This file is part of libzakconfi
+ * bkspluggable.c
+ * This file is part of libzakbookmarks
*
- * Copyright (C) 2014-2016 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2019 Andrea Zagli <azagli@libero.it>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published by
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifdef HAVE_CONFIG_H
+#ifdef HAVE_BKSG_H
#include <config.h>
#endif
-#include "confipluggable.h"
+#include "bkspluggable.h"
/**
- * SECTION:confipluggable
+ * SECTION:bkspluggable
* @short_description: Interface for pluggable plugins.
* @see_also: #PeasExtensionSet
*
**/
-G_DEFINE_INTERFACE(ZakConfiPluggable, zak_confi_pluggable, G_TYPE_OBJECT)
+G_DEFINE_INTERFACE(ZakBksPluggable, zak_bks_pluggable, G_TYPE_OBJECT)
void
-zak_confi_pluggable_default_init (ZakConfiPluggableInterface *iface)
+zak_bks_pluggable_default_init (ZakBksPluggableInterface *iface)
{
static gboolean initialized = FALSE;
if (!initialized)
{
/**
- * ZakConfiPluggable:cnc_string:
+ * ZakBksPluggable:cnc_string:
*
*/
g_object_interface_install_property (iface,
"",
G_PARAM_READWRITE));
- /**
- * ZakConfiPluggable:name:
- *
- */
- g_object_interface_install_property (iface,
- g_param_spec_string ("name",
- "Configuraton Name",
- "The configuration name",
- "",
- G_PARAM_READABLE));
-
- /**
- * ZakConfiPluggable:description:
- *
- */
- g_object_interface_install_property (iface,
- g_param_spec_string ("description",
- "Configuraton Description",
- "The configuration description",
- "",
- G_PARAM_READABLE));
-
- /**
- * ZakConfiPluggable:root:
- *
- */
- g_object_interface_install_property (iface,
- g_param_spec_string ("root",
- "Configuraton Root",
- "The configuration root",
- "/",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
initialized = TRUE;
}
}
/**
- * zak_confi_pluggable_initialize:
- * @pluggable: A #ZakConfiPluggable.
+ * zak_bks_pluggable_initialize:
+ * @pluggable: A #ZakBksPluggable.
* @cnc_string: The connection string.
*
* Initialize the backend.
* Returns: #TRUE if success.
*/
gboolean
-zak_confi_pluggable_initialize (ZakConfiPluggable *pluggable, const gchar *cnc_string)
+zak_bks_pluggable_initialize (ZakBksPluggable *pluggable, const gchar *cnc_string)
{
- ZakConfiPluggableInterface *iface;
+ ZakBksPluggableInterface *iface;
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
+ g_return_val_if_fail (ZAK_BKS_IS_PLUGGABLE (pluggable), FALSE);
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
+ iface = ZAK_BKS_PLUGGABLE_GET_IFACE (pluggable);
g_return_val_if_fail (iface->initialize != NULL, FALSE);
return iface->initialize (pluggable, cnc_string);
}
-
-/**
- * zak_confi_pluggable_get_configs_list:
- * @pluggable: A #ZakConfiPluggable.
- * @filter: (nullable):
- *
- * Returns: (element-type ZakConfi) (transfer container): a #GList of #ZakConfi. If there's no configurations, returns a valid
- * #GList but with a unique NULL element.
-*/
-GList
-*zak_confi_pluggable_get_configs_list (ZakConfiPluggable *pluggable, const gchar *filter)
-{
- ZakConfiPluggableInterface *iface;
-
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
-
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
- g_return_val_if_fail (iface->get_configs_list != NULL, FALSE);
-
- return iface->get_configs_list (pluggable, filter);
-}
-
-/**
- * zak_confi_pluggable_path_get_value:
- * @pluggable: A #ZakConfiPluggable.
- * @path:
- *
- * Returns: the value of the @path.
-*/
-gchar
-*zak_confi_pluggable_path_get_value (ZakConfiPluggable *pluggable, const gchar *path)
-{
- ZakConfiPluggableInterface *iface;
-
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
-
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
- g_return_val_if_fail (iface->path_get_value != NULL, FALSE);
-
- return iface->path_get_value (pluggable, path);
-}
-
-/**
- * zak_confi_pluggable_path_set_value:
- * @pluggable: a #ZakConfiPluggable object.
- * @path: the key's path.
- * @value: the value to set.
- *
- */
-gboolean
-zak_confi_pluggable_path_set_value (ZakConfiPluggable *pluggable, const gchar *path, const gchar *value)
-{
- ZakConfiPluggableInterface *iface;
-
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
-
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
- g_return_val_if_fail (iface->path_set_value != NULL, FALSE);
-
- return iface->path_set_value (pluggable, path, value);
-}
-
-/**
- * zak_confi_pluggable_get_tree:
- * @pluggable: a #ZakConfiPluggable object.
- *
- * Returns: a #GNode with the entire tree of configurations.
- */
-GNode
-*zak_confi_pluggable_get_tree (ZakConfiPluggable *pluggable)
-{
- ZakConfiPluggableInterface *iface;
-
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
-
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
- g_return_val_if_fail (iface->get_tree != NULL, FALSE);
-
- return iface->get_tree (pluggable);
-}
-
-/**
- * zak_confi_pluggable_add_config:
- * @pluggable: a #ZakConfiPluggable object.
- * @name: the name of the config..
- * @description: the config's description.
- *
- * Returns: a #ZakConfiConfi struct filled with data from the key just added.
- */
-ZakConfiConfi
-*zak_confi_pluggable_add_config (ZakConfiPluggable *pluggable, const gchar *name, const gchar *description)
-{
- ZakConfiPluggableInterface *iface;
-
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
-
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
- g_return_val_if_fail (iface->add_config != NULL, FALSE);
-
- return iface->add_config (pluggable, name, description);
-}
-
-/**
- * zak_confi_pluggable_set_config:
- * @pluggable: a #ZakConfiPluggable object.
- * @name: the name of the config..
- * @description: the config's description.
- *
- * Returns:
- */
-gboolean
-zak_confi_pluggable_set_config (ZakConfiPluggable *pluggable, const gchar *name, const gchar *description)
-{
- ZakConfiPluggableInterface *iface;
-
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
-
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
- g_return_val_if_fail (iface->set_config != NULL, FALSE);
-
- return iface->set_config (pluggable, name, description);
-}
-
-/**
- * zak_confi_pluggable_add_key:
- * @pluggable: a #ZakConfiPluggable object.
- * @parent: the path where add the key.
- * @key: the key's name.
- * @value: the key's value.
- *
- * Returns: a #ZakConfiKey struct filled with data from the key just added.
- */
-ZakConfiKey
-*zak_confi_pluggable_add_key (ZakConfiPluggable *pluggable, const gchar *parent, const gchar *key, const gchar *value)
-{
- ZakConfiPluggableInterface *iface;
-
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
-
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
- g_return_val_if_fail (iface->add_key != NULL, FALSE);
-
- return iface->add_key (pluggable, parent, key, value);
-}
-
-/**
- * zak_confi_pluggable_key_set_key:
- * @pluggable: a #ZakConfiPluggable object.
- * @ck: a #ZakConfiKey struct.
- *
- */
-gboolean
-zak_confi_pluggable_key_set_key (ZakConfiPluggable *pluggable,
- ZakConfiKey *ck)
-{
- ZakConfiPluggableInterface *iface;
-
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
-
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
- g_return_val_if_fail (iface->key_set_key != NULL, FALSE);
-
- return iface->key_set_key (pluggable, ck);
-}
-
-/**
- * zak_confi_pluggable_path_get_confi_key:
- * @pluggable: a #ZakConfiPluggable object.
- * @path: the key's path to get.
- *
- * Returns: (transfer full): a #ZakConfiKey from @path
- */
-ZakConfiKey
-*zak_confi_pluggable_path_get_confi_key (ZakConfiPluggable *pluggable, const gchar *path)
-{
- ZakConfiPluggableInterface *iface;
-
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
-
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
- g_return_val_if_fail (iface->path_get_confi_key != NULL, FALSE);
-
- return iface->path_get_confi_key (pluggable, path);
-}
-
-/**
- * zak_confi_pluggable_remove_path:
- * @pluggable: a #ZakConfiPluggable object.
- * @path: the path to remove.
- *
- * Removes @path and every child key.
- */
-gboolean
-zak_confi_pluggable_remove_path (ZakConfiPluggable *pluggable, const gchar *path)
-{
- ZakConfiPluggableInterface *iface;
-
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
-
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
- g_return_val_if_fail (iface->remove_path != NULL, FALSE);
-
- return iface->remove_path (pluggable, path);
-}
-
-/**
- * zak_confi_pluggable_remove:
- * @pluggable: a #ZakConfiPluggable object.
- *
- * Remove a configuration from databases and destroy the relative object.
- */
-gboolean
-zak_confi_pluggable_remove (ZakConfiPluggable *pluggable)
-{
- ZakConfiPluggableInterface *iface;
-
- g_return_val_if_fail (ZAK_CONFI_IS_PLUGGABLE (pluggable), FALSE);
-
- iface = ZAK_CONFI_PLUGGABLE_GET_IFACE (pluggable);
- g_return_val_if_fail (iface->remove != NULL, FALSE);
-
- return iface->remove (pluggable);
-}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef __ZAK_BOOKMAKRS_PLUGGABLE_H__
+#ifndef __ZAK_BOOKMARKS_PLUGGABLE_H__
#define __ZAK_BOOKMARKS_PLUGGABLE_H__
#include <glib-object.h>
/* Virtual public methods */
gboolean (*initialize) (ZakBksPluggable *pluggable, const gchar *cnc_string);
- GList *(*get_bksgs_list) (ZakBksPluggable *pluggable,
- const gchar *filter);
- gchar *(*path_get_value) (ZakBksPluggable *pluggable, const gchar *path);
- gboolean (*path_set_value) (ZakBksPluggable *pluggable,
- const gchar *path,
- const gchar *value);
- GNode *(*get_tree) (ZakBksPluggable *pluggable);
- ZakBksBks *(*add_bksg) (ZakBksPluggable *pluggable,
- const gchar *name,
- const gchar *description);
- gboolean (*set_bksg) (ZakBksPluggable *pluggable,
- const gchar *name,
- const gchar *description);
- ZakBksKey *(*add_key) (ZakBksPluggable *pluggable,
- const gchar *parent,
- const gchar *key,
- const gchar *value);
- ZakBksKey *(*path_get_bks_key) (ZakBksPluggable *pluggable, const gchar *path);
- gboolean (*remove_path) (ZakBksPluggable *pluggable,
- const gchar *path);
- gboolean (*remove) (ZakBksPluggable *pluggable);
- gboolean (*key_set_key) (ZakBksPluggable *pluggable,
- ZakBksKey *ck);
};
/*
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_bksgs_list (ZakBksPluggable *pluggable,
- const gchar *filter);
-gchar *zak_bks_pluggable_path_get_value (ZakBksPluggable *pluggable,
- const gchar *path);
-gboolean zak_bks_pluggable_path_set_value (ZakBksPluggable *pluggable,
- const gchar *path,
- const gchar *value);
-GNode *zak_bks_pluggable_get_tree (ZakBksPluggable *pluggable);
-ZakBksBks *zak_bks_pluggable_add_bksg (ZakBksPluggable *pluggable,
- const gchar *name,
- const gchar *description);
-gboolean zak_bks_pluggable_set_bksg (ZakBksPluggable *pluggable,
- const gchar *name,
- const gchar *description);
-ZakBksKey *zak_bks_pluggable_add_key (ZakBksPluggable *pluggable,
- const gchar *parent,
- const gchar *key,
- const gchar *value);
-gboolean zak_bks_pluggable_key_set_key (ZakBksPluggable *pluggable,
- ZakBksKey *ck);
-ZakBksKey *zak_bks_pluggable_path_get_bks_key (ZakBksPluggable *pluggable, const gchar *path);
-gboolean zak_bks_pluggable_remove_path (ZakBksPluggable *pluggable, const gchar *path);
-gboolean zak_bks_pluggable_remove (ZakBksPluggable *pluggable);
+ const gchar *cnc_string);
G_END_DECLS
-#endif /* __ZAK_BOOKMAKRS_PLUGGABLE_H__ */
-<
+#endif /* __ZAK_BOOKMARKS_PLUGGABLE_H__ */
G_BEGIN_DECLS
-#define ZAK_TYPE_BKS (zak_bks_get_type ())
-#define ZAK_BKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZAK_TYPE_BKS, ZakBks))
-#define ZAK_BKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ZAK_TYPE_BKS, ZakBksClass))
-#define ZAK_IS_BKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZAK_TYPE_BKS))
-#define ZAK_IS_BKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ZAK_TYPE_BKS))
-#define ZAK_BKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ZAK_TYPE_BKS, ZakBksClass))
+#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);
-typedef struct _ZakBks ZakBks;
-typedef struct _ZakBksClass ZakBksClass;
+PeasPluginInfo *zak_bks_get_plugin_info (ZakBksBks *bks);
-struct _ZakBks
- {
- GObject parent;
- };
-
-struct _ZakBksClass
- {
- GObjectClass parent_class;
- };
-
-GType zak_bks_get_type (void);
-
-ZakBks *zak_bks_new (const gchar *cnc_string);
-
-PeasPluginInfo *zak_bks_get_plugin_info (ZakBks *bks);
-
-void zak_bks_destroy (ZakBks *bks);
+void zak_bks_destroy (ZakBksBks *bks);
G_END_DECLS