Implement view-selection-changed signal handler

This commit is contained in:
Gergely Polonkai 2014-08-10 23:42:24 +02:00
parent f44c5b8c86
commit 4a42ae40b6

View File

@ -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;