aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-datetime.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-14 21:37:51 -0500
committerTed Gould <ted@gould.cx>2011-03-14 21:37:51 -0500
commit7b3db506757233a530f88efebcd145784f720d9a (patch)
tree05ab2914cff0378cc673fbe60f656d8553b7cad0 /src/indicator-datetime.c
parent444370e95ed0f9e8ecf4c786e35855ff91c642ac (diff)
parent3cf4b8aea38d62a047b609d13909d79d5c246d65 (diff)
downloadayatana-indicator-datetime-7b3db506757233a530f88efebcd145784f720d9a.tar.gz
ayatana-indicator-datetime-7b3db506757233a530f88efebcd145784f720d9a.tar.bz2
ayatana-indicator-datetime-7b3db506757233a530f88efebcd145784f720d9a.zip
Change the appointments so that they're modified by the calendar month
Diffstat (limited to 'src/indicator-datetime.c')
-rw-r--r--src/indicator-datetime.c64
1 files changed, 59 insertions, 5 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 46ed0d9..d48cb55 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -1153,6 +1153,10 @@ indicator_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant *value,
ido_calendar_menu_item_unmark_day (IDO_CALENDAR_MENU_ITEM (mi_data), g_variant_get_int16(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)) {
+ 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);
}
@@ -1240,17 +1244,62 @@ static void
month_changed_cb (IdoCalendarMenuItem *ido,
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 month changed signal: %s", asctime(&date));
+ GVariant *variant = g_variant_new_uint32(selecteddate);
guint timestamp = (guint)time(NULL);
- dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "event::month-changed", variant, timestamp);
- g_debug("Got month changed signal: %s", datestring);
+ dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "month-changed", variant, timestamp);
}
+// 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)
+{
+ guint d,m,y;
+ DbusmenuMenuitem * item = DBUSMENU_MENUITEM (user_data);
+ ido_calendar_menu_item_get_date(ido, &y, &m, &d);
+ 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);
+}
+
+static void
+day_selected_double_click_cb (IdoCalendarMenuItem *ido,
+ guint day,
+ gpointer user_data)
+{
+ guint d,m,y;
+ DbusmenuMenuitem * item = DBUSMENU_MENUITEM (user_data);
+ ido_calendar_menu_item_get_date(ido, &y, &m, &d);
+ 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);
+}
+*/
+
+
static gboolean
new_calendar_item (DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
@@ -1284,6 +1333,11 @@ 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);
+
+ // 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);
+ g_signal_connect_after(ido, "day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), (gpointer)newitem);*/
+
return TRUE;
}