1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 08:13:27 +00:00

(trunk, gtk) minor fix to tr_prefs_init_default() -- avoid redundant calls to g_get_user_special_dir

This commit is contained in:
Jordan Lee 2013-06-12 00:22:41 +00:00
parent 5f61425565
commit beeb4d3b77

View file

@ -64,17 +64,16 @@ gtr_pref_init (const char * config_dir)
static void static void
tr_prefs_init_defaults (tr_variant * d) tr_prefs_init_defaults (tr_variant * d)
{ {
const char * str; const char * dir;
const char * special_dl_dir = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD);
str = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD); dir = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD);
if (!str) if (dir == NULL)
str = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP); dir = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
if (!str) if (dir == NULL)
str = tr_getDefaultDownloadDir (); dir = tr_getDefaultDownloadDir ();
tr_variantDictReserve (d, 29); tr_variantDictReserve (d, 29);
tr_variantDictAddStr (d, TR_KEY_watch_dir, str); tr_variantDictAddStr (d, TR_KEY_watch_dir, dir);
tr_variantDictAddBool (d, TR_KEY_watch_dir_enabled, FALSE); tr_variantDictAddBool (d, TR_KEY_watch_dir_enabled, FALSE);
tr_variantDictAddBool (d, TR_KEY_user_has_given_informed_consent, FALSE); tr_variantDictAddBool (d, TR_KEY_user_has_given_informed_consent, FALSE);
tr_variantDictAddBool (d, TR_KEY_inhibit_desktop_hibernation, FALSE); tr_variantDictAddBool (d, TR_KEY_inhibit_desktop_hibernation, FALSE);
@ -99,7 +98,7 @@ tr_prefs_init_defaults (tr_variant * d)
tr_variantDictAddInt (d, TR_KEY_main_window_width, 300); tr_variantDictAddInt (d, TR_KEY_main_window_width, 300);
tr_variantDictAddInt (d, TR_KEY_main_window_x, 50); tr_variantDictAddInt (d, TR_KEY_main_window_x, 50);
tr_variantDictAddInt (d, TR_KEY_main_window_y, 50); tr_variantDictAddInt (d, TR_KEY_main_window_y, 50);
tr_variantDictAddStr (d, TR_KEY_download_dir, special_dl_dir ? special_dl_dir : str); tr_variantDictAddStr (d, TR_KEY_download_dir, dir);
tr_variantDictAddStr (d, TR_KEY_sort_mode, "sort-by-name"); tr_variantDictAddStr (d, TR_KEY_sort_mode, "sort-by-name");
tr_variantDictAddBool (d, TR_KEY_sort_reversed, FALSE); tr_variantDictAddBool (d, TR_KEY_sort_reversed, FALSE);
tr_variantDictAddBool (d, TR_KEY_compact_view, FALSE); tr_variantDictAddBool (d, TR_KEY_compact_view, FALSE);