[gthumb] reorganized the headerbar tools



commit a51c269fbf48c8546ef4a75eecced45b9d75ef74
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Oct 30 21:55:44 2013 +0100

    reorganized the headerbar tools

 extensions/change_date/callbacks.c          |    2 +-
 extensions/comments/callbacks.c             |    2 +-
 extensions/convert_format/callbacks.c       |    2 +-
 extensions/desktop_background/callbacks.c   |    4 +-
 extensions/edit_metadata/callbacks.c        |    2 +-
 extensions/export_tools/callbacks.c         |    7 --
 extensions/file_tools/main.c                |    2 +-
 extensions/image_rotation/callbacks.c       |   94 +++++++++++++++++++++++++--
 extensions/image_rotation/callbacks.h       |   10 ++-
 extensions/image_rotation/main.c            |    2 +
 extensions/list_tools/callbacks.c           |   16 +----
 extensions/list_tools/data/ui/tools-menu.ui |    5 +-
 extensions/list_tools/list-tools.h          |    4 +-
 extensions/resize_images/callbacks.c        |    2 +-
 extensions/slideshow/callbacks.c            |    6 --
 gthumb/gth-browser.c                        |   20 ++++--
 gthumb/gth-browser.h                        |    4 +-
 gthumb/gth-main-default-hooks.c             |   14 ++++
 gthumb/gth-menu-manager.c                   |   11 +++-
 gthumb/resources/gears-menu.ui              |    1 -
 20 files changed, 150 insertions(+), 60 deletions(-)
---
diff --git a/extensions/change_date/callbacks.c b/extensions/change_date/callbacks.c
index b3ca9e0..f555f3f 100644
--- a/extensions/change_date/callbacks.c
+++ b/extensions/change_date/callbacks.c
@@ -47,7 +47,7 @@ cd__gth_browser_construct_cb (GthBrowser *browser)
                                         actions,
                                         G_N_ELEMENTS (actions),
                                         browser);
-       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_TOOLS2),
+       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_TOOLS),
                                         action_entries,
                                         G_N_ELEMENTS (action_entries));
 }
diff --git a/extensions/comments/callbacks.c b/extensions/comments/callbacks.c
index e0893b8..524d544 100644
--- a/extensions/comments/callbacks.c
+++ b/extensions/comments/callbacks.c
@@ -49,7 +49,7 @@ comments__gth_browser_construct_cb (GthBrowser *browser)
                                                 actions,
                                                 G_N_ELEMENTS (actions),
                                                 browser);
-               gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_TOOLS2),
+               gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_GEARS_OTHER_ACTIONS),
                                                 action_entries,
                                                 G_N_ELEMENTS (action_entries));
        }
diff --git a/extensions/convert_format/callbacks.c b/extensions/convert_format/callbacks.c
index 0033b57..e3bca59 100644
--- a/extensions/convert_format/callbacks.c
+++ b/extensions/convert_format/callbacks.c
@@ -47,7 +47,7 @@ cf__gth_browser_construct_cb (GthBrowser *browser)
                                         actions,
                                         G_N_ELEMENTS (actions),
                                         browser);
-       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_TOOLS2),
+       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_TOOLS),
                                         action_entries,
                                         G_N_ELEMENTS (action_entries));
 }
diff --git a/extensions/desktop_background/callbacks.c b/extensions/desktop_background/callbacks.c
index 8141cd4..0f78b1d 100644
--- a/extensions/desktop_background/callbacks.c
+++ b/extensions/desktop_background/callbacks.c
@@ -43,13 +43,13 @@ db__gth_browser_construct_cb (GthBrowser *browser)
                                         browser);
        gth_menu_manager_append_entry (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_FILE_SCREEN_ACTIONS),
                                       GTH_MENU_MANAGER_NEW_MERGE_ID,
-                                      _("Set as Desktop Background"),
+                                      _("Set as Background"),
                                       "win.set-desktop-background",
                                       NULL,
                                       NULL);
        gth_menu_manager_append_entry (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_FILE_LIST_SCREEN_ACTIONS),
                                       GTH_MENU_MANAGER_NEW_MERGE_ID,
-                                      _("Set as Desktop Background"),
+                                      _("Set as Background"),
                                       "win.set-desktop-background",
                                       NULL,
                                       NULL);
diff --git a/extensions/edit_metadata/callbacks.c b/extensions/edit_metadata/callbacks.c
index 30f5cde..7372760 100644
--- a/extensions/edit_metadata/callbacks.c
+++ b/extensions/edit_metadata/callbacks.c
@@ -56,7 +56,7 @@ edit_metadata__gth_browser_construct_cb (GthBrowser *browser)
                                         browser);
 
        if (gth_main_extension_is_active ("list_tools"))
-               gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_TOOLS2),
+               gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_MORE_TOOLS),
                                                 action_entries,
                                                 G_N_ELEMENTS (action_entries));
 
diff --git a/extensions/export_tools/callbacks.c b/extensions/export_tools/callbacks.c
index 0fb234b..b027852 100644
--- a/extensions/export_tools/callbacks.c
+++ b/extensions/export_tools/callbacks.c
@@ -48,11 +48,4 @@ export_tools__gth_browser_construct_cb (GthBrowser *browser)
        gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
        gtk_widget_show_all (button);
        gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser, 
GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS)), button, FALSE, FALSE, 0);
-
-       button = _gtk_menu_button_new_for_header_bar ();
-       gtk_widget_set_tooltip_text (button, _("Share"));
-       gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name 
("folder-publicshare-symbolic", GTK_ICON_SIZE_MENU));
-       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
-       gtk_widget_show_all (button);
-       gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser, 
GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS)), button, FALSE, FALSE, 0);
 }
diff --git a/extensions/file_tools/main.c b/extensions/file_tools/main.c
index c00ef60..b8d2a29 100644
--- a/extensions/file_tools/main.c
+++ b/extensions/file_tools/main.c
@@ -58,8 +58,8 @@ gthumb_extension_activate (void)
        gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_GRAYSCALE);
        gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_NEGATIVE);
 
-       gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_ROTATE_RIGHT);
        gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_ROTATE_LEFT);
+       gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_ROTATE_RIGHT);
        gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_MIRROR);
        gth_main_register_type ("file-tools", GTH_TYPE_FILE_TOOL_FLIP);
 
diff --git a/extensions/image_rotation/callbacks.c b/extensions/image_rotation/callbacks.c
index b80f850..9db93cd 100644
--- a/extensions/image_rotation/callbacks.c
+++ b/extensions/image_rotation/callbacks.c
@@ -25,10 +25,14 @@
 #include <glib-object.h>
 #include <gdk/gdkkeysyms.h>
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 #include <extensions/list_tools/list-tools.h>
 #include "actions.h"
 
 
+#define BROWSER_DATA_KEY "image-rotation-browser-data"
+
+
 static const GActionEntry actions[] = {
        { "rotate-right", gth_browser_activate_rotate_right },
        { "rotate-left", gth_browser_activate_rotate_left },
@@ -37,26 +41,52 @@ static const GActionEntry actions[] = {
 };
 
 
-static const GthMenuEntry tools_action_entries[] = {
-       { N_("Rotate Right"), "win.rotate-right", "<control><alt>R", "object-rotate-right-symbolic" },
-       { N_("Rotate Left"), "win.rotate-left", "<control><alt>L", "object-rotate-left-symbolic" },
+static const GthMenuEntry tools1_action_entries[] = {
+       { N_("Rotate Right"), "win.rotate-right", "bracketright", "object-rotate-right-symbolic" },
+       { N_("Rotate Left"), "win.rotate-left", "bracketleft", "object-rotate-left-symbolic" },
+};
+
+
+static const GthMenuEntry tools2_action_entries[] = {
        { N_("Rotate Physically"), "win.apply-orientation", NULL },
        { N_("Reset the EXIF Orientation"), "win.reset-orientation", NULL }
 };
 
 
+typedef struct {
+       GtkWidget *buttons[2];
+} BrowserData;
+
+
+static void
+browser_data_free (BrowserData *data)
+{
+       g_free (data);
+}
+
+
 void
 ir__gth_browser_construct_cb (GthBrowser *browser)
 {
+       BrowserData *data;
+
        g_return_if_fail (GTH_IS_BROWSER (browser));
 
+       data = g_new0 (BrowserData, 1);
+       g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) 
browser_data_free);
+       data->buttons[0] = NULL;
+       data->buttons[1] = NULL;
+
        g_action_map_add_action_entries (G_ACTION_MAP (browser),
                                         actions,
                                         G_N_ELEMENTS (actions),
                                         browser);
-       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_TOOLS1),
-                                        tools_action_entries,
-                                        G_N_ELEMENTS (tools_action_entries));
+       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_TOOLS),
+                                        tools1_action_entries,
+                                        G_N_ELEMENTS (tools1_action_entries));
+       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_MORE_TOOLS),
+                                        tools2_action_entries,
+                                        G_N_ELEMENTS (tools2_action_entries));
 }
 
 
