diff options
author | Ted Gould <ted@gould.cx> | 2011-08-18 15:28:13 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-08-18 15:28:13 -0500 |
commit | aa0da73e3aa68e9958b9187927fa581db4436c35 (patch) | |
tree | 69c7215b3bc97f739626eb0e5acede642c4484a4 /src/indicator-datetime.c | |
parent | 45d0776e19fd738130457daec5d8401837eb6a0d (diff) | |
parent | 70ef2f0a626ffbb05b85874398ca2e7ce9058745 (diff) | |
download | ayatana-indicator-datetime-aa0da73e3aa68e9958b9187927fa581db4436c35.tar.gz ayatana-indicator-datetime-aa0da73e3aa68e9958b9187927fa581db4436c35.tar.bz2 ayatana-indicator-datetime-aa0da73e3aa68e9958b9187927fa581db4436c35.zip |
New upstream release.
∘ Use cleaner GDateTime API
∘ Use locale preferred date format
∘ Use real ellipsis (LP: #621339)
Diffstat (limited to 'src/indicator-datetime.c')
-rw-r--r-- | src/indicator-datetime.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 163804b..aca1101 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -270,6 +270,9 @@ static void menu_visible_notfy_cb(GtkWidget * menu, G_GNUC_UNUSED GParamSpec *pspec, gpointer user_data) { IndicatorDatetime * self = INDICATOR_DATETIME(user_data); + GDateTime *datetime; + gint y, m, d; + g_debug("notify visible signal received"); // we should only react if we're currently visible @@ -277,18 +280,14 @@ menu_visible_notfy_cb(GtkWidget * menu, G_GNUC_UNUSED GParamSpec *pspec, gpointe g_object_get(G_OBJECT(menu), "visible", &visible, NULL); if (visible) return; g_debug("notify visible menu hidden, resetting date"); - - time_t curtime; - - time(&curtime); - struct tm *today = localtime(&curtime); - int y = today->tm_year; - int m = today->tm_mon; - int d = today->tm_mday; - + + datetime = g_date_time_new_now_local (); + g_date_time_get_ymd (datetime, &y, &m, &d); + g_date_time_unref (datetime); + // Set the calendar to todays date - ido_calendar_menu_item_set_date (self->priv->ido_calendar, y+1900, m, d); - + ido_calendar_menu_item_set_date (self->priv->ido_calendar, y, m-1, d); + // Make sure the day-selected signal is sent so the menu updates - may duplicate /*GVariant *variant = g_variant_new_uint32((guint)curtime); guint timestamp = (guint)time(NULL); |