[anjuta] symbol-db: bgo #614408 - convert GET_PRIV () to ->priv
- From: Massimo Cora' <mcora src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] symbol-db: bgo #614408 - convert GET_PRIV () to ->priv
- Date: Fri, 2 Apr 2010 16:44:15 +0000 (UTC)
commit 4c6ffd4c1d4417a89e4ca7ef4e3bd2fe6bbe89e6
Author: Massimo Corà <mcora src gnome org>
Date: Fri Apr 2 18:39:30 2010 +0200
symbol-db: bgo #614408 - convert GET_PRIV () to ->priv
plugins/symbol-db/symbol-db-engine-core.c | 2 +-
plugins/symbol-db/symbol-db-model-file.c | 28 ++++++------
plugins/symbol-db/symbol-db-model-file.h | 5 ++-
plugins/symbol-db/symbol-db-model-project.c | 23 +++++-----
plugins/symbol-db/symbol-db-model-project.h | 3 +
plugins/symbol-db/symbol-db-model.c | 63 ++++++++++++++-------------
plugins/symbol-db/symbol-db-model.h | 3 +
7 files changed, 68 insertions(+), 59 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-engine-core.c b/plugins/symbol-db/symbol-db-engine-core.c
index ebec55d..059cf65 100644
--- a/plugins/symbol-db/symbol-db-engine-core.c
+++ b/plugins/symbol-db/symbol-db-engine-core.c
@@ -5353,7 +5353,7 @@ sdb_engine_add_new_symbol (SymbolDBEngine * dbe, const tagEntry * tag_entry,
type_id);
/* the container scopes can be: union, struct, typeref, class, namespace etc.
- * this field will be parse in the second pass.
+ * this field will be parsed in the second pass.
*/
scope_id = 0;
diff --git a/plugins/symbol-db/symbol-db-model-file.c b/plugins/symbol-db/symbol-db-model-file.c
index eef1b06..67d3442 100644
--- a/plugins/symbol-db/symbol-db-model-file.c
+++ b/plugins/symbol-db/symbol-db-model-file.c
@@ -20,17 +20,11 @@
#include "symbol-db-engine.h"
#include "symbol-db-model-file.h"
-typedef struct _SymbolDBModelFilePriv SymbolDBModelFilePriv;
struct _SymbolDBModelFilePriv
{
gchar *file_path;
};
-
-
-#define GET_PRIV(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
- SYMBOL_DB_TYPE_MODEL_FILE, \
- SymbolDBModelFilePriv))
enum
{
PROP_0,
@@ -50,7 +44,7 @@ sdb_model_file_get_n_children (SymbolDBModel *model, gint tree_level,
SymbolDBEngineIterator *iter = NULL;
g_return_val_if_fail (SYMBOL_DB_IS_MODEL_FILE (model), 0);
- priv = GET_PRIV (model);
+ priv = SYMBOL_DB_MODEL_FILE (model)->priv;
g_object_get (model, "symbol-db-engine", &dbe, NULL);
@@ -89,7 +83,7 @@ sdb_model_file_get_children (SymbolDBModel *model, gint tree_level,
SymbolDBEngineIterator *iter = NULL;
g_return_val_if_fail (SYMBOL_DB_IS_MODEL_FILE (model), 0);
- priv = GET_PRIV (model);
+ priv = SYMBOL_DB_MODEL_FILE (model)->priv;
g_object_get (model, "symbol-db-engine", &dbe, NULL);
@@ -131,7 +125,7 @@ sdb_model_file_set_property (GObject *object, guint prop_id,
SymbolDBModelFilePriv *priv;
g_return_if_fail (SYMBOL_DB_IS_MODEL_FILE (object));
- priv = GET_PRIV (object);
+ priv = SYMBOL_DB_MODEL_FILE (object)->priv;
switch (prop_id)
{
@@ -155,7 +149,7 @@ sdb_model_file_get_property (GObject *object, guint prop_id,
SymbolDBModelFilePriv *priv;
g_return_if_fail (SYMBOL_DB_IS_MODEL_FILE (object));
- priv = GET_PRIV (object);
+ priv = SYMBOL_DB_MODEL_FILE (object)->priv;
switch (prop_id)
{
@@ -174,8 +168,11 @@ sdb_model_file_finalize (GObject *object)
SymbolDBModelFilePriv *priv;
g_return_if_fail (SYMBOL_DB_IS_MODEL_FILE (object));
- priv = GET_PRIV (object);
+ priv = SYMBOL_DB_MODEL_FILE (object)->priv;
g_free (priv->file_path);
+
+ g_free (priv);
+
G_OBJECT_CLASS (sdb_model_file_parent_class)->finalize (object);
}
@@ -185,7 +182,10 @@ sdb_model_file_init (SymbolDBModelFile *object)
SymbolDBModelFilePriv *priv;
g_return_if_fail (SYMBOL_DB_IS_MODEL_FILE (object));
- priv = GET_PRIV (object);
+
+ priv = g_new0 (SymbolDBModelFilePriv, 1);
+ object->priv = priv;
+
priv->file_path = NULL;
}
@@ -194,9 +194,7 @@ sdb_model_file_class_init (SymbolDBModelFileClass *klass)
{
GObjectClass* object_class = G_OBJECT_CLASS (klass);
SymbolDBModelClass* model_class = SYMBOL_DB_MODEL_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (SymbolDBModelFilePriv));
-
+
object_class->finalize = sdb_model_file_finalize;
object_class->set_property = sdb_model_file_set_property;
object_class->get_property = sdb_model_file_get_property;
diff --git a/plugins/symbol-db/symbol-db-model-file.h b/plugins/symbol-db/symbol-db-model-file.h
index cb0bc06..04ffdf0 100644
--- a/plugins/symbol-db/symbol-db-model-file.h
+++ b/plugins/symbol-db/symbol-db-model-file.h
@@ -34,6 +34,7 @@ G_BEGIN_DECLS
typedef struct _SymbolDBModelFileClass SymbolDBModelFileClass;
typedef struct _SymbolDBModelFile SymbolDBModelFile;
+typedef struct _SymbolDBModelFilePriv SymbolDBModelFilePriv;
enum {
SYMBOL_DB_MODEL_FILE_COL_SYMBOL_ID,
@@ -51,7 +52,9 @@ struct _SymbolDBModelFileClass
struct _SymbolDBModelFile
{
- SymbolDBModel parent_instance;
+ SymbolDBModelProject parent_instance;
+
+ SymbolDBModelFilePriv *priv;
};
GType sdb_model_file_get_type (void) G_GNUC_CONST;
diff --git a/plugins/symbol-db/symbol-db-model-project.c b/plugins/symbol-db/symbol-db-model-project.c
index 488e2c6..ebc209e 100644
--- a/plugins/symbol-db/symbol-db-model-project.c
+++ b/plugins/symbol-db/symbol-db-model-project.c
@@ -20,15 +20,11 @@
#include "symbol-db-engine.h"
#include "symbol-db-model-project.h"
-typedef struct _SymbolDBModelProjectPriv SymbolDBModelProjectPriv;
struct _SymbolDBModelProjectPriv
{
SymbolDBEngine* dbe;
};
-#define GET_PRIV(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
- SYMBOL_DB_TYPE_MODEL_PROJECT, \
- SymbolDBModelProjectPriv))
enum {
DATA_COL_SYMBOL_ID,
DATA_COL_SYMBOL_NAME,
@@ -63,7 +59,7 @@ sdb_model_project_get_n_children (SymbolDBModel *model, gint tree_level,
gint symbol_id;
g_return_val_if_fail (SYMBOL_DB_IS_MODEL_PROJECT (model), 0);
- priv = GET_PRIV (model);
+ priv = SYMBOL_DB_MODEL_PROJECT (model)->priv;
/* If engine is not connected, there is nothing we can show */
if (!priv->dbe || !symbol_db_engine_is_connected (priv->dbe))
@@ -103,7 +99,7 @@ sdb_model_project_get_children (SymbolDBModel *model, gint tree_level,
gint symbol_id;
g_return_val_if_fail (SYMBOL_DB_IS_MODEL_PROJECT (model), 0);
- priv = GET_PRIV (model);
+ priv = SYMBOL_DB_MODEL_PROJECT (model)->priv;
/* If engine is not connected, there is nothing we can show */
if (!priv->dbe || !symbol_db_engine_is_connected (priv->dbe))
@@ -247,7 +243,7 @@ on_sdb_project_dbe_unref (SymbolDBModelProject *model)
SymbolDBModelProjectPriv *priv;
g_return_if_fail (SYMBOL_DB_IS_MODEL_PROJECT (model));
- priv = GET_PRIV (model);
+ priv = SYMBOL_DB_MODEL_PROJECT (model)->priv;
priv->dbe = NULL;
symbol_db_model_update (SYMBOL_DB_MODEL (model));
}
@@ -259,7 +255,7 @@ sdb_model_project_set_property (GObject *object, guint prop_id,
SymbolDBModelProjectPriv *priv;
g_return_if_fail (SYMBOL_DB_IS_MODEL_PROJECT (object));
- priv = GET_PRIV (object);
+ priv = SYMBOL_DB_MODEL_PROJECT (object)->priv;
switch (prop_id)
{
@@ -309,7 +305,7 @@ sdb_model_project_get_property (GObject *object, guint prop_id,
SymbolDBModelProjectPriv *priv;
g_return_if_fail (SYMBOL_DB_IS_MODEL_PROJECT (object));
- priv = GET_PRIV (object);
+ priv = SYMBOL_DB_MODEL_PROJECT (object)->priv;
switch (prop_id)
{
@@ -328,7 +324,7 @@ sdb_model_project_finalize (GObject *object)
SymbolDBModelProjectPriv *priv;
g_return_if_fail (SYMBOL_DB_IS_MODEL_PROJECT (object));
- priv = GET_PRIV (object);
+ priv = SYMBOL_DB_MODEL_PROJECT (object)->priv;
if (priv->dbe)
{
@@ -345,6 +341,9 @@ sdb_model_project_finalize (GObject *object)
G_CALLBACK (symbol_db_model_thaw),
object);
}
+
+ g_free (priv);
+
G_OBJECT_CLASS (sdb_model_project_parent_class)->finalize (object);
}
@@ -372,7 +371,9 @@ sdb_model_project_init (SymbolDBModelProject *object)
};
g_return_if_fail (SYMBOL_DB_IS_MODEL_PROJECT (object));
- priv = GET_PRIV (object);
+
+ priv = g_new0 (SymbolDBModelProjectPriv, 1);
+ object->priv = priv;
priv->dbe = NULL;
diff --git a/plugins/symbol-db/symbol-db-model-project.h b/plugins/symbol-db/symbol-db-model-project.h
index a6adb31..4fbf7c4 100644
--- a/plugins/symbol-db/symbol-db-model-project.h
+++ b/plugins/symbol-db/symbol-db-model-project.h
@@ -34,6 +34,7 @@ G_BEGIN_DECLS
typedef struct _SymbolDBModelProjectClass SymbolDBModelProjectClass;
typedef struct _SymbolDBModelProject SymbolDBModelProject;
+typedef struct _SymbolDBModelProjectPriv SymbolDBModelProjectPriv;
enum {
SYMBOL_DB_MODEL_PROJECT_COL_SYMBOL_ID,
@@ -53,6 +54,8 @@ struct _SymbolDBModelProjectClass
struct _SymbolDBModelProject
{
SymbolDBModel parent_instance;
+
+ SymbolDBModelProjectPriv *priv;
};
GType sdb_model_project_get_type (void) G_GNUC_CONST;
diff --git a/plugins/symbol-db/symbol-db-model.c b/plugins/symbol-db/symbol-db-model.c
index 58c35c8..8930064 100644
--- a/plugins/symbol-db/symbol-db-model.c
+++ b/plugins/symbol-db/symbol-db-model.c
@@ -24,9 +24,6 @@
#define SYMBOL_DB_MODEL_STAMP 5364558
-#define GET_PRIV(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), SYMBOL_DB_TYPE_MODEL, SymbolDBModelPriv))
-
/* Constants */
#define SYMBOL_DB_MODEL_PAGE_SIZE 50
@@ -66,7 +63,7 @@ struct _SymbolDBModelNode {
SymbolDBModelNode **children;
};
-typedef struct {
+ struct _SymbolDBModelPriv {
/* Keeps track of model freeze count. When the model is frozen, it
* avoid retreiving data from backend. It does not freeze the frontend
* view at all and instead use empty data for the duration of freeze.
@@ -82,7 +79,7 @@ typedef struct {
guint ensure_children_idle_id;
SymbolDBModelNode *root;
-} SymbolDBModelPriv;
+};
enum {
SIGNAL_GET_HAS_CHILD,
@@ -436,7 +433,7 @@ sdb_model_node_new (SymbolDBModel *model, SymbolDBModelNode *parent,
GdaDataModelIter *data_iter)
{
gint i;
- SymbolDBModelPriv *priv = GET_PRIV (model);
+ SymbolDBModelPriv *priv = model->priv;
SymbolDBModelNode* node = g_slice_new0 (SymbolDBModelNode);
node->n_columns = priv->n_columns;
node->values = g_slice_alloc0 (sizeof (GValue) * priv->n_columns);
@@ -516,7 +513,7 @@ sdb_model_page_fault (SymbolDBModel *model,
g_return_val_if_fail (page_found == NULL, page_found);
/* If model is frozen, can't fetch data from backend */
- priv = GET_PRIV (model);
+ priv = model->priv;
if (priv->freeze_count > 0)
return NULL;
@@ -590,7 +587,7 @@ static GType
sdb_model_get_column_type (GtkTreeModel *tree_model,
gint index)
{
- SymbolDBModelPriv *priv = GET_PRIV (tree_model);
+ SymbolDBModelPriv *priv = SYMBOL_DB_MODEL (tree_model)->priv;
g_return_val_if_fail (index < priv->n_columns, G_TYPE_INVALID);
return priv->column_types [index];
}
@@ -599,7 +596,7 @@ static gint
sdb_model_get_n_columns (GtkTreeModel *tree_model)
{
SymbolDBModelPriv *priv;
- priv = GET_PRIV (tree_model);
+ priv = SYMBOL_DB_MODEL (tree_model)->priv;
return priv->n_columns;
}
@@ -623,7 +620,7 @@ sdb_model_get_iter (GtkTreeModel *tree_model,
depth = gtk_tree_path_get_depth (path);
g_return_val_if_fail (depth > 0, FALSE);
- priv = GET_PRIV (tree_model);
+ priv = SYMBOL_DB_MODEL (tree_model)->priv;
indx = gtk_tree_path_get_indices (path);
parent_node = NULL;
@@ -674,7 +671,7 @@ sdb_model_get_path (GtkTreeModel *tree_model,
g_return_val_if_fail (sdb_model_iter_is_valid (tree_model, iter),
NULL);
- priv = GET_PRIV (tree_model);
+ priv = SYMBOL_DB_MODEL (tree_model)->priv;
path = gtk_tree_path_new ();
node = (SymbolDBModelNode*)iter->user_data;
@@ -700,7 +697,7 @@ sdb_model_get_value (GtkTreeModel *tree_model,
g_return_if_fail (sdb_model_iter_is_valid (tree_model, iter));
- priv = GET_PRIV (tree_model);
+ priv = SYMBOL_DB_MODEL (tree_model)->priv;
g_return_if_fail (column >= 0);
g_return_if_fail (column < priv->n_columns);
@@ -754,8 +751,8 @@ sdb_model_iter_next (GtkTreeModel *tree_model,
static gboolean
sdb_model_iter_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent)
+ GtkTreeIter *iter,
+ GtkTreeIter *parent)
{
SymbolDBModelNode *node, *parent_node;
SymbolDBModelPriv *priv;
@@ -769,7 +766,7 @@ sdb_model_iter_children (GtkTreeModel *tree_model,
g_return_val_if_fail (SYMBOL_DB_IS_MODEL(tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
- priv = GET_PRIV (tree_model);
+ priv = SYMBOL_DB_MODEL (tree_model)->priv;
if (parent == NULL)
{
node = priv->root;
@@ -861,7 +858,7 @@ sdb_model_iter_nth_child (GtkTreeModel *tree_model,
if (!sdb_model_iter_children (tree_model, iter, parent))
return FALSE;
- priv = GET_PRIV (tree_model);
+ priv = SYMBOL_DB_MODEL (tree_model)->priv;
node = (SymbolDBModelNode*) (iter->user_data);
g_return_val_if_fail (n < node->n_children, FALSE);
@@ -967,7 +964,7 @@ sdb_model_ensure_node_children (SymbolDBModel *model,
g_return_if_fail (node->children == NULL);
g_return_if_fail (node->children_ensured == FALSE);
- priv = GET_PRIV (model);
+ priv = model->priv;
/* Can not ensure if model is frozen */
if (priv->freeze_count > 0)
@@ -1012,7 +1009,7 @@ on_sdb_ensure_node_children_idle (SymbolDBModel *model)
SymbolDBModelNode *node;
SymbolDBModelPriv *priv;
- priv = GET_PRIV (model);
+ priv = model->priv;
for (count = 0; count < SYMBOL_DB_MODEL_ENSURE_CHILDREN_BATCH_SIZE; count++)
{
@@ -1043,7 +1040,7 @@ sdb_model_queue_ensure_node_children (SymbolDBModel *model,
g_return_if_fail (node->children == NULL);
g_return_if_fail (node->children_ensured == FALSE);
- priv = GET_PRIV (model);
+ priv = model->priv;
if (!g_queue_find (priv->ensure_children_queue, node))
{
g_queue_push_tail (priv->ensure_children_queue, node);
@@ -1071,7 +1068,7 @@ sdb_model_update_node_children (SymbolDBModel *model,
{
SymbolDBModelPriv *priv;
- priv = GET_PRIV (model);
+ priv = model->priv;
/* Delete all nodes */
if (node->n_children > 0)
@@ -1142,7 +1139,7 @@ sdb_model_get_query_value_real (SymbolDBModel *model,
GValue *value)
{
const GValue *ret;
- SymbolDBModelPriv *priv = GET_PRIV (model);
+ SymbolDBModelPriv *priv = model->priv;
gint query_column = priv->query_columns[column];
if (query_column < 0)
@@ -1188,7 +1185,7 @@ sdb_model_get_query_value_at_real (SymbolDBModel *model,
GValue *value)
{
const GValue *ret;
- SymbolDBModelPriv *priv = GET_PRIV (model);
+ SymbolDBModelPriv *priv = model->priv;
gint query_column = priv->query_columns[column];
g_value_init (value, priv->column_types[column]);
@@ -1286,7 +1283,7 @@ sdb_model_finalize (GObject *object)
SymbolDBModelPriv *priv;
/* FIXME */
- priv = GET_PRIV (object);
+ priv = SYMBOL_DB_MODEL (object)->priv;;
if (priv->ensure_children_idle_id)
g_source_remove (priv->ensure_children_idle_id);
g_queue_free (priv->ensure_children_queue);
@@ -1295,6 +1292,8 @@ sdb_model_finalize (GObject *object)
g_free (priv->query_columns);
sdb_model_node_cleanse (priv->root, TRUE);
g_slice_free (SymbolDBModelNode, priv->root);
+
+ g_free (priv);
G_OBJECT_CLASS (sdb_model_parent_class)->finalize (object);
}
@@ -1328,7 +1327,11 @@ sdb_model_get_property (GObject *object, guint prop_id, GValue *value,
static void
sdb_model_init (SymbolDBModel *object)
{
- SymbolDBModelPriv *priv = GET_PRIV (object);
+ SymbolDBModelPriv *priv;
+
+ priv = g_new0 (SymbolDBModelPriv, 1);
+ object->priv = priv;
+
priv->root = g_slice_new0 (SymbolDBModelNode);
priv->freeze_count = 0;
priv->n_columns = 0;
@@ -1351,8 +1354,6 @@ sdb_model_class_init (SymbolDBModelClass *klass)
object_class->set_property = sdb_model_set_property;
object_class->get_property = sdb_model_get_property;
- g_type_class_add_private (object_class, sizeof(SymbolDBModelPriv));
-
/* Signals */
symbol_db_model_signals[SIGNAL_GET_HAS_CHILD] =
g_signal_new ("get-has-child",
@@ -1397,7 +1398,7 @@ symbol_db_model_set_columns (SymbolDBModel *model, gint n_columns,
g_return_if_fail (n_columns > 0);
g_return_if_fail (SYMBOL_DB_IS_MODEL (model));
- priv = GET_PRIV (model);
+ priv = model->priv;
g_return_if_fail (priv->n_columns <= 0);
g_return_if_fail (priv->column_types == NULL);
@@ -1421,7 +1422,7 @@ symbol_db_model_new (gint n_columns, ...)
g_return_val_if_fail (n_columns > 0, NULL);
model = g_object_new (SYMBOL_DB_TYPE_MODEL, NULL);
- priv = GET_PRIV (model);
+ priv = SYMBOL_DB_MODEL (model)->priv;
priv->n_columns = n_columns;
priv->column_types = g_new0(GType, n_columns);
@@ -1457,7 +1458,7 @@ symbol_db_model_update (SymbolDBModel *model)
g_return_if_fail (SYMBOL_DB_IS_MODEL (model));
- priv = GET_PRIV (model);
+ priv = model->priv;
sdb_model_update_node_children (model, priv->root, FALSE);
}
@@ -1469,7 +1470,7 @@ symbol_db_model_freeze (SymbolDBModel *model)
g_return_if_fail (SYMBOL_DB_IS_MODEL (model));
- priv = GET_PRIV (model);
+ priv = model->priv;
priv->freeze_count++;
}
@@ -1480,7 +1481,7 @@ symbol_db_model_thaw (SymbolDBModel *model)
g_return_if_fail (SYMBOL_DB_IS_MODEL (model));
- priv = GET_PRIV (model);
+ priv = model->priv;
if (priv->freeze_count > 0)
priv->freeze_count--;
diff --git a/plugins/symbol-db/symbol-db-model.h b/plugins/symbol-db/symbol-db-model.h
index a8db3b7..3c89e73 100644
--- a/plugins/symbol-db/symbol-db-model.h
+++ b/plugins/symbol-db/symbol-db-model.h
@@ -36,6 +36,7 @@ G_BEGIN_DECLS
typedef struct _SymbolDBModelClass SymbolDBModelClass;
typedef struct _SymbolDBModel SymbolDBModel;
+typedef struct _SymbolDBModelPriv SymbolDBModelPriv;
struct _SymbolDBModelClass
{
@@ -67,6 +68,8 @@ struct _SymbolDBModelClass
struct _SymbolDBModel
{
GObject parent_instance;
+
+ SymbolDBModelPriv *priv;
};
GType sdb_model_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]