[ekiga/ds-gtk-application] Main Window: Reselect when the view is mapped on the screen.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/ds-gtk-application] Main Window: Reselect when the view is mapped on the screen.
- Date: Mon, 8 Dec 2014 17:00:42 +0000 (UTC)
commit 578f56df17eaa589482e9623470209c920c65625
Author: Damien Sandras <dsandras seconix com>
Date: Mon Dec 8 17:59:03 2014 +0100
Main Window: Reselect when the view is mapped on the screen.
This makes the former selection active again, and resets the Actions.
.../gui/gtk-frontend/call-history-view-gtk.cpp | 15 ++++++++++++
lib/engine/gui/gtk-frontend/roster-view-gtk.cpp | 25 +++++++++++++++++++-
2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp
b/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp
index 575cde7..ecea07e 100644
--- a/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp
+++ b/lib/engine/gui/gtk-frontend/call-history-view-gtk.cpp
@@ -213,6 +213,19 @@ on_selection_changed (G_GNUC_UNUSED GtkTreeSelection* selection,
g_signal_emit (self, signals[ACTIONS_CHANGED_SIGNAL], 0, NULL);
}
+static void
+on_map_cb (G_GNUC_UNUSED GtkWidget *widget,
+ gpointer data)
+{
+ GtkTreeSelection *selection = NULL;
+
+ g_return_if_fail (IS_CALL_HISTORY_VIEW_GTK (data));
+ CallHistoryViewGtk *self = CALL_HISTORY_VIEW_GTK (data);
+
+ selection = gtk_tree_view_get_selection (self->priv->tree);
+ on_selection_changed (selection, self);
+}
+
/* GObject stuff */
static void
@@ -320,6 +333,8 @@ call_history_view_gtk_new (boost::shared_ptr<History::Book> book,
G_CALLBACK (on_selection_changed), self);
g_signal_connect (self->priv->tree, "event-after",
G_CALLBACK (on_clicked), self);
+ g_signal_connect (GTK_WIDGET (self), "map",
+ G_CALLBACK (on_map_cb), self);
/* connect to the signal */
self->priv->connection = book->updated.connect (boost::bind (&on_book_updated, self));
diff --git a/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp b/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
index 07530ad..aaf88f7 100644
--- a/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
+++ b/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
@@ -193,6 +193,13 @@ static gint on_view_event_after (GtkWidget *tree_view,
GdkEventButton *event,
gpointer data);
+/* DESCRIPTION : Called when the RosterViewGtk widget becomes visible.
+ * BEHAVIOR : Calls on_selection_changed to update actions.
+ * PRE : /
+ */
+static void on_map_cb (G_GNUC_UNUSED GtkWidget *widget,
+ gpointer data);
+
/* DESCRIPTION : Helpers for the next function
*/
@@ -740,7 +747,6 @@ on_view_event_after (GtkWidget *tree_view,
GtkTreePath *path = NULL;
GtkTreeIter iter;
-
// take into account only clicks and Enter keys
if (event->type != GDK_BUTTON_PRESS && event->type != GDK_2BUTTON_PRESS && event->type != GDK_KEY_PRESS)
return FALSE;
@@ -810,6 +816,21 @@ on_view_event_after (GtkWidget *tree_view,
return TRUE;
}
+
+static void
+on_map_cb (G_GNUC_UNUSED GtkWidget *widget,
+ gpointer data)
+{
+ GtkTreeSelection *selection = NULL;
+
+ g_return_if_fail (IS_ROSTER_VIEW_GTK (data));
+ RosterViewGtk *self = ROSTER_VIEW_GTK (data);
+
+ selection = gtk_tree_view_get_selection (self->priv->tree_view);
+ on_selection_changed (selection, self);
+}
+
+
static gboolean
presentity_hide_show_offline (RosterViewGtk* self,
GtkTreeModel* model,
@@ -1669,6 +1690,8 @@ roster_view_gtk_init (RosterViewGtk* self)
G_CALLBACK (on_selection_changed), self);
g_signal_connect (self->priv->tree_view, "event-after",
G_CALLBACK (on_view_event_after), self);
+ g_signal_connect (GTK_WIDGET (self), "map",
+ G_CALLBACK (on_map_cb), self);
/* Other signals */
g_signal_connect (self->priv->settings->get_g_settings (), "changed::show-offline-contacts",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]