[goffice] GocItem: redo style context if ::canvas changes.



commit 301ce30451f12593fbafec68c1b4223dff70365c
Author: Morten Welinder <terra gnome org>
Date:   Thu Apr 10 15:33:06 2014 -0400

    GocItem: redo style context if ::canvas changes.

 ChangeLog                 |    6 ++++++
 goffice/canvas/goc-item.c |   15 ++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3f3cff1..df8d443 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-04-10  Morten Welinder  <terra gnome org>
+
+       * goffice/canvas/goc-item.c (cb_hierarchy_changed): Renamed from
+       cb_parent_changed.
+       (goc_item_get_style_context): Also watch ::canvas.
+
 2014-04-09  Morten Welinder  <terra gnome org>
 
        * goffice/utils/go-format.c (go_render_general): Drop a decimal by
diff --git a/goffice/canvas/goc-item.c b/goffice/canvas/goc-item.c
index a47b642..67aa1c2 100644
--- a/goffice/canvas/goc-item.c
+++ b/goffice/canvas/goc-item.c
@@ -25,7 +25,7 @@
 #include <glib/gi18n-lib.h>
 
 #ifdef GOFFICE_WITH_GTK
-static void cb_parent_changed (const GocItem *item);
+static void cb_hierarchy_changed (const GocItem *item);
 #endif
 
 
@@ -236,7 +236,7 @@ goc_item_dispose (GObject *object)
        context = g_object_get_qdata (G_OBJECT (item), quark_style_context);
        if (context) {
                g_signal_handlers_disconnect_by_func
-                       (object, G_CALLBACK (cb_parent_changed), NULL);
+                       (object, G_CALLBACK (cb_hierarchy_changed), NULL);
 #ifdef HAVE_GTK_STYLE_CONTEXT_SET_PARENT
                gtk_style_context_set_parent (context, NULL);
 #endif
@@ -856,7 +856,7 @@ _goc_item_transform (GocItem const *item, cairo_t *cr, gboolean scaled)
 #ifdef GOFFICE_WITH_GTK
 
 static void
-cb_parent_changed (const GocItem *item)
+cb_hierarchy_changed (const GocItem *item)
 {
        GtkStyleContext *context = goc_item_get_style_context (item);
        GtkStyleContext *pcontext;
@@ -905,9 +905,14 @@ goc_item_get_style_context (const GocItem *item)
                                         g_object_unref);
 
                g_signal_connect (G_OBJECT (item),
-                                 "notify::parent", G_CALLBACK (cb_parent_changed),
+                                 "notify::parent",
+                                 G_CALLBACK (cb_hierarchy_changed),
                                  NULL);
-               cb_parent_changed (item);
+               g_signal_connect (G_OBJECT (item),
+                                 "notify::canvas",
+                                 G_CALLBACK (cb_hierarchy_changed),
+                                 NULL);
+               cb_hierarchy_changed (item);
        }
 
        return context;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]