ocarina: Remove more obsolete code

Some of this involved commenting out dead code that I want to use for
reference later.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-08-29 10:43:19 -04:00
parent 9801e9335b
commit e6d9d2a906
14 changed files with 6 additions and 444 deletions

View File

@ -1,39 +0,0 @@
#ifndef OCARINA_BODY_H
#define OCARINA_BODY_H
#include <ocarina/ocarina.h>
#include <libsaria/playlist.h>
GtkWidget *get_tabs();
GtkWidget *make_page(GtkWidget *);
void push_page(GtkWidget *, GtkWidget *, bool);
void remove_page(GtkWidget *);
void set_current_page(GtkWidget *);
namespace ocarina
{
namespace body
{
void init();
void add_page(int, GtkWidget *, GtkWidget *, libsaria::Playlist *);
void remove_page(GtkWidget *);
void switch_to_page(GtkWidget *);
void set_idle_progress(float);
void hide_idle_progress();
void set_now_playing();
GtkWidget *playlist_init();
GtkWidget *footer_init();
GtkWidget *now_playing_page();
GtkWidget *pause_page();
GtkWidget *general_page();
GtkWidget *library_page();
}
}; /* Namespace: ocarina */
#endif /* OCARINA_BODY_H */

View File

@ -1,15 +0,0 @@
#ifndef OCARINA_CHOOSER_H
#define OCARINA_CHOOSER_H
#include <string>
using namespace std;
namespace ocarina
{
string choose_file();
string choose_dir();
};
#endif

View File

@ -1,10 +0,0 @@
#ifndef OCARINA_FOOTER
#define OCARINA_FOOTER
#include <ocarina/ocarina.h>
#include <libsaria/track.h>
void footer_init();
void change_footer(libsaria::Track *);
#endif /* OCARINA_FOOTER */

View File

@ -1,11 +0,0 @@
#ifndef OCARINA_HEADER_H
#define OCARINA_HEADER_H
#include <ocarina/ocarina.h>
GtkWidget *get_header();
void header_init();
bool entry_focused();
#endif /* OCARINA_HEADER_H */

View File

@ -1,19 +0,0 @@
#ifndef OCARINA_LIBRARY_H
#define OCARINA_LIBRARY_H
#include <libsaria/track.h>
namespace ocarina
{
namespace library
{
void init();
void refresh();
void refilter();
void scroll_to(libsaria::Track *);
}
};
#endif /* OCARINA_LIBRARY_H */

View File

@ -33,7 +33,6 @@ namespace ocarina
void on_show();
void on_hide();
void switch_to();
void right_click(guint, guint64);
void select_none();
void list_selected_tracks(list<libsaria::Track *> &);
@ -55,17 +54,6 @@ namespace ocarina
void remove_index(unsigned int);
};
namespace playlist
{
void switch_to_library();
void switch_to_recent();
void switch_to_banned();
void switch_to_plist(unsigned int);
void init();
};
}; /* Namespace: ocarina */
#endif /* OCARINA_PLAYLIST_H */

View File

@ -1,16 +0,0 @@
#ifndef OCARINA_SETTINGS_H
#define OCARINA_SETTINGS_H
#include <ocarina/ocarina.h>
#include <string>
using namespace std;
void settings_init();
void add_settings_page(string, GtkWidget *);
void general_settings_init();
void library_settings_init();
void library_settings_refresh();
#endif /* OCARINA_SETTINGS_H */

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Bryan Schumaker
#include <ocarina/ocarina.h>
#include <ocarina/body.h>
namespace ocarina
{
GtkWidget *body::general_page()
{
GtkWidget *label = gtk_label_new("Future general settings page");
gtk_widget_show(label);
return label;
}
}; /* Namespace: ocarina */

View File

