[Xfce4-commits] [apps/xfce4-screenshooter] 01/01: Fix the --open command line option (Bug #14225)
noreply at xfce.org
noreply at xfce.org
Sat Feb 17 15:32:55 CET 2018
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-screenshooter.
commit 3d6fafaa192150a01e409b7137b6d039f6258c23
Author: Andre Miranda <andreldm at xfce.org>
Date: Sat Feb 17 11:14:50 2018 -0300
Fix the --open command line option (Bug #14225)
This option doesn't use AppInfo, so I had to restore
the code that used g_spawn_command_line_async, removed
in e86731e.
---
lib/screenshooter-utils.c | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/lib/screenshooter-utils.c b/lib/screenshooter-utils.c
index 76080d4..de6d69e 100644
--- a/lib/screenshooter-utils.c
+++ b/lib/screenshooter-utils.c
@@ -159,9 +159,11 @@ screenshooter_write_rc_file (const gchar *file, ScreenshotData *sd)
void
screenshooter_open_screenshot (const gchar *screenshot_path, const gchar *application, GAppInfo *const app_info)
{
- GError *error = NULL;
gpointer screenshot_file = NULL;
- GList *files = NULL;
+ gboolean success = TRUE;
+ gchar *command;
+ GError *error = NULL;
+ GList *files = NULL;
g_return_if_fail (screenshot_path != NULL);
@@ -172,23 +174,31 @@ screenshooter_open_screenshot (const gchar *screenshot_path, const gchar *applic
TRACE ("Application was not none");
- g_return_if_fail (app_info != NULL);
+ if (app_info != NULL)
+ {
+ TRACE ("Launch the app");
- TRACE ("app_info was != NULL");
+ screenshot_file = g_file_new_for_path (screenshot_path);
+ files = g_list_append (NULL, screenshot_file);
+ success = g_app_info_launch (app_info, files, NULL, &error);
+ g_list_free_full (files, g_object_unref);
+ }
+ else if (application != NULL)
+ {
+ TRACE ("Launch the command");
- screenshot_file = g_file_new_for_path (screenshot_path);
- files = g_list_append (NULL, screenshot_file);
+ command = g_strconcat (application, " ", "\"", screenshot_path, "\"", NULL);
+ success = g_spawn_command_line_async (command, &error);
+ g_free (command);
+ }
- TRACE ("Launch the command");
- if (!g_app_info_launch (app_info, files, NULL, &error))
+ /* report any error */
+ if (!success && error != NULL)
{
TRACE ("An error occured");
-
screenshooter_error (_("<b>The application could not be launched.</b>\n%s"), error->message);
g_error_free (error);
}
-
- g_list_free_full (files, g_object_unref);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list