Add ui_combo_box_add_to_history() to API.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5048 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
de7e85129d
commit
c41b55d692
@ -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:
|
||||
|
@ -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 \
|
||||
|
@ -831,7 +831,7 @@ on_input_dialog_response(GtkDialog *dialog,
|
||||
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);
|
||||
}
|
||||
|
@ -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 @@ typedef struct UIUtilsFuncs
|
||||
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;
|
||||
|
||||
|
@ -233,7 +233,8 @@ static UIUtilsFuncs uiutils_funcs = {
|
||||
&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 = {
|
||||
|
14
src/search.c
14
src/search.c
@ -1096,7 +1096,7 @@ on_find_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
|
||||
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 @@ on_replace_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
|
||||
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 @@ on_find_in_files_dialog_response(GtkDialog *dialog, gint response,
|
||||
|
||||
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);
|
||||
|
@ -1407,15 +1407,24 @@ static gboolean tree_model_find_text(GtkTreeModel *model,
|
||||
}
|
||||
|
||||
|
||||
/* 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))
|
||||
|
@ -184,7 +184,8 @@ GtkWidget *ui_image_menu_item_new(const gchar *stock_id, const gchar *label);
|
||||
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user