aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Yuan <li.yuan@sun.com>2005-04-28 16:09:53 +0800
committerHarry Lu <haip@src.gnome.org>2005-04-28 16:09:53 +0800
commit6c77af3cf2a6cf3c0e4c573baed9b6d822f570c4 (patch)
tree99490396f165d967eb04e10beac1fbfb1d2e04e5
parentf4a4681685477573943f2de5340dfade7e441702 (diff)
downloadgsoc2013-evolution-6c77af3cf2a6cf3c0e4c573baed9b6d822f570c4.tar
gsoc2013-evolution-6c77af3cf2a6cf3c0e4c573baed9b6d822f570c4.tar.gz
gsoc2013-evolution-6c77af3cf2a6cf3c0e4c573baed9b6d822f570c4.tar.bz2
gsoc2013-evolution-6c77af3cf2a6cf3c0e4c573baed9b6d822f570c4.tar.lz
gsoc2013-evolution-6c77af3cf2a6cf3c0e4c573baed9b6d822f570c4.tar.xz
gsoc2013-evolution-6c77af3cf2a6cf3c0e4c573baed9b6d822f570c4.tar.zst
gsoc2013-evolution-6c77af3cf2a6cf3c0e4c573baed9b6d822f570c4.zip
add a signal "style_set" to support theme. ditto.
2005-04-28 Li Yuan <li.yuan@sun.com> * 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
-rw-r--r--widgets/misc/e-canvas-background.c26
-rw-r--r--widgets/misc/e-canvas-background.h1
2 files changed, 27 insertions, 0 deletions
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
@@ -56,6 +56,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,
PROP_FILL_COLOR_GDK,
@@ -415,9 +422,18 @@ ecb_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
}
static void
+ecb_style_set (ECanvasBackground *ecb, GtkStyle *previous_style)
+{
+ GnomeCanvasItem *item = GNOME_CANVAS_ITEM (ecb);
+ gdk_gc_set_foreground (ecb->priv->gc, &GTK_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);
};