SF.net SVN: geany:[3237] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Nov 16 17:53:55 UTC 2008
Revision: 3237
http://geany.svn.sourceforge.net/geany/?rev=3237&view=rev
Author: eht16
Date: 2008-11-16 17:53:55 +0000 (Sun, 16 Nov 2008)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/search.c
trunk/src/ui_utils.c
trunk/src/ui_utils.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-11-16 17:53:33 UTC (rev 3236)
+++ trunk/ChangeLog 2008-11-16 17:53:55 UTC (rev 3237)
@@ -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>
Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c 2008-11-16 17:53:33 UTC (rev 3236)
+++ trunk/src/search.c 2008-11-16 17:53:55 UTC (rev 3237)
@@ -744,7 +744,6 @@
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 @@
/* 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;
Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c 2008-11-16 17:53:33 UTC (rev 3236)
+++ trunk/src/ui_utils.c 2008-11-16 17:53:55 UTC (rev 3237)
@@ -1259,6 +1259,33 @@
}
+/* 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)
Modified: trunk/src/ui_utils.h
===================================================================
--- trunk/src/ui_utils.h 2008-11-16 17:53:33 UTC (rev 3236)
+++ trunk/src/ui_utils.h 2008-11-16 17:53:55 UTC (rev 3237)
@@ -154,6 +154,8 @@
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,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list