aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-datetime.c
diff options
context:
space:
mode:
authorDavid Barth <david.barth@canonical.com>2010-07-22 21:26:08 +0200
committerDavid Barth <david.barth@canonical.com>2010-07-22 21:26:08 +0200
commit293ef57a01d459a4f5f9222fc80658597fb5820b (patch)
tree3824333a82daad3eaa0c4711858d0b73de02bcb2 /src/indicator-datetime.c
parentb93453548ac650dd5cf12785e231cfaf5e271c1e (diff)
parent2564f8526c2508be8847024f5aad6324db4fb256 (diff)
downloadayatana-indicator-datetime-293ef57a01d459a4f5f9222fc80658597fb5820b.tar.gz
ayatana-indicator-datetime-293ef57a01d459a4f5f9222fc80658597fb5820b.tar.bz2
ayatana-indicator-datetime-293ef57a01d459a4f5f9222fc80658597fb5820b.zip
merging the new calendar widget branch
Diffstat (limited to 'src/indicator-datetime.c')
-rw-r--r--src/indicator-datetime.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 7034fb8..e1f6571 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -36,6 +36,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 +79,8 @@ struct _IndicatorDatetimePrivate {
IndicatorServiceManager * sm;
DbusmenuGtkMenu * menu;
+ IdoCalendarMenuItem *ido_calendar;
+
GSettings * settings;
};
@@ -882,6 +885,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 +944,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);
}