static void on_load_project(const char * name, void * data) { log_info("Request to load project \"%s\":\"%s\"", name, (const char *)data); if (!ladish_room_proxy_load_project(graph_view_get_room(get_current_view()), data)) { error_message_box(_("Project load failed, please inspect logs.")); } }
static int selectdrive_menu_cb(ui_context * ctx, int event, int xpos, int ypos, int parameter) { int drive,ret; if(event) { drive = parameter; hxc_printf_box(ctx,"Init emulator I/O..."); deinit_fdc(); ret = mount_drive(ctx, drive); if( ret != ERR_NO_ERROR ) goto mounterror; ui_loadfilelistpage(ctx); } return MENU_LEAVEMENU; mounterror: deinit_fdc(); error_message_box(ctx, ret); // Fall back to the boot device... ret = mount_drive(ctx, ctx->bootdev); if( ret != ERR_NO_ERROR ) { error_message_box(ctx, ret); lockup(); } return MENU_REDRAWMENU; }
void menu_request_settings(void) { gint result; GtkDialog * dialog; GtkToggleButton * autostart_studio_button; GtkToggleButton * send_notifications_button; 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")); if (!conf_get_bool(LADISH_CONF_KEY_DAEMON_STUDIO_AUTOSTART, &autostart)) { autostart = LADISH_CONF_KEY_DAEMON_STUDIO_AUTOSTART_DEFAULT; } if (!conf_get_bool(LADISH_CONF_KEY_DAEMON_NOTIFY, ¬ify)) { notify = LADISH_CONF_KEY_DAEMON_NOTIFY_DEFAULT; } if (!conf_get(LADISH_CONF_KEY_DAEMON_SHELL, &shell)) { shell = LADISH_CONF_KEY_DAEMON_SHELL_DEFAULT; } if (!conf_get(LADISH_CONF_KEY_DAEMON_TERMINAL, &terminal)) { terminal = LADISH_CONF_KEY_DAEMON_TERMINAL_DEFAULT; } if (!conf_get_uint(LADISH_CONF_KEY_DAEMON_JS_SAVE_DELAY, &js_delay)) { 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); gtk_spin_button_set_value(js_delay_spin, js_delay); gtk_widget_show(GTK_WIDGET(dialog)); result = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_hide(GTK_WIDGET(dialog)); if (result != GTK_RESPONSE_OK) { return; } autostart = gtk_toggle_button_get_active(autostart_studio_button); notify = gtk_toggle_button_get_active(send_notifications_button); 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(LADISH_CONF_KEY_JACK_CONF_TOOL, jack_conf_tool)) { error_message_box(_("Storing settings")); } }
void on_popup_menu_action_app_properties(GtkWidget * UNUSED(menuitem), gpointer UNUSED(userdata)) { uint64_t id; ladish_app_supervisor_proxy_handle proxy; graph_view_handle view; char * name; char * command; bool running; bool terminal; const char * level; guint result; GtkEntry * command_entry = GTK_ENTRY(get_gtk_builder_widget("app_command_entry")); GtkEntry * name_entry = GTK_ENTRY(get_gtk_builder_widget("app_name_entry")); GtkToggleButton * terminal_button = GTK_TOGGLE_BUTTON(get_gtk_builder_widget("app_terminal_check_button")); GtkToggleButton * level0_button = GTK_TOGGLE_BUTTON(get_gtk_builder_widget("app_level0")); GtkToggleButton * level1_button = GTK_TOGGLE_BUTTON(get_gtk_builder_widget("app_level1")); GtkToggleButton * level2lash_button = GTK_TOGGLE_BUTTON(get_gtk_builder_widget("app_level2lash")); GtkToggleButton * level2js_button = GTK_TOGGLE_BUTTON(get_gtk_builder_widget("app_level2js")); if (!get_selected_app_id(&view, &id)) { return; } log_info("app %"PRIu64" properties", id); proxy = graph_view_get_app_supervisor(view); if (!ladish_app_supervisor_get_app_properties(proxy, id, &name, &command, &running, &terminal, &level)) { error_message_box(_("Cannot get app properties")); return; } log_info("'%s':'%s' %s level '%s'", name, command, terminal ? "terminal" : "shell", level); gtk_entry_set_text(name_entry, name); gtk_entry_set_text(command_entry, command); gtk_toggle_button_set_active(terminal_button, terminal); gtk_widget_set_sensitive(GTK_WIDGET(command_entry), !running); gtk_widget_set_sensitive(GTK_WIDGET(terminal_button), !running); gtk_widget_set_sensitive(GTK_WIDGET(level0_button), !running); gtk_widget_set_sensitive(GTK_WIDGET(level1_button), !running); gtk_widget_set_sensitive(GTK_WIDGET(level2lash_button), !running); gtk_widget_set_sensitive(GTK_WIDGET(level2js_button), !running && is_room_view(view)); /* comparing pointers here is ok, because ladish_map_app_level_constant() was called by ladish_app_supervisor_get_app_properties() */ if (level == LADISH_APP_LEVEL_0) { gtk_toggle_button_set_active(level0_button, TRUE); } else if (level == LADISH_APP_LEVEL_1) { gtk_toggle_button_set_active(level1_button, TRUE); } else if (level == LADISH_APP_LEVEL_LASH) { gtk_toggle_button_set_active(level2lash_button, TRUE); } else if (level == LADISH_APP_LEVEL_JACKSESSION) { gtk_toggle_button_set_active(level2js_button, TRUE); } else { log_error("unknown level"); ASSERT_NO_PASS; gtk_toggle_button_set_active(level0_button, TRUE); } free(name); free(command); gtk_window_set_focus(GTK_WINDOW(g_app_dialog), running ? GTK_WIDGET(name_entry) : GTK_WIDGET(command_entry)); gtk_window_set_title(GTK_WINDOW(g_app_dialog), _("App properties")); gtk_widget_show(g_app_dialog); result = gtk_dialog_run(GTK_DIALOG(g_app_dialog)); if (result == 2) { if (gtk_toggle_button_get_active(level0_button)) { level = LADISH_APP_LEVEL_0; } else if (gtk_toggle_button_get_active(level1_button)) { level = LADISH_APP_LEVEL_1; } else if (gtk_toggle_button_get_active(level2lash_button)) { level = LADISH_APP_LEVEL_LASH; } else if (gtk_toggle_button_get_active(level2js_button)) { level = LADISH_APP_LEVEL_JACKSESSION; } else { log_error("unknown level"); ASSERT_NO_PASS; level = LADISH_APP_LEVEL_0; } log_info("'%s':'%s' %s level '%s'", gtk_entry_get_text(name_entry), gtk_entry_get_text(command_entry), gtk_toggle_button_get_active(terminal_button) ? "terminal" : "shell", level); if (!ladish_app_supervisor_set_app_properties(proxy, id, gtk_entry_get_text(name_entry), gtk_entry_get_text(command_entry), gtk_toggle_button_get_active(terminal_button), level)) { error_message_box(_("Cannot set app properties.")); } } gtk_widget_hide(g_app_dialog); }