[gimp] app: A '|' in identifiers is not a special case



commit 40d98b79cbf661749a4d9086dee81cc0248d250a
Author: Martin Nordholts <martinn src gnome org>
Date:   Tue Jan 10 20:51:08 2012 +0100

    app: A '|' in identifiers is not a special case

 app/widgets/gimpdialogfactory.c |   46 +++++++++++++-------------------------
 1 files changed, 16 insertions(+), 30 deletions(-)
---
diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c
index d23dc32..677c00b 100644
--- a/app/widgets/gimpdialogfactory.c
+++ b/app/widgets/gimpdialogfactory.c
@@ -734,6 +734,8 @@ gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
                                   gint               view_size)
 {
   GtkWidget *dialog;
+  gchar    **ids;
+  gint       i;
 
   g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (factory), NULL);
   g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
@@ -742,39 +744,23 @@ gimp_dialog_factory_dialog_raise (GimpDialogFactory *factory,
   /*  If the identifier is a list, try to find a matching dialog and
    *  raise it. If there's no match, use the first list item.
    */
-  if (strchr (identifiers, '|'))
+  ids = g_strsplit (identifiers, "|", 0);
+  for (i = 0; ids[i]; i++)
     {
-      gchar **ids = g_strsplit (identifiers, "|", 0);
-      gint    i;
-
-      for (i = 0; ids[i]; i++)
-        {
-          if (gimp_dialog_factory_find_widget (factory, ids[i]))
-            break;
-        }
-
-      dialog = gimp_dialog_factory_dialog_new_internal (factory,
-                                                        screen,
-                                                        NULL,
-                                                        NULL,
-                                                        ids[i] ? ids[i] : ids[0],
-                                                        view_size,
-                                                        TRUE,
-                                                        TRUE);
-      g_strfreev (ids);
-    }
-  else
-    {
-      dialog = gimp_dialog_factory_dialog_new_internal (factory,
-                                                        screen,
-                                                        NULL,
-                                                        NULL,
-                                                        identifiers,
-                                                        view_size,
-                                                        TRUE,
-                                                        TRUE);
+      if (gimp_dialog_factory_find_widget (factory, ids[i]))
+        break;
     }
 
+  dialog = gimp_dialog_factory_dialog_new_internal (factory,
+                                                    screen,
+                                                    NULL,
+                                                    NULL,
+                                                    ids[i] ? ids[i] : ids[0],
+                                                    view_size,
+                                                    TRUE,
+                                                    TRUE);
+  g_strfreev (ids);
+
   return dialog;
 }
 



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