[gtk+] mount-operation: don't show the dialog until the tree is populated



commit d2540893086c46bad4c12071d31dfe86750949fe
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Jan 27 13:09:56 2011 -0500

    mount-operation: don't show the dialog until the tree is populated
    
    Otherwise it won't show up properly, and GTK+ will trigger a warning.
    Don't know why this did not show up before.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=640744

 gtk/gtkmountoperation.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c
index 2cdd1d5..ffa6656 100644
--- a/gtk/gtkmountoperation.c
+++ b/gtk/gtkmountoperation.c
@@ -1182,7 +1182,7 @@ on_button_press_event_for_process_tree_view (GtkWidget      *widget,
   return ret;
 }
 
-static void
+static GtkWidget *
 create_show_processes_dialog (GMountOperation *op,
                               const char      *message,
                               const char      *choices[])
@@ -1309,9 +1309,9 @@ create_show_processes_dialog (GMountOperation *op,
   g_object_add_weak_pointer (G_OBJECT (tree_view), (gpointer *) &priv->process_tree_view);
 
   g_object_unref (list_store);
-
-  gtk_widget_show_all (dialog);
   g_object_ref (op);
+
+  return dialog;
 }
 
 static void
@@ -1321,6 +1321,7 @@ gtk_mount_operation_show_processes (GMountOperation *op,
                                     const char      *choices[])
 {
   GtkMountOperationPrivate *priv;
+  GtkWidget *dialog = NULL;
 
   g_return_if_fail (GTK_IS_MOUNT_OPERATION (op));
   g_return_if_fail (message != NULL);
@@ -1332,7 +1333,7 @@ gtk_mount_operation_show_processes (GMountOperation *op,
   if (priv->process_list_store == NULL)
     {
       /* need to create the dialog */
-      create_show_processes_dialog (op, message, choices);
+      dialog = create_show_processes_dialog (op, message, choices);
     }
 
   /* otherwise, we're showing the dialog, assume messages+choices hasn't changed */
@@ -1340,6 +1341,11 @@ gtk_mount_operation_show_processes (GMountOperation *op,
   update_process_list_store (GTK_MOUNT_OPERATION (op),
                              priv->process_list_store,
                              processes);
+
+  if (dialog != NULL)
+    {
+      gtk_widget_show_all (dialog);
+    }
 }
 
 static void



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