From 6c77af3cf2a6cf3c0e4c573baed9b6d822f570c4 Mon Sep 17 00:00:00 2001
From: Li Yuan
Date: Thu, 28 Apr 2005 08:09:53 +0000
Subject: add a signal "style_set" to support theme. ditto.
2005-04-28 Li Yuan
* gal/widgets/e-canvas-background.c: (ecb_style_set),
(ecb_class_init):add a signal "style_set" to support theme.
* gal/widgets/e-canvas-background.h:
ditto.
Fixes #301888
svn path=/trunk/; revision=29235
---
widgets/misc/e-canvas-background.c | 26 ++++++++++++++++++++++++++
widgets/misc/e-canvas-background.h | 1 +
2 files changed, 27 insertions(+)
(limited to 'widgets/misc')
diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c
index 0e57feff4e..26d9d37de2 100644
--- a/widgets/misc/e-canvas-background.c
+++ b/widgets/misc/e-canvas-background.c
@@ -55,6 +55,13 @@ struct _ECanvasBackgroundPrivate {
static GnomeCanvasItemClass *parent_class;
+enum {
+ STYLE_SET,
+ LAST_SIGNAL
+};
+
+static guint ecb_signals [LAST_SIGNAL] = { 0, };
+
enum {
PROP_0,
PROP_FILL_COLOR,
@@ -414,10 +421,19 @@ ecb_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
return 0.0;
}
+static void
+ecb_style_set (ECanvasBackground *ecb, GtkStyle *previous_style)
+{
+ GnomeCanvasItem *item = GNOME_CANVAS_ITEM (ecb);
+ gdk_gc_set_foreground (ecb->priv->gc, >K_WIDGET(item->canvas)->style->base[GTK_STATE_NORMAL]);
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (ecb));
+}
+
static void
ecb_class_init (GObjectClass *object_class)
{
GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
+ ECanvasBackgroundClass *ecb_class = (ECanvasBackgroundClass *) object_class;
parent_class = g_type_class_ref (PARENT_OBJECT_TYPE);
@@ -431,6 +447,8 @@ ecb_class_init (GObjectClass *object_class)
item_class->draw = ecb_draw;
item_class->point = ecb_point;
+ ecb_class->style_set = ecb_style_set;
+
g_object_class_install_property (object_class, PROP_FILL_COLOR,
g_param_spec_string ("fill_color",
_( "Fill color" ),
@@ -486,6 +504,14 @@ ecb_class_init (GObjectClass *object_class)
_( "Y2" ),
0.0, G_MAXDOUBLE, 0.0,
G_PARAM_READWRITE));
+ ecb_signals [STYLE_SET] =
+ g_signal_new ("style_set",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECanvasBackgroundClass, style_set),
+ NULL, NULL,
+ e_marshal_NONE__OBJECT,
+ G_TYPE_NONE, 1, GTK_TYPE_STYLE);
}
E_MAKE_TYPE (e_canvas_background,
diff --git a/widgets/misc/e-canvas-background.h b/widgets/misc/e-canvas-background.h
index 4a8e3294fb..eb3eecbd00 100644
--- a/widgets/misc/e-canvas-background.h
+++ b/widgets/misc/e-canvas-background.h
@@ -60,6 +60,7 @@ struct _ECanvasBackground {
struct _ECanvasBackgroundClass {
GnomeCanvasItemClass parent_class;
+ void (*style_set) (ECanvasBackground *eti, GtkStyle *previous_style);
};
--
cgit v1.2.3