From 5c1676dfe6d2f3c837a5e074117b45613fd29a72 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:30:19 +0200 Subject: Adding upstream version 2.10.34. Signed-off-by: Daniel Baumann --- app/display/gimpdisplayshell-actions.c | 149 +++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 app/display/gimpdisplayshell-actions.c (limited to 'app/display/gimpdisplayshell-actions.c') diff --git a/app/display/gimpdisplayshell-actions.c b/app/display/gimpdisplayshell-actions.c new file mode 100644 index 0000000..fa0b5ef --- /dev/null +++ b/app/display/gimpdisplayshell-actions.c @@ -0,0 +1,149 @@ +/* GIMP - The GNU Image Manipulation Program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include +#include + +#include "display-types.h" + +#include "core/gimp.h" +#include "core/gimpcontext.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimpuimanager.h" + +#include "gimpdisplay.h" +#include "gimpdisplayshell.h" +#include "gimpdisplayshell-actions.h" +#include "gimpimagewindow.h" + + +void +gimp_display_shell_set_action_sensitive (GimpDisplayShell *shell, + const gchar *action, + gboolean sensitive) +{ + GimpImageWindow *window; + GimpContext *context; + + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + g_return_if_fail (action != NULL); + + window = gimp_display_shell_get_window (shell); + + if (window && gimp_image_window_get_active_shell (window) == shell) + { + GimpUIManager *manager = gimp_image_window_get_ui_manager (window); + GimpActionGroup *action_group; + + action_group = gimp_ui_manager_get_action_group (manager, "view"); + + if (action_group) + gimp_action_group_set_action_sensitive (action_group, action, sensitive); + } + + context = gimp_get_user_context (shell->display->gimp); + + if (shell->display == gimp_context_get_display (context)) + { + GimpActionGroup *action_group; + + action_group = gimp_ui_manager_get_action_group (shell->popup_manager, + "view"); + + if (action_group) + gimp_action_group_set_action_sensitive (action_group, action, sensitive); + } +} + +void +gimp_display_shell_set_action_active (GimpDisplayShell *shell, + const gchar *action, + gboolean active) +{ + GimpImageWindow *window; + GimpContext *context; + + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + g_return_if_fail (action != NULL); + + window = gimp_display_shell_get_window (shell); + + if (window && gimp_image_window_get_active_shell (window) == shell) + { + GimpUIManager *manager = gimp_image_window_get_ui_manager (window); + GimpActionGroup *action_group; + + action_group = gimp_ui_manager_get_action_group (manager, "view"); + + if (action_group) + gimp_action_group_set_action_active (action_group, action, active); + } + + context = gimp_get_user_context (shell->display->gimp); + + if (shell->display == gimp_context_get_display (context)) + { + GimpActionGroup *action_group; + + action_group = gimp_ui_manager_get_action_group (shell->popup_manager, + "view"); + + if (action_group) + gimp_action_group_set_action_active (action_group, action, active); + } +} + +void +gimp_display_shell_set_action_color (GimpDisplayShell *shell, + const gchar *action, + const GimpRGB *color) +{ + GimpImageWindow *window; + GimpContext *context; + + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + g_return_if_fail (action != NULL); + + window = gimp_display_shell_get_window (shell); + + if (window && gimp_image_window_get_active_shell (window) == shell) + { + GimpUIManager *manager = gimp_image_window_get_ui_manager (window); + GimpActionGroup *action_group; + + action_group = gimp_ui_manager_get_action_group (manager, "view"); + + if (action_group) + gimp_action_group_set_action_color (action_group, action, color, FALSE); + } + + context = gimp_get_user_context (shell->display->gimp); + + if (shell->display == gimp_context_get_display (context)) + { + GimpActionGroup *action_group; + + action_group = gimp_ui_manager_get_action_group (shell->popup_manager, + "view"); + + if (action_group) + gimp_action_group_set_action_color (action_group, action, color, FALSE); + } +} -- cgit v1.2.3