lib: Remove rest of lib/
This is all contained in the gui code now. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
dc3e770c28
commit
74a557739d
|
@ -29,14 +29,13 @@ Export("env", "test_env")
|
|||
|
||||
include = SConscript("include/Sconscript")
|
||||
core = SConscript("core/Sconscript")
|
||||
lib = SConscript("lib/Sconscript")
|
||||
gui = SConscript("gui/Sconscript")
|
||||
|
||||
if os.path.isdir("tests"):
|
||||
tests = SConscript("tests/Sconscript")
|
||||
|
||||
|
||||
ocarina = env.Program("bin/ocarina", core + lib + gui)
|
||||
ocarina = env.Program("bin/ocarina", core + gui)
|
||||
Default(ocarina)
|
||||
Clean(ocarina, "bin/")
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/python
|
||||
Import("env")
|
||||
|
||||
env.UsePackage("gtkmm-3.0")
|
||||
env.UsePackage("gstreamer-1.0")
|
||||
|
||||
res = Glob("*.cpp")
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <core/library.h>
|
||||
#include <core/playlist.h>
|
||||
#include <gui/tabs.h>
|
||||
#include <lib/lib.h>
|
||||
|
||||
|
||||
class CollectionTab : public Tab {
|
||||
|
|
26
gui/main.cpp
26
gui/main.cpp
|
@ -3,25 +3,45 @@
|
|||
*/
|
||||
#include <core/core.h>
|
||||
#include <core/playlist.h>
|
||||
#include <lib/lib.h>
|
||||
#include <gui/ocarina.h>
|
||||
#include <gui/tabs.h>
|
||||
|
||||
|
||||
static std::string share_dir = "";
|
||||
|
||||
namespace gui
|
||||
{
|
||||
Glib::RefPtr<Gtk::Builder> __O_BUILDER;
|
||||
|
||||
const std::string share_file(const std::string &f)
|
||||
{
|
||||
return share_dir + f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void setup_share(const std::string &path)
|
||||
{
|
||||
char buf[1024];
|
||||
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
|
||||
|
||||
if (len == -1)
|
||||
return;
|
||||
buf[len] = '\0';
|
||||
|
||||
share_dir = std::string(buf);
|
||||
share_dir = share_dir.substr(0, share_dir.size() - 11);
|
||||
share_dir = share_dir + "share/ocarina/";
|
||||
}
|
||||
|
||||
Gtk::Window *ocarina_init(int *argc, char ***argv)
|
||||
{
|
||||
Gtk::Window *window;
|
||||
|
||||
lib :: init(argc, argv);
|
||||
setup_share((*argv)[0]);
|
||||
|
||||
gui :: __O_BUILDER = Gtk::Builder::create();
|
||||
if (!gui :: __O_BUILDER->add_from_file(lib :: share_file("ocarina6.glade")))
|
||||
if (!gui::__O_BUILDER->add_from_file(gui::share_file("ocarina6.glade")))
|
||||
exit(1);
|
||||
|
||||
gst :: init(argc, argv);
|
||||
|
|
|
@ -62,7 +62,7 @@ Gtk::Window *window_init()
|
|||
|
||||
window->set_can_focus();
|
||||
window->set_title(appname + get_version());
|
||||
window->set_icon_from_file(lib :: share_file("ocarina.png"));
|
||||
window->set_icon_from_file(gui :: share_file("ocarina.png"));
|
||||
|
||||
window->signal_key_press_event().connect(sigc::ptr_fun(on_window_key_pressed));
|
||||
window->signal_key_release_event().connect(sigc::ptr_fun(on_window_key_released));
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#define OCARINA_H
|
||||
|
||||
#include <core/queue.h>
|
||||
#include <lib/lib.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
|
||||
/* main.cpp */
|
||||
|
@ -13,6 +13,8 @@ namespace gui
|
|||
{
|
||||
extern Glib::RefPtr<Gtk::Builder> __O_BUILDER;
|
||||
|
||||
const std::string share_file(const std::string &);
|
||||
|
||||
template <class T>
|
||||
static inline T *get_widget(const std::string &name)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#ifndef OCARINA_TABS_H
|
||||
#define OCARINA_TABS_H
|
||||
|
||||
#include <lib/lib.h>
|
||||
#include <gui/model.h>
|
||||
#include <gui/ocarina.h>
|
||||
#include <core/queue.h>
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#ifndef OCARINA_LIB_LIB_H
|
||||
#define OCARINA_LIB_LIB_H
|
||||
|
||||
#include <string>
|
||||
#include <gtkmm.h>
|
||||
|
||||
namespace lib
|
||||
{
|
||||
|
||||
void init(int *, char ***);
|
||||
const std::string share_file(const std::string &);
|
||||
|
||||
}
|
||||
|
||||
#endif /* OCARINA_LIB_LIB_H */
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
Import("env")
|
||||
env.UsePackage("gtkmm-3.0")
|
||||
res = Glob("*.cpp")
|
||||
Return("res")
|
32
lib/lib.cpp
32
lib/lib.cpp
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/core.h>
|
||||
#include <lib/lib.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
static std::string share_dir = "";
|
||||
|
||||
static void setup_share(const std::string &path)
|
||||
{
|
||||
char buf[1024];
|
||||
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
|
||||
|
||||
if (len == -1)
|
||||
return;
|
||||
buf[len] = '\0';
|
||||
|
||||
share_dir = std::string(buf);
|
||||
share_dir = share_dir.substr(0, share_dir.size() - 11);
|
||||
share_dir = share_dir + "share/ocarina/";
|
||||
}
|
||||
|
||||
void lib :: init(int *argc, char ***argv)
|
||||
{
|
||||
setup_share((*argv)[0]);
|
||||
}
|
||||
|
||||
const std::string lib :: share_file(const std::string &f)
|
||||
{
|
||||
return share_dir + f;
|
||||
}
|
|
@ -56,6 +56,5 @@ add_test(test, "")
|
|||
|
||||
|
||||
SConscript("core/Sconscript")
|
||||
#SConscript("lib/Sconscript")
|
||||
|
||||
Return("res")
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
lib
|
||||
colmgr
|
||||
model
|
||||
tags/
|
|
@ -1,23 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
import os
|
||||
Import("test_env", "generic_test")
|
||||
|
||||
objs = []
|
||||
core = []
|
||||
|
||||
for f in Glob("../../core/*.cpp"):
|
||||
f = str(f)
|
||||
core += [ test_env.Object("%s-core" % os.path.basename(f), f) ]
|
||||
for f in Glob("../../core/tags/*.cpp"):
|
||||
f = str(f)
|
||||
core += [ test_env.Object("tags/%s-core" % os.path.basename(f), f) ]
|
||||
|
||||
def test(name):
|
||||
global core, objs
|
||||
objs = generic_test(name, "lib", objs, core)
|
||||
|
||||
|
||||
test( "lib" )
|
||||
|
||||
test_env.UsePackage("gtkmm-3.0")
|
||||
test( "model" )
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/deck.h>
|
||||
#include <lib/lib.h>
|
||||
#include <tests/test.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
static void test_init(int *argc, char ***argv)
|
||||
{
|
||||
Gtk::Window *window;
|
||||
|
||||
test_equal(deck :: get_queues().size(), (size_t)0);
|
||||
|
||||
test :: cp_data_dir();
|
||||
lib :: init(argc, argv, "ocarina6.glade");
|
||||
|
||||
test_equal(deck :: get_queues().size(), (size_t)2);
|
||||
test_equal(lib :: share_file("saria"), (std::string)"./share/ocarina/saria");
|
||||
|
||||
window = lib :: get_widget<Gtk::Window>("o_window");
|
||||
test_not_equal(window, (Gtk::Window *)NULL);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Gtk::Main ocarina(&argc, &argv);
|
||||
run_test("Lib Test", test_init, &argc, &argv);
|
||||
return 0;
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/library.h>
|
||||
#include <lib/lib.h>
|
||||
#include <lib/model.h>
|
||||
#include <tests/test.h>
|
||||
|
||||
static void test_qmodel()
|
||||
{
|
||||
QueueModel model(library :: get_queue());
|
||||
Gtk::TreePath path;
|
||||
Gtk::TreeIter iter;
|
||||
Gtk::TreeRow row;
|
||||
bool valid;
|
||||
|
||||
test_equal(model.get_flags(), Gtk::TREE_MODEL_LIST_ONLY);
|
||||
test_equal(model.get_n_columns(), 10);
|
||||
|
||||
for (unsigned int i = 0; i < 10; i++) {
|
||||
if ((i == 0) || (i == 5) || (i == 7))
|
||||
test_equal(model.get_column_type(i), G_TYPE_UINT);
|
||||
else
|
||||
test_equal(model.get_column_type(i), G_TYPE_STRING);
|
||||
}
|
||||
|
||||
path = Gtk::TreePath("42");
|
||||
iter = model.get_iter(path);
|
||||
valid = (iter ? true : false);
|
||||
test_equal(valid, false);
|
||||
|
||||
path = Gtk::TreePath("19");
|
||||
iter = model.get_iter(path);
|
||||
valid = (iter ? true : false);
|
||||
test_equal(valid, true);
|
||||
|
||||
test_equal(model.get_path(iter), path);
|
||||
test_equal(model.get_iter(path), iter);
|
||||
|
||||
test_equal(model.iter_to_id(iter), (unsigned)19);
|
||||
test_equal(model.path_to_id(path), (unsigned)15);
|
||||
|
||||
valid = (++iter ? true : false);
|
||||
test_equal(valid, false);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Gtk::Main ocarina(&argc, &argv);
|
||||
test :: cp_data_dir();
|
||||
lib :: init(&argc, &argv, "ocarina6.glade");
|
||||
|
||||
run_test("QueueModel Test", test_qmodel);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue