[gthumb] reorganized the header bar buttons and sections



commit b67b20746bef178a653cfc989cedcb79dae5153f
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Nov 5 16:44:41 2013 +0100

    reorganized the header bar buttons and sections

 extensions/catalogs/callbacks.c                    |   29 +++++--
 extensions/edit_metadata/callbacks.c               |   12 ---
 extensions/gstreamer_tools/gth-media-viewer-page.c |    2 +-
 extensions/image_rotation/callbacks.c              |    2 +-
 extensions/list_tools/data/ui/tools-menu.ui        |    5 +-
 extensions/slideshow/callbacks.c                   |    2 +-
 gthumb/gth-browser-actions-entries.h               |    4 +
 gthumb/gth-browser.c                               |   79 ++++++++------------
 gthumb/gth-browser.h                               |    2 +-
 9 files changed, 61 insertions(+), 76 deletions(-)
---
diff --git a/extensions/catalogs/callbacks.c b/extensions/catalogs/callbacks.c
index 540d880..f101fee 100644
--- a/extensions/catalogs/callbacks.c
+++ b/extensions/catalogs/callbacks.c
@@ -52,8 +52,12 @@ static const GthMenuEntry fixed_menu_entries[] = {
 };
 
 
-static const GthMenuEntry file_list_popup_entries[] = {
+static const GthMenuEntry vfs_open_actions_entries[] = {
        { N_("Open Folder"), "win.go-to-container-from-catalog", "<Alt>end" },
+};
+
+
+static const GthMenuEntry vfs_other_actions_entries[] = {
        { N_("Remove from Catalog"), "win.remove-from-catalog" },
 };
 
@@ -70,7 +74,8 @@ static const GthMenuEntry folder_popup_entries[] = {
 typedef struct {
        GthBrowser     *browser;
        guint           folder_popup_merge_id;
-       guint           vfs_merge_id;
+       guint           vfs_open_actions_merge_id;
+       guint           vfs_other_actions_merge_id;
        gboolean        catalog_menu_loaded;
        guint           n_top_catalogs;
        guint           monitor_events;
@@ -274,15 +279,23 @@ catalogs__gth_browser_load_location_after_cb (GthBrowser   *browser,
        data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
 
        if (GTH_IS_FILE_SOURCE_CATALOGS (gth_browser_get_location_source (browser))) {
-               if (data->vfs_merge_id == 0)
-                       data->vfs_merge_id =
+               if (data->vfs_open_actions_merge_id == 0)
+                       data->vfs_open_actions_merge_id =
+                                       gth_menu_manager_append_entries (gth_browser_get_menu_manager 
(browser, GTH_BROWSER_MENU_MANAGER_FILE_LIST_OPEN_ACTIONS),
+                                                                        vfs_open_actions_entries,
+                                                                        G_N_ELEMENTS 
(vfs_open_actions_entries));
+               if (data->vfs_other_actions_merge_id == 0)
+                       data->vfs_other_actions_merge_id =
                                        gth_menu_manager_append_entries (gth_browser_get_menu_manager 
(browser, GTH_BROWSER_MENU_MANAGER_FILE_LIST_OTHER_ACTIONS),
-                                                                        file_list_popup_entries,
-                                                                        G_N_ELEMENTS 
(file_list_popup_entries));
+                                                                        vfs_other_actions_entries,
+                                                                        G_N_ELEMENTS 
(vfs_other_actions_entries));
        }
        else {
-               gth_menu_manager_remove_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_FILE_LIST_OTHER_ACTIONS), data->vfs_merge_id);
-               data->vfs_merge_id = 0;
+               gth_menu_manager_remove_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_FILE_LIST_OPEN_ACTIONS), data->vfs_open_actions_merge_id);
+               data->vfs_open_actions_merge_id = 0;
+
+               gth_menu_manager_remove_entries (gth_browser_get_menu_manager (browser, 
GTH_BROWSER_MENU_MANAGER_FILE_LIST_OTHER_ACTIONS), data->vfs_other_actions_merge_id);
+               data->vfs_other_actions_merge_id = 0;
        }
 }
 
