app: add gimp_display_shell_set_action_sensitive()

This commit is contained in:
Michael Natterer 2016-05-16 13:00:27 +02:00
parent 762e324d9a
commit a942b771fb
2 changed files with 47 additions and 6 deletions

View File

@ -34,6 +34,44 @@
#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,

View File

@ -19,12 +19,15 @@
#define __GIMP_DISPLAY_SHELL_ACTIONS_H__
void gimp_display_shell_set_action_active (GimpDisplayShell *shell,
const gchar *action,
gboolean active);
void gimp_display_shell_set_action_color (GimpDisplayShell *shell,
const gchar *action,
const GimpRGB *color);
void gimp_display_shell_set_action_sensitive (GimpDisplayShell *shell,
const gchar *action,
gboolean sensitive);
void gimp_display_shell_set_action_active (GimpDisplayShell *shell,
const gchar *action,
gboolean active);
void gimp_display_shell_set_action_color (GimpDisplayShell *shell,
const gchar *action,
const GimpRGB *color);
#endif /* __GIMP_DISPLAY_SHELL_ACTIONS_H__ */