aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2012-10-04 17:53:00 +0200
committerSebastien Bacher <seb128@ubuntu.com>2012-10-04 17:53:00 +0200
commit8410e81a5f648217a0deb2e9163f6a463c881df2 (patch)
tree8018338630aabc6f2d52e51d64767d94ec70bdc0
parentd25d5903237eb4d4d7d1c6d5151b936175f28b59 (diff)
parent57e21f7a78cad4aa01e56a5ee3e273c71b9fe4ec (diff)
downloadayatana-indicator-datetime-8410e81a5f648217a0deb2e9163f6a463c881df2.tar.gz
ayatana-indicator-datetime-8410e81a5f648217a0deb2e9163f6a463c881df2.tar.bz2
ayatana-indicator-datetime-8410e81a5f648217a0deb2e9163f6a463c881df2.zip
* New upstream release:
- Fix 12.10.0 appointment calendar regression. (LP: #1060263)
-rw-r--r--ChangeLog45
-rw-r--r--Makefile.in4
-rw-r--r--NEWS5
-rw-r--r--aclocal.m46
-rwxr-xr-xconfigure48
-rw-r--r--configure.ac6
-rw-r--r--data/Makefile.in2
-rw-r--r--debian/changelog7
-rw-r--r--src/Makefile.in2
-rw-r--r--src/datetime-service.c241
-rw-r--r--src/indicator-datetime.c18
-rw-r--r--tests/Makefile.in2
12 files changed, 212 insertions, 174 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e397a7..c042f21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,50 @@
# Generated by Makefile. Do not edit.
+2012-10-04 Charles Kerr <charles.kerr@canonical.com>
+
+ 12.10.2
+
+2012-10-04 Charles Kerr <charles.kerr@canonical.com>
+
+ get i-datetime's use of the EDS 3.5 API working.
+
+2012-10-04 Charles Kerr <charles.kerr@canonical.com>
+
+ copyediting: tweak indentation
+
+2012-10-03 Charles Kerr <charles.kerr@canonical.com>
+
+ a timing issue was causing the appointment menuitems to be grouped into the wrong section. Resolve this by creating them at the same time as the 'Add Event...' menuitem in the same group.
+
+2012-10-03 Charles Kerr <charles.kerr@canonical.com>
+
+ fix r189 oops. This code would be cleaner if handled upstream in IDO... filed side ticket #1061364 for that side issue
+
+2012-10-03 Charles Kerr <charles.kerr@canonical.com>
+
+ Our client code for EDS 3.5 is triggering a periodic loop of rebuilds:
+
+ 1. We create an ESource and listen for its "changed" signal.
+ 2. EDS appears to be emitting a "changed" idly after the source is created.
+ 3. We handle the changed event by rebuilding our source list... goto 1.
+
+ This commit breaks the loop by building the appointment source list once
+ on startup and keeping it as a private field. It adds upkeep code to
+ rebuild the list when the EDS registry tells us that sources have been
+ added or removed.
+
+2012-10-03 Charles Kerr <charles.kerr@canonical.com>
+
+ When showing/hiding the menu, don't change the calendar date if it's already what we want. This way we avoid unnecessary appointment rebuilds in the service.
+
+2012-10-03 Charles Kerr <charles.kerr@canonical.com>
+
+ don't use gconf to see if evolution accounts are installed -- we can have calendars even if gconf returns empty
+
+2012-10-03 Charles Kerr <charles.kerr@canonical.com>
+
+ fix populate_appointment_instances() to use ECalComponents instead of ECalClients.
+
2012-09-20 Charles Kerr <charles.kerr@canonical.com>
12.10.1
diff --git a/Makefile.in b/Makefile.in
index 92b0cc8..c4b4601 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -647,7 +647,7 @@ distcheck: dist
*.zip*) \
unzip $(distdir).zip ;;\
esac
- chmod -R a-w $(distdir); chmod a+w $(distdir)
+ chmod -R a-w $(distdir); chmod u+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
diff --git a/NEWS b/NEWS
index 59376bb..41fec0a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,12 +1,13 @@
-12.10.1
+12.10.2
+ - Fix 12.10.0 appointment calendar regression. (LP: #1060263)
+12.10.1
- Gracefully handle clock skew (LP: #917236)
- Raise the version number of our EDS dependency (LP: #1024437)
- Fix X-Ubuntu-Gettext-Domain entries in the .desktop file (LP: #1048834)
- Remove unnecessary watching for geoclue address provider changes
12.10.0
-
- Support EDS 3.6's API (cyphermox)
- Apply an 'en space' between the date and time strings. (LP #749847)
lp:~bobowen/indicator-datetime/fix-for-749847
diff --git a/aclocal.m4 b/aclocal.m4
index a306aca..51436db 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.11.5 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
@@ -752,7 +752,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.11.5], [],
+m4_if([$1], [1.11.6], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -768,7 +768,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.5])dnl
+[AM_AUTOMAKE_VERSION([1.11.6])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
diff --git a/configure b/configure
index 7b35642..02b898b 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.69 for indicator-datetime 12.10.1.
+# Generated by GNU Autoconf 2.69 for indicator-datetime 12.10.2.
#
# Report bugs to <http://bugs.launchpad.net/indicator-datetime>.
#
@@ -592,8 +592,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='indicator-datetime'
PACKAGE_TARNAME='indicator-datetime'
-PACKAGE_VERSION='12.10.1'
-PACKAGE_STRING='indicator-datetime 12.10.1'
+PACKAGE_VERSION='12.10.2'
+PACKAGE_STRING='indicator-datetime 12.10.2'
PACKAGE_BUGREPORT='http://bugs.launchpad.net/indicator-datetime'
PACKAGE_URL='http://launchpad.net/indicator-datetime'
@@ -1417,7 +1417,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 12.10.1 to adapt to many kinds of systems.
+\`configure' configures indicator-datetime 12.10.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1488,7 +1488,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of indicator-datetime 12.10.1:";;
+ short | recursive ) echo "Configuration of indicator-datetime 12.10.2:";;
esac
cat <<\_ACEOF
@@ -1620,7 +1620,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-indicator-datetime configure 12.10.1
+indicator-datetime configure 12.10.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1991,7 +1991,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 12.10.1, which was
+It was created by indicator-datetime $as_me 12.10.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2815,7 +2815,7 @@ fi
# Define the identity of the package.
PACKAGE='indicator-datetime'
- VERSION='12.10.1'
+ VERSION='12.10.2'
cat >>confdefs.h <<_ACEOF
@@ -11904,7 +11904,6 @@ CAIRO_REQUIRED_VERSION=1.10
GDK_REQUIRED_VERSION=2.22
GLIB_REQUIRED_VERSION=2.29.19
GTK3_REQUIRED_VERSION=3.1.4
-GCONF_REQUIRED_VERSION=2.31
pkg_failed=no
@@ -12055,8 +12054,7 @@ if test -n "$SERVICE_CFLAGS"; then
libedataserver-1.2 >= EDS_REQUIRED_VERSION
libedataserverui-3.0 >= EDS_REQUIRED_VERSION
cairo >= CAIRO_REQUIRED_VERSION
- gdk-3.0 >= GDK_REQUIRED_VERSION
- gconf-2.0 >= GCONF_REQUIRED_VERSION\""; } >&5
+ gdk-3.0 >= GDK_REQUIRED_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
glib-2.0 >= $GLIB_REQUIRED_VERSION
dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
@@ -12069,8 +12067,7 @@ if test -n "$SERVICE_CFLAGS"; then
libedataserver-1.2 >= EDS_REQUIRED_VERSION
libedataserverui-3.0 >= EDS_REQUIRED_VERSION
cairo >= CAIRO_REQUIRED_VERSION
- gdk-3.0 >= GDK_REQUIRED_VERSION
- gconf-2.0 >= GCONF_REQUIRED_VERSION") 2>&5
+ gdk-3.0 >= GDK_REQUIRED_VERSION") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
@@ -12086,8 +12083,7 @@ if test -n "$SERVICE_CFLAGS"; then
libedataserver-1.2 >= EDS_REQUIRED_VERSION
libedataserverui-3.0 >= EDS_REQUIRED_VERSION
cairo >= CAIRO_REQUIRED_VERSION
- gdk-3.0 >= GDK_REQUIRED_VERSION
- gconf-2.0 >= GCONF_REQUIRED_VERSION" 2>/dev/null`
+ gdk-3.0 >= GDK_REQUIRED_VERSION" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -12111,8 +12107,7 @@ if test -n "$SERVICE_LIBS"; then
libedataserver-1.2 >= EDS_REQUIRED_VERSION
libedataserverui-3.0 >= EDS_REQUIRED_VERSION
cairo >= CAIRO_REQUIRED_VERSION
- gdk-3.0 >= GDK_REQUIRED_VERSION
- gconf-2.0 >= GCONF_REQUIRED_VERSION\""; } >&5
+ gdk-3.0 >= GDK_REQUIRED_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
glib-2.0 >= $GLIB_REQUIRED_VERSION
dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
@@ -12125,8 +12120,7 @@ if test -n "$SERVICE_LIBS"; then
libedataserver-1.2 >= EDS_REQUIRED_VERSION
libedataserverui-3.0 >= EDS_REQUIRED_VERSION
cairo >= CAIRO_REQUIRED_VERSION
- gdk-3.0 >= GDK_REQUIRED_VERSION
- gconf-2.0 >= GCONF_REQUIRED_VERSION") 2>&5
+ gdk-3.0 >= GDK_REQUIRED_VERSION") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
@@ -12142,8 +12136,7 @@ if test -n "$SERVICE_LIBS"; then
libedataserver-1.2 >= EDS_REQUIRED_VERSION
libedataserverui-3.0 >= EDS_REQUIRED_VERSION
cairo >= CAIRO_REQUIRED_VERSION
- gdk-3.0 >= GDK_REQUIRED_VERSION
- gconf-2.0 >= GCONF_REQUIRED_VERSION" 2>/dev/null`
+ gdk-3.0 >= GDK_REQUIRED_VERSION" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -12176,8 +12169,7 @@ fi
libedataserver-1.2 >= EDS_REQUIRED_VERSION
libedataserverui-3.0 >= EDS_REQUIRED_VERSION
cairo >= CAIRO_REQUIRED_VERSION
- gdk-3.0 >= GDK_REQUIRED_VERSION
- gconf-2.0 >= GCONF_REQUIRED_VERSION" 2>&1`
+ gdk-3.0 >= GDK_REQUIRED_VERSION" 2>&1`
else
SERVICE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
glib-2.0 >= $GLIB_REQUIRED_VERSION
@@ -12191,8 +12183,7 @@ fi
libedataserver-1.2 >= EDS_REQUIRED_VERSION
libedataserverui-3.0 >= EDS_REQUIRED_VERSION
cairo >= CAIRO_REQUIRED_VERSION
- gdk-3.0 >= GDK_REQUIRED_VERSION
- gconf-2.0 >= GCONF_REQUIRED_VERSION" 2>&1`
+ gdk-3.0 >= GDK_REQUIRED_VERSION" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$SERVICE_PKG_ERRORS" >&5
@@ -12209,8 +12200,7 @@ fi
libedataserver-1.2 >= EDS_REQUIRED_VERSION
libedataserverui-3.0 >= EDS_REQUIRED_VERSION
cairo >= CAIRO_REQUIRED_VERSION
- gdk-3.0 >= GDK_REQUIRED_VERSION
- gconf-2.0 >= GCONF_REQUIRED_VERSION) were not met:
+ gdk-3.0 >= GDK_REQUIRED_VERSION) were not met:
$SERVICE_PKG_ERRORS
@@ -14923,7 +14913,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 12.10.1, which was
+This file was extended by indicator-datetime $as_me 12.10.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14990,7 +14980,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 12.10.1
+indicator-datetime config.status 12.10.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index ce79611..6b34706 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_INIT([indicator-datetime],
- [12.10.1],
+ [12.10.2],
[http://bugs.launchpad.net/indicator-datetime],
[indicator-datetime],
[http://launchpad.net/indicator-datetime])
@@ -59,7 +59,6 @@ CAIRO_REQUIRED_VERSION=1.10
GDK_REQUIRED_VERSION=2.22
GLIB_REQUIRED_VERSION=2.29.19
GTK3_REQUIRED_VERSION=3.1.4
-GCONF_REQUIRED_VERSION=2.31
PKG_CHECK_MODULES(INDICATOR, indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
glib-2.0 >= $GLIB_REQUIRED_VERSION
@@ -79,8 +78,7 @@ PKG_CHECK_MODULES(SERVICE, indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
libedataserverui-3.0 >= EDS_REQUIRED_VERSION
cairo >= CAIRO_REQUIRED_VERSION
- gdk-3.0 >= GDK_REQUIRED_VERSION
- gconf-2.0 >= GCONF_REQUIRED_VERSION)
+ gdk-3.0 >= GDK_REQUIRED_VERSION)
###########################
# Control Center panel
diff --git a/data/Makefile.in b/data/Makefile.in
index 1cc50a7..e90eb97 100644
--- a/data/Makefile.in
+++ b/data/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
diff --git a/debian/changelog b/debian/changelog
index 820c022..53165b8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+indicator-datetime (12.10.2-0ubuntu1) UNRELEASED; urgency=low
+
+ * New upstream release:
+ - Fix 12.10.0 appointment calendar regression. (LP: #1060263)
+
+ -- Sebastien Bacher <seb128@ubuntu.com> Thu, 04 Oct 2012 17:50:53 +0200
+
indicator-datetime (12.10.1-0ubuntu1) quantal; urgency=low
* New upstream release.
diff --git a/src/Makefile.in b/src/Makefile.in
index 78a28dc..1f971c9 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
diff --git a/src/datetime-service.c b/src/datetime-service.c
index ccdfe14..1a37fde 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -29,7 +29,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <math.h>
-#include <gconf/gconf-client.h>
#include <libdbusmenu-gtk/menuitem.h>
#include <libdbusmenu-glib/server.h>
@@ -55,6 +54,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
/* how often to check for clock skew */
#define SKEW_CHECK_INTERVAL_SEC 10
+#define MAX_APPOINTMENT_MENUITEMS 5
+
#define SKEW_DIFF_THRESHOLD_SEC (SKEW_CHECK_INTERVAL_SEC + 5)
#ifdef HAVE_CCPANEL
@@ -85,13 +86,14 @@ static DbusmenuMenuitem * settings = NULL;
static DbusmenuMenuitem * events_separator = NULL;
static DbusmenuMenuitem * locations_separator = NULL;
static DbusmenuMenuitem * add_appointment = NULL;
-static GList * appointments = NULL;
+static DbusmenuMenuitem * appointments[MAX_APPOINTMENT_MENUITEMS];
static GSList * location_menu_items = NULL;
static GList * comp_instances = NULL;
static gboolean updating_appointments = FALSE;
static time_t start_time_appointments = (time_t) 0;
static GSettings * conf = NULL;
-static GConfClient * gconf = NULL;
+static ESourceRegistry * source_registry = NULL;
+static GList * appointment_sources = NULL;
/* Geoclue trackers */
@@ -392,6 +394,15 @@ update_appointment_menu_items_idle (gpointer user_data)
return FALSE;
}
+static void
+hide_all_appointments (void)
+{
+ int i;
+
+ for (i=0; i<MAX_APPOINTMENT_MENUITEMS; i++)
+ dbusmenu_menuitem_property_set_bool(appointments[i], DBUSMENU_MENUITEM_PROP_ENABLED, FALSE);
+}
+
static gboolean
month_changed_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp)
{
@@ -404,11 +415,7 @@ month_changed_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, g
user. */
dbusmenu_menuitem_property_remove(menuitem, CALENDAR_MENUITEM_PROP_MARKS);
- GList * appointment;
- for (appointment = appointments; appointment != NULL; appointment = g_list_next(appointment)) {
- DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(appointment->data);
- dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE);
- }
+ hide_all_appointments ();
g_idle_add(update_appointment_menu_items_idle, NULL);
return TRUE;
@@ -439,11 +446,7 @@ day_selected_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, gu
}
}
- GList * appointment;
- for (appointment = appointments; appointment != NULL; appointment = g_list_next(appointment)) {
- DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(appointment->data);
- dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE);
- }
+ hide_all_appointments ();
start_time_appointments = new_time;
@@ -512,17 +515,7 @@ show_events_changed (void)
} else {
dbusmenu_menuitem_property_set_bool(add_appointment, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
dbusmenu_menuitem_property_set_bool(events_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
- /* Remove all of the previous appointments */
- if (appointments != NULL) {
- g_debug("Hiding old appointments");
- GList * appointment;
- for (appointment = appointments; appointment != NULL; appointment = g_list_next(appointment)) {
- DbusmenuMenuitem * litem = DBUSMENU_MENUITEM(appointment->data);
- g_debug("Hiding old appointment: %p", litem);
- // Remove all the existing menu items which are in appointments.
- dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(litem), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
- }
- }
+ hide_all_appointments ();
stop_ecal_timer();
}
}
@@ -537,12 +530,8 @@ calendar_app_is_usable (void)
g_debug ("found calendar app: '%s'", evo);
g_free (evo);
- /* confirm that it's got an account set up... */
- GSList *accounts_list = gconf_client_get_list (gconf, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL);
- const guint n = g_slist_length (accounts_list);
- g_debug ("found %u evolution accounts", n);
- g_slist_free_full (accounts_list, g_free);
- return n > 0;
+ /* see if there are any calendar sources */
+ return appointment_sources > 0;
}
/* Looks for the calendar application and enables the item if
@@ -555,19 +544,32 @@ check_for_calendar (gpointer user_data)
dbusmenu_menuitem_property_set_bool(date, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
if (!get_greeter_mode () && calendar_app_is_usable()) {
+
+ int i;
+ int pos = 2;
g_signal_connect (G_OBJECT(date), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
G_CALLBACK (activate_cb), "evolution -c calendar");
events_separator = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(events_separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
- dbusmenu_menuitem_child_add_position(root, events_separator, 2);
+ dbusmenu_menuitem_child_add_position(root, events_separator, pos++);
+
+ for (i=0; i<MAX_APPOINTMENT_MENUITEMS; i++)
+ {
+ DbusmenuMenuitem * item = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_TYPE, APPOINTMENT_MENUITEM_TYPE);
+ dbusmenu_menuitem_property_set_bool (item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
+ dbusmenu_menuitem_property_set_bool (item, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+ appointments[i] = item;
+ dbusmenu_menuitem_child_add_position(root, item, pos++);
+ }
+
add_appointment = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (add_appointment, DBUSMENU_MENUITEM_PROP_LABEL, _("Add Event…"));
dbusmenu_menuitem_property_set_bool(add_appointment, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
g_signal_connect(G_OBJECT(add_appointment), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "evolution -c calendar");
- dbusmenu_menuitem_child_add_position (root, add_appointment, 3);
-
+ dbusmenu_menuitem_child_add_position (root, add_appointment, pos++);
if (g_settings_get_boolean(conf, SETTINGS_SHOW_EVENTS_S)) {
dbusmenu_menuitem_property_set_bool(add_appointment, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
@@ -636,53 +638,29 @@ comp_instance_free (struct comp_instance* ci)
}
static gboolean
-populate_appointment_instances (ECalClient * client,
+populate_appointment_instances (ECalComponent * comp,
time_t start,
time_t end,
gpointer data)
{
- GSList *ecalcomps, *comp_item;
-
- if (e_cal_client_get_object_list_as_comps_sync (client,
- NULL,
- &ecalcomps,
- NULL, NULL)) {
-
- for (comp_item = ecalcomps; comp_item; comp_item = g_slist_next(comp_item)) {
- ECalComponent *comp = comp_item->data;
-
- g_debug("Appending item %p", e_cal_component_get_as_string(comp));
-
- ECalComponentVType vtype = e_cal_component_get_vtype (comp);
- if (vtype != E_CAL_COMPONENT_EVENT && vtype != E_CAL_COMPONENT_TODO) return FALSE;
-
- icalproperty_status status;
- e_cal_component_get_status (comp, &status);
- if (status == ICAL_STATUS_COMPLETED || status == ICAL_STATUS_CANCELLED) return FALSE;
-
- g_object_ref(comp);
-
- ECalComponentDateTime datetime;
- icaltimezone *appointment_zone = NULL;
- icaltimezone *current_zone = NULL;
-
- if (vtype == E_CAL_COMPONENT_EVENT)
- e_cal_component_get_dtstart (comp, &datetime);
- else
- e_cal_component_get_due (comp, &datetime);
-
- appointment_zone = icaltimezone_get_builtin_timezone_from_tzid(datetime.tzid);
- current_zone = icaltimezone_get_builtin_timezone_from_tzid(current_timezone);
- if (!appointment_zone || datetime.value->is_date) { // If it's today put in the current timezone?
- appointment_zone = current_zone;
- }
+ const ECalComponentVType vtype = e_cal_component_get_vtype (comp);
+
+ if ((vtype == E_CAL_COMPONENT_EVENT) || (vtype == E_CAL_COMPONENT_TODO))
+ {
+ icalproperty_status status;
+ e_cal_component_get_status (comp, &status);
+
+ if ((status != ICAL_STATUS_COMPLETED) && (status != ICAL_STATUS_CANCELLED))
+ {
+ gchar * str = e_cal_component_get_as_string (comp);
+ g_debug("Appending item %s", str);
+ struct comp_instance *ci = comp_instance_new (comp, start, end, E_SOURCE(data));
+ comp_instances = g_list_append (comp_instances, ci);
+ g_free (str);
+ }
+ }
- struct comp_instance *ci = comp_instance_new (comp, start, end, E_SOURCE(data));
- comp_instances = g_list_append (comp_instances, ci);
- }
- return TRUE;
- }
- return FALSE;
+ return TRUE; /* tell eds to keep iterating */
}
/* Populate the menu with todays, next 5 appointments.
@@ -691,7 +669,7 @@ populate_appointment_instances (ECalClient * client,
* this is a problem mainly on the EDS side of things, not ours.
*/
static gboolean
-update_appointment_menu_items (gpointer user_data)
+update_appointment_menu_items (gpointer unused)
{
// 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.
@@ -706,7 +684,6 @@ update_appointment_menu_items (gpointer user_data)
GError *gerror = NULL;
gint i;
gint width = 0, height = 0;
- ESourceRegistry * src_registry = NULL;
GList * sources = NULL;
// Get today & work out query times
@@ -751,19 +728,10 @@ update_appointment_menu_items (gpointer user_data)
g_list_free_full (comp_instances, (GDestroyNotify)comp_instance_free);
comp_instances = NULL;
- src_registry = e_source_registry_new_sync (NULL, &gerror);
- if (!src_registry) {
- g_debug("Failed to get access to source registry: %s\n", gerror->message);
- return FALSE;
- }
-
- sources = e_source_registry_list_sources(src_registry, E_SOURCE_EXTENSION_CALENDAR);
-
// Generate instances for all sources
- for (s = g_list_first (sources); s; s = g_list_next (s)) {
+ for (s=appointment_sources; s!=NULL; s=s->next) {
ESource *source = E_SOURCE (s->data);
- g_signal_connect (G_OBJECT(source), "changed", G_CALLBACK (update_appointment_menu_items), NULL);
ECalClient *ecal = e_cal_client_new(source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &gerror);
icaltimezone* current_zone = icaltimezone_get_builtin_timezone(current_timezone);
@@ -785,31 +753,21 @@ update_appointment_menu_items (gpointer user_data)
continue;
}
- e_cal_client_generate_instances (ecal, t1, t2, NULL,
- (ECalRecurInstanceFn) populate_appointment_instances,
- (gpointer) source,
- NULL);
+ e_cal_client_generate_instances_sync (ecal,
+ t1,
+ t2,
+ populate_appointment_instances,
+ source);
}
g_object_unref(ecal);
}
- g_list_free_full (sources, g_object_unref);
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");
-
- /* Hiding all of the previous appointments */
- if (appointments != NULL) {
- g_debug("Hiding old appointments");
- GList * appointment;
- for (appointment = appointments; appointment != NULL; appointment = g_list_next(appointment)) {
- DbusmenuMenuitem * litem = DBUSMENU_MENUITEM(appointment->data);
- g_debug("Hiding old appointment: %p", litem);
- // Remove all the existing menu items which are in appointments.
- dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(litem), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
- }
- }
+
+ hide_all_appointments ();
gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
if (width <= 0) width = 12;
@@ -834,7 +792,6 @@ update_appointment_menu_items (gpointer user_data)
g_variant_builder_init (&markeddays, G_VARIANT_TYPE ("ai"));
i = 0;
- GList * cached_appointment = appointments;
for (l = sorted_comp_instances; l; l = l->next) {
struct comp_instance *ci = l->data;
ECalComponent *ecalcomp = ci->comp;
@@ -866,28 +823,18 @@ update_appointment_menu_items (gpointer user_data)
} else if (vtype == E_CAL_COMPONENT_TODO) {
if (ci->end < start_time_appointments) continue;
}
-
- if (i >= 5) continue;
- i++;
-
- if (cached_appointment == NULL) {
- g_debug("Create menu item");
-
- item = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_TYPE, APPOINTMENT_MENUITEM_TYPE);
+
+ if (i >= MAX_APPOINTMENT_MENUITEMS)
+ continue;
- dbusmenu_menuitem_child_add_position (root, item, 2+i);
- appointments = g_list_append (appointments, item); // Keep track of the items here to make them easy to remove
- } else {
- item = DBUSMENU_MENUITEM(cached_appointment->data);
- cached_appointment = g_list_next(cached_appointment);
+ i++;
+ item = appointments[i];
- /* Remove the icon as we might not replace it on error */
- dbusmenu_menuitem_property_remove(item, APPOINTMENT_MENUITEM_PROP_ICON);
+ /* Remove the icon as we might not replace it on error */
+ dbusmenu_menuitem_property_remove(item, APPOINTMENT_MENUITEM_PROP_ICON);
- /* Remove the activate handler */
- g_signal_handlers_disconnect_matched(G_OBJECT(item), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, G_CALLBACK(activate_cb), NULL);
- }
+ /* Remove the activate handler */
+ g_signal_handlers_disconnect_matched(G_OBJECT(item), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, G_CALLBACK(activate_cb), NULL);
dbusmenu_menuitem_property_set_bool (item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
dbusmenu_menuitem_property_set_bool (item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
@@ -1416,6 +1363,34 @@ service_shutdown (IndicatorService * service, gpointer user_data)
return;
}
+static void
+free_appointment_sources (void)
+{
+ g_list_free_full (appointment_sources, g_object_unref);
+ appointment_sources = NULL;
+}
+
+static void
+init_appointment_sources (void)
+{
+ GList * l;
+
+ appointment_sources = e_source_registry_list_sources (source_registry, E_SOURCE_EXTENSION_CALENDAR);
+
+ for (l=appointment_sources; l!=NULL; l=l->next)
+ g_signal_connect (G_OBJECT(l->data), "changed", G_CALLBACK (update_appointment_menu_items), NULL);
+}
+
+/* rebuilds both the appointment sources and menu */
+static void
+update_appointments (void)
+{
+ free_appointment_sources ();
+ init_appointment_sources ();
+
+ update_appointment_menu_items (NULL);
+}
+
/* Function to build everything up. Entry point from asm. */
int
main (int argc, char ** argv)
@@ -1434,10 +1409,21 @@ main (int argc, char ** argv)
/* Set up GSettings */
conf = g_settings_new(SETTINGS_INTERFACE);
- /* Set up gconf for getting evolution enabled calendars */
- gconf = gconf_client_get_default();
// TODO Add a signal handler to catch gsettings changes and respond to them
+ /* Build our list of appointment calendar sources.
+ When a source changes, update our menu items.
+ When sources are added or removed, update our list and menu items. */
+ source_registry = e_source_registry_new_sync (NULL, NULL);
+ g_object_connect (source_registry,
+ "signal::source-added", update_appointments,
+ "signal::source-removed", update_appointments,
+ "signal::source-changed", update_appointment_menu_items,
+ "signal::source-disabled", update_appointment_menu_items,
+ "signal::source-enabled", update_appointment_menu_items,
+ NULL);
+ init_appointment_sources ();
+
/* Building the base menu */
server = dbusmenu_server_new(MENU_OBJ);
root = dbusmenu_menuitem_new();
@@ -1478,12 +1464,15 @@ main (int argc, char ** argv)
mainloop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(mainloop);
+ free_appointment_sources();
+
g_object_unref(G_OBJECT(conf));
g_object_unref(G_OBJECT(master));
g_object_unref(G_OBJECT(dbus));
g_object_unref(G_OBJECT(service));
g_object_unref(G_OBJECT(server));
g_object_unref(G_OBJECT(root));
+ g_object_unref(G_OBJECT(source_registry));
icaltimezone_free_builtin_timezones();
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 2356c6d..9546664 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -268,18 +268,26 @@ indicator_datetime_class_init (IndicatorDatetimeClass *klass)
static void
menu_visible_notfy_cb(GtkWidget * menu, G_GNUC_UNUSED GParamSpec *pspec, gpointer user_data)
{
+ GtkWidget * w;
+ GtkCalendar * calendar;
IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
GDateTime *datetime;
- gint y, m, d;
+ gint cur_y, cur_m, cur_d;
+ guint cal_y, cal_m, cal_d;
g_debug("notify visible signal received");
+ /* set the calendar to today's date */
datetime = g_date_time_new_now_local ();
- g_date_time_get_ymd (datetime, &y, &m, &d);
+ g_date_time_get_ymd (datetime, &cur_y, &cur_m, &cur_d);
g_date_time_unref (datetime);
-
- // Set the calendar to todays date
- ido_calendar_menu_item_set_date (self->priv->ido_calendar, y, m-1, d);
+ w = ido_calendar_menu_item_get_calendar (self->priv->ido_calendar);
+ calendar = GTK_CALENDAR(w);
+ gtk_calendar_get_date (calendar, &cal_y, &cal_m, &cal_d);
+ if ((cur_y != cal_y) || (cur_m-1 != cal_m))
+ gtk_calendar_select_month (calendar, cur_m-1, cur_y); /* (cur_m is 1-based) */
+ if (cur_d != cal_d)
+ gtk_calendar_select_day (calendar, cur_d);
/* Update in case date was changed outside of indicator-datetime */
update_label(self, NULL);
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 953ab15..1e3d29b 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,