aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkarl-qdh <karl@qdh.org.uk>2011-03-30 12:49:01 +0100
committerkarl-qdh <karl@qdh.org.uk>2011-03-30 12:49:01 +0100
commit851b7395730c2679403bc69013a9aea94584721d (patch)
treea4784968ed84bd309e2af8e6fa2dec186dc3a2bb
parent26fddf955899a2751b140a8c5a75f6861509b66e (diff)
downloadayatana-indicator-datetime-851b7395730c2679403bc69013a9aea94584721d.tar.gz
ayatana-indicator-datetime-851b7395730c2679403bc69013a9aea94584721d.tar.bz2
ayatana-indicator-datetime-851b7395730c2679403bc69013a9aea94584721d.zip
Made marking work when you change month, still needs more work to get it to do it on startup properly.
-rw-r--r--src/datetime-service.c6
-rw-r--r--src/indicator-datetime.c34
2 files changed, 20 insertions, 20 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index b0298ae..36a9a73 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -607,7 +607,7 @@ update_appointment_menu_items (gpointer user_data)
int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if ((this_year % 400 == 0) || (this_year % 100 > 0 && this_year % 4 == 0)) days[1] = 29;
- int highlightdays = days[mon] - mday;
+ int highlightdays = days[mon] - mday + 1;
t1 = curtime; // By default the current time is the appointment start time.
if (start_time_appointments > 0) {
@@ -621,7 +621,7 @@ update_appointment_menu_items (gpointer user_data)
month_start.tm_mon = start_tm->tm_mon;
month_start.tm_mday = 1;
t1 = mktime(&month_start);
- highlightdays = days[mon];
+ highlightdays = days[start_month];
}
}
@@ -699,8 +699,6 @@ update_appointment_menu_items (gpointer user_data)
} else {
apt_output = SETTINGS_TIME_LOCALE;
}
- // Remove all highlights from the calendar widget
- dbusmenu_menuitem_property_set (calendar, CALENDAR_MENUITEM_PROP_CLEAR_MARKS, NULL);
GVariantBuilder markeddays;
g_variant_builder_init (&markeddays, G_VARIANT_TYPE_ARRAY);
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 71b174c..ef3a857 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -1155,25 +1155,27 @@ calendar_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant *value, I
{
g_debug("Changing calendar property");
if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_MARK)) {
- GVariantIter iter;
- GVariant *day;
- gchar *key;
-
- g_variant_iter_init (&iter, value);
- while (g_variant_iter_loop (&iter, "{i}", &key, &day)) {
- ido_calendar_menu_item_mark_day (IDO_CALENDAR_MENU_ITEM (mi_data), g_variant_get_int32(day));
- g_debug("Marked day: %d", g_variant_get_int32(day));
+ ido_calendar_menu_item_clear_marks (IDO_CALENDAR_MENU_ITEM (mi_data));
+ g_debug("Marks: Cleared");
+ GVariantIter *iter;
+ gint day;
+
+ g_variant_get (value, "ai", &iter);
+ while (g_variant_iter_loop (iter, "i", &day)) {
+ ido_calendar_menu_item_mark_day (IDO_CALENDAR_MENU_ITEM (mi_data), day);
+ g_debug("Marks: Marked day: %d", day);
}
+ g_variant_iter_free (iter);
} else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_UNMARK)) {
- GVariantIter iter;
- GVariant *day;
- gchar *key;
-
- g_variant_iter_init (&iter, value);
- while (g_variant_iter_loop (&iter, "{i}", &key, &day)) {
- ido_calendar_menu_item_unmark_day (IDO_CALENDAR_MENU_ITEM (mi_data), g_variant_get_int32(day));
- g_debug("Unmarked day: %d", g_variant_get_int32(day));
+ GVariantIter *iter;
+ gint day;
+
+ g_variant_get (value, "ai", &iter);
+ while (g_variant_iter_loop (iter, "i", &day)) {
+ g_debug("Unmarked day: %d", day);
+ ido_calendar_menu_item_unmark_day (IDO_CALENDAR_MENU_ITEM (mi_data), day);
}
+ g_variant_iter_free (iter);
} else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_CLEAR_MARKS)) {
ido_calendar_menu_item_clear_marks (IDO_CALENDAR_MENU_ITEM (mi_data));
g_debug("Cleared Marks");