Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorJustin Blanchard <justinb04@aim.com>2007-08-27 21:36:20 (GMT)
committer Nickolay V. Shmyrev <nshmyrev@src.gnome.org>2007-08-27 21:36:20 (GMT)
commit39c51b63804387f5f7c0f3fce193da9eb9998774 (patch)
treec329fe198913ed35a624e69f816bb21762f18b25 /shell
parent3353ab8a090233f5e0b9f316fc35c9e48d58aed0 (diff)
Enables 'find next' when bindbar is hidden. Fixes bug #323817.
2007-08-28 Justin Blanchard <justinb04@aim.com> * shell/ev-view-private.h: * shell/ev-view.c: (ev_view_expose_event), (ev_view_init), (ev_view_set_highlight_search): * shell/ev-view.h: * shell/ev-window.c: (ev_window_cmd_edit_find_next), (ev_window_cmd_edit_find_previous), (find_bar_search_changed_cb), (find_bar_visibility_changed_cb): Enables 'find next' when bindbar is hidden. Fixes bug #323817. svn path=/trunk/; revision=2645
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-view-private.h1
-rw-r--r--shell/ev-view.c9
-rw-r--r--shell/ev-view.h13
-rw-r--r--shell/ev-window.c36
4 files changed, 43 insertions, 16 deletions
diff --git a/shell/ev-view-private.h b/shell/ev-view-private.h
index feed78a..d1edfa6 100644
--- a/shell/ev-view-private.h
+++ b/shell/ev-view-private.h
@@ -81,6 +81,7 @@ struct _EvView {
char *find_status;
int find_result;
gboolean jump_to_find_result;
+ gboolean highlight_find_results;
EvPageCache *page_cache;
EvPixbufCache *pixbuf_cache;
diff --git a/shell/ev-view.c b/shell/ev-view.c
index 4fda98c..b3bd531 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -2494,7 +2494,7 @@ ev_view_expose_event (GtkWidget *widget,
draw_one_page (view, i, cr, &page_area, &border, &(event->area), &page_ready);
- if (page_ready && EV_IS_DOCUMENT_FIND (view->document))
+ if (page_ready && EV_IS_DOCUMENT_FIND (view->document) && view->highlight_find_results)
highlight_find_results (view, i);
}
@@ -3996,6 +3996,7 @@ ev_view_init (EvView *view)
view->sizing_mode = EV_SIZING_FIT_WIDTH;
view->pending_scroll = SCROLL_TO_KEEP_POSITION;
view->jump_to_find_result = TRUE;
+ view->highlight_find_results = FALSE;
gtk_layout_set_hadjustment (GTK_LAYOUT (view), NULL);
gtk_layout_set_vadjustment (GTK_LAYOUT (view), NULL);
@@ -4997,6 +4998,12 @@ void ev_view_search_changed (EvView *view)
view->jump_to_find_result = TRUE;
}
+void ev_view_set_highlight_search (EvView *view, gboolean value)
+{
+ view->highlight_find_results = value;
+ gtk_widget_queue_draw (GTK_WIDGET (view));
+}
+
/*** Selections ***/
/* compute_new_selection_rect/text calculates the area currently selected by
diff --git a/shell/ev-view.h b/shell/ev-view.h
index 698b7b2..667b2ee 100644
--- a/shell/ev-view.h
+++ b/shell/ev-view.h
@@ -118,12 +118,13 @@ void ev_view_set_rotation (EvView *view,
int ev_view_get_rotation (EvView *view);
/* Find */
-gboolean ev_view_can_find_next (EvView *view);
-void ev_view_find_next (EvView *view);
-gboolean ev_view_can_find_previous (EvView *view);
-void ev_view_find_previous (EvView *view);
-void ev_view_search_changed (EvView *view);
-
+gboolean ev_view_can_find_next (EvView *view);
+void ev_view_find_next (EvView *view);
+gboolean ev_view_can_find_previous (EvView *view);
+void ev_view_find_previous (EvView *view);
+void ev_view_search_changed (EvView *view);
+void ev_view_set_highlight_search (EvView *view,
+ gboolean value);
/* Status */
const char *ev_view_get_status (EvView *view);
const char *ev_view_get_find_status (EvView *view);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 32d52fd..9081b85 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -2789,6 +2789,8 @@ ev_window_cmd_edit_find_next (GtkAction *action, EvWindow *ev_window)
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
+ update_chrome_flag (ev_window, EV_CHROME_FINDBAR, TRUE);
+ gtk_widget_grab_focus (ev_window->priv->find_bar);
ev_view_find_next (EV_VIEW (ev_window->priv->view));
}
@@ -2797,6 +2799,8 @@ ev_window_cmd_edit_find_previous (GtkAction *action, EvWindow *ev_window)
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
+ update_chrome_flag (ev_window, EV_CHROME_FINDBAR, TRUE);
+ gtk_widget_grab_focus (ev_window->priv->find_bar);
ev_view_find_previous (EV_VIEW (ev_window->priv->view));
}
@@ -4019,24 +4023,18 @@ find_bar_search_changed_cb (EggFindBar *find_bar,
EvWindow *ev_window)
{
gboolean case_sensitive;
- gboolean visible;
const char *search_string;
- /* Either the string or case sensitivity could have changed,
- * we connect this callback to both. We also connect it
- * to ::visible so when the find bar is hidden, we should
- * pretend the search string is NULL/""
- */
+ /* Either the string or case sensitivity could have changed. */
case_sensitive = egg_find_bar_get_case_sensitive (find_bar);
- visible = GTK_WIDGET_VISIBLE (find_bar);
search_string = egg_find_bar_get_search_string (find_bar);
ev_view_search_changed (EV_VIEW(ev_window->priv->view));
if (ev_window->priv->document &&
EV_IS_DOCUMENT_FIND (ev_window->priv->document)) {
- if (visible && search_string && search_string[0]) {
+ if (search_string && search_string[0]) {
ev_document_doc_mutex_lock ();
ev_document_find_begin (EV_DOCUMENT_FIND (ev_window->priv->document),
ev_page_cache_get_current_page (ev_window->priv->page_cache),
@@ -4057,6 +4055,26 @@ find_bar_search_changed_cb (EggFindBar *find_bar,
}
static void
+find_bar_visibility_changed_cb (EggFindBar *find_bar,
+ GParamSpec *param,
+ EvWindow *ev_window)
+{
+ gboolean visible;
+
+ visible = GTK_WIDGET_VISIBLE (find_bar);
+
+ if (ev_window->priv->document &&
+ EV_IS_DOCUMENT_FIND (ev_window->priv->document)) {
+ ev_view_set_highlight_search (EV_VIEW(ev_window->priv->view), visible);
+ ev_view_search_changed (EV_VIEW(ev_window->priv->view));
+ ev_window_update_actions (ev_window);
+
+ if (!visible)
+ egg_find_bar_set_status_text (EGG_FIND_BAR (ev_window->priv->find_bar), NULL);
+ }
+}
+
+static void
find_bar_scroll(EggFindBar *find_bar, GtkScrollType scroll, EvWindow* ev_window)
{
ev_view_scroll(EV_VIEW(ev_window->priv->view), scroll, FALSE);
@@ -5419,7 +5437,7 @@ ev_window_init (EvWindow *ev_window)
ev_window);
g_signal_connect (ev_window->priv->find_bar,
"notify::visible",
- G_CALLBACK (find_bar_search_changed_cb),
+ G_CALLBACK (find_bar_visibility_changed_cb),
ev_window);
g_signal_connect (ev_window->priv->find_bar,
"scroll",