[gthumb] added fullscreen button in editor header bar



commit d92c303fe224b4cf80b91179266a967a2a4d98a7
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Jan 2 11:01:40 2016 +0100

    added fullscreen button in editor header bar

 gthumb/gth-browser.c      |   29 ++++++++++++++++++++++-------
 gthumb/gth-browser.h      |    1 +
 gthumb/gth-image-viewer.c |    7 +++++++
 gthumb/gth-image-viewer.h |    2 ++
 4 files changed, 32 insertions(+), 7 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 7327540..7e475f0 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -2398,6 +2398,7 @@ _gth_browser_update_header_bar_content (GthBrowser *browser)
 
        section_visible = (page == GTH_BROWSER_PAGE_VIEWER) && active_tool;
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_EDITOR_NAVIGATION, 
section_visible);
+       _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_EDITOR_VIEW, 
section_visible);
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS, 
section_visible);
        _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_EDITOR_APPLY, 
section_visible);
 
@@ -4434,6 +4435,7 @@ gth_browser_init (GthBrowser *browser)
                gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW], GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
                gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_OTHER_VIEW], 
GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
                gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS], 
GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
+               gtk_widget_set_margin_left 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_VIEW], GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
                gtk_widget_set_margin_right 
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS], 
GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
 
                gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION]);
@@ -4456,6 +4458,7 @@ gth_browser_init (GthBrowser *browser)
 #endif
 
                gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_NAVIGATION]);
+               gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_VIEW]);
 
 #if ! GTK_CHECK_VERSION(3,11,4)
                gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), 
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS]);
@@ -4563,6 +4566,15 @@ gth_browser_init (GthBrowser *browser)
                                                   "win.browser-mode",
                                                   NULL);
 
+               /* editor view */
+
+               gth_browser_add_header_bar_button (browser,
+                                                  GTH_BROWSER_HEADER_SECTION_EDITOR_VIEW,
+                                                  "view-fullscreen-symbolic",
+                                                  _("Fullscreen"),
+                                                  "win.fullscreen",
+                                                  NULL);
+
                /* editor commands */
 
                button = gth_browser_add_header_bar_label_button (browser,
@@ -6457,12 +6469,14 @@ gth_browser_hide_sidebar (GthBrowser *browser)
                break;
 
        case GTH_BROWSER_PAGE_VIEWER:
-               if (browser->priv->viewer_sidebar == GTH_SIDEBAR_STATE_PROPERTIES)
-                       gth_window_change_action_state (GTH_WINDOW (browser), "viewer-properties", FALSE);
-               else if (browser->priv->viewer_sidebar == GTH_SIDEBAR_STATE_TOOLS)
-                       gth_window_change_action_state (GTH_WINDOW (browser), "viewer-edit-file", FALSE);
-               browser->priv->viewer_sidebar = GTH_SIDEBAR_STATE_HIDDEN;
-               gtk_widget_hide (browser->priv->viewer_sidebar_alignment);
+               if (! gth_sidebar_tool_is_active (GTH_SIDEBAR (browser->priv->file_properties))) {
+                       if (browser->priv->viewer_sidebar == GTH_SIDEBAR_STATE_PROPERTIES)
+                               gth_window_change_action_state (GTH_WINDOW (browser), "viewer-properties", 
FALSE);
+                       else if (browser->priv->viewer_sidebar == GTH_SIDEBAR_STATE_TOOLS)
+                               gth_window_change_action_state (GTH_WINDOW (browser), "viewer-edit-file", 
FALSE);
+                       browser->priv->viewer_sidebar = GTH_SIDEBAR_STATE_HIDDEN;
+                       gtk_widget_hide (browser->priv->viewer_sidebar_alignment);
+               }
                break;
        }
 }
@@ -6783,7 +6797,8 @@ gth_browser_unfullscreen (GthBrowser *browser)
 
        gth_window_show_only_content (GTH_WINDOW (browser), FALSE);
 
-       browser->priv->fullscreen_state.sidebar = browser->priv->viewer_sidebar;
+       if (! gth_sidebar_tool_is_active (GTH_SIDEBAR (browser->priv->file_properties)))
+               browser->priv->fullscreen_state.sidebar = browser->priv->viewer_sidebar;
        browser->priv->fullscreen_state.thumbnail_list = gth_window_get_action_state (GTH_WINDOW (browser), 
"show-thumbnail-list");
 
        if (browser->priv->before_fullscreen.page < 0)
diff --git a/gthumb/gth-browser.h b/gthumb/gth-browser.h
index 724bec0..382b3a0 100644
--- a/gthumb/gth-browser.h
+++ b/gthumb/gth-browser.h
@@ -93,6 +93,7 @@ typedef enum { /*< skip >*/
        GTH_BROWSER_HEADER_SECTION_VIEWER_SIDEBAR,
        GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT,
        GTH_BROWSER_HEADER_SECTION_EDITOR_NAVIGATION,
+       GTH_BROWSER_HEADER_SECTION_EDITOR_VIEW,
        GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
        GTH_BROWSER_HEADER_SECTION_EDITOR_APPLY,
        GTH_BROWSER_N_HEADER_SECTIONS
diff --git a/gthumb/gth-image-viewer.c b/gthumb/gth-image-viewer.c
index 0ab0f67..9e19fb7 100644
--- a/gthumb/gth-image-viewer.c
+++ b/gthumb/gth-image-viewer.c
@@ -2247,6 +2247,13 @@ gth_image_viewer_set_tool (GthImageViewer     *self,
 }
 
 
+GthImageViewerTool *
+gth_image_viewer_get_tool (GthImageViewer *self)
+{
+       return self->priv->tool;
+}
+
+
 void
 gth_image_viewer_scroll_to (GthImageViewer *self,
                            int             x_offset,
diff --git a/gthumb/gth-image-viewer.h b/gthumb/gth-image-viewer.h
index 8b03a33..9754b7f 100644
--- a/gthumb/gth-image-viewer.h
+++ b/gthumb/gth-image-viewer.h
@@ -222,6 +222,8 @@ void           gth_image_viewer_enable_zoom_with_keys    (GthImageViewer
 void           gth_image_viewer_clicked                  (GthImageViewer        *viewer);
 void           gth_image_viewer_set_tool                 (GthImageViewer        *viewer,
                                                          GthImageViewerTool    *tool);
+GthImageViewerTool *
+              gth_image_viewer_get_tool                 (GthImageViewer        *viewer);
 
 /* Scrolling. */
 


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