2015-12-29 09:11:51 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2015 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#include <gui/builder.h>
|
|
|
|
#include <gui/settings.h>
|
|
|
|
#include <gui/sidebar.h>
|
|
|
|
|
|
|
|
const gchar *SIDEBAR_SETTING = "gui.sidebar.pos";
|
|
|
|
|
|
|
|
void __sidebar_resize(GtkPaned *pane, GParamSpec *pspec, gpointer data)
|
|
|
|
{
|
|
|
|
gui_settings_set(SIDEBAR_SETTING, gtk_paned_get_position(pane));
|
|
|
|
}
|
|
|
|
|
2016-01-04 08:27:30 -05:00
|
|
|
void __sidebar_deselect(const gchar *widget)
|
|
|
|
{
|
|
|
|
GtkTreeView *treeview = GTK_TREE_VIEW(gui_builder_widget(widget));
|
|
|
|
GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview);
|
|
|
|
|
|
|
|
gtk_tree_selection_unselect_all(selection);
|
|
|
|
}
|
|
|
|
|
2015-12-29 09:11:51 -05:00
|
|
|
void gui_sidebar_init()
|
|
|
|
{
|
|
|
|
GtkPaned *pane = GTK_PANED(gui_builder_widget("o_sidebar"));
|
|
|
|
int pos = gui_settings_get(SIDEBAR_SETTING);
|
|
|
|
|
|
|
|
if (pos > 0)
|
|
|
|
gtk_paned_set_position(pane, pos);
|
|
|
|
}
|
2016-01-04 08:27:30 -05:00
|
|
|
|
|
|
|
void gui_sidebar_selected(enum sidebar_selection_t selected)
|
|
|
|
{
|
|
|
|
if (selected != SB_COLLECTION)
|
|
|
|
__sidebar_deselect("o_collection_view");
|
|
|
|
if (selected != SB_PLAYLIST)
|
|
|
|
__sidebar_deselect("o_playlist_view");
|
|
|
|
}
|