gui/history: Remove unused gui queue code
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
64fc5a9a0d
commit
dc07d637f6
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2014 (c) Anna Schumaker.
|
|
||||||
*/
|
|
||||||
#include <gui/queue.h>
|
|
||||||
#include <gui/sidebar.h>
|
|
||||||
|
|
||||||
|
|
||||||
static void *__history_init(struct queue *queue, void *data)
|
|
||||||
{
|
|
||||||
return gui_queue_alloc(queue, "History", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __history_added(struct queue *queue, unsigned int pos)
|
|
||||||
{
|
|
||||||
gui_queue_added(queue, pos);
|
|
||||||
gui_sidebar_set_size(gui_queue(queue));
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool __history_erase(struct queue *queue, struct track *track)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __history_removed(struct queue *queue, unsigned int pos)
|
|
||||||
{
|
|
||||||
gui_queue_removed(queue, pos);
|
|
||||||
gui_sidebar_set_size(gui_queue(queue));
|
|
||||||
}
|
|
||||||
|
|
||||||
struct queue_ops history_ops = {
|
|
||||||
.qop_init = __history_init,
|
|
||||||
.qop_deinit = gui_queue_free,
|
|
||||||
.qop_added = __history_added,
|
|
||||||
.qop_erase = __history_erase,
|
|
||||||
.qop_removed = __history_removed,
|
|
||||||
.qop_cleared = gui_queue_cleared,
|
|
||||||
.qop_updated = gui_queue_updated,
|
|
||||||
};
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <gui/audio.h>
|
#include <gui/audio.h>
|
||||||
#include <gui/builder.h>
|
#include <gui/builder.h>
|
||||||
#include <gui/collection.h>
|
#include <gui/collection.h>
|
||||||
#include <gui/history.h>
|
|
||||||
#include <gui/idle.h>
|
#include <gui/idle.h>
|
||||||
#include <gui/playlist.h>
|
#include <gui/playlist.h>
|
||||||
#include <gui/settings.h>
|
#include <gui/settings.h>
|
||||||
|
@ -24,7 +23,7 @@ const static gchar *OCARINA_NAME = "org.gtk.ocarina-debug";
|
||||||
|
|
||||||
struct core_init_data init_data = {
|
struct core_init_data init_data = {
|
||||||
NULL,
|
NULL,
|
||||||
&history_ops,
|
NULL,
|
||||||
&playlist_ops,
|
&playlist_ops,
|
||||||
&tempq_ops,
|
&tempq_ops,
|
||||||
&audio_ops,
|
&audio_ops,
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* Copyright 2015 (c) Anna Schumaker.
|
* Copyright 2015 (c) Anna Schumaker.
|
||||||
*/
|
*/
|
||||||
#include <core/collection.h>
|
#include <core/collection.h>
|
||||||
#include <core/history.h>
|
|
||||||
#include <core/queue.h>
|
#include <core/queue.h>
|
||||||
#include <core/tempq.h>
|
#include <core/tempq.h>
|
||||||
#include <gui/builder.h>
|
#include <gui/builder.h>
|
||||||
|
@ -34,11 +33,6 @@ static void __sidebar_set_size(GtkTreeIter *iter, const gchar *name,
|
||||||
g_free(text);
|
g_free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __sidebar_set_queue(GtkTreeIter *iter, struct gui_queue *queue)
|
|
||||||
{
|
|
||||||
gtk_list_store_set(sb_store, iter, SB_QUEUE, queue, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct gui_queue *__sidebar_get_queue(GtkTreeIter *iter)
|
static struct gui_queue *__sidebar_get_queue(GtkTreeIter *iter)
|
||||||
{
|
{
|
||||||
struct gui_queue *queue;
|
struct gui_queue *queue;
|
||||||
|
@ -117,15 +111,11 @@ void __sidebar_deselect(const gchar *widget)
|
||||||
void gui_sidebar_init()
|
void gui_sidebar_init()
|
||||||
{
|
{
|
||||||
GtkPaned *pane = GTK_PANED(gui_builder_widget("o_sidebar"));
|
GtkPaned *pane = GTK_PANED(gui_builder_widget("o_sidebar"));
|
||||||
GtkTreeIter iter;
|
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
/* Set up entries in the liststore. */
|
/* Set up entries in the liststore. */
|
||||||
sb_store = GTK_LIST_STORE(gui_builder_object("o_sidebar_store"));
|
sb_store = GTK_LIST_STORE(gui_builder_object("o_sidebar_store"));
|
||||||
|
|
||||||
gtk_tree_model_get_iter_first(GTK_TREE_MODEL(sb_store), &iter);
|
|
||||||
__sidebar_set_queue(&iter, gui_queue(history_get_queue()));
|
|
||||||
|
|
||||||
/* Set sidebar width. */
|
/* Set sidebar width. */
|
||||||
pos = gui_settings_get(SIDEBAR_SETTING);
|
pos = gui_settings_get(SIDEBAR_SETTING);
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
|
@ -160,11 +150,13 @@ void gui_sidebar_add(struct gui_queue *queue)
|
||||||
if (!GTK_IS_TREE_MODEL(sb_store))
|
if (!GTK_IS_TREE_MODEL(sb_store))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(sb_store),
|
if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(sb_store),
|
||||||
&sibling, NULL,
|
&sibling, NULL,
|
||||||
tempq_index(queue->gq_queue));
|
tempq_index(queue->gq_queue)))
|
||||||
|
gtk_list_store_insert_before(sb_store, &iter, &sibling);
|
||||||
|
else
|
||||||
|
gtk_list_store_insert(sb_store, &iter, -1);
|
||||||
|
|
||||||
gtk_list_store_insert_before(sb_store, &iter, &sibling);
|
|
||||||
gtk_list_store_set(sb_store, &iter, SB_IMAGE, "audio-x-generic",
|
gtk_list_store_set(sb_store, &iter, SB_IMAGE, "audio-x-generic",
|
||||||
SB_IMAGE_SZ, GTK_ICON_SIZE_BUTTON,
|
SB_IMAGE_SZ, GTK_ICON_SIZE_BUTTON,
|
||||||
SB_TEXT, text,
|
SB_TEXT, text,
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2016 (c) Anna Schumaker.
|
|
||||||
*/
|
|
||||||
#ifndef OCARINA_GUI_HISTORY_H
|
|
||||||
#define OCARINA_GUI_HISTORY_H
|
|
||||||
|
|
||||||
/* History operations passed to core_init() */
|
|
||||||
extern struct queue_ops history_ops;
|
|
||||||
|
|
||||||
#endif /* OCARINA_GUI_HISTORY_H */
|
|
|
@ -274,14 +274,6 @@
|
||||||
<!-- column-name Queue -->
|
<!-- column-name Queue -->
|
||||||
<column type="gpointer"/>
|
<column type="gpointer"/>
|
||||||
</columns>
|
</columns>
|
||||||
<data>
|
|
||||||
<row>
|
|
||||||
<col id="0" translatable="yes">document-open-recent</col>
|
|
||||||
<col id="1">menu</col>
|
|
||||||
<col id="2" translatable="yes"><big>History</big>
|
|
||||||
0 tracks</col>
|
|
||||||
</row>
|
|
||||||
</data>
|
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkWindow" id="o_window">
|
<object class="GtkWindow" id="o_window">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#define TEST_NEED_COLLECTION
|
#define TEST_NEED_COLLECTION
|
||||||
#define TEST_NEED_PLAYLIST
|
#define TEST_NEED_PLAYLIST
|
||||||
#include <core/collection.h>
|
#include <core/collection.h>
|
||||||
#include <core/history.h>
|
|
||||||
#include <gui/builder.h>
|
#include <gui/builder.h>
|
||||||
#include <gui/settings.h>
|
#include <gui/settings.h>
|
||||||
#include <gui/sidebar.h>
|
#include <gui/sidebar.h>
|
||||||
|
@ -35,21 +34,6 @@ static void test_sidebar()
|
||||||
gui_sidebar_init();
|
gui_sidebar_init();
|
||||||
test_equal(gui_settings_get("gui.sidebar.pos"), 250);
|
test_equal(gui_settings_get("gui.sidebar.pos"), 250);
|
||||||
test_equal(gtk_paned_get_position(paned), 250);
|
test_equal(gtk_paned_get_position(paned), 250);
|
||||||
}
|
|
||||||
|
|
||||||
static void test_treeview()
|
|
||||||
{
|
|
||||||
struct queue *queue;
|
|
||||||
GtkTreeModel *model;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
|
|
||||||
model = GTK_TREE_MODEL(gui_builder_object("o_sidebar_store"));
|
|
||||||
|
|
||||||
test_equal(gtk_tree_model_get_iter_first(model, &iter), true);
|
|
||||||
gtk_tree_model_get(model, &iter, 3, &queue, -1);
|
|
||||||
test_equal((void *)queue, (void *)gui_queue(history_get_queue()));
|
|
||||||
|
|
||||||
test_equal(gtk_tree_model_iter_next(model, &iter), false);
|
|
||||||
|
|
||||||
gui_settings_deinit();
|
gui_settings_deinit();
|
||||||
gui_builder_deinit();
|
gui_builder_deinit();
|
||||||
|
@ -57,5 +41,4 @@ static void test_treeview()
|
||||||
|
|
||||||
DECLARE_UNIT_TESTS(
|
DECLARE_UNIT_TESTS(
|
||||||
UNIT_TEST("Sidebar", test_sidebar),
|
UNIT_TEST("Sidebar", test_sidebar),
|
||||||
UNIT_TEST("Sidebar Treeview", test_treeview),
|
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue