SF.net SVN: geany: [1692] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Jul 11 17:44:44 UTC 2007


Revision: 1692
          http://svn.sourceforge.net/geany/?rev=1692&view=rev
Author:   eht16
Date:     2007-07-11 10:44:43 -0700 (Wed, 11 Jul 2007)

Log Message:
-----------
Also change background colour of search bar when using find next/previous after using the search bar.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/search.c
    trunk/src/search.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-07-11 17:05:13 UTC (rev 1691)
+++ trunk/ChangeLog	2007-07-11 17:44:43 UTC (rev 1692)
@@ -6,6 +6,9 @@
    compilers than gcc.
  * src/document.c, src/editor.c, src/sciwrappers.c, src/sciwrappers.h:
    Experimental change of scrolling to get horizontal scrolling working.
+ * src/callbacks.c, src/search.c, src/search.h:
+   Also change background colour of search bar when using find
+   next/previous after using the search bar.
 
 
 2007-07-11  Nick Treleaven  <nick.treleaven at btinternet.com>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2007-07-11 17:05:13 UTC (rev 1691)
+++ trunk/src/callbacks.c	2007-07-11 17:44:43 UTC (rev 1692)
@@ -573,7 +573,7 @@
 	static gboolean old_value = TRUE;
 
 	// only update if really needed
-	if (old_value != success)
+	if (search_data.search_bar && old_value != success)
 	{
 		gtk_widget_modify_base(widget, GTK_STATE_NORMAL, success ? NULL : &red);
 		gtk_widget_modify_text(widget, GTK_STATE_NORMAL, success ? NULL : &white);
@@ -590,6 +590,7 @@
 	search_data.text = gtk_editable_get_chars(editable, 0, -1);
 	search_data.flags = 0;
 	search_data.backwards = FALSE;
+	search_data.search_bar = TRUE;
 }
 
 
@@ -1351,8 +1352,10 @@
 
 	if (search_data.text)
 	{
-		document_find_text(idx, search_data.text, search_data.flags,
+		gint result = document_find_text(idx, search_data.text, search_data.flags,
 			search_data.backwards, TRUE, NULL);
+		// app->sensitive_buttons[3] points to the entry widget within the toolbar
+		set_search_bar_background(app->sensitive_buttons[3], (result > -1) ? TRUE : FALSE);
 	}
 }
 
@@ -1369,8 +1372,9 @@
 		utils_beep(); //Can't reverse search order for a regex (find next ignores search backwards)
 	else
 	{
-		document_find_text(idx, search_data.text, search_data.flags,
+		gint result = document_find_text(idx, search_data.text, search_data.flags,
 			!search_data.backwards, TRUE, NULL);
+		set_search_bar_background(app->sensitive_buttons[3], (result > -1) ? TRUE : FALSE);
 	}
 }
 

Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c	2007-07-11 17:05:13 UTC (rev 1691)
+++ trunk/src/search.c	2007-07-11 17:44:43 UTC (rev 1692)
@@ -234,6 +234,7 @@
 	search_data.text = g_strdup(text);
 	search_data.flags = 0;
 	search_data.backwards = FALSE;
+	search_data.search_bar = FALSE;
 }
 
 
@@ -824,6 +825,7 @@
 		search_replace_escape = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
 						lookup_widget(GTK_WIDGET(widgets.find_dialog), "check_escape")));
 		search_data.backwards = FALSE;
+		search_data.search_bar = FALSE;
 
 		if (! DOC_IDX_VALID(idx)) return;
 

Modified: trunk/src/search.h
===================================================================
--- trunk/src/search.h	2007-07-11 17:05:13 UTC (rev 1691)
+++ trunk/src/search.h	2007-07-11 17:44:43 UTC (rev 1692)
@@ -25,12 +25,15 @@
 #ifndef GEANY_SEARCH_H
 #define GEANY_SEARCH_H 1
 
-// the flags given in the search dialog for "find next"
+// the flags given in the search dialog for "find next", also used by the search bar
 typedef struct
 {
 	gchar		*text;
 	gint		flags;
 	gboolean	backwards;
+	// set to TRUE when text was set by a search bar callback to keep track of
+	// search bar background colour
+	gboolean	search_bar;
 } GeanySearchData;
 
 extern GeanySearchData search_data;


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