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/.
This commit is contained in:
Michael Natterer
2016-10-01 01:06:02 +02:00
parent 41754669e6
commit aa0afe0d01
3 changed files with 32 additions and 2 deletions

View File

@ -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);
gimp_image_flush (image);
if (window)
{
GimpUIManager *manager = gimp_image_window_get_ui_manager (window);
gimp_ui_manager_toggle_action (manager,
"quick-mask", "quick-mask-toggle",
active);
}
}
}

View File

@ -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,

View File

@ -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,