static void init_window(t_ctxt *ctxt) /* * Initialise the main window features */ { GtkWidget *win; gchar *title; GtkWidget *hbox; GtkWidget *vbox; title = mk_win_title("MIDI Device", USR(ctxt)->dev->name); init_win_ctxt(title, ctxt); FREE(title); win = ctxt->win; /* Window widget */ hbox = gtk_hbox_new(FALSE, 0); vbox = gtk_vbox_new(FALSE, PAD); add_text_fields(vbox, ctxt); add_buttons(vbox, ctxt); connect_callbacks(ctxt); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, PAD); gtk_container_add(GTK_CONTAINER(win), hbox); gtk_widget_show_all(win); } /* init_window() */
void config_plugin_config_window(void) { #if ENABLE_NLS setlocale(LC_MESSAGES, ""); bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); textdomain(GETTEXT_PACKAGE); #endif if (configure_dialog) { set_config_values(configure_dialog); config_dialog_show(configure_dialog); return; } config_plugin_load_prefs(); if (!config_is_initialized()) config_set_default_values(); configure_dialog = config_dialog_new(); set_config_values(configure_dialog); connect_callbacks(configure_dialog); config_dialog_show(configure_dialog); }
/** * construct_workspaces: * @plugin: the xfce plugin object * * Create the plugin. * * Returns: the plugin */ static i3WorkspacesPlugin * construct_workspaces(XfcePanelPlugin *plugin) { i3WorkspacesPlugin *i3_workspaces; GtkOrientation orientation; /* allocate memory for the plugin structure */ i3_workspaces = panel_slice_new0(i3WorkspacesPlugin); /* pointer to plugin */ i3_workspaces->plugin = plugin; /* plugin configuration */ i3_workspaces->config = i3_workspaces_config_new(); i3_workspaces_config_load(i3_workspaces->config, plugin); /* get the current orientation */ orientation = xfce_panel_plugin_get_orientation (plugin); /* create some panel widgets */ i3_workspaces->ebox = gtk_event_box_new(); gtk_widget_show(i3_workspaces->ebox); /* listen for scroll events */ gtk_widget_add_events(i3_workspaces->ebox, GDK_SCROLL_MASK); g_signal_connect(G_OBJECT(i3_workspaces->ebox), "scroll-event", G_CALLBACK(on_workspace_scrolled), i3_workspaces); i3_workspaces->hvbox = xfce_hvbox_new(orientation, FALSE, 2); gtk_widget_show(i3_workspaces->hvbox); gtk_container_add(GTK_CONTAINER(i3_workspaces->ebox), i3_workspaces->hvbox); i3_workspaces->workspace_buttons = g_hash_table_new(g_direct_hash, g_direct_equal); GError *err = NULL; i3_workspaces->i3wm = i3wm_construct(&err); if (NULL != err) { //TODO: error_state_on(); recover_from_disconnect(i3_workspaces); //TODO: error_state_off(); } connect_callbacks(i3_workspaces); add_workspaces(i3_workspaces); return i3_workspaces; }
static void on_ipc_shutdown(gpointer i3_w) { i3WorkspacesPlugin *i3_workspaces = (i3WorkspacesPlugin *) i3_w; remove_workspaces(i3_workspaces); i3wm_destruct(i3_workspaces->i3wm); i3_workspaces->i3wm = NULL; recover_from_disconnect(i3_workspaces); connect_callbacks(i3_workspaces); add_workspaces(i3_workspaces); }
static void init_window(t_ctxt *ctxt) /* * Initialise the main window features; the scrolling region, the * buttons etc */ { GtkWidget *win; gchar *title; GtkWidget *hbox; GtkWidget *vbox; GtkWidget *bbox; /* Buttons box */ t_usr_ctxt *usr; usr = ctxt->usr; title = mk_win_title("Cue", usr->cue->name); init_win_ctxt(title, ctxt); FREE(title); win = ctxt->win; hbox = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(win), hbox); vbox = gtk_vbox_new(FALSE, PAD); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, PAD); add_text_fields(vbox, ctxt); add_follow_fields(vbox, ctxt); add_delay_fields(vbox, ctxt); /*gtk_window_set_default_size(GTK_WINDOW(ctxt->win), 400, 400);*/ bbox = add_edit_btns(win, "Notes", &(usr->cue->notes), NULL, (GCallback)btn_ok_callback, ctxt); gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); connect_callbacks(ctxt); gtk_widget_show_all(win); } /* init_window() */
/* Create a new generic device, and return its number (starting in 1), or zero * in case of error. */ int emu_generic_init(char* filename, double device_cycles_per_cpu_cycle) { GModule *generic_mod; gchar *path, *type; GtkWidget *debug_item; GtkWidget *table, *label; gint row, col, i; SYNC_TYPE* sync; if(generic_count >= MAX_GENERIC) { g_error("There is a limit of %d devices.", generic_count); return 0; } if(emu_mem_size() == 0) { emu_error("The memory size wasn't set yet!"); return 0; } /* create path (g_module_open requires a full path) */ if(filename[0] == '.' || filename[0] == '/' || filename[0] == '~') path = g_strdup_printf("%s", filename); else path = g_strdup_printf("./%s", filename); /* open module */ generic_mod = g_module_open(path, G_MODULE_BIND_LAZY); if(!generic_mod) { g_error("%s: invalid Generic Device file (%s)", path, g_module_error()); return 0; } /* check if it's really a generic device */ if(!g_module_symbol(generic_mod, "dev_type", (gpointer*)&type)) g_error("variable dev_type not defined in %s", path); if(strcmp(type, "generic")) g_error("%s not a Generic Device file.", path); /* Connect functions */ if(!g_module_symbol(generic_mod, "dev_generic_name", (gpointer*)&emu_generic_name[generic_count])) g_error("variable dev_generic_name not defined in %s", path); if(!g_module_symbol(generic_mod, "dev_generic_sync_type", (gpointer*)&sync)) g_error("variable dev_generic_sync_type is not defined"); /* TODO - can't load generic device synched with video if there's no video */ emu_generic_sync[generic_count] = *sync; emu_generic_cycles[generic_count] = device_cycles_per_cpu_cycle; if(!g_module_symbol(generic_mod, "dev_generic_reset", (void*)&emu_generic_reset[generic_count])) g_error("variable dev_generic_reset not defined in %s", path); if(!g_module_symbol(generic_mod, "dev_generic_step", (void*)&emu_generic_step[generic_count])) g_error("variable dev_generic_step not defined in %s", path); if(!g_module_symbol(generic_mod, "dev_generic_memory_set", (void*)&emu_generic_memory_set[generic_count])) g_error("variable dev_generic_memory_set not defined in %s", path); if(!g_module_symbol(generic_mod, "dev_generic_debug_name", (void*)&emu_generic_debug_name[generic_count])) g_error("variable dev_generic_debug_name not defined in %s", path); if(!g_module_symbol(generic_mod, "dev_generic_debug", (void*)&emu_generic_debug[generic_count])) g_error("variable dev_generic_debug not defined in %s", path); /* Connect callbacks */ if(!connect_callbacks(generic_mod)) g_error("Generic Device callbacks couldn't be connected in %s", path); g_message("Generic Device %s loaded from %s", emu_generic_name[generic_count], path); /* Add a new menu option */ debug_item = button_with_pixmap_image(emu_generic_name[generic_count], P_DEVICE, TRUE); gtk_box_pack_start_defaults(GTK_BOX(internal_hbox), debug_item); /* Create window */ generic_window[generic_count] = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(generic_window[generic_count]), emu_generic_name[generic_count]); gtk_window_set_destroy_with_parent(GTK_WINDOW(generic_window[generic_count]), TRUE); g_signal_connect(debug_item, "toggled", G_CALLBACK(generic_show_hide), generic_window[generic_count]); g_signal_connect(generic_window[generic_count], "delete_event", G_CALLBACK(generic_hide), debug_item); /* Create table */ table = gtk_table_new(1, 2, FALSE); gtk_container_set_border_width(GTK_CONTAINER(table), 12); gtk_table_set_row_spacings(GTK_TABLE(table), 6); gtk_table_set_col_spacings(GTK_TABLE(table), 6); /* Add registers to table */ row = 0; col = 0; i = 0 ; while(emu_generic_debug_name[generic_count](i)) { gtk_table_attach(GTK_TABLE(table), gtk_label_new(emu_generic_debug_name[generic_count](i)), col, col+1, row, row+1, GTK_SHRINK, GTK_SHRINK, 0, 0); generic_register[generic_count][i] = gtk_entry_new(); gtk_entry_set_width_chars(GTK_ENTRY(generic_register[generic_count][i]), 4); gtk_table_attach_defaults(GTK_TABLE(table), generic_register[generic_count][i], col+1, col+2, row, row+1); row++; if(row >= MAX_VERTICAL) { row = 0; col += 2; } i++; } num_registers[generic_count] = i; emu_generic_reset[generic_count](); gtk_container_add(GTK_CONTAINER(generic_window[generic_count]), table); gtk_widget_show_all(table); generic_count++; return generic_count-1; }