[evince] shell: Use selection to populate find bar if available.



commit b6390b35b30ed273885ce6ead6f32ef496dce0ac
Author: José Aliste <jose aliste gmail com>
Date:   Wed Mar 28 22:59:56 2018 -0300

    shell: Use selection to populate find bar if available.
    
    When a selection is made, if user clicks on the Search icon or hits
    Ctrl+F, the search bar will be shown with the selection copied to the
    search bar entry. This immitates what Gedit does when the Find action
    is activated and there is a selection
    
    Based on a patch by William Hawkins <hawkinsw borlaugic com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=794538

 shell/ev-window.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 5a627df..adc7fca 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -3905,8 +3905,19 @@ ev_window_cmd_find (GSimpleAction *action,
                    GVariant      *parameter,
                    gpointer       user_data)
 {
+       EvView *view;
+       gchar *selected_text = NULL;
        EvWindow *ev_window = user_data;
 
+       view = EV_VIEW (ev_window->priv->view);
+        selected_text = ev_view_get_selected_text (view);
+
+        if (selected_text != NULL) {
+               GtkSearchEntry *entry = ev_search_box_get_entry (EV_SEARCH_BOX (ev_window->priv->search_box));
+               gtk_entry_set_text (GTK_ENTRY (entry), selected_text);
+               g_free (selected_text);
+       }
+
        ev_window_show_find_bar (ev_window, TRUE);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]