aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-ui-utils.c33
-rw-r--r--libempathy-gtk/empathy-ui-utils.h1
2 files changed, 32 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 905037bf8..967d59cda 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -1669,10 +1669,12 @@ launch_app_info (GAppInfo *app_info,
gboolean
empathy_launch_external_app (const gchar *desktop_file,
+ const gchar *args,
GError **error)
{
GDesktopAppInfo *desktop_info;
gboolean result;
+ GError *err = NULL;
desktop_info = g_desktop_app_info_new (desktop_file);
if (desktop_info == NULL)
@@ -1684,8 +1686,35 @@ empathy_launch_external_app (const gchar *desktop_file,
return FALSE;
}
- result = launch_app_info (G_APP_INFO (desktop_info), error);
- g_object_unref (desktop_info);
+ if (args == NULL)
+ {
+ result = launch_app_info (G_APP_INFO (desktop_info), error);
+ }
+ else
+ {
+ gchar *cmd;
+ GAppInfo *app_info;
+
+ /* glib doesn't have API to start a desktop file with args... (#637875) */
+ cmd = g_strdup_printf ("%s %s", g_app_info_get_commandline (
+ (GAppInfo *) desktop_info), args);
+ app_info = g_app_info_create_from_commandline (cmd, NULL, 0, &err);
+ if (app_info == NULL)
+ {
+ DEBUG ("Failed to launch '%s': %s", cmd, err->message);
+ g_free (cmd);
+ g_object_unref (desktop_info);
+ g_propagate_error (error, err);
+ return FALSE;
+ }
+
+ result = launch_app_info (app_info, error);
+
+ g_object_unref (app_info);
+ g_free (cmd);
+ }
+
+ g_object_unref (desktop_info);
return result;
}
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index 97777e5b6..73232cf52 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -148,6 +148,7 @@ void empathy_launch_program (const gchar *dir,
void empathy_set_css_provider (GtkWidget *widget);
gboolean empathy_launch_external_app (const gchar *desktop_file,
+ const gchar *args,
GError **error);
G_END_DECLS