aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkarl-qdh <karl@qdh.org.uk>2011-03-08 13:18:50 +0000
committerkarl-qdh <karl@qdh.org.uk>2011-03-08 13:18:50 +0000
commit3bd841330e0299c54031218e3fc20f911ba7e952 (patch)
treeb7203cae26a1e2cfc6f7c0fe1d7e0ccc3cf3bece /src
parent7823baf6ae4d84d7796bd003f2c3f0bb0122d126 (diff)
downloadayatana-indicator-datetime-3bd841330e0299c54031218e3fc20f911ba7e952.tar.gz
ayatana-indicator-datetime-3bd841330e0299c54031218e3fc20f911ba7e952.tar.bz2
ayatana-indicator-datetime-3bd841330e0299c54031218e3fc20f911ba7e952.zip
Fixed incorrect year in tm struct for indicator-datetime.c:month_changed_cb, still receiving a segfault in
datetime-service.c when we try to use the variant. Checked the variant value over dbus and its fine.
Diffstat (limited to 'src')
-rw-r--r--src/datetime-service.c15
-rw-r--r--src/indicator-datetime.c21
2 files changed, 19 insertions, 17 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index b097217..78e695d 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -82,6 +82,7 @@ static GList * appointments = NULL;
static GList * dconflocations = NULL;
static GList * comp_instances = NULL;
static gboolean updating_appointments = FALSE;
+//static time_t start_time_appointments = NULL;
GSettings *conf;
@@ -279,12 +280,16 @@ activate_cb (DbusmenuMenuitem * menuitem, guint timestamp, const gchar *command)
static gboolean
month_changed_cb (DbusmenuMenuitem * menuitem, GVariant *variant, guint timestamp)
{
- // BLOCKED: Get string from the variant causes segfault in glib
- // TODO: * Decode the month/year from the string we received
- // * Check what our current month/year are
- // * Set some globals so when we-re-run update appointment menu items it gets the right start date
+ // BLOCKED: get type, then get type as string from the variant causes segfault in glib
+ // TODO: * Set some globals so when we-re-run update appointment menu items it gets the right start date
// * update appointment menu items
- g_debug("Received month changed : %d", g_variant_get_uint32(variant));
+ if (g_variant_get_type(variant) != G_VARIANT_TYPE_UINT32)
+ g_debug("Variant type is not uint32");
+ else
+ g_debug("Received month changed with timestamp: %d", g_variant_get_uint32(variant));
+
+ //start_time_appointments = (time_t)g_variant_get_uint32(variant);
+ //update_appointment_menu_items(NULL);
return TRUE;
}
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 944b33d..86eeed6 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -1192,24 +1192,21 @@ 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);
- struct tm date;
+ struct tm date = {0};
date.tm_mday = d;
- date.tm_mon = m;
- date.tm_year = y;
- date.tm_hour = 0;
- date.tm_min = 0;
+ date.tm_mon = m + 1; // Month is always off by one
+ 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);
- g_debug("Got month changed signal: %s", datestring);
}
-
+/* The following needs ido changes to be merged
static void
day_selected_cb (IdoCalendarMenuItem *ido,
guint day,
@@ -1241,7 +1238,7 @@ day_selected_double_click_cb (IdoCalendarMenuItem *ido,
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,
@@ -1274,9 +1271,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);
- g_signal_connect_after(ido, "day-selected", G_CALLBACK(day_selected_cb), (gpointer)newitem);
+ /*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);
+ g_signal_connect_after(ido, "day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), (gpointer)newitem);*/
return TRUE;
}