int main(int argc, char *argv[]) { if(open_database()) create_medialib(); else { g_print("错误:无法打开数据库。"); return 1; } link_t mlink = {NULL, 0}; link_t plink = {NULL, 0}; load_medialib(&mlink, 0); main_core(GENERAL_MEDIALIB_INIT, &mlink); main_core(GENERAL_PLAYLIST_INIT, &plink); gtk_init(&argc, &argv); InterFace ui; ui.winMain = create_winMain(&ui); ui.diaMedialib = create_diaMedialib(&ui); ui.diaPlaylist = create_diaPlaylist(&ui); ui.diaVolume = create_diaVolume(&ui); gtk_widget_show(ui.winMain); g_signal_connect(G_OBJECT(ui.winMain), "delete_event", G_CALLBACK(gtk_main_quit), NULL); gtk_main(); link_del_all(&mlink); link_del_all(&plink); close_database(); return 0; }
int main (int argc, char *argv[]) { gchar *path, *path1, *path2; #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); #endif gtk_set_locale (); gtk_init (&argc, &argv); add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps"); path = g_path_get_dirname(argv[0]); path1 = g_build_filename(path, "pixmaps", NULL); path2 = g_build_filename(path, "..", "pixmaps", NULL); add_pixmap_directory (path1); add_pixmap_directory (path2); add_pixmap_directory (path); g_free(path); g_free(path1); g_free(path2); /* * The following code was added by Glade to create one of each component * (except popup menus), just so that you see something after building * the project. Delete any components that you don't want shown initially. */ winMain = create_winMain (); init_stuff (argc, argv); gtk_window_set_icon(GTK_WINDOW(winMain), create_pixbuf("xournal.png")); gtk_main (); if (bgpdf.status != STATUS_NOT_INIT) shutdown_bgpdf(); save_mru_list(); autosave_cleanup(&ui.autosave_filename_list); if (ui.auto_save_prefs) save_config_to_file(); return 0; }
int main (int argc, char *argv[]) { int c; char *str_addr; gtk_set_locale (); gtk_init (&argc, &argv); if (!g_thread_supported()) { g_thread_init(NULL); } gdk_threads_init(); gdk_threads_enter(); /* cwiid_set_err(err); */ /* Parse Options */ while ((c = getopt(argc, argv, OPTSTRING)) != -1) { switch (c) { case 'h': printf(USAGE, argv[0]); return 0; break; case '?': return -1; break; default: printf("unknown command-line option: -%c\n", c); break; } } /* BDADDR */ if (optind < argc) { if (str2ba(argv[optind], &bdaddr)) { printf("invalid bdaddr\n"); bdaddr = *BDADDR_ANY; } optind++; if (optind < argc) { printf("invalid command-line\n"); printf(USAGE, argv[0]); return -1; } } else if ((str_addr = getenv(WIIMOTE_BDADDR)) != NULL) { if (str2ba(str_addr, &bdaddr)) { printf("invalid address in %s\n", WIIMOTE_BDADDR); bdaddr = *BDADDR_ANY; } } else { bdaddr = *BDADDR_ANY; } /* Create the window */ winMain = create_winMain(); winRW = create_winRW(); /* Lookup Widgets */ menuConnect = lookup_widget(winMain, "menuConnect"); menuDisconnect = lookup_widget(winMain, "menuDisconnect"); menuQuit = lookup_widget(winMain, "menuQuit"); menuRW = lookup_widget(winMain, "menuRW"); menuAbout = lookup_widget(winMain, "menuAbout"); chkAcc = lookup_widget(winMain, "chkAcc"); chkIR = lookup_widget(winMain, "chkIR"); chkExt = lookup_widget(winMain, "chkExt"); chkLED1 = lookup_widget(winMain, "chkLED1"); chkLED2 = lookup_widget(winMain, "chkLED2"); chkLED3 = lookup_widget(winMain, "chkLED3"); chkLED4 = lookup_widget(winMain, "chkLED4"); chkRumble = lookup_widget(winMain, "chkRumble"); evUp = lookup_widget(winMain, "evUp"); evDown = lookup_widget(winMain, "evDown"); evLeft = lookup_widget(winMain, "evLeft"); evRight = lookup_widget(winMain, "evRight"); evA = lookup_widget(winMain, "evA"); evB = lookup_widget(winMain, "evB"); evMinus = lookup_widget(winMain, "evMinus"); evPlus = lookup_widget(winMain, "evPlus"); evHome = lookup_widget(winMain, "evHome"); ev1 = lookup_widget(winMain, "ev1"); ev2 = lookup_widget(winMain, "ev2"); lblUp = lookup_widget(winMain, "lblUp"); lblDown = lookup_widget(winMain, "lblDown"); lblLeft = lookup_widget(winMain, "lblLeft"); lblRight = lookup_widget(winMain, "lblRight"); lblA = lookup_widget(winMain, "lblA"); lblB = lookup_widget(winMain, "lblB"); lblMinus = lookup_widget(winMain, "lblMinus"); lblPlus = lookup_widget(winMain, "lblPlus"); lblHome = lookup_widget(winMain, "lblHome"); lbl1 = lookup_widget(winMain, "lbl1"); lbl2 = lookup_widget(winMain, "lbl2"); lblAccX = lookup_widget(winMain, "lblAccX"); lblAccY = lookup_widget(winMain, "lblAccY"); lblAccZ = lookup_widget(winMain, "lblAccZ"); lblAccXVal = lookup_widget(winMain, "lblAccXVal"); lblAccYVal = lookup_widget(winMain, "lblAccYVal"); lblAccZVal = lookup_widget(winMain, "lblAccZVal"); progAccX = lookup_widget(winMain, "progAccX"); progAccY = lookup_widget(winMain, "progAccY"); progAccZ = lookup_widget(winMain, "progAccZ"); lblAcc = lookup_widget(winMain, "lblAcc"); lblRoll = lookup_widget(winMain, "lblRoll"); lblPitch = lookup_widget(winMain, "lblPitch"); lblAccVal = lookup_widget(winMain, "lblAccVal"); lblRollVal = lookup_widget(winMain, "lblRollVal"); lblPitchVal = lookup_widget(winMain, "lblPitchVal"); lblIR = lookup_widget(winMain, "lblIR"); drawIR = lookup_widget(winMain, "drawIR"); lblNC = lookup_widget(winMain, "lblNC"); drawNCStick = lookup_widget(winMain, "drawNCStick"); evNCC = lookup_widget(winMain, "evNCC"); evNCZ = lookup_widget(winMain, "evNCZ"); lblNCC = lookup_widget(winMain, "lblNCC"); lblNCZ = lookup_widget(winMain, "lblNCZ"); lblNCAccX = lookup_widget(winMain, "lblNCAccX"); lblNCAccY = lookup_widget(winMain, "lblNCAccY"); lblNCAccZ = lookup_widget(winMain, "lblNCAccZ"); lblNCAccXVal = lookup_widget(winMain, "lblNCAccXVal"); lblNCAccYVal = lookup_widget(winMain, "lblNCAccYVal"); lblNCAccZVal = lookup_widget(winMain, "lblNCAccZVal"); progNCAccX = lookup_widget(winMain, "progNCAccX"); progNCAccY = lookup_widget(winMain, "progNCAccY"); progNCAccZ = lookup_widget(winMain, "progNCAccZ"); lblNCAcc = lookup_widget(winMain, "lblNCAcc"); lblNCRoll = lookup_widget(winMain, "lblNCRoll"); lblNCPitch = lookup_widget(winMain, "lblNCPitch"); lblNCAccVal = lookup_widget(winMain, "lblNCAccVal"); lblNCRollVal = lookup_widget(winMain, "lblNCRollVal"); lblNCPitchVal = lookup_widget(winMain, "lblNCPitchVal"); evCCUp = lookup_widget(winMain, "evCCUp"); evCCDown = lookup_widget(winMain, "evCCDown"); evCCLeft = lookup_widget(winMain, "evCCLeft"); evCCRight = lookup_widget(winMain, "evCCRight"); evCCMinus = lookup_widget(winMain, "evCCMinus"); evCCPlus = lookup_widget(winMain, "evCCPlus"); evCCHome = lookup_widget(winMain, "evCCHome"); evCCA = lookup_widget(winMain, "evCCA"); evCCB = lookup_widget(winMain, "evCCB"); evCCX = lookup_widget(winMain, "evCCX"); evCCY = lookup_widget(winMain, "evCCY"); evCCZL = lookup_widget(winMain, "evCCZL"); evCCZR = lookup_widget(winMain, "evCCZR"); lblCCUp = lookup_widget(winMain, "lblCCUp"); lblCCDown = lookup_widget(winMain, "lblCCDown"); lblCCLeft = lookup_widget(winMain, "lblCCLeft"); lblCCRight = lookup_widget(winMain, "lblCCRight"); lblCCMinus = lookup_widget(winMain, "lblCCMinus"); lblCCPlus = lookup_widget(winMain, "lblCCPlus"); lblCCHome = lookup_widget(winMain, "lblCCHome"); lblCCA = lookup_widget(winMain, "lblCCA"); lblCCB = lookup_widget(winMain, "lblCCB"); lblCCX = lookup_widget(winMain, "lblCCX"); lblCCY = lookup_widget(winMain, "lblCCY"); lblCCZL = lookup_widget(winMain, "lblCCZL"); lblCCZR = lookup_widget(winMain, "lblCCZR"); drawCCLStick = lookup_widget(winMain, "drawCCLStick"); drawCCRStick = lookup_widget(winMain, "drawCCRStick"); evCCL = lookup_widget(winMain, "evCCL"); evCCR = lookup_widget(winMain, "evCCR"); lblCCL = lookup_widget(winMain, "lblCCL"); lblCCR = lookup_widget(winMain, "lblCCR"); lblCCLVal = lookup_widget(winMain, "lblCCLVal"); lblCCRVal = lookup_widget(winMain, "lblCCRVal"); progCCL = lookup_widget(winMain, "progCCL"); progCCR = lookup_widget(winMain, "progCCR"); lblMPPhi = lookup_widget(winMain, "lblMPPhi"); lblMPTheta = lookup_widget(winMain, "lblMPTheta"); lblMPPsi = lookup_widget(winMain, "lblMPPsi"); lblMPPhiVal = lookup_widget(winMain, "lblMPPhiVal"); lblMPThetaVal = lookup_widget(winMain, "lblMPThetaVal"); lblMPPsiVal = lookup_widget(winMain, "lblMPPsiVal"); evMPPhiSlow = lookup_widget(winMain, "evMPPhiSlow"); evMPThetaSlow = lookup_widget(winMain, "evMPThetaSlow"); evMPPsiSlow = lookup_widget(winMain, "evMPPsiSlow"); lblMPPhiSlow = lookup_widget(winMain, "lblMPPhiSlow"); lblMPThetaSlow = lookup_widget(winMain, "lblMPThetaSlow"); lblMPPsiSlow = lookup_widget(winMain, "lblMPPsiSlow"); progMPPhi = lookup_widget(winMain, "progMPPhi"); progMPTheta = lookup_widget(winMain, "progMPTheta"); progMPPsi = lookup_widget(winMain, "progMPPsi"); statConnection = lookup_widget(winMain, "statConnection"); statBattery = lookup_widget(winMain, "statBattery"); statExtension = lookup_widget(winMain, "statExtension"); txtReadOffset = lookup_widget(winRW, "txtReadOffset"); txtReadLen = lookup_widget(winRW, "txtReadLen"); radReadEEPROM = lookup_widget(winRW, "radReadEEPROM"); radReadReg = lookup_widget(winRW, "radReadReg"); btnRead = lookup_widget(winRW, "btnRead"); txtWriteOffset = lookup_widget(winRW, "txtWriteOffset"); txtWriteData = lookup_widget(winRW, "txtWriteData"); radWriteEEPROM = lookup_widget(winRW, "radWriteEEPROM"); radWriteReg = lookup_widget(winRW, "radWriteReg"); btnWrite = lookup_widget(winRW, "btnWrite"); tvRW = lookup_widget(winRW, "tvRW"); btnRWClose = lookup_widget(winRW, "btnRWClose"); btnBeep = lookup_widget(winMain, "btnBeep"); tbRW = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tvRW)); /* Connect Callbacks */ g_signal_connect(winMain, "delete_event", G_CALLBACK(winMain_delete_event), NULL); g_signal_connect(winRW, "delete_event", G_CALLBACK(winRW_delete_event), NULL); g_signal_connect(menuConnect, "activate", G_CALLBACK(menuConnect_activate), NULL); g_signal_connect(menuDisconnect, "activate", G_CALLBACK(menuDisconnect_activate), NULL); g_signal_connect(menuQuit, "activate", G_CALLBACK(menuQuit_activate), NULL); g_signal_connect(menuRW, "activate", G_CALLBACK(menuRW_activate), NULL); g_signal_connect(menuAbout, "activate", G_CALLBACK(menuAbout_activate), NULL); g_signal_connect(chkAcc, "toggled", G_CALLBACK(chkAcc_toggled), NULL); g_signal_connect(chkIR, "toggled", G_CALLBACK(chkIR_toggled), NULL); g_signal_connect(chkExt, "toggled", G_CALLBACK(chkExt_toggled), NULL); g_signal_connect(chkLED1, "toggled", G_CALLBACK(chkLED_toggled), NULL); g_signal_connect(chkLED2, "toggled", G_CALLBACK(chkLED_toggled), NULL); g_signal_connect(chkLED3, "toggled", G_CALLBACK(chkLED_toggled), NULL); g_signal_connect(chkLED4, "toggled", G_CALLBACK(chkLED_toggled), NULL); g_signal_connect(chkRumble, "toggled", G_CALLBACK(chkRumble_toggled), NULL); g_signal_connect(drawIR, "expose_event", G_CALLBACK(drawIR_expose_event), NULL); g_signal_connect(drawNCStick, "expose_event", G_CALLBACK(drawStick_expose_event), &nc_stick); g_signal_connect(drawCCLStick, "expose_event", G_CALLBACK(drawStick_expose_event), &cc_l_stick); g_signal_connect(drawCCRStick, "expose_event", G_CALLBACK(drawStick_expose_event), &cc_r_stick); g_signal_connect(btnRead, "clicked", G_CALLBACK(btnRead_clicked), NULL); g_signal_connect(btnWrite, "clicked", G_CALLBACK(btnWrite_clicked), NULL); g_signal_connect(btnRWClose, "clicked", G_CALLBACK(btnRWClose_clicked), NULL); g_signal_connect(btnBeep, "clicked", G_CALLBACK(btnBeep_clicked), NULL); /* Initialize */ btn_on.red = 0; btn_on.blue = 0; btn_on.green = 0xFFFF; btn_off = gtk_widget_get_style(evUp)->bg[GTK_STATE_NORMAL]; nc_stick.max = 0xFF; cc_l_stick.max = CWIID_CLASSIC_L_STICK_MAX; cc_r_stick.max = CWIID_CLASSIC_R_STICK_MAX; set_gui_state(); clear_widgets(); status("No connection"); gtk_widget_show(winMain); gtk_main(); gdk_threads_leave(); return 0; }