comparison src/options.c @ 1145:3a7af6a8cd5f

Use functions to return directories instead of constants. Following functions were added: get_collections_dir() get_metadata_cache_dir() get_rc_dir() get_thumbnails_cache_dir() get_trash_dir() They return the full directory path.
author zas_
date Sat, 15 Nov 2008 17:30:45 +0000
parents 1e2de04c6fc4
children c45cc5cf3c4d
comparison
equal deleted inserted replaced
1144:5fe3b8b3a612 1145:3a7af6a8cd5f
181 181
182 bookmark_add_default(_("Home"), homedir()); 182 bookmark_add_default(_("Home"), homedir());
183 path = g_build_filename(homedir(), "Desktop", NULL); 183 path = g_build_filename(homedir(), "Desktop", NULL);
184 bookmark_add_default(_("Desktop"), path); 184 bookmark_add_default(_("Desktop"), path);
185 g_free(path); 185 g_free(path);
186 path = g_build_filename(homedir(), GQ_RC_DIR_COLLECTIONS, NULL); 186 bookmark_add_default(_("Collections"), get_collections_dir());
187 bookmark_add_default(_("Collections"), path);
188 g_free(path);
189 187
190 g_free(options->file_ops.safe_delete_path); 188 g_free(options->file_ops.safe_delete_path);
191 options->file_ops.safe_delete_path = g_build_filename(homedir(), GQ_RC_DIR_TRASH, NULL); 189 options->file_ops.safe_delete_path = g_strdup(get_trash_dir());
192 190
193 for (i = 0; i < COLOR_PROFILE_INPUTS; i++) 191 for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
194 { 192 {
195 options->color_profile.input_file[i] = NULL; 193 options->color_profile.input_file[i] = NULL;
196 options->color_profile.input_name[i] = NULL; 194 options->color_profile.input_name[i] = NULL;
258 { 256 {
259 gchar *rc_path; 257 gchar *rc_path;
260 258
261 sync_options_with_current_state(options); 259 sync_options_with_current_state(options);
262 260
263 rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL); 261 rc_path = g_build_filename(get_rc_dir(), RC_FILE_NAME, NULL);
264 save_options_to(rc_path, options); 262 save_options_to(rc_path, options);
265 g_free(rc_path); 263 g_free(rc_path);
266 } 264 }
267 265
268 void load_options(ConfOptions *options) 266 void load_options(ConfOptions *options)
276 success = load_options_from(rc_path, options); 274 success = load_options_from(rc_path, options);
277 DEBUG_1("Loading options from %s ... %s", rc_path, success ? "done" : "failed"); 275 DEBUG_1("Loading options from %s ... %s", rc_path, success ? "done" : "failed");
278 g_free(rc_path); 276 g_free(rc_path);
279 } 277 }
280 278
281 rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL); 279 rc_path = g_build_filename(get_rc_dir(), RC_FILE_NAME, NULL);
282 success = load_options_from(rc_path, options); 280 success = load_options_from(rc_path, options);
283 DEBUG_1("Loading options from %s ... %s", rc_path, success ? "done" : "failed"); 281 DEBUG_1("Loading options from %s ... %s", rc_path, success ? "done" : "failed");
284 g_free(rc_path); 282 g_free(rc_path);
285 } 283 }
286 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ 284 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */