[evince] shell: Check "page-changed" in EvSidebarBookmarks
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] shell: Check "page-changed" in EvSidebarBookmarks
- Date: Mon, 22 Jun 2020 07:31:58 +0000 (UTC)
commit de3ac477178936758922cca1df3386d8f8ce234b
Author: Casey Jao <casey jao gmail com>
Date: Sun May 24 22:03:56 2020 -0400
shell: Check "page-changed" in EvSidebarBookmarks
Currently, a second click of a previously selected bookmark always
begins renaming the bookmark, even after one has navigated away from
the bookmark. The listener unselects the bookmark as soon as one moves
to a different page, allowing one to easily jump back to the bookmark.
Fixes #623.
shell/ev-sidebar-bookmarks.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
diff --git a/shell/ev-sidebar-bookmarks.c b/shell/ev-sidebar-bookmarks.c
index 9aac3262..e5b90146 100644
--- a/shell/ev-sidebar-bookmarks.c
+++ b/shell/ev-sidebar-bookmarks.c
@@ -57,6 +57,9 @@ struct _EvSidebarBookmarksPrivate {
static void ev_sidebar_bookmarks_page_iface_init (EvSidebarPageInterface *iface);
static void ev_sidebar_bookmarks_selection_changed (GtkTreeSelection *selection,
EvSidebarBookmarks *sidebar_bookmarks);
+static void ev_sidebar_bookmarks_page_changed (EvSidebarBookmarks *sidebar_bookmarks,
+ gint old_page,
+ gint new_page);
G_DEFINE_TYPE_EXTENDED (EvSidebarBookmarks,
ev_sidebar_bookmarks,
@@ -230,6 +233,21 @@ ev_sidebar_bookmarks_selection_changed (GtkTreeSelection *selection,
}
}
+static void ev_sidebar_bookmarks_page_changed (EvSidebarBookmarks *sidebar_bookmarks,
+ gint old_page,
+ gint new_page)
+{
+ EvSidebarBookmarksPrivate *priv = sidebar_bookmarks->priv;
+ GtkTreeSelection *selection;
+ gint selected_page;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view));
+ selected_page = ev_sidebar_bookmarks_get_selected_page (sidebar_bookmarks, selection);
+
+ if (selected_page != new_page)
+ gtk_tree_selection_unselect_all (selection);
+}
+
static void
ev_sidebar_bookmarks_del_clicked (GtkWidget *button,
EvSidebarBookmarks *sidebar_bookmarks)
@@ -581,6 +599,9 @@ ev_sidebar_bookmarks_set_model (EvSidebarPage *sidebar_page,
if (priv->model)
g_object_unref (priv->model);
priv->model = g_object_ref (model);
+ g_signal_connect_swapped (model, "page-changed",
+ G_CALLBACK (ev_sidebar_bookmarks_page_changed),
+ sidebar_page);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]