[gnome-settings-daemon] datetime: Don't use filenames, use TZ names



commit b2a0bc089a777de0f2d04e1747fa14bbcfa7ee71
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 8 13:59:49 2010 +0000

    datetime: Don't use filenames, use TZ names
    
    There is absolutely no need for front-ends to know about the
    location on-disk of the timezone files. Just use the timezone names
    instead.

 plugins/datetime/gsd-datetime-mechanism.c   |   12 ++++++------
 plugins/datetime/gsd-datetime-mechanism.xml |    2 +-
 plugins/datetime/system-timezone.c          |   16 ----------------
 plugins/datetime/system-timezone.h          |    2 --
 4 files changed, 7 insertions(+), 25 deletions(-)
---
diff --git a/plugins/datetime/gsd-datetime-mechanism.c b/plugins/datetime/gsd-datetime-mechanism.c
index 0ee6564..1f1899d 100644
--- a/plugins/datetime/gsd-datetime-mechanism.c
+++ b/plugins/datetime/gsd-datetime-mechanism.c
@@ -397,7 +397,7 @@ gsd_datetime_mechanism_set_time (GsdDatetimeMechanism  *mechanism,
         struct timeval tv;
 
         reset_killtimer ();
-        g_debug ("SetTime(%lld) called", seconds_since_epoch);
+        g_debug ("SetTime(%" G_GINT64_FORMAT ") called", seconds_since_epoch);
 
         tv.tv_sec = (time_t) seconds_since_epoch;
         tv.tv_usec = 0;
@@ -412,7 +412,7 @@ gsd_datetime_mechanism_adjust_time (GsdDatetimeMechanism  *mechanism,
         struct timeval tv;
 
         reset_killtimer ();
-        g_debug ("AdjustTime(%lld) called", seconds_to_add);
+        g_debug ("AdjustTime(%" G_GINT64_FORMAT " ) called", seconds_to_add);
 
         if (gettimeofday (&tv, NULL) != 0) {
                 GError *error;
@@ -431,26 +431,26 @@ gsd_datetime_mechanism_adjust_time (GsdDatetimeMechanism  *mechanism,
 
 gboolean
 gsd_datetime_mechanism_set_timezone (GsdDatetimeMechanism  *mechanism,
-                                     const char            *zone_file,
+                                     const char            *tz,
                                      DBusGMethodInvocation *context)
 {
         GError *error;
 
         reset_killtimer ();
-        g_debug ("SetTimezone('%s') called", zone_file);
+        g_debug ("SetTimezone('%s') called", tz);
 
         if (!_check_polkit_for_action (mechanism, context, "org.gnome.settingsdaemon.datetimemechanism.settimezone"))
                 return FALSE;
 
         error = NULL;
 
-        if (!system_timezone_set_from_file (zone_file, &error)) {
+        if (!system_timezone_set (tz, &error)) {
                 GError *error2;
                 int     code;
 
                 if (error->code == SYSTEM_TIMEZONE_ERROR_INVALID_TIMEZONE_FILE)
                         code = GSD_DATETIME_MECHANISM_ERROR_INVALID_TIMEZONE_FILE;
-                else 
+                else
                         code = GSD_DATETIME_MECHANISM_ERROR_GENERAL;
 
                 error2 = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
diff --git a/plugins/datetime/gsd-datetime-mechanism.xml b/plugins/datetime/gsd-datetime-mechanism.xml
index bd097a0..2420e79 100644
--- a/plugins/datetime/gsd-datetime-mechanism.xml
+++ b/plugins/datetime/gsd-datetime-mechanism.xml
@@ -3,7 +3,7 @@
   <interface name="org.gnome.SettingsDaemon.DateTimeMechanism">
     <method name="SetTimezone">
       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
-      <arg name="zonefile" direction="in" type="s"/>
+      <arg name="tz" direction="in" type="s"/>
     </method>
 
     <method name="GetTimezone">
diff --git a/plugins/datetime/system-timezone.c b/plugins/datetime/system-timezone.c
index 43add01..4fcbf7b 100644
--- a/plugins/datetime/system-timezone.c
+++ b/plugins/datetime/system-timezone.c
@@ -998,22 +998,6 @@ system_timezone_update_config (const char  *tz,
 }
 
 gboolean
-system_timezone_set_from_file (const char  *zone_file,
-                               GError     **error)
-{
-        const char *tz;
-
-        g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
-        tz = zone_file + strlen (SYSTEM_ZONEINFODIR"/");
-
-        /* FIXME: is it right to return FALSE even when /etc/localtime was
-         * changed but not the config files? */
-        return (system_timezone_set_etc_timezone (zone_file, error) &&
-                system_timezone_update_config (tz, error));
-}
-
-gboolean
 system_timezone_set (const char  *tz,
                      GError     **error)
 {
diff --git a/plugins/datetime/system-timezone.h b/plugins/datetime/system-timezone.h
index 4049f49..3fd35b2 100644
--- a/plugins/datetime/system-timezone.h
+++ b/plugins/datetime/system-timezone.h
@@ -76,8 +76,6 @@ typedef enum
 
 char *system_timezone_find (void);
 
-gboolean system_timezone_set_from_file (const char  *zone_file,
-                                        GError     **error);
 gboolean system_timezone_set (const char  *tz,
                               GError     **error);
 



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