[gnome-disk-utility/udisks2-port] Expand tree view on row insertion



commit 338322c36e0bfbc38bfc310a575405e9b50f0d9e
Author: David Zeuthen <davidz redhat com>
Date:   Sat Mar 5 16:04:31 2011 -0500

    Expand tree view on row insertion
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 src/palimpsest/gduapplication.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/palimpsest/gduapplication.c b/src/palimpsest/gduapplication.c
index 574e031..6b65c91 100644
--- a/src/palimpsest/gduapplication.c
+++ b/src/palimpsest/gduapplication.c
@@ -191,6 +191,8 @@ add_lun (GduApplication   *app,
   const gchar *model;
   const gchar *vendor;
 
+  g_debug ("add %s", g_dbus_object_proxy_get_object_path (object));
+
   lun = UDISKS_PEEK_LUN (object);
 
   model = udisks_lun_get_model (lun);
@@ -225,6 +227,8 @@ remove_lun (GduApplication   *app,
 {
   GtkTreeIter iter;
 
+  g_debug ("remove %s", g_dbus_object_proxy_get_object_path (object));
+
   if (!find_iter_for_object_proxy (app,
                                    object,
                                    &iter))
@@ -261,6 +265,16 @@ on_object_proxy_removed (GDBusProxyManager *manager,
 }
 
 static void
+on_row_inserted (GtkTreeModel *tree_model,
+                 GtkTreePath  *path,
+                 GtkTreeIter  *iter,
+                 gpointer      user_data)
+{
+  GduApplication *app = GDU_APPLICATION (user_data);
+  gtk_tree_view_expand_all (GTK_TREE_VIEW (gdu_application_get_widget (app, "lunlist-treeview")));
+}
+
+static void
 gdu_application_activate (GApplication *_app)
 {
   GduApplication *app = GDU_APPLICATION (_app);
@@ -416,6 +430,11 @@ gdu_application_activate (GApplication *_app)
                     G_CALLBACK (on_object_proxy_removed),
                     app);
 
+  /* expand on insertion - hmm, I wonder if there's an easier way to do this */
+  g_signal_connect (app->lun_tree_store,
+                    "row-inserted",
+                    G_CALLBACK (on_row_inserted),
+                    app);
   gtk_tree_view_expand_all (tree_view);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]