gimp r27077 - in trunk: . app/dialogs app/display app/widgets



Author: martinn
Date: Mon Sep 29 15:42:56 2008
New Revision: 27077
URL: http://svn.gnome.org/viewvc/gimp?rev=27077&view=rev

Log:
Bug 554125 â Tab key doesn't hide utility windows when there is no
image open.
	
* app/widgets/gimpdialogfactory.[ch]: Add 'toggle_visibility' to
GimpDialogFactory and as a parameter to gimp_dialog_factory_new(),
and set it there.

(gimp_dialog_factories_hide_foreach): Don't hide dialogs belonging
to factories with toggle_visibility FALSE.

* app/display/gimpdisplayshell-callbacks.c
(gimp_display_shell_canvas_tool_events): Move no-image event
handling to a new helper function, and make pressing Tab hide
windows.

* app/dialogs/dialogs.c (dialogs_init): Allow toggling visibility
for all factories except the display-factory.


Modified:
   trunk/ChangeLog
   trunk/app/dialogs/dialogs.c
   trunk/app/display/gimpdisplayshell-callbacks.c
   trunk/app/widgets/gimpdialogfactory.c
   trunk/app/widgets/gimpdialogfactory.h

Modified: trunk/app/dialogs/dialogs.c
==============================================================================
--- trunk/app/dialogs/dialogs.c	(original)
+++ trunk/app/dialogs/dialogs.c	Mon Sep 29 15:42:56 2008
@@ -249,26 +249,30 @@
   global_dialog_factory = gimp_dialog_factory_new ("toplevel",
                                                    gimp_get_user_context (gimp),
                                                    menu_factory,
-                                                   NULL);
+                                                   NULL,
+                                                   TRUE);
 
   global_toolbox_factory = gimp_dialog_factory_new ("toolbox",
                                                     gimp_get_user_context (gimp),
                                                     menu_factory,
-                                                    dialogs_toolbox_get);
+                                                    dialogs_toolbox_get,
+                                                    TRUE);
   gimp_dialog_factory_set_constructor (global_toolbox_factory,
                                        dialogs_dockable_constructor);
 
   global_dock_factory = gimp_dialog_factory_new ("dock",
                                                  gimp_get_user_context (gimp),
                                                  menu_factory,
-                                                 dialogs_dock_new);
+                                                 dialogs_dock_new,
+                                                 TRUE);
   gimp_dialog_factory_set_constructor (global_dock_factory,
                                        dialogs_dockable_constructor);
 
   global_display_factory = gimp_dialog_factory_new ("display",
                                                     gimp_get_user_context (gimp),
                                                     menu_factory,
-                                                    NULL);
+                                                    NULL,
+                                                    FALSE);
 
   for (i = 0; i < G_N_ELEMENTS (toplevel_entries); i++)
     gimp_dialog_factory_register_entry (global_dialog_factory,

Modified: trunk/app/display/gimpdisplayshell-callbacks.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-callbacks.c	(original)
+++ trunk/app/display/gimpdisplayshell-callbacks.c	Mon Sep 29 15:42:56 2008
@@ -539,6 +539,46 @@
                                      shell->display);
 }
 
+static gboolean
+gimp_display_shell_canvas_no_image_events (GtkWidget        *canvas,
+                                           GdkEvent         *event,
+                                           GimpDisplayShell *shell)
+{
+  switch (event->type)
+    {
+    case GDK_BUTTON_PRESS:
+      {
+        GdkEventButton *bevent = (GdkEventButton *) event;
+
+        if (bevent->button == 3)
+          {
+            gimp_ui_manager_ui_popup (shell->popup_manager,
+                                      "/dummy-menubar/image-popup",
+                                      GTK_WIDGET (shell),
+                                      NULL, NULL, NULL, NULL);
+          }
+      }
+      break;
+
+    case GDK_KEY_PRESS:
+      {
+        GdkEventKey *kevent = (GdkEventKey *) event;
+
+        if (kevent->keyval == GDK_Tab ||
+            kevent->keyval == GDK_ISO_Left_Tab)
+          {
+            gimp_dialog_factories_toggle ();
+          }
+      }
+      break;
+
+    default:
+      break;
+    }
+
+  return TRUE;
+}
+
 gboolean
 gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
                                        GdkEvent         *event,
@@ -573,16 +613,7 @@
 
   if (! image)
     {
-      if (event->type == GDK_BUTTON_PRESS &&
-          ((GdkEventButton *) event)->button == 3)
-        {
-          gimp_ui_manager_ui_popup (shell->popup_manager,
-                                    "/dummy-menubar/image-popup",
-                                    GTK_WIDGET (shell),
-                                    NULL, NULL, NULL, NULL);
-        }
-
-      return TRUE;
+      return gimp_display_shell_canvas_no_image_events (canvas, event, shell);
     }
 
   gdk_display = gtk_widget_get_display (canvas);

Modified: trunk/app/widgets/gimpdialogfactory.c
==============================================================================
--- trunk/app/widgets/gimpdialogfactory.c	(original)
+++ trunk/app/widgets/gimpdialogfactory.c	Mon Sep 29 15:42:56 2008
@@ -146,6 +146,7 @@
   factory->registered_dialogs = NULL;
   factory->session_infos      = NULL;
   factory->open_dialogs       = NULL;
+  factory->toggle_visibility  = FALSE;
 }
 
 static void
@@ -237,7 +238,8 @@
 gimp_dialog_factory_new (const gchar       *name,
                          GimpContext       *context,
                          GimpMenuFactory   *menu_factory,
-                         GimpDialogNewFunc  new_dock_func)
+                         GimpDialogNewFunc  new_dock_func,
+                         gboolean           toggle_visibility)
 {
   GimpDialogFactory *factory;
   gpointer           key;
@@ -267,9 +269,10 @@
   g_hash_table_insert (GIMP_DIALOG_FACTORY_GET_CLASS (factory)->factories,
                        key, factory);
 
-  factory->context       = context;
-  factory->menu_factory  = menu_factory;
-  factory->new_dock_func = new_dock_func;
+  factory->context           = context;
+  factory->menu_factory      = menu_factory;
+  factory->new_dock_func     = new_dock_func;
+  factory->toggle_visibility = toggle_visibility;
 
   return factory;
 }
@@ -1405,6 +1408,9 @@
 {
   GList *list;
 
+  if (! factory->toggle_visibility)
+    return;
+
   for (list = factory->open_dialogs; list; list = g_list_next (list))
     {
       GtkWidget *widget = list->data;

Modified: trunk/app/widgets/gimpdialogfactory.h
==============================================================================
--- trunk/app/widgets/gimpdialogfactory.h	(original)
+++ trunk/app/widgets/gimpdialogfactory.h	Mon Sep 29 15:42:56 2008
@@ -87,6 +87,7 @@
   GList                 *session_infos;
 
   GList                 *open_dialogs;
+  gboolean               toggle_visibility;
 };
 
 struct _GimpDialogFactoryClass
@@ -107,7 +108,8 @@
 GimpDialogFactory * gimp_dialog_factory_new       (const gchar       *name,
                                                    GimpContext       *context,
                                                    GimpMenuFactory   *menu_factory,
-                                                   GimpDialogNewFunc  new_dock_func);
+                                                   GimpDialogNewFunc  new_dock_func,
+                                                   gboolean           toggle_visibility);
 
 GimpDialogFactory * gimp_dialog_factory_from_name (const gchar       *name);
 



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