aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-datetime.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-08-31 07:57:01 -0500
committerTed Gould <ted@gould.cx>2010-08-31 07:57:01 -0500
commita2176c0fda7b41546dbe75b25fed57cfe2376506 (patch)
tree498ce9b392b3aa7760a1af0b2ba532c0b7c59cfc /src/indicator-datetime.c
parent5c882ecc2474d48fbe7675b76cb23f9875905483 (diff)
parentd0f7670cc5c25a89c734ace8a442278b982c3caa (diff)
downloadayatana-indicator-datetime-a2176c0fda7b41546dbe75b25fed57cfe2376506.tar.gz
ayatana-indicator-datetime-a2176c0fda7b41546dbe75b25fed57cfe2376506.tar.bz2
ayatana-indicator-datetime-a2176c0fda7b41546dbe75b25fed57cfe2376506.zip
Updating to trunk
Diffstat (limited to 'src/indicator-datetime.c')
-rw-r--r--src/indicator-datetime.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 10d1329..cef2b00 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -39,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"
@@ -82,6 +83,7 @@ struct _IndicatorDatetimePrivate {
DbusmenuGtkMenu * menu;
DBusGProxy * service_proxy;
+ IdoCalendarMenuItem *ido_calendar;
GSettings * settings;
};
@@ -921,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 *
@@ -954,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);
}