aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-03-16 18:44:40 -0400
committerKen VanDine <ken.vandine@canonical.com>2011-03-16 18:44:40 -0400
commit28103d195c1356c21e61b09c546e2ee583b03112 (patch)
tree3543bbcc42ba554878b3e05b2fe1ac504c4b7c91
parentdad04c02798827909038b22b993027b800596557 (diff)
parent27e02c433cc3a871e100a7120f9f9e6e73c5a661 (diff)
downloadayatana-indicator-datetime-28103d195c1356c21e61b09c546e2ee583b03112.tar.gz
ayatana-indicator-datetime-28103d195c1356c21e61b09c546e2ee583b03112.tar.bz2
ayatana-indicator-datetime-28103d195c1356c21e61b09c546e2ee583b03112.zip
releasing version 0.1.98-0ubuntu10.1.98-0ubuntu1
-rw-r--r--ChangeLog67
-rwxr-xr-xconfigure22
-rw-r--r--configure.ac6
-rw-r--r--debian/changelog10
-rw-r--r--debian/control2
-rw-r--r--src/datetime-service.c217
-rw-r--r--src/dbus-shared.h1
-rw-r--r--src/indicator-datetime.c58
-rw-r--r--src/settings-shared.h4
9 files changed, 303 insertions, 84 deletions
diff --git a/ChangeLog b/ChangeLog
index c48a912..8448b10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,72 @@
# Generated by Makefile. Do not edit.
+2011-03-16 Ted Gould <ted@gould.cx>
+
+ 0.1.98
+
+2011-03-16 Ted Gould <ted@gould.cx>
+
+ Updating to required IDO version
+
+2011-03-16 Ted Gould <ted@gould.cx>
+
+ Get more signals from the calendar and use them for good.
+
+2011-03-15 karl-qdh <karl@qdh.org.uk>
+
+ Fixed up much of the calendar browsing
+
+2011-03-15 karl-qdh <karl@qdh.org.uk>
+
+ Fixed missed build error, caused by sync problems between netbook and laptop.
+
+2011-03-14 Ted Gould <ted@gould.cx>
+
+ Fix appointment time format
+
+2011-03-14 karl-qdh <karl@qdh.org.uk>
+
+ Merged back with the pre-requisite branch and updated to include ted's suggested _()'s in strftime
+
+2011-03-08 karl-qdh <karl@qdh.org.uk>
+
+ Fixed time format of appointments not respecting the configuration
+
+2011-03-14 Ted Gould <ted@gould.cx>
+
+ Commenting out value as we're not using it yet.
+
+2011-03-14 Ted Gould <ted@gould.cx>
+
+ Change the appointments so that they're modified by the calendar month
+
+2011-03-14 karl-qdh <karl@qdh.org.uk>
+
+ Fixing ted's comments
+
+2011-03-08 karl-qdh <karl@qdh.org.uk>
+
+ Fixed calendar browsing with month-changed and removed bogus off by one error
+
+2011-03-08 karl-qdh <karl@qdh.org.uk>
+
+ Changed update appointment items so there's less of a delay when refreshing between no-appointments and appointments loaded.
+ Fixed the handle_event signalling from the client to the service.
+ Started hooking up calendar browsing.
+
+2011-03-08 karl-qdh <karl@qdh.org.uk>
+
+ 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.
+
+2011-03-06 karl-qdh <karl@qdh.org.uk>
+
+ Tried using uint but still segfaulting in variant code
+
+2011-03-06 karl-qdh <karl@qdh.org.uk>
+
+ Hooking up the signals from the calendar and getting it working on service side
+
2011-03-10 Ted Gould <ted@gould.cx>
0.1.97
diff --git a/configure b/configure
index e600bc2..577ed72 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for indicator-datetime 0.1.97.
+# Generated by GNU Autoconf 2.67 for indicator-datetime 0.1.98.
#
# Report bugs to <ted@canonical.com>.
#
@@ -703,8 +703,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='indicator-datetime'
PACKAGE_TARNAME='indicator-datetime'
-PACKAGE_VERSION='0.1.97'
-PACKAGE_STRING='indicator-datetime 0.1.97'
+PACKAGE_VERSION='0.1.98'
+PACKAGE_STRING='indicator-datetime 0.1.98'
PACKAGE_BUGREPORT='ted@canonical.com'
PACKAGE_URL=''
@@ -1502,7 +1502,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures indicator-datetime 0.1.97 to adapt to many kinds of systems.
+\`configure' configures indicator-datetime 0.1.98 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1573,7 +1573,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of indicator-datetime 0.1.97:";;
+ short | recursive ) echo "Configuration of indicator-datetime 0.1.98:";;
esac
cat <<\_ACEOF
@@ -1701,7 +1701,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-indicator-datetime configure 0.1.97
+indicator-datetime configure 0.1.98
generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2072,7 +2072,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by indicator-datetime $as_me 0.1.97, which was
+It was created by indicator-datetime $as_me 0.1.98, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
@@ -2893,7 +2893,7 @@ fi
# Define the identity of the package.
PACKAGE=indicator-datetime
- VERSION=0.1.97
+ VERSION=0.1.98
cat >>confdefs.h <<_ACEOF
@@ -12221,7 +12221,7 @@ DBUSMENUGLIB_REQUIRED_VERSION=0.1.1
DBUSMENUGTK_REQUIRED_VERSION=0.3.94
GIO_REQUIRED_VERSION=2.25.11
# Note: the GIO check below also ensures the proper glib with gsettings support is present
-INDICATOR_DISPLAY_OBJECTS=0.1.10
+INDICATOR_DISPLAY_OBJECTS=0.2.2
GEOCLUE_REQUIRED_VERSION=0.12.0
OOBS_REQUIRED_VERSION=2.31.0
ECAL_REQUIRED_VERSION=2.30
@@ -14964,7 +14964,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by indicator-datetime $as_me 0.1.97, which was
+This file was extended by indicator-datetime $as_me 0.1.98, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15030,7 +15030,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-indicator-datetime config.status 0.1.97
+indicator-datetime config.status 0.1.98
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 177c7e2..88c7b20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,11 @@
-AC_INIT(indicator-datetime, 0.1.97, ted@canonical.com)
+AC_INIT(indicator-datetime, 0.1.98, ted@canonical.com)
AC_COPYRIGHT([Copyright 2009,2010 Canonical])
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-datetime, 0.1.97)
+AM_INIT_AUTOMAKE(indicator-datetime, 0.1.98)
AM_MAINTAINER_MODE
@@ -56,7 +56,7 @@ DBUSMENUGLIB_REQUIRED_VERSION=0.1.1
DBUSMENUGTK_REQUIRED_VERSION=0.3.94
GIO_REQUIRED_VERSION=2.25.11
# Note: the GIO check below also ensures the proper glib with gsettings support is present
-INDICATOR_DISPLAY_OBJECTS=0.1.10
+INDICATOR_DISPLAY_OBJECTS=0.2.2
GEOCLUE_REQUIRED_VERSION=0.12.0
OOBS_REQUIRED_VERSION=2.31.0
ECAL_REQUIRED_VERSION=2.30
diff --git a/debian/changelog b/debian/changelog
index 505a49e..f420f39 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,17 @@
-indicator-datetime (0.1.97-0ubuntu1) UNRELEASED; urgency=low
+indicator-datetime (0.1.98-0ubuntu1) natty; urgency=low
* New upstream release.
+ ∘ Make appointments match calendar month
+ ∘ Fix time format of appointments
+ ∘ Get date change signals from calendar and adjust based on them.
+ ∘ Crash fixes (LP: #733833, LP: #729444)
+ ∘ Valgrind invalid read (LP: #729175)
+ ∘ Translation fixes to date label (LP: #729632)
* Fix handling of reoccruing events
* Handle settings in the indicator
* Allow for hiding the calendar and the clock
- -- Ted Gould <ted@ubuntu.com> Thu, 10 Mar 2011 23:14:41 -0600
+ -- Ted Gould <ted@ubuntu.com> Wed, 16 Mar 2011 16:17:38 -0500
indicator-datetime (0.1.96-0ubuntu1) natty; urgency=low
diff --git a/debian/control b/debian/control
index 1aacc14..ff8df82 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ Build-Depends: cdbs,
libdbusmenu-glib-dev (>= 0.3.90),
libdbusmenu-gtk-dev (>= 0.3.90),
libglib2.0-dev (>= 2.25.0),
- libido-0.1-dev (>= 0.2.1-0ubuntu2),
+ libido-0.1-dev (>= 0.2.2),
libgeoclue-dev (>= 0.12.0),
liboobs-1-dev (>= 2.31.0),
libecal1.2-dev (>= 2.30),
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 3a0a3f0..18fa583 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 = (time_t) 0;
GSettings *conf;
@@ -277,14 +278,43 @@ activate_cb (DbusmenuMenuitem * menuitem, guint timestamp, const gchar *command)
}
static gboolean
-month_changed_cb (DbusmenuMenuitem * menuitem, GVariant *variant, guint timestamp)
+month_changed_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp)
{
- // BLOCKED: We're not getting the signal from calendar the ido calendar menuitem
- // 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
- // * update appointment menu items
- g_debug("Received month changed : %s", g_variant_get_string(variant, NULL));
+ start_time_appointments = (time_t)g_variant_get_uint32(variant);
+
+ g_debug("Received month changed with timestamp: %d -> %s",(int)start_time_appointments, ctime(&start_time_appointments));
+ update_appointment_menu_items(NULL);
+ return TRUE;
+}
+
+static gboolean
+day_selected_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp)
+{
+ start_time_appointments = (time_t)g_variant_get_uint32(variant);
+
+ g_debug("Received day-selected with timestamp: %d -> %s",(int)start_time_appointments, ctime(&start_time_appointments));
+ update_appointment_menu_items(NULL);
+ return TRUE;
+}
+
+static gboolean
+day_selected_double_click_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp)
+{
+ time_t evotime = (time_t)g_variant_get_uint32(variant);
+
+ g_debug("Received day-selected-double-click with timestamp: %d -> %s",(int)evotime, ctime(&evotime));
+
+ gchar *ad = isodate_from_time_t(evotime);
+ gchar *cmd = g_strconcat("evolution calendar:///?startdate=", ad, NULL);
+
+ GError * error = NULL;
+
+ g_debug("Issuing command '%s'", cmd);
+ if (!g_spawn_command_line_async(cmd, &error)) {
+ g_warning("Unable to start %s: %s", (char *)cmd, error->message);
+ g_error_free(error);
+ }
+
return TRUE;
}
@@ -363,8 +393,10 @@ check_for_calendar (gpointer user_data)
stop_ecal_timer();
}
- // Connect to event::month-changed
+ // Connect to calendar events
g_signal_connect(calendar, "event::month-changed", G_CALLBACK(month_changed_cb), NULL);
+ g_signal_connect(calendar, "event::day-selected", G_CALLBACK(day_selected_cb), NULL);
+ g_signal_connect(calendar, "event::day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), NULL);
g_free(evo);
} else {
g_debug("Unable to find calendar app.");
@@ -535,39 +567,57 @@ update_appointment_menu_items (gpointer user_data)
{
// FFR: we should take into account short term timers, for instance
// tea timers, pomodoro timers etc... that people may add, this is hinted to in the spec.
+ g_debug("Update appointments called");
if (calendar == NULL) return FALSE;
if (!g_settings_get_boolean(conf, SETTINGS_SHOW_EVENTS_S)) return FALSE;
if (updating_appointments) return TRUE;
updating_appointments = TRUE;
- time_t t1, t2;
+ time_t curtime = 0, t1 = 0, t2 = 0;
gchar *ad;
GList *l;
- //GList *allobjects = NULL;
GSList *g;
GError *gerror = NULL;
gint i;
- gint width, height;
+ gint width = 0, height = 0;
ESourceList * sources = NULL;
-
- time(&t1);
- time(&t2);
- t2 += (time_t) (7 * 24 * 60 * 60); /* 7 days ahead of now, we actually need number_of_days_in_this_month */
- /* Remove all of the previous appointments */
- if (appointments != NULL) {
- g_debug("Freeing old appointments");
- while (appointments != NULL) {
- DbusmenuMenuitem * litem = DBUSMENU_MENUITEM(appointments->data);
- g_debug("Freeing old appointment: %p", litem);
- // Remove all the existing menu items which are in appointments.
- appointments = g_list_remove(appointments, litem);
- dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(litem));
- g_object_unref(G_OBJECT(litem));
+ // Get today & work out query times
+ time(&curtime);
+ struct tm *today = localtime(&curtime);
+ const int mday = today->tm_mday;
+ const int mon = today->tm_mon;
+ const int year = today->tm_year;
+
+ struct tm *start_tm = NULL;
+ int this_year = today->tm_year + 1900;
+ int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
+ if ((this_year % 400 == 0) || (this_year % 100 > 0 && this_year % 4 == 0)) days[1] = 29;
+
+ int highlightdays = days[mon] - mday + 1;
+ t1 = curtime; // By default the current time is the appointment start time.
+
+ if (start_time_appointments > 0) {
+ start_tm = localtime(&start_time_appointments);
+ int start_month = start_tm->tm_mon;
+ int start_year = start_tm->tm_year + 1900;
+ if ((start_month != mon) || (start_year != this_year)) {
+ // Set t1 to the start of that month.
+ struct tm month_start = {0};
+ month_start.tm_year = start_tm->tm_year;
+ month_start.tm_mon = start_tm->tm_mon;
+ month_start.tm_mday = 1;
+ t1 = mktime(&month_start);
+ highlightdays = days[mon];
}
}
- // TODO Remove all highlights from the calendar widget
+ g_debug("Will highlight %d days from %s", highlightdays, ctime(&t1));
+
+ t2 = t1 + (time_t) (highlightdays * 24 * 60 * 60);
+
+ // Remove all highlights from the calendar widget
+ dbusmenu_menuitem_property_set (calendar, CALENDAR_MENUITEM_PROP_CLEAR_MARKS, NULL);
if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) {
g_debug("Failed to get ecal sources\n");
@@ -592,7 +642,7 @@ update_appointment_menu_items (gpointer user_data)
for (s = e_source_group_peek_sources (group); s; s = s->next) {
ESource *source = E_SOURCE (s->data);
- //g_signal_connect (G_OBJECT(source), "changed", G_CALLBACK (update_appointment_menu_items), NULL);
+ g_signal_connect (G_OBJECT(source), "changed", G_CALLBACK (update_appointment_menu_items), NULL);
ECal *ecal = e_cal_new(source, E_CAL_SOURCE_TYPE_EVENT);
e_cal_set_auth_func (ecal, (ECalAuthFunc) auth_func, NULL);
@@ -609,10 +659,36 @@ update_appointment_menu_items (gpointer user_data)
g_debug("Number of ECalComponents returned: %d", g_list_length(comp_instances));
GList *sorted_comp_instances = g_list_sort(comp_instances, compare_comp_instances);
comp_instances = NULL;
+ g_debug("Components sorted");
+ /* Remove all of the previous appointments */
+ if (appointments != NULL) {
+ g_debug("Freeing old appointments");
+ while (appointments != NULL) {
+ DbusmenuMenuitem * litem = DBUSMENU_MENUITEM(appointments->data);
+ g_debug("Freeing old appointment: %p", litem);
+ // Remove all the existing menu items which are in appointments.
+ appointments = g_list_remove(appointments, litem);
+ dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(litem));
+ g_object_unref(G_OBJECT(litem));
+ }
+ }
+
gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
if (width <= 0) width = 12;
- if (height <= 0) height = 13;
+ if (height <= 0) height = 12;
+ if (width > 30) width = 12;
+ if (height > 30) height = 12;
+
+ gchar *time_format_str = g_settings_get_string(conf, SETTINGS_TIME_FORMAT_S);
+ gint apt_output;
+ if (g_strcmp0(time_format_str, "12-hour") == 0) {
+ apt_output = SETTINGS_TIME_12_HOUR;
+ } else if (g_strcmp0(time_format_str, "24-hour") == 0) {
+ apt_output = SETTINGS_TIME_24_HOUR;
+ } else {
+ apt_output = SETTINGS_TIME_LOCALE;
+ }
i = 0;
for (l = sorted_comp_instances; l; l = l->next) {
@@ -623,13 +699,34 @@ update_appointment_menu_items (gpointer user_data)
char right[20];
//const gchar *uri;
DbusmenuMenuitem * item;
-
- g_debug("Start Object %p", ecalcomp);
- // TODO Mark days
+ ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp);
+ struct tm *due = NULL;
+ if (vtype == E_CAL_COMPONENT_EVENT) due = localtime(&ci->start);
+ else if (vtype == E_CAL_COMPONENT_TODO) due = localtime(&ci->end);
+ else continue;
+
+ const int dmday = due->tm_mday;
+ const int dmon = due->tm_mon;
+ const int dyear = due->tm_year;
+
+ // Mark day
+ g_debug("Marking date %s", ctime(&ci->start));
+ dbusmenu_menuitem_property_set_int (calendar, CALENDAR_MENUITEM_PROP_MARK, due->tm_mday);
+
+
+ // If the appointment time is less than the selected date,
+ // don't create an appointment item for it.
+ if (vtype == E_CAL_COMPONENT_EVENT) {
+ if (ci->start < start_time_appointments) continue;
+ } else if (vtype == E_CAL_COMPONENT_TODO) {
+ if (ci->end < start_time_appointments) continue;
+ }
if (i >= 5) continue;
i++;
+
+ g_debug("Create menu item");
item = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_TYPE, APPOINTMENT_MENUITEM_TYPE);
@@ -645,31 +742,23 @@ update_appointment_menu_items (gpointer user_data)
g_free (summary);
// Due text
- ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp);
-
- // Get today
- time_t curtime = time(NULL);
- struct tm *today = localtime(&curtime);
-
- int mday = today->tm_mday;
- int mon = today->tm_mon;
- int year = today->tm_year;
-
- struct tm *due;
- if (vtype == E_CAL_COMPONENT_EVENT) due = localtime(&ci->start);
- else if (vtype == E_CAL_COMPONENT_TODO) due = localtime(&ci->end);
- else continue;
-
- int dmday = due->tm_mday;
- int dmon = due->tm_mon;
- int dyear = due->tm_year;
-
- if ((mday == dmday) && (mon == dmon) && (year == dyear))
- strftime(right, 20, "%l:%M %p", due);
- else
- strftime(right, 20, "%a %l:%M %p", due);
-
- g_debug("Appointment time: %s", right);
+ if (apt_output == SETTINGS_TIME_12_HOUR) {
+ if ((mday == dmday) && (mon == dmon) && (year == dyear))
+ strftime(right, 20, _(DEFAULT_TIME_12_FORMAT), due);
+ else
+ strftime(right, 20, _(DEFAULT_TIME_12_FORMAT_WITH_DAY), due);
+ } else if (apt_output == SETTINGS_TIME_24_HOUR) {
+ if ((mday == dmday) && (mon == dmon) && (year == dyear))
+ strftime(right, 20, _(DEFAULT_TIME_24_FORMAT), due);
+ else
+ strftime(right, 20, _(DEFAULT_TIME_24_FORMAT_WITH_DAY), due);
+ } else {
+ if ((mday == dmday) && (mon == dmon) && (year == dyear))
+ strftime(right, 20, _(DEFAULT_TIME_FORMAT), due);
+ else
+ strftime(right, 20, _(DEFAULT_TIME_FORMAT_WITH_DAY), due);
+ }
+ g_debug("Appointment time: %s, for date %s", right, asctime(due));
dbusmenu_menuitem_property_set (item, APPOINTMENT_MENUITEM_PROP_RIGHT, right);
// Now we pull out the URI for the calendar event and try to create a URI that'll work when we execute evolution
@@ -688,10 +777,9 @@ update_appointment_menu_items (gpointer user_data)
// Draw the correct icon for the appointment type and then tint it using mask fill.
// For now we'll create a circle
if (color_spec != NULL) {
- // Fixme causes segfault, but we have colours now yay!
GdkColor color;
gdk_color_parse (color_spec, &color);
- g_debug("Creating a cairo surface\n size, %d by %d", width, height);
+ g_debug("Creating a cairo surface: size, %d by %d", width, height);
cairo_surface_t *surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, width, height );
cairo_t *cr = cairo_create(surface);
@@ -736,13 +824,13 @@ update_appointment_menu_items (gpointer user_data)
dbusmenu_menuitem_property_set_image (item, APPOINTMENT_MENUITEM_PROP_ICON, pixbuf);
} else {
- g_debug("Creating pixbuf from surface failed\n Couldn't create new pixbuf for size, %d by %d", width, height);
+ g_debug("Creating pixbuf from surface failed");
}
cairo_surface_destroy (surface);
cairo_destroy(cr);
}
dbusmenu_menuitem_child_add_position (root, item, 2+i);
- appointments = g_list_append (appointments, item); // Keep track of the items here to make them east to remove
+ appointments = g_list_append (appointments, item); // Keep track of the items here to make them easy to remove
g_debug("Adding appointment: %p", item);
}
@@ -750,8 +838,8 @@ update_appointment_menu_items (gpointer user_data)
for (l = sorted_comp_instances; l; l = l->next) {
const struct comp_instance *ci = l->data;
g_object_unref(ci->comp);
- g_list_free(sorted_comp_instances);
}
+ g_list_free(sorted_comp_instances);
updating_appointments = FALSE;
g_debug("End of objects");
@@ -785,6 +873,12 @@ show_locations_changed (void)
check_timezone_sync();
}
+static void
+time_format_changed (void)
+{
+ update_appointment_menu_items(NULL);
+}
+
/* Does the work to build the default menu, really calls out
to other functions but this is the core to clean up the
main function. */
@@ -837,6 +931,7 @@ build_menus (DbusmenuMenuitem * root)
g_signal_connect (conf, "changed::" SETTINGS_SHOW_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL);
g_signal_connect (conf, "changed::" SETTINGS_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL);
g_signal_connect (conf, "changed::" SETTINGS_SHOW_EVENTS_S, G_CALLBACK (show_events_changed), NULL);
+ g_signal_connect (conf, "changed::" SETTINGS_TIME_FORMAT_S, G_CALLBACK (time_format_changed), NULL);
DbusmenuMenuitem * separator = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
diff --git a/src/dbus-shared.h b/src/dbus-shared.h
index fa6de7b..8b1a20b 100644
--- a/src/dbus-shared.h
+++ b/src/dbus-shared.h
@@ -34,6 +34,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define CALENDAR_MENUITEM_PROP_MARK "calendar-mark"
#define CALENDAR_MENUITEM_PROP_UNMARK "calendar-unmark"
#define CALENDAR_MENUITEM_PROP_CLEAR_MARKS "calendar-clear-marks"
+#define CALENDAR_MENUITEM_PROP_SET_DATE "calendar-set-date"
#define APPOINTMENT_MENUITEM_TYPE "appointment-item"
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 46ed0d9..1cdcd3f 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -813,7 +813,7 @@ setup_timer (IndicatorDatetime * self, GDateTime * datetime)
if (self->priv->show_seconds ||
(self->priv->time_mode == SETTINGS_TIME_CUSTOM && self->priv->custom_show_seconds)) {
- self->priv->timer = g_timeout_add_seconds(1, timer_func, self);
+ self->priv->timer = g_timeout_add_full(G_PRIORITY_HIGH, 865, timer_func, self, NULL);
} else {
if (datetime == NULL) {
datetime = g_date_time_new_now_local();
@@ -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)) {
+ gsize size = 3;
+ const gint * array = g_variant_get_fixed_array(value, &size, sizeof(gint));
+ 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,15 +1244,54 @@ 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);
+}
+
+static void
+day_selected_cb (IdoCalendarMenuItem *ido,
+ 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,
+ 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
@@ -1284,6 +1327,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);
+ 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;
}
diff --git a/src/settings-shared.h b/src/settings-shared.h
index df2260e..ef1183c 100644
--- a/src/settings-shared.h
+++ b/src/settings-shared.h
@@ -51,5 +51,9 @@ enum {
#define DEFAULT_TIME_24_FORMAT N_("%H:%M")
#define DEFAULT_TIME_FORMAT DEFAULT_TIME_12_FORMAT
+#define DEFAULT_TIME_FORMAT_WITH_DAY DEFAULT_TIME_12_FORMAT
+
+#define DEFAULT_TIME_12_FORMAT_WITH_DAY N_("%a %l:%M %p")
+#define DEFAULT_TIME_24_FORMAT_WITH_DAY N_("%a %H:%M")
#endif