/* save filters in users filter file */ gboolean color_filters_write(GSList *cfl) { gchar *pf_dir_path; gchar *path; FILE *f; /* Create the directory that holds personal configuration files, if necessary. */ if (create_persconffile_dir(&pf_dir_path) == -1) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Can't create directory\n\"%s\"\nfor color files: %s.", pf_dir_path, g_strerror(errno)); g_free(pf_dir_path); return FALSE; } path = get_persconffile_path("colorfilters", TRUE); if ((f = ws_fopen(path, "w+")) == NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not open\n%s\nfor writing: %s.", path, g_strerror(errno)); g_free(path); return FALSE; } g_free(path); write_filters_file(cfl, f, FALSE); fclose(f); return TRUE; }
/* save filters in some other filter file (export) */ gboolean color_filters_export(const gchar *path, GSList *cfl, gboolean only_marked, gchar** err_msg) { FILE *f; if ((f = ws_fopen(path, "w+")) == NULL) { *err_msg = g_strdup_printf("Could not open\n%s\nfor writing: %s.", path, g_strerror(errno)); return FALSE; } write_filters_file(cfl, f, only_marked); fclose(f); return TRUE; }
/* save filters in some other filter file (export) */ gboolean color_filters_export(const gchar *path, const GSList *cfl, gboolean only_marked) { FILE *f; if ((f = ws_fopen(path, "w+")) == NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not open\n%s\nfor writing: %s.", path, g_strerror(errno)); return FALSE; } write_filters_file(cfl, f, only_marked); fclose(f); return TRUE; }