aboutsummaryrefslogtreecommitdiff
path: root/src/datetime-service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/datetime-service.c')
-rw-r--r--src/datetime-service.c58
1 files changed, 57 insertions, 1 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 8a31940..3fe6ebb 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -23,6 +23,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libindicator/indicator-service.h>
#include <locale.h>
+#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
@@ -33,6 +34,15 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <geoclue/geoclue-master.h>
#include <geoclue/geoclue-master-client.h>
+#include <time.h>
+#include <libecal/e-cal.h>
+#include <libical/ical.h>
+#include <libecal/e-cal-time-util.h>
+#include <libedataserver/e-source.h>
+// Other users of ecal seem to also include these, not sure why they should be included by the above
+#include <libical/icaltime.h>
+
+
#include <oobs/oobs-timeconfig.h>
#include "datetime-interface.h"
@@ -225,6 +235,32 @@ check_for_calendar (gpointer user_data)
return FALSE;
}
+static gboolean
+update_timezone_menu_items(gpointer user_data) {
+ // Get the location preferences and the current location, highlight the current location somehow
+ return FALSE;
+}
+
+/* Populate the menu with todays, next 5 appointments.
+ * we should hook into the ABOUT TO SHOW signal and use that to update the appointments.
+ * Experience has shown that caldav's and webcals can be slow to load from eds
+ * this is a problem mainly on the EDS side of things, not ours.
+ */
+static gboolean
+update_appointment_menu_items (gpointer user_data) {
+ DbusmenuMenuitem * item = NULL;
+
+ gint i;
+ for (i = 0; i < 5; i++) {
+ item = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_TYPE, APPOINTMENT_MENUITEM_TYPE);
+ dbusmenu_menuitem_property_set (item, APPOINTMENT_MENUITEM_PROP_LABEL, "fake summary");
+ dbusmenu_menuitem_property_set (item, APPOINTMENT_MENUITEM_PROP_RIGHT, "9:00pm");
+ dbusmenu_menuitem_child_append (root, item);
+ }
+ return TRUE;
+}
+
/* Looks for the time and date admin application and enables the
item we have one */
static gboolean
@@ -272,8 +308,28 @@ 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);
- DbusmenuMenuitem * separator = dbusmenu_menuitem_new();
+ // 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);
+ if (calendar != NULL) {
+ // TODO Create "Add appointment" menu item
+ }
+ // TODO Create FFR? "Add timer" menu item
+
+ separator = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
+ dbusmenu_menuitem_child_append(root, separator);
+
+ update_timezone_menu_items(NULL);
+ // TODO Create "Add location" menu item
+
+ separator = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
dbusmenu_menuitem_child_append(root, separator);