aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am33
-rw-r--r--src/Makefile.in88
-rw-r--r--src/calendar-menu-item.c100
-rw-r--r--src/calendar-menu-item.h59
-rw-r--r--src/datetime-interface.c98
-rw-r--r--src/datetime-interface.h55
-rw-r--r--src/datetime-service-client.h26
-rw-r--r--src/datetime-service-server.h73
-rw-r--r--src/datetime-service.c82
-rw-r--r--src/datetime-service.xml11
-rw-r--r--src/dbus-shared.h8
-rw-r--r--src/indicator-datetime.c72
12 files changed, 691 insertions, 14 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index fe3db2e..98d4733 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,18 +2,25 @@
libexec_PROGRAMS = indicator-datetime-service
indicator_datetime_service_SOURCES = \
+ datetime-interface.c \
+ datetime-interface.h \
+ datetime-service-server.h \
+ calendar-menu-item.c \
+ calendar-menu-item.h \
datetime-service.c \
dbus-shared.h
indicator_datetime_service_CFLAGS = \
-Wall \
-Werror \
- $(INDICATOR_CFLAGS)
+ $(INDICATOR_CFLAGS) \
+ -DTIMEZONE_FILE="\"/etc/timezone\""
indicator_datetime_service_LDADD = \
$(INDICATOR_LIBS)
datetimelibdir = $(INDICATORDIR)
datetimelib_LTLIBRARIES = libdatetime.la
libdatetime_la_SOURCES = \
+ datetime-service-client.h \
dbus-shared.h \
indicator-datetime.c
libdatetime_la_CFLAGS = \
@@ -25,4 +32,26 @@ libdatetime_la_LDFLAGS = \
-module \
-avoid-version
-EXTRA_DIST = $(libdatetime_la_SOURCES)
+datetime-service-client.h: $(srcdir)/datetime-service.xml
+ dbus-binding-tool \
+ --prefix=_datetime_service_client \
+ --mode=glib-client \
+ --output=datetime-service-client.h \
+ $(srcdir)/datetime-service.xml
+
+datetime-service-server.h: $(srcdir)/datetime-service.xml
+ dbus-binding-tool \
+ --prefix=_datetime_service_server \
+ --mode=glib-server \
+ --output=datetime-service-server.h \
+ $(srcdir)/datetime-service.xml
+
+BUILT_SOURCES = \
+ datetime-service-client.h \
+ datetime-service-server.h
+
+CLEANFILES = \
+ $(BUILT_SOURCES)
+
+EXTRA_DIST = \
+ datetime-service.xml
diff --git a/src/Makefile.in b/src/Makefile.in
index a1a5ba6..9bf7c3b 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -83,6 +83,8 @@ libdatetime_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(LDFLAGS) -o $@
PROGRAMS = $(libexec_PROGRAMS)
am_indicator_datetime_service_OBJECTS = \
+ indicator_datetime_service-datetime-interface.$(OBJEXT) \
+ indicator_datetime_service-calendar-menu-item.$(OBJEXT) \
indicator_datetime_service-datetime-service.$(OBJEXT)
indicator_datetime_service_OBJECTS = \
$(am_indicator_datetime_service_OBJECTS)
@@ -154,12 +156,14 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
GLIB_MKENUMS = @GLIB_MKENUMS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOMELOCALEDIR = @GNOMELOCALEDIR@
GREP = @GREP@
+GSETTINGS_DISABLE_SCHEMAS_COMPILE = @GSETTINGS_DISABLE_SCHEMAS_COMPILE@
INDICATORDIR = @INDICATORDIR@
INDICATORICONSDIR = @INDICATORICONSDIR@
INDICATOR_CFLAGS = @INDICATOR_CFLAGS@
@@ -205,6 +209,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POFILES = @POFILES@
POSUB = @POSUB@
PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
@@ -240,6 +246,7 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+gsettingsschemadir = @gsettingsschemadir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -270,13 +277,19 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
indicator_datetime_service_SOURCES = \
+ datetime-interface.c \
+ datetime-interface.h \
+ datetime-service-server.h \
+ calendar-menu-item.c \
+ calendar-menu-item.h \
datetime-service.c \
dbus-shared.h
indicator_datetime_service_CFLAGS = \
-Wall \
-Werror \
- $(INDICATOR_CFLAGS)
+ $(INDICATOR_CFLAGS) \
+ -DTIMEZONE_FILE="\"/etc/timezone\""
indicator_datetime_service_LDADD = \
$(INDICATOR_LIBS)
@@ -284,6 +297,7 @@ indicator_datetime_service_LDADD = \
datetimelibdir = $(INDICATORDIR)
datetimelib_LTLIBRARIES = libdatetime.la
libdatetime_la_SOURCES = \
+ datetime-service-client.h \
dbus-shared.h \
indicator-datetime.c
@@ -298,8 +312,18 @@ libdatetime_la_LDFLAGS = \
-module \
-avoid-version
-EXTRA_DIST = $(libdatetime_la_SOURCES)
-all: all-am
+BUILT_SOURCES = \
+ datetime-service-client.h \
+ datetime-service-server.h
+
+CLEANFILES = \
+ $(BUILT_SOURCES)
+
+EXTRA_DIST = \
+ datetime-service.xml
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
@@ -419,6 +443,8 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_service-calendar-menu-item.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_service-datetime-interface.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_service-datetime-service.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdatetime_la-indicator-datetime.Plo@am__quote@
@@ -454,6 +480,38 @@ libdatetime_la-indicator-datetime.lo: indicator-datetime.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdatetime_la_CFLAGS) $(CFLAGS) -c -o libdatetime_la-indicator-datetime.lo `test -f 'indicator-datetime.c' || echo '$(srcdir)/'`indicator-datetime.c
+indicator_datetime_service-datetime-interface.o: datetime-interface.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -MT indicator_datetime_service-datetime-interface.o -MD -MP -MF $(DEPDIR)/indicator_datetime_service-datetime-interface.Tpo -c -o indicator_datetime_service-datetime-interface.o `test -f 'datetime-interface.c' || echo '$(srcdir)/'`datetime-interface.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_service-datetime-interface.Tpo $(DEPDIR)/indicator_datetime_service-datetime-interface.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='datetime-interface.c' object='indicator_datetime_service-datetime-interface.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -c -o indicator_datetime_service-datetime-interface.o `test -f 'datetime-interface.c' || echo '$(srcdir)/'`datetime-interface.c
+
+indicator_datetime_service-datetime-interface.obj: datetime-interface.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -MT indicator_datetime_service-datetime-interface.obj -MD -MP -MF $(DEPDIR)/indicator_datetime_service-datetime-interface.Tpo -c -o indicator_datetime_service-datetime-interface.obj `if test -f 'datetime-interface.c'; then $(CYGPATH_W) 'datetime-interface.c'; else $(CYGPATH_W) '$(srcdir)/datetime-interface.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_service-datetime-interface.Tpo $(DEPDIR)/indicator_datetime_service-datetime-interface.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='datetime-interface.c' object='indicator_datetime_service-datetime-interface.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -c -o indicator_datetime_service-datetime-interface.obj `if test -f 'datetime-interface.c'; then $(CYGPATH_W) 'datetime-interface.c'; else $(CYGPATH_W) '$(srcdir)/datetime-interface.c'; fi`
+
+indicator_datetime_service-calendar-menu-item.o: calendar-menu-item.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -MT indicator_datetime_service-calendar-menu-item.o -MD -MP -MF $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Tpo -c -o indicator_datetime_service-calendar-menu-item.o `test -f 'calendar-menu-item.c' || echo '$(srcdir)/'`calendar-menu-item.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Tpo $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='calendar-menu-item.c' object='indicator_datetime_service-calendar-menu-item.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -c -o indicator_datetime_service-calendar-menu-item.o `test -f 'calendar-menu-item.c' || echo '$(srcdir)/'`calendar-menu-item.c
+
+indicator_datetime_service-calendar-menu-item.obj: calendar-menu-item.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -MT indicator_datetime_service-calendar-menu-item.obj -MD -MP -MF $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Tpo -c -o indicator_datetime_service-calendar-menu-item.obj `if test -f 'calendar-menu-item.c'; then $(CYGPATH_W) 'calendar-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/calendar-menu-item.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Tpo $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='calendar-menu-item.c' object='indicator_datetime_service-calendar-menu-item.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -c -o indicator_datetime_service-calendar-menu-item.obj `if test -f 'calendar-menu-item.c'; then $(CYGPATH_W) 'calendar-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/calendar-menu-item.c'; fi`
+
indicator_datetime_service-datetime-service.o: datetime-service.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -MT indicator_datetime_service-datetime-service.o -MD -MP -MF $(DEPDIR)/indicator_datetime_service-datetime-service.Tpo -c -o indicator_datetime_service-datetime-service.o `test -f 'datetime-service.c' || echo '$(srcdir)/'`datetime-service.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_service-datetime-service.Tpo $(DEPDIR)/indicator_datetime_service-datetime-service.Po
@@ -559,13 +617,15 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(datetimelibdir)" "$(DESTDIR)$(libexecdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
-install: install-am
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
@@ -582,6 +642,7 @@ install-strip:
mostlyclean-generic:
clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -590,6 +651,7 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am
clean-am: clean-datetimelibLTLIBRARIES clean-generic \
@@ -662,7 +724,7 @@ ps-am:
uninstall-am: uninstall-datetimelibLTLIBRARIES \
uninstall-libexecPROGRAMS
-.MAKE: install-am install-strip
+.MAKE: all check install install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean \
clean-datetimelibLTLIBRARIES clean-generic \
@@ -682,6 +744,20 @@ uninstall-am: uninstall-datetimelibLTLIBRARIES \
uninstall-libexecPROGRAMS
+datetime-service-client.h: $(srcdir)/datetime-service.xml
+ dbus-binding-tool \
+ --prefix=_datetime_service_client \
+ --mode=glib-client \
+ --output=datetime-service-client.h \
+ $(srcdir)/datetime-service.xml
+
+datetime-service-server.h: $(srcdir)/datetime-service.xml
+ dbus-binding-tool \
+ --prefix=_datetime_service_server \
+ --mode=glib-server \
+ --output=datetime-service-server.h \
+ $(srcdir)/datetime-service.xml
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/src/calendar-menu-item.c b/src/calendar-menu-item.c
new file mode 100644
index 0000000..c2ceec3
--- /dev/null
+++ b/src/calendar-menu-item.c
@@ -0,0 +1,100 @@
+/*
+Calendar menu item dbusmenu "transport" for the corresponding IDO widget.
+
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ David Barth <david.barth@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gdk/gdk.h>
+#include <glib/gi18n.h>
+#include "calendar-menu-item.h"
+
+#include "dbus-shared.h"
+
+#include <libdbusmenu-glib/client.h>
+#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/menuitem.h>
+
+enum {
+ LAST_SIGNAL
+};
+
+/* static guint signals[LAST_SIGNAL] = { }; */
+
+typedef struct _CalendarMenuItemPrivate CalendarMenuItemPrivate;
+struct _CalendarMenuItemPrivate
+{
+ void * placeholder;
+};
+
+#define CALENDAR_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItemPrivate))
+
+/* Prototypes */
+static void calendar_menu_item_class_init (CalendarMenuItemClass *klass);
+static void calendar_menu_item_init (CalendarMenuItem *self);
+static void calendar_menu_item_dispose (GObject *object);
+static void calendar_menu_item_finalize (GObject *object);
+
+G_DEFINE_TYPE (CalendarMenuItem, calendar_menu_item, DBUSMENU_TYPE_MENUITEM);
+
+static void
+calendar_menu_item_class_init (CalendarMenuItemClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (CalendarMenuItemPrivate));
+
+ object_class->dispose = calendar_menu_item_dispose;
+ object_class->finalize = calendar_menu_item_finalize;
+
+ return;
+}
+
+static void
+calendar_menu_item_init (CalendarMenuItem *self)
+{
+ return;
+}
+
+static void
+calendar_menu_item_dispose (GObject *object)
+{
+ G_OBJECT_CLASS (calendar_menu_item_parent_class)->dispose (object);
+}
+
+static void
+calendar_menu_item_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (calendar_menu_item_parent_class)->finalize (object);
+
+ return;
+}
+
+CalendarMenuItem *
+calendar_menu_item_new ()
+{
+ CalendarMenuItem * self = g_object_new(CALENDAR_MENU_ITEM_TYPE, NULL);
+
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CALENDAR_MENUITEM_TYPE);
+
+ return self;
+}
+
diff --git a/src/calendar-menu-item.h b/src/calendar-menu-item.h
new file mode 100644
index 0000000..7a56f96
--- /dev/null
+++ b/src/calendar-menu-item.h
@@ -0,0 +1,59 @@
+/*
+Calendar menu item dbusmenu "transport" for the corresponding IDO widget.
+
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ David Barth <david.barth@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __CALENDAR_MENU_ITEM_H__
+#define __CALENDAR_MENU_ITEM_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <libdbusmenu-glib/menuitem.h>
+
+G_BEGIN_DECLS
+
+#define CALENDAR_MENU_ITEM_TYPE (calendar_menu_item_get_type ())
+#define CALENDAR_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItem))
+#define CALENDAR_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItemClass))
+#define IS_CALENDAR_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALENDAR_MENU_ITEM_TYPE))
+#define IS_CALENDAR_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALENDAR_MENU_ITEM_TYPE))
+#define CALENDAR_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItemClass))
+
+#define CALENDAR_MENU_ITEM_SIGNAL_ACTIVATE "activate"
+#define CALENDAR_MENUITEM_PROP_TEXT "text"
+
+typedef struct _CalendarMenuItem CalendarMenuItem;
+typedef struct _CalendarMenuItemClass CalendarMenuItemClass;
+
+struct _CalendarMenuItemClass {
+ DbusmenuMenuitemClass parent_class;
+};
+
+struct _CalendarMenuItem {
+ DbusmenuMenuitem parent;
+};
+
+GType calendar_menu_item_get_type (void);
+CalendarMenuItem * calendar_menu_item_new ();
+
+G_END_DECLS
+
+#endif /* __CALENDAR_MENU_ITEM_H__ */
+
diff --git a/src/datetime-interface.c b/src/datetime-interface.c
new file mode 100644
index 0000000..c58c5af
--- /dev/null
+++ b/src/datetime-interface.c
@@ -0,0 +1,98 @@
+/*
+An indicator to time and date related information in the menubar.
+
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#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;
+}
diff --git a/src/datetime-interface.h b/src/datetime-interface.h
new file mode 100644
index 0000000..60ead1b
--- /dev/null
+++ b/src/datetime-interface.h
@@ -0,0 +1,55 @@
+/*
+An indicator to time and date related information in the menubar.
+
+Copyright 2010 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 3, as published
+by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranties of
+MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __DATETIME_INTERFACE_H__
+#define __DATETIME_INTERFACE_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define DATETIME_INTERFACE_TYPE (datetime_interface_get_type ())
+#define DATETIME_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DATETIME_INTERFACE_TYPE, DatetimeInterface))
+#define DATETIME_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DATETIME_INTERFACE_TYPE, DatetimeInterfaceClass))
+#define IS_DATETIME_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DATETIME_INTERFACE_TYPE))
+#define IS_DATETIME_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DATETIME_INTERFACE_TYPE))
+#define DATETIME_INTERFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DATETIME_INTERFACE_TYPE, DatetimeInterfaceClass))
+
+typedef struct _DatetimeInterface DatetimeInterface;
+typedef struct _DatetimeInterfaceClass DatetimeInterfaceClass;
+
+struct _DatetimeInterfaceClass {
+ GObjectClass parent_class;
+
+ void (*update_time) (void);
+};
+
+struct _DatetimeInterface {
+ GObject parent;
+};
+
+GType datetime_interface_get_type (void);
+void datetime_interface_update (DatetimeInterface *self);
+
+G_END_DECLS
+
+#endif
diff --git a/src/datetime-service-client.h b/src/datetime-service-client.h
new file mode 100644
index 0000000..76caedc
--- /dev/null
+++ b/src/datetime-service-client.h
@@ -0,0 +1,26 @@
+/* Generated by dbus-binding-tool; do not edit! */
+
+#include <glib.h>
+#include <dbus/dbus-glib.h>
+
+G_BEGIN_DECLS
+
+#ifndef _DBUS_GLIB_ASYNC_DATA_FREE
+#define _DBUS_GLIB_ASYNC_DATA_FREE
+static
+#ifdef G_HAVE_INLINE
+inline
+#endif
+void
+_dbus_glib_async_data_free (gpointer stuff)
+{
+ g_slice_free (DBusGAsyncData, stuff);
+}
+#endif
+
+#ifndef DBUS_GLIB_CLIENT_WRAPPERS_org_ayatana_indicator_datetime_service
+#define DBUS_GLIB_CLIENT_WRAPPERS_org_ayatana_indicator_datetime_service
+
+#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_ayatana_indicator_datetime_service */
+
+G_END_DECLS
diff --git a/src/datetime-service-server.h b/src/datetime-service-server.h
new file mode 100644
index 0000000..6a490c0
--- /dev/null
+++ b/src/datetime-service-server.h
@@ -0,0 +1,73 @@
+/* Generated by dbus-binding-tool; do not edit! */
+
+
+#ifndef __dbus_glib_marshal__datetime_service_server_MARSHAL_H__
+#define __dbus_glib_marshal__datetime_service_server_MARSHAL_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
+#define g_marshal_value_peek_char(v) g_value_get_char (v)
+#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
+#define g_marshal_value_peek_int(v) g_value_get_int (v)
+#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
+#define g_marshal_value_peek_long(v) g_value_get_long (v)
+#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
+#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
+#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
+#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
+#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
+#define g_marshal_value_peek_float(v) g_value_get_float (v)
+#define g_marshal_value_peek_double(v) g_value_get_double (v)
+#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
+#define g_marshal_value_peek_param(v) g_value_get_param (v)
+#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
+#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
+#define g_marshal_value_peek_object(v) g_value_get_object (v)
+#define g_marshal_value_peek_variant(v) g_value_get_variant (v)
+#else /* !G_ENABLE_DEBUG */
+/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
+ * Do not access GValues directly in your code. Instead, use the
+ * g_value_get_*() functions
+ */
+#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
+#define g_marshal_value_peek_char(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_int(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_long(v) (v)->data[0].v_long
+#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
+#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
+#define g_marshal_value_peek_enum(v) (v)->data[0].v_long
+#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_float(v) (v)->data[0].v_float
+#define g_marshal_value_peek_double(v) (v)->data[0].v_double
+#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+
+G_END_DECLS
+
+#endif /* __dbus_glib_marshal__datetime_service_server_MARSHAL_H__ */
+
+#include <dbus/dbus-glib.h>
+static const DBusGMethodInfo dbus_glib__datetime_service_server_methods[] = {
+};
+
+const DBusGObjectInfo dbus_glib__datetime_service_server_object_info = { 1,
+ dbus_glib__datetime_service_server_methods,
+ 0,
+"\0",
+"org.ayatana.indicator.datetime.service\0UpdateTime\0\0",
+"\0"
+};
+
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 2137065..c197980 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -23,17 +23,22 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libindicator/indicator-service.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <libdbusmenu-glib/server.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/menuitem.h>
+#include "datetime-interface.h"
#include "dbus-shared.h"
+static void setup_timer (void);
+
static IndicatorService * service = NULL;
static GMainLoop * mainloop = NULL;
static DbusmenuServer * server = NULL;
static DbusmenuMenuitem * root = NULL;
+static DatetimeInterface * dbus = NULL;
/* Global Items */
static DbusmenuMenuitem * date = NULL;
@@ -136,12 +141,11 @@ build_menus (DbusmenuMenuitem * root)
dbusmenu_menuitem_child_append(root, date);
g_idle_add(update_datetime, NULL);
- /* TODO: Set up updating daily */
}
if (calendar == NULL) {
calendar = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set (calendar, DBUSMENU_MENUITEM_PROP_LABEL, _("Open Calendar"));
+ dbusmenu_menuitem_property_set (calendar, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CALENDAR_MENUITEM_TYPE);
/* insensitive until we check for available apps */
dbusmenu_menuitem_property_set_bool(calendar, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE);
g_signal_connect (G_OBJECT(calendar), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
@@ -156,7 +160,7 @@ build_menus (DbusmenuMenuitem * root)
dbusmenu_menuitem_child_append(root, separator);
settings = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set (settings, DBUSMENU_MENUITEM_PROP_LABEL, _("Set Time and Date..."));
+ dbusmenu_menuitem_property_set (settings, DBUSMENU_MENUITEM_PROP_LABEL, _("Time & Date Settings..."));
/* insensitive until we check for available apps */
dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE);
g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "time-admin");
@@ -166,6 +170,68 @@ build_menus (DbusmenuMenuitem * root)
return;
}
+/* Run when the timezone file changes */
+static void
+timezone_changed (GFileMonitor * monitor, GFile * file, GFile * otherfile, GFileMonitorEvent event, gpointer user_data)
+{
+ datetime_interface_update(DATETIME_INTERFACE(user_data));
+ update_datetime(NULL);
+ setup_timer();
+ return;
+}
+
+/* Set up monitoring the timezone file */
+static void
+build_timezone (DatetimeInterface * dbus)
+{
+ GFile * timezonefile = g_file_new_for_path(TIMEZONE_FILE);
+ GFileMonitor * monitor = g_file_monitor_file(timezonefile, G_FILE_MONITOR_NONE, NULL, NULL);
+ if (monitor != NULL) {
+ g_signal_connect(G_OBJECT(monitor), "changed", G_CALLBACK(timezone_changed), dbus);
+ g_debug("Monitoring timezone file: '" TIMEZONE_FILE "'");
+ } else {
+ g_warning("Unable to monitor timezone file: '" TIMEZONE_FILE "'");
+ }
+ return;
+}
+
+/* Source ID for the timer */
+static guint timer = 0;
+
+/* Execute at a given time, update and setup a new
+ timer to go again. */
+static gboolean
+timer_func (gpointer user_data)
+{
+ timer = 0;
+ /* Reset up each time to reduce error */
+ setup_timer();
+ update_datetime(NULL);
+ return FALSE;
+}
+
+/* Sets up the time to launch the timer to update the
+ date in the datetime entry */
+static void
+setup_timer (void)
+{
+ if (timer != 0) {
+ g_source_remove(timer);
+ timer = 0;
+ }
+
+ time_t t;
+ t = time(NULL);
+ struct tm * ltime = localtime(&t);
+
+ timer = g_timeout_add_seconds(((23 - ltime->tm_hour) * 60 * 60) +
+ ((59 - ltime->tm_min) * 60) +
+ ((60 - ltime->tm_sec)) + 60 /* one minute past */,
+ timer_func, NULL);
+
+ return;
+}
+
/* Repsonds to the service object saying it's time to shutdown.
It stops the mainloop. */
static void
@@ -198,9 +264,19 @@ main (int argc, char ** argv)
dbusmenu_server_set_root(server, root);
build_menus(root);
+ /* Setup dbus interface */
+ dbus = g_object_new(DATETIME_INTERFACE_TYPE, NULL);
+
+ /* Setup timezone watch */
+ build_timezone(dbus);
+
+ /* Setup the timer */
+ setup_timer();
+
mainloop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(mainloop);
+ g_object_unref(G_OBJECT(dbus));
g_object_unref(G_OBJECT(service));
g_object_unref(G_OBJECT(server));
g_object_unref(G_OBJECT(root));
diff --git a/src/datetime-service.xml b/src/datetime-service.xml
new file mode 100644
index 0000000..1207ebb
--- /dev/null
+++ b/src/datetime-service.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/">
+ <interface name="org.ayatana.indicator.datetime.service">
+
+<!-- Methods -->
+
+<!-- Signals -->
+ <signal name="UpdateTime" />
+
+ </interface>
+</node>
diff --git a/src/dbus-shared.h b/src/dbus-shared.h
index aa6d933..357beb5 100644
--- a/src/dbus-shared.h
+++ b/src/dbus-shared.h
@@ -20,10 +20,12 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define SERVICE_NAME "org.ayatana.indicator.datetime"
-#define SERVICE_IFACE "org.ayatana.indicator.datetime.service"
-#define SERVICE_OBJ "/org/ayatana/indicator/datetime/service"
+#define SERVICE_NAME "org.ayatana.indicator.datetime"
+#define SERVICE_IFACE "org.ayatana.indicator.datetime.service"
+#define SERVICE_OBJ "/org/ayatana/indicator/datetime/service"
#define SERVICE_VERSION 1
#define MENU_OBJ "/org/ayatana/indicator/datetime/menu"
+#define DBUSMENU_CALENDAR_MENUITEM_TYPE "x-canonical-calendar-item"
+
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 7034fb8..cef2b00 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -29,6 +29,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
+/* DBus Stuff */
+#include <dbus/dbus-glib.h>
+
/* Indicator Stuff */
#include <libindicator/indicator.h>
#include <libindicator/indicator-object.h>
@@ -36,6 +39,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
/* DBusMenu */
#include <libdbusmenu-gtk/menu.h>
+#include <libido/idocalendarmenuitem.h>
#include "dbus-shared.h"
@@ -78,6 +82,9 @@ struct _IndicatorDatetimePrivate {
IndicatorServiceManager * sm;
DbusmenuGtkMenu * menu;
+ DBusGProxy * service_proxy;
+ IdoCalendarMenuItem *ido_calendar;
+
GSettings * settings;
};
@@ -135,6 +142,7 @@ static gchar * generate_format_string (IndicatorDatetime * self);
static struct tm * update_label (IndicatorDatetime * io);
static void guess_label_size (IndicatorDatetime * self);
static void setup_timer (IndicatorDatetime * self, struct tm * ltime);
+static void update_time (DBusGProxy * proxy, gpointer user_data);
/* Indicator Module Config */
INDICATOR_SET_VERSION
@@ -220,6 +228,8 @@ indicator_datetime_init (IndicatorDatetime *self)
self->priv->show_day = FALSE;
self->priv->custom_string = g_strdup(DEFAULT_TIME_FORMAT);
+ self->priv->service_proxy = NULL;
+
self->priv->sm = NULL;
self->priv->menu = NULL;
@@ -259,6 +269,21 @@ indicator_datetime_init (IndicatorDatetime *self)
self->priv->sm = indicator_service_manager_new_version(SERVICE_NAME, SERVICE_VERSION);
+ DBusGConnection * session = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+ if (session != NULL) {
+ self->priv->service_proxy = dbus_g_proxy_new_for_name(session,
+ SERVICE_NAME,
+ SERVICE_OBJ,
+ SERVICE_IFACE);
+
+ dbus_g_proxy_add_signal(self->priv->service_proxy, "UpdateTime", G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal(self->priv->service_proxy,
+ "UpdateTime",
+ G_CALLBACK(update_time),
+ self,
+ NULL);
+ }
+
return;
}
@@ -297,6 +322,11 @@ indicator_datetime_dispose (GObject *object)
self->priv->settings = NULL;
}
+ if (self->priv->service_proxy != NULL) {
+ g_object_unref(self->priv->service_proxy);
+ self->priv->service_proxy = NULL;
+ }
+
G_OBJECT_CLASS (indicator_datetime_parent_class)->dispose (object);
return;
}
@@ -534,6 +564,17 @@ update_label (IndicatorDatetime * io)
return ltime;
}
+/* Recieves the signal from the service that we should update
+ the time right now. Usually from a timezone switch. */
+static void
+update_time (DBusGProxy * proxy, gpointer user_data)
+{
+ IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
+ struct tm * ltime = update_label(self);
+ setup_timer(self, ltime);
+ return;
+}
+
/* Runs every minute and updates the time */
gboolean
timer_func (gpointer user_data)
@@ -882,6 +923,32 @@ generate_format_string (IndicatorDatetime * self)
return g_strdup_printf(_("%s, %s"), date_string, time_string);
}
+static gboolean
+new_calendar_item (DbusmenuMenuitem * newitem,
+ DbusmenuMenuitem * parent,
+ DbusmenuClient * client)
+{
+ g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE);
+ g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
+ /* Note: not checking parent, it's reasonable for it to be NULL */
+
+ IndicatorObject *io = g_object_get_data (G_OBJECT (client), "indicator");
+ if (io == NULL) {
+ g_warning ("found no indicator to attach the caledar to");
+ return FALSE;
+ }
+
+ IndicatorDatetime *self = INDICATOR_DATETIME(io);
+ self->priv = INDICATOR_DATETIME_GET_PRIVATE(self);
+
+ IdoCalendarMenuItem *ido = IDO_CALENDAR_MENU_ITEM (ido_calendar_menu_item_new ());
+ self->priv->ido_calendar = ido;
+
+ dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent);
+
+ return TRUE;
+}
+
/* Grabs the label. Creates it if it doesn't
exist already */
static GtkLabel *
@@ -915,5 +982,10 @@ get_menu (IndicatorObject * io)
self->priv->menu = dbusmenu_gtkmenu_new(SERVICE_NAME, MENU_OBJ);
}
+ DbusmenuGtkClient *client = dbusmenu_gtkmenu_get_client(self->priv->menu);
+ g_object_set_data (G_OBJECT (client), "indicator", io);
+
+ dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_CALENDAR_MENUITEM_TYPE, new_calendar_item);
+
return GTK_MENU(self->priv->menu);
}