[gimp] app: color manage the new color tag color areas
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: color manage the new color tag color areas
- Date: Sun, 30 Oct 2016 17:06:59 +0000 (UTC)
commit 9f9307edcb609f06b7e81f74c7e93deb9a627f9e
Author: Michael Natterer <mitch gimp org>
Date: Sun Oct 30 18:05:57 2016 +0100
app: color manage the new color tag color areas
app/actions/edit-actions.c | 14 +++-----------
app/actions/file-actions.c | 10 ++--------
app/actions/items-actions.c | 4 ++++
app/dialogs/item-options-dialog.c | 5 +++++
app/widgets/gimpactiongroup.c | 33 +++++++++++++++++++++++++++++++++
app/widgets/gimpactiongroup.h | 3 +++
6 files changed, 50 insertions(+), 19 deletions(-)
---
diff --git a/app/actions/edit-actions.c b/app/actions/edit-actions.c
index 96fcd1a..f58ed24 100644
--- a/app/actions/edit-actions.c
+++ b/app/actions/edit-actions.c
@@ -232,17 +232,9 @@ edit_actions_setup (GimpActionGroup *group)
"edit-paste-as-new-image-short");
gtk_action_set_accel_path (action, "<Actions>/edit/edit-paste-as-new-image");
- action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
- "edit-fill-fg");
- g_object_set (action, "context", context, NULL);
-
- 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);
+ gimp_action_group_set_action_context (group, "edit-fill-fg", context);
+ gimp_action_group_set_action_context (group, "edit-fill-bg", context);
+ gimp_action_group_set_action_context (group, "edit-fill-pattern", context);
g_signal_connect_object (context, "foreground-changed",
G_CALLBACK (edit_actions_foreground_changed),
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index 905b436..2f3bac6 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -217,17 +217,11 @@ file_actions_setup (GimpActionGroup *group)
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_always_show_image (group, entries[i].name,
TRUE);
-
- action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
- entries[i].name);
- g_object_set (action,
- "context", gimp_get_user_context (group->gimp),
- NULL);
+ gimp_action_group_set_action_context (group, entries[i].name,
+ gimp_get_user_context (group->gimp));
g_free ((gchar *) entries[i].name);
if (entries[i].accelerator)
diff --git a/app/actions/items-actions.c b/app/actions/items-actions.c
index bb8084e..a263bfb 100644
--- a/app/actions/items-actions.c
+++ b/app/actions/items-actions.c
@@ -24,6 +24,7 @@
#include "actions-types.h"
+#include "core/gimp.h"
#include "core/gimpitem.h"
#include "widgets/gimpactiongroup.h"
@@ -56,6 +57,9 @@ items_actions_setup (GimpActionGroup *group,
{
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_action_group_set_action_color (group, action, &color, FALSE);
}
diff --git a/app/dialogs/item-options-dialog.c b/app/dialogs/item-options-dialog.c
index b47d1ef..15705bf 100644
--- a/app/dialogs/item-options-dialog.c
+++ b/app/dialogs/item-options-dialog.c
@@ -25,6 +25,9 @@
#include "dialogs-types.h"
+#include "config/gimpcoreconfig.h"
+
+#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpitem.h"
@@ -231,6 +234,8 @@ item_options_dialog_new (GimpImage *image,
gint w, h;
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_MENU, &w, &h);
gtk_widget_set_size_request (image, w, h);
diff --git a/app/widgets/gimpactiongroup.c b/app/widgets/gimpactiongroup.c
index d7b9edb..79861b6 100644
--- a/app/widgets/gimpactiongroup.c
+++ b/app/widgets/gimpactiongroup.c
@@ -29,6 +29,7 @@
#include "widgets-types.h"
#include "core/gimp.h"
+#include "core/gimpcontext.h"
#include "core/gimpmarshal.h"
#include "core/gimpviewable.h"
@@ -869,6 +870,38 @@ gimp_action_group_get_action_tooltip (GimpActionGroup *group,
}
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
gimp_action_group_set_action_color (GimpActionGroup *group,
const gchar *action_name,
const GimpRGB *color,
diff --git a/app/widgets/gimpactiongroup.h b/app/widgets/gimpactiongroup.h
index 5cb34b9..1455cfa 100644
--- a/app/widgets/gimpactiongroup.h
+++ b/app/widgets/gimpactiongroup.h
@@ -197,6 +197,9 @@ void gimp_action_group_set_action_tooltip (GimpActionGroup *group,
const gchar *tooltip);
const gchar * gimp_action_group_get_action_tooltip (GimpActionGroup *group,
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,
const gchar *action_name,
const GimpRGB *color,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]