[devhelp] sync tab_label_style_set_cb with epiphany



commit a4ef0c8bc0f2f5924c73904031c9572d1791d979
Author: Frédéric Péters <fpeters 0d be>
Date:   Tue Mar 8 13:56:54 2011 +0100

    sync tab_label_style_set_cb with epiphany

 src/dh-window.c |   50 +++++++++++++++++++++++++-------------------------
 1 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index 1e35bf1..16ff1e2 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -49,6 +49,7 @@
 #include "ige-conf.h"
 
 #define FULLSCREEN_ANIMATION_SPEED 4
+#define TAB_WIDTH_N_CHARS 15
 
 struct _DhWindowPriv {
         DhBase         *base;
@@ -1728,32 +1729,31 @@ close_button_clicked_cb (GtkButton *button,
 
 static void
 tab_label_style_set_cb (GtkWidget *hbox,
-                        GtkStyle  *previous_style,
-                        gpointer   user_data)
-{
-        PangoFontMetrics *metrics;
-        PangoContext     *context;
-        GtkWidget        *button;
-        GtkStyle         *style;
-        gint              char_width;
-        gint              h, w;
-
-        context = gtk_widget_get_pango_context (hbox);
-        style = gtk_widget_get_style (hbox);
-        metrics = pango_context_get_metrics (context,
-                                             style->font_desc,
-                                             pango_context_get_language (context));
-
-        char_width = pango_font_metrics_get_approximate_digit_width (metrics);
-        pango_font_metrics_unref (metrics);
-
-        gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (hbox),
-                                           GTK_ICON_SIZE_MENU, &w, &h);
-
-        gtk_widget_set_size_request (hbox, 15 * PANGO_PIXELS (char_width) + 2 * w, -1);
-
-        button = g_object_get_data (G_OBJECT (hbox), "close-button");
-        gtk_widget_set_size_request (button, w + 2, h + 2);
+			GtkStyle *previous_style,
+			gpointer user_data)
+{
+	PangoFontMetrics *metrics;
+	PangoContext *context;
+	GtkStyleContext *style;
+	GtkWidget *button;
+	int char_width, h, w;
+
+	context = gtk_widget_get_pango_context (hbox);
+	style = gtk_widget_get_style_context (hbox);
+	metrics = pango_context_get_metrics (context,
+					     gtk_style_context_get_font (style, GTK_STATE_FLAG_NORMAL),
+					     pango_context_get_language (context));
+	char_width = pango_font_metrics_get_approximate_digit_width (metrics);
+	pango_font_metrics_unref (metrics);
+
+	gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (hbox),
+					   GTK_ICON_SIZE_MENU, &w, &h);
+
+	gtk_widget_set_size_request
+		(hbox, TAB_WIDTH_N_CHARS * PANGO_PIXELS(char_width) + 2 * w, -1);
+
+	button = g_object_get_data (G_OBJECT (hbox), "close-button");
+	gtk_widget_set_size_request (button, w + 2, h + 2);
 }
 #endif
 



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