From 4a42ae40b6ef5aba3822c130c7331d3c0ebc2074 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sun, 10 Aug 2014 23:42:24 +0200 Subject: [PATCH] Implement view-selection-changed signal handler --- src/ag-window.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/ag-window.c b/src/ag-window.c index e41e989..409ac6b 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -1289,6 +1289,30 @@ ag_window_list_item_activated_cb(GdMainView *view, ag_window_change_tab(window, "chart"); } +static void +ag_window_list_selection_changed_cb(GdMainView *view, AgWindow *window) +{ + GList *selection; + guint count; + AgWindowPrivate *priv = ag_window_get_instance_private(window); + + selection = gd_main_view_get_selection(view); + + if ((count = g_list_length(selection)) > 0) { + gtk_revealer_set_reveal_child( + GTK_REVEALER(priv->selection_toolbar), + TRUE + ); + } else { + gtk_revealer_set_reveal_child( + GTK_REVEALER(priv->selection_toolbar), + FALSE + ); + } + + // Here it is possible to set button sensitivity later +} + static void ag_window_init(AgWindow *window) { @@ -1357,6 +1381,12 @@ ag_window_init(AgWindow *window) G_CALLBACK(ag_window_list_item_activated_cb), window ); + g_signal_connect( + priv->tab_list, + "view-selection-changed", + G_CALLBACK(ag_window_list_selection_changed_cb), + window + ); gtk_stack_set_visible_child_name(GTK_STACK(priv->stack), "list"); priv->current_tab = priv->tab_list;