aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-datetime.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-08-17 14:56:03 -0500
committerTed Gould <ted@gould.cx>2011-08-17 14:56:03 -0500
commit09f6c57c2441719f1d9d86ac629f970a7f95bfb5 (patch)
tree04bfa33a53145c64a9e999e3b9d319fc1486f5e0 /src/indicator-datetime.c
parentd6387351865a03d04d2d5881a59dd2652bc3947a (diff)
parentac74e3a3a1600fd57d23a7d8a5bf1be674a5b2d9 (diff)
downloadayatana-indicator-datetime-09f6c57c2441719f1d9d86ac629f970a7f95bfb5.tar.gz
ayatana-indicator-datetime-09f6c57c2441719f1d9d86ac629f970a7f95bfb5.tar.bz2
ayatana-indicator-datetime-09f6c57c2441719f1d9d86ac629f970a7f95bfb5.zip
Use cleaner gdatetime
Diffstat (limited to 'src/indicator-datetime.c')
-rw-r--r--src/indicator-datetime.c21
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);