Add and use ui_combo_box_prepend_text_once() to add project's base_path to the Find in Files dialog even if another project was opened.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3237 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
0bfd8eb893
commit
9975737eff
@ -7,6 +7,10 @@
|
||||
when a Find in Files search fails.
|
||||
Add the project's base_path to the directory list in the Find in
|
||||
Files dialog if a project is open.
|
||||
* src/search.c, src/ui_utils.c, src/ui_utils.h:
|
||||
Add and use ui_combo_box_prepend_text_once() to add project's
|
||||
base_path to the Find in Files dialog even if another project was
|
||||
opened.
|
||||
|
||||
|
||||
2008-11-15 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
@ -744,7 +744,6 @@ void search_show_find_in_files_dialog(const gchar *dir)
|
||||
gchar *sel = NULL;
|
||||
gchar *cur_dir = NULL;
|
||||
GeanyEncodingIndex enc_idx = GEANY_ENCODING_UTF_8;
|
||||
static gboolean project_basepath_added = FALSE;
|
||||
|
||||
if (widgets.find_in_files_dialog == NULL)
|
||||
{
|
||||
@ -762,11 +761,10 @@ void search_show_find_in_files_dialog(const gchar *dir)
|
||||
|
||||
/* add project's base path directory to the dir list, we do this here once
|
||||
* (in create_fif_dialog() it would fail if a project is opened after dialog creation) */
|
||||
if (app->project != NULL && NZV(app->project->base_path) && ! project_basepath_added)
|
||||
if (app->project != NULL && NZV(app->project->base_path))
|
||||
{
|
||||
gtk_combo_box_prepend_text(GTK_COMBO_BOX(find_in_files.dir_combo),
|
||||
ui_combo_box_prepend_text_once(GTK_COMBO_BOX(find_in_files.dir_combo),
|
||||
app->project->base_path);
|
||||
project_basepath_added = TRUE;
|
||||
}
|
||||
|
||||
entry = GTK_BIN(find_in_files.dir_combo)->child;
|
||||
|
@ -1259,6 +1259,33 @@ void ui_combo_box_add_to_history(GtkComboBox *combo, const gchar *text)
|
||||
}
|
||||
|
||||
|
||||
/* Same as gtk_combo_box_prepend_text(), except that text is only prepended if it not already
|
||||
* exists in the combo's model. */
|
||||
void ui_combo_box_prepend_text_once(GtkComboBox *combo, const gchar *text)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
gchar *combo_text;
|
||||
gboolean found = FALSE;
|
||||
|
||||
model = gtk_combo_box_get_model(combo);
|
||||
if (gtk_tree_model_get_iter_first(model, &iter))
|
||||
{
|
||||
do
|
||||
{
|
||||
gtk_tree_model_get(model, &iter, 0, &combo_text, -1);
|
||||
found = utils_str_equal(combo_text, text);
|
||||
g_free(combo_text);
|
||||
}
|
||||
while (!found && gtk_tree_model_iter_next(model, &iter));
|
||||
}
|
||||
if (found)
|
||||
return; /* don't prepend duplicate */
|
||||
|
||||
gtk_combo_box_prepend_text(combo, text);
|
||||
}
|
||||
|
||||
|
||||
/* Changes the color of the notebook tab text and open files items according to
|
||||
* document status. */
|
||||
void ui_update_tab_status(GeanyDocument *doc)
|
||||
|
@ -154,6 +154,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_prepend_text_once(GtkComboBox *combo, const gchar *text);
|
||||
|
||||
GtkWidget *ui_path_box_new(const gchar *title, GtkFileChooserAction action, GtkEntry *entry);
|
||||
|
||||
void ui_setup_open_button_callback(GtkWidget *open_btn, const gchar *title,
|
||||
|
Loading…
x
Reference in New Issue
Block a user