[gimp] Move the menubar and the menubar_manager to GimpImageWindow



commit 6793d687692f9872d86ccdc820a7b13821e93985
Author: Michael Natterer <mitch gimp org>
Date:   Wed Sep 23 16:58:03 2009 +0200

    Move the menubar and the menubar_manager to GimpImageWindow
    
    Also move some of their related code and update other code to
    go via gtk_widget_get_toplevel(), but also add some horrid temp
    /* FIXME image window */ hacks.

 app/actions/debug-commands.c              |   13 ++++--
 app/actions/view-actions.c                |   11 +++-
 app/actions/view-commands.c               |    6 ++-
 app/display/gimpdisplayshell-appearance.c |   53 ++++++++++++--------
 app/display/gimpdisplayshell-callbacks.c  |    5 ++-
 app/display/gimpdisplayshell-close.c      |   14 ++++-
 app/display/gimpdisplayshell.c            |   74 ++++++++++-------------------
 app/display/gimpdisplayshell.h            |    2 -
 app/display/gimpimagewindow.c             |   26 ++++++++++
 app/display/gimpimagewindow.h             |    1 +
 app/gui/gui-vtable.c                      |    3 +-
 11 files changed, 122 insertions(+), 86 deletions(-)
---
diff --git a/app/actions/debug-commands.c b/app/actions/debug-commands.c
index d4765ae..3a46d18 100644
--- a/app/actions/debug-commands.c
+++ b/app/actions/debug-commands.c
@@ -44,6 +44,7 @@
 
 #include "display/gimpdisplay.h"
 #include "display/gimpdisplayshell.h"
+#include "display/gimpimagewindow.h"
 
 #include "widgets/gimpaction.h"
 #include "widgets/gimpmenufactory.h"
@@ -187,17 +188,21 @@ debug_dump_keyboard_shortcuts_cmd_callback (GtkAction *action,
                                             gpointer   data)
 {
   GimpDisplay      *display     = NULL;
-  GimpDisplayShell *shell       = NULL;
+  GtkWidget        *window      = NULL;
+  GtkUIManager     *manager     = NULL;
   GtkAccelGroup    *accel_group = NULL;
   GList            *group_it    = NULL;
   GList            *strings     = NULL;
   return_if_no_display (display, data);
 
-  shell       = GIMP_DISPLAY_SHELL (display->shell);
-  accel_group = gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (shell->menubar_manager));
+  window = gtk_widget_get_toplevel (display->shell);
+
+  manager = GTK_UI_MANAGER (GIMP_IMAGE_WINDOW (window)->menubar_manager);
+
+  accel_group = gtk_ui_manager_get_accel_group (manager);
 
   /* Gather formated strings of keyboard shortcuts */