@ -1,7 +1,5 @@
// Copyright (c) 2012 Bryan Schumaker
#include <ocarina/ocarina.h>
#include <ocarina/chooser.h>
#include <ocarina/body.h>
#include <libsaria/libsaria.h>
#include <libsaria/deck.h>
@ -21,13 +19,13 @@ static void on_click_open(GtkWidget *b, gpointer d)
}
}
static void on_page_reordered(GtkWidget *t, GtkWidget *page, guint num, gpointer d)
/*static void on_page_reordered(GtkWidget *t, GtkWidget *page, guint num, gpointer d)
{
libsaria::Playlist *plist = tab_mapping[page];
unsigned int n = libsaria::deck::move_playlist(plist, num);
if (n != num)
gtk_notebook_reorder_child(GTK_NOTEBOOK(tabs), page, n);
}
}*/
static GtkWidget *init_playlist_action()
{
@ -52,7 +50,7 @@ void init_playlist2()
namespace ocarina
{
GtkWidget *body::playlist_init()
/*GtkWidget *body::playlist_init()
{
tabs = gtk_notebook_new();
@ -87,6 +85,6 @@ namespace ocarina
int pg = gtk_notebook_page_num(GTK_NOTEBOOK(tabs), page);
println("Switching to page: %d", pg);
gtk_notebook_set_current_page(GTK_NOTEBOOK(tabs), pg);
}
}*/
}; /* Namespace: ocarina */

View File

@ -1,37 +0,0 @@
// Copyright (c) 2011 Bryan Schumaker
#include <ocarina/ocarina.h>
#include <ocarina/chooser.h>
namespace ocarina
{
static string generic_chooser(GtkFileChooserAction action)
{
GtkWidget *chooser = gtk_file_chooser_dialog_new(
"Open File", NULL, action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
char *c_file;
string filename = "";
if ( gtk_dialog_run(GTK_DIALOG(chooser)) == GTK_RESPONSE_ACCEPT) {
c_file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser));
filename = c_file;
g_free(c_file);
}
gtk_widget_destroy(chooser);
return filename;
}
string choose_file()
{
return generic_chooser(GTK_FILE_CHOOSER_ACTION_OPEN);
}
string choose_dir()
{
return generic_chooser(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
}
};

View File

@ -1,6 +1,5 @@
// Copyright (c) 2012 Bryan Schumaker
#include <ocarina/playlist.h>
#include <ocarina/body.h>
#include <libsaria/format.h>
#include <libsaria/track.h>
@ -103,11 +102,6 @@ namespace ocarina
gtk_tree_selection_unselect_all(treesel);
}
void Playlist::switch_to()
{
body::switch_to_page(box);
}
void Playlist::on_show()
{
visible = true;
@ -206,7 +200,7 @@ namespace ocarina
set_label_text();
renumbered(p->get_number());
body::add_page(p->get_number(), box, label_box, p);
//body::add_page(p->get_number(), box, label_box, p);
}
void Playlist::renumbered(int n)
@ -220,7 +214,7 @@ namespace ocarina
void Playlist::prepare_for_removal()
{
body::remove_page(box);
//body::remove_page(box);
}
void Playlist::on_disable(bool disabled)

View File

@ -1,71 +0,0 @@
// Copyright (c) 2012 Bryan Schumaker
#include <ocarina/settings.h>
#include <ocarina/ocarina.h>
#include <libsaria/audio.h>
static GtkWidget *alsa_devices = NULL;
//static unsigned int num_alsa_devices = 0;
/*static void set_alsa_devices(bool using_alsa)
{
//list<string> *devices;
list<string>::iterator it;
for (unsigned int i = 0; i < num_alsa_devices; i++)
gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(alsa_devices), 0);
num_alsa_devices = 0;
if (using_alsa == true) {*/
/*devices = libsaria::audio::get_alsa_devices();
for (it = devices->begin(); it != devices->end(); it++)
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(alsa_devices), it->c_str());
num_alsa_devices = devices->size();*/
/* }
}*/
/*static void change_alsa_device(GtkComboBox *combo, gpointer data)
{
char *device = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(alsa_devices));
if (device != NULL) {
string dev = device;
//libsaria::audio::set_device(dev);
g_free(device);
}
}*/
/*static void toggle_alsa(GtkWidget *button, gpointer data)
{
bool active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
//libsaria::audio::use_alsa(active);
gtk_widget_set_sensitive(alsa_devices, active);
set_alsa_devices(active);
}*/
static void add_alsa_settings(GtkWidget *general)
{
//bool using_alsa = libsaria::audio::using_alsa();
//GtkWidget *alsa = gtk_hbox_new(FALSE, 0);
//GtkWidget *button = gtk_check_button_new_with_label("Use ALSA");
alsa_devices = gtk_combo_box_text_new();
//gtk_widget_set_sensitive(alsa_devices, using_alsa);
//set_alsa_devices(using_alsa);
//gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), using_alsa);
//GTK_CONNECT(button, "toggled", toggle_alsa, NULL);
//GTK_CONNECT(alsa_devices, "changed", change_alsa_device, NULL);
//box_pack_start(alsa, button, FALSE, FALSE, 0);
//box_pack_start(alsa, alsa_devices, TRUE, TRUE, 0);
//box_pack_start(general, alsa, FALSE, FALSE, 0);
}
void general_settings_init()
{
GtkWidget *general_settings = gtk_vbox_new(FALSE, 0);
add_alsa_settings(general_settings);
gtk_widget_show_all(general_settings);
add_settings_page("General", general_settings);
}

View File

@ -1,147 +0,0 @@
// Copyright (c) 2011 Bryan Schumaker
#include <sstream>
#include <map>
using namespace std;
#include <ocarina/settings.h>
#include <ocarina/chooser.h>
#include <ocarina/ocarina.h>
#include <libsaria/library.h>
#include <libsaria/print.h>
/* This is a gtk vbox */
static GtkWidget *library_settings = NULL;
static map<GtkWidget *, string> widget_mapping;
/*static void on_click_add(GtkWidget *b, gpointer d)
{
string dir = ocarina::choose_dir();
if (dir != "" ) {
println("Scanning dir: " + dir);
//libsaria::library::add_path(dir);
}
}*/
/*static void on_click_update(GtkWidget *b, gpointer d)
{
//libsaria::library::update();
}*/
/*static void on_click_update_path(GtkWidget *b, GdkEvent *e, gpointer d)
{
libsaria::library::update_path(widget_mapping[b]);
}
static void on_click_remove(GtkWidget *b, GdkEvent *e, gpointer d)
{
libsaria::library::remove_path(widget_mapping[b]);
}
static GtkWidget *markup_label(string markup)
{
GtkWidget *label = gtk_label_new("");
gtk_label_set_markup(GTK_LABEL(label), markup.c_str());
return label;
}
static GtkWidget *make_path_info(string path, unsigned int size)
{
stringstream stream;
GtkWidget *path_label, *size_label;
GtkWidget *box = gtk_vbox_new(FALSE, 0);
stream << "<span size='xx-large' weight='bold'>" << path << "</span>";
path_label = markup_label(stream.str());
stream.str("");
stream << "<span size='large'>" << size << " files</span>";
size_label = markup_label(stream.str());
box_pack_start(box, path_label, TRUE, TRUE, 0);
box_pack_start(box, size_label, TRUE, TRUE, 0);
return box;
}
static void add_content(GtkWidget *panel, libsaria::LibraryPath *path)
{
GtkWidget *content = gtk_hbox_new(FALSE, 0);
GtkWidget *info = make_path_info(path->get_path(), path->get_size());
GtkWidget *update = make_text_button(GTK_STOCK_REFRESH,
"Update Path",
on_click_update_path,
true);
GtkWidget *remove = make_text_button(GTK_STOCK_REMOVE,
"Remove Path",
on_click_remove,
true);
box_pack_start(content, info, TRUE, TRUE, 0);
box_pack_start(content, update, FALSE, FALSE, 0);
box_pack_start(content, remove, FALSE, FALSE, 0);
box_pack_start(panel, content, TRUE, TRUE, 0);
widget_mapping[update] = path->get_path();
widget_mapping[remove] = path->get_path();
}
static void add_library_path(libsaria::LibraryPath *path)
{
GtkWidget *panel = gtk_vbox_new(FALSE, 0);
GtkWidget *sep = gtk_hseparator_new();
add_content(panel, path);
box_pack_start(panel, sep, TRUE, TRUE, 0);
box_pack_start(library_settings, panel, FALSE, FALSE, 0);
}*/
/*static GtkWidget *get_button_row()
{
GtkWidget *button_row = gtk_hbox_new(FALSE, 0);*/
/*GtkWidget *add_button = make_text_button(GTK_STOCK_ADD,
"Add to Library",
on_click_add,
true);*/
/*GtkWidget *update_button = make_text_button(GTK_STOCK_REFRESH,
"Update Library",
on_click_update,
true);*/
//box_pack_end(button_row, add_button, FALSE, FALSE, 0);
//box_pack_end(button_row, update_button, FALSE, FALSE, 0);
/*
return button_row;
}*/
void library_refresh_remove(GtkWidget *widget, gpointer data)
{
gtk_widget_destroy(widget);
}
void library_settings_refresh()
{
//libsaria::LibraryPath *path;
gtk_container_foreach(GTK_CONTAINER(library_settings), library_refresh_remove, NULL);
widget_mapping.clear();
/*libsaria::library::pathiter::reset();
while (!libsaria::library::pathiter::end()) {
path = libsaria::library::pathiter::next();
add_library_path(path);
}*/
//box_pack_start(library_settings, get_button_row(), FALSE, FALSE, 0);
gtk_widget_show_all(library_settings);
}
void library_settings_init()
{
library_settings = gtk_vbox_new(FALSE, 0);
//box_pack_start(library_settings, get_button_row(), FALSE, FALSE, 0);
gtk_widget_show_all(library_settings);
add_settings_page("Library", library_settings);
}

View File

@ -1,38 +0,0 @@
// Copyright (c) 2011 Bryan Schumaker
#include <ocarina/settings.h>
#include <ocarina/body.h>
#include <ocarina/ocarina.h>
static GtkWidget *settings_tabs = NULL;
//static GtkWidget *settings_page = NULL;
void settings_init()
{
GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_PREFERENCES,
GTK_ICON_SIZE_MENU);
settings_tabs = gtk_notebook_new();
gtk_widget_show(image);
gtk_widget_show(settings_tabs);
//settings_page = make_page(settings_tabs);
//push_page(settings_page, image, false);
general_settings_init();
library_settings_init();
}
void add_settings_page(string label_text, GtkWidget *page)
{
GtkWidget *label = gtk_label_new(label_text.c_str());
GtkWidget *window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(window),
page);
gtk_notebook_append_page(GTK_NOTEBOOK(settings_tabs), window, label);
gtk_widget_show(window);
gtk_widget_show(label);
}