[anjuta/sdb-queries] symbol-db: Left over from previous commit. Implement new label property
- From: Naba Kumar <naba src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/sdb-queries] symbol-db: Left over from previous commit. Implement new label property
- Date: Wed, 16 Jun 2010 20:45:31 +0000 (UTC)
commit ce47be44714ff1459d32237f1a5092232225c320
Author: Naba Kumar <naba gnome org>
Date: Wed Jun 16 23:42:42 2010 +0300
symbol-db: Left over from previous commit. Implement new label property
plugins/symbol-db/symbol-db-model-file.h | 9 ------
plugins/symbol-db/symbol-db-model-project.c | 38 ++++++++++++++++++++++++++-
2 files changed, 37 insertions(+), 10 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-model-file.h b/plugins/symbol-db/symbol-db-model-file.h
index 04ffdf0..7319801 100644
--- a/plugins/symbol-db/symbol-db-model-file.h
+++ b/plugins/symbol-db/symbol-db-model-file.h
@@ -36,15 +36,6 @@ typedef struct _SymbolDBModelFileClass SymbolDBModelFileClass;
typedef struct _SymbolDBModelFile SymbolDBModelFile;
typedef struct _SymbolDBModelFilePriv SymbolDBModelFilePriv;
-enum {
- SYMBOL_DB_MODEL_FILE_COL_SYMBOL_ID,
- SYMBOL_DB_MODEL_FILE_COL_PIXBUF,
- SYMBOL_DB_MODEL_FILE_COL_LABEL,
- SYMBOL_DB_MODEL_FILE_COL_FILE,
- SYMBOL_DB_MODEL_FILE_COL_LINE,
- SYMBOL_DB_MODEL_FILE_COL_N_COLS
-};
-
struct _SymbolDBModelFileClass
{
SymbolDBModelProjectClass parent_class;
diff --git a/plugins/symbol-db/symbol-db-model-project.c b/plugins/symbol-db/symbol-db-model-project.c
index fd4eeca..174d41a 100644
--- a/plugins/symbol-db/symbol-db-model-project.c
+++ b/plugins/symbol-db/symbol-db-model-project.c
@@ -86,6 +86,7 @@ struct _SymbolDBModelProjectPriv
GdaStatement *stmt;
GdaSet *params;
GdaHolder *param_parent_id, *param_limit, *param_offset;
+ gboolean show_file_line;
};
enum {
@@ -106,7 +107,8 @@ enum {
enum
{
PROP_0,
- PROP_SYMBOL_DB_ENGINE
+ PROP_SYMBOL_DB_ENGINE,
+ PROP_SHOW_FILE_LINE
};
G_DEFINE_TYPE (SymbolDBModelProject, sdb_model_project,
@@ -275,6 +277,26 @@ sdb_model_project_get_query_value (SymbolDBModel *model,
g_free (escaped);
}
}
+ if (SYMBOL_DB_MODEL_PROJECT (model)->priv->show_file_line)
+ {
+ ret_value =
+ gda_data_model_iter_get_value_at (iter,
+ DATA_COL_SYMBOL_FILE_PATH);
+ if (ret_value && G_VALUE_HOLDS_STRING (ret_value))
+ {
+ gint file_line = 0;
+ const gchar* file_name = g_value_get_string (ret_value);
+
+ ret_value =
+ gda_data_model_iter_get_value_at (iter,
+ DATA_COL_SYMBOL_FILE_LINE);
+ file_line = g_value_get_int (ret_value);
+ g_string_append_printf
+ (label,
+ "\n<span font-size=\"x-small\" font-weight=\"ultralight\"><tt>%s:%d</tt></span>",
+ file_name, file_line);
+ }
+ }
g_value_take_string (value, label->str);
g_string_free (label, FALSE);
return TRUE;
@@ -352,6 +374,9 @@ sdb_model_project_set_property (GObject *object, guint prop_id,
symbol_db_model_update (SYMBOL_DB_MODEL (object));
break;
+ case PROP_SHOW_FILE_LINE:
+ priv->show_file_line = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -372,6 +397,9 @@ sdb_model_project_get_property (GObject *object, guint prop_id,
case PROP_SYMBOL_DB_ENGINE:
g_value_set_object (value, priv->dbe);
break;
+ case PROP_SHOW_FILE_LINE:
+ g_value_set_boolean (value, priv->show_file_line);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -479,6 +507,14 @@ sdb_model_project_class_init (SymbolDBModelProjectClass *klass)
G_PARAM_READABLE |
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property
+ (object_class, PROP_SHOW_FILE_LINE,
+ g_param_spec_boolean ("show-file-line",
+ "Show file and line",
+ "Show file and line number in labels",
+ FALSE,
+ G_PARAM_READABLE |
+ G_PARAM_WRITABLE));
}
GtkTreeModel*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]