aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-12-23 21:17:14 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-12-23 21:17:14 +0800
commitfdcf1b26fd44a44c0dfe882f19ec2782cccd542c (patch)
tree5478a1ba7e5a6ca6d516943f3e1746d9b026bd5b
parent8cf5f1c4f4224bc8863ab498c4d89082db6ceb7b (diff)
downloadgsoc2013-empathy-fdcf1b26fd44a44c0dfe882f19ec2782cccd542c.tar
gsoc2013-empathy-fdcf1b26fd44a44c0dfe882f19ec2782cccd542c.tar.gz
gsoc2013-empathy-fdcf1b26fd44a44c0dfe882f19ec2782cccd542c.tar.bz2
gsoc2013-empathy-fdcf1b26fd44a44c0dfe882f19ec2782cccd542c.tar.lz
gsoc2013-empathy-fdcf1b26fd44a44c0dfe882f19ec2782cccd542c.tar.xz
gsoc2013-empathy-fdcf1b26fd44a44c0dfe882f19ec2782cccd542c.tar.zst
gsoc2013-empathy-fdcf1b26fd44a44c0dfe882f19ec2782cccd542c.zip
account-widget: use g_app_info_launch() instead of gdk_spawn_on_screen() (#637854)
-rw-r--r--libempathy-gtk/empathy-account-widget.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index ea1572021..a405789ae 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -1087,32 +1087,48 @@ account_widget_launch_external_clicked (GtkWidget *button,
"com.meego.libsocialweb"))
{
/* we know how to handle this external provider */
- GDesktopAppInfo *app_info;
- const gchar *args[3] = { NULL, };
+ GDesktopAppInfo *desktop_info;
GError *error = NULL;
+ GdkAppLaunchContext *context;
+ gchar *cmd;
+ GAppInfo *app_info;
- app_info = g_desktop_app_info_new ("gnome-control-center.desktop");
-
- if (app_info == NULL)
+ desktop_info = g_desktop_app_info_new ("gnome-control-center.desktop");
+ if (desktop_info == NULL)
{
g_critical ("Could not locate 'gnome-control-center.desktop'");
return;
}
- args[0] = g_app_info_get_commandline (G_APP_INFO (app_info));
- args[1] = "bisho.desktop";
- args[2] = NULL;
+ /* glib doesn't have API to start a desktop file with args... (#637875) */
+ cmd = g_strdup_printf ("%s bisho.desktop", g_app_info_get_commandline (
+ (GAppInfo *) desktop_info));
+
+ app_info = g_app_info_create_from_commandline (cmd, NULL, 0, &error);
+ g_free (cmd);
- gdk_spawn_on_screen (gtk_widget_get_screen (button),
- NULL, (gchar **) args, NULL,
- G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error);
- if (error != NULL)
+ if (app_info == NULL)
{
- g_critical ("Failed to launch editor: %s", error->message);
+ DEBUG ("Failed to create app info: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ context = gdk_app_launch_context_new ();
+ gdk_app_launch_context_set_screen (context,
+ gtk_widget_get_screen (button));
+
+ if (!g_app_info_launch (app_info, NULL, (GAppLaunchContext *) context,
+ &error))
+ {
+ g_critical ("Failed to bisho: %s", error->message);
g_clear_error (&error);
}
- g_object_unref (app_info);
+out:
+ g_object_unref (desktop_info);
+ tp_clear_object (&app_info);
+ tp_clear_object (&context);
}
}