[gnome-panel/gtk3] Use GdkAppLaunchContext instead of gdk_spawn_command_line_on_screen()



commit 53ee7d2f39a30df4559920bb8044d9ac3b17ee97
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Wed Dec 29 22:35:18 2010 +0100

    Use GdkAppLaunchContext instead of gdk_spawn_command_line_on_screen()
    
    The latter has been removed in GDK 3, so use GIO's GAppLaunchContext
    and GAppInfo.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=627455

 gnome-panel/panel-action-button.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/gnome-panel/panel-action-button.c b/gnome-panel/panel-action-button.c
index c6434d1..b6b51bb 100644
--- a/gnome-panel/panel-action-button.c
+++ b/gnome-panel/panel-action-button.c
@@ -238,14 +238,25 @@ panel_action_force_quit (GtkWidget *widget)
 static void
 panel_action_connect_server (GtkWidget *widget)
 {
-	GdkScreen *screen;
-	GError    *error;
-	
+	GdkScreen           *screen;
+	GdkAppLaunchContext *launch_context;
+	GAppInfo            *app_info;
+	GError              *error;
+
 	screen = gtk_widget_get_screen (GTK_WIDGET (widget));
 	error = NULL;
+	app_info = g_app_info_create_from_commandline ("nautilus-connect-server",
+						       _("Connect to server"),
+						       G_APP_INFO_CREATE_NONE,
+						       &error);
 
-	gdk_spawn_command_line_on_screen (screen, "nautilus-connect-server",
-					  &error);
+	if (!error) {
+		launch_context = gdk_app_launch_context_new ();
+		gdk_app_launch_context_set_screen (launch_context, screen);
+		g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error);
+
+		g_object_unref (launch_context);
+	}
 
 	if (error) {
 		panel_error_dialog (NULL, screen,
@@ -255,6 +266,8 @@ panel_action_connect_server (GtkWidget *widget)
 				    error->message);
 		g_clear_error (&error);
 	}
+
+	g_object_unref (app_info);
 }
 
 typedef struct {



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