static void save_rssyl_prefs(PrefsPage *page) { RSSylPrefsPage *prefs_page = (RSSylPrefsPage *)page; PrefFile *pref_file; gchar *rc_file_path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); rssyl_prefs.refresh = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(prefs_page->refresh)); rssyl_prefs.expired = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(prefs_page->expired)); rssyl_prefs.refresh_on_startup = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(prefs_page->refresh_on_startup)); g_free(rssyl_prefs.cookies_path); rssyl_prefs.cookies_path = g_strdup(gtk_entry_get_text( GTK_ENTRY(prefs_page->cookies_path))); pref_file = prefs_write_open(rc_file_path); g_free(rc_file_path); if( !pref_file || prefs_set_block_label(pref_file, PREFS_BLOCK_NAME) < 0 ) return; if( prefs_write_param(param, pref_file->fp) < 0 ) { g_warning("Failed to write RSSyl plugin configuration\n"); prefs_file_close_revert(pref_file); return; } if (fprintf(pref_file->fp, "\n") < 0) { FILE_OP_ERROR(rc_file_path, "fprintf"); prefs_file_close_revert(pref_file); } else prefs_file_close(pref_file); }
static void cm_gdata_save_config(void) { PrefFile *pfile; gchar *rcpath; debug_print("Saving GData plugin configuration...\n"); rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); pfile = prefs_write_open(rcpath); g_free(rcpath); if (!pfile || (prefs_set_block_label(pfile, "GDataPlugin") < 0)) return; if (prefs_write_param(cm_gdata_param, pfile->fp) < 0) { debug_print("failed!\n"); g_warning("GData Plugin: Failed to write plugin configuration to file"); prefs_file_close_revert(pfile); return; } if (fprintf(pfile->fp, "\n") < 0) { FILE_OP_ERROR(rcpath, "fprintf"); prefs_file_close_revert(pfile); } else prefs_file_close(pfile); debug_print("done.\n"); }
void fetchinfo_save_config(void) { PrefFile *pfile; gchar *rcpath; debug_print("Saving Fetchinfo Page\n"); rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); pfile = prefs_write_open(rcpath); g_free(rcpath); if (!pfile || (prefs_set_block_label(pfile, "Fetchinfo") < 0)) return; if (prefs_write_param(param, pfile->fp) < 0) { /* i18n: Possible error message during plugin load */ g_warning("failed to write Fetchinfo configuration to file"); prefs_file_close_revert(pfile); return; } if (fprintf(pfile->fp, "\n") < 0) { FILE_OP_ERROR(rcpath, "fprintf"); prefs_file_close_revert(pfile); } else prefs_file_close(pfile); }
void vcal_prefs_save(void) { PrefFile *pfile; gchar *rcpath; rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); pfile = prefs_write_open(rcpath); g_free(rcpath); if (!pfile || (prefs_set_block_label(pfile, PREFS_BLOCK_NAME) < 0)) return; if (prefs_write_param(param, pfile->fp) < 0) { g_warning("failed to write vCalendar configuration to file"); prefs_file_close_revert(pfile); return; } if (fprintf(pfile->fp, "\n") < 0) { FILE_OP_ERROR(rcpath, "fprintf"); prefs_file_close_revert(pfile); } else prefs_file_close(pfile); }
static void save_rssyl_prefs(PrefsPage *page) { RPrefsPage *prefs_page = (RPrefsPage *)page; PrefFile *pref_file; gchar *rc_file_path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); /* Grab values from GTK widgets */ rssyl_prefs.refresh_enabled = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(prefs_page->refresh_enabled)); rssyl_prefs.refresh = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(prefs_page->refresh)); rssyl_prefs.refresh_on_startup = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(prefs_page->refresh_on_startup)); g_free(rssyl_prefs.cookies_path); rssyl_prefs.cookies_path = g_strdup(gtk_entry_get_text( GTK_ENTRY(prefs_page->cookies_path))); rssyl_prefs.ssl_verify_peer = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(prefs_page->ssl_verify_peer)); /* Store prefs in rc file */ pref_file = prefs_write_open(rc_file_path); g_free(rc_file_path); if( !pref_file || prefs_set_block_label(pref_file, PREFS_BLOCK_NAME) < 0 ) return; if( prefs_write_param(param, pref_file->fp) < 0 ) { g_warning("Failed to write RSSyl plugin configuration"); prefs_file_close_revert(pref_file); return; } fprintf(pref_file->fp, "\n"); prefs_file_close(pref_file); rssyl_apply_prefs(); }
static void save_fancy_prefs(PrefsPage *page) { PrefFile *pref_file; gchar *rc_file_path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); pref_file = prefs_write_open(rc_file_path); g_free(rc_file_path); if (!(pref_file) || (prefs_set_block_label(pref_file, PREFS_BLOCK_NAME) < 0)) return; if (prefs_write_param(param, pref_file->fp) < 0) { g_warning("failed to write Fancy Plugin configuration\n"); prefs_file_close_revert(pref_file); return; } if (fprintf(pref_file->fp, "\n") < 0) { FILE_OP_ERROR(rc_file_path, "fprintf"); prefs_file_close_revert(pref_file); } else prefs_file_close(pref_file); }
void bogofilter_save_config(void) { PrefFile *pfile; gchar *rcpath; debug_print("Saving Bogofilter Page\n"); rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); pfile = prefs_write_open(rcpath); g_free(rcpath); if (!pfile || (prefs_set_block_label(pfile, "Bogofilter") < 0)) return; if (prefs_write_param(param, pfile->fp) < 0) { g_warning("Failed to write Bogofilter configuration to file"); prefs_file_close_revert(pfile); return; } if (fprintf(pfile->fp, "\n") < 0) { FILE_OP_ERROR(rcpath, "fprintf"); prefs_file_close_revert(pfile); } else prefs_file_close(pfile); }
static void save_archiver_prefs(PrefsPage * _page) { struct ArchiverPrefsPage *page = (struct ArchiverPrefsPage *) _page; PrefFile *pref_file; gchar *rc_file_path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); archiver_prefs.save_folder = gtk_editable_get_chars(GTK_EDITABLE(page->save_folder), 0, -1); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->zip_radiobtn))) archiver_prefs.compression = COMPRESSION_ZIP; else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->bzip_radiobtn))) archiver_prefs.compression = COMPRESSION_BZIP; else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->compress_radiobtn))) archiver_prefs.compression = COMPRESSION_COMPRESS; else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->none_radiobtn))) archiver_prefs.compression = COMPRESSION_NONE; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->tar_radiobtn))) archiver_prefs.format = FORMAT_TAR; else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->shar_radiobtn))) archiver_prefs.format = FORMAT_SHAR; else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->cpio_radiobtn))) archiver_prefs.format = FORMAT_CPIO; else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->pax_radiobtn))) archiver_prefs.format = FORMAT_PAX; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->recursive_chkbtn))) archiver_prefs.recursive = TRUE; else archiver_prefs.recursive = FALSE; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->md5sum_chkbtn))) archiver_prefs.md5sum = TRUE; else archiver_prefs.md5sum = FALSE; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->rename_chkbtn))) archiver_prefs.rename = TRUE; else archiver_prefs.rename = FALSE; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->unlink_chkbtn))) archiver_prefs.unlink = TRUE; else archiver_prefs.unlink = FALSE; pref_file = prefs_write_open(rc_file_path); g_free(rc_file_path); if (!(pref_file) || (prefs_set_block_label(pref_file, PREFS_BLOCK_NAME) < 0)) return; if (prefs_write_param(param, pref_file->fp) < 0) { g_warning("failed to write Archiver Plugin configuration\n"); prefs_file_close_revert(pref_file); return; } if (fprintf(pref_file->fp, "\n") < 0) { FILE_OP_ERROR(rc_file_path, "fprintf"); prefs_file_close_revert(pref_file); } else prefs_file_close(pref_file); }