Revision: 5048 http://geany.svn.sourceforge.net/geany/?rev=5048&view=rev Author: ntrel Date: 2010-06-18 12:20:15 +0000 (Fri, 18 Jun 2010)
Log Message: ----------- Add ui_combo_box_add_to_history() to API.
Modified Paths: -------------- trunk/ChangeLog trunk/plugins/geanyfunctions.h trunk/src/dialogs.c trunk/src/plugindata.h trunk/src/plugins.c trunk/src/search.c trunk/src/ui_utils.c trunk/src/ui_utils.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-06-17 22:07:53 UTC (rev 5047) +++ trunk/ChangeLog 2010-06-18 12:20:15 UTC (rev 5048) @@ -1,3 +1,10 @@ +2010-06-18 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/ui_utils.h, src/dialogs.c, src/plugindata.h, src/search.c, + src/plugins.c, src/ui_utils.c, plugins/geanyfunctions.h: + Add ui_combo_box_add_to_history() to API. + + 2010-06-17 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/sidebar.c:
Modified: trunk/plugins/geanyfunctions.h =================================================================== --- trunk/plugins/geanyfunctions.h 2010-06-17 22:07:53 UTC (rev 5047) +++ trunk/plugins/geanyfunctions.h 2010-06-18 12:20:15 UTC (rev 5048) @@ -272,6 +272,8 @@ geany_functions->p_ui->ui_is_keyval_enter_or_return #define ui_get_gtk_settings_integer \ geany_functions->p_ui->ui_get_gtk_settings_integer +#define ui_combo_box_add_to_history \ + geany_functions->p_ui->ui_combo_box_add_to_history #define dialogs_show_question \ geany_functions->p_dialogs->dialogs_show_question #define dialogs_show_msgbox \
Modified: trunk/src/dialogs.c =================================================================== --- trunk/src/dialogs.c 2010-06-17 22:07:53 UTC (rev 5047) +++ trunk/src/dialogs.c 2010-06-18 12:20:15 UTC (rev 5048) @@ -831,7 +831,7 @@ if (persistent) { GtkWidget *combo = (GtkWidget *) g_object_get_data(G_OBJECT(dialog), "combo"); - ui_combo_box_add_to_history(GTK_COMBO_BOX(combo), str); + ui_combo_box_add_to_history(GTK_COMBO_BOX_ENTRY(combo), str, 0); } input_cb(str); }
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2010-06-17 22:07:53 UTC (rev 5047) +++ trunk/src/plugindata.h 2010-06-18 12:20:15 UTC (rev 5048) @@ -50,7 +50,7 @@ enum { /** The Application Programming Interface (API) version, incremented * whenever any plugin data types are modified or appended to. */ - GEANY_API_VERSION = 189, + GEANY_API_VERSION = 190,
/** The Application Binary Interface (ABI) version, incremented whenever * existing fields in the plugin data types have to be changed or reordered. */ @@ -453,6 +453,8 @@ void (*ui_widget_modify_font_from_string) (GtkWidget *widget, const gchar *str); gboolean (*ui_is_keyval_enter_or_return) (guint keyval); gint (*ui_get_gtk_settings_integer) (const gchar *property_name, gint default_value); + void (*ui_combo_box_add_to_history) (GtkComboBoxEntry *combo_entry, + const gchar *text, gint history_len); } UIUtilsFuncs;
Modified: trunk/src/plugins.c =================================================================== --- trunk/src/plugins.c 2010-06-17 22:07:53 UTC (rev 5047) +++ trunk/src/plugins.c 2010-06-18 12:20:15 UTC (rev 5048) @@ -233,7 +233,8 @@ &ui_menu_add_document_items, &ui_widget_modify_font_from_string, &ui_is_keyval_enter_or_return, - &ui_get_gtk_settings_integer + &ui_get_gtk_settings_integer, + &ui_combo_box_add_to_history };
static DialogFuncs dialog_funcs = {
Modified: trunk/src/search.c =================================================================== --- trunk/src/search.c 2010-06-17 22:07:53 UTC (rev 5047) +++ trunk/src/search.c 2010-06-18 12:20:15 UTC (rev 5048) @@ -1096,7 +1096,7 @@ if (! utils_str_replace_escape(search_data.text, search_data.flags & SCFIND_REGEXP)) goto fail; } - ui_combo_box_add_to_history(GTK_COMBO_BOX(user_data), search_data.text); + ui_combo_box_add_to_history(GTK_COMBO_BOX_ENTRY(user_data), search_data.text, 0);
switch (response) { @@ -1234,10 +1234,10 @@ goto fail; }
- ui_combo_box_add_to_history(GTK_COMBO_BOX( - gtk_widget_get_parent(replace_dlg.find_entry)), find); - ui_combo_box_add_to_history(GTK_COMBO_BOX( - gtk_widget_get_parent(replace_dlg.replace_entry)), replace); + ui_combo_box_add_to_history(GTK_COMBO_BOX_ENTRY( + gtk_widget_get_parent(replace_dlg.find_entry)), find, 0); + ui_combo_box_add_to_history(GTK_COMBO_BOX_ENTRY( + gtk_widget_get_parent(replace_dlg.replace_entry)), replace, 0);
switch (response) { @@ -1377,8 +1377,8 @@
if (search_find_in_files(search_text, locale_dir, opts->str, enc)) { - ui_combo_box_add_to_history(GTK_COMBO_BOX(search_combo), search_text); - ui_combo_box_add_to_history(GTK_COMBO_BOX(dir_combo), utf8_dir); + ui_combo_box_add_to_history(GTK_COMBO_BOX_ENTRY(search_combo), search_text, 0); + ui_combo_box_add_to_history(GTK_COMBO_BOX_ENTRY(dir_combo), utf8_dir, 0); gtk_widget_hide(fif_dlg.dialog); } g_free(locale_dir);
Modified: trunk/src/ui_utils.c =================================================================== --- trunk/src/ui_utils.c 2010-06-17 22:07:53 UTC (rev 5047) +++ trunk/src/ui_utils.c 2010-06-18 12:20:15 UTC (rev 5048) @@ -1407,15 +1407,24 @@ }
-/* Prepends the active text to the drop down list, removing a duplicate element in - * the list if found. Ensures there are <= history_len elements. */ -void ui_combo_box_add_to_history(GtkComboBox *combo, const gchar *text) +/** Prepends @a text to the drop down list, removing a duplicate element in + * the list if found. Also ensures there are <= @a history_len elements. + * @param combo_entry . + * @param text Text to add, or @c NULL for current entry text. + * @param history_len Max number of items, or @c 0 for default. */ +void ui_combo_box_add_to_history(GtkComboBoxEntry *combo_entry, + const gchar *text, gint history_len) { - const gint history_len = 10; + GtkComboBox *combo = GTK_COMBO_BOX(combo_entry); GtkTreeModel *model; GtkTreeIter iter; GtkTreePath *path;
+ if (history_len <= 0) + history_len = 10; + if (!text) + text = gtk_entry_get_text(GTK_ENTRY(GTK_BIN(combo)->child)); + model = gtk_combo_box_get_model(combo);
if (tree_model_find_text(model, &iter, 0, text))
Modified: trunk/src/ui_utils.h =================================================================== --- trunk/src/ui_utils.h 2010-06-17 22:07:53 UTC (rev 5047) +++ trunk/src/ui_utils.h 2010-06-18 12:20:15 UTC (rev 5048) @@ -184,7 +184,8 @@
void ui_hbutton_box_copy_layout(GtkButtonBox *master, GtkButtonBox *copy);
-void ui_combo_box_add_to_history(GtkComboBox *combo, const gchar *text); +void ui_combo_box_add_to_history(GtkComboBoxEntry *combo_entry, + const gchar *text, gint history_len);
void ui_combo_box_prepend_text_once(GtkComboBox *combo, const gchar *text);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.