[gnome-applets] Remove use of deprecated GDK functions and quiet a compiler warning



commit fea6b8c6857d822475100aa7692c1360ff9292b9
Author: Kjartan Maraas <kmaraas gnome org>
Date:   Sat Jan 8 23:12:14 2011 +0100

    Remove use of deprecated GDK functions and quiet a compiler warning

 accessx-status/applet.c |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/accessx-status/applet.c b/accessx-status/applet.c
index c4fe882..c957377 100644
--- a/accessx-status/applet.c
+++ b/accessx-status/applet.c
@@ -27,6 +27,8 @@
 #include <gdk/gdkkeysyms.h>
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
+#include <gio/gio.h>
+#include <gio/gdesktopappinfo.h>
 #include <panel-applet-gconf.h>
 #include <X11/XKBlib.h>
 #define XK_MISCELLANY
@@ -185,26 +187,27 @@ dialog_cb (GtkAction           *action,
 	   AccessxStatusApplet *sapplet)
 {
 	GError *error = NULL;
+	GdkScreen *screen;
+	GdkAppLaunchContext *launch_context;
+	GAppInfo *appinfo;
 
 	if (sapplet->error_type != ACCESSX_STATUS_ERROR_NONE) {
 		popup_error_dialog (sapplet);
 		return;
 	}
 
-	/* This is the old way of calling things, we try this just in case
-	 * we're in a mixed-version enviroment. It has to be tried first, 
-	 * because the new command doesn't fail in a way useful to
-	 * gdk_spawn_command_line_on_screen and its error parameter. */
-	gdk_spawn_command_line_on_screen (gtk_widget_get_screen (GTK_WIDGET (sapplet->applet)),
-					  "gnome-accessibility-keyboard-properties", 
-					  &error);
+	screen = gtk_widget_get_screen (GTK_WIDGET (sapplet->applet));
+	appinfo = g_app_info_create_from_commandline ("gnome-control-center keyboard",
+						      _("Open the keyboard preferences dialog"),
+						      G_APP_INFO_CREATE_NONE,
+						      &error);
 
-	if (error != NULL) {
-		g_error_free (error);
-		error = NULL;
-	        gdk_spawn_command_line_on_screen (gtk_widget_get_screen (GTK_WIDGET (sapplet->applet)),
-						  "gnome-keyboard-properties --a11y", 
-						  &error);
+	if (!error) {
+		launch_context = gdk_app_launch_context_new ();
+		gdk_app_launch_context_set_screen (launch_context, screen);
+		g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error);
+
+		g_object_unref (launch_context);
 	}
 
 	if (error != NULL) {
@@ -227,6 +230,8 @@ dialog_cb (GtkAction           *action,
 		gtk_widget_show (dialog);
 		g_error_free (error);
 	}
+
+	g_object_unref (appinfo);
 }
 
 static const GtkActionEntry accessx_status_applet_menu_actions [] = {
@@ -498,7 +503,7 @@ accessx_status_applet_bouncekeys_image (AccessxStatusApplet *sapplet, XkbAccessX
 {
 	GtkStyle  *style;
 	GdkColor   fg, bg;
-	GdkPixbuf *icon_base, *tmp_pixbuf;
+	GdkPixbuf *icon_base = NULL, *tmp_pixbuf;
 	/* Note to translators: the first letter of the alphabet, not the indefinite article */
 	gchar     *glyphstring = N_("a");
 	gchar *stock_id = ACCESSX_BASE_ICON;



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