void prefsProxiesViewCb_ok(Widget w, XtPointer closure, XtPointer callData) { XFE_PrefsProxiesViewDialog *theDialog = (XFE_PrefsProxiesViewDialog *)closure; PrefsDataProxiesView *fep = theDialog->m_prefsDataProxiesView; XP_ASSERT(fep); if (! theDialog->verifyPage()) return; char *s1; char *s2; PREFS_SET_GLOBALPREF_TEXT(no_proxy, no_proxy_text); #define SNARFP(NAME,SUFFIX,empty_port_ok) \ { \ s1 = fe_GetTextField(fep->NAME##_##SUFFIX##_text); \ s2 = fe_GetTextField(fep->NAME##_port_text); \ if (*s1 && (*s2 || empty_port_ok)) { \ fe_globalPrefs.NAME##_##SUFFIX = strdup(s1); \ fe_globalPrefs.NAME##_##SUFFIX##_port = *s2 ? atoi(s2) : 0; \ } else { \ fe_globalPrefs.NAME##_##SUFFIX = strdup(""); \ fe_globalPrefs.NAME##_##SUFFIX##_port = 0; \ } \ if (s1) XtFree(s1); \ if (s2) XtFree(s2); \ } SNARFP (ftp, proxy, False); SNARFP (gopher, proxy, False); SNARFP (http, proxy, False); #ifndef NO_SECURITY SNARFP (https, proxy, False); #endif SNARFP (wais, proxy, False); SNARFP (socks, host, True); #undef SNARFP // Install changes theDialog->installChanges(); // Simulate a cancel prefsProxiesViewCb_cancel(w, closure, callData); // Save the preferences at the end, so that if we've found some setting that // crashes, it won't get saved... if (!fe_CheckVersionAndSavePrefs((char *) fe_globalData.user_prefs_file, &fe_globalPrefs)) fe_perror (theDialog->getContext(), XP_GetString( XFE_ERROR_SAVING_OPTIONS)); }
void XFE_PrefsDiskMoreDialog::prefsDiskMoreCb_ok(Widget w, XtPointer closure, XtPointer callData) { XFE_PrefsDiskMoreDialog *theDialog = (XFE_PrefsDiskMoreDialog *)closure; PrefsDataDiskMore *fep = theDialog->m_prefsDataDiskMore; XP_ASSERT(fep); if (! theDialog->verifyPage()) return; Boolean b; char c; char *s = 0; int n; XtVaGetValues(fep->rm_msg_body_toggle, XmNset, &b, 0); fe_globalPrefs.news_remove_bodies_by_age = b; XtVaGetValues(fep->num_days_text, XmNvalue, &s, 0); fe_globalPrefs.news_remove_bodies_days = 0; if (1 == sscanf (s, " %d %c", &n, &c)) fe_globalPrefs.news_remove_bodies_days = n; // Simulate a cancel prefsDiskMoreCb_cancel(w, closure, callData); // Install preferences theDialog->installChanges(); // Save the preferences at the end, so that if we've found some // setting that crashes, it won't get saved... if (! fe_CheckVersionAndSavePrefs((char *) fe_globalData.user_prefs_file, &fe_globalPrefs)) fe_perror (theDialog->getContext(), XP_GetString( XFE_ERROR_SAVING_OPTIONS)); }