[gimp] app: invoke the right action when the quick mask button is clicked
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: invoke the right action when the quick mask button is clicked
- Date: Fri, 30 Sep 2016 23:07:32 +0000 (UTC)
commit aa0afe0d011b5b934368d4d58135d5cb2d4f1944
Author: Michael Natterer <mitch gimp org>
Date: Sat Oct 1 01:06:02 2016 +0200
app: invoke the right action when the quick mask button is clicked
instead of implementing the toggling in display/. One more bit
moved to actiona/.
app/display/gimpdisplayshell-callbacks.c | 11 +++++++++--
app/widgets/gimpuimanager.c | 19 +++++++++++++++++++
app/widgets/gimpuimanager.h | 4 ++++
3 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index ba3064a..b8834a3 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -306,9 +306,16 @@ gimp_display_shell_quick_mask_toggled (GtkWidget *widget,
if (active != gimp_image_get_quick_mask_state (image))
{
- gimp_image_set_quick_mask_state (image, active);
+ GimpImageWindow *window = gimp_display_shell_get_window (shell);
+
+ if (window)
+ {
+ GimpUIManager *manager = gimp_image_window_get_ui_manager (window);
- gimp_image_flush (image);
+ gimp_ui_manager_toggle_action (manager,
+ "quick-mask", "quick-mask-toggle",
+ active);
+ }
}
}
diff --git a/app/widgets/gimpuimanager.c b/app/widgets/gimpuimanager.c
index a66f3dc..7c26e29 100644
--- a/app/widgets/gimpuimanager.c
+++ b/app/widgets/gimpuimanager.c
@@ -522,6 +522,25 @@ gimp_ui_manager_activate_action (GimpUIManager *manager,
return (action != NULL);
}
+gboolean
+gimp_ui_manager_toggle_action (GimpUIManager *manager,
+ const gchar *group_name,
+ const gchar *action_name,
+ gboolean active)
+{
+ GtkAction *action;
+
+ g_return_val_if_fail (GIMP_IS_UI_MANAGER (manager), FALSE);
+ g_return_val_if_fail (action_name != NULL, FALSE);
+
+ action = gimp_ui_manager_find_action (manager, group_name, action_name);
+
+ if (GTK_IS_TOGGLE_ACTION (action))
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ active ? TRUE : FALSE);
+
+ return GTK_IS_TOGGLE_ACTION (action);
+}
void
gimp_ui_manager_ui_register (GimpUIManager *manager,
diff --git a/app/widgets/gimpuimanager.h b/app/widgets/gimpuimanager.h
index 712cd50..252de05 100644
--- a/app/widgets/gimpuimanager.h
+++ b/app/widgets/gimpuimanager.h
@@ -89,6 +89,10 @@ GtkAction * gimp_ui_manager_find_action (GimpUIManager *manager,
gboolean gimp_ui_manager_activate_action (GimpUIManager *manager,
const gchar *group_name,
const gchar *action_name);
+gboolean gimp_ui_manager_toggle_action (GimpUIManager *manager,
+ const gchar *group_name,
+ const gchar *action_name,
+ gboolean active);
void gimp_ui_manager_ui_register (GimpUIManager *manager,
const gchar *ui_path,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]