diff options
author | Antia Puentes <[email protected]> | 2013-07-17 16:04:06 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-09-06 18:25:34 +0200 |
commit | f8bc3fa4d54088c418d776e6b48f268d0398c57d (patch) | |
tree | 4ca9843d59f60e105da8511ccc02e6012be87d2b | |
parent | daae8271e55004b16c01fee5e9b2940e246ce2dc (diff) | |
download | atril-f8bc3fa4d54088c418d776e6b48f268d0398c57d.tar.bz2 atril-f8bc3fa4d54088c418d776e6b48f268d0398c57d.tar.xz |
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
origin commit:
https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=3a9d081
-rw-r--r-- | 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 5a9ba432..81fcc797 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 * |