[evince] ev-view-accessible: Fix ev_view_accesssible_get_n_selections



commit 3a9d0812e430ef0523c2719ed5ca22ea06324539
Author: Antia Puentes <apuentes igalia com>
Date:   Wed Jul 17 16:04:06 2013 +0200

    ev-view-accessible: Fix ev_view_accesssible_get_n_selections
    
    Return 1 when there's selected text since evince only supports one
    selection, and 0 if there isn't selected text.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704396

 libview/ev-view-accessible.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)
---
diff --git a/libview/ev-view-accessible.c b/libview/ev-view-accessible.c
index e31d70d..45f725e 100644
--- a/libview/ev-view-accessible.c
+++ b/libview/ev-view-accessible.c
@@ -612,27 +612,18 @@ static gint
 ev_view_accessible_get_n_selections (AtkText *text)
 {
        GtkWidget *widget;
-       GtkTextBuffer *buffer;
-       GtkTextIter start, end;
-       gint select_start, select_end;
+       EvView *view;
 
        widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
        if (widget == NULL)
                /* State is defunct */
                return -1;
 
-       buffer = ev_view_accessible_get_text_buffer (EV_VIEW_ACCESSIBLE (text), EV_VIEW (widget));
-       if (!buffer)
-               return -1;
-
-       gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
-       select_start = gtk_text_iter_get_offset (&start);
-       select_end = gtk_text_iter_get_offset (&end);
-
-       if (select_start != select_end)
-               return 1;
-       else
+       view = EV_VIEW (widget);
+       if (!EV_IS_SELECTION (view->document) || !view->selection_info.selections)
                return 0;
+
+       return 1;
 }
 
 static gchar *


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