@@ -98,3 +128,55 @@ ir__gth_browser_file_list_key_press_cb (GthBrowser  *browser,
 
        return result;
 }
+
+
+void
+ir__gth_browser_activate_viewer_page_cb (GthBrowser *browser)
+{
+       BrowserData *data;
+       GtkWidget   *viewer_page;
+
+       data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
+       g_return_if_fail (data != NULL);
+
+       viewer_page = gth_browser_get_viewer_page (browser);
+       if (GTH_IS_IMAGE_VIEWER_PAGE (viewer_page)) {
+               if (data->buttons[0] == NULL)
+                       data->buttons[0] =
+                                       gth_browser_add_header_bar_button (browser,
+                                                                          
GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS,
+                                                                          "object-rotate-left-symbolic",
+                                                                          _("Rotate Left"),
+                                                                          "win.rotate-left",
+                                                                          NULL);
+               if (data->buttons[1] == NULL)
+                       data->buttons[1] =
+                                       gth_browser_add_header_bar_button (browser,
+                                                                          
GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS,
+                                                                          "object-rotate-right-symbolic",
+                                                                          _("Rotate Right"),
+                                                                          "win.rotate-right",
+                                                                          NULL);
+       }
+}
+
+
+void
+ir__gth_browser_deactivate_viewer_page_cb (GthBrowser *browser)
+{
+       BrowserData *data;
+       GtkWidget   *viewer_page;
+
+       data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
+       g_return_if_fail (data != NULL);
+
+       viewer_page = gth_browser_get_viewer_page (browser);
+       if (GTH_IS_IMAGE_VIEWER_PAGE (viewer_page)) {
+               if (data->buttons[0] != NULL)
+                       gtk_widget_destroy (data->buttons[0]);
+               if (data->buttons[1] != NULL)
+                       gtk_widget_destroy (data->buttons[1]);
+               data->buttons[0] = NULL;
+               data->buttons[1] = NULL;
+       }
+}
diff --git a/extensions/image_rotation/callbacks.h b/extensions/image_rotation/callbacks.h
index b3aa21f..990773e 100644
--- a/extensions/image_rotation/callbacks.h
+++ b/extensions/image_rotation/callbacks.h
@@ -24,9 +24,11 @@
 
 #include <gthumb.h>
 
-void      ir__gth_browser_construct_cb           (GthBrowser  *browser);
-void      ir__gth_browser_update_sensitivity_cb  (GthBrowser  *browser);
-gpointer  ir__gth_browser_file_list_key_press_cb (GthBrowser  *browser,
-                                                 GdkEventKey *event);
+void      ir__gth_browser_construct_cb              (GthBrowser  *browser);
+void      ir__gth_browser_update_sensitivity_cb     (GthBrowser  *browser);
+gpointer  ir__gth_browser_file_list_key_press_cb    (GthBrowser  *browser,
+                                                    GdkEventKey *event);
+void     ir__gth_browser_activate_viewer_page_cb   (GthBrowser  *browser);
+void     ir__gth_browser_deactivate_viewer_page_cb (GthBrowser  *browser);
 
 #endif /* CALLBACKS_H */
diff --git a/extensions/image_rotation/main.c b/extensions/image_rotation/main.c
index 632d35f..6c7f59b 100644
--- a/extensions/image_rotation/main.c
+++ b/extensions/image_rotation/main.c
@@ -40,6 +40,8 @@ gthumb_extension_activate (void)
        gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK (ir__gth_browser_construct_cb), NULL);
        gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK 
