gui: Add shuffle and repeat buttons

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-01-14 08:26:17 -05:00
parent 410a784ede
commit 2c676631a4
2 changed files with 202 additions and 128 deletions

View File

@ -602,163 +602,238 @@
<property name="wide_handle">True</property>
<signal name="notify::position" handler="__sidebar_resize" swapped="no"/>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow3">
<object class="GtkBox" id="box5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_right">1</property>
<property name="shadow_type">in</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkViewport" id="viewport1">
<object class="GtkButtonBox" id="buttonbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="spacing">5</property>
<property name="layout_style">spread</property>
<child>
<object class="GtkBox" id="box5">
<object class="GtkToggleButton" id="o_random">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">center</property>
<child>
<object class="GtkImage" id="image10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">10</property>
<property name="ypad">2</property>
<property name="icon_name">media-playlist-shuffle</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
<property name="non_homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="o_repeat">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">center</property>
<child>
<object class="GtkImage" id="image9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">10</property>
<property name="ypad">2</property>
<property name="icon_name">media-playlist-repeat</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="non_homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_right">1</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkTreeView" id="o_sidebar_view">
<object class="GtkBox" id="box9">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">o_sidebar_store</property>
<property name="headers_visible">False</property>
<property name="show_expanders">False</property>
<property name="level_indentation">10</property>
<property name="enable_tree_lines">True</property>
<signal name="key-press-event" handler="__sidebar_keypress" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection4">
<signal name="changed" handler="__sidebar_selection_changed" swapped="no"/>
</object>
</child>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn6">
<property name="title" translatable="yes">Image</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf3"/>
<attributes>
<attribute name="icon-name">0</attribute>
<attribute name="stock-size">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn7">
<property name="title" translatable="yes">Text</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
<attribute name="markup">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="o_playlist_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">start</property>
<property name="model">o_playlist_store</property>
<property name="headers_visible">False</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection3">
<signal name="changed" handler="__playlist_selection_changed" swapped="no"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<property name="title" translatable="yes">Image</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf2">
<property name="stock_size">1</property>
<object class="GtkTreeView" id="o_sidebar_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">o_sidebar_store</property>
<property name="headers_visible">False</property>
<property name="show_expanders">False</property>
<property name="level_indentation">10</property>
<property name="enable_tree_lines">True</property>
<signal name="key-press-event" handler="__sidebar_keypress" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection4">
<signal name="changed" handler="__sidebar_selection_changed" swapped="no"/>
</object>
<attributes>
<attribute name="icon-name">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
<property name="title" translatable="yes">column</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="markup">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="o_collection_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">o_collection_store</property>
<property name="headers_visible">False</property>
<property name="enable_tree_lines">True</property>
<signal name="button-press-event" handler="__collection_buttonpress" swapped="no"/>
<signal name="key-press-event" handler="__collection_keypress" swapped="no"/>
<signal name="row-activated" handler="__collection_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection2">
<signal name="changed" handler="__collection_selection_changed" object="o_collection_chooser" swapped="no"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<property name="title" translatable="yes">Image</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1">
<property name="stock_size">1</property>
<object class="GtkTreeViewColumn" id="treeviewcolumn6">
<property name="title" translatable="yes">Image</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf3"/>
<attributes>
<attribute name="icon-name">0</attribute>
<attribute name="stock-size">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn7">
<property name="title" translatable="yes">Text</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
<attribute name="markup">2</attribute>
</attributes>
</child>
</object>
<attributes>
<attribute name="icon-name">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn5">
<property name="title" translatable="yes">Path</property>
<object class="GtkTreeView" id="o_playlist_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">start</property>
<property name="model">o_playlist_store</property>
<property name="headers_visible">False</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection3">
<signal name="changed" handler="__playlist_selection_changed" swapped="no"/>
</object>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderertext3"/>
<attributes>
<attribute name="markup">1</attribute>
</attributes>
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
<property name="title" translatable="yes">Image</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf2">
<property name="stock_size">1</property>
</object>
<attributes>
<attribute name="icon-name">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
<property name="title" translatable="yes">column</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="markup">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="o_collection_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">o_collection_store</property>
<property name="headers_visible">False</property>
<property name="enable_tree_lines">True</property>
<signal name="button-press-event" handler="__collection_buttonpress" swapped="no"/>
<signal name="key-press-event" handler="__collection_keypress" swapped="no"/>
<signal name="row-activated" handler="__collection_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection2">
<signal name="changed" handler="__collection_selection_changed" object="o_collection_chooser" swapped="no"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
<property name="title" translatable="yes">Image</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1">
<property name="stock_size">1</property>
</object>
<attributes>
<attribute name="icon-name">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn5">
<property name="title" translatable="yes">Path</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext3"/>
<attributes>
<attribute name="markup">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
<property name="shrink">False</property>
</packing>
</child>
<child>

View File

@ -23,10 +23,9 @@ static void test_sidebar()
gui_builder_init("share/ocarina/ocarina6.glade");
gui_settings_init();
gui_sidebar_init();
paned = GTK_PANED(gui_builder_widget("o_sidebar"));
paned = GTK_PANED(gui_builder_widget("o_sidebar"));
test_equal(gui_settings_has("gui.sidebar.pos"), (bool)false);
test_equal(gtk_paned_get_position(paned), 125);
gtk_paned_set_position(paned, 300);
test_equal(gui_settings_has("gui.sidebar.pos"), (bool)true);