static void save_settings(void) { apply_settings(); // Save settings nsoption_write( (const char*)&options ); nsoption_read( (const char*)&options ); close_settings(); form_alert(1, "[1][Some options require an netsurf restart!][OK]"); deskmenu_update(); }
static gboolean on_dialog_close (GtkDialog *dlg, gboolean stay_alive) { LOG(("Writing options to file")); nsoption_write(options_file_location); if ((stay_alive) && GTK_IS_WIDGET(dlg)) gtk_widget_hide(GTK_WIDGET(dlg)); else { stay_alive = FALSE; } return stay_alive; }
void nsws_prefs_dialog_init(HINSTANCE hinst, HWND parent) { int ret; PROPSHEETPAGE psp[3]; PROPSHEETHEADER psh; psp[0].dwSize = sizeof(PROPSHEETPAGE); psp[0].dwFlags = 0;/*PSP_USEICONID*/ psp[0].hInstance = hinst; psp[0].pszTemplate = MAKEINTRESOURCE(IDD_DLG_OPTIONS_GENERAL); psp[0].pfnDlgProc = options_general_dialog_handler; psp[0].lParam = 0; psp[0].pfnCallback = NULL; psp[1].dwSize = sizeof(PROPSHEETPAGE); psp[1].dwFlags = 0;/*PSP_USEICONID*/ psp[1].hInstance = hinst; psp[1].pszTemplate = MAKEINTRESOURCE(IDD_DLG_OPTIONS_CONNECTIONS); psp[1].pfnDlgProc = options_connections_dialog_handler; psp[1].lParam = 0; psp[1].pfnCallback = NULL; psp[2].dwSize = sizeof(PROPSHEETPAGE); psp[2].dwFlags = 0;/*PSP_USEICONID*/ psp[2].hInstance = hinst; psp[2].pszTemplate = MAKEINTRESOURCE(IDD_DLG_OPTIONS_APPERANCE); psp[2].pfnDlgProc = options_appearance_dialog_handler; psp[2].lParam = 0; psp[2].pfnCallback = NULL; psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_NOAPPLYNOW | PSH_USEICONID | PSH_PROPSHEETPAGE; psh.hwndParent = parent; psh.hInstance = hinst; psh.pszIcon = MAKEINTRESOURCE(IDR_NETSURF_ICON); psh.pszCaption = (LPSTR) "NetSurf Options"; psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = (LPCPROPSHEETPAGE) &psp; psh.pfnCallback = NULL; ret = PropertySheet(&psh); if (ret == -1) { win_perror("PropertySheet"); } else if (ret > 0) { /* user saved changes */ nsoption_write(options_file_location); } }
int main(int argc, char**argv) { FILE *fp; nsoption_init(gui_options_init_defaults, NULL, NULL); nsoption_read("data/Choices", NULL); nsoption_write("Choices-short", NULL, NULL); fp = fopen("Choices-all", "w"); nsoption_dump(fp, NULL); fclose(fp); return 0; }
static void __CDECL menu_savewin(short item, short title, void *data) { LOG(("%s", __FUNCTION__)); if (input_window && input_window->browser) { GRECT rect; wind_get_grect(gemtk_wm_get_handle(input_window->root->win), WF_CURRXYWH, &rect); option_window_width = rect.g_w; option_window_height = rect.g_h; option_window_x = rect.g_x; option_window_y = rect.g_y; nsoption_set_int(window_width, rect.g_w); nsoption_set_int(window_height, rect.g_h); nsoption_set_int(window_x, rect.g_x); nsoption_set_int(window_y, rect.g_y); nsoption_write((const char*)&options); } }
static void ami_menu_item_settings_save(struct Hook *hook, APTR window, struct IntuiMessage *msg) { nsoption_write(current_user_options, NULL, NULL); }
void WriteOptions(struct ObjApp * obj) { /*General*/ get(obj->CM_Enable_JavaScript, MUIA_Selected, &var); nsoption_bool(enable_javascript) = var; get(obj->CM_Hide_advertisements,MUIA_Selected, &var); nsoption_bool(block_advertisements) = var; get(obj->STR_label_URL, MUIA_String_Contents, &var); nsoption_charp(homepage_url) = strdup(var); get(obj->CH_send_referer, MUIA_Selected, &var); nsoption_bool(send_referer) = strdup(var); get(obj->CH_do_not_track, MUIA_Selected, &var); nsoption_bool(do_not_track) = strdup(var); get(obj->CM_Get_from_Locale_prefs, MUIA_Selected, &var); nsoption_bool(accept_lang_locale) = var; get(obj->STR_Get_from_Locale_prefs, MUIA_String_Contents, &var); nsoption_charp(accept_language) = strdup(var); get(obj->STR_charset, MUIA_String_Contents, &var); nsoption_charp(accept_charset) = strdup(var); /*Connection*/ get(obj->STR_Host, MUIA_String_Contents, &var); nsoption_charp(http_proxy_host) = strdup(var); get(obj->STR_Port, MUIA_String_Contents, &var); nsoption_int(http_proxy_port) = atoi(var); get(obj->STR_Username, MUIA_String_Contents, &var); nsoption_charp(http_proxy_auth_user) = strdup(var); get(obj->STR_Password, MUIA_String_Contents, &var); nsoption_charp(http_proxy_auth_pass) = strdup(var); get(obj->STR_Bypass, MUIA_String_Contents, &var); nsoption_charp(http_proxy_noproxy) = strdup(var); get(obj->STR_Maximum_fetchers, MUIA_String_Contents, &var); nsoption_int(max_fetchers) = atoi(var); get(obj->STR_Maximum_retried, MUIA_String_Contents, &var); nsoption_int(max_retried_fetches) = atoi(var); get(obj->STR_Fetchers_per_host, MUIA_String_Contents, &var); nsoption_int(max_fetchers_per_host) = atoi(var); get(obj->STR_Fetch_timeout, MUIA_String_Contents, &var); nsoption_int(curl_fetch_timeout) = atoi(var); get(obj->STR_Cached_connections, MUIA_String_Contents, &var); nsoption_int(max_cached_fetch_handles) = atoi(var); /*Display*/ get(obj->STR_width, MUIA_String_Contents, &var); nsoption_int(window_width)= atoi(var); get(obj->STR_height, MUIA_String_Contents, &var); nsoption_int(window_height)= atoi(var); get(obj->STR_depth, MUIA_String_Contents, &var); nsoption_int(window_depth)= atoi(var); get(obj->CH_fullscreen, MUIA_Selected, &var); nsoption_bool(fullscreen)= var; get(obj->CH_autodepth, MUIA_Selected, &var); nsoption_bool(autodetect_depth)= var; get(obj->PA_theme, MUIA_String_Contents, &var); nsoption_charp(theme) = strdup(var); get(obj->CH_dithering, MUIA_Selected, &var); nsoption_bool(low_dither_quality) = var; /*Rendering*/ get(obj->CH_Foreground_images,MUIA_Selected, &var); nsoption_bool(foreground_images) = var; get(obj->CH_Background_images,MUIA_Selected, &var); nsoption_bool(background_images) = var; get(obj->CH_Disable_animations,MUIA_Selected, &var); nsoption_bool(animate_images) = !var; get(obj->STR_gif_delay, MUIA_String_Contents, &var); nsoption_int(minimum_gif_delay) = atof(var)*100+0.01; get(obj->SL_scale, MUIA_Slider_Level, &cint); nsoption_int(scale) = cint; get(obj->SL_scale_aga, MUIA_Slider_Level, &cint); nsoption_int(scale_aga) = cint; get(obj->CH_cpu_speed,MUIA_Selected, &var); nsoption_bool(warp_mode) = var; /*Cache*/ get(obj->SL_Memory_cache, MUIA_Slider_Level, &cint); nsoption_int(memory_cache_size) = cint * 1024 * 1024; get(obj->SL_Disc_cache, MUIA_Slider_Level, &cint); nsoption_int(disc_cache_size) = cint * 1024 * 1024; get(obj->PA_Cache_directory, MUIA_String_Contents, &var); nsoption_charp(cache_dir) = strdup(var); /*Fonts*/ get(obj->STR_PA_Sans_serif, MUIA_String_Contents, &var); nsoption_charp(fb_face_sans_serif) = strdup(var); get(obj->STR_PA_Sans_serif_italic, MUIA_String_Contents, &var); nsoption_charp(fb_face_sans_serif_italic) = strdup(var); get(obj->STR_PA_Serif, MUIA_String_Contents, &var); nsoption_charp(fb_face_serif) = strdup(var); get(obj->STR_PA_Sans_serif_bold, MUIA_String_Contents, &var); nsoption_charp(fb_face_sans_serif_bold) = strdup(var); get(obj->STR_PA_Sans_serif_bold_italic, MUIA_String_Contents, &var); nsoption_charp(fb_face_sans_serif_italic_bold) = strdup(var); get(obj->STR_PA_Monospace, MUIA_String_Contents, &var); nsoption_charp(fb_face_monospace) = strdup(var); get(obj->STR_PA_Cursive, MUIA_String_Contents, &var); nsoption_charp(fb_face_cursive) = strdup(var); get(obj->STR_PA_Fantasy, MUIA_String_Contents, &var); nsoption_charp(fb_face_fantasy) = strdup(var); get(obj->STR_Default, MUIA_String_Contents, &var); nsoption_int(font_size) = atoi(var) * 10; get(obj->STR_Minimum, MUIA_String_Contents, &var); nsoption_int(font_min_size) = atoi(var) * 10; get(obj->SL_dpi, MUIA_Slider_Level, &cint); nsoption_int(browser_dpi) = cint; get(obj->CH_bitmap_fonts, MUIA_Selected, &var); nsoption_bool(bitmap_fonts)= var; /*Other*/ get(obj->STR_PA_Download_manager, MUIA_String_Contents, &var); nsoption_charp(download_manager) = strdup(var); get(obj->PA_Download_dir, MUIA_String_Contents, &var); nsoption_charp(download_path) = strdup(var); get(obj->STR_YT, MUIA_String_Contents, &var); nsoption_charp(youtube_handler) = strdup(var); get(obj->PA_Mp3_player, MUIA_String_Contents, &var); nsoption_charp(net_player) = strdup(var); get(obj->PA_Module, MUIA_String_Contents, &var); nsoption_charp(module_player) = strdup(var); nsoption_write("PROGDIR:Resources/Options", NULL, NULL); }