SF.net SVN: geany:[4315] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Oct 14 14:07:28 UTC 2009


Revision: 4315
          http://geany.svn.sourceforge.net/geany/?rev=4315&view=rev
Author:   ntrel
Date:     2009-10-14 14:07:28 +0000 (Wed, 14 Oct 2009)

Log Message:
-----------
Fix warning when using Find in Files with no documents open; make
keybinding work in this case.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/keybindings.c
    trunk/src/search.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-10-14 13:51:43 UTC (rev 4314)
+++ trunk/ChangeLog	2009-10-14 14:07:28 UTC (rev 4315)
@@ -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>

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2009-10-14 13:51:43 UTC (rev 4314)
+++ trunk/src/keybindings.c	2009-10-14 14:07:28 UTC (rev 4315)
@@ -1320,6 +1320,11 @@
 	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 @@
 			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:

Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c	2009-10-14 13:51:43 UTC (rev 4314)
+++ trunk/src/search.c	2009-10-14 14:07:28 UTC (rev 4315)
@@ -846,7 +846,6 @@
 {
 	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 @@
 	{
 		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)


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