Commit 35e2aba4 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

keep the zoom buttons on the headerbar if the tool allow to zoom the image

parent f113a6ee
......@@ -832,4 +832,5 @@ gth_file_tool_resize_init (GthFileToolResize *self)
self->priv->preview = NULL;
self->priv->new_image = NULL;
gth_file_tool_construct (GTH_FILE_TOOL (self), "image-resize-symbolic", _("Resize"), GTH_TOOLBOX_SECTION_FORMAT);
gth_file_tool_set_zoomable (GTH_FILE_TOOL (self), TRUE);
}
......@@ -435,4 +435,5 @@ gth_file_tool_sharpen_init (GthFileToolSharpen *self)
"image-sharpen-symbolic",
_("Enhance Focus"),
GTH_TOOLBOX_SECTION_COLORS);
gth_file_tool_set_zoomable (GTH_FILE_TOOL (self), TRUE);
}
......@@ -921,14 +921,14 @@ gth_image_viewer_page_real_activate (GthViewerPage *base,
self->priv->buttons[0] =
gth_browser_add_header_bar_button (browser,
GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW,
GTH_BROWSER_HEADER_SECTION_VIEWER_ZOOM,
"view-zoom-original-symbolic",
_("Set to actual size"),
"win.image-zoom-100",
NULL);
self->priv->buttons[1] =
gth_browser_add_header_bar_button (browser,
GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW,
GTH_BROWSER_HEADER_SECTION_VIEWER_ZOOM,
"view-zoom-fit-symbolic",
_("Fit to window if larger"),
"win.image-zoom-fit-if-larger",
......@@ -937,7 +937,7 @@ gth_image_viewer_page_real_activate (GthViewerPage *base,
self->priv->builder = gtk_builder_new_from_resource ("/org/gnome/gThumb/image_viewer/data/ui/toolbar-zoom-menu.ui");
self->priv->buttons[ZOOM_BUTTON] =
gth_browser_add_header_bar_menu_button (browser,
GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW,
GTH_BROWSER_HEADER_SECTION_VIEWER_ZOOM,
"view-zoom-in-symbolic",
NULL,
_gtk_builder_get_widget (self->priv->builder, "zoom_popover"));
......
......@@ -2409,6 +2409,16 @@ _gth_browser_update_header_bar_content (GthBrowser *browser)
_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);
section_visible = (page == GTH_BROWSER_PAGE_VIEWER);
if (active_tool) {
GtkWidget *toolbox;
GtkWidget *file_tool;
toolbox = gth_sidebar_get_toolbox (GTH_SIDEBAR (browser->priv->file_properties));
file_tool = gth_toolbox_get_active_tool (GTH_TOOLBOX (toolbox));
section_visible = gth_file_tool_get_zoomable (GTH_FILE_TOOL (file_tool));
}
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_ZOOM, section_visible);
gtk_widget_set_visible (browser->priv->menu_button, ! ((page == GTH_BROWSER_PAGE_VIEWER) && active_tool));
gth_browser_update_title (browser);
......@@ -4458,11 +4468,13 @@ gth_browser_init (GthBrowser *browser)
gtk_widget_set_margin_right (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW], GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
gtk_widget_set_margin_left (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT], GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
gtk_widget_set_margin_right (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT], GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
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_right (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_OTHER_VIEW], GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
gtk_widget_set_margin_right (browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_ZOOM], 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_VIEWER_OTHER_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_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]);
......@@ -4475,6 +4487,11 @@ gth_browser_init (GthBrowser *browser)
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]);
/* GTH_BROWSER_HEADER_SECTION_VIEWER_ZOOM is shared by the viewer and the editor */
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_ZOOM]);
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_start (GTK_HEADER_BAR (header_bar), browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_OTHER_COMMANDS]);
/* gears menu button */
......
......@@ -89,6 +89,7 @@ typedef enum { /*< skip >*/
GTH_BROWSER_HEADER_SECTION_VIEWER_NAVIGATION,
GTH_BROWSER_HEADER_SECTION_VIEWER_OTHER_VIEW,
GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW,
GTH_BROWSER_HEADER_SECTION_VIEWER_ZOOM, /* section shared by viewer and editor */
GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS,
GTH_BROWSER_HEADER_SECTION_VIEWER_OTHER_COMMANDS,
GTH_BROWSER_HEADER_SECTION_VIEWER_SIDEBAR,
......
......@@ -39,6 +39,7 @@ struct _GthFileToolPrivate {
const char *options_title;
GthToolboxSection section;
gboolean cancelled;
gboolean zoomable;
};
......@@ -152,6 +153,7 @@ gth_file_tool_init (GthFileTool *self)
self->priv->icon_name = NULL;
self->priv->options_title = NULL;
self->priv->cancelled = FALSE;
self->priv->zoomable = FALSE;
self->priv->section = GTH_TOOLBOX_SECTION_COLORS;
/*gtk_button_set_relief (GTK_BUTTON (self), GTK_RELIEF_NONE);*/
......@@ -230,6 +232,21 @@ gth_file_tool_is_cancelled (GthFileTool *self)
}
void
gth_file_tool_set_zoomable (GthFileTool *self,
gboolean zoomable)
{
self->priv->zoomable = zoomable;
}
gboolean
gth_file_tool_get_zoomable (GthFileTool *self)
{
return self->priv->zoomable;
}
void
gth_file_tool_update_sensitivity (GthFileTool *self)
{
......
......@@ -74,6 +74,9 @@ const char * gth_file_tool_get_icon_name (GthFileTool *self);
void gth_file_tool_activate (GthFileTool *self);
void gth_file_tool_cancel (GthFileTool *self);
gboolean gth_file_tool_is_cancelled (GthFileTool *self);
void gth_file_tool_set_zoomable (GthFileTool *self,
gboolean zoomable);
gboolean gth_file_tool_get_zoomable (GthFileTool *self);
void gth_file_tool_update_sensitivity (GthFileTool *self);
GtkWidget * gth_file_tool_get_options (GthFileTool *self);
const char * gth_file_tool_get_options_title (GthFileTool *self);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment