Revision: 3302 http://geany.svn.sourceforge.net/geany/?rev=3302&view=rev Author: ntrel Date: 2008-12-01 14:54:47 +0000 (Mon, 01 Dec 2008)
Log Message: ----------- Add G_TYPE_STRING setting support to Stash code, use in keyfile.c.
Modified Paths: -------------- trunk/ChangeLog trunk/src/keyfile.c trunk/src/stash.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-12-01 14:45:26 UTC (rev 3301) +++ trunk/ChangeLog 2008-12-01 14:54:47 UTC (rev 3302) @@ -3,6 +3,8 @@ * src/keyfile.c, src/vte.c, doc/geany.txt, doc/geany.html: Make VTE emulation pref hidden, because libvte only comes with an xterm termcaps file and the GUI pref can be confusing. + * src/stash.c, src/keyfile.c: + Add G_TYPE_STRING setting support to Stash code, use in keyfile.c.
2008-11-29 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2008-12-01 14:45:26 UTC (rev 3301) +++ trunk/src/keyfile.c 2008-12-01 14:54:47 UTC (rev 3302) @@ -104,6 +104,8 @@ { GeanyPrefEntry package_items[] = { + {G_TYPE_STRING, &prefs.default_open_path, "default_open_path", "", NULL}, + {G_TYPE_BOOLEAN, &file_prefs.cmdline_new_files, "cmdline_new_files", (gpointer)TRUE, NULL},
@@ -116,7 +118,6 @@ (gpointer)FALSE, NULL}, {G_TYPE_BOOLEAN, &editor_prefs.use_tab_to_indent, "use_tab_to_indent", (gpointer)TRUE, NULL}, - {G_TYPE_INT, &editor_prefs.indentation->width, "pref_editor_tab_width", (gpointer)4, NULL}, {G_TYPE_INT, &editor_prefs.indentation->hard_tab_width, "indent_hard_tab_width", @@ -147,7 +148,7 @@ #if GTK_CHECK_VERSION(2, 12, 0) , {G_TYPE_BOOLEAN, &interface_prefs.show_symbol_list_expanders, "show_symbol_list_expanders", - (gpointer)TRUE, NULL}, + (gpointer)TRUE, NULL} #endif }; GeanyPrefGroup groups[] = @@ -293,7 +294,6 @@ g_key_file_set_boolean(config, PACKAGE, "switch_msgwin_pages", prefs.switch_to_status); g_key_file_set_boolean(config, PACKAGE, "beep_on_errors", prefs.beep_on_errors); g_key_file_set_boolean(config, PACKAGE, "auto_focus", prefs.auto_focus); - g_key_file_set_string(config, PACKAGE, "default_open_path", prefs.default_open_path);
/* interface */ g_key_file_set_boolean(config, PACKAGE, "sidebar_symbol_visible", interface_prefs.sidebar_symbol_visible); @@ -580,7 +580,6 @@ prefs.beep_on_errors = utils_get_setting_boolean(config, PACKAGE, "beep_on_errors", TRUE); prefs.switch_to_status = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", FALSE); prefs.auto_focus = utils_get_setting_boolean(config, PACKAGE, "auto_focus", FALSE); - prefs.default_open_path = utils_get_setting_string(config, PACKAGE, "default_open_path", "");
/* interface */ interface_prefs.tab_pos_editor = utils_get_setting_integer(config, PACKAGE, "tab_pos_editor", GTK_POS_TOP);
Modified: trunk/src/stash.c =================================================================== --- trunk/src/stash.c 2008-12-01 14:45:26 UTC (rev 3301) +++ trunk/src/stash.c 2008-12-01 14:54:47 UTC (rev 3302) @@ -77,6 +77,25 @@ }
+static void handle_string_setting(GeanyPrefGroup *group, GeanyPrefEntry *se, + GKeyFile *config, SettingAction action) +{ + gchararray *setting = se->setting; + + switch (action) + { + case SETTING_READ: + g_free(*setting); + *setting = utils_get_setting_string(config, group->name, se->key_name, + se->default_value); + break; + case SETTING_WRITE: + g_key_file_set_string(config, group->name, se->key_name, *setting); + break; + } +} + + static void keyfile_action(GeanyPrefGroup *group, GKeyFile *keyfile, SettingAction action) { GeanyPrefEntry *entry; @@ -93,6 +112,8 @@ handle_bool_setting(group, entry, keyfile, action); break; case G_TYPE_INT: handle_int_setting(group, entry, keyfile, action); break; + case G_TYPE_STRING: + handle_string_setting(group, entry, keyfile, action); break; default: g_warning("Unhandled type for %s::%s!", group->name, entry->key_name); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.