summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2015-12-19 16:08:37 +0100
committerWolfgang Ulbrich <[email protected]>2015-12-19 16:08:37 +0100
commit208c2cd972c1fafd05b4813f438b745b5db00942 (patch)
treeed9410daf6b7c6c86b1b1d45441afe5ae4cdeeea
parent74f608e462c9ac492426a3f408b9002b4b733e2a (diff)
downloadmate-applets-208c2cd972c1fafd05b4813f438b745b5db00942.tar.bz2
mate-applets-208c2cd972c1fafd05b4813f438b745b5db00942.tar.xz
GTK3: fix several deprecations
- deprecated gdk_app_launch_context_new - deprecated gtk_widget_{set/get}_state
-rw-r--r--accessx-status/applet.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/accessx-status/applet.c b/accessx-status/applet.c
index a00a1a71..8383452c 100644
--- a/accessx-status/applet.c
+++ b/accessx-status/applet.c
@@ -197,7 +197,12 @@ static void dialog_cb(GtkAction* action, AccessxStatusApplet* sapplet)
&error);
if (!error) {
+#if GTK_CHECK_VERSION (3, 0, 0)
+ launch_context = gdk_display_get_app_launch_context (
+ gtk_widget_get_display (GTK_WIDGET (screen)));
+#else
launch_context = gdk_app_launch_context_new ();
+#endif
gdk_app_launch_context_set_screen (launch_context, screen);
g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error);
@@ -518,7 +523,11 @@ static GdkPixbuf* accessx_status_applet_slowkeys_image(AccessxStatusApplet* sapp
}
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ fg = style->fg[gtk_widget_get_state_flags (GTK_WIDGET (sapplet->applet))];
+#else
fg = style->fg[gtk_widget_get_state(GTK_WIDGET(sapplet->applet))];
+#endif
glyph_pixbuf = accessx_status_applet_get_glyph_pixbuf(sapplet, GTK_WIDGET(sapplet->applet), ret_pixbuf, &fg, &bg, glyphstring);
gdk_pixbuf_composite(glyph_pixbuf, ret_pixbuf, 0, 0, gdk_pixbuf_get_width(glyph_pixbuf), gdk_pixbuf_get_height(glyph_pixbuf), 0., 0., 1.0, 1.0, GDK_INTERP_NEAREST, 255);
g_object_unref(glyph_pixbuf);
@@ -539,7 +548,11 @@ static GdkPixbuf* accessx_status_applet_bouncekeys_image(AccessxStatusApplet* sa
g_assert(sapplet->applet);
style = gtk_widget_get_style(GTK_WIDGET(sapplet->applet));
+#if GTK_CHECK_VERSION (3, 0, 0)
+ fg = style->text[gtk_widget_get_state_flags (GTK_WIDGET (sapplet->applet))];
+#else
fg = style->text[gtk_widget_get_state(GTK_WIDGET(sapplet->applet))];
+#endif
bg = style->base[GTK_STATE_NORMAL];
if (event != NULL)
@@ -648,12 +661,20 @@ static void accessx_status_applet_update(AccessxStatusApplet* sapplet, AccessxSt
if (locked_mods & modifiers[i].mask)
{
gtk_widget_set_sensitive(modifiers[i].indicator, TRUE);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_state_flags (modifiers[i].indicator, GTK_STATE_FLAG_SELECTED, TRUE);
+#else
gtk_widget_set_state(modifiers[i].indicator, GTK_STATE_SELECTED);
+#endif
}
else if (latched_mods & modifiers[i].mask)
{
gtk_widget_set_sensitive(modifiers[i].indicator, TRUE);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_state_flags (modifiers[i].indicator, GTK_STATE_FLAG_NORMAL, TRUE);
+#else
gtk_widget_set_state(modifiers[i].indicator, GTK_STATE_NORMAL);
+#endif
}
else
{
@@ -788,7 +809,11 @@ static void accessx_status_applet_notify_xkb_device(AccessxStatusApplet* sapplet
if (event->led_state &= ALT_GRAPH_LED_MASK)
{
gtk_widget_set_sensitive(sapplet->alt_graph_indicator, TRUE);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_state_flags (sapplet->alt_graph_indicator, GTK_STATE_FLAG_NORMAL, TRUE);
+#else
gtk_widget_set_state(sapplet->alt_graph_indicator, GTK_STATE_NORMAL);
+#endif
}
else
{
@@ -881,7 +906,11 @@ static GtkIconSet* accessx_status_applet_altgraph_icon_set(AccessxStatusApplet*
case GTK_STATE_NORMAL:
alpha = 255;
gtk_widget_set_sensitive(widget, TRUE);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_NORMAL, TRUE);
+#else
gtk_widget_set_state(widget, GTK_STATE_NORMAL);
+#endif
break;
case GTK_STATE_SELECTED:
/* FIXME: should use text/base here, for selected ? */
@@ -889,7 +918,11 @@ static GtkIconSet* accessx_status_applet_altgraph_icon_set(AccessxStatusApplet*
bg = &style->black;
alpha = 255;
gtk_widget_set_sensitive(widget, TRUE);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_SELECTED, TRUE);
+#else
gtk_widget_set_state(widget, GTK_STATE_SELECTED);
+#endif
break;
case GTK_STATE_INSENSITIVE:
default:
@@ -921,7 +954,11 @@ static GtkIconSet* accessx_status_applet_altgraph_icon_set(AccessxStatusApplet*
gtk_icon_source_free(source);
}
/* we mucked about with the box's state to create the icons; restore it to normal */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_NORMAL, TRUE);
+#else
gtk_widget_set_state(widget, GTK_STATE_NORMAL);
+#endif
gtk_widget_set_sensitive(widget, TRUE);
return icon_set;