/* * ============================================================================ * Save settings to XML properties file. * Enter: ctl Export control data. * ============================================================================ */ void exporthtml_save_settings( ExportHtmlCtl *ctl ) { XmlProperty *props; props = xmlprops_create(); xmlprops_set_path( props, ctl->settingsFile ); xmlprops_set_property( props, EXMLPROP_DIRECTORY, ctl->dirOutput ); xmlprops_set_property( props, EXMLPROP_FILE, ctl->fileHtml ); xmlprops_set_property_i( props, EXMLPROP_STYLESHEET, ctl->stylesheet ); xmlprops_set_property_i( props, EXMLPROP_FMT_NAME, ctl->nameFormat ); xmlprops_set_property_b( props, EXMLPROP_BANDING, ctl->banding ); xmlprops_set_property_b( props, EXMLPROP_FMT_EMAIL, ctl->linkEMail ); xmlprops_set_property_b( props, EXMLPROP_FMT_ATTRIB, ctl->showAttribs ); xmlprops_save_file( props ); xmlprops_free( props ); }
/* * ============================================================================ * Load settings from XML properties file. * Enter: ctl Export control data. * ============================================================================ */ void exporthtml_load_settings( ExportHtmlCtl *ctl ) { XmlProperty *props; gint rc; gchar buf[256]; *buf = '\0'; props = xmlprops_create(); xmlprops_set_path( props, ctl->settingsFile ); rc = xmlprops_load_file( props ); if( rc == 0 ) { /* Read settings */ xmlprops_get_property_s( props, EXMLPROP_DIRECTORY, buf ); ctl->dirOutput = mgu_replace_string( ctl->dirOutput, buf ); xmlprops_get_property_s( props, EXMLPROP_FILE, buf ); ctl->fileHtml = mgu_replace_string( ctl->fileHtml, buf ); ctl->stylesheet = xmlprops_get_property_i( props, EXMLPROP_STYLESHEET ); ctl->nameFormat = xmlprops_get_property_i( props, EXMLPROP_FMT_NAME ); ctl->banding = xmlprops_get_property_b( props, EXMLPROP_BANDING ); ctl->linkEMail = xmlprops_get_property_b( props, EXMLPROP_FMT_EMAIL ); ctl->showAttribs = xmlprops_get_property_b( props, EXMLPROP_FMT_ATTRIB ); } else { /* Set default values */ exporthtml_default_values( ctl ); } exporthtml_build_filespec( ctl ); /* exporthtml_print( ctl, stdout ); */ xmlprops_free( props ); }