gnome-settings-daemon r237 - in trunk: . plugins/housekeeping



Author: jensg
Date: Sat Mar 29 08:14:38 2008
New Revision: 237
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=237&view=rev

Log:
2008-03-29  Jens Granseuer  <jensgr gmx net>

	* plugins/housekeeping/gsd-housekeeping-manager.c:
	(get_gconf_int_with_default): rename to better reflect what it does,
	and also use the default passed in if we don't get an int from GConf,
	or we'll end up with a value of 0 which is certainly not what we want

	(purge_thumbnail_cache): update callers


Modified:
   trunk/ChangeLog
   trunk/plugins/housekeeping/gsd-housekeeping-manager.c

Modified: trunk/plugins/housekeeping/gsd-housekeeping-manager.c
==============================================================================
--- trunk/plugins/housekeeping/gsd-housekeeping-manager.c	(original)
+++ trunk/plugins/housekeeping/gsd-housekeeping-manager.c	Sat Mar 29 08:14:38 2008
@@ -1,5 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
+/*
  * Copyright (C) 2008 Michael J. Chudobiak <mjc avtechpulse com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -39,7 +38,7 @@
 #define DEFAULT_MAX_AGE_IN_DAYS 60
 #define GCONF_THUMB_SIZE "/desktop/gnome/thumbnail_cache/maximum_size"
 #define DEFAULT_MAX_SIZE_IN_MB 64
-#define GCONF_THUMB_BINDING_DIR "/desktop/gnome/thumbnail_cache" 
+#define GCONF_THUMB_BINDING_DIR "/desktop/gnome/thumbnail_cache"
 
 
 struct GsdHousekeepingManagerPrivate {
@@ -155,7 +154,7 @@
 
 
 static int
-get_gconf_int_with_nonzero_default (char *key, int default_value)
+get_gconf_int_with_default (char *key, int default_value)
 {
         /* If the key is unset, we use a non-zero default value.
            A zero value corresponds to an extra-paranoid level
@@ -168,16 +167,15 @@
 
         client = gconf_client_get_default ();
         value = gconf_client_get (client, key, NULL);
+        g_object_unref (client);
 
-        if (value == NULL) {
+        if (value == NULL || value->type != GCONF_VALUE_INT) {
                 res = default_value;
         } else {
                 res = gconf_value_get_int (value);
                 gconf_value_free (value);
         }
 
-        g_object_unref (client);
-
         return res;
 }
 
@@ -218,8 +216,8 @@
         g_get_current_time (&current_time);
 
         purge_data.now = current_time.tv_sec;
-        purge_data.max_age = get_gconf_int_with_nonzero_default (GCONF_THUMB_AGE, DEFAULT_MAX_AGE_IN_DAYS) * 24 * 60 * 60;
-        purge_data.max_size = get_gconf_int_with_nonzero_default (GCONF_THUMB_SIZE, DEFAULT_MAX_SIZE_IN_MB) * 1024 * 1024;
+        purge_data.max_age = get_gconf_int_with_default (GCONF_THUMB_AGE, DEFAULT_MAX_AGE_IN_DAYS) * 24 * 60 * 60;
+        purge_data.max_size = get_gconf_int_with_default (GCONF_THUMB_SIZE, DEFAULT_MAX_SIZE_IN_MB) * 1024 * 1024;
         purge_data.total_size = 0;
 
         if (purge_data.max_age >= 0)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]