-  for (group_it = gtk_ui_manager_get_action_groups (GTK_UI_MANAGER (shell->menubar_manager));
+  for (group_it = gtk_ui_manager_get_action_groups (manager);
        group_it;
        group_it = g_list_next (group_it))
     {
diff --git a/app/actions/view-actions.c b/app/actions/view-actions.c
index b9b6b71..7f3a925 100644
--- a/app/actions/view-actions.c
+++ b/app/actions/view-actions.c
@@ -524,7 +524,7 @@ view_actions_setup (GimpActionGroup *group)
   view_actions_check_type_notify (GIMP_DISPLAY_CONFIG (group->gimp->config),
                                   NULL, group);
 
-  if (GIMP_IS_DISPLAY (group->user_data) ||
+  if (GIMP_IS_IMAGE_WINDOW (group->user_data) ||
       GIMP_IS_GIMP (group->user_data))
     {
       /*  add window actions only if the context of the group is
@@ -670,11 +670,16 @@ view_actions_update (GimpActionGroup *group,
   SET_ACTIVE    ("view-fullscreen",  display && fullscreen);
   SET_ACTIVE    ("view-use-gegl",    image && display->image->projection->use_gegl);
 
-  if (GIMP_IS_DISPLAY (group->user_data) ||
+  if (GIMP_IS_IMAGE_WINDOW (group->user_data) ||
       GIMP_IS_GIMP (group->user_data))
     {
+      GtkWidget *window = NULL;
+
+      if (shell)
+        window = gtk_widget_get_toplevel (GTK_WIDGET (shell));
+
       /*  see view_actions_setup()  */
-      window_actions_update (group, GTK_WIDGET (shell));
+      window_actions_update (group, window);
     }
 
 #undef SET_ACTIVE
diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c
index 5c7c422..0d1410d 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -260,10 +260,12 @@ view_dot_for_dot_cmd_callback (GtkAction *action,
 
   if (active != shell->dot_for_dot)
     {
+      GtkWidget *window = gtk_widget_get_toplevel (GTK_WIDGET (shell));
+
       gimp_display_shell_scale_set_dot_for_dot (shell, active);
 
-      SET_ACTIVE (shell->menubar_manager, "view-dot-for-dot",
-                  shell->dot_for_dot);
+      SET_ACTIVE (GIMP_IMAGE_WINDOW (window)->menubar_manager,
+                  "view-dot-for-dot", shell->dot_for_dot);
 
       if (IS_ACTIVE_DISPLAY (display))
         SET_ACTIVE (shell->popup_manager, "view-dot-for-dot",
diff --git a/app/display/gimpdisplayshell-appearance.c b/app/display/gimpdisplayshell-appearance.c
index 049276a..e41d107 100644
--- a/app/display/gimpdisplayshell-appearance.c
+++ b/app/display/gimpdisplayshell-appearance.c
@@ -82,10 +82,6 @@ gimp_display_shell_appearance_update (GimpDisplayShell *shell)
   /* FIXME temp image window hack */
   fullscreen = gimp_image_window_get_fullscreen (GIMP_IMAGE_WINDOW (shell));
 
-  if (shell->menubar)
-    gtk_widget_set_name (GTK_WIDGET (shell->menubar),
-                         fullscreen ? "gimp-menubar-fullscreen" : NULL);
-
   gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (shell->statusbar),
                                      ! fullscreen);
 
@@ -124,15 +120,17 @@ gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
 
   g_object_set (options, "show-menubar", show, NULL);
 
-  if (shell->menubar)
+  /* FIXME image window */
+  if (GIMP_IMAGE_WINDOW (shell)->menubar)
     {
       if (show)
-        gtk_widget_show (shell->menubar);
+        gtk_widget_show (GIMP_IMAGE_WINDOW (shell)->menubar);
       else
-        gtk_widget_hide (shell->menubar);
+        gtk_widget_hide (GIMP_IMAGE_WINDOW (shell)->menubar);
     }
 
-  SET_ACTIVE (shell->menubar_manager, "view-show-menubar", show);
+  /* FIXME image window */
+  SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-show-menubar", show);
 
   if (IS_ACTIVE_DISPLAY (shell))
     SET_ACTIVE (shell->popup_manager, "view-show-menubar", show);
@@ -180,7 +178,8 @@ gimp_display_shell_set_show_rulers (GimpDisplayShell *shell,
       gtk_table_set_row_spacing (table, 0, 0);
     }
 
-  SET_ACTIVE (shell->menubar_manager, "view-show-rulers", show);
+  /* FIXME image window */
+  SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-show-rulers", show);
 
   if (IS_ACTIVE_DISPLAY (shell))
     SET_ACTIVE (shell->popup_manager, "view-show-rulers", show);
@@ -238,7 +237,8 @@ gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell,
       gtk_box_set_spacing (vbox, 0);
     }
 
-  SET_ACTIVE (shell->menubar_manager, "view-show-scrollbars", show);
+  /* FIXME image window */
+  SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-show-scrollbars", show);
 
   if (IS_ACTIVE_DISPLAY (shell))
     SET_ACTIVE (shell->popup_manager, "view-show-scrollbars", show);
@@ -266,7 +266,8 @@ gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell,
 
   gimp_statusbar_set_visible (GIMP_STATUSBAR (shell->statusbar), show);
 
-  SET_ACTIVE (shell->menubar_manager, "view-show-statusbar", show);
+  /* FIXME image window */
+  SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-show-statusbar", show);
 
   if (IS_ACTIVE_DISPLAY (shell))
     SET_ACTIVE (shell->popup_manager, "view-show-statusbar", show);
@@ -294,7 +295,8 @@ gimp_display_shell_set_show_selection (GimpDisplayShell *shell,
 
   gimp_display_shell_selection_set_hidden (shell, ! show);
 
-  SET_ACTIVE (shell->menubar_manager, "view-show-selection", show);
+  /* FIXME image window */
+  SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-show-selection", show);
 
   if (IS_ACTIVE_DISPLAY (shell))
     SET_ACTIVE (shell->popup_manager, "view-show-selection", show);
@@ -322,7 +324,8 @@ gimp_display_shell_set_show_layer (GimpDisplayShell *shell,
 
   gimp_display_shell_selection_layer_set_hidden (shell, ! show);
 
-  SET_ACTIVE (shell->menubar_manager, "view-show-layer-boundary", show);
+  /* FIXME image window */
+  SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-show-layer-boundary", show);
 
   if (IS_ACTIVE_DISPLAY (shell))
     SET_ACTIVE (shell->popup_manager, "view-show-layer-boundary", show);
@@ -371,7 +374,8 @@ gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
       gimp_display_shell_expose_full (shell);
     }
 
-  SET_ACTIVE (shell->menubar_manager, "view-show-guides", show);
+  /* FIXME image window */
+  SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-show-guides", show);
 
   if (IS_ACTIVE_DISPLAY (shell))
     SET_ACTIVE (shell->popup_manager, "view-show-guides", show);
@@ -403,7 +407,8 @@ gimp_display_shell_set_show_grid (GimpDisplayShell *shell,
       gimp_display_shell_expose_full (shell);
     }
 
-  SET_ACTIVE (shell->menubar_manager, "view-show-grid", show);
+  /* FIXME image window */
+  SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-show-grid", show);
 
   if (IS_ACTIVE_DISPLAY (shell))
     SET_ACTIVE (shell->popup_manager, "view-show-grid", show);
@@ -435,7 +440,8 @@ gimp_display_shell_set_show_sample_points (GimpDisplayShell *shell,
       gimp_display_shell_expose_full (shell);
     }
 
-  SET_ACTIVE (shell->menubar_manager, "view-show-sample-points", show);
+  /* FIXME image window */
+  SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-show-sample-points", show);
 
   if (IS_ACTIVE_DISPLAY (shell))
     SET_ACTIVE (shell->popup_manager, "view-show-sample-points", show);
@@ -459,7 +465,8 @@ gimp_display_shell_set_snap_to_grid (GimpDisplayShell *shell,
     {
       shell->snap_to_grid = snap ? TRUE : FALSE;
 
-      SET_ACTIVE (shell->menubar_manager, "view-snap-to-grid", snap);
+      /* FIXME image window */
+      SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-snap-to-grid", snap);
 
       if (IS_ACTIVE_DISPLAY (shell))
         SET_ACTIVE (shell->popup_manager, "view-snap-to-grid", snap);
@@ -484,7 +491,8 @@ gimp_display_shell_set_snap_to_guides (GimpDisplayShell *shell,
     {
       shell->snap_to_guides = snap ? TRUE : FALSE;
 
-      SET_ACTIVE (shell->menubar_manager, "view-snap-to-guides", snap);
+      /* FIXME image window */
+      SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-snap-to-guides", snap);
 
       if (IS_ACTIVE_DISPLAY (shell))
         SET_ACTIVE (shell->popup_manager, "view-snap-to-guides", snap);
@@ -509,7 +517,8 @@ gimp_display_shell_set_snap_to_canvas (GimpDisplayShell *shell,
     {
       shell->snap_to_canvas = snap ? TRUE : FALSE;
 
-      SET_ACTIVE (shell->menubar_manager, "view-snap-to-canvas", snap);
+      /* FIXME image window */
+      SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-snap-to-canvas", snap);
 
       if (IS_ACTIVE_DISPLAY (shell))
         SET_ACTIVE (shell->popup_manager, "view-snap-to-canvas", snap);
@@ -534,7 +543,8 @@ gimp_display_shell_set_snap_to_vectors (GimpDisplayShell *shell,
     {
       shell->snap_to_vectors = snap ? TRUE : FALSE;
 
-      SET_ACTIVE (shell->menubar_manager, "view-snap-to-vectors", snap);
+      /* FIXME image window */
+      SET_ACTIVE (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-snap-to-vectors", snap);
 
       if (IS_ACTIVE_DISPLAY (shell))
         SET_ACTIVE (shell->popup_manager, "view-snap-to-vectors", snap);
@@ -598,7 +608,8 @@ gimp_display_shell_set_padding (GimpDisplayShell      *shell,
 
   gimp_canvas_set_bg_color (GIMP_CANVAS (shell->canvas), &color);
 
-  SET_COLOR (shell->menubar_manager, "view-padding-color-menu",
+  /* FIXME image window */
+  SET_COLOR (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "view-padding-color-menu",
              &options->padding_color);
 
   if (IS_ACTIVE_DISPLAY (shell))
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index c831bea..8c9c20c 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -1832,7 +1832,10 @@ gimp_display_shell_quick_mask_button_press (GtkWidget        *widget,
 
   if ((bevent->type == GDK_BUTTON_PRESS) && (bevent->button == 3))
     {
-      gimp_ui_manager_ui_popup (shell->menubar_manager, "/quick-mask-popup",
+      GtkWidget *window = gtk_widget_get_toplevel (GTK_WIDGET (shell));
+
+      gimp_ui_manager_ui_popup (GIMP_IMAGE_WINDOW (window)->menubar_manager,
+                                "/quick-mask-popup",
                                 GTK_WIDGET (shell),
                                 NULL, NULL, NULL, NULL);
 
diff --git a/app/display/gimpdisplayshell-close.c b/app/display/gimpdisplayshell-close.c
index 0b476f1..9f8d7e6 100644
--- a/app/display/gimpdisplayshell-close.c
+++ b/app/display/gimpdisplayshell-close.c
@@ -110,10 +110,12 @@ gimp_display_shell_close (GimpDisplayShell *shell,
     }
   else
     {
+      GtkWidget *window = gtk_widget_get_toplevel (GTK_WIDGET (shell));
+
       /* Activate the action instead of simply calling gimp_exit(), so
        * the quit action's sensitivity is taken into account.
        */
-      gimp_ui_manager_activate_action (shell->menubar_manager,
+      gimp_ui_manager_activate_action (GIMP_IMAGE_WINDOW (window)->menubar_manager,
                                        "file", "file-quit");
     }
 }
@@ -295,8 +297,14 @@ gimp_display_shell_close_response (GtkWidget        *widget,
       break;
 
     case RESPONSE_SAVE:
-      gimp_ui_manager_activate_action (shell->menubar_manager,
-                                       "file", "file-save-and-close");
+      {
+        GtkWidget *window = gtk_widget_get_toplevel (GTK_WIDGET (shell));
+
+        /* FIXME image window: set this display active */
+
+        gimp_ui_manager_activate_action (GIMP_IMAGE_WINDOW (window)->menubar_manager,
+                                         "file", "file-save-and-close");
+      }
       break;
 
     default:
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 9e05cef..57e8208 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -230,7 +230,6 @@ gimp_display_shell_init (GimpDisplayShell *shell)
 {
   shell->display                = NULL;
 
-  shell->menubar_manager        = NULL;
   shell->popup_manager          = NULL;
 
   shell->options                = g_object_new (GIMP_TYPE_DISPLAY_OPTIONS, NULL);
@@ -292,7 +291,6 @@ gimp_display_shell_init (GimpDisplayShell *shell)
   shell->zoom_button            = NULL;
   shell->nav_ebox               = NULL;
 
-  shell->menubar                = NULL;
   shell->statusbar              = NULL;
 
   shell->render_buf             = g_new (guchar,
@@ -463,12 +461,6 @@ gimp_display_shell_destroy (GtkObject *object)
   if (shell->display && shell->display->image)
     gimp_display_shell_disconnect (shell);
 
-  if (shell->menubar_manager)
-    {
-      g_object_unref (shell->menubar_manager);
-      shell->menubar_manager = NULL;
-    }
-
   shell->popup_manager = NULL;
 
   gimp_display_shell_selection_free (shell);
@@ -648,10 +640,6 @@ gimp_display_shell_window_state_event (GtkWidget           *widget,
 
       fullscreen = gimp_image_window_get_fullscreen (GIMP_IMAGE_WINDOW (window));
 
-      group = gimp_ui_manager_get_action_group (shell->menubar_manager, "view");
-      gimp_action_group_set_action_active (group,
-                                           "view-fullscreen", fullscreen);
-
       if (shell->display ==
           gimp_context_get_display (gimp_get_user_context (gimp)))
         {
@@ -705,9 +693,10 @@ gimp_display_shell_style_set (GtkWidget *widget,
   geometry.min_width  = requisition.width;
   geometry.min_height += requisition.height;
 
-  if (shell->menubar)
+  /* FIXME image window */
+  if (GIMP_IMAGE_WINDOW (shell)->menubar)
     {
-      gtk_widget_size_request (shell->menubar, &requisition);
+      gtk_widget_size_request (GIMP_IMAGE_WINDOW (shell)->menubar, &requisition);
 
       geometry.min_height += requisition.height;
     }
@@ -737,8 +726,10 @@ gimp_display_shell_real_scaled (GimpDisplayShell *shell)
 
   gimp_display_shell_title_update (shell);
 
+  /* FIXME image window */
   /* update the <Image>/View/Zoom menu */
-  gimp_ui_manager_update (shell->menubar_manager, shell->display);
+  gimp_ui_manager_update (GIMP_IMAGE_WINDOW (shell)->menubar_manager,
+                          shell->display);
 
   user_context = gimp_get_user_context (shell->display->gimp);
 
@@ -929,20 +920,13 @@ gimp_display_shell_new (GimpDisplay       *display,
       shell_height = image_height;
     }
 
-  shell->menubar_manager = gimp_menu_factory_manager_new (menu_factory,
-                                                          "<Image>",
-                                                          display,
-                                                          FALSE);
-
   shell->popup_manager = popup_manager;
 
-  gtk_window_add_accel_group (GTK_WINDOW (shell),
-                              gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (shell->menubar_manager)));
-
-  g_signal_connect (shell->menubar_manager, "show-tooltip",
+  /* FIXME image window */
+  g_signal_connect (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "show-tooltip",
                     G_CALLBACK (gimp_display_shell_show_tooltip),
                     shell);
-  g_signal_connect (shell->menubar_manager, "hide-tooltip",
+  g_signal_connect (GIMP_IMAGE_WINDOW (shell)->menubar_manager, "hide-tooltip",
                     G_CALLBACK (gimp_display_shell_hide_tooltip),
                     shell);
 
@@ -989,37 +973,24 @@ gimp_display_shell_new (GimpDisplay       *display,
 
   /*  the vbox containing all widgets  */
 
-#ifndef GDK_WINDOWING_QUARTZ
-  shell->menubar =
-    gtk_ui_manager_get_widget (GTK_UI_MANAGER (shell->menubar_manager),
-                               "/image-menubar");
-#endif /* !GDK_WINDOWING_QUARTZ */
-
-  if (shell->menubar)
+  /* FIXME image window */
+  if (GIMP_IMAGE_WINDOW (shell)->menubar)
     {
-      gtk_box_pack_start (GTK_BOX (GIMP_IMAGE_WINDOW (shell)->main_vbox),
-                          shell->menubar, FALSE, FALSE, 0);
+      GtkWidget *menubar = GIMP_IMAGE_WINDOW (shell)->menubar;
 
       if (options->show_menubar)
-        gtk_widget_show (shell->menubar);
+        gtk_widget_show (menubar);
       else
-        gtk_widget_hide (shell->menubar);
-
-      /*  make sure we can activate accels even if the menubar is invisible
-       *  (see http://bugzilla.gnome.org/show_bug.cgi?id=137151)
-       */
-      g_signal_connect (shell->menubar, "can-activate-accel",
-                        G_CALLBACK (gtk_true),
-                        NULL);
+        gtk_widget_hide (menubar);
 
       /*  active display callback  */
-      g_signal_connect (shell->menubar, "button-press-event",
+      g_signal_connect (menubar, "button-press-event",
                         G_CALLBACK (gimp_display_shell_events),
                         shell);
-      g_signal_connect (shell->menubar, "button-release-event",
+      g_signal_connect (menubar, "button-release-event",
                         G_CALLBACK (gimp_display_shell_events),
                         shell);
-      g_signal_connect (shell->menubar, "key-press-event",
+      g_signal_connect (menubar, "key-press-event",
                         G_CALLBACK (gimp_display_shell_events),
                         shell);
     }
@@ -1211,7 +1182,8 @@ gimp_display_shell_new (GimpDisplay       *display,
   gtk_container_add (GTK_CONTAINER (shell->quick_mask_button), image);
   gtk_widget_show (image);
 
-  action = gimp_ui_manager_find_action (shell->menubar_manager,
+  /* FIXME image window */
+  action = gimp_ui_manager_find_action (GIMP_IMAGE_WINDOW (shell)->menubar_manager,
                                         "quick-mask", "quick-mask-toggle");
   if (action)
     gimp_widget_set_accel_help (shell->quick_mask_button, action);
@@ -1430,7 +1402,9 @@ gimp_display_shell_empty (GimpDisplayShell *shell)
 
   /*  update the ui managers  */
 
-  gimp_ui_manager_update (shell->menubar_manager, shell->display);
+  /* FIXME image window */
+  gimp_ui_manager_update (GIMP_IMAGE_WINDOW (shell)->menubar_manager,
+                          shell->display);
 
   user_context = gimp_get_user_context (shell->display->gimp);
 
@@ -1824,7 +1798,9 @@ gimp_display_shell_flush (GimpDisplayShell *shell,
     {
       GimpContext *user_context;
 
-      gimp_ui_manager_update (shell->menubar_manager, shell->display);
+      /* FIXME image window */
+      gimp_ui_manager_update (GIMP_IMAGE_WINDOW (shell)->menubar_manager,
+                              shell->display);
 
       user_context = gimp_get_user_context (shell->display->gimp);
 
diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h
index 9c5b036..a8296a1 100644
--- a/app/display/gimpdisplayshell.h
+++ b/app/display/gimpdisplayshell.h
@@ -66,7 +66,6 @@ struct _GimpDisplayShell
 
   GimpDisplay       *display;
 
-  GimpUIManager     *menubar_manager;
   GimpUIManager     *popup_manager;
 
   GimpDialogFactory *display_factory;
@@ -145,7 +144,6 @@ struct _GimpDisplayShell
   GtkWidget         *zoom_button;      /*  NE: zoom toggle button             */
   GtkWidget         *nav_ebox;         /*  SE: navigation event box           */
 
-  GtkWidget         *menubar;          /*  menubar                            */
   GtkWidget         *statusbar;        /*  statusbar                          */
 
   guchar            *render_buf;       /*  buffer for rendering the image     */
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 100ed6f..9a1f9e5 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -124,10 +124,32 @@ gimp_image_window_constructor (GType                  type,
 
   g_assert (GIMP_IS_UI_MANAGER (window->menubar_manager));
 
+  gtk_window_add_accel_group (GTK_WINDOW (window),
+                              gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (window->menubar_manager)));
+
   window->main_vbox = gtk_vbox_new (FALSE, 0);
   gtk_container_add (GTK_CONTAINER (window), window->main_vbox);
   gtk_widget_show (window->main_vbox);
 
+#ifndef GDK_WINDOWING_QUARTZ
+  window->menubar =
+    gtk_ui_manager_get_widget (GTK_UI_MANAGER (window->menubar_manager),
+                               "/image-menubar");
+#endif /* !GDK_WINDOWING_QUARTZ */
+
+  if (window->menubar)
+    {
+      gtk_box_pack_start (GTK_BOX (window->main_vbox),
+                          window->menubar, FALSE, FALSE, 0);
+
+      /*  make sure we can activate accels even if the menubar is invisible
+       *  (see http://bugzilla.gnome.org/show_bug.cgi?id=137151)
+       */
+      g_signal_connect (window->menubar, "can-activate-accel",
+                        G_CALLBACK (gtk_true),
+                        NULL);
+    }
+
   return object;
 }
 
@@ -217,6 +239,10 @@ gimp_image_window_window_state (GtkWidget           *widget,
                 widget,
                 fullscreen ? "TURE" : "FALSE");
 
+      if (window->menubar)
+        gtk_widget_set_name (window->menubar,
+                             fullscreen ? "gimp-menubar-fullscreen" : NULL);
+
       group = gimp_ui_manager_get_action_group (window->menubar_manager, "view");
       gimp_action_group_set_action_active (group,
                                            "view-fullscreen", fullscreen);
diff --git a/app/display/gimpimagewindow.h b/app/display/gimpimagewindow.h
index 29e239c..aa941bc 100644
--- a/app/display/gimpimagewindow.h
+++ b/app/display/gimpimagewindow.h
@@ -39,6 +39,7 @@ struct _GimpImageWindow
   GimpUIManager   *menubar_manager;
 
   GtkWidget       *main_vbox;
+  GtkWidget       *menubar;
 
   GdkWindowState   window_state;
 };
diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c
index b1d71c2..8cbe6aa 100644
--- a/app/gui/gui-vtable.c
+++ b/app/gui/gui-vtable.c
@@ -356,7 +356,8 @@ gui_display_create (Gimp      *gimp,
       gimp_context_set_display (context, display);
     }
 
-  gimp_ui_manager_update (GIMP_DISPLAY_SHELL (display->shell)->menubar_manager,
+  /* FIXME image window */
+  gimp_ui_manager_update (GIMP_IMAGE_WINDOW (display->shell)->menubar_manager,
                           display);
 
   return GIMP_OBJECT (display);



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