[gimp/gtk3-port: 183/240] app: add gimp_get_style_color() to simplify GdkRGBA style property lookup
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 183/240] app: add gimp_get_style_color() to simplify GdkRGBA style property lookup
- Date: Sat, 28 Apr 2018 18:38:21 +0000 (UTC)
commit 3dfe0ecd2c583b34e9e74fd34daa3191c939c2e0
Author: Michael Natterer <mitch gimp org>
Date: Mon Feb 7 22:16:05 2011 +0100
app: add gimp_get_style_color() to simplify GdkRGBA style property lookup
app/widgets/gimpwidgets-utils.c | 32 ++++++++++++++++++++++++++++++++
app/widgets/gimpwidgets-utils.h | 3 +++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index dfc5744..6394f87 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -887,6 +887,38 @@ gimp_rgb_set_gdk_color (GimpRGB *rgb,
gimp_rgb_set_uchar (rgb, r, g, b);
}
+gboolean
+gimp_get_style_color (GtkWidget *widget,
+ const gchar *property_name,
+ GdkRGBA *color)
+{
+ GdkRGBA *c = NULL;
+
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+ g_return_val_if_fail (property_name != NULL, FALSE);
+ g_return_val_if_fail (color != NULL, FALSE);
+
+ gtk_widget_style_get (widget,
+ property_name, &c,
+ NULL);
+
+ if (c)
+ {
+ *color = *c;
+ gdk_rgba_free (c);
+
+ return TRUE;
+ }
+
+ /* return ugly magenta to indicate that something is wrong */
+ color->red = 1.0;
+ color->green = 1.0;
+ color->blue = 0.0;
+ color->alpha = 1.0;
+
+ return FALSE;
+}
+
void
gimp_window_set_hint (GtkWindow *window,
GimpWindowHint hint)
diff --git a/app/widgets/gimpwidgets-utils.h b/app/widgets/gimpwidgets-utils.h
index 2098fe1..66b2a16 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -77,6 +77,9 @@ void gimp_rgb_get_gdk_color (const GimpRGB *rgb,
GdkColor *gdk_color);
void gimp_rgb_set_gdk_color (GimpRGB *rgb,
const GdkColor *gdk_color);
+gboolean gimp_get_style_color (GtkWidget *widget,
+ const gchar *property_name,
+ GdkRGBA *color);
void gimp_window_set_hint (GtkWindow *window,
GimpWindowHint hint);
guint32 gimp_window_get_native_id (GtkWindow *window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]