aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/datetime-service.c10
-rw-r--r--src/indicator-datetime.c38
2 files changed, 31 insertions, 17 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 46b31ef..5616d1c 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -548,7 +548,6 @@ update_appointment_menu_items (gpointer user_data)
time_t t1, t2;
gchar *ad;
GList *l;
- //GList *allobjects = NULL;
GSList *g;
GError *gerror = NULL;
gint i;
@@ -560,7 +559,11 @@ update_appointment_menu_items (gpointer user_data)
else
time(&t1);
- t2 = t1 + (time_t) (7 * 24 * 60 * 60); /* 7 days ahead of now, we actually need number_of_days_in_this_month */
+ /* TODO: 7 days ahead of now, we actually need number_of_days_in_this_month
+ * so we call "mark-day" for all remaining days in this month
+ * N.B. Ideally we want any/all dates which are later than today to be marked.
+ */
+ t2 = t1 + (time_t) (7 * 24 * 60 * 60);
// TODO Remove all highlights from the calendar widget
@@ -619,7 +622,8 @@ update_appointment_menu_items (gpointer user_data)
}
gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
- // Sometimes these give negative numbers, sometimes large numbers which look like timestampss
+ // Sometimes these give negative numbers, sometimes large numbers which look like timestamps
+ // is there a buffer overwrite causing it?
if (width <= 0) width = 12;
if (height <= 0) height = 12;
if (width > 30) width = 12;
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 07be8de..cf61d25 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -1103,8 +1103,9 @@ indicator_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant *value,
} else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_CLEAR_MARKS)) {
ido_calendar_menu_item_clear_marks (IDO_CALENDAR_MENU_ITEM (mi_data));
} else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_SET_DATE)) {
- // TODO This needs to be an array of 3 ints
- //ido_calendar_menu_item_set_date (IDO_CALENDAR_MENU_ITEM (mi_data), );
+ gint *array = g_variant_get_fixed_array(value, 3, sizeof(gint));
+ // TODO: Needs ido branch merged - lp:~karl-qdh/ido/select-activate-set-date
+ //ido_calendar_menu_item_set_date (IDO_CALENDAR_MENU_ITEM (mi_data), array[0], array[1], array[2]);
} else {
g_warning("Indicator Item property '%s' unknown", prop);
}
@@ -1201,26 +1202,30 @@ month_changed_cb (IdoCalendarMenuItem *ido,
date.tm_year = y - 1900;
guint selecteddate = (guint)mktime(&date);
g_debug("Got month changed signal: %s", asctime(&date));
- g_debug("Selected date %d from %d-%d-%d", selecteddate, d, m, y);
GVariant *variant = g_variant_new_uint32(selecteddate);
guint timestamp = (guint)time(NULL);
dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "month-changed", variant, timestamp);
}
-/* The following needs ido changes to be merged
+
+// TODO: Needs ido branch merged - lp:~karl-qdh/ido/select-activate-set-date
+/*
static void
day_selected_cb (IdoCalendarMenuItem *ido,
guint day,
gpointer user_data)
{
- gchar datestring[20];
guint d,m,y;
DbusmenuMenuitem * item = DBUSMENU_MENUITEM (user_data);
ido_calendar_menu_item_get_date(ido, &y, &m, &d);
- g_sprintf(datestring, "%d-%d-%d", y, m, d);
- GVariant *variant = g_variant_new_string(datestring);
+ struct tm date = {0};
+ date.tm_mday = d;
+ date.tm_mon = m;
+ date.tm_year = y - 1900;
+ guint selecteddate = (guint)mktime(&date);
+ g_debug("Got day selected signal: %s", asctime(&date));
+ GVariant *variant = g_variant_new_uint32(selecteddate);
guint timestamp = (guint)time(NULL);
dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "day-selected", variant, timestamp);
- g_debug("Got day-selected signal: %s", datestring);
}
static void
@@ -1228,17 +1233,22 @@ day_selected_double_click_cb (IdoCalendarMenuItem *ido,
guint day,
gpointer user_data)
{
- gchar datestring[20];
guint d,m,y;
DbusmenuMenuitem * item = DBUSMENU_MENUITEM (user_data);
ido_calendar_menu_item_get_date(ido, &y, &m, &d);
- g_sprintf(datestring, "%d-%d-%d", y, m, d);
- GVariant *variant = g_variant_new_string(datestring);
+ struct tm date = {0};
+ date.tm_mday = d;
+ date.tm_mon = m;
+ date.tm_year = y - 1900;
+ guint selecteddate = (guint)mktime(&date);
+ g_debug("Got day selected double click signal: %s", asctime(&date));
+ GVariant *variant = g_variant_new_uint32(selecteddate);
guint timestamp = (guint)time(NULL);
dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "day-selected-double-click", variant, timestamp);
- g_debug("Got day-selected-double-click signal: %s", datestring);
}
*/
+
+
static gboolean
new_calendar_item (DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
@@ -1270,9 +1280,9 @@ new_calendar_item (DbusmenuMenuitem * newitem,
dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent);
g_signal_connect_after(ido, "month-changed", G_CALLBACK(month_changed_cb), (gpointer)newitem);
- dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent);
+
+ // TODO: Needs ido branch merged - lp:~karl-qdh/ido/select-activate-set-date
/*g_signal_connect_after(ido, "day-selected", G_CALLBACK(day_selected_cb), (gpointer)newitem);
- dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent);
g_signal_connect_after(ido, "day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), (gpointer)newitem);*/
return TRUE;