[gimp] app: Cleanup gimp_dialog_factory_dialog_new_internal() a bit



commit e4dee4c559d2ece9629c561158c4afc5e8291fe0
Author: Martin Nordholts <martinn src gnome org>
Date:   Tue Mar 2 22:15:42 2010 +0100

    app: Cleanup gimp_dialog_factory_dialog_new_internal() a bit
    
    Cleanup gimp_dialog_factory_dialog_new_internal() a bit with regards
    to how it presents toplevel windows.

 app/widgets/gimpdialogfactory.c |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c
index c99c8af..cbaafcd 100644
--- a/app/widgets/gimpdialogfactory.c
+++ b/app/widgets/gimpdialogfactory.c
@@ -372,8 +372,9 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
                                          gboolean           return_existing,
                                          gboolean           present)
 {
-  GimpDialogFactoryEntry *entry;
-  GtkWidget              *dialog = NULL;
+  GimpDialogFactoryEntry *entry    = NULL;
+  GtkWidget              *dialog   = NULL;
+  GtkWidget              *toplevel = NULL;
 
   g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
   g_return_val_if_fail (identifier != NULL, NULL);
@@ -511,8 +512,7 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
     {
       gtk_window_set_screen (GTK_WINDOW (dialog), screen);
 
-      if (present)
-        gtk_window_present (GTK_WINDOW (dialog));
+      toplevel = dialog;
     }
   else if (GIMP_IS_DOCKABLE (dialog))
     {
@@ -532,15 +532,12 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
             }
         }
 
-      if (present)
-        {
-          GtkWidget *toplevel = gtk_widget_get_toplevel (dialog);
-
-          if (GTK_IS_WINDOW (toplevel))
-            gtk_window_present (GTK_WINDOW (toplevel));
-        }
+      toplevel = gtk_widget_get_toplevel (dialog);
     }
 
+  if (present && toplevel != NULL && GTK_IS_WINDOW (toplevel))
+    gtk_window_present (GTK_WINDOW (toplevel));
+
   return dialog;
 }
 



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