2009-07-30 01:16:07 +03:00
|
|
|
/* -*- Mode: C ; c-basic-offset: 2 -*- */
|
2009-07-20 04:50:15 +03:00
|
|
|
/*
|
2009-07-30 01:16:07 +03:00
|
|
|
* LADI Session Handler (ladish)
|
2009-07-20 04:50:15 +03:00
|
|
|
*
|
2014-09-11 18:36:42 +03:00
|
|
|
* Copyright (C) 2008,2009,2010,2011,2014 Nedko Arnaudov <nedko@arnaudov.name>
|
2009-07-30 01:16:07 +03:00
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
* This file contains the code that implements main() and other top-level functionality
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* LADI Session Handler is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* LADI Session Handler is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
* or write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
2006-06-09 05:18:57 +03:00
|
|
|
*/
|
|
|
|
|
2010-03-21 18:08:42 +02:00
|
|
|
#include "internal.h"
|
2009-08-22 18:41:10 +03:00
|
|
|
|
2010-02-07 19:37:23 +02:00
|
|
|
#include "gtk_builder.h"
|
2009-08-17 05:30:31 +03:00
|
|
|
#include "canvas.h"
|
2009-12-13 18:10:57 +02:00
|
|
|
#include "../proxies/control_proxy.h"
|
2010-12-25 05:12:19 +02:00
|
|
|
#include "../proxies/a2j_proxy.h"
|
2009-08-22 04:42:54 +03:00
|
|
|
#include "world_tree.h"
|
2009-08-22 14:11:38 +03:00
|
|
|
#include "graph_view.h"
|
2010-09-19 17:15:11 +03:00
|
|
|
#include "../common/catdup.h"
|
2009-12-13 18:10:57 +02:00
|
|
|
#include "../proxies/studio_proxy.h"
|
2010-09-27 22:48:35 +03:00
|
|
|
#include "../proxies/conf_proxy.h"
|
2010-03-21 16:33:39 +02:00
|
|
|
#include "create_room_dialog.h"
|
2010-03-21 18:08:42 +02:00
|
|
|
#include "menu.h"
|
2010-09-07 01:02:12 +03:00
|
|
|
#include "about.h"
|
|
|
|
#include "statusbar.h"
|
|
|
|
#include "action.h"
|
|
|
|
#include "studio.h"
|
|
|
|
#include "jack.h"
|
2010-09-28 00:18:44 +03:00
|
|
|
#include "../daemon/conf.h"
|
2010-09-28 00:38:49 +03:00
|
|
|
#include "toolbar.h"
|
2009-08-17 04:08:32 +03:00
|
|
|
|
2010-12-19 14:30:13 +02:00
|
|
|
#define GETTEXT_PACKAGE "ladish"
|
2010-12-11 18:45:06 +02:00
|
|
|
|
|
|
|
#define ENABLE_NLS 1
|
|
|
|
|
2009-08-22 18:41:10 +03:00
|
|
|
GtkWidget * g_main_win;
|
2010-09-27 22:48:35 +03:00
|
|
|
|
2009-08-22 16:59:40 +03:00
|
|
|
void
|
|
|
|
set_main_window_title(
|
|
|
|
graph_view_handle view)
|
2009-07-20 04:50:15 +03:00
|
|
|
{
|
2009-10-11 18:25:49 +03:00
|
|
|
char * title;
|
|
|
|
|
|
|
|
if (view != NULL)
|
|
|
|
{
|
2010-12-11 18:45:06 +02:00
|
|
|
title = catdup3(get_view_name(view), " - ", _("LADI Session Handler"));
|
2009-10-11 18:25:49 +03:00
|
|
|
gtk_window_set_title(GTK_WINDOW(g_main_win), title);
|
|
|
|
free(title);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-12-11 18:45:06 +02:00
|
|
|
gtk_window_set_title(GTK_WINDOW(g_main_win), _("LADI Session Handler"));
|
2009-10-11 18:25:49 +03:00
|
|
|
}
|
2009-08-22 16:59:40 +03:00
|
|
|
}
|
2009-07-20 04:50:15 +03:00
|
|
|
|
2010-09-07 01:02:12 +03:00
|
|
|
void arrange(void)
|
2009-08-30 14:36:27 +03:00
|
|
|
{
|
2010-09-07 01:02:12 +03:00
|
|
|
canvas_handle canvas;
|
|
|
|
|
|
|
|
log_info("arrange request");
|
|
|
|
|
|
|
|
canvas = get_current_canvas();
|
|
|
|
if (canvas != NULL)
|
|
|
|
{
|
|
|
|
canvas_arrange(canvas);
|
|
|
|
}
|
2009-08-30 14:36:27 +03:00
|
|
|
}
|
|
|
|
|
2009-08-22 16:59:40 +03:00
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
2010-12-19 13:24:55 +02:00
|
|
|
#if ENABLE_NLS
|
|
|
|
bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
|
2010-12-11 18:45:06 +02:00
|
|
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
|
|
|
textdomain (GETTEXT_PACKAGE);
|
|
|
|
#endif
|
|
|
|
|
2009-08-17 05:30:31 +03:00
|
|
|
gtk_init(&argc, &argv);
|
2009-07-20 04:50:15 +03:00
|
|
|
|
2014-09-11 18:36:42 +03:00
|
|
|
if (!dbus_init())
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2010-09-27 22:48:35 +03:00
|
|
|
|
|
|
|
if (!conf_proxy_init())
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-08-17 04:35:25 +03:00
|
|
|
if (!canvas_init())
|
|
|
|
{
|
2009-09-20 18:23:42 +03:00
|
|
|
log_error("Canvas initialization failed.");
|
2009-08-17 04:17:26 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-02-07 19:37:23 +02:00
|
|
|
if (!init_gtk_builder())
|
2009-08-17 04:35:25 +03:00
|
|
|
{
|
2009-07-20 04:59:25 +03:00
|
|
|
return 1;
|
|
|
|
}
|
2006-06-09 05:18:57 +03:00
|
|
|
|
2010-02-07 19:37:23 +02:00
|
|
|
g_main_win = get_gtk_builder_widget("main_win");
|
2009-08-23 12:13:43 +03:00
|
|
|
|
2010-09-07 01:02:12 +03:00
|
|
|
init_dialogs();
|
2009-08-28 21:59:45 +03:00
|
|
|
|
2010-10-16 01:39:06 +03:00
|
|
|
if (!create_studio_lists())
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2010-02-20 03:09:37 +02:00
|
|
|
|
2010-09-07 01:02:12 +03:00
|
|
|
init_statusbar();
|
|
|
|
init_jack_widgets();
|
2010-02-20 01:52:49 +02:00
|
|
|
|
2010-03-21 16:33:39 +02:00
|
|
|
create_room_dialog_init();
|
|
|
|
|
2009-08-22 04:42:54 +03:00
|
|
|
world_tree_init();
|
2009-08-22 14:11:38 +03:00
|
|
|
view_init();
|
2009-08-22 04:42:54 +03:00
|
|
|
|
2010-09-07 01:02:12 +03:00
|
|
|
init_actions_and_accelerators();
|
2010-02-28 17:13:54 +02:00
|
|
|
|
2010-10-16 05:17:11 +03:00
|
|
|
if (!menu_init())
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-04-03 04:22:29 +03:00
|
|
|
buffer_size_clear();
|
2010-03-21 18:08:42 +02:00
|
|
|
|
2010-09-28 00:38:49 +03:00
|
|
|
if (!toolbar_init())
|
2010-09-27 22:48:35 +03:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2009-08-17 05:30:31 +03:00
|
|
|
|
2010-09-28 00:18:44 +03:00
|
|
|
if (!conf_register(LADISH_CONF_KEY_DAEMON_NOTIFY, NULL, NULL))
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!conf_register(LADISH_CONF_KEY_DAEMON_SHELL, NULL, NULL))
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!conf_register(LADISH_CONF_KEY_DAEMON_TERMINAL, NULL, NULL))
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!conf_register(LADISH_CONF_KEY_DAEMON_STUDIO_AUTOSTART, NULL, NULL))
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-10-23 03:52:16 +03:00
|
|
|
if (!conf_register(LADISH_CONF_KEY_DAEMON_JS_SAVE_DELAY, NULL, NULL))
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-12-19 00:16:51 +02:00
|
|
|
if (!conf_register(LADISH_CONF_KEY_JACK_CONF_TOOL, NULL, NULL))
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-09-07 01:02:12 +03:00
|
|
|
if (!init_jack())
|
2009-08-22 15:06:29 +03:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-12-25 05:12:19 +02:00
|
|
|
if (!a2j_proxy_init())
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-08-20 00:51:27 +03:00
|
|
|
if (!control_proxy_init())
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-08-23 12:58:01 +03:00
|
|
|
if (!studio_proxy_init())
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-09-07 01:02:12 +03:00
|
|
|
set_studio_callbacks();
|
|
|
|
set_room_callbacks();
|
2009-08-23 12:58:01 +03:00
|
|
|
|
2009-08-22 16:59:40 +03:00
|
|
|
g_signal_connect(G_OBJECT(g_main_win), "destroy", G_CALLBACK(gtk_main_quit), NULL);
|
2010-02-07 19:37:23 +02:00
|
|
|
g_signal_connect(G_OBJECT(get_gtk_builder_widget("menu_item_quit")), "activate", G_CALLBACK(gtk_main_quit), NULL);
|
|
|
|
g_signal_connect(G_OBJECT(get_gtk_builder_widget("menu_item_view_arrange")), "activate", G_CALLBACK(arrange), NULL);
|
|
|
|
g_signal_connect(G_OBJECT(get_gtk_builder_widget("menu_item_help_about")), "activate", G_CALLBACK(show_about), NULL);
|
2010-02-19 01:28:51 +02:00
|
|
|
|
2009-08-22 16:59:40 +03:00
|
|
|
gtk_widget_show(g_main_win);
|
2009-08-17 05:30:31 +03:00
|
|
|
|
|
|
|
gtk_main();
|
|
|
|
|
2009-08-23 12:58:01 +03:00
|
|
|
studio_proxy_uninit();
|
2009-08-20 00:51:27 +03:00
|
|
|
control_proxy_uninit();
|
2010-12-25 05:12:19 +02:00
|
|
|
a2j_proxy_uninit();
|
2010-09-07 01:02:12 +03:00
|
|
|
uninit_jack();
|
2010-10-16 05:17:11 +03:00
|
|
|
menu_uninit();
|
2010-03-21 16:33:39 +02:00
|
|
|
create_room_dialog_uninit();
|
2010-10-16 01:39:06 +03:00
|
|
|
destroy_studio_lists();
|
2010-02-07 19:37:23 +02:00
|
|
|
uninit_gtk_builder();
|
2009-08-17 05:30:31 +03:00
|
|
|
|
2010-09-27 22:48:35 +03:00
|
|
|
conf_proxy_uninit();
|
|
|
|
dbus_uninit();
|
|
|
|
|
2009-07-20 04:59:25 +03:00
|
|
|
return 0;
|
2006-06-09 05:18:57 +03:00
|
|
|
}
|