aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkarl-qdh <karl@qdh.org.uk>2011-01-11 15:48:58 +0000
committerkarl-qdh <karl@qdh.org.uk>2011-01-11 15:48:58 +0000
commited67c38fc82ed34fc7fe7afeb94a5af56f963c52 (patch)
tree1f3806739126f7e0824d4e6ead739d4f4e1ad58d /src
parentfeb60b1977c1fe3fa45452bc40f6635f56b0e39f (diff)
downloadayatana-indicator-datetime-ed67c38fc82ed34fc7fe7afeb94a5af56f963c52.tar.gz
ayatana-indicator-datetime-ed67c38fc82ed34fc7fe7afeb94a5af56f963c52.tar.bz2
ayatana-indicator-datetime-ed67c38fc82ed34fc7fe7afeb94a5af56f963c52.zip
Updated some minor things, the last commit wasn't exactly great, still untested, looking for a way to pull the evolution URI out of the events.
Diffstat (limited to 'src')
-rw-r--r--src/datetime-service.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 1e4404d..cd8ca92 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -236,9 +236,19 @@ check_for_calendar (gpointer user_data)
}
/* Populate the menu with todays, next 5 appointments. We probably want to shift this off to an idle-add
+ * the problem is the inserting order of items and updating them might be difficult.
+ * we should hook into the ABOUT TO SHOW signal and use that to update the appointments.
*/
static gboolean
-update_calendar_menu_items (gpointer user_data) {
+update_appointment_menu_items (gpointer user_data) {
+
+ time_t t1, t2;
+ gchar *query, *is, *ie;
+ GList *objects = NULL, *l;
+ GError *gerror = NULL;
+ DbusmenuMenuitem * item = NULL;
+ gint i;
+
ecal = e_cal_new_system_calendar();
if (!ecal) {
g_debug("e_cal_new_system_calendar failed");
@@ -261,13 +271,6 @@ update_calendar_menu_items (gpointer user_data) {
ecal_timezone = icaltimezone_get_tzid(tzone);
- time_t t1, t2;
- gchar *query, *is, *ie;
- GList *objects = NULL, *l;
- GError *gerror = NULL;
- DbusmenuMenuitem * item = NULL;
- gint i;
-
// TODO: Remove all the existing menu items which are appointments.
time(&t1);
@@ -283,7 +286,7 @@ update_calendar_menu_items (gpointer user_data) {
g_debug("Failed to get objects\n");
g_free(ecal);
ecal = NULL;
- return TRUE;
+ return FALSE;
}
i = 0;
gint width, height;
@@ -293,7 +296,7 @@ update_calendar_menu_items (gpointer user_data) {
icalcomponent *icalcomp = l->data;
icalproperty* p;
icalvalue *v;
- gchar *name, due;
+ gchar *name, *due, *uri;
p = icalcomponent_get_first_property(icalcomp, ICAL_NAME_PROPERTY);
v = icalproperty_get_value(p);
name = icalvalue_get_string(v);
@@ -302,7 +305,6 @@ update_calendar_menu_items (gpointer user_data) {
v = icalproperty_get_value(p);
due = icalvalue_get_string(v);
-
// TODO: now we pull out the URI for the calendar event and try to create a URI that'll work when we execute evolution
//cairo_surface_t *cs = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
@@ -321,10 +323,14 @@ update_calendar_menu_items (gpointer user_data) {
dbusmenu_menuitem_property_set_bool (item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
dbusmenu_menuitem_property_set_bool (item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
dbusmenu_menuitem_child_append (root, item);
+ //g_signal_connect (G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
+ // G_CALLBACK (activate_cb), "evolution %s", uri);
if (i == 4) break; // See above FIXME regarding query result limit
i++;
}
+ g_free(ecal); // Really we should do the setup somewhere where we know it'll only run once, right now, we'll do it every time and free it.
+ return TRUE;
}
/* Looks for the time and date admin application and enables the
@@ -374,8 +380,17 @@ build_menus (DbusmenuMenuitem * root)
g_idle_add(check_for_calendar, NULL);
}
+ DbusmenuMenuitem * separator;
+
+ separator = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
+ dbusmenu_menuitem_child_append(root, separator);
+
+ // This just populates the items on startup later we want to be able to update the appointments before
+ // presenting the menu.
+ update_appointment_menu_items(NULL);
- DbusmenuMenuitem * separator = dbusmenu_menuitem_new();
+ separator = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
dbusmenu_menuitem_child_append(root, separator);