aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-12-23 20:31:01 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-12-23 20:31:01 +0800
commita5c7ff32a6f9672ca78a4aca5a4dcf7554fc24f1 (patch)
treebc48e7894c82c9df28049aad9ccfa4b17e62c57d /src
parent23a647a3dcb0109aadcb9a3f40d788754cd48767 (diff)
downloadgsoc2013-empathy-a5c7ff32a6f9672ca78a4aca5a4dcf7554fc24f1.tar
gsoc2013-empathy-a5c7ff32a6f9672ca78a4aca5a4dcf7554fc24f1.tar.gz
gsoc2013-empathy-a5c7ff32a6f9672ca78a4aca5a4dcf7554fc24f1.tar.bz2
gsoc2013-empathy-a5c7ff32a6f9672ca78a4aca5a4dcf7554fc24f1.tar.lz
gsoc2013-empathy-a5c7ff32a6f9672ca78a4aca5a4dcf7554fc24f1.tar.xz
gsoc2013-empathy-a5c7ff32a6f9672ca78a4aca5a4dcf7554fc24f1.tar.zst
gsoc2013-empathy-a5c7ff32a6f9672ca78a4aca5a4dcf7554fc24f1.zip
accounts-dialog: use g_app_info_launch() instead of gdk_spawn_on_screen() (#637854)
Diffstat (limited to 'src')
-rw-r--r--src/empathy-accounts-dialog.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 8b025da4e..a155feceb 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -2292,10 +2292,10 @@ empathy_accounts_dialog_show_application (GdkScreen *screen,
gboolean hidden)
{
GError *error = NULL;
- const gchar *argv[4] = { NULL, };
- gint i = 0;
- gchar *account_option = NULL;
+ GString *cmd;
gchar *path;
+ GAppInfo *app_info;
+ GdkAppLaunchContext *context;
g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (!selected_account || TP_IS_ACCOUNT (selected_account));
@@ -2310,37 +2310,48 @@ empathy_accounts_dialog_show_application (GdkScreen *screen,
path = g_build_filename (BIN_DIR, "empathy-accounts", NULL);
}
- argv[i++] = path;
+ cmd = g_string_new (path);
+ g_free (path);
if (selected_account != NULL)
{
- account_option = g_strdup_printf ("--select-account=%s",
+ g_string_append_printf (cmd, " --select-account=%s",
tp_account_get_path_suffix (selected_account));
-
- argv[i++] = account_option;
}
if (if_needed)
- argv[i++] = "--if-needed";
+ g_string_append_printf (cmd, " --if-needed");
if (hidden)
- argv[i++] = "--hidden";
+ g_string_append_printf (cmd, " --hidden");
DEBUG ("Launching empathy-accounts (if_needed: %d, hidden: %d, account: %s)",
if_needed, hidden,
selected_account == NULL ? "<none selected>" :
tp_proxy_get_object_path (TP_PROXY (selected_account)));
- gdk_spawn_on_screen (screen, NULL, (gchar**) argv, NULL, G_SPAWN_SEARCH_PATH,
- NULL, NULL, NULL, &error);
- if (error != NULL)
+ app_info = g_app_info_create_from_commandline (cmd->str, NULL, 0, &error);
+ if (app_info == NULL)
+ {
+ 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_display (context, gdk_screen_get_display (screen));
+
+ if (!g_app_info_launch (app_info, NULL, (GAppLaunchContext *) context,
+ &error))
{
g_warning ("Failed to open accounts dialog: %s", error->message);
g_error_free (error);
}
- g_free (account_option);
- g_free (path);
+out:
+ tp_clear_object (&app_info);
+ tp_clear_object (&context);
+ g_string_free (cmd, TRUE);
}
gboolean