[gthumb] moved the file tool buttons in the main headerbar
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] moved the file tool buttons in the main headerbar
- Date: Tue, 23 Dec 2014 11:34:12 +0000 (UTC)
commit f4017e19ba8a0598df8e8c249052b39daa3c1823
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Dec 23 11:46:41 2014 +0100
moved the file tool buttons in the main headerbar
.../file_tools/data/ui/adjust-colors-options.ui | 32 ----
extensions/file_tools/data/ui/crop-options.ui | 38 +----
extensions/file_tools/data/ui/resize-options.ui | 69 ++------
extensions/file_tools/data/ui/rotate-options.ui | 57 +------
extensions/file_tools/data/ui/sharpen-options.ui | 32 ----
.../file_tools/gth-file-tool-adjust-colors.c | 38 +++--
extensions/file_tools/gth-file-tool-crop.c | 30 +++-
extensions/file_tools/gth-file-tool-resize.c | 30 +++-
extensions/file_tools/gth-file-tool-rotate.c | 56 +++++--
extensions/file_tools/gth-file-tool-sharpen.c | 38 +++--
gthumb/gth-browser-actions-callbacks.c | 11 ++
gthumb/gth-browser-actions-callbacks.h | 1 +
gthumb/gth-browser-actions-entries.h | 2 +
gthumb/gth-browser.c | 188 +++++++++++++-------
gthumb/gth-browser.h | 9 +
gthumb/gth-file-tool.c | 18 ++-
gthumb/gth-file-tool.h | 5 +
gthumb/gth-toolbox.c | 23 +--
gthumb/gth-toolbox.h | 1 +
19 files changed, 350 insertions(+), 328 deletions(-)
---
diff --git a/extensions/file_tools/data/ui/adjust-colors-options.ui
b/extensions/file_tools/data/ui/adjust-colors-options.ui
index e486f3e..5701629 100644
--- a/extensions/file_tools/data/ui/adjust-colors-options.ui
+++ b/extensions/file_tools/data/ui/adjust-colors-options.ui
@@ -363,38 +363,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="reset_button">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Reset</property>
- <property name="use_underline">True</property>
- <child>
- <object class="GtkImage" id="reset_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/extensions/file_tools/data/ui/crop-options.ui b/extensions/file_tools/data/ui/crop-options.ui
index 7516302..45b285d 100644
--- a/extensions/file_tools/data/ui/crop-options.ui
+++ b/extensions/file_tools/data/ui/crop-options.ui
@@ -126,7 +126,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
- <property name="spacing">12</property>
+ <property name="spacing">24</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
@@ -158,7 +158,6 @@
<object class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_left">6</property>
<property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
@@ -431,7 +430,6 @@
<object class="GtkVBox" id="vbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_left">6</property>
<property name="spacing">6</property>
<child>
<object class="GtkHBox" id="ratio_combobox_box">
@@ -587,40 +585,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkButton" id="options_button">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Options</property>
- <child>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">preferences-system-symbolic</property>
- <property name="icon_size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/extensions/file_tools/data/ui/resize-options.ui b/extensions/file_tools/data/ui/resize-options.ui
index 5509612..8b0dd71 100644
--- a/extensions/file_tools/data/ui/resize-options.ui
+++ b/extensions/file_tools/data/ui/resize-options.ui
@@ -122,7 +122,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
- <property name="spacing">12</property>
+ <property name="spacing">24</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
@@ -387,7 +387,6 @@
<object class="GtkVBox" id="vbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_left">6</property>
<property name="spacing">6</property>
<child>
<object class="GtkHBox" id="ratio_combobox_box">
@@ -487,40 +486,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkButton" id="options_button">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Options</property>
- <child>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">preferences-system-symbolic</property>
- <property name="icon_size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
@@ -529,17 +494,6 @@
</packing>
</child>
<child>
- <object class="GtkHSeparator" id="separator1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
<object class="GtkHBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -548,7 +502,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">12</property>
- <property name="margin_bottom">6</property>
+ <property name="margin_bottom">12</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
@@ -557,7 +511,7 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
+ <property name="xalign">1</property>
<property name="label" translatable="yes">Original dimensions:</property>
<attributes>
<attribute name="scale" value="0.80000000000000004"/>
@@ -572,7 +526,7 @@
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
+ <property name="xalign">1</property>
<property name="label" translatable="yes">Scale factor:</property>
<attributes>
<attribute name="scale" value="0.80000000000000004"/>
@@ -623,7 +577,7 @@
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
+ <property name="xalign">1</property>
<property name="label" translatable="yes">New dimensions:</property>
<attributes>
<attribute name="scale" value="0.80000000000000004"/>
@@ -665,6 +619,19 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHSeparator" id="separator1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
diff --git a/extensions/file_tools/data/ui/rotate-options.ui b/extensions/file_tools/data/ui/rotate-options.ui
index 77a48e9..2292349 100644
--- a/extensions/file_tools/data/ui/rotate-options.ui
+++ b/extensions/file_tools/data/ui/rotate-options.ui
@@ -207,7 +207,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
- <property name="spacing">12</property>
+ <property name="spacing">24</property>
<child>
<object class="GtkBox" id="box4">
<property name="visible">True</property>
@@ -338,7 +338,6 @@
<object class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_left">6</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="box3">
@@ -480,60 +479,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkButton" id="reset_button">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Reset</property>
- <child>
- <object class="GtkImage" id="reset_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="options_button">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Options</property>
- <child>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">preferences-system-symbolic</property>
- <property name="icon_size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/extensions/file_tools/data/ui/sharpen-options.ui
b/extensions/file_tools/data/ui/sharpen-options.ui
index ef2f87e..9ff95b9 100644
--- a/extensions/file_tools/data/ui/sharpen-options.ui
+++ b/extensions/file_tools/data/ui/sharpen-options.ui
@@ -180,38 +180,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="reset_button">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Reset</property>
- <property name="use_underline">True</property>
- <child>
- <object class="GtkImage" id="reset_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/extensions/file_tools/gth-file-tool-adjust-colors.c
b/extensions/file_tools/gth-file-tool-adjust-colors.c
index 8b0d42f..4ff5901 100644
--- a/extensions/file_tools/gth-file-tool-adjust-colors.c
+++ b/extensions/file_tools/gth-file-tool-adjust-colors.c
@@ -395,12 +395,9 @@ gth_file_tool_adjust_colors_get_options (GthFileTool *base)
GtkWidget *options;
int width, height;
GtkAllocation allocation;
- gboolean rtl;
self = (GthFileToolAdjustColors *) base;
- rtl = gtk_widget_get_direction (GTK_WIDGET (base)) == GTK_TEXT_DIR_RTL;
-
viewer_page = gth_image_viewer_page_tool_get_page (GTH_IMAGE_VIEWER_PAGE_TOOL (self));
if (viewer_page == NULL)
return NULL;
@@ -429,10 +426,6 @@ gth_file_tool_adjust_colors_get_options (GthFileTool *base)
options = _gtk_builder_get_widget (self->priv->builder, "options");
gtk_widget_show (options);
- gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET("reset_image")), rtl ? "edit-undo-rtl-symbolic" :
- "edit-undo-symbolic",
- GTK_ICON_SIZE_MENU);
-
self->priv->histogram_view = gth_histogram_view_new (self->priv->histogram);
gtk_widget_show (self->priv->histogram_view);
gtk_box_pack_start (GTK_BOX (GET_WIDGET ("histogram_hbox")), self->priv->histogram_view, TRUE, TRUE,
0);
@@ -466,10 +459,6 @@ gth_file_tool_adjust_colors_get_options (GthFileTool *base)
GTH_COLOR_SCALE_YELLOW_BLUE,
0.0, -99.0, 99.0, 1.0, 1.0, "%+.0f");
- g_signal_connect (GET_WIDGET ("reset_button"),
- "clicked",
- G_CALLBACK (reset_button_clicked_cb),
- self);
g_signal_connect (G_OBJECT (self->priv->brightness_adj),
"value-changed",
G_CALLBACK (value_changed_cb),
@@ -547,6 +536,32 @@ gth_file_tool_adjust_colors_apply_options (GthFileTool *base)
static void
+gth_file_tool_adjust_colors_populate_headerbar (GthFileTool *base,
+ GthBrowser *browser)
+{
+ GthFileToolAdjustColors *self;
+ gboolean rtl;
+ GtkWidget *button;
+
+ self = (GthFileToolAdjustColors *) base;
+
+ /* reset button */
+
+ rtl = gtk_widget_get_direction (GTK_WIDGET (base)) == GTK_TEXT_DIR_RTL;
+ button = gth_browser_add_header_bar_button (browser,
+ GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
+ rtl ? "edit-undo-rtl-symbolic" : "edit-undo-symbolic",
+ _("Reset"),
+ NULL,
+ NULL);
+ g_signal_connect (button,
+ "clicked",
+ G_CALLBACK (reset_button_clicked_cb),
+ self);
+}
+
+
+static void
gth_file_tool_sharpen_reset_image (GthImageViewerPageTool *base)
{
GthFileToolAdjustColors *self = (GthFileToolAdjustColors *) base;
@@ -617,6 +632,7 @@ gth_file_tool_adjust_colors_class_init (GthFileToolAdjustColorsClass *klass)
file_tool_class->get_options = gth_file_tool_adjust_colors_get_options;
file_tool_class->destroy_options = gth_file_tool_adjust_colors_destroy_options;
file_tool_class->apply_options = gth_file_tool_adjust_colors_apply_options;
+ file_tool_class->populate_headerbar = gth_file_tool_adjust_colors_populate_headerbar;
image_viewer_page_tool_class = (GthImageViewerPageToolClass *) klass;
image_viewer_page_tool_class->reset_image = gth_file_tool_sharpen_reset_image;
diff --git a/extensions/file_tools/gth-file-tool-crop.c b/extensions/file_tools/gth-file-tool-crop.c
index 977a847..c0a98ef 100644
--- a/extensions/file_tools/gth-file-tool-crop.c
+++ b/extensions/file_tools/gth-file-tool-crop.c
@@ -479,10 +479,6 @@ gth_file_tool_crop_get_options (GthFileTool *base)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("bind_factor_spinbutton")),
g_settings_get_int (self->priv->settings, PREF_CROP_BIND_FACTOR));
- g_signal_connect (GET_WIDGET ("options_button"),
- "clicked",
- G_CALLBACK (options_button_clicked_cb),
- self);
g_signal_connect_swapped (GET_WIDGET ("options_close_button"),
"clicked",
G_CALLBACK (gtk_widget_hide),
@@ -644,6 +640,31 @@ gth_file_tool_crop_apply_options (GthFileTool *base)
static void
+gth_file_tool_crop_populate_headerbar (GthFileTool *base,
+ GthBrowser *browser)
+{
+ GthFileToolCrop *self;
+ GtkWidget *button;
+
+ self = (GthFileToolCrop *) base;
+
+ /* preferences dialog */
+
+ button = gth_browser_add_header_bar_button (browser,
+ GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
+ "preferences-system-symbolic",
+ _("Options"),
+ NULL,
+ NULL);
+ g_signal_connect (button,
+ "clicked",
+ G_CALLBACK (options_button_clicked_cb),
+ self);
+
+}
+
+
+static void
gth_file_tool_crop_reset_image (GthImageViewerPageTool *base)
{
GthFileToolCrop *self = (GthFileToolCrop *) base;
@@ -697,6 +718,7 @@ gth_file_tool_crop_class_init (GthFileToolCropClass *klass)
file_tool_class->get_options = gth_file_tool_crop_get_options;
file_tool_class->destroy_options = gth_file_tool_crop_destroy_options;
file_tool_class->apply_options = gth_file_tool_crop_apply_options;
+ file_tool_class->populate_headerbar = gth_file_tool_crop_populate_headerbar;
image_viewer_page_tool_class = (GthImageViewerPageToolClass *) klass;
image_viewer_page_tool_class->reset_image = gth_file_tool_crop_reset_image;
diff --git a/extensions/file_tools/gth-file-tool-resize.c b/extensions/file_tools/gth-file-tool-resize.c
index b310ca2..36a7d74 100644
--- a/extensions/file_tools/gth-file-tool-resize.c
+++ b/extensions/file_tools/gth-file-tool-resize.c
@@ -609,10 +609,6 @@ gth_file_tool_resize_get_options (GthFileTool *base)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_h_spinbutton")),
MAX (g_settings_get_int (self->priv->settings,
PREF_RESIZE_ASPECT_RATIO_HEIGHT), 1));
- g_signal_connect (GET_WIDGET ("options_button"),
- "clicked",
- G_CALLBACK (options_button_clicked_cb),
- self);
g_signal_connect_swapped (GET_WIDGET ("options_close_button"),
"clicked",
G_CALLBACK (gtk_widget_hide),
@@ -737,6 +733,31 @@ gth_file_tool_resize_apply_options (GthFileTool *base)
static void
+gth_file_tool_resize_populate_headerbar (GthFileTool *base,
+ GthBrowser *browser)
+{
+ GthFileToolResize *self;
+ GtkWidget *button;
+
+ self = (GthFileToolResize *) base;
+
+ /* preferences dialog */
+
+ button = gth_browser_add_header_bar_button (browser,
+ GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
+ "preferences-system-symbolic",
+ _("Options"),
+ NULL,
+ NULL);
+ g_signal_connect (button,
+ "clicked",
+ G_CALLBACK (options_button_clicked_cb),
+ self);
+
+}
+
+
+static void
gth_file_tool_resize_reset_image (GthImageViewerPageTool *base)
{
GthFileToolResize *self = (GthFileToolResize *) base;
@@ -793,6 +814,7 @@ gth_file_tool_resize_class_init (GthFileToolResizeClass *klass)
file_tool_class->get_options = gth_file_tool_resize_get_options;
file_tool_class->destroy_options = gth_file_tool_resize_destroy_options;
file_tool_class->apply_options = gth_file_tool_resize_apply_options;
+ file_tool_class->populate_headerbar = gth_file_tool_resize_populate_headerbar;
image_viewer_page_tool_class = (GthImageViewerPageToolClass *) klass;
image_viewer_page_tool_class->reset_image = gth_file_tool_resize_reset_image;
diff --git a/extensions/file_tools/gth-file-tool-rotate.c b/extensions/file_tools/gth-file-tool-rotate.c
index 76c2d1a..96f22c9 100644
--- a/extensions/file_tools/gth-file-tool-rotate.c
+++ b/extensions/file_tools/gth-file-tool-rotate.c
@@ -357,12 +357,9 @@ gth_file_tool_rotate_get_options (GthFileTool *base)
GtkWidget *viewer;
char *color_spec;
GdkRGBA background_color;
- gboolean rtl;
self = (GthFileToolRotate *) base;
- rtl = gtk_widget_get_direction (GTK_WIDGET (base)) == GTK_TEXT_DIR_RTL;
-
window = gth_file_tool_get_window (base);
viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
@@ -378,10 +375,6 @@ gth_file_tool_rotate_get_options (GthFileTool *base)
self->priv->builder = _gtk_builder_new_from_file ("rotate-options.ui", "file_tools");
- gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET("reset_image")), rtl ? "edit-undo-rtl-symbolic" :
- "edit-undo-symbolic",
- GTK_ICON_SIZE_MENU);
-
self->priv->rotation_angle_adj = gth_color_scale_label_new (GET_WIDGET ("rotation_angle_hbox"),
GTK_LABEL (GET_WIDGET
("rotation_angle_label")),
GTH_COLOR_SCALE_DEFAULT,
@@ -451,14 +444,6 @@ gth_file_tool_rotate_get_options (GthFileTool *base)
self->priv->crop_region.width = cairo_image_surface_get_width (self->priv->image);
self->priv->crop_region.height = cairo_image_surface_get_height (self->priv->image);
- g_signal_connect (GET_WIDGET ("reset_button"),
- "clicked",
- G_CALLBACK (reset_button_clicked_cb),
- self);
- g_signal_connect (GET_WIDGET ("options_button"),
- "clicked",
- G_CALLBACK (options_button_clicked_cb),
- self);
g_signal_connect_swapped (GET_WIDGET ("options_close_button"),
"clicked",
G_CALLBACK (gtk_widget_hide),
@@ -600,6 +585,46 @@ gth_file_tool_rotate_apply_options (GthFileTool *base)
static void
+gth_file_tool_rotate_populate_headerbar (GthFileTool *base,
+ GthBrowser *browser)
+{
+ GthFileToolRotate *self;
+ gboolean rtl;
+ GtkWidget *button;
+
+ self = (GthFileToolRotate *) base;
+
+ /* reset button */
+
+ rtl = gtk_widget_get_direction (GTK_WIDGET (base)) == GTK_TEXT_DIR_RTL;
+ button = gth_browser_add_header_bar_button (browser,
+ GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
+ rtl ? "edit-undo-rtl-symbolic" : "edit-undo-symbolic",
+ _("Reset"),
+ NULL,
+ NULL);
+ g_signal_connect (button,
+ "clicked",
+ G_CALLBACK (reset_button_clicked_cb),
+ self);
+
+ /* preferences dialog */
+
+ button = gth_browser_add_header_bar_button (browser,
+ GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
+ "preferences-system-symbolic",
+ _("Options"),
+ NULL,
+ NULL);
+ g_signal_connect (button,
+ "clicked",
+ G_CALLBACK (options_button_clicked_cb),
+ self);
+
+}
+
+
+static void
gth_file_tool_rotate_reset_image (GthImageViewerPageTool *self)
{
gth_image_viewer_page_reset (GTH_IMAGE_VIEWER_PAGE (gth_image_viewer_page_tool_get_page
(GTH_IMAGE_VIEWER_PAGE_TOOL (self))));
@@ -642,6 +667,7 @@ gth_file_tool_rotate_class_init (GthFileToolRotateClass *klass)
file_tool_class->get_options = gth_file_tool_rotate_get_options;
file_tool_class->destroy_options = gth_file_tool_rotate_destroy_options;
file_tool_class->apply_options = gth_file_tool_rotate_apply_options;
+ file_tool_class->populate_headerbar = gth_file_tool_rotate_populate_headerbar;
image_viewer_page_tool_class = (GthImageViewerPageToolClass *) klass;
image_viewer_page_tool_class->reset_image = gth_file_tool_rotate_reset_image;
diff --git a/extensions/file_tools/gth-file-tool-sharpen.c b/extensions/file_tools/gth-file-tool-sharpen.c
index bbe94c8..18bdec5 100644
--- a/extensions/file_tools/gth-file-tool-sharpen.c
+++ b/extensions/file_tools/gth-file-tool-sharpen.c
@@ -218,12 +218,9 @@ gth_file_tool_sharpen_get_options (GthFileTool *base)
cairo_surface_t *source;
GtkWidget *options;
GtkWidget *image_navigator;
- gboolean rtl;
self = (GthFileToolSharpen *) base;
- rtl = gtk_widget_get_direction (GTK_WIDGET (base)) == GTK_TEXT_DIR_RTL;
-
_cairo_clear_surface (&self->priv->preview_source);
source = gth_image_viewer_page_tool_get_source (GTH_IMAGE_VIEWER_PAGE_TOOL (self));
@@ -236,10 +233,6 @@ gth_file_tool_sharpen_get_options (GthFileTool *base)
options = _gtk_builder_get_widget (self->priv->builder, "options");
gtk_widget_show (options);
- gtk_image_set_from_icon_name (GTK_IMAGE (GET_WIDGET("reset_image")), rtl ? "edit-undo-rtl-symbolic" :
- "edit-undo-symbolic",
- GTK_ICON_SIZE_MENU);
-
self->priv->preview = gth_image_viewer_new ();
gth_image_viewer_set_reset_scrollbars (GTH_IMAGE_VIEWER (self->priv->preview), FALSE);
gth_image_viewer_set_fit_mode (GTH_IMAGE_VIEWER (self->priv->preview), GTH_FIT_NONE);
@@ -264,10 +257,6 @@ gth_file_tool_sharpen_get_options (GthFileTool *base)
GTH_COLOR_SCALE_DEFAULT,
DEFAULT_THRESHOLD, 0.0, 255.0, 1.0, 1.0,
"%.0f");
- g_signal_connect (GET_WIDGET ("reset_button"),
- "clicked",
- G_CALLBACK (reset_button_clicked_cb),
- self);
g_signal_connect (G_OBJECT (self->priv->radius_adj),
"value-changed",
G_CALLBACK (value_changed_cb),
@@ -358,6 +347,32 @@ gth_file_tool_sharpen_apply_options (GthFileTool *base)
static void
+gth_file_tool_sharpen_populate_headerbar (GthFileTool *base,
+ GthBrowser *browser)
+{
+ GthFileToolSharpen *self;
+ gboolean rtl;
+ GtkWidget *button;
+
+ self = (GthFileToolSharpen *) base;
+
+ /* reset button */
+
+ rtl = gtk_widget_get_direction (GTK_WIDGET (base)) == GTK_TEXT_DIR_RTL;
+ button = gth_browser_add_header_bar_button (browser,
+ GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
+ rtl ? "edit-undo-rtl-symbolic" : "edit-undo-symbolic",
+ _("Reset"),
+ NULL,
+ NULL);
+ g_signal_connect (button,
+ "clicked",
+ G_CALLBACK (reset_button_clicked_cb),
+ self);
+}
+
+
+static void
gth_file_tool_sharpen_reset_image (GthImageViewerPageTool *base)
{
GthFileToolSharpen *self = (GthFileToolSharpen *) base;
@@ -403,6 +418,7 @@ gth_file_tool_sharpen_class_init (GthFileToolSharpenClass *klass)
file_tool_class->get_options = gth_file_tool_sharpen_get_options;
file_tool_class->destroy_options = gth_file_tool_sharpen_destroy_options;
file_tool_class->apply_options = gth_file_tool_sharpen_apply_options;
+ file_tool_class->populate_headerbar = gth_file_tool_sharpen_populate_headerbar;
image_viewer_page_tool_class = (GthImageViewerPageToolClass *) klass;
image_viewer_page_tool_class->reset_image = gth_file_tool_sharpen_reset_image;
diff --git a/gthumb/gth-browser-actions-callbacks.c b/gthumb/gth-browser-actions-callbacks.c
index 538b72c..0aff0c3 100644
--- a/gthumb/gth-browser-actions-callbacks.c
+++ b/gthumb/gth-browser-actions-callbacks.c
@@ -530,6 +530,7 @@ gth_browser_activate_show_previous_image (GSimpleAction *action,
gth_browser_show_prev_image (browser, FALSE, FALSE);
}
+
void
gth_browser_activate_show_next_image (GSimpleAction *action,
GVariant *state,
@@ -538,3 +539,13 @@ gth_browser_activate_show_next_image (GSimpleAction *action,
GthBrowser *browser = GTH_BROWSER (user_data);
gth_browser_show_next_image (browser, FALSE, FALSE);
}
+
+
+void
+gth_browser_activate_apply_editor_changes (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ GthBrowser *browser = GTH_BROWSER (user_data);
+ gth_browser_apply_editor_changes (browser);
+}
diff --git a/gthumb/gth-browser-actions-callbacks.h b/gthumb/gth-browser-actions-callbacks.h
index ef5c478..a3b5391 100644
--- a/gthumb/gth-browser-actions-callbacks.h
+++ b/gthumb/gth-browser-actions-callbacks.h
@@ -60,5 +60,6 @@ DEF_ACTION_CALLBACK (gth_browser_activate_show_sidebar)
DEF_ACTION_CALLBACK (gth_browser_activate_show_thumbnail_list)
DEF_ACTION_CALLBACK (gth_browser_activate_show_previous_image)
DEF_ACTION_CALLBACK (gth_browser_activate_show_next_image)
+DEF_ACTION_CALLBACK (gth_browser_activate_apply_editor_changes)
#endif /* GTH_BROWSER_ACTIONS_CALLBACK_H */
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index 2193e86..b866050 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -59,6 +59,8 @@ static const GActionEntry gth_browser_actions[] = {
{ "show-previous-image", gth_browser_activate_show_previous_image },
{ "show-next-image", gth_browser_activate_show_next_image },
+
+ { "apply-editor-changes", gth_browser_activate_apply_editor_changes },
};
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 3b0f598..9900653 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -36,6 +36,7 @@
#include "gth-file-list.h"
#include "gth-file-view.h"
#include "gth-file-selection.h"
+#include "gth-file-tool.h"
#include "gth-filter.h"
#include "gth-filterbar.h"
#include "gth-folder-tree.h"
@@ -322,6 +323,13 @@ _gth_browser_update_current_file_position (GthBrowser *browser)
}
+static gboolean
+_gth_browser_file_tool_is_active (GthBrowser *browser)
+{
+ return gth_toolbox_tool_is_active (GTH_TOOLBOX (gth_sidebar_get_toolbox (GTH_SIDEBAR
(browser->priv->file_properties))));
+}
+
+
void
gth_browser_update_title (GthBrowser *browser)
{
@@ -340,22 +348,32 @@ gth_browser_update_title (GthBrowser *browser)
break;
case GTH_BROWSER_PAGE_VIEWER:
- if (browser->priv->current_file != NULL)
- name = g_file_info_get_display_name (browser->priv->current_file->info);
- if (name != NULL)
- g_string_append (title, name);
+ if (_gth_browser_file_tool_is_active (browser)) {
+ GtkWidget *toolbox;
+ GtkWidget *file_tool;
- if (gth_browser_get_file_modified (browser)) {
- g_string_append (title, " ");
- g_string_append (title, _("[modified]"));
+ toolbox = gth_sidebar_get_toolbox (GTH_SIDEBAR (browser->priv->file_properties));
+ file_tool = gth_toolbox_get_active_tool (GTH_TOOLBOX (toolbox));
+ g_string_append (title, gth_file_tool_get_options_title (GTH_FILE_TOOL (file_tool)));
}
+ else {
+ if (browser->priv->current_file != NULL)
+ name = g_file_info_get_display_name (browser->priv->current_file->info);
+ if (name != NULL)
+ g_string_append (title, name);
+
+ if (gth_browser_get_file_modified (browser)) {
+ g_string_append (title, " ");
+ g_string_append (title, _("[modified]"));
+ }
- if (browser->priv->current_file != NULL) {
- GthStringList *string_list;
+ if (browser->priv->current_file != NULL) {
+ GthStringList *string_list;
- string_list = GTH_STRING_LIST (g_file_info_get_attribute_object
(browser->priv->current_file->info, GTH_FILE_ATTRIBUTE_EMBLEMS));
- if (string_list != NULL)
- emblems = _g_string_list_dup (gth_string_list_get_list (string_list));
+ string_list = GTH_STRING_LIST (g_file_info_get_attribute_object
(browser->priv->current_file->info, GTH_FILE_ATTRIBUTE_EMBLEMS));
+ if (string_list != NULL)
+ emblems = _g_string_list_dup (gth_string_list_get_list (string_list));
+ }
}
break;
}
@@ -2383,7 +2401,7 @@ _gth_browser_update_header_bar_content (GthBrowser *browser)
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW,
section_visible);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS,
section_visible);
- active_tool = gth_toolbox_tool_is_active (GTH_TOOLBOX (gth_sidebar_get_toolbox (GTH_SIDEBAR
(browser->priv->file_properties))));
+ active_tool = _gth_browser_file_tool_is_active (browser);
section_visible = (page == GTH_BROWSER_PAGE_VIEWER) && ! active_tool;
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_NAVIGATION,
section_visible);
_gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS,
section_visible);
@@ -2394,8 +2412,12 @@ _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_COMMANDS,
section_visible);
+ _gth_browser_update_header_section_visibility (browser, GTH_BROWSER_HEADER_SECTION_EDITOR_APPLY,
section_visible);
gtk_widget_set_visible (browser->priv->menu_button, ! ((page == GTH_BROWSER_PAGE_VIEWER) &&
active_tool));
+
+ gth_browser_update_title (browser);
}
@@ -2883,13 +2905,22 @@ toolbox_options_visibility_cb (GthToolbox *toolbox,
GthBrowser *browser)
{
if (toolbox_options_visible) {
+ GtkWidget *file_tool;
+
gtk_widget_hide (browser->priv->next_image_button);
gtk_widget_hide (browser->priv->previous_image_button);
browser->priv->pointer_visible = FALSE;
+
+ file_tool = gth_toolbox_get_active_tool (toolbox);
+ if (file_tool != NULL)
+ gth_file_tool_populate_headerbar (GTH_FILE_TOOL (file_tool), browser);
}
- else if (browser->priv->pointer_visible) {
- gtk_widget_show (browser->priv->next_image_button);
- gtk_widget_show (browser->priv->previous_image_button);
+ else {
+ if (browser->priv->pointer_visible) {
+ gtk_widget_show (browser->priv->next_image_button);
+ gtk_widget_show (browser->priv->previous_image_button);
+ }
+ _gtk_container_remove_children (GTK_CONTAINER
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS]), NULL, NULL);
}
_gth_browser_update_header_bar_content (browser);
@@ -4214,7 +4245,8 @@ gth_browser_init (GthBrowser *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));
+ || (i == GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT_SIDEBAR)
+ || (i == GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS));
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);
@@ -4225,8 +4257,11 @@ gth_browser_init (GthBrowser *browser)
/* window header bar */
{
- GtkWidget *header_bar;
- gboolean rtl;
+ GtkWidget *header_bar;
+ gboolean rtl;
+ GtkBuilder *builder;
+ GMenuModel *menu;
+ GtkWidget *button;
header_bar = gth_window_get_header_bar (GTH_WINDOW (browser));
@@ -4237,6 +4272,7 @@ gth_browser_init (GthBrowser *browser)
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);
+ gtk_widget_set_margin_right
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_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]);
@@ -4259,34 +4295,28 @@ gth_browser_init (GthBrowser *browser)
#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]);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar),
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_APPLY]);
#endif
/* gears menu button */
- {
- GtkBuilder *builder;
- GMenuModel *menu;
-
- builder = _gtk_builder_new_from_resource ("gears-menu.ui");
- menu = G_MENU_MODEL (gtk_builder_get_object (builder, "menu"));
- browser->priv->menu_button = _gtk_menu_button_new_for_header_bar ();
+ builder = _gtk_builder_new_from_resource ("gears-menu.ui");
+ menu = G_MENU_MODEL (gtk_builder_get_object (builder, "menu"));
+ browser->priv->menu_button = _gtk_menu_button_new_for_header_bar ();
#if ! GTK_CHECK_VERSION(3,13,0)
- gtk_container_add (GTK_CONTAINER (browser->priv->menu_button),
gtk_image_new_from_icon_name ("emblem-system-symbolic", GTK_ICON_SIZE_MENU));
+ gtk_container_add (GTK_CONTAINER (browser->priv->menu_button), gtk_image_new_from_icon_name
("emblem-system-symbolic", GTK_ICON_SIZE_MENU));
#else
- gtk_menu_button_set_direction (GTK_MENU_BUTTON (browser->priv->menu_button),
GTK_ARROW_NONE);
+ gtk_menu_button_set_direction (GTK_MENU_BUTTON (browser->priv->menu_button), GTK_ARROW_NONE);
#endif
- gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (browser->priv->menu_button), menu);
- gtk_widget_show_all (browser->priv->menu_button);
- gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), browser->priv->menu_button);
-
- gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_GEARS,
G_MENU (menu));
- gth_browser_add_menu_manager_for_menu (browser,
GTH_BROWSER_MENU_MANAGER_GEARS_FOLDER_ACTIONS, G_MENU (gtk_builder_get_object (builder, "folder-actions")));
- gth_browser_add_menu_manager_for_menu (browser,
GTH_BROWSER_MENU_MANAGER_GEARS_OTHER_ACTIONS, G_MENU (gtk_builder_get_object (builder, "other-actions")));
-
- _gtk_window_add_accelerators_from_menu ((GTK_WINDOW (browser)), menu);
-
- g_object_unref (builder);
- }
+ gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (browser->priv->menu_button), menu);
+ gtk_widget_show_all (browser->priv->menu_button);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), browser->priv->menu_button);
+
+ gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_GEARS, G_MENU
(menu));
+ gth_browser_add_menu_manager_for_menu (browser,
GTH_BROWSER_MENU_MANAGER_GEARS_FOLDER_ACTIONS, G_MENU (gtk_builder_get_object (builder, "folder-actions")));
+ gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_GEARS_OTHER_ACTIONS,
G_MENU (gtk_builder_get_object (builder, "other-actions")));
+ _gtk_window_add_accelerators_from_menu ((GTK_WINDOW (browser)), menu);
+ g_object_unref (builder);
#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_BROWSER_TOOLS]);
@@ -4296,6 +4326,7 @@ gth_browser_init (GthBrowser *browser)
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_TOOLS]);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar),
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_APPLY]);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar),
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS]);
#endif
@@ -4316,22 +4347,17 @@ gth_browser_init (GthBrowser *browser)
/* history menu button */
- {
- GtkBuilder *builder;
- GtkWidget *button;
-
- builder = _gtk_builder_new_from_resource ("history-menu.ui");
- button = _gtk_menu_button_new_for_header_bar ();
- gtk_widget_set_tooltip_text (button, _("History"));
- gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name
("document-open-recent-symbolic", GTK_ICON_SIZE_MENU));
+ builder = _gtk_builder_new_from_resource ("history-menu.ui");
+ button = _gtk_menu_button_new_for_header_bar ();
+ gtk_widget_set_tooltip_text (button, _("History"));
+ gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name
("document-open-recent-symbolic", GTK_ICON_SIZE_MENU));
- browser->priv->history_menu = G_MENU (gtk_builder_get_object (builder,
"visited-locations"));
- gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL
(gtk_builder_get_object (builder, "menu")));
- gtk_widget_show_all (button);
- gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser,
GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION)), button, FALSE, FALSE, 0);
+ browser->priv->history_menu = G_MENU (gtk_builder_get_object (builder, "visited-locations"));
+ gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL
(gtk_builder_get_object (builder, "menu")));
+ gtk_widget_show_all (button);
+ gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser,
GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION)), button, FALSE, FALSE, 0);
- g_object_unref (builder);
- }
+ g_object_unref (builder);
/* viewer navigation */
@@ -4365,6 +4391,16 @@ gth_browser_init (GthBrowser *browser)
NULL,
"win.browser-mode",
NULL);
+
+ /* editor commands */
+
+ button = gth_browser_add_header_bar_label_button (browser,
+ GTH_BROWSER_HEADER_SECTION_EDITOR_APPLY,
+ _("Accept"),
+ NULL,
+ "win.apply-editor-changes",
+ NULL);
+ gtk_style_context_add_class (gtk_widget_get_style_context (button),
GTK_STYLE_CLASS_SUGGESTED_ACTION);
}
/* fullscreen toolbar */
@@ -5057,16 +5093,16 @@ gth_browser_get_headerbar_section (GthBrowser *browser,
static void
_gth_browser_setup_header_bar_button (GthBrowser *browser,
GthBrowserHeaderSection section,
- const char *icon_name,
const char *tooltip,
const char *action_name,
const char *accelerator,
GtkWidget *button)
{
- gtk_actionable_set_action_name (GTK_ACTIONABLE (button), action_name);
+ if (action_name != NULL)
+ gtk_actionable_set_action_name (GTK_ACTIONABLE (button), action_name);
if (tooltip != NULL)
gtk_widget_set_tooltip_text (button, tooltip);
- if (accelerator != NULL)
+ if ((action_name != NULL) && (accelerator != NULL))
_gtk_window_add_accelerator_for_action (GTK_WINDOW (browser),
gth_window_get_accel_group (GTH_WINDOW (browser)),
action_name,
@@ -5088,10 +5124,9 @@ gth_browser_add_header_bar_button (GthBrowser *browser,
GtkWidget *button;
g_return_val_if_fail (icon_name != NULL, NULL);
- g_return_val_if_fail (action_name != NULL, NULL);
button = _gtk_image_button_new_for_header_bar (icon_name);
- _gth_browser_setup_header_bar_button (browser, section, icon_name, tooltip, action_name, accelerator,
button);
+ _gth_browser_setup_header_bar_button (browser, section, tooltip, action_name, accelerator, button);
return button;
}
@@ -5108,10 +5143,28 @@ gth_browser_add_header_bar_toggle_button (GthBrowser *browser,
GtkWidget *button;
g_return_val_if_fail (icon_name != NULL, NULL);
- g_return_val_if_fail (action_name != NULL, NULL);
button = _gtk_toggle_image_button_new_for_header_bar (icon_name);
- _gth_browser_setup_header_bar_button (browser, section, icon_name, tooltip, action_name, accelerator,
button);
+ _gth_browser_setup_header_bar_button (browser, section, tooltip, action_name, accelerator, button);
+
+ return button;
+}
+
+
+GtkWidget *
+gth_browser_add_header_bar_label_button (GthBrowser *browser,
+ GthBrowserHeaderSection section,
+ const char *label,
+ const char *tooltip,
+ const char *action_name,
+ const char *accelerator)
+{
+ GtkWidget *button;
+
+ g_return_val_if_fail (label != NULL, NULL);
+
+ button = gtk_button_new_with_label (label);
+ _gth_browser_setup_header_bar_button (browser, section, tooltip, action_name, accelerator, button);
return button;
}
@@ -6570,6 +6623,19 @@ gth_browser_restore_state (GthBrowser *browser)
}
+void
+gth_browser_apply_editor_changes (GthBrowser *browser)
+{
+ 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));
+ if (file_tool != NULL)
+ gth_file_tool_apply_options (GTH_FILE_TOOL (file_tool));
+}
+
+
GMenuItem *
_g_menu_item_new_for_file (GFile *file,
const char *custom_label)
diff --git a/gthumb/gth-browser.h b/gthumb/gth-browser.h
index 2385279..f2c4f96 100644
--- a/gthumb/gth-browser.h
+++ b/gthumb/gth-browser.h
@@ -90,6 +90,7 @@ typedef enum { /*< skip >*/
GTH_BROWSER_HEADER_SECTION_VIEWER_EDIT,
GTH_BROWSER_HEADER_SECTION_EDITOR_NAVIGATION,
GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS,
+ GTH_BROWSER_HEADER_SECTION_EDITOR_APPLY,
GTH_BROWSER_N_HEADER_SECTIONS
} GthBrowserHeaderSection;
@@ -161,6 +162,13 @@ GtkWidget * gth_browser_add_header_bar_toggle_button
const char *tooltip,
const char *action_name,
const char *accelerator);
+GtkWidget * gth_browser_add_header_bar_label_button
+ (GthBrowser *browser,
+ GthBrowserHeaderSection section,
+ const char *label,
+ const char *tooltip,
+ const char *action_name,
+ const char *accelerator);
void gth_browser_add_menu_manager_for_menu
(GthBrowser *browser,
const char *menu_id,
@@ -250,6 +258,7 @@ void gth_browser_ask_whether_to_save (GthBrowser *browser,
gpointer user_data);
void gth_browser_save_state (GthBrowser *browser);
gboolean gth_browser_restore_state (GthBrowser *browser);
+void gth_browser_apply_editor_changes (GthBrowser *browser);
/* utilities */
diff --git a/gthumb/gth-file-tool.c b/gthumb/gth-file-tool.c
index 2b5f69d..d6b1017 100644
--- a/gthumb/gth-file-tool.c
+++ b/gthumb/gth-file-tool.c
@@ -88,6 +88,14 @@ gth_file_tool_base_apply_options (GthFileTool *self)
static void
+gth_file_tool_base_populate_headerbar (GthFileTool *self,
+ GthBrowser *browser)
+{
+ /* void */
+}
+
+
+static void
gth_file_tool_finalize (GObject *object)
{
g_return_if_fail (object != NULL);
@@ -114,6 +122,7 @@ gth_file_tool_class_init (GthFileToolClass *klass)
klass->get_options = gth_file_tool_base_get_options;
klass->destroy_options = gth_file_tool_base_destroy_options;
klass->apply_options = gth_file_tool_base_apply_options;
+ klass->populate_headerbar = gth_file_tool_base_populate_headerbar;
gth_file_tool_signals[SHOW_OPTIONS] =
g_signal_new ("show-options",
@@ -211,7 +220,6 @@ gth_file_tool_cancel (GthFileTool *self)
self->priv->cancelled = TRUE;
GTH_FILE_TOOL_GET_CLASS (self)->cancel (self);
- /*gth_file_tool_hide_options (self); FIXME */
}
@@ -276,3 +284,11 @@ gth_file_tool_apply_options (GthFileTool *self)
{
GTH_FILE_TOOL_GET_CLASS (self)->apply_options (self);
}
+
+
+void
+gth_file_tool_populate_headerbar (GthFileTool *self,
+ GthBrowser *browser)
+{
+ GTH_FILE_TOOL_GET_CLASS (self)->populate_headerbar (self, browser);
+}
diff --git a/gthumb/gth-file-tool.h b/gthumb/gth-file-tool.h
index d30607c..e7276e1 100644
--- a/gthumb/gth-file-tool.h
+++ b/gthumb/gth-file-tool.h
@@ -24,6 +24,7 @@
#include <gtk/gtk.h>
#include "gth-toolbox.h"
+#include "gth-browser.h"
G_BEGIN_DECLS
@@ -54,6 +55,8 @@ struct _GthFileToolClass {
GtkWidget * (*get_options) (GthFileTool *self);
void (*destroy_options) (GthFileTool *self);
void (*apply_options) (GthFileTool *self);
+ void (*populate_headerbar) (GthFileTool *self,
+ GthBrowser *browser);
/*< signals >*/
@@ -79,6 +82,8 @@ void gth_file_tool_destroy_options (GthFileTool
*self);
void gth_file_tool_show_options (GthFileTool *self);
void gth_file_tool_hide_options (GthFileTool *self);
void gth_file_tool_apply_options (GthFileTool *self);
+void gth_file_tool_populate_headerbar (GthFileTool *self,
+ GthBrowser *browser);
G_END_DECLS
diff --git a/gthumb/gth-toolbox.c b/gthumb/gth-toolbox.c
index 413fa82..68f3aaf 100644
--- a/gthumb/gth-toolbox.c
+++ b/gthumb/gth-toolbox.c
@@ -50,7 +50,6 @@ struct _GthToolboxPrivate {
char *name;
GtkWidget *tool_grid[GTH_TOOLBOX_N_SECTIONS];
GtkWidget *options;
- GtkWidget *options_title;
GtkWidget *active_tool;
};
@@ -135,7 +134,8 @@ gth_toolbox_class_init (GthToolboxClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE,
- 0);
+ 1,
+ G_TYPE_BOOLEAN);
}
@@ -242,14 +242,8 @@ gth_toolbox_init (GthToolbox *toolbox)
gtk_widget_show (ok_button);
g_signal_connect (ok_button, "clicked", G_CALLBACK (ok_button_clicked_cb), toolbox);
- toolbox->priv->options_title = gtk_header_bar_new ();
- /*gtk_style_context_add_class (gtk_widget_get_style_context (toolbox->priv->options_title),
"inline-headerbar");*/
- gtk_header_bar_pack_start (GTK_HEADER_BAR (toolbox->priv->options_title), close_button);
- gtk_header_bar_pack_end (GTK_HEADER_BAR (toolbox->priv->options_title), ok_button);
- gtk_widget_show (toolbox->priv->options_title);
- gtk_box_pack_start (GTK_BOX (options_box), toolbox->priv->options_title, FALSE, FALSE, 0);
-
toolbox->priv->options = gtk_scrolled_window_new (NULL, NULL);
+ gtk_widget_set_margin_top (toolbox->priv->options, 24);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (toolbox->priv->options), GTK_SHADOW_NONE);
gtk_widget_show (toolbox->priv->options);
gtk_box_pack_start (GTK_BOX (options_box), toolbox->priv->options, TRUE, TRUE, 0);
@@ -276,11 +270,7 @@ child_show_options_cb (GtkWidget *tool,
return;
toolbox->priv->active_tool = tool;
-
_gtk_container_remove_children (GTK_CONTAINER (toolbox->priv->options), NULL, NULL);
-
- gtk_header_bar_set_title (GTK_HEADER_BAR (toolbox->priv->options_title),
gth_file_tool_get_options_title (GTH_FILE_TOOL (tool)));
- /*gtk_image_set_from_icon_name (GTK_IMAGE (toolbox->priv->options_icon), gth_file_tool_get_icon_name
(GTH_FILE_TOOL (tool)), GTK_ICON_SIZE_MENU);*/
gtk_container_add (GTK_CONTAINER (toolbox->priv->options), options);
gtk_stack_set_visible_child_name (GTK_STACK (toolbox), GTH_TOOLBOX_PAGE_OPTIONS);
@@ -432,3 +422,10 @@ gth_toolbox_get_tool (GthToolbox *toolbox,
return tool;
}
+
+
+GtkWidget *
+gth_toolbox_get_active_tool (GthToolbox *toolbox)
+{
+ return toolbox->priv->active_tool;
+}
diff --git a/gthumb/gth-toolbox.h b/gthumb/gth-toolbox.h
index a896ae1..21fbb5f 100644
--- a/gthumb/gth-toolbox.h
+++ b/gthumb/gth-toolbox.h
@@ -66,6 +66,7 @@ void gth_toolbox_deactivate_tool (GthToolbox *toolbox);
gboolean gth_toolbox_tool_is_active (GthToolbox *toolbox);
GtkWidget * gth_toolbox_get_tool (GthToolbox *toolbox,
GType tool_type);
+GtkWidget * gth_toolbox_get_active_tool (GthToolbox *toolbox);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]