81 lines
1.6 KiB
C++
81 lines
1.6 KiB
C++
/*
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
*/
|
|
extern "C" {
|
|
#include <core/core.h>
|
|
#include <core/idle.h>
|
|
#include <gui/audio.h>
|
|
#include <gui/builder.h>
|
|
#include <gui/collection.h>
|
|
#include <gui/history.h>
|
|
#include <gui/playlist.h>
|
|
#include <gui/settings.h>
|
|
#include <gui/sidebar.h>
|
|
#include <gui/tempq.h>
|
|
#include <gui/view.h>
|
|
#include <gui/window.h>
|
|
}
|
|
#include <gtkmm.h>
|
|
#include <glib.h>
|
|
|
|
|
|
static Glib::RefPtr<Gtk::Application> ocarina_app;
|
|
|
|
|
|
struct core_init_data init_data = {
|
|
&collection_ops,
|
|
&history_ops,
|
|
&playlist_ops,
|
|
&tempq_ops,
|
|
&audio_ops,
|
|
};
|
|
|
|
static gchar *find_file_path(const gchar *file)
|
|
{
|
|
gchar *path = g_strjoin("/", "share", "ocarina", file, NULL);
|
|
|
|
if (g_file_test(path, G_FILE_TEST_IS_REGULAR))
|
|
return path;
|
|
g_free(path);
|
|
|
|
return g_strjoin("/", "/usr", "share", "ocarina", file, NULL);
|
|
}
|
|
|
|
static void on_window_removed(Gtk::Window *window)
|
|
{
|
|
idle_cancel();
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
Gtk::Window *window;
|
|
gchar *ui = find_file_path("ocarina6.glade");
|
|
gchar *icon = find_file_path("ocarina.png");
|
|
|
|
ocarina_app = Gtk::Application::create(argc, argv, "org.gtkmm.ocarina");
|
|
|
|
gui_builder_init(ui);
|
|
core_init(&argc, &argv, &init_data);
|
|
gui_settings_init();
|
|
gui_view_init();
|
|
gui_window_init(icon);
|
|
gui_sidebar_init();
|
|
gui_collection_init();
|
|
gui_playlist_init();
|
|
gui_audio_init();
|
|
|
|
g_free(ui);
|
|
g_free(icon);
|
|
|
|
window = Glib :: wrap(GTK_WINDOW(gui_builder_widget("o_window")), false);
|
|
ocarina_app->signal_window_removed().connect(sigc::ptr_fun(on_window_removed));
|
|
ocarina_app->run(*window, argc, argv);
|
|
|
|
core_deinit();
|
|
gui_window_deinit();
|
|
gui_settings_deinit();
|
|
gui_builder_deinit();
|
|
|
|
return 0;
|
|
}
|