[gnome-disk-utility/udisks2-port] Fix problem with grid toolbar items not being updated



commit 555137eeda89d95c6191f91a369a6c3054163650
Author: David Zeuthen <davidz redhat com>
Date:   Mon Aug 15 06:16:22 2011 -0400

    Fix problem with grid toolbar items not being updated
    
    The grid wasn't always emitting the 'changed' signal when something
    changed.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 src/palimpsest/gduvolumegrid.c |    2 ++
 src/palimpsest/gduwindow.c     |   29 +++++++++++++++--------------
 2 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/src/palimpsest/gduvolumegrid.c b/src/palimpsest/gduvolumegrid.c
index d1936fc..9155563 100644
--- a/src/palimpsest/gduvolumegrid.c
+++ b/src/palimpsest/gduvolumegrid.c
@@ -1853,6 +1853,8 @@ recompute_grid (GduVolumeGrid *grid)
 
   /* queue a redraw */
   gtk_widget_queue_draw (GTK_WIDGET (grid));
+
+  g_signal_emit (grid, signals[CHANGED_SIGNAL], 0);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/palimpsest/gduwindow.c b/src/palimpsest/gduwindow.c
index 1517e17..456089c 100644
--- a/src/palimpsest/gduwindow.c
+++ b/src/palimpsest/gduwindow.c
@@ -1276,7 +1276,7 @@ update_all (GduWindow     *window,
 
     case DETAILS_PAGE_DEVICE:
       /* this is a little too inclusive.. */
-      if (gdu_volume_grid_includes_object (GDU_VOLUME_GRID (window->volume_grid), object))
+      if (object != NULL && gdu_volume_grid_includes_object (GDU_VOLUME_GRID (window->volume_grid), object))
         {
           ShowFlags show_flags;
           show_flags = SHOW_FLAGS_NONE;
@@ -1293,6 +1293,7 @@ on_object_added (GDBusObjectManager  *manager,
                  gpointer             user_data)
 {
   GduWindow *window = GDU_WINDOW (user_data);
+  // g_debug ("on_object_added %s", g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));
   update_all (window, UDISKS_OBJECT (object));
 }
 
@@ -1302,6 +1303,7 @@ on_object_removed (GDBusObjectManager  *manager,
                    gpointer             user_data)
 {
   GduWindow *window = GDU_WINDOW (user_data);
+  // g_debug ("on_object_removed %s", g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));
   update_all (window, UDISKS_OBJECT (object));
 }
 
@@ -1312,6 +1314,7 @@ on_interface_added (GDBusObjectManager  *manager,
                     gpointer             user_data)
 {
   GduWindow *window = GDU_WINDOW (user_data);
+  // g_debug ("on_interface_added %s", g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));
   update_all (window, UDISKS_OBJECT (object));
 }
 
@@ -1322,6 +1325,7 @@ on_interface_removed (GDBusObjectManager  *manager,
                       gpointer             user_data)
 {
   GduWindow *window = GDU_WINDOW (user_data);
+  // g_debug ("on_interface_removed %s", g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));
   update_all (window, UDISKS_OBJECT (object));
 }
 
@@ -1334,9 +1338,19 @@ on_interface_proxy_properties_changed (GDBusObjectManagerClient   *manager,
                                        gpointer                    user_data)
 {
   GduWindow *window = GDU_WINDOW (user_data);
+  // g_debug ("on_interface_proxy_properties_changed %s", g_dbus_object_get_object_path (G_DBUS_OBJECT (object_proxy)));
   update_all (window, UDISKS_OBJECT (object_proxy));
 }
 
+static void
+on_volume_grid_changed (GduVolumeGrid  *grid,
+                        gpointer        user_data)
+{
+  GduWindow *window = GDU_WINDOW (user_data);
+  // g_debug ("on_volume_grid_changed");
+  update_all (window, gdu_volume_grid_get_block_device (GDU_VOLUME_GRID (window->volume_grid)));
+}
+
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
@@ -2159,19 +2173,6 @@ teardown_device_page (GduWindow *window)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
-on_volume_grid_changed (GduVolumeGrid  *grid,
-                        gpointer        user_data)
-{
-  GduWindow *window = GDU_WINDOW (user_data);
-  ShowFlags show_flags;
-  show_flags = SHOW_FLAGS_NONE;
-  update_device_page (window, &show_flags);
-  update_for_show_flags (window, show_flags);
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
 /* TODO: right now we show a MessageDialog but we could do things like an InfoBar etc */
 static void
 gdu_window_show_error (GduWindow   *window,



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