[anjuta] symbol-db: Fixed bgo #614393 - don't fold struct in locals view after buffer-update
- From: Naba Kumar <naba src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] symbol-db: Fixed bgo #614393 - don't fold struct in locals view after buffer-update
- Date: Sat, 3 Apr 2010 20:45:20 +0000 (UTC)
commit a77b5f43b189dfa02a0205b992cc6a88d98c5e59
Author: Naba Kumar <naba gnome org>
Date: Sat Apr 3 23:45:02 2010 +0300
symbol-db: Fixed bgo #614393 - don't fold struct in locals view after buffer-update
plugins/symbol-db/symbol-db-views.c | 59 +++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-views.c b/plugins/symbol-db/symbol-db-views.c
index 45a06b7..4f57ca6 100644
--- a/plugins/symbol-db/symbol-db-views.c
+++ b/plugins/symbol-db/symbol-db-views.c
@@ -71,6 +71,55 @@ on_treeview_row_activated (GtkTreeView *view, GtkTreePath *arg1,
}
}
+static void
+on_treeview_row_expanded (GtkTreeView *view, GtkTreeIter *iter,
+ GtkTreePath *path, SymbolDBPlugin *plugin)
+{
+ gint symbol_id;
+ GtkTreeModel *model;
+ GHashTable *expanded_nodes =
+ g_object_get_data (G_OBJECT (view), "__expanded_nodes__");
+
+ model = gtk_tree_view_get_model (view);
+ gtk_tree_model_get (model, iter, SYMBOL_DB_MODEL_PROJECT_COL_SYMBOL_ID,
+ &symbol_id, -1);
+ g_hash_table_insert (expanded_nodes, GINT_TO_POINTER (symbol_id),
+ GINT_TO_POINTER (symbol_id));
+}
+
+static void
+on_treeview_row_collapsed (GtkTreeView *view, GtkTreeIter *iter,
+ GtkTreePath *path, SymbolDBPlugin *plugin)
+{
+ gint symbol_id;
+ GtkTreeModel *model;
+
+ GHashTable *expanded_nodes =
+ g_object_get_data (G_OBJECT (view), "__expanded_nodes__");
+
+ model = gtk_tree_view_get_model (view);
+ gtk_tree_model_get (model, iter, SYMBOL_DB_MODEL_PROJECT_COL_SYMBOL_ID,
+ &symbol_id, -1);
+ g_hash_table_remove (expanded_nodes, GINT_TO_POINTER (symbol_id));
+}
+
+static void
+on_treeview_has_child_toggled (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ GtkTreeView *view)
+{
+ gint symbol_id;
+
+ GHashTable *expanded_nodes =
+ g_object_get_data (G_OBJECT (view), "__expanded_nodes__");
+
+ gtk_tree_model_get (model, iter, SYMBOL_DB_MODEL_PROJECT_COL_SYMBOL_ID,
+ &symbol_id, -1);
+ if (g_hash_table_lookup (expanded_nodes, GINT_TO_POINTER (symbol_id)))
+ gtk_tree_view_expand_row (view, path, FALSE);
+}
+
GtkWidget*
symbol_db_view_new (SymbolViewType view_type,
SymbolDBEngine *dbe, SymbolDBPlugin *plugin)
@@ -95,7 +144,17 @@ symbol_db_view_new (SymbolViewType view_type,
g_signal_connect (G_OBJECT (dbv), "row-activated",
G_CALLBACK (on_treeview_row_activated), plugin);
-
+ g_signal_connect (G_OBJECT (dbv), "row-expanded",
+ G_CALLBACK (on_treeview_row_expanded), plugin);
+ g_signal_connect (G_OBJECT (dbv), "row-collapsed",
+ G_CALLBACK (on_treeview_row_collapsed), plugin);
+ g_signal_connect (G_OBJECT (model), "row-has-child-toggled",
+ G_CALLBACK (on_treeview_has_child_toggled), dbv);
+
+ g_object_set_data_full (G_OBJECT (dbv), "__expanded_nodes__",
+ g_hash_table_new (g_direct_hash, g_direct_equal),
+ (GDestroyNotify)g_hash_table_destroy);
+
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (dbv), FALSE);
gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (dbv), TRUE);
gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (dbv),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]