Fix warning when using Find in Files with no documents open; make

keybinding work in this case.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4315 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2009-10-14 14:07:28 +00:00
parent d9a5d81356
commit d83416fdd1
3 changed files with 12 additions and 6 deletions

View File

@ -12,6 +12,9 @@
Fix wrong escaping (patch by dmaphy, thanks - closes #2878138).
* src/interface.c, src/ui_utils.c, geany.glade:
Move Tools configuration items to top of menu.
* src/keybindings.c, src/search.c:
Fix warning when using Find in Files with no documents open; make
keybinding work in this case.
2009-10-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -1320,6 +1320,11 @@ static gboolean cb_func_search_action(guint key_id)
GeanyDocument *doc = document_get_current();
ScintillaObject *sci;
if (key_id == GEANY_KEYS_SEARCH_FINDINFILES)
{
on_find_in_files1_activate(NULL, NULL); /* works without docs too */
return TRUE;
}
if (!doc)
return TRUE;
sci = doc->editor->sci;
@ -1338,8 +1343,6 @@ static gboolean cb_func_search_action(guint key_id)
on_find_nextsel1_activate(NULL, NULL); break;
case GEANY_KEYS_SEARCH_REPLACE:
on_replace1_activate(NULL, NULL); break;
case GEANY_KEYS_SEARCH_FINDINFILES:
on_find_in_files1_activate(NULL, NULL); break;
case GEANY_KEYS_SEARCH_NEXTMESSAGE:
on_next_message1_activate(NULL, NULL); break;
case GEANY_KEYS_SEARCH_PREVIOUSMESSAGE:

View File

@ -846,7 +846,6 @@ void search_show_find_in_files_dialog(const gchar *dir)
{
GtkWidget *entry; /* for child GtkEntry of a GtkComboBoxEntry */
GeanyDocument *doc = document_get_current();
GeanyEditor *editor = doc ? doc->editor : NULL;
gchar *sel = NULL;
gchar *cur_dir = NULL;
GeanyEncodingIndex enc_idx = GEANY_ENCODING_UTF_8;
@ -855,13 +854,14 @@ void search_show_find_in_files_dialog(const gchar *dir)
{
create_fif_dialog();
gtk_widget_show_all(fif_dlg.dialog);
sel = editor_get_default_selection(editor, search_prefs.use_current_word, NULL);
if (doc)
sel = editor_get_default_selection(doc->editor, search_prefs.use_current_word, NULL);
}
stash_group_display(fif_prefs, fif_dlg.dialog);
/* only set selection if the dialog is not already visible, or has just been created */
if (! sel && ! GTK_WIDGET_VISIBLE(fif_dlg.dialog))
sel = editor_get_default_selection(editor, search_prefs.use_current_word, NULL);
if (doc && ! sel && ! GTK_WIDGET_VISIBLE(fif_dlg.dialog))
sel = editor_get_default_selection(doc->editor, search_prefs.use_current_word, NULL);
entry = GTK_BIN(fif_dlg.search_combo)->child;
if (sel)