aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-datetime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/indicator-datetime.c')
-rw-r--r--src/indicator-datetime.c38
1 files changed, 24 insertions, 14 deletions
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;