From 05b43caf4c5c36fe35d03cbc26158e562a4a7cc1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 22 Dec 2010 11:13:31 -0500 Subject: Add a section about gdk_spawn to migration guide --- docs/reference/gtk/migrating-2to3.xml | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/docs/reference/gtk/migrating-2to3.xml b/docs/reference/gtk/migrating-2to3.xml index ad0919b9a8..237d14f634 100644 --- a/docs/reference/gtk/migrating-2to3.xml +++ b/docs/reference/gtk/migrating-2to3.xml @@ -123,6 +123,53 @@ +
+ Use GIO for launching applications + + The gdk_spawn family of functions has been + deprecated in GDK 2.24 and removed from GDK 3. Various replacements + exit; the best replacement depends on the circumstances: + + If you are opening a document or URI by launching a command + like firefox http://my-favourite-website.com or + gnome-open ghelp:epiphany, it is best to just use + gtk_show_uri(); as an added benefit, your application will henceforth + respect the users preference for what application to use. + If you are launching a regular, installed application that + has a desktop file, it is best to use GIOs #GAppInfo with a suitable + launch context. + + GAppInfo *info; + GAppLaunchContext *context; + GError *error = NULL; + + info = g_desktop_app_info_new ("epiphany.desktop"); + context = gdk_app_launch_context_new (); + g_app_info_launch (info, NULL, context, &error); + + if (error) + { + g_warning ("Failed to launch epiphany: %s", error->message); + g_error_free (error); + } + + g_object_unref (info); + g_object_unref (context); + + + If you are launching a custom commandline, you can + still use g_app_info_launch() with a GAppInfo that is constructed + with g_app_info_create_from_commandline(), or you can use the + more lowlevel g_spawn family of functions + (e.g. g_spawn_command_line_async()), and pass DISPLAY + in the environment. gdk_screen_make_display_name() can be + used to find the right value for the DISPLAY + environment variable. + + + +
+
Use cairo for drawing -- cgit v1.2.1