Add the project's base_path to the directory list in the Find in Files dialog if a project is open.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3236 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2008-11-16 17:53:33 +00:00
parent 631da007a4
commit 0bfd8eb893
2 changed files with 13 additions and 0 deletions

View File

@ -5,6 +5,8 @@
* src/search.c: * src/search.c:
Capture command's stderr and log it into the Debug messages window Capture command's stderr and log it into the Debug messages window
when a Find in Files search fails. 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.
2008-11-15 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> 2008-11-15 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -39,6 +39,7 @@
#include "ui_utils.h" #include "ui_utils.h"
#include "editor.h" #include "editor.h"
#include "encodings.h" #include "encodings.h"
#include "project.h"
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
@ -743,6 +744,7 @@ void search_show_find_in_files_dialog(const gchar *dir)
gchar *sel = NULL; gchar *sel = NULL;
gchar *cur_dir = NULL; gchar *cur_dir = NULL;
GeanyEncodingIndex enc_idx = GEANY_ENCODING_UTF_8; GeanyEncodingIndex enc_idx = GEANY_ENCODING_UTF_8;
static gboolean project_basepath_added = FALSE;
if (widgets.find_in_files_dialog == NULL) if (widgets.find_in_files_dialog == NULL)
{ {
@ -758,6 +760,15 @@ void search_show_find_in_files_dialog(const gchar *dir)
gtk_entry_set_text(GTK_ENTRY(entry), sel); gtk_entry_set_text(GTK_ENTRY(entry), sel);
g_free(sel); g_free(sel);
/* 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)
{
gtk_combo_box_prepend_text(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; entry = GTK_BIN(find_in_files.dir_combo)->child;
if (NZV(dir)) if (NZV(dir))
cur_dir = g_strdup(dir); /* custom directory argument passed */ cur_dir = g_strdup(dir); /* custom directory argument passed */