summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2005-02-13 05:42:47 +0000
committerJason Woodward2005-02-13 05:42:47 +0000
commit0140464295c74dd7fbcbf0c7d044e5650a01f18c (patch)
treeab091730f9e621e92c85cb2efa25d853a9a8df32
parentd076d7ed2ae3dc245a5880587ee0c9e29b9c944b (diff)
downloadgslapt-0140464295c74dd7fbcbf0c7d044e5650a01f18c.tar.gz
write_preferences now commits runtime preferences to RC_LOCATION
-rw-r--r--src/callbacks.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index 9dee79b..549b50f 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -1551,18 +1551,28 @@ void preferences_exclude_remove(GtkWidget *w, gpointer user_data) {
static gboolean write_preferences(void){
extern rc_config *global_config;
guint i;
+ FILE *rc;
- fprintf(stderr,"About to write configuration\n\n");
+ rc = open_file(RC_LOCATION,"w+");
+ if( rc == NULL ) return FALSE;
- fprintf(stderr,"working_dir: %s\n",global_config->working_dir);
- for(i = 0; i < global_config->exclude_list->count;++i){
- fprintf(stderr,"exclude %d: %s\n",i,global_config->exclude_list->excludes[i]);
+ fprintf(rc,"%s%s\n",WORKINGDIR_TOKEN,global_config->working_dir);
+
+ fprintf(rc,"%s",EXCLUDE_TOKEN);
+ for(i = 0;i < global_config->exclude_list->count;++i){
+ if( i+1 == global_config->exclude_list->count)
+ fprintf(rc,"%s",global_config->exclude_list->excludes[i]);
+ else
+ fprintf(rc,"%s,",global_config->exclude_list->excludes[i]);
}
+ fprintf(rc,"\n");
+
for(i = 0; i < global_config->sources.count;++i){
- fprintf(stderr,"source %d: %s\n",i,global_config->sources.url[i]);
+ fprintf(rc,"%s%s\n",SOURCE_TOKEN,global_config->sources.url[i]);
}
- /* open RC_LOCATION */
+ fclose(rc);
return TRUE;
}
+