(ir__gth_browser_update_sensitivity_cb), NULL);
        gth_hook_add_callback ("gth-browser-file-list-key-press", 10, G_CALLBACK 
(ir__gth_browser_file_list_key_press_cb), NULL);
+       gth_hook_add_callback ("gth-browser-activate-viewer-page", 10, G_CALLBACK 
(ir__gth_browser_activate_viewer_page_cb), NULL);
+       gth_hook_add_callback ("gth-browser-deactivate-viewer-page", 10, G_CALLBACK 
(ir__gth_browser_deactivate_viewer_page_cb), NULL);
 }
 
 
diff --git a/extensions/list_tools/callbacks.c b/extensions/list_tools/callbacks.c
index 3e24db3..5bbc3d4 100644
--- a/extensions/list_tools/callbacks.c
+++ b/extensions/list_tools/callbacks.c
@@ -162,8 +162,8 @@ list_tools__gth_browser_construct_cb (GthBrowser *browser)
                                         browser);
 
        builder = gtk_builder_new_from_resource ("/org/gnome/gThumb/list_tools/data/ui/tools-menu.ui");
-       gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_TOOLS1, G_MENU 
(gtk_builder_get_object (builder, "tools1")));
-       gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_TOOLS2, G_MENU 
(gtk_builder_get_object (builder, "tools2")));
+       gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_TOOLS, G_MENU 
(gtk_builder_get_object (builder, "tools1")));
+       gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_MORE_TOOLS, G_MENU 
(gtk_builder_get_object (builder, "tools2")));
        gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_TOOLS3, G_MENU 
(gtk_builder_get_object (builder, "tools3")));
        menu = G_MENU_MODEL (gtk_builder_get_object (builder, "tools-menu"));
 
@@ -172,21 +172,11 @@ list_tools__gth_browser_construct_cb (GthBrowser *browser)
        button = _gtk_menu_button_new_for_header_bar ();
        g_signal_connect (button, "toggled", G_CALLBACK (tools_menu_button_toggled_cb), data);
        gtk_widget_set_tooltip_text (button, _("Tools"));
-       gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("system-run-symbolic", 
GTK_ICON_SIZE_MENU));
+       gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("tools-symbolic", 
GTK_ICON_SIZE_MENU));
        gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
        gtk_widget_show_all (button);
        gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser, 
GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS)), button, FALSE, FALSE, 0);
 
-       /* viewer tools */
-
-       button = _gtk_menu_button_new_for_header_bar ();
-       g_signal_connect (button, "toggled", G_CALLBACK (tools_menu_button_toggled_cb), data);
-       gtk_widget_set_tooltip_text (button, _("Tools"));
-       gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("system-run-symbolic", 
GTK_ICON_SIZE_MENU));
-       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
-       gtk_widget_show_all (button);
-       gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser, 
GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS)), button, FALSE, FALSE, 0);
-
        g_object_unref (builder);
 }
 
diff --git a/extensions/list_tools/data/ui/tools-menu.ui b/extensions/list_tools/data/ui/tools-menu.ui
index 4a973cc..8bc5f79 100644
--- a/extensions/list_tools/data/ui/tools-menu.ui
+++ b/extensions/list_tools/data/ui/tools-menu.ui
@@ -4,8 +4,9 @@
   <menu id="tools-menu">
     <section id="tools1">
     </section>
-    <section id="tools2">
-    </section>
+    <submenu id="tools2">
+      <attribute name="label" translatable="yes">More</attribute>
+    </submenu>
     <section id="tools3">
     </section>
     <section>
diff --git a/extensions/list_tools/list-tools.h b/extensions/list_tools/list-tools.h
index 9172d67..d92a5fd 100644
--- a/extensions/list_tools/list-tools.h
+++ b/extensions/list_tools/list-tools.h
@@ -22,8 +22,8 @@
 #ifndef LIST_TOOLS_H
 #define LIST_TOOLS_H
 
-#define GTH_BROWSER_MENU_MANAGER_TOOLS1 "tools.tools1"
-#define GTH_BROWSER_MENU_MANAGER_TOOLS2 "tools.tools2"
+#define GTH_BROWSER_MENU_MANAGER_TOOLS "tools.tools1"
+#define GTH_BROWSER_MENU_MANAGER_MORE_TOOLS "tools.tools2"
 #define GTH_BROWSER_MENU_MANAGER_TOOLS3 "tools.tools3"
 
 #endif /* LIST_TOOLS_H */
