setting for jack conf tool

This commit is contained in:
Nedko Arnaudov 2011-12-19 00:16:51 +02:00
parent d66d57ae8a
commit e85a6e96fe
5 changed files with 56 additions and 4 deletions

View File

@ -94,4 +94,7 @@
#define LADISH_DBUS_ERROR_UNFINISHED_TASK DBUS_NAME_BASE ".Error.UnfinishedTask"
#define LADISH_DBUS_ERROR_KEY_NOT_FOUND DBUS_NAME_BASE ".Error.KeyNotFound"
#define LADISH_CONF_KEY_JACK_CONF_TOOL "/org/ladish/jack_conf_tool"
#define LADISH_CONF_KEY_JACK_CONF_TOOL_DEFAULT "ladiconf"
#endif /* #ifndef DBUS_CONSTANTS_H__C21DE0EE_C19C_42F0_8D63_D613E4806C0E__INCLUDED */

View File

@ -1741,7 +1741,7 @@ along with LADI Session Handler; if not, write to the Free Software Foundation,
<object class="GtkTable" id="settings_string_table">
<property name="column_spacing">5</property>
<property name="n_columns">2</property>
<property name="n_rows">3</property>
<property name="n_rows">4</property>
<property name="row_spacing">5</property>
<property name="visible">True</property>
<child>
@ -1813,6 +1813,30 @@ along with LADI Session Handler; if not, write to the Free Software Foundation,
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="settings_jack_conf_tool_label">
<property name="label" translatable="yes">JACK conf tool:</property>
<property name="visible">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="bottom_attach">4</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="settings_jack_conf_tool_entry">
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
<property name="visible">True</property>
</object>
<packing>
<property name="bottom_attach">4</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>

View File

@ -34,6 +34,7 @@
#include "action.h"
#include "../proxies/jack_proxy.h"
#include "../proxies/a2j_proxy.h"
#include "../proxies/conf_proxy.h"
#include "gtk_builder.h"
#include "ask_dialog.h"
@ -282,11 +283,19 @@ void menu_request_a2jmidid_exit(void)
void menu_request_jack_configure(void)
{
GError * error_ptr;
gchar * argv[] = {"ladiconf", NULL};
gchar * argv[] = {NULL, NULL};
GtkWidget * dialog;
const char * jack_conf_tool;
log_info("JACK configure request");
if (!conf_get(LADISH_CONF_KEY_JACK_CONF_TOOL, &jack_conf_tool))
{
jack_conf_tool = LADISH_CONF_KEY_JACK_CONF_TOOL_DEFAULT;
}
argv[0] = (gchar *)jack_conf_tool;
error_ptr = NULL;
if (!g_spawn_async(
NULL, /* working directory */
@ -299,7 +308,7 @@ void menu_request_jack_configure(void)
&error_ptr))
{
dialog = get_gtk_builder_widget("error_dialog");
gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), _("<b><big>Error executing ladiconf.\nAre LADI Tools installed?</big></b>"));
gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), _("<b><big>Error executing JACK configuration tool.\n</big></b>"));
gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog), "%s", error_ptr->message);
gtk_widget_show(dialog);
gtk_dialog_run(GTK_DIALOG(dialog));

View File

@ -166,6 +166,11 @@ int main(int argc, char** argv)
return 1;
}
if (!conf_register(LADISH_CONF_KEY_JACK_CONF_TOOL, NULL, NULL))
{
return 1;
}
if (!init_jack())
{
return 1;

View File

@ -38,17 +38,20 @@ void menu_request_settings(void)
GtkEntry * shell_entry;
GtkEntry * terminal_entry;
GtkSpinButton * js_delay_spin;
GtkEntry * jack_conf_tool_entry;
bool autostart;
bool notify;
const char * shell;
const char * terminal;
unsigned int js_delay;
const char * jack_conf_tool;
autostart_studio_button = GTK_TOGGLE_BUTTON(get_gtk_builder_widget("settings_studio_autostart_checkbutton"));
send_notifications_button = GTK_TOGGLE_BUTTON(get_gtk_builder_widget("settings_send_notifications_checkbutton"));
shell_entry = GTK_ENTRY(get_gtk_builder_widget("settings_shell_entry"));
terminal_entry = GTK_ENTRY(get_gtk_builder_widget("settings_terminal_entry"));
js_delay_spin = GTK_SPIN_BUTTON(get_gtk_builder_widget("settings_js_delay_spin"));
jack_conf_tool_entry = GTK_ENTRY(get_gtk_builder_widget("settings_jack_conf_tool_entry"));
dialog = GTK_DIALOG(get_gtk_builder_widget("settings_dialog"));
@ -77,11 +80,17 @@ void menu_request_settings(void)
js_delay = LADISH_CONF_KEY_DAEMON_JS_SAVE_DELAY_DEFAULT;
}
if (!conf_get(LADISH_CONF_KEY_JACK_CONF_TOOL, &jack_conf_tool))
{
jack_conf_tool = LADISH_CONF_KEY_JACK_CONF_TOOL_DEFAULT;
}
gtk_toggle_button_set_active(autostart_studio_button, autostart);
gtk_toggle_button_set_active(send_notifications_button, notify);
gtk_entry_set_text(shell_entry, shell);
gtk_entry_set_text(terminal_entry, terminal);
gtk_entry_set_text(jack_conf_tool_entry, jack_conf_tool);
gtk_spin_button_set_range(js_delay_spin, 0, 1000);
gtk_spin_button_set_increments(js_delay_spin, 1, 2);
@ -100,12 +109,14 @@ void menu_request_settings(void)
shell = gtk_entry_get_text(shell_entry);
terminal = gtk_entry_get_text(terminal_entry);
js_delay = gtk_spin_button_get_value(js_delay_spin);
jack_conf_tool = gtk_entry_get_text(jack_conf_tool_entry);
if (!conf_set_bool(LADISH_CONF_KEY_DAEMON_STUDIO_AUTOSTART, autostart) ||
!conf_set_bool(LADISH_CONF_KEY_DAEMON_NOTIFY, notify) ||
!conf_set(LADISH_CONF_KEY_DAEMON_SHELL, shell) ||
!conf_set(LADISH_CONF_KEY_DAEMON_TERMINAL, terminal) ||
!conf_set_uint(LADISH_CONF_KEY_DAEMON_JS_SAVE_DELAY, js_delay))
!conf_set_uint(LADISH_CONF_KEY_DAEMON_JS_SAVE_DELAY, js_delay) ||
!conf_set(LADISH_CONF_KEY_JACK_CONF_TOOL, jack_conf_tool))
{
error_message_box(_("Storing settings"));
}