app: color manage the new color tag color areas

This commit is contained in:
Michael Natterer
2016-10-30 18:05:57 +01:00
parent 967ac88c35
commit 9f9307edcb
6 changed files with 50 additions and 19 deletions

View File

@ -232,17 +232,9 @@ edit_actions_setup (GimpActionGroup *group)
"edit-paste-as-new-image-short"); "edit-paste-as-new-image-short");
gtk_action_set_accel_path (action, "<Actions>/edit/edit-paste-as-new-image"); gtk_action_set_accel_path (action, "<Actions>/edit/edit-paste-as-new-image");
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), gimp_action_group_set_action_context (group, "edit-fill-fg", context);
"edit-fill-fg"); gimp_action_group_set_action_context (group, "edit-fill-bg", context);
g_object_set (action, "context", context, NULL); gimp_action_group_set_action_context (group, "edit-fill-pattern", context);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
"edit-fill-bg");
g_object_set (action, "context", context, NULL);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
"edit-fill-pattern");
g_object_set (action, "context", context, NULL);
g_signal_connect_object (context, "foreground-changed", g_signal_connect_object (context, "foreground-changed",
G_CALLBACK (edit_actions_foreground_changed), G_CALLBACK (edit_actions_foreground_changed),

View File

@ -217,17 +217,11 @@ file_actions_setup (GimpActionGroup *group)
for (i = 0; i < n_entries; i++) for (i = 0; i < n_entries; i++)
{ {
GtkAction *action;
gimp_action_group_set_action_visible (group, entries[i].name, FALSE); gimp_action_group_set_action_visible (group, entries[i].name, FALSE);
gimp_action_group_set_action_always_show_image (group, entries[i].name, gimp_action_group_set_action_always_show_image (group, entries[i].name,
TRUE); TRUE);
gimp_action_group_set_action_context (group, entries[i].name,
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), gimp_get_user_context (group->gimp));
entries[i].name);
g_object_set (action,
"context", gimp_get_user_context (group->gimp),
NULL);
g_free ((gchar *) entries[i].name); g_free ((gchar *) entries[i].name);
if (entries[i].accelerator) if (entries[i].accelerator)

View File

@ -24,6 +24,7 @@
#include "actions-types.h" #include "actions-types.h"
#include "core/gimp.h"
#include "core/gimpitem.h" #include "core/gimpitem.h"
#include "widgets/gimpactiongroup.h" #include "widgets/gimpactiongroup.h"
@ -56,6 +57,9 @@ items_actions_setup (GimpActionGroup *group,
{ {
GimpRGB color; GimpRGB color;
gimp_action_group_set_action_context (group, action,
gimp_get_user_context (group->gimp));
gimp_get_color_tag_color (value->value, &color); gimp_get_color_tag_color (value->value, &color);
gimp_action_group_set_action_color (group, action, &color, FALSE); gimp_action_group_set_action_color (group, action, &color, FALSE);
} }

View File

@ -25,6 +25,9 @@
#include "dialogs-types.h" #include "dialogs-types.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpitem.h" #include "core/gimpitem.h"
@ -231,6 +234,8 @@ item_options_dialog_new (GimpImage *image,
gint w, h; gint w, h;
image = gimp_color_area_new (&color, GIMP_COLOR_AREA_FLAT, 0); image = gimp_color_area_new (&color, GIMP_COLOR_AREA_FLAT, 0);
gimp_color_area_set_color_config (GIMP_COLOR_AREA (image),
context->gimp->config->color_management);
gtk_icon_size_lookup_for_settings (settings, gtk_icon_size_lookup_for_settings (settings,
GTK_ICON_SIZE_MENU, &w, &h); GTK_ICON_SIZE_MENU, &w, &h);
gtk_widget_set_size_request (image, w, h); gtk_widget_set_size_request (image, w, h);

View File

@ -29,6 +29,7 @@
#include "widgets-types.h" #include "widgets-types.h"
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpmarshal.h" #include "core/gimpmarshal.h"
#include "core/gimpviewable.h" #include "core/gimpviewable.h"
@ -868,6 +869,38 @@ gimp_action_group_get_action_tooltip (GimpActionGroup *group,
return gtk_action_get_tooltip (action); return gtk_action_get_tooltip (action);
} }
void
gimp_action_group_set_action_context (GimpActionGroup *group,
const gchar *action_name,
GimpContext *context)
{
GtkAction *action;
g_return_if_fail (GIMP_IS_ACTION_GROUP (group));
g_return_if_fail (action_name != NULL);
g_return_if_fail (context == NULL || GIMP_IS_CONTEXT (context));
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
if (! action)
{
g_warning ("%s: Unable to set context of action "
"which doesn't exist: %s",
G_STRFUNC, action_name);
return;
}
if (! GIMP_IS_ACTION (action))
{
g_warning ("%s: Unable to set \"context\" of action "
"which is not a GimpAction: %s",
G_STRFUNC, action_name);
return;
}
g_object_set (action, "context", context, NULL);
}
void void
gimp_action_group_set_action_color (GimpActionGroup *group, gimp_action_group_set_action_color (GimpActionGroup *group,
const gchar *action_name, const gchar *action_name,

View File

@ -197,6 +197,9 @@ void gimp_action_group_set_action_tooltip (GimpActionGroup *group,
const gchar *tooltip); const gchar *tooltip);
const gchar * gimp_action_group_get_action_tooltip (GimpActionGroup *group, const gchar * gimp_action_group_get_action_tooltip (GimpActionGroup *group,
const gchar *action_name); const gchar *action_name);
void gimp_action_group_set_action_context (GimpActionGroup *group,
const gchar *action_name,
GimpContext *context);
void gimp_action_group_set_action_color (GimpActionGroup *group, void gimp_action_group_set_action_color (GimpActionGroup *group,
const gchar *action_name, const gchar *action_name,
const GimpRGB *color, const GimpRGB *color,