[devhelp/wip/swilmet/various-code-improvements] sidebar: always send link-selected signal
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/wip/swilmet/various-code-improvements] sidebar: always send link-selected signal
- Date: Sat, 10 Oct 2015 10:32:18 +0000 (UTC)
commit 9adaba893f0040003f23a836dc7ba95a694ea90d
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Oct 10 12:14:11 2015 +0200
sidebar: always send link-selected signal
Storing the selected_link is not needed. In every case where the
link-selected signal is sent, it is better to send it regardless of
whether the previous signal emission provided the same link. By
re-sending the signal with the same link, the page scrolls at the right
location (if the user has scrolled within the page).
src/dh-sidebar.c | 23 ++++++-----------------
1 files changed, 6 insertions(+), 17 deletions(-)
---
diff --git a/src/dh-sidebar.c b/src/dh-sidebar.c
index 79d0c80..be16855 100644
--- a/src/dh-sidebar.c
+++ b/src/dh-sidebar.c
@@ -5,6 +5,7 @@
* Copyright (C) 2005-2008 Imendio AB
* Copyright (C) 2010 Lanedo GmbH
* Copyright (C) 2013 Aleksander Morgado <aleksander gnu org>
+ * Copyright (C) 2015 Sébastien Wilmet <swilmet gnome org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -32,8 +33,6 @@
typedef struct {
DhBookManager *book_manager;
- DhLink *selected_link;
-
DhBookTree *book_tree;
GtkScrolledWindow *sw_book_tree;
@@ -185,10 +184,7 @@ sidebar_hitlist_selection_changed_cb (GtkTreeSelection *selection,
DH_KEYWORD_MODEL_COL_LINK, &link,
-1);
- if (link != priv->selected_link) {
- priv->selected_link = link;
- g_signal_emit (sidebar, signals[LINK_SELECTED], 0, link);
- }
+ g_signal_emit (sidebar, signals[LINK_SELECTED], 0, link);
}
}
@@ -218,8 +214,6 @@ sidebar_hitlist_button_press_cb (GtkTreeView *hitlist_view,
DH_KEYWORD_MODEL_COL_LINK, &link,
-1);
- priv->selected_link = link;
-
g_signal_emit (sidebar, signals[LINK_SELECTED], 0, link);
/* Always propagate the event so the tree view can update
@@ -405,16 +399,11 @@ hitlist_cell_data_func (GtkTreeViewColumn *tree_column,
/******************************************************************************/
static void
-sidebar_book_tree_link_selected_cb (GObject *ignored,
- DhLink *link,
- DhSidebar *sidebar)
+sidebar_book_tree_link_selected_cb (DhBookTree *book_tree,
+ DhLink *link,
+ DhSidebar *sidebar)
{
- DhSidebarPrivate *priv = dh_sidebar_get_instance_private (sidebar);
-
- if (link != priv->selected_link) {
- priv->selected_link = link;
- g_signal_emit (sidebar, signals[LINK_SELECTED], 0, link);
- }
+ g_signal_emit (sidebar, signals[LINK_SELECTED], 0, link);
}
DhLink *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]