[geany/geany] ca76d8: Fix context action spawning error message

Dimitar Zhekov git-noreply at xxxxx
Sun Nov 1 13:34:26 UTC 2015


Branch:      refs/heads/master
Author:      Dimitar Zhekov <dimitar.zhekov at gmail.com>
Committer:   Dimitar Zhekov <dimitar.zhekov at gmail.com>
Date:        Sun, 01 Nov 2015 13:34:26 UTC
Commit:      ca76d87cac33d59c0b726a4f47d47b7948aca55e
             https://github.com/geany/geany/commit/ca76d87cac33d59c0b726a4f47d47b7948aca55e

Log Message:
-----------
Fix context action spawning error message

Properly display what configuration should be checked, and show the
entire command line on parsing error.


Modified Paths:
--------------
    src/callbacks.c

Modified: src/callbacks.c
13 lines changed, 7 insertions(+), 6 deletions(-)
===================================================================
@@ -1452,7 +1452,7 @@ void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data)
 	gchar *word, *command;
 	GError *error = NULL;
 	GeanyDocument *doc = document_get_current();
-	const gchar *format;
+	const gchar *check_msg;
 
 	g_return_if_fail(doc != NULL);
 
@@ -1470,14 +1470,12 @@ void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data)
 		!EMPTY(doc->file_type->context_action_cmd))
 	{
 		command = g_strdup(doc->file_type->context_action_cmd);
-		format = _("Cannot execute context action command \"%s\": %s. "
-			"Check the path setting in Preferences.");
+		check_msg = _("Check the path setting in Filetype configuration.");
 	}
 	else
 	{
 		command = g_strdup(tool_prefs.context_action_cmd);
-		format = _("Cannot execute context action command \"%s\": %s. "
-			"Check the path setting in Filetype configuration.");
+		check_msg = _("Check the path setting in Preferences.");
 	}
 
 	/* substitute the wildcard %s and run the command if it is non empty */
@@ -1489,7 +1487,10 @@ void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data)
 
 		if (!spawn_async(NULL, command_line, NULL, NULL, NULL, &error))
 		{
-			ui_set_statusbar(TRUE, format, command, error->message);
+			/* G_SHELL_ERROR is parsing error, it may be caused by %s word with quotes */
+			ui_set_statusbar(TRUE, _("Cannot execute context action command \"%s\": %s. %s"),
+				error->domain == G_SHELL_ERROR ? command_line : command, error->message,
+				check_msg);
 			g_error_free(error);
 		}
 		g_free(command_line);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list