Revision: 3416 http://geany.svn.sourceforge.net/geany/?rev=3416&view=rev Author: ntrel Date: 2008-12-22 13:01:50 +0000 (Mon, 22 Dec 2008)
Log Message: ----------- Use helper function add_widget_pref() for GUI prefs.
Modified Paths: -------------- trunk/src/stash.c
Modified: trunk/src/stash.c =================================================================== --- trunk/src/stash.c 2008-12-22 12:50:19 UTC (rev 3415) +++ trunk/src/stash.c 2008-12-22 13:01:50 UTC (rev 3416) @@ -394,16 +394,27 @@ }
+static GeanyPrefEntry * +add_widget_pref(GeanyPrefGroup *group, GType setting_type, gpointer setting, + const gchar *key_name, gpointer default_value, + GType widget_type, gpointer widget_id) +{ + GeanyPrefEntry *entry = + add_pref(group, setting_type, setting, key_name, default_value); + + entry->widget_type = widget_type; + entry->widget_id = widget_id; + return entry; +} + + /* Used for GtkCheckButton or GtkToggleButton widgets. * @see stash_group_add_radio_buttons(). */ void stash_group_add_toggle_button(GeanyPrefGroup *group, gboolean *setting, const gchar *key_name, gboolean default_value, gpointer widget_id) { - GeanyPrefEntry *entry = - add_pref(group, G_TYPE_BOOLEAN, setting, key_name, GINT_TO_POINTER(default_value)); - - entry->widget_type = GTK_TYPE_TOGGLE_BUTTON; - entry->widget_id = widget_id; + add_widget_pref(group, G_TYPE_BOOLEAN, setting, key_name, GINT_TO_POINTER(default_value), + GTK_TYPE_TOGGLE_BUTTON, widget_id); }
@@ -419,13 +430,12 @@ gpointer widget_id, gint enum_id, ...) { GeanyPrefEntry *entry = - add_pref(group, G_TYPE_INT, setting, key_name, GINT_TO_POINTER(default_value)); + add_widget_pref(group, G_TYPE_INT, setting, key_name, GINT_TO_POINTER(default_value), + GTK_TYPE_RADIO_BUTTON, NULL); va_list args; gsize count = 1; EnumWidget *item, *array;
- entry->widget_type = GTK_TYPE_RADIO_BUTTON; - /* count pairs of args */ va_start(args, enum_id); while (1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.