SF.net SVN: geany: [2331] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Mar 13 09:33:24 UTC 2008


Revision: 2331
          http://geany.svn.sourceforge.net/geany/?rev=2331&view=rev
Author:   eht16
Date:     2008-03-13 02:33:23 -0700 (Thu, 13 Mar 2008)

Log Message:
-----------
Use the default values for various tools if they don't exist in the config file instead of using g_find_program_in_path(), patch by Yura Siamashka (thanks).
Fix executable check for grep command.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/keyfile.c
    trunk/src/search.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-03-13 09:18:41 UTC (rev 2330)
+++ trunk/ChangeLog	2008-03-13 09:33:23 UTC (rev 2331)
@@ -5,6 +5,11 @@
    a notice how to change the used font (#1907117).
  * src/plugins.c: Don't load all available plugins on startup, it's only
                   necessary opening the plugin manager.
+ * src/keyfile.c, src/search.c:
+   Use the default values for various tools if they don't exist in the
+   config file instead of using g_find_program_in_path(), patch by
+   Yura Siamashka (thanks).
+   Fix executable check for grep command.
 
 
 2008-03-12  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2008-03-13 09:18:41 UTC (rev 2330)
+++ trunk/src/keyfile.c	2008-03-13 09:33:23 UTC (rev 2331)
@@ -638,22 +638,11 @@
 	g_free(tmp_string2);
 
 	/* tools */
-	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_MAKE);
-	prefs.tools_make_cmd = utils_get_setting_string(config, "tools", "make_cmd", tmp_string);
-	g_free(tmp_string);
+	prefs.tools_make_cmd = utils_get_setting_string(config, "tools", "make_cmd", GEANY_DEFAULT_TOOLS_MAKE);
+	prefs.tools_term_cmd = utils_get_setting_string(config, "tools", "term_cmd", GEANY_DEFAULT_TOOLS_TERMINAL);
+	prefs.tools_browser_cmd = utils_get_setting_string(config, "tools", "browser_cmd", GEANY_DEFAULT_TOOLS_BROWSER);
+	prefs.tools_grep_cmd = utils_get_setting_string(config, "tools", "grep_cmd", GEANY_DEFAULT_TOOLS_GREP);
 
-	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_TERMINAL);
-	prefs.tools_term_cmd = utils_get_setting_string(config, "tools", "term_cmd", tmp_string);
-	g_free(tmp_string);
-
-	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_BROWSER);
-	prefs.tools_browser_cmd = utils_get_setting_string(config, "tools", "browser_cmd", tmp_string);
-	g_free(tmp_string);
-
-	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_GREP);
-	prefs.tools_grep_cmd = utils_get_setting_string(config, "tools", "grep_cmd", tmp_string);
-	g_free(tmp_string);
-
 	prefs.context_action_cmd = utils_get_setting_string(config, PACKAGE, "context_action_cmd", "");
 
 	/* printing */

Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c	2008-03-13 09:18:41 UTC (rev 2330)
+++ trunk/src/search.c	2008-03-13 09:33:23 UTC (rev 2331)
@@ -1150,6 +1150,7 @@
 search_find_in_files(const gchar *search_text, const gchar *dir, const gchar *opts)
 {
 	gchar **argv_prefix, **argv, **opts_argv;
+	gchar *command_grep;
 	guint opts_argv_len, i;
 	GPid child_pid;
 	gint stdout_fd;
@@ -1158,7 +1159,8 @@
 
 	if (! search_text || ! *search_text || ! dir) return TRUE;
 
-	if (! g_file_test(prefs.tools_grep_cmd, G_FILE_TEST_IS_EXECUTABLE))
+	command_grep = g_find_program_in_path(prefs.tools_grep_cmd);
+	if (command_grep == NULL)
 	{
 		ui_set_statusbar(TRUE, _("Cannot execute grep tool '%s';"
 			" check the path setting in Preferences."), prefs.tools_grep_cmd);
@@ -1171,7 +1173,7 @@
 	/* set grep command and options */
 	argv_prefix = g_new0(gchar*, 1 + opts_argv_len + 3 + 1);	/* last +1 for recursive arg */
 
-	argv_prefix[0] = g_strdup(prefs.tools_grep_cmd);
+	argv_prefix[0] = command_grep;
 	for (i = 0; i < opts_argv_len; i++)
 	{
 		argv_prefix[i + 1] = g_strdup(opts_argv[i]);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list