[gnome-settings-daemon] datetime: add a get_timezone function to the DateTimeMechanism object



commit b48b5980dd87817220e441079ca9bea835d44d2c
Author: Thomas Wood <thomas wood intel com>
Date:   Mon Jun 28 17:14:07 2010 +0100

    datetime: add a get_timezone function to the DateTimeMechanism object
    
    Add a function to the DateTimeMechanism object that retrieves the current
    timezone.

 plugins/datetime/gsd-datetime-mechanism.c   |   14 ++++++++++++++
 plugins/datetime/gsd-datetime-mechanism.xml |    6 ++++++
 plugins/datetime/system-timezone.c          |    3 +--
 plugins/datetime/system-timezone.h          |    2 ++
 4 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/plugins/datetime/gsd-datetime-mechanism.c b/plugins/datetime/gsd-datetime-mechanism.c
index 377978f..f95327e 100644
--- a/plugins/datetime/gsd-datetime-mechanism.c
+++ b/plugins/datetime/gsd-datetime-mechanism.c
@@ -463,6 +463,20 @@ gsd_datetime_mechanism_set_timezone (GsdDatetimeMechanism  *mechanism,
 }
 
 
+gboolean
+gsd_datetime_mechanism_get_timezone (GsdDatetimeMechanism   *mechism,
+                                     DBusGMethodInvocation  *context)
+{
+  gchar *timezone;
+
+  reset_killtimer ();
+
+  timezone = system_timezone_find ();
+
+  dbus_g_method_return (context, timezone);
+
+  return TRUE;
+}
 
 gboolean
 gsd_datetime_mechanism_get_hardware_clock_using_utc (GsdDatetimeMechanism  *mechanism,
diff --git a/plugins/datetime/gsd-datetime-mechanism.xml b/plugins/datetime/gsd-datetime-mechanism.xml
index a7efddf..bd097a0 100644
--- a/plugins/datetime/gsd-datetime-mechanism.xml
+++ b/plugins/datetime/gsd-datetime-mechanism.xml
@@ -5,6 +5,12 @@
       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
       <arg name="zonefile" direction="in" type="s"/>
     </method>
+
+    <method name="GetTimezone">
+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+      <arg name="timezone" direction="out" type="s"/>
+    </method>
+
     <method name="CanSetTimezone">
       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
       <arg name="value" direction="out" type="i">
diff --git a/plugins/datetime/system-timezone.c b/plugins/datetime/system-timezone.c
index 336f5a9..43add01 100644
--- a/plugins/datetime/system-timezone.c
+++ b/plugins/datetime/system-timezone.c
@@ -101,7 +101,6 @@ static void system_timezone_monitor_changed (GFileMonitor *handle,
                                              GFile *other_file,
                                              GFileMonitorEvent event,
                                              gpointer user_data);
-static char *system_timezone_find (void);
 
 #define PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SYSTEM_TIMEZONE_TYPE, SystemTimezonePrivate))
 
@@ -831,7 +830,7 @@ system_timezone_is_valid (const char *tz)
         return TRUE;
 }
 
-static char *
+char *
 system_timezone_find (void)
 {
         char *tz;
diff --git a/plugins/datetime/system-timezone.h b/plugins/datetime/system-timezone.h
index 6ae6dab..4049f49 100644
--- a/plugins/datetime/system-timezone.h
+++ b/plugins/datetime/system-timezone.h
@@ -74,6 +74,8 @@ typedef enum
         SYSTEM_TIMEZONE_NUM_ERRORS
 } SystemTimezoneError;
 
+char *system_timezone_find (void);
+
 gboolean system_timezone_set_from_file (const char  *zone_file,
                                         GError     **error);
 gboolean system_timezone_set (const char  *tz,



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