[network-manager-applet] applet: port to GtkStyleContext (bgo #636881)
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] applet: port to GtkStyleContext (bgo #636881)
- Date: Thu, 9 Dec 2010 17:17:56 +0000 (UTC)
commit 243b01c71a2d22825325a53a09968543f0662f55
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 9 11:17:14 2010 -0600
applet: port to GtkStyleContext (bgo #636881)
configure.ac | 2 +-
src/applet.c | 18 +++++++++++++++---
2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a0ce1ea..99d2614 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,7 +84,7 @@ case "${with_gtk2}" in
yes) PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.20)
gtkver=2
;;
- *) PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 2.90)
+ *) PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 2.91.6)
;;
esac
AM_CONDITIONAL(USE_GTK2, test x"$gtkver" = "x2")
diff --git a/src/applet.c b/src/applet.c
index 7f52f1d..9247638 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -482,7 +482,6 @@ static gboolean
menu_title_item_expose (GtkWidget *widget, GdkEventExpose *event)
{
GtkAllocation allocation;
- GtkStyle *style;
GtkWidget *label;
PangoFontDescription *desc;
cairo_t *cr;
@@ -515,8 +514,21 @@ menu_title_item_expose (GtkWidget *widget, GdkEventExpose *event)
text = gtk_label_get_text (GTK_LABEL (label));
layout = pango_cairo_create_layout (cr);
- style = gtk_widget_get_style (widget);
- desc = pango_font_description_copy (style->font_desc);
+#if GTK_CHECK_VERSION(2,20,0) && !GTK_CHECK_VERSION(2,91,6)
+ {
+ GtkStyle *style;
+ style = gtk_widget_get_style (widget);
+ desc = pango_font_description_copy (style->font_desc);
+ }
+#else
+ {
+ GtkStyleContext *style;
+ style = gtk_widget_get_style_context (widget);
+ gtk_style_context_get (style, gtk_style_context_get_state (style),
+ "font", &desc,
+ NULL);
+ }
+#endif
pango_font_description_set_variant (desc, PANGO_VARIANT_SMALL_CAPS);
pango_font_description_set_weight (desc, PANGO_WEIGHT_SEMIBOLD);
pango_layout_set_font_description (layout, desc);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]