diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/datetime-service.c | 24 | ||||
-rw-r--r-- | src/indicator-datetime.c | 4 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c index bd9a9c9..129ec14 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -318,6 +318,27 @@ day_selected_double_click_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant return TRUE; } +static gboolean +close_menu_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant) +{ + if (calendar == NULL) return FALSE; + start_time_appointments = 0; + // TODO create a variant which will be an array of 3 ints {y,m,d} + GVariant *date_variant; + time_t curtime; + struct tm *t1; + time(&curtime); + t1 = localtime(&curtime); + GVariant *date[3]; + date[0] = g_variant_new_uint32(t1->tm_year + 1900); + date[1] = g_variant_new_uint32(t1->tm_mon); + date[2] = g_variant_new_uint32(t1->tm_mday); + date_variant = g_variant_new_array(NULL, date, 3); + + dbusmenu_menuitem_property_set_variant (calendar, CALENDAR_MENUITEM_PROP_SET_DATE, date_variant); + return TRUE; +} + static guint ecaltimer = 0; static void @@ -1216,6 +1237,9 @@ main (int argc, char ** argv) build_menus(root); + // Connect to the close signal to reset the calendar date + g_signal_connect(root, "event::closed", G_CALLBACK(close_menu_cb), NULL); + /* Cache the timezone */ update_current_timezone(); diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 1cdcd3f..fb77974 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -1149,13 +1149,17 @@ indicator_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant *value, } else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_MARK)) { ido_calendar_menu_item_mark_day (IDO_CALENDAR_MENU_ITEM (mi_data), g_variant_get_int16(value)); + g_debug("Marked day: %d", g_variant_get_int16(value)); } else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_UNMARK)) { ido_calendar_menu_item_unmark_day (IDO_CALENDAR_MENU_ITEM (mi_data), g_variant_get_int16(value)); + g_debug("Unmarked day: %d", g_variant_get_int16(value)); } else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_CLEAR_MARKS)) { + g_debug("Cleared Marks"); ido_calendar_menu_item_clear_marks (IDO_CALENDAR_MENU_ITEM (mi_data)); } else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_SET_DATE)) { gsize size = 3; const gint * array = g_variant_get_fixed_array(value, &size, sizeof(gint)); + g_debug("Setting date y-m-d: %d-%d-%d", array[0], array[1], array[2]); 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); |