bool PrefWindow::QuitRequested() { save_prefs(); signal_app(); be_app->PostMessage(B_QUIT_REQUESTED); return(true); }
PLUGIN_API void XPluginStop(void) { save_prefs(); stop_checklists(); do_cleanup(); XPLMUnregisterFlightLoopCallback(dataProcessingCallback, NULL); XPLMDestroyMenu(checklistsMenu); XPLMDestroyMenu(PluginMenu); xcClose(); }
int toc_login(char *username, char *password) { char *config; struct in_addr *sin; char buf[80]; char buf2[2048]; toc_debug_printf("looking up host! %s", aim_host); sin = (struct in_addr *)get_address(aim_host); if (!sin) { set_state(STATE_OFFLINE); toc_msg_printf(TOC_CONNECT_MSGS,"Unable to lookup %s", aim_host); return -1; } snprintf(toc_addy, sizeof(toc_addy), "%s", inet_ntoa(*sin)); snprintf(buf, sizeof(buf), "Connecting to %s", inet_ntoa(*sin)); toc_msg_printf(TOC_CONNECT_MSGS,"%s",buf); toc_fd = connect_address(sin->s_addr, aim_port); if (toc_fd < 0) { set_state(STATE_OFFLINE); toc_msg_printf(TOC_CONNECT_MSGS,"Connect to %s failed", inet_ntoa(*sin)); return -1; } free(sin); toc_msg_printf(TOC_CONNECT_MSGS,"Signon: %s",username); if (toc_signon(username, password) < 0) { set_state(STATE_OFFLINE); toc_msg_printf(TOC_CONNECT_MSGS,"Disconnected."); return -1; } toc_msg_printf(TOC_CONNECT_MSGS,"Waiting for reply..."); if (toc_wait_signon() < 0) { set_state(STATE_OFFLINE); toc_msg_printf(TOC_CONNECT_MSGS,"Authentication Failed"); return -1; } snprintf(aim_username, sizeof(aim_username), "%s", username); snprintf(aim_password, sizeof(aim_password), "%s", password); save_prefs(); toc_msg_printf(TOC_CONNECT_MSGS,"Retrieving config..."); if ((config=toc_wait_config()) == NULL) { toc_msg_printf(TOC_CONNECT_MSGS,"No Configuration\n"); set_state(STATE_OFFLINE); return -1; } init_lists(); /* gtk_widget_hide(mainwindow); show_buddy_list(); */ parse_toc_buddy_list(config); /* refresh_buddy_window(); */ snprintf(buf2, sizeof(buf2), "toc_init_done"); sflap_send(buf2, -1, TYPE_DATA); serv_finish_login(); return 0; }
void PrefWindow::MessageReceived( BMessage* message ) { BString tmp(""); switch (message->what) { //case 'tstB': // signal_app(); // break; case 'chHp': cout << "help value reset "; if (help_value) cout << "was true "; else cout << "was false "; help_value = help_setting->Value(); if (help_value) cout << "now true "; else cout << "now false "; cout << endl; save_prefs(); break; case 'mnuF': cout << "got a BMessageField selection message..." << endl; if (message->FindString("filename", &tmp)==B_OK) { main_save_file.SetTo( tmp.String() ); cout << tmp.String() << endl; save_prefs(); } break; case 'mnF2': cout << "got a BMessageField selection message..." << endl; if (message->FindString("filename", &tmp)==B_OK) { trainer_save_file.SetTo( tmp.String() ); cout << tmp.String() << endl; } break; case 'svTf': cout << "got a file save message...(save current)" << endl; tmp.SetTo( trainer_input->Text() ); save_stroke( tmp.String(), main_save_file.String() ); break; case 'sTsf': cout << "got a file save message...(save into)" << endl; tmp.SetTo( trainer_input->Text() ); save_stroke( tmp.String(), trainer_save_file.String() ); break; case 'stSc': cout << "scale changed: was " << scale_value << " "; scale_value = sliderToScale( scale_setting->Value() ); cout << "now " << scale_value << endl; save_prefs(); setSliderLabel(); break; case 'ScMv': cout << "track move " << scale_value << endl; break; default: BWindow::MessageReceived(message); break; } }