diff --git a/extensions/resize_images/callbacks.c b/extensions/resize_images/callbacks.c
index 6a890b2..65e930c 100644
--- a/extensions/resize_images/callbacks.c
+++ b/extensions/resize_images/callbacks.c
@@ -47,7 +47,7 @@ ri__gth_browser_construct_cb (GthBrowser *browser)
                                         actions,
                                         G_N_ELEMENTS (actions),
                                         browser);
-       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_TOOLS2),
+       gth_menu_manager_append_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_TOOLS),
                                         action_entries,
                                         G_N_ELEMENTS (action_entries));
 }
diff --git a/extensions/slideshow/callbacks.c b/extensions/slideshow/callbacks.c
index 5c972ae..d25a9fc 100644
--- a/extensions/slideshow/callbacks.c
+++ b/extensions/slideshow/callbacks.c
@@ -51,12 +51,6 @@ ss__gth_browser_construct_cb (GthBrowser *browser)
                                           _("View as a slideshow"),
                                           "win.slideshow",
                                           "F5");
-       gth_browser_add_header_bar_button (browser,
-                                          GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW,
-                                          "view-presentation-symbolic",
-                                          _("View as a slideshow"),
-                                          "win.slideshow",
-                                          "F5");
 }
 
 
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index f2bb8c3..c4a5e68 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -1889,6 +1889,7 @@ _gth_browser_deactivate_viewer_page (GthBrowser *browser)
        if (browser->priv->viewer_page != NULL) {
                if (browser->priv->fullscreen)
                        gth_viewer_page_show_pointer (GTH_VIEWER_PAGE (browser->priv->viewer_page), TRUE);
+               gth_hook_invoke ("gth-browser-deactivate-viewer-page", browser);
                gth_viewer_page_deactivate (browser->priv->viewer_page);
                gth_browser_set_viewer_widget (browser, NULL);
                g_object_unref (browser->priv->viewer_page);
@@ -3865,29 +3866,33 @@ gth_browser_init (GthBrowser *browser)
                /* dynamic sections */
 
                for (i = 0; i < GTH_BROWSER_N_HEADER_SECTIONS; i++) {
-                       browser->priv->header_sections[i] = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+                       gboolean separated_buttons;
+
+                       separated_buttons = (i == GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS) || (i == 
GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS);
+
+                       browser->priv->header_sections[i] = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 
separated_buttons ? 6 : 0);
                        gtk_widget_set_valign (browser->priv->header_sections[i], GTK_ALIGN_CENTER);
-                       gtk_style_context_add_class (gtk_widget_get_style_context 
(browser->priv->header_sections[i]), GTK_STYLE_CLASS_LINKED);
+                       if (! separated_buttons)
+                               gtk_style_context_add_class (gtk_widget_get_style_context 
(browser->priv->header_sections[i]), GTK_STYLE_CLASS_LINKED);
                }
 
-               gtk_widget_set_margin_right 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT], SECTION_BIG_MARGIN);
+               gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW], SECTION_BIG_MARGIN);
                gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT], SECTION_BIG_MARGIN);
-
-               gtk_widget_set_margin_right 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT], SECTION_BIG_MARGIN);
                gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT], SECTION_BIG_MARGIN);
+               gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS], SECTION_BIG_MARGIN);
 
                gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION]);
                gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_LOCATIONS]);
                gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_COMMANDS]);
+               gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS]);
                gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW]);
                gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT]);
-               gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS]);
 
                gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_NAVIGATION]);
                gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS]);
+               gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS]);
                gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW]);
                gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT]);
-               gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS]);
 
                /* gears menu button */
 
