SF.net SVN: geany:[5885] trunk/src
colombanw at users.sourceforge.net
colombanw at xxxxx
Sat Aug 6 18:33:28 UTC 2011
Revision: 5885
http://geany.svn.sourceforge.net/geany/?rev=5885&view=rev
Author: colombanw
Date: 2011-08-06 18:33:27 +0000 (Sat, 06 Aug 2011)
Log Message:
-----------
Refactor a little some code to be more readable
Modified Paths:
--------------
trunk/src/stash.c
trunk/src/tools.c
Modified: trunk/src/stash.c
===================================================================
--- trunk/src/stash.c 2011-08-06 18:33:04 UTC (rev 5884)
+++ trunk/src/stash.c 2011-08-06 18:33:27 UTC (rev 5885)
@@ -1030,8 +1030,9 @@
static void stash_tree_append_pref(StashGroup *group, StashPref *entry, GtkListStore *store)
{
- gboolean supported_type = TRUE;
gpointer setting;
+ GtkTreeIter iter;
+ StashTreeValue *value;
switch (entry->setting_type)
{
@@ -1045,28 +1046,21 @@
setting = g_strdup(*(gchararray *) entry->setting);
break;
default:
- supported_type = FALSE;
+ g_warning("Unhandled type for %s::%s in %s()!", group->name,
+ entry->key_name, G_STRFUNC);
+ return;
}
- if (supported_type)
- {
- GtkTreeIter iter;
- StashTreeValue *value = g_new(StashTreeValue, 1);
+ value = g_new(StashTreeValue, 1);
- value->setting_type = entry->setting_type;
- value->setting = setting;
- value->key_name = entry->key_name;
- value->group_name = group->name;
+ value->setting_type = entry->setting_type;
+ value->setting = setting;
+ value->key_name = entry->key_name;
+ value->group_name = group->name;
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter, STASH_TREE_NAME, value->key_name,
- STASH_TREE_VALUE, value, -1);
- }
- else
- {
- g_warning("Unhandled type for %s::%s in %s()!", group->name,
- entry->key_name, G_STRFUNC);
- }
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, STASH_TREE_NAME, value->key_name,
+ STASH_TREE_VALUE, value, -1);
}
Modified: trunk/src/tools.c
===================================================================
--- trunk/src/tools.c 2011-08-06 18:33:04 UTC (rev 5884)
+++ trunk/src/tools.c 2011-08-06 18:33:27 UTC (rev 5885)
@@ -85,13 +85,9 @@
{
gchar *path = g_find_program_in_path(command);
- if (path != NULL)
- {
- g_free(path);
- return TRUE;
- }
+ g_free(path);
- return FALSE;
+ return path != NULL;
}
@@ -99,27 +95,23 @@
static void cc_dialog_update_row_status(GtkListStore *store, GtkTreeIter *iter, const gchar *cmd)
{
GError *err = NULL;
- const gchar *stock_id;
+ const gchar *stock_id = GTK_STOCK_NO;
gchar *tooltip = NULL;
gint argc;
gchar **argv;
if (! NZV(cmd))
- {
stock_id = GTK_STOCK_YES;
- }
else if (g_shell_parse_argv(cmd, &argc, &argv, &err))
{
if (argc > 0 && cc_exists_command(argv[0]))
stock_id = GTK_STOCK_YES;
else
- err = g_error_new(G_FILE_ERROR, G_FILE_ERROR_NOENT, _("Command not found"));
+ tooltip = g_strdup_printf(_("Invalid command: %s"), _("Command not found"));
g_strfreev(argv);
}
-
- if (err != NULL)
+ else
{
- stock_id = GTK_STOCK_NO;
tooltip = g_strdup_printf(_("Invalid command: %s"), err->message);
g_error_free(err);
}
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