void do_defaults(char *session, Config * cfg) { if (session) load_settings(session, TRUE, cfg); else load_settings("Default Settings", FALSE, cfg); }
status_t init_driver() { status_t status = get_module(B_USB_MODULE_NAME, (module_info **)&gUSBModule); if (status < B_OK) return status; load_settings(); TRACE_ALWAYS("%s\n", kVersion); for (int32 i = 0; i < MAX_DEVICES; i++) gDavicomDevices[i] = NULL; gDeviceNames[0] = NULL; mutex_init(&gDriverLock, DRIVER_NAME"_devices"); static usb_notify_hooks notifyHooks = { &usb_davicom_device_added, &usb_davicom_device_removed }; gUSBModule->register_driver(DRIVER_NAME, 0, 0, NULL); gUSBModule->install_notify(DRIVER_NAME, ¬ifyHooks); return B_OK; }
NBodySim::NBodySim(std::istream & s) { load_default_settings(); load_settings(s); initialize(); }
MateVFSMethod * vfs_module_init (const char *method_name, const char *args) { char *conf_file; LIBXML_TEST_VERSION conf_file = getenv (TEST_CONF_ENV_VARIABLE); if (conf_file == NULL) { conf_file = MATE_VFS_PREFIX "/etc/vfs/Test-conf.xml"; } if (load_settings (conf_file) == FALSE) { /* FIXME: we probably shouldn't use printf to output the message */ printf (_("Didn't find a valid settings file at %s\n"), conf_file); printf (_("Use the %s environment variable to specify a different location.\n"), TEST_CONF_ENV_VARIABLE); properly_initialized = FALSE; } else { properly_initialized = TRUE; } return &method; }
status_t init_driver() { status_t status = get_module(B_USB_MODULE_NAME, (module_info**)&gUSBModule); if (status < B_OK) return status; load_settings(); TRACE(ERR, "%s\n", kVersion); // TODO: always??? for (int32 i = 0; i < MAX_DEVICES; i++) gDevices[i] = NULL; gDeviceNames[0] = NULL; mutex_init(&gDriverLock, DRIVER_NAME"_devices"); static usb_notify_hooks notifyHooks = { &usb_audio_device_added, &usb_audio_device_removed }; static usb_support_descriptor supportedDevices[] = { { USB_AUDIO_INTERFACE_AUDIO_CLASS, 0, 0, 0, 0 } }; gUSBModule->register_driver(DRIVER_NAME, supportedDevices, 0, NULL); gUSBModule->install_notify(DRIVER_NAME, ¬ifyHooks); return B_OK; }
int main(int argc, char *argv[]) { pthread_t thread; /* init threads */ g_thread_init (NULL); gdk_threads_init (); gdk_threads_enter (); gtk_init(&argc, &argv); initApp(); appdata->program = HILDON_PROGRAM(hildon_program_get_instance()); g_set_application_name("Webview"); appdata->window = HILDON_WINDOW(hildon_window_new()); hildon_program_add_window(appdata->program, appdata->window); create_menu(appdata->window); build_interface(appdata->window); /* Connect signal to X in the upper corner */ g_signal_connect(G_OBJECT(appdata->window), "delete_event", G_CALLBACK(destroy), NULL); update_image(); load_settings(); gtk_widget_show_all(GTK_WIDGET(appdata->window)); if(! start_camera(appdata->window)) { g_warning("Unable to start camera\n"); GtkWidget *failDialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Unable to start camera\n"); gtk_dialog_run (GTK_DIALOG (failDialog)); gtk_widget_destroy (failDialog); } if(! start_webserver()) { GtkWidget *failDialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Unable to start web server.\nCheck server port is not already in use.\n"); gtk_dialog_run (GTK_DIALOG (failDialog)); gtk_widget_destroy (failDialog); } sleep(1); pthread_create(&thread, NULL, count_down_thread, NULL); gtk_main(); gdk_threads_leave (); return( 0 ); }
void e_print_run_page_setup_dialog (GtkWindow *parent) { GtkPageSetup *new_page_setup; GtkPageSetup *old_page_setup; GtkPrintSettings *settings; GKeyFile *key_file; key_file = g_key_file_new (); load_key_file (key_file); settings = load_settings (key_file); old_page_setup = load_page_setup (key_file); new_page_setup = gtk_print_run_page_setup_dialog ( parent, old_page_setup, settings); save_page_setup (new_page_setup, key_file); save_settings (settings, key_file); g_object_unref (new_page_setup); g_object_unref (old_page_setup); g_object_unref (settings); save_key_file (key_file); g_key_file_free (key_file); }
Settings::Settings() { try { xml_settings = load_settings("Carambola.xmlsettings"); } catch (uicore::Exception &) { XMLSettingsList connections = xml_settings.get_list("connections"); XMLSettings connection1 = connections.add(); connection1.set_string("connectionname", "FreeNode"); connection1.set_string("server", "irc.freenode.net"); connection1.set_string("comment", "Freenode provides discussion facilities for the Free and Open Source Software communities, for not-for-profit organizations and for related communities and organizations."); connection1.set_string("nick", "CTalk2011"); connection1.set_string("altnick", "_CTalk2011"); connection1.set_string("username", "carambola"); connection1.set_string("name", "Anonymous Carambola User"); connection1.set_bool("autoconnect", false); XMLSettingsList performlist1 = connection1.get_list("performlist"); XMLSettings connection2 = connections.add(); connection2.set_string("connectionname", "QuakeNet"); connection2.set_string("server", "jubiigames.dk.quakenet.org"); /*"servercentral.il.us.quakenet.org"*/ connection2.set_string("comment", "QuakeNet is built around the gaming community, and is an organizations that facilitates the communication of many teams and online organizations."); connection2.set_string("nick", "CTalk2011"); connection2.set_string("altnick", "_CTalk2011"); connection2.set_string("username", "carambola"); connection2.set_string("name", "Anonymous Carambola User"); connection2.set_bool("autoconnect", false); XMLSettingsList performlist2 = connection2.get_list("performlist"); set_minimize_to_tray(true); } }
bool DayWatcherThread::run() { Log.Notice("DayWatcherThread", "Started."); currenttime = UNIXTIME; dupe_tm_pointer(localtime(¤ttime), &local_currenttime); load_settings(); set_tm_pointers(); m_busy = false; #ifdef WIN32 m_abortEvent = CreateEvent(NULL, NULL, FALSE, NULL); #else struct timeval now; struct timespec tv; pthread_mutex_init(&abortmutex,NULL); pthread_cond_init(&abortcond,NULL); #endif while(ThreadState != THREADSTATE_TERMINATE) { m_busy=true; currenttime = UNIXTIME; dupe_tm_pointer(localtime(¤ttime), &local_currenttime); if(has_timeout_expired(&local_currenttime, &local_last_arena_time, arena_period)) update_arena(); if(has_timeout_expired(&local_currenttime, &local_last_daily_time, daily_period)) update_daily(); if(m_dirty) update_settings(); m_busy=false; if(ThreadState == THREADSTATE_TERMINATE) break; #ifdef WIN32 if (m_abortEvent) WaitForSingleObject(m_abortEvent, THREAD_LOOP_INTERVAL*1000); #else gettimeofday(&now, NULL); tv.tv_sec = now.tv_sec + THREAD_LOOP_INTERVAL; tv.tv_nsec = now.tv_usec * 1000; pthread_mutex_lock(&abortmutex); pthread_cond_timedwait(&abortcond, &abortmutex, &tv); pthread_mutex_unlock(&abortmutex); #endif if(!m_running) break; } #ifdef WIN32 if (m_abortEvent) CloseHandle(m_abortEvent); #else pthread_mutex_destroy(&abortmutex); pthread_cond_destroy(&abortcond); #endif return true; }
int main(int argc, char **argv) { set_is_chs(); exec_setup_scripts(); init_TableDir(); load_settings(); load_gtab_list(FALSE); gtk_init(&argc, &argv); #if HIME_i18n_message bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); #endif g_object_get(gtk_settings_get_default(), "gtk-alternative-button-order", &button_order, NULL); #if 0 // once you invoke hime-setup, the left-right buton tips is disabled save_hime_conf_int(LEFT_RIGHT_BUTTON_TIPS, 0); #endif run_dialog(); gtk_main(); return 0; }
GtkPrintOperation * e_print_operation_new (void) { GtkPrintOperation *operation; GtkPrintSettings *settings; GtkPageSetup *page_setup; GKeyFile *key_file; operation = gtk_print_operation_new (); key_file = g_key_file_new (); load_key_file (key_file); settings = load_settings (key_file); gtk_print_operation_set_print_settings (operation, settings); g_object_unref (settings); page_setup = load_page_setup (key_file); gtk_print_operation_set_default_page_setup (operation, page_setup); g_object_unref (page_setup); g_signal_connect ( operation, "done", G_CALLBACK (print_done_cb), key_file); return operation; }
status_t init_driver() { status_t status = get_module(B_PCI_MODULE_NAME, (module_info**)&gPCIModule); if (status < B_OK) { return ENOSYS; } load_settings(); TRACE_ALWAYS("%s\n", kVersion); pci_info info = {0}; for (long i = 0; B_OK == (*gPCIModule->get_nth_pci_info)(i, &info); i++) { for (size_t idx = 0; idx < _countof(cardInfos); idx++) { if (info.vendor_id == cardInfos[idx].VendorId() && info.device_id == cardInfos[idx].DeviceId()) { TRACE_ALWAYS("Found:%s %#010x\n", cardInfos[idx].Description(), cardInfos[idx].Id()); if (numCards == MAX_DEVICES) { break; } Device* device = new Device(cardInfos[idx], info); if (device == 0) { return ENODEV; } status_t status = device->InitCheck(); if (status < B_OK) { delete device; break; } status = device->SetupDevice(); if (status < B_OK) { delete device; break; } char name[DEVNAME_LEN] = {0}; sprintf(name, "net/%s/%ld", cardInfos[idx].Name(), numCards); gDeviceNames[numCards] = strdup(name); gDevices[numCards++] = device; } } } if (numCards == 0) { put_module(B_PCI_MODULE_NAME); return ENODEV; } add_debugger_command(DRIVER_NAME, SiS19X_DebuggerCommand, "SiS190/191 Ethernet driver info"); return B_OK; }
int main(int argc, char **argv) { const uint16_t acceptor_port = (uint16_t)((argc >= 2) ? atoi(argv[1]) : 8080); char const * const settings_file_name = ((argc >= 3) ? argv[2] : "settings.txt"); settings_t settings; server_t server; log_t log; log_create(&log, stderr); if (!load_settings(&settings, settings_file_name, &log)) { return 1; } if (!server_create(&server, &log, &settings, acceptor_port)) { settings_destroy(&settings); return 1; } settings_destroy(&settings); server_run(&server); server_destroy(&server); log_destroy(&log); return 0; }
/***************************************************************************** * VideoSettings constructor and destructor *****************************************************************************/ VideoSettings::VideoSettings() : fVideoSize( SIZE_100 ), fFlags( FLAG_CORRECT_RATIO ), fSettings( new BMessage( 'sett' ) ) { // read settings from disk status_t ret = load_settings( fSettings, "video_settings", "VideoLAN Client" ); if ( ret == B_OK ) { uint32_t flags; if ( fSettings->FindInt32( "flags", (int32*)&flags ) == B_OK ) SetFlags( flags ); uint32_t size; if ( fSettings->FindInt32( "video size", (int32*)&size ) == B_OK ) SetVideoSize( size ); } else { // figure out if we should use vertical sync by default BScreen screen(B_MAIN_SCREEN_ID); if (screen.IsValid()) { display_mode mode; screen.GetMode(&mode); float refresh = (mode.timing.pixel_clock * 1000) / ((mode.timing.h_total)* (mode.timing.v_total)); if (refresh < MIN_AUTO_VSYNC_REFRESH) AddFlags(FLAG_SYNC_RETRACE); } } }
void Tracker::StartTracker(QFrame* videoframe) { videoframe->show(); videoWidget = new VideoWidget(videoframe); QHBoxLayout* layout = new QHBoxLayout(); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(videoWidget); if (videoframe->layout()) delete videoframe->layout(); videoframe->setLayout(layout); videoWidget->show(); this->layout = layout; load_settings(&shm->config, this); shm->frame.channels = shm->frame.width = shm->frame.height = 0; shm->pause = shm->terminate = shm->running = false; shm->timer = 0; subprocess.setWorkingDirectory(QCoreApplication::applicationDirPath() + "/tracker-ht"); #if defined(_WIN32) || defined(__WIN32) subprocess.start("\"" + QCoreApplication::applicationDirPath() + "/tracker-ht/headtracker-ftnoir" + "\""); #else subprocess.start(QCoreApplication::applicationDirPath() + "/tracker-ht/headtracker-ftnoir"); #endif connect(&timer, SIGNAL(timeout()), this, SLOT(paint_widget()), Qt::QueuedConnection); timer.start(60); }
status_t init_driver() { status_t status = get_module(B_USB_MODULE_NAME, (module_info **)&gUSBModule); if (status < B_OK) return status; load_settings(); TRACE_ALWAYS("%s\n", kVersion); for (int32 i = 0; i < MAX_DEVICES; i++) gDavicomDevices[i] = NULL; gDeviceNames[0] = NULL; mutex_init(&gDriverLock, DRIVER_NAME"_devices"); static usb_notify_hooks notifyHooks = { &usb_davicom_device_added, &usb_davicom_device_removed }; const size_t count = B_COUNT_OF(gSupportedDevices); static usb_support_descriptor sDescriptors[count] = {{ 0 }}; for (size_t i = 0; i < count; i++) { sDescriptors[i].vendor = gSupportedDevices[i].VendorId(); sDescriptors[i].product = gSupportedDevices[i].ProductId(); } gUSBModule->register_driver(DRIVER_NAME, sDescriptors, count, NULL); gUSBModule->install_notify(DRIVER_NAME, ¬ifyHooks); return B_OK; }
static void on_btnSave_clicked(GtkWidget *button, gpointer userdata) { gint server_port_int = g_ascii_strtod(gtk_entry_get_text(GTK_ENTRY(txtServerPort)), NULL); if( (server_port_int < 1024) || (server_port_int > 32766) ) { GtkWidget *failDialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Bad server port value.\nServer port must be between 1024 and 32766."); gtk_dialog_run (GTK_DIALOG (failDialog)); gtk_widget_destroy (failDialog); return; } gint update_interval_int = g_ascii_strtod(gtk_entry_get_text(GTK_ENTRY(txtUpdateInterval)), NULL); if( (update_interval_int < 1) || (update_interval_int > 1000000) ) { GtkWidget *failDialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Bad update interval entered. Please enter a value between 1 and 1000000\n"); gtk_dialog_run (GTK_DIALOG (failDialog)); gtk_widget_destroy (failDialog); return; } stop_webserver(); save_settings(); load_settings(); start_webserver(); gtk_widget_destroy(button); }
MainWindow::MainWindow(const char* name, BRect frame, bool addDefaultButtons) : BWindow(frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION | B_AUTO_UPDATE_SIZE_LIMITS | B_SAME_POSITION_IN_ALL_WORKSPACES, B_ALL_WORKSPACES), fSettings(new BMessage('sett')), fPadView(new PadView("pad view")), fAutoRaise(false), fShowOnAllWorkspaces(true) { bool buttonsAdded = false; if (load_settings(fSettings, "main_settings", "LaunchBox") >= B_OK) buttonsAdded = LoadSettings(fSettings); if (!buttonsAdded) { if (addDefaultButtons) _AddDefaultButtons(); else _AddEmptyButtons(); } SetLayout(new BGroupLayout(B_HORIZONTAL)); AddChild(fPadView); }
static void init(void) { memset(&time_digits_layers, 0, sizeof(time_digits_layers)); memset(&time_digits_images, 0, sizeof(time_digits_images)); const int inbound_size = 64; const int outbound_size = 64; app_message_open(inbound_size, outbound_size); window = window_create(); if (window == NULL) { return; } window_set_background_color(window, GColorBlack); canvas = layer_create(GRect(0, 0, 144, 168)); layer_set_update_proc(canvas, (LayerUpdateProc) render); layer_add_child(window_get_root_layer(window), canvas); window_stack_push(window, true); Layer *window_layer = window_get_root_layer(window); load_settings(); // Open AppMessage connection app_message_register_inbox_received(inbox_received_handler); app_message_open(128, 128); //owm_weather_init(5ba77aab84470992ddc7e49e4985aeab); //events_app_message_open(); //owm_weather_fetch(); handle_weather(); handle_battery(battery_state_service_peek()); battery_state_service_subscribe(handle_battery); // Create time and date layers GRect dummy_frame = { {0, 0}, {0, 0} }; for (int i = 0; i < TOTAL_TIME_DIGITS; i++) { time_digits_layers[i] = bitmap_layer_create(dummy_frame); layer_add_child(window_layer, bitmap_layer_get_layer(time_digits_layers[i])); } mFont = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_20)); mDayText = malloc(mDayTextSize); mWeatherText = malloc(mWeatherTextSize); mBatteryText = malloc(mBatteryTextSize); // Avoids a blank screen on watch start. time_t now = time(NULL); struct tm *tick_time = localtime(&now); handle_tick(tick_time, DAY_UNIT + HOUR_UNIT + MINUTE_UNIT); tick_timer_service_subscribe(MINUTE_UNIT, handle_tick); }
Tracker::Tracker() { layout = nullptr; stop = false; videoWidget = NULL; enableRX = enableRY = enableRZ = enableTX = enableTY = enableTZ = true; load_settings(); }
status_t init_driver() { status_t status = get_module(B_PCI_MODULE_NAME, (module_info **)&gPCI); if (status < B_OK) { return ENOSYS; } load_settings(); pci_info info = { 0 }; for (long i = 0; B_OK == (*gPCI->get_nth_pci_info)(i, &info); i++) { for (size_t idx = 0; idx < _countof(cardInfos); idx++) { if (info.vendor_id == cardInfos[idx].VendorId() && info.device_id == cardInfos[idx].DeviceId()) { if (gNumCards == MAX_DEVICES) { ERROR("Skipped:%s [%#06x:%#06x]\n", cardInfos[idx].Name(), cardInfos[idx].VendorId(), cardInfos[idx].DeviceId()); break; } Device* device = new Device(cardInfos[idx], info); if (device == 0) { return ENODEV; } status_t status = device->InitCheck(); if (status < B_OK) { delete device; break; } status = device->Setup(); if (status < B_OK) { delete device; break; } char name[32] = {0}; sprintf(name, "audio/hmulti/%s/%ld", cardInfos[idx].Name(), gNumCards); gDeviceNames[gNumCards] = strdup(name); gDevices[gNumCards++] = device; TRACE("Found:%s [%#06x:%#06x]\n", cardInfos[idx].Name(), cardInfos[idx].VendorId(), cardInfos[idx].DeviceId()); } } } if (gNumCards == 0) { put_module(B_PCI_MODULE_NAME); return ENODEV; } return B_OK; }
void MainWindow::on_actionOpen_triggered() { QFileDialog dialog(this); dialog.setAcceptMode(QFileDialog::AcceptOpen); dialog.setFileMode(QFileDialog::AnyFile); if (dialog.exec()==QDialog::Rejected){return;} QString filename = dialog.selectedFiles().first(); load_settings(filename); }
void reload_settings(int sig) { /* SIGUSR1 handler */ settings *temp; temp = load_settings(conf_file); free(temp); free(*event_list_global); *event_list_global = temp->event_first; }
void copy_settings(const char* fromsession, const char* tosession) { Config cfg; load_settings(fromsession, &cfg); char *errmsg = save_settings(tosession, &cfg); if (errmsg){ return; } }
Tracker::Tracker() : lck_shm(HT_SHM_NAME, HT_MUTEX_NAME, sizeof(ht_shm_t)), fresh(false) { videoWidget = NULL; layout = NULL; enableRX = enableRY = enableRZ = enableTX = enableTY = enableTZ = true; shm = (ht_shm_t*) lck_shm.mem; shm->terminate = 0; load_settings(&shm->config, this); shm->result.filled = false; }
static void init() { load_settings(); s_main_window = window_create(); window_set_window_handlers(s_main_window, (WindowHandlers) { .load = main_window_load, .unload = main_window_unload });
bool App::_LoadSettings(BMessage& settings) { if (!fSettingsRead) { fSettings = true; if (load_settings(&fSettings, "main_settings", "HaikuDepot") != B_OK) fSettings.MakeEmpty(); } settings = fSettings; return !fSettings.IsEmpty(); }
bool init() { if(initialized_) { return true; } load_settings(); initialized_ = true; return initialized_; }
void initialize_property_bar(property_bar& self) { self.set_text(m_message_catalog.get(TETENGO2_TEXT("PropertyBar:Properties"))); m_p_map_box = tetengo2::stdalt::make_unique<map_box_type>(self); self.size_observer_set().resized().connect(resized_observer_type{ self, *m_p_map_box }); m_p_map_box->mouse_observer_set().pressed().connect(mouse_pressed_observer_type{ *m_p_map_box }); load_settings(self); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //TODO: Load settings load_settings(); ui->NewGame->setToolTip("<b>Start a new game<\b>"); //TODO: maybe add tooltips to some stuff. }