@@ -5373,6 +5378,7 @@ _gth_browser_set_current_viewer_page (GthBrowser    *browser,
        if (browser->priv->viewer_page == NULL) {
                browser->priv->viewer_page = g_object_new (G_OBJECT_TYPE (registered_viewer_page), NULL);
                gth_viewer_page_activate (browser->priv->viewer_page, browser);
+               gth_hook_invoke ("gth-browser-activate-viewer-page", browser);
                if (browser->priv->fullscreen)
                        gth_viewer_page_show_pointer (GTH_VIEWER_PAGE (browser->priv->viewer_page), FALSE);
 
diff --git a/gthumb/gth-browser.h b/gthumb/gth-browser.h
index 0397a38..253ec29 100644
--- a/gthumb/gth-browser.h
+++ b/gthumb/gth-browser.h
@@ -80,14 +80,14 @@ typedef enum { /*< skip >*/
        GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION,
        GTH_BROWSER_HEADER_SECTION_BROWSER_LOCATIONS,
        GTH_BROWSER_HEADER_SECTION_BROWSER_COMMANDS,
+       GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS,
        GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW,
        GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT,
-       GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS,
        GTH_BROWSER_HEADER_SECTION_VIEWER_NAVIGATION,
        GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS,
+       GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS,
        GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW,
        GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT,
-       GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS,
        GTH_BROWSER_N_HEADER_SECTIONS
 } GthBrowserHeaderSection;
 
diff --git a/gthumb/gth-main-default-hooks.c b/gthumb/gth-main-default-hooks.c
index 68f114a..b402f82 100644
--- a/gthumb/gth-main-default-hooks.c
+++ b/gthumb/gth-main-default-hooks.c
@@ -97,6 +97,20 @@ gth_main_register_default_hooks (void)
        gth_hook_register ("gth-browser-set-current-page", 1);
 
        /**
+        *  Called when after the activation of a viewer page
+        *
+        * @browser (GthBrowser*): the relative window.
+        **/
+       gth_hook_register ("gth-browser-activate-viewer-page", 1);
+
+       /**
+        *  Called before the deactivation of a viewer page.
+        *
+        * @browser (GthBrowser*): the relative window.
+        **/
+       gth_hook_register ("gth-browser-deactivate-viewer-page", 1);
+
+       /**
         * Called before loading a folder.
         *
         * @browser (GthBrowser*): the window
diff --git a/gthumb/gth-menu-manager.c b/gthumb/gth-menu-manager.c
index c42dd2a..516ef1f 100644
--- a/gthumb/gth-menu-manager.c
+++ b/gthumb/gth-menu-manager.c
@@ -26,6 +26,9 @@
 #include "gth-menu-manager.h"
 
 
+#define _G_MENU_ATTRIBUTE_DETAILED_ACTION "gthumb-detailed-action"
+
+
 /* Properties */
 enum {
         PROP_0,
@@ -165,6 +168,7 @@ create_menu_item (const char *label,
        GMenuItem *item;
 
        item = g_menu_item_new (label,detailed_action);
+       g_menu_item_set_attribute (item, _G_MENU_ATTRIBUTE_DETAILED_ACTION, "s", detailed_action, NULL);
        if (accel != NULL)
                g_menu_item_set_attribute (item, "accel", "s", accel, NULL);
        if (icon_name != NULL) {
@@ -221,7 +225,7 @@ _g_menu_model_get_item_position_from_action (GMenuModel *model,
 
                if (g_menu_model_get_item_attribute (model,
                                                     i,
-                                                    G_MENU_ATTRIBUTE_ACTION,
+                                                    _G_MENU_ATTRIBUTE_DETAILED_ACTION,
                                                     "s",
                                                     &item_action))
                {
@@ -250,7 +254,10 @@ gth_menu_manager_remove_entries (GthMenuManager     *menu_manager,
                return;
 
        items = g_hash_table_lookup (menu_manager->priv->items, GINT_TO_POINTER (merge_id));
-       g_return_if_fail (items != NULL);
+       if (items == NULL) {
+               g_hash_table_remove (menu_manager->priv->items, GINT_TO_POINTER (merge_id));
+               return;
+       }
 
        for (scan = items; scan; scan = scan->next) {
                char *detailed_action = scan->data;
diff --git a/gthumb/resources/gears-menu.ui b/gthumb/resources/gears-menu.ui
index ec011fc..ff6d113 100644
--- a/gthumb/resources/gears-menu.ui
+++ b/gthumb/resources/gears-menu.ui
@@ -42,7 +42,6 @@
       <item>
         <attribute name="label" translatable="yes">Thumbnails</attribute>
         <attribute name="action">win.show-thumbnails</attribute>
-        <attribute name="accel"><![CDATA[<Control>t]]></attribute>
       </item>
     </section>
     <section id="folder-actions">


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