[Xfce4-commits] r26447 - in mousepad/branches/nick_0_3: . mousepad
Nick Schermer
nick at xfce.org
Fri Dec 7 20:42:24 CET 2007
Author: nick
Date: 2007-12-07 19:42:23 +0000 (Fri, 07 Dec 2007)
New Revision: 26447
Modified:
mousepad/branches/nick_0_3/ChangeLog
mousepad/branches/nick_0_3/mousepad/mousepad-search-bar.c
Log:
* mousepad/mousepad-search-bar.c: Fix red entry when toggling the
highlight button.
Modified: mousepad/branches/nick_0_3/ChangeLog
===================================================================
--- mousepad/branches/nick_0_3/ChangeLog 2007-12-07 11:56:21 UTC (rev 26446)
+++ mousepad/branches/nick_0_3/ChangeLog 2007-12-07 19:42:23 UTC (rev 26447)
@@ -1,5 +1,11 @@
-2007-xx-xx Nick Schermer <nick at xfce.org>
+2007-12-07 Nick Schermer <nick at xfce.org>
+ * mousepad/mousepad-search-bar.c: Fix red entry when toggling the
+ highlight button.
+
+
+2007-12-06 Nick Schermer <nick at xfce.org>
+
* mousepad/mousepad-document.c: Fix column number in statusbar.
First column is 0 and not 1.
* mousepad/mousepad-dialogs.c: Improve the go to dialog. You can now
Modified: mousepad/branches/nick_0_3/mousepad/mousepad-search-bar.c
===================================================================
--- mousepad/branches/nick_0_3/mousepad/mousepad-search-bar.c 2007-12-07 11:56:21 UTC (rev 26446)
+++ mousepad/branches/nick_0_3/mousepad/mousepad-search-bar.c 2007-12-07 19:42:23 UTC (rev 26447)
@@ -322,12 +322,16 @@
/* emit signal */
g_signal_emit (G_OBJECT (bar), search_bar_signals[SEARCH], 0, flags, string, NULL, &nmatches);
- /* make sure the search entry is not red when no text was typed */
- if (string == NULL || *string == '\0')
- nmatches = 1;
+ /* do nothing with the error entry when highlight when trigged with highlight */
+ if ((flags & MOUSEPAD_SEARCH_FLAGS_ACTION_HIGHTLIGHT) == 0)
+ {
+ /* make sure the search entry is not red when no text was typed */
+ if (string == NULL || *string == '\0')
+ nmatches = 1;
- /* change the entry style */
- mousepad_util_entry_error (bar->entry, nmatches < 1);
+ /* change the entry style */
+ mousepad_util_entry_error (bar->entry, nmatches < 1);
+ }
}
@@ -357,8 +361,7 @@
mousepad_search_bar_find_string (bar, flags);
/* schedule a new highlight */
- if (bar->highlight_all)
- mousepad_search_bar_highlight_schedule (bar);
+ mousepad_search_bar_highlight_schedule (bar);
}
@@ -367,13 +370,31 @@
mousepad_search_bar_highlight_toggled (GtkWidget *button,
MousepadSearchBar *bar)
{
+ MousepadSearchFlags flags;
+
_mousepad_return_if_fail (MOUSEPAD_IS_SEARCH_BAR (bar));
/* set the new state */
bar->highlight_all = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (button));
- /* reschedule the highlight */
- mousepad_search_bar_highlight_schedule (bar);
+ if (bar->highlight_all)
+ {
+ /* reschedule the highlight */
+ mousepad_search_bar_highlight_schedule (bar);
+ }
+ else
+ {
+ /* stop timeout */
+ if (bar->highlight_id != 0)
+ g_source_remove (bar->highlight_id);
+
+ /* set search flags */
+ flags = MOUSEPAD_SEARCH_FLAGS_ACTION_HIGHTLIGHT
+ | MOUSEPAD_SEARCH_FLAGS_ACTION_CLEANUP;
+
+ /* emit signal to cleanup the highlight */
+ mousepad_search_bar_find_string (bar, flags);
+ }
}
@@ -402,8 +423,7 @@
mousepad_search_bar_entry_changed (NULL, bar);
/* schedule a new hightlight */
- if (bar->highlight_all)
- mousepad_search_bar_highlight_schedule (bar);
+ mousepad_search_bar_highlight_schedule (bar);
}
@@ -434,8 +454,11 @@
g_source_remove (bar->highlight_id);
/* schedule a new timeout */
- bar->highlight_id = g_timeout_add_full (G_PRIORITY_LOW, HIGHTLIGHT_TIMEOUT, mousepad_search_bar_highlight_timeout,
- bar, mousepad_search_bar_highlight_timeout_destroy);
+ if (bar->highlight_all)
+ {
+ bar->highlight_id = g_timeout_add_full (G_PRIORITY_LOW, HIGHTLIGHT_TIMEOUT, mousepad_search_bar_highlight_timeout,
+ bar, mousepad_search_bar_highlight_timeout_destroy);
+ }
}
@@ -461,11 +484,7 @@
| MOUSEPAD_SEARCH_FLAGS_ITER_AREA_START
| MOUSEPAD_SEARCH_FLAGS_ACTION_HIGHTLIGHT;
- /* only clear when there is no text */
- if (!bar->highlight_all)
- flags |= MOUSEPAD_SEARCH_FLAGS_ACTION_CLEANUP;
-
- /* hightlight */
+ /* emit signal */
mousepad_search_bar_find_string (bar, flags);
GDK_THREADS_LEAVE ();
@@ -496,8 +515,7 @@
gtk_widget_grab_focus (bar->entry);
/* update the highlight */
- if (bar->highlight_all)
- mousepad_search_bar_highlight_schedule (bar);
+ mousepad_search_bar_highlight_schedule (bar);
}
More information about the Xfce4-commits
mailing list