aboutsummaryrefslogtreecommitdiff
path: root/src/datetime-interface.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-08-30 22:03:20 -0500
committerTed Gould <ted@gould.cx>2010-08-30 22:03:20 -0500
commitdc304670cce8f0b76377c2225d5da36b1ad1ba8d (patch)
treed71acb60315c0b0b4aea3912eefb14bf52839313 /src/datetime-interface.c
parent3ce9af6066484f5faa6ac3a2569d7ea9fb804745 (diff)
parente22fcc15f62ec03acc0250152281f921e51a0a1b (diff)
downloadayatana-indicator-datetime-dc304670cce8f0b76377c2225d5da36b1ad1ba8d.tar.gz
ayatana-indicator-datetime-dc304670cce8f0b76377c2225d5da36b1ad1ba8d.tar.bz2
ayatana-indicator-datetime-dc304670cce8f0b76377c2225d5da36b1ad1ba8d.zip
* Upstream Merge
* Refresh times on timezone change * Update the date daily
Diffstat (limited to 'src/datetime-interface.c')
-rw-r--r--src/datetime-interface.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/datetime-interface.c b/src/datetime-interface.c
new file mode 100644
index 0000000..246fcb3
--- /dev/null
+++ b/src/datetime-interface.c
@@ -0,0 +1,77 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "datetime-interface.h"
+#include "datetime-service-server.h"
+#include "dbus-shared.h"
+
+enum {
+ UPDATE_TIME,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+static void datetime_interface_class_init (DatetimeInterfaceClass *klass);
+static void datetime_interface_init (DatetimeInterface *self);
+static void datetime_interface_dispose (GObject *object);
+static void datetime_interface_finalize (GObject *object);
+
+G_DEFINE_TYPE (DatetimeInterface, datetime_interface, G_TYPE_OBJECT);
+
+static void
+datetime_interface_class_init (DatetimeInterfaceClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->dispose = datetime_interface_dispose;
+ object_class->finalize = datetime_interface_finalize;
+
+ signals[UPDATE_TIME] = g_signal_new("update-time",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (DatetimeInterfaceClass, update_time),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0, G_TYPE_NONE);
+
+ dbus_g_object_type_install_info(DATETIME_INTERFACE_TYPE, &dbus_glib__datetime_service_server_object_info);
+
+ return;
+}
+
+static void
+datetime_interface_init (DatetimeInterface *self)
+{
+ DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+ dbus_g_connection_register_g_object(connection,
+ SERVICE_OBJ,
+ G_OBJECT(self));
+
+ return;
+}
+
+static void
+datetime_interface_dispose (GObject *object)
+{
+
+ G_OBJECT_CLASS (datetime_interface_parent_class)->dispose (object);
+ return;
+}
+
+static void
+datetime_interface_finalize (GObject *object)
+{
+
+ G_OBJECT_CLASS (datetime_interface_parent_class)->finalize (object);
+ return;
+}
+
+void
+datetime_interface_update (DatetimeInterface *self)
+{
+ g_return_if_fail(IS_DATETIME_INTERFACE(self));
+ g_signal_emit(G_OBJECT(self), signals[UPDATE_TIME], 0, TRUE);
+ return;
+}