diff --git a/extensions/edit_metadata/callbacks.c b/extensions/edit_metadata/callbacks.c
index 7372760..cd2ae39 100644
--- a/extensions/edit_metadata/callbacks.c
+++ b/extensions/edit_metadata/callbacks.c
@@ -61,18 +61,6 @@ edit_metadata__gth_browser_construct_cb (GthBrowser *browser)
                                                 G_N_ELEMENTS (action_entries));
 
        gth_browser_add_header_bar_button (browser,
-                                          GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT,
-                                          "comment-symbolic",
-                                          _("Comment"),
-                                          "win.edit-metadata",
-                                          NULL);
-       gth_browser_add_header_bar_button (browser,
-                                          GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT,
-                                          "tag-symbolic",
-                                          _("Tags"),
-                                          "win.edit-tags",
-                                          NULL);
-       gth_browser_add_header_bar_button (browser,
                                           GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT,
                                           "comment-symbolic",
                                           _("Comment"),
diff --git a/extensions/gstreamer_tools/gth-media-viewer-page.c 
b/extensions/gstreamer_tools/gth-media-viewer-page.c
index 8b3f113..31202fa 100644
--- a/extensions/gstreamer_tools/gth-media-viewer-page.c
+++ b/extensions/gstreamer_tools/gth-media-viewer-page.c
@@ -711,7 +711,7 @@ gth_media_viewer_page_real_activate (GthViewerPage *base,
                                         browser);
        self->priv->screenshot_button =
                        gth_browser_add_header_bar_button (browser,
-                                                          GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS,
+                                                          GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW,
                                                           "camera-photo-symbolic",
                                                           _("Take a screenshot"),
                                                           "win.video-screenshot",
diff --git a/extensions/image_rotation/callbacks.c b/extensions/image_rotation/callbacks.c
index 9db93cd..73970a5 100644
--- a/extensions/image_rotation/callbacks.c
+++ b/extensions/image_rotation/callbacks.c
@@ -42,8 +42,8 @@ static const GActionEntry actions[] = {
 
 
 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" },
+       { N_("Rotate Right"), "win.rotate-right", "bracketright", "object-rotate-right-symbolic" },
 };
 
 
diff --git a/extensions/list_tools/data/ui/tools-menu.ui b/extensions/list_tools/data/ui/tools-menu.ui
index 8bc5f79..4a973cc 100644
--- a/extensions/list_tools/data/ui/tools-menu.ui
+++ b/extensions/list_tools/data/ui/tools-menu.ui
@@ -4,9 +4,8 @@
   <menu id="tools-menu">
     <section id="tools1">
     </section>
-    <submenu id="tools2">
-      <attribute name="label" translatable="yes">More</attribute>
-    </submenu>
+    <section id="tools2">
+    </section>
     <section id="tools3">
     </section>
     <section>
diff --git a/extensions/slideshow/callbacks.c b/extensions/slideshow/callbacks.c
index d25a9fc..035ad5a 100644
--- a/extensions/slideshow/callbacks.c
+++ b/extensions/slideshow/callbacks.c
@@ -48,7 +48,7 @@ ss__gth_browser_construct_cb (GthBrowser *browser)
        gth_browser_add_header_bar_button (browser,
                                           GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW,
                                           "view-presentation-symbolic",
-                                          _("View as a slideshow"),
+                                          _("Presentation"),
                                           "win.slideshow",
                                           "F5");
 }
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index df0e902..15137dc 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -67,6 +67,10 @@ static const GthAccelerator gth_browser_accelerators[] = {
        { "revert-to-saved", "F4" },
        { "show-sidebar", "F9" },
        { "show-thumbnail-list", "F8" },
+       { "go-back", "<Alt>Left" },
+       { "go-forward", "<Alt>Right" },
+       { "go-up", "<Alt>Up" },
+       { "go-home", "<Alt>Home" }
 };
 
 
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index d727d6f..04d078e 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -2182,13 +2182,13 @@ _gth_browser_real_set_current_page (GthWindow *window,
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_LOCATIONS, 
page == GTH_BROWSER_PAGE_BROWSER);
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_COMMANDS, 
page == GTH_BROWSER_PAGE_BROWSER);
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW, page 
== GTH_BROWSER_PAGE_BROWSER);
-       _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT, page 
== GTH_BROWSER_PAGE_BROWSER);
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS, 
page == GTH_BROWSER_PAGE_BROWSER);
 
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_NAVIGATION, 
page == GTH_BROWSER_PAGE_VIEWER);
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS, 
page == GTH_BROWSER_PAGE_VIEWER);
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW, page 
== GTH_BROWSER_PAGE_VIEWER);
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT, page 
== GTH_BROWSER_PAGE_VIEWER);
+       _gth_browser_update_header_section_visibility (browser, 
GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT_SIDEBAR, page == GTH_BROWSER_PAGE_VIEWER);
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS, page 
== GTH_BROWSER_PAGE_VIEWER);
 
        gtk_widget_set_visible (browser->priv->browser_status_commands, page == GTH_BROWSER_PAGE_BROWSER);
@@ -3867,29 +3867,30 @@ gth_browser_init (GthBrowser *browser)
 
        /* -- browser page -- */
 
-       /* headerbar */
+       /* dynamic header sections */
 
-       {
-               GtkWidget *header_bar;
-               GtkWidget *button;
+       for (i = 0; i < GTH_BROWSER_N_HEADER_SECTIONS; i++) {
+               gboolean separated_buttons;
 
-               header_bar = gth_window_get_header_bar (GTH_WINDOW (browser));
+               separated_buttons = ((i == GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS)
+                                    || (i == GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS)
+                                    || (i == GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT_SIDEBAR));
 
-               /* dynamic sections */
+               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);
+               if (! separated_buttons)
+                       gtk_style_context_add_class (gtk_widget_get_style_context 
(browser->priv->header_sections[i]), GTK_STYLE_CLASS_LINKED);
+       }
 
