[evolution/wip/webkit2] Bug 240130 - Resize table header on theme font change



commit 45b440e1bfd302599c4fe64609eeb83363d8bad7
Author: Milan Crha <mcrha redhat com>
Date:   Fri Apr 1 18:45:24 2016 +0200

    Bug 240130 - Resize table header on theme font change

 e-util/e-table-header-item.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-table-header-item.c b/e-util/e-table-header-item.c
index 0867fa5..b6cd4ea 100644
--- a/e-util/e-table-header-item.c
+++ b/e-util/e-table-header-item.c
@@ -904,6 +904,20 @@ ethi_drag_leave (GtkWidget *widget,
 }
 
 static void
+ethi_style_updated_cb (GtkWidget *widget,
+                      ETableHeaderItem *ethi)
+{
+       PangoContext *pango_context;
+
+       g_return_if_fail (GTK_IS_WIDGET (widget));
+       g_return_if_fail (E_IS_TABLE_HEADER_ITEM (ethi));
+
+       pango_context = gtk_widget_get_pango_context (widget);
+
+       ethi_font_set (ethi, pango_context_get_font_description (pango_context));
+}
+
+static void
 ethi_realize (GnomeCanvasItem *item)
 {
        ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
@@ -922,6 +936,10 @@ ethi_realize (GnomeCanvasItem *item)
                ethi_font_set (ethi, pango_context_get_font_description (pango_context));
        }
 
+       g_signal_connect (
+               item->canvas, "style-updated",
+               G_CALLBACK (ethi_style_updated_cb), ethi);
+
        /*
         * Now, configure DnD
         */
@@ -966,6 +984,8 @@ ethi_unrealize (GnomeCanvasItem *item)
                ethi->font_desc = NULL;
        }
 
+       g_signal_handlers_disconnect_by_func (item->canvas, G_CALLBACK (ethi_style_updated_cb), ethi);
+
        g_signal_handler_disconnect (item->canvas, ethi->drag_motion_id);
        g_signal_handler_disconnect (item->canvas, ethi->drag_leave_id);
        g_signal_handler_disconnect (item->canvas, ethi->drag_drop_id);


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