[geany/geany] 897197: Unify the spawn callers error messages: context action

Dimitar Zhekov git-noreply at xxxxx
Tue Oct 20 17:33:41 UTC 2015


Branch:      refs/heads/master
Author:      Dimitar Zhekov <dimitar.zhekov at gmail.com>
Committer:   Dimitar Zhekov <dimitar.zhekov at gmail.com>
Date:        Tue, 20 Oct 2015 17:33:41 UTC
Commit:      897197ae51cb51c7f07281ef7c6e118b27f25718
             https://github.com/geany/geany/commit/897197ae51cb51c7f07281ef7c6e118b27f25718

Log Message:
-----------
Unify the spawn callers error messages: context action


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

Modified: src/callbacks.c
14 lines changed, 11 insertions(+), 3 deletions(-)
===================================================================
@@ -1452,6 +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;
 
 	g_return_if_fail(doc != NULL);
 
@@ -1469,22 +1470,29 @@ 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.");
 	}
 	else
 	{
 		command = g_strdup(tool_prefs.context_action_cmd);
+		format = _("Cannot execute context action command \"%s\": %s. "
+			"Check the path setting in Filetype configuration.");
 	}
 
 	/* substitute the wildcard %s and run the command if it is non empty */
 	if (G_LIKELY(!EMPTY(command)))
 	{
-		utils_str_replace_all(&command, "%s", word);
+		gchar *command_line = g_strdup(command);
 
-		if (!spawn_async(NULL, command, NULL, NULL, NULL, &error))
+		utils_str_replace_all(&command_line, "%s", word);
+
+		if (!spawn_async(NULL, command_line, NULL, NULL, NULL, &error))
 		{
-			ui_set_statusbar(TRUE, "Context action command failed: %s", error->message);
+			ui_set_statusbar(TRUE, format, command, error->message);
 			g_error_free(error);
 		}
+		g_free(command_line);
 	}
 	g_free(word);
 	g_free(command);



--------------
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