-               for (i = 0; i < GTH_BROWSER_N_HEADER_SECTIONS; i++) {
-                       gboolean separated_buttons;
+       /* window header bar */
 
-                       separated_buttons = (i == GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS) || (i == 
GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS);
+       {
+               GtkWidget *header_bar;
 
-                       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);
-                       if (! separated_buttons)
-                               gtk_style_context_add_class (gtk_widget_get_style_context 
(browser->priv->header_sections[i]), GTK_STYLE_CLASS_LINKED);
-               }
+               header_bar = gth_window_get_header_bar (GTH_WINDOW (browser));
 
-               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_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_COMMANDS], SECTION_BIG_MARGIN);
+               gtk_widget_set_margin_right 
(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_VIEWER_EDIT], SECTION_BIG_MARGIN);
                gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW], SECTION_BIG_MARGIN);
                gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS], SECTION_BIG_MARGIN);
@@ -3897,14 +3898,14 @@ gth_browser_init (GthBrowser *browser)
                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_VIEW]);
                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_EDIT_SIDEBAR]);
                gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT]);
 
                /* gears menu button */
@@ -3938,30 +3939,19 @@ gth_browser_init (GthBrowser *browser)
                                                   "go-previous-symbolic",
                                                   _("Go to the previous visited location"),
                                                   "win.go-back",
-                                                  "<alt>Left");
+                                                  NULL);
                gth_browser_add_header_bar_button (browser,
                                                   GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION,
                                                   "go-next-symbolic",
                                                   _("Go to the next visited location"),
                                                   "win.go-forward",
-                                                  "<alt>Right");
-               /*gth_browser_add_header_bar_button (browser,
-                                                  GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION,
-                                                  "go-up-symbolic",
-                                                  _("Go up one level"),
-                                                  "win.go-up",
-                                                  "<alt>Up");*/
-               gth_browser_add_header_bar_button (browser,
-                                                  GTH_BROWSER_HEADER_SECTION_BROWSER_LOCATIONS,
-                                                  "user-home-symbolic",
-                                                  NULL,
-                                                  "win.go-home",
-                                                  "<alt>Home");
+                                                  NULL);
 
                /* history menu button */
 
                {
                        GtkBuilder *builder;
+                       GtkWidget  *button;
 
                        builder = _gtk_builder_new_from_resource ("history-menu.ui");
                        button = _gtk_menu_button_new_for_header_bar ();
@@ -3976,15 +3966,6 @@ gth_browser_init (GthBrowser *browser)
                        g_object_unref (builder);
                }
 
-               /* browser commands */
-
-               gth_browser_add_header_bar_button (browser,
-                                                  GTH_BROWSER_HEADER_SECTION_BROWSER_EDIT,
-                                                  "palette-symbolic",
-                                                  _("Edit file"),
-                                                  "win.browser-edit-file",
-                                                  NULL);
-
                /* viewer navigation */
 
                gth_browser_add_header_bar_button (browser,
@@ -3997,7 +3978,13 @@ gth_browser_init (GthBrowser *browser)
                /* viewer edit */
 
                gth_browser_add_header_bar_toggle_button (browser,
-                                                         GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT,
+                                                         GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT_SIDEBAR,
+                                                         "dialog-information-symbolic",
+                                                         _("Properties"),
+                                                         "win.viewer-properties",
+                                                         NULL);
+               gth_browser_add_header_bar_toggle_button (browser,
+                                                         GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT_SIDEBAR,
                                                          "palette-symbolic",
                                                          _("Edit file"),
                                                          "win.viewer-edit-file",
@@ -4039,12 +4026,6 @@ gth_browser_init (GthBrowser *browser)
                gtk_box_pack_start (GTK_BOX (gth_statubar_get_action_area (GTH_STATUSBAR 
(browser->priv->statusbar))), browser->priv->viewer_status_commands, FALSE, FALSE, 0);
 
                button = gtk_toggle_button_new ();
-               gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name 
("dialog-information-symbolic", GTK_ICON_SIZE_MENU));
-               gtk_widget_show_all (button);
-               gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.viewer-properties");
-               gtk_box_pack_end (GTK_BOX (browser->priv->viewer_status_commands), button, FALSE, FALSE, 0);
-
-               button = gtk_toggle_button_new ();
                gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name 
("view-grid-symbolic", GTK_ICON_SIZE_MENU));
                gtk_widget_show_all (button);
                gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.show-thumbnail-list");
diff --git a/gthumb/gth-browser.h b/gthumb/gth-browser.h
index 6bc0595..a5f1f93 100644
--- a/gthumb/gth-browser.h
+++ b/gthumb/gth-browser.h
@@ -82,11 +82,11 @@ typedef enum { /*< skip >*/
        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_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_SIDEBAR,
        GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT,
        GTH_BROWSER_N_HEADER_SECTIONS
 } GthBrowserHeaderSection;


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