From 2622adaa1fd3a6f24ed3ba527ee132148fd25beb Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 16 May 2012 19:57:43 +0000 Subject: allow netsurf to build with gtk3 svn path=/trunk/netsurf/; revision=13926 --- gtk/tabs.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'gtk/tabs.c') diff --git a/gtk/tabs.c b/gtk/tabs.c index 13f6d393d..b258a20ad 100644 --- a/gtk/tabs.c +++ b/gtk/tabs.c @@ -16,8 +16,10 @@ * along with this program. If not, see . */ -#include +#include #include + +#include "gtk/compat.h" #include "gtk/window.h" #include "gtk/gui.h" #include "desktop/browser.h" @@ -37,10 +39,16 @@ static void nsgtk_tab_update_size(GtkWidget *hbox, GtkStyle *previous_style, PangoFontMetrics *metrics; PangoContext *context; int char_width, h, w; + GtkStyleContext *style; + GtkStateFlags state; + + state = nsgtk_widget_get_state_flags(hbox); + style = nsgtk_widget_get_style_context(hbox); context = gtk_widget_get_pango_context(hbox); - metrics = pango_context_get_metrics(context, hbox->style->font_desc, - pango_context_get_language(context)); + metrics = pango_context_get_metrics(context, + nsgtk_style_context_get_font(style, state), + pango_context_get_language(context)); char_width = pango_font_metrics_get_approximate_digit_width(metrics); pango_font_metrics_unref(metrics); @@ -59,9 +67,8 @@ static void nsgtk_tab_update_size(GtkWidget *hbox, GtkStyle *previous_style, static GtkWidget *nsgtk_tab_label_setup(struct gui_window *window) { GtkWidget *hbox, *label, *button, *close; - GtkRcStyle *rcstyle; - hbox = gtk_hbox_new(FALSE, 2); + hbox = nsgtk_hbox_new(FALSE, 2); if (nsoption_bool(new_blank) == true) label = gtk_label_new("New Tab"); @@ -81,10 +88,13 @@ static GtkWidget *nsgtk_tab_label_setup(struct gui_window *window) gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); gtk_widget_set_tooltip_text(button, "Close this tab."); +#ifdef FIXME + GtkRcStyle *rcstyle; rcstyle = gtk_rc_style_new(); rcstyle->xthickness = rcstyle->ythickness = 0; gtk_widget_modify_style(button, rcstyle); g_object_unref(rcstyle); +#endif g_signal_connect_swapped(button, "clicked", G_CALLBACK(nsgtk_window_destroy_browser), window); -- cgit v1.2.3