[empathy] accounts-dialog: use g_app_info_launch() instead of gdk_spawn_on_screen() (#637854)
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] accounts-dialog: use g_app_info_launch() instead of gdk_spawn_on_screen() (#637854)
- Date: Thu, 23 Dec 2010 13:56:30 +0000 (UTC)
commit a5c7ff32a6f9672ca78a4aca5a4dcf7554fc24f1
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Thu Dec 23 13:31:01 2010 +0100
accounts-dialog: use g_app_info_launch() instead of gdk_spawn_on_screen() (#637854)
src/empathy-accounts-dialog.c | 39 +++++++++++++++++++++++++--------------
1 files changed, 25 insertions(+), 14 deletions(-)
---
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 8b025da..a155fec 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]