diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | ChangeLog | 131 | ||||
-rw-r--r-- | config.h.in | 3 | ||||
-rwxr-xr-x | configure | 100 | ||||
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/Makefile.in | 20 | ||||
-rw-r--r-- | src/calendar-menu-item.c | 100 | ||||
-rw-r--r-- | src/calendar-menu-item.h | 59 | ||||
-rw-r--r-- | src/datetime-prefs.c | 3 | ||||
-rw-r--r-- | src/datetime-service.c | 91 | ||||
-rw-r--r-- | src/indicator-datetime.c | 141 | ||||
-rw-r--r-- | src/timezone-completion.c | 24 | ||||
-rw-r--r-- | src/timezone-completion.h | 17 |
14 files changed, 335 insertions, 369 deletions
@@ -3,6 +3,7 @@ David Barth David Planella Dylan McCall + Espen Wiborg Evgeni Golov Gabor Kelemen Javier Jardón @@ -1,5 +1,136 @@ # Generated by Makefile. Do not edit. +2011-09-15 Ted Gould <ted@gould.cx> + + 0.2.94 + +2011-09-15 Ted Gould <ted@gould.cx> + + Use the GNOME Wall Clock interface + +2011-09-05 Javier Jardón <javier.jardon@codethink.co.uk> + + indicator-datetime: Update the desktop schema when showing seconds + + As GnomeWallClock uses "clock-show-seconds" desktop key to update the current + time + +2011-09-05 Javier Jardón <javier.jardon@codethink.co.uk> + + indicator-datetime.c: Fix typo + +2011-09-05 Javier Jardón <javier.jardon@codethink.co.uk> + + datetime-service: Fix typo + +2011-09-05 Javier Jardón <javier.jardon@codethink.co.uk> + + indicator-datetime.c: Use GnomeWallClock instead of periodic timeout + + This class support changes in the timezone and notifications of clock skews + when using a recent version of Linux (using timerfds) + See https://bugzilla.gnome.org/show_bug.cgi?id=655129 + + Fixes https://bugs.launchpad.net/indicator-datetime/+bug/837440 + +2011-09-05 Javier Jardón <javier.jardon@codethink.co.uk> + + Bump gnome-desktop required version to 3.1.91 + + GnomeWallClock was added in this version + +2011-09-05 Javier Jardón <javier.jardon@codethink.co.uk> + + Use GnomeWallClock instead of periodic timeout + + This class support changes in the timezone and notifications of clock skews + when using a recent version of Linux (using timerfds) + See https://bugzilla.gnome.org/show_bug.cgi?id=655129 + + Fixes https://bugs.launchpad.net/indicator-datetime/+bug/837440 + +2011-09-15 Ted Gould <ted@gould.cx> + + Set the builder language before opening the file + +2011-09-09 Gabor Kelemen <kelemeng@gnome.hu> + + Set translation domain before the gtk_builder_add_from_file call. LP: #845473 + +2011-09-15 Ted Gould <ted@gould.cx> + + Update comments to discuss the new format options in glib + +2011-09-05 Javier Jardón <javier.jardon@codethink.co.uk> + + configure.ac: Bump glib required version + + This version of Glib supports all the strftime format specifiers + Fixes https://bugs.launchpad.net/indicator-datetime/+bug/775113 + +2011-09-02 Javier Jardón <javier.jardon@codethink.co.uk> + + Warning when the user use a date format not supported + + We are using the g_date_time_format () function and the format strings + understood by this function are a subset of the strftime() format language. + +2011-09-06 Ted Gould <ted@gould.cx> + + Some optimizations to the private pointers and a const + +2011-09-06 Javier Jardón <javier.jardon@codethink.co.uk> + + indicator-datetime.c: Use G_GNUC_CONST in the type declaration + +2011-09-06 Javier Jardón <javier.jardon@codethink.co.uk> + + indicator-datetime.c: Use private pointer instead GET_PRIV macro + +2011-09-06 Javier Jardón <javier.jardon@codethink.co.uk> + + timezone-completion: Use private pointer instead GET_PRIV macro + +2011-09-06 Ted Gould <ted@gould.cx> + + Remove unused code + +2011-09-06 Javier Jardón <javier.jardon@codethink.co.uk> + + Remove death code: calendar-menu-item + + We use IdoCalendarMenuItem nowadays + +2011-09-06 Ted Gould <ted@gould.cx> + + Checking for pow + +2011-09-06 Javier Jardón <javier.jardon@codethink.co.uk> + + configure.ac: Check for 'pow' in math library + +2011-09-01 Espen Wiborg <espenhw@grumblesmurf.org> + + Set default timezone on events + +2011-08-31 Ted Gould <ted@gould.cx> + + Remove visibility check so we can update the date before we're visible. + +2011-08-25 Javier Jardón <javier.jardon@codethink.co.uk> + + Update the date when open the indicator-datetime menu + + Fixes https://bugs.launchpad.net/indicator-datetime/+bug/793450 + +2011-08-31 Ted Gould <ted@gould.cx> + + Check for greeter mode to whether we should show Evolution options. + +2011-08-31 Michael Terry <michael.terry@canonical.com> + + disable evolution functionality when in greeter mode + 2011-08-18 Ted Gould <ted@gould.cx> 0.2.93 diff --git a/config.h.in b/config.h.in index ddb1256..979f5d2 100644 --- a/config.h.in +++ b/config.h.in @@ -27,6 +27,9 @@ /* Define if your <locale.h> file defines LC_MESSAGES. */ #undef HAVE_LC_MESSAGES +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + /* Define to 1 if you have the <locale.h> header file. */ #undef HAVE_LOCALE_H @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for indicator-datetime 0.2.93. +# Generated by GNU Autoconf 2.68 for indicator-datetime 0.2.94. # # Report bugs to <http://bugs.launchpad.net/indicator-datetime>. # @@ -13,7 +13,7 @@ # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # -# Copyright 2009,2010 Canonical +# Copyright 2009-2011 Canonical ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## @@ -572,8 +572,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='indicator-datetime' PACKAGE_TARNAME='indicator-datetime' -PACKAGE_VERSION='0.2.93' -PACKAGE_STRING='indicator-datetime 0.2.93' +PACKAGE_VERSION='0.2.94' +PACKAGE_STRING='indicator-datetime 0.2.94' PACKAGE_BUGREPORT='http://bugs.launchpad.net/indicator-datetime' PACKAGE_URL='http://launchpad.net/indicator-datetime' @@ -1375,7 +1375,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.2.93 to adapt to many kinds of systems. +\`configure' configures indicator-datetime 0.2.94 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1446,7 +1446,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of indicator-datetime 0.2.93:";; + short | recursive ) echo "Configuration of indicator-datetime 0.2.94:";; esac cat <<\_ACEOF @@ -1578,14 +1578,14 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-datetime configure 0.2.93 +indicator-datetime configure 0.2.94 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. -Copyright 2009,2010 Canonical +Copyright 2009-2011 Canonical _ACEOF exit fi @@ -1949,7 +1949,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.2.93, which was +It was created by indicator-datetime $as_me 0.2.94, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2773,7 +2773,7 @@ fi # Define the identity of the package. PACKAGE='indicator-datetime' - VERSION='0.2.93' + VERSION='0.2.94' cat >>confdefs.h <<_ACEOF @@ -11504,6 +11504,51 @@ CC="$lt_save_CC" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 +$as_echo_n "checking for pow in -lm... " >&6; } +if ${ac_cv_lib_m_pow+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pow (); +int +main () +{ +return pow (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_pow=yes +else + ac_cv_lib_m_pow=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 +$as_echo "$ac_cv_lib_m_pow" >&6; } +if test "x$ac_cv_lib_m_pow" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBM 1 +_ACEOF + + LIBS="-lm $LIBS" + +fi + # Check whether --enable-deprecations was given. if test "${enable_deprecations+set}" = set; then : @@ -11745,9 +11790,11 @@ GEOCLUE_REQUIRED_VERSION=0.12.0 ECAL_REQUIRED_VERSION=2.30 EDS_REQUIRED_VERSION=2.30 ICAL_REQUIRED_VERSION=0.44 +GNOME_DESKTOP_REQUIRED_VERSION=3.1.91 +GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=3.1.4 CAIRO_REQUIRED_VERSION=1.10 GDK_REQUIRED_VERSION=2.22 -GLIB_REQUIRED_VERSION=2.26 +GLIB_REQUIRED_VERSION=2.29.19 GTK3_REQUIRED_VERSION=3.1.4 GCONF_REQUIRED_VERSION=2.31 @@ -11763,11 +11810,15 @@ if test -n "$INDICATOR_CFLAGS"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"indicator3-0.4 >= \$INDICATOR_REQUIRED_VERSION glib-2.0 >= \$GLIB_REQUIRED_VERSION + gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION + gsettings-desktop-schemas >= \$GSETTINGS_DESKTOP_SCHEMAS_REQUIRED dbusmenu-glib-0.4 >= \$DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= \$DBUSMENUGTK_REQUIRED_VERSION libido3-0.1 >= \$INDICATOR_DISPLAY_OBJECTS\""; } >&5 ($PKG_CONFIG --exists --print-errors "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION + gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION libido3-0.1 >= $INDICATOR_DISPLAY_OBJECTS") 2>&5 @@ -11776,6 +11827,8 @@ if test -n "$INDICATOR_CFLAGS"; then test $ac_status = 0; }; then pkg_cv_INDICATOR_CFLAGS=`$PKG_CONFIG --cflags "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION + gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION libido3-0.1 >= $INDICATOR_DISPLAY_OBJECTS" 2>/dev/null` @@ -11792,11 +11845,15 @@ if test -n "$INDICATOR_LIBS"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"indicator3-0.4 >= \$INDICATOR_REQUIRED_VERSION glib-2.0 >= \$GLIB_REQUIRED_VERSION + gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION + gsettings-desktop-schemas >= \$GSETTINGS_DESKTOP_SCHEMAS_REQUIRED dbusmenu-glib-0.4 >= \$DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= \$DBUSMENUGTK_REQUIRED_VERSION libido3-0.1 >= \$INDICATOR_DISPLAY_OBJECTS\""; } >&5 ($PKG_CONFIG --exists --print-errors "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION + gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION libido3-0.1 >= $INDICATOR_DISPLAY_OBJECTS") 2>&5 @@ -11805,6 +11862,8 @@ if test -n "$INDICATOR_LIBS"; then test $ac_status = 0; }; then pkg_cv_INDICATOR_LIBS=`$PKG_CONFIG --libs "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION + gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION libido3-0.1 >= $INDICATOR_DISPLAY_OBJECTS" 2>/dev/null` @@ -11830,12 +11889,16 @@ fi if test $_pkg_short_errors_supported = yes; then INDICATOR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION + gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION libido3-0.1 >= $INDICATOR_DISPLAY_OBJECTS" 2>&1` else INDICATOR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION + gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION libido3-0.1 >= $INDICATOR_DISPLAY_OBJECTS" 2>&1` @@ -11845,6 +11908,8 @@ fi as_fn_error $? "Package requirements (indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION + gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION libido3-0.1 >= $INDICATOR_DISPLAY_OBJECTS) were not met: @@ -12039,6 +12104,7 @@ if test -n "$SERVICE_CFLAGS"; then libedataserverui-3.0 >= EDS_REQUIRED_VERSION cairo >= CAIRO_REQUIRED_VERSION gdk-3.0 >= GDK_REQUIRED_VERSION + gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION gconf-2.0 >= GCONF_REQUIRED_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION @@ -12053,6 +12119,7 @@ if test -n "$SERVICE_CFLAGS"; then libedataserverui-3.0 >= EDS_REQUIRED_VERSION cairo >= CAIRO_REQUIRED_VERSION gdk-3.0 >= GDK_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gconf-2.0 >= GCONF_REQUIRED_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 @@ -12070,6 +12137,7 @@ if test -n "$SERVICE_CFLAGS"; then libedataserverui-3.0 >= EDS_REQUIRED_VERSION cairo >= CAIRO_REQUIRED_VERSION gdk-3.0 >= GDK_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gconf-2.0 >= GCONF_REQUIRED_VERSION" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else @@ -12095,6 +12163,7 @@ if test -n "$SERVICE_LIBS"; then libedataserverui-3.0 >= EDS_REQUIRED_VERSION cairo >= CAIRO_REQUIRED_VERSION gdk-3.0 >= GDK_REQUIRED_VERSION + gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED_VERSION gconf-2.0 >= GCONF_REQUIRED_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION @@ -12109,6 +12178,7 @@ if test -n "$SERVICE_LIBS"; then libedataserverui-3.0 >= EDS_REQUIRED_VERSION cairo >= CAIRO_REQUIRED_VERSION gdk-3.0 >= GDK_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gconf-2.0 >= GCONF_REQUIRED_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 @@ -12126,6 +12196,7 @@ if test -n "$SERVICE_LIBS"; then libedataserverui-3.0 >= EDS_REQUIRED_VERSION cairo >= CAIRO_REQUIRED_VERSION gdk-3.0 >= GDK_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gconf-2.0 >= GCONF_REQUIRED_VERSION" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else @@ -12160,6 +12231,7 @@ fi libedataserverui-3.0 >= EDS_REQUIRED_VERSION cairo >= CAIRO_REQUIRED_VERSION gdk-3.0 >= GDK_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gconf-2.0 >= GCONF_REQUIRED_VERSION" 2>&1` else SERVICE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION @@ -12175,6 +12247,7 @@ fi libedataserverui-3.0 >= EDS_REQUIRED_VERSION cairo >= CAIRO_REQUIRED_VERSION gdk-3.0 >= GDK_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gconf-2.0 >= GCONF_REQUIRED_VERSION" 2>&1` fi # Put the nasty error message in config.log where it belongs @@ -12193,6 +12266,7 @@ fi libedataserverui-3.0 >= EDS_REQUIRED_VERSION cairo >= CAIRO_REQUIRED_VERSION gdk-3.0 >= GDK_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gconf-2.0 >= GCONF_REQUIRED_VERSION) were not met: $SERVICE_PKG_ERRORS @@ -14609,7 +14683,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.2.93, which was +This file was extended by indicator-datetime $as_me 0.2.94, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14676,7 +14750,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.2.93 +indicator-datetime config.status 0.2.94 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 71fd0e9..b980185 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,9 @@ AC_INIT([indicator-datetime], - [0.2.93], + [0.2.94], [http://bugs.launchpad.net/indicator-datetime], [indicator-datetime], [http://launchpad.net/indicator-datetime]) -AC_COPYRIGHT([Copyright 2009,2010 Canonical]) +AC_COPYRIGHT([Copyright 2009-2011 Canonical]) AC_PREREQ([2.64]) @@ -26,6 +26,7 @@ AC_HEADER_STDC LT_PREREQ([2.2]) LT_INIT([disable-static]) +AC_CHECK_LIB([m],[pow]) AC_ARG_ENABLE([deprecations], [AS_HELP_STRING([--enable-deprecations], @@ -64,15 +65,19 @@ GEOCLUE_REQUIRED_VERSION=0.12.0 ECAL_REQUIRED_VERSION=2.30 EDS_REQUIRED_VERSION=2.30 ICAL_REQUIRED_VERSION=0.44 +GNOME_DESKTOP_REQUIRED_VERSION=3.1.91 +GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=3.1.4 CAIRO_REQUIRED_VERSION=1.10 GDK_REQUIRED_VERSION=2.22 -GLIB_REQUIRED_VERSION=2.26 +GLIB_REQUIRED_VERSION=2.29.19 GTK3_REQUIRED_VERSION=3.1.4 GCONF_REQUIRED_VERSION=2.31 AS_IF([test "x$with_gtk" = x3], [PKG_CHECK_MODULES(INDICATOR, indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION + gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION libido3-0.1 >= $INDICATOR_DISPLAY_OBJECTS) @@ -100,6 +105,7 @@ PKG_CHECK_MODULES(SERVICE, indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION libedataserverui-3.0 >= EDS_REQUIRED_VERSION cairo >= CAIRO_REQUIRED_VERSION gdk-3.0 >= GDK_REQUIRED_VERSION + gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION gconf-2.0 >= GCONF_REQUIRED_VERSION) PKG_CHECK_MODULES(PREF, gio-2.0 >= $GIO_REQUIRED_VERSION diff --git a/src/Makefile.am b/src/Makefile.am index 6ca07a8..254022e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,8 +8,6 @@ indicator_datetime_service_SOURCES = \ datetime-interface.c \ datetime-interface.h \ gen-datetime-service.xml.c \ - calendar-menu-item.c \ - calendar-menu-item.h \ datetime-service.c \ utils.c \ utils.h \ diff --git a/src/Makefile.in b/src/Makefile.in index b8b7fb2..406797d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -102,7 +102,6 @@ PROGRAMS = $(libexec_PROGRAMS) am_indicator_datetime_service_OBJECTS = \ indicator_datetime_service-datetime-interface.$(OBJEXT) \ indicator_datetime_service-gen-datetime-service.xml.$(OBJEXT) \ - indicator_datetime_service-calendar-menu-item.$(OBJEXT) \ indicator_datetime_service-datetime-service.$(OBJEXT) \ indicator_datetime_service-utils.$(OBJEXT) indicator_datetime_service_OBJECTS = \ @@ -312,8 +311,6 @@ indicator_datetime_service_SOURCES = \ datetime-interface.c \ datetime-interface.h \ gen-datetime-service.xml.c \ - calendar-menu-item.c \ - calendar-menu-item.h \ datetime-service.c \ utils.c \ utils.h \ @@ -540,7 +537,6 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_service-calendar-menu-item.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_service-datetime-interface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_service-datetime-service.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_datetime_service-gen-datetime-service.xml.Po@am__quote@ @@ -656,22 +652,6 @@ indicator_datetime_service-gen-datetime-service.xml.obj: gen-datetime-service.xm @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -c -o indicator_datetime_service-gen-datetime-service.xml.obj `if test -f 'gen-datetime-service.xml.c'; then $(CYGPATH_W) 'gen-datetime-service.xml.c'; else $(CYGPATH_W) '$(srcdir)/gen-datetime-service.xml.c'; fi` -indicator_datetime_service-calendar-menu-item.o: calendar-menu-item.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -MT indicator_datetime_service-calendar-menu-item.o -MD -MP -MF $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Tpo -c -o indicator_datetime_service-calendar-menu-item.o `test -f 'calendar-menu-item.c' || echo '$(srcdir)/'`calendar-menu-item.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Tpo $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='calendar-menu-item.c' object='indicator_datetime_service-calendar-menu-item.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -c -o indicator_datetime_service-calendar-menu-item.o `test -f 'calendar-menu-item.c' || echo '$(srcdir)/'`calendar-menu-item.c - -indicator_datetime_service-calendar-menu-item.obj: calendar-menu-item.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -MT indicator_datetime_service-calendar-menu-item.obj -MD -MP -MF $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Tpo -c -o indicator_datetime_service-calendar-menu-item.obj `if test -f 'calendar-menu-item.c'; then $(CYGPATH_W) 'calendar-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/calendar-menu-item.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Tpo $(DEPDIR)/indicator_datetime_service-calendar-menu-item.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='calendar-menu-item.c' object='indicator_datetime_service-calendar-menu-item.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -c -o indicator_datetime_service-calendar-menu-item.obj `if test -f 'calendar-menu-item.c'; then $(CYGPATH_W) 'calendar-menu-item.c'; else $(CYGPATH_W) '$(srcdir)/calendar-menu-item.c'; fi` - indicator_datetime_service-datetime-service.o: datetime-service.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(indicator_datetime_service_CFLAGS) $(CFLAGS) -MT indicator_datetime_service-datetime-service.o -MD -MP -MF $(DEPDIR)/indicator_datetime_service-datetime-service.Tpo -c -o indicator_datetime_service-datetime-service.o `test -f 'datetime-service.c' || echo '$(srcdir)/'`datetime-service.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/indicator_datetime_service-datetime-service.Tpo $(DEPDIR)/indicator_datetime_service-datetime-service.Po diff --git a/src/calendar-menu-item.c b/src/calendar-menu-item.c deleted file mode 100644 index c2ceec3..0000000 --- a/src/calendar-menu-item.c +++ /dev/null @@ -1,100 +0,0 @@ -/* -Calendar menu item dbusmenu "transport" for the corresponding IDO widget. - -Copyright 2010 Canonical Ltd. - -Authors: - David Barth <david.barth@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gdk/gdk.h> -#include <glib/gi18n.h> -#include "calendar-menu-item.h" - -#include "dbus-shared.h" - -#include <libdbusmenu-glib/client.h> -#include <libdbusmenu-glib/server.h> -#include <libdbusmenu-glib/menuitem.h> - -enum { - LAST_SIGNAL -}; - -/* static guint signals[LAST_SIGNAL] = { }; */ - -typedef struct _CalendarMenuItemPrivate CalendarMenuItemPrivate; -struct _CalendarMenuItemPrivate -{ - void * placeholder; -}; - -#define CALENDAR_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItemPrivate)) - -/* Prototypes */ -static void calendar_menu_item_class_init (CalendarMenuItemClass *klass); -static void calendar_menu_item_init (CalendarMenuItem *self); -static void calendar_menu_item_dispose (GObject *object); -static void calendar_menu_item_finalize (GObject *object); - -G_DEFINE_TYPE (CalendarMenuItem, calendar_menu_item, DBUSMENU_TYPE_MENUITEM); - -static void -calendar_menu_item_class_init (CalendarMenuItemClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (CalendarMenuItemPrivate)); - - object_class->dispose = calendar_menu_item_dispose; - object_class->finalize = calendar_menu_item_finalize; - - return; -} - -static void -calendar_menu_item_init (CalendarMenuItem *self) -{ - return; -} - -static void -calendar_menu_item_dispose (GObject *object) -{ - G_OBJECT_CLASS (calendar_menu_item_parent_class)->dispose (object); -} - -static void -calendar_menu_item_finalize (GObject *object) -{ - G_OBJECT_CLASS (calendar_menu_item_parent_class)->finalize (object); - - return; -} - -CalendarMenuItem * -calendar_menu_item_new () -{ - CalendarMenuItem * self = g_object_new(CALENDAR_MENU_ITEM_TYPE, NULL); - - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CALENDAR_MENUITEM_TYPE); - - return self; -} - diff --git a/src/calendar-menu-item.h b/src/calendar-menu-item.h deleted file mode 100644 index 7a56f96..0000000 --- a/src/calendar-menu-item.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -Calendar menu item dbusmenu "transport" for the corresponding IDO widget. - -Copyright 2010 Canonical Ltd. - -Authors: - David Barth <david.barth@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __CALENDAR_MENU_ITEM_H__ -#define __CALENDAR_MENU_ITEM_H__ - -#include <glib.h> -#include <glib-object.h> - -#include <libdbusmenu-glib/menuitem.h> - -G_BEGIN_DECLS - -#define CALENDAR_MENU_ITEM_TYPE (calendar_menu_item_get_type ()) -#define CALENDAR_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItem)) -#define CALENDAR_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItemClass)) -#define IS_CALENDAR_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALENDAR_MENU_ITEM_TYPE)) -#define IS_CALENDAR_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALENDAR_MENU_ITEM_TYPE)) -#define CALENDAR_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItemClass)) - -#define CALENDAR_MENU_ITEM_SIGNAL_ACTIVATE "activate" -#define CALENDAR_MENUITEM_PROP_TEXT "text" - -typedef struct _CalendarMenuItem CalendarMenuItem; -typedef struct _CalendarMenuItemClass CalendarMenuItemClass; - -struct _CalendarMenuItemClass { - DbusmenuMenuitemClass parent_class; -}; - -struct _CalendarMenuItem { - DbusmenuMenuitem parent; -}; - -GType calendar_menu_item_get_type (void); -CalendarMenuItem * calendar_menu_item_new (); - -G_END_DECLS - -#endif /* __CALENDAR_MENU_ITEM_H__ */ - diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c index e7fef5d..5ace8c4 100644 --- a/src/datetime-prefs.c +++ b/src/datetime-prefs.c @@ -653,6 +653,7 @@ indicator_datetime_panel_init (IndicatorDatetimePanel * self) GError * error = NULL; self->priv->builder = gtk_builder_new (); + gtk_builder_set_translation_domain (self->priv->builder, GETTEXT_PACKAGE); gtk_builder_add_from_file (self->priv->builder, DATETIME_DIALOG_UI_FILE, &error); if (error != NULL) { /* We have to abort, we can't continue without the ui file */ @@ -661,8 +662,6 @@ indicator_datetime_panel_init (IndicatorDatetimePanel * self) return; } - gtk_builder_set_translation_domain (self->priv->builder, GETTEXT_PACKAGE); - GSettings * conf = g_settings_new (SETTINGS_INTERFACE); #define WIG(name) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, name)) diff --git a/src/datetime-service.c b/src/datetime-service.c index e46b04d..5a492c1 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -38,6 +38,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <geoclue/geoclue-master.h> #include <geoclue/geoclue-master-client.h> +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include <gdesktop-enums.h> +#include <libgnome-desktop/gnome-wall-clock.h> + #include <time.h> #include <libecal/e-cal.h> #include <libical/ical.h> @@ -57,7 +61,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>. static void geo_create_client (GeoclueMaster * master, GeoclueMasterClient * client, gchar * path, GError * error, gpointer user_data); static gboolean update_appointment_menu_items (gpointer user_data); static gboolean update_timezone_menu_items(gpointer user_data); -static void setup_timer (void); static void geo_client_invalid (GeoclueMasterClient * client, gpointer user_data); static void geo_address_change (GeoclueMasterClient * client, gchar * a, gchar * b, gchar * c, gchar * d, gpointer user_data); static gboolean get_greeter_mode (void); @@ -482,7 +485,7 @@ check_for_calendar (gpointer user_data) dbusmenu_menuitem_property_set_bool(date, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); gchar *evo = g_find_program_in_path("evolution"); - if (evo != NULL) { + if (!get_greeter_mode () && evo != NULL) { g_debug("Found the calendar application: %s", evo); g_signal_connect (G_OBJECT(date), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, @@ -770,6 +773,18 @@ update_appointment_menu_items (gpointer user_data) ECal *ecal = e_cal_new(source, E_CAL_SOURCE_TYPE_EVENT); e_cal_set_auth_func (ecal, (ECalAuthFunc) auth_func, NULL); + icaltimezone* current_zone = icaltimezone_get_builtin_timezone(current_timezone); + if (!current_zone) { + // current_timezone may be a TZID? + current_zone = icaltimezone_get_builtin_timezone_from_tzid(current_timezone); + } + if (current_zone && !e_cal_set_default_timezone(ecal, current_zone, &gerror)) { + g_debug("Failed to set ecal default timezone %s", gerror->message); + g_error_free(gerror); + gerror = NULL; + continue; + } + if (!e_cal_open(ecal, FALSE, &gerror)) { g_debug("Failed to get ecal sources %s", gerror->message); g_error_free(gerror); @@ -1127,67 +1142,12 @@ build_menus (DbusmenuMenuitem * root) return; } -/* Run when the timezone file changes */ static void -timezone_changed (GFileMonitor * monitor, GFile * file, GFile * otherfile, GFileMonitorEvent event, gpointer user_data) +on_clock_changed (GnomeWallClock *clock, + GParamSpec *pspec, + gpointer user_data) { - update_current_timezone(); - datetime_interface_update(DATETIME_INTERFACE(user_data)); - update_datetime(NULL); - setup_timer(); - return; -} - -/* Set up monitoring the timezone file */ -static void -build_timezone (DatetimeInterface * dbus) -{ - GFile * timezonefile = g_file_new_for_path(TIMEZONE_FILE); - GFileMonitor * monitor = g_file_monitor_file(timezonefile, G_FILE_MONITOR_NONE, NULL, NULL); - if (monitor != NULL) { - g_signal_connect(G_OBJECT(monitor), "changed", G_CALLBACK(timezone_changed), dbus); - g_debug("Monitoring timezone file: '" TIMEZONE_FILE "'"); - } else { - g_warning("Unable to monitor timezone file: '" TIMEZONE_FILE "'"); - } - return; -} - -/* Source ID for the timer */ -static guint timer = 0; - -/* Execute at a given time, update and setup a new - timer to go again. */ -static gboolean -timer_func (gpointer user_data) -{ - timer = 0; - /* Reset up each time to reduce error */ - setup_timer(); - update_datetime(NULL); - return FALSE; -} - -/* Sets up the time to launch the timer to update the - date in the datetime entry */ -static void -setup_timer (void) -{ - if (timer != 0) { - g_source_remove(timer); - timer = 0; - } - - time_t t; - t = time(NULL); - struct tm * ltime = localtime(&t); - - timer = g_timeout_add_seconds(((23 - ltime->tm_hour) * 60 * 60) + - ((59 - ltime->tm_min) * 60) + - ((60 - ltime->tm_sec)) + 60 /* one minute past */, - timer_func, NULL); - - return; + update_datetime (NULL); } static void @@ -1201,7 +1161,6 @@ session_active_change_cb (GDBusProxy * proxy, gchar * sender_name, gchar * signa if (!idle) { datetime_interface_update(DATETIME_INTERFACE(user_data)); update_datetime(NULL); - setup_timer(); } } return; @@ -1425,6 +1384,8 @@ service_shutdown (IndicatorService * service, gpointer user_data) int main (int argc, char ** argv) { + GnomeWallClock *clock; + g_type_init(); /* Acknowledging the service init and setting up the interface */ @@ -1460,11 +1421,9 @@ main (int argc, char ** argv) /* Setup dbus interface */ dbus = g_object_new(DATETIME_INTERFACE_TYPE, NULL); - /* Setup timezone watch */ - build_timezone(dbus); - /* Setup the timer */ - setup_timer(); + clock = g_object_new (GNOME_TYPE_WALL_CLOCK, NULL); + g_signal_connect (clock, "notify::clock", G_CALLBACK (on_clock_changed), NULL); /* And watch for system resumes */ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index aca1101..61cfc5f 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -45,6 +45,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <libido/libido.h> #include <libdbusmenu-gtk3/menuitem.h> +/* For GnomeWallClock */ +#define GNOME_DESKTOP_USE_UNSTABLE_API +#include <libgnome-desktop/gnome-wall-clock.h> + #include "utils.h" #include "dbus-shared.h" #include "settings-shared.h" @@ -72,7 +76,6 @@ struct _IndicatorDatetime { struct _IndicatorDatetimePrivate { GtkLabel * label; - guint timer; gchar * time_string; @@ -101,8 +104,11 @@ struct _IndicatorDatetimePrivate { GList * timezone_items; GSettings * settings; + GSettings * gnome_settings; GtkSizeGroup * indicator_right_group; + + GnomeWallClock *clock; }; /* Enum for the properties so that they can be quickly @@ -138,9 +144,6 @@ struct _indicator_item_t { #define PROP_SHOW_WEEK_NUMBERS_S "show-week-numbers" #define PROP_SHOW_CALENDAR_S "show-calendar" -#define INDICATOR_DATETIME_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_DATETIME_TYPE, IndicatorDatetimePrivate)) - enum { STRFTIME_MASK_NONE = 0, /* Hours or minutes as we always test those */ STRFTIME_MASK_SECONDS = 1 << 0, /* Seconds count */ @@ -153,7 +156,7 @@ enum { STRFTIME_MASK_ALL = (STRFTIME_MASK_SECONDS | STRFTIME_MASK_AMPM | STRFTIME_MASK_WEEK | STRFTIME_MASK_DAY | STRFTIME_MASK_MONTH | STRFTIME_MASK_YEAR) }; -GType indicator_datetime_get_type (void); +GType indicator_datetime_get_type (void) G_GNUC_CONST; static void indicator_datetime_class_init (IndicatorDatetimeClass *klass); static void indicator_datetime_init (IndicatorDatetime *self); @@ -169,8 +172,8 @@ static gboolean bind_enum_get (GValue * value, GVariant * variant, g static gchar * generate_format_string_now (IndicatorDatetime * self); static void update_label (IndicatorDatetime * io, GDateTime ** datetime); static void guess_label_size (IndicatorDatetime * self); -static void setup_timer (IndicatorDatetime * self, GDateTime * datetime); static void update_time (IndicatorDatetime * self); +static void on_clock_changed (GnomeWallClock *clock, GParamSpec *pspec, gpointer user_data); static void receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, GVariant * parameters, gpointer user_data); static void service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data); static gint generate_strftime_bitmask (const char *time_str); @@ -215,7 +218,7 @@ indicator_datetime_class_init (IndicatorDatetimeClass *klass) PROP_TIME_FORMAT, g_param_spec_int(PROP_TIME_FORMAT_S, "A choice of which format should be used on the panel", - "Chooses between letting the locale choose the time, 12-hour time, 24-time or using the custom string passed to strftime().", + "Chooses between letting the locale choose the time, 12-hour time, 24-time or using the custom string passed to g_date_time_format().", SETTINGS_TIME_LOCALE, /* min */ SETTINGS_TIME_CUSTOM, /* max */ SETTINGS_TIME_LOCALE, /* default */ @@ -245,7 +248,7 @@ indicator_datetime_class_init (IndicatorDatetimeClass *klass) PROP_CUSTOM_TIME_FORMAT, g_param_spec_string(PROP_CUSTOM_TIME_FORMAT_S, "The format that is used to show the time on the panel.", - "A format string in the form used to pass to strftime to make a string for displaying on the panel.", + "A format string in the form used to pass to g_date_time_format() to make a string for displaying on the panel.", DEFAULT_TIME_FORMAT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); @@ -274,12 +277,6 @@ menu_visible_notfy_cb(GtkWidget * menu, G_GNUC_UNUSED GParamSpec *pspec, gpointe gint y, m, d; g_debug("notify visible signal received"); - - // we should only react if we're currently visible - gboolean visible; - g_object_get(G_OBJECT(menu), "visible", &visible, NULL); - if (visible) return; - g_debug("notify visible menu hidden, resetting date"); datetime = g_date_time_new_now_local (); g_date_time_get_ymd (datetime, &y, &m, &d); @@ -297,10 +294,11 @@ menu_visible_notfy_cb(GtkWidget * menu, G_GNUC_UNUSED GParamSpec *pspec, gpointe static void indicator_datetime_init (IndicatorDatetime *self) { - self->priv = INDICATOR_DATETIME_GET_PRIVATE(self); + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + INDICATOR_DATETIME_TYPE, + IndicatorDatetimePrivate); self->priv->label = NULL; - self->priv->timer = 0; self->priv->idle_measure = 0; self->priv->max_width = 0; @@ -369,6 +367,11 @@ indicator_datetime_init (IndicatorDatetime *self) g_warning("Unable to get settings for '" SETTINGS_INTERFACE "'"); } + self->priv->gnome_settings = g_settings_new ("org.gnome.desktop.interface"); + + self->priv->clock = g_object_new (GNOME_TYPE_WALL_CLOCK, NULL); + g_signal_connect (self->priv->clock, "notify::clock", G_CALLBACK (on_clock_changed), self); + self->priv->sm = indicator_service_manager_new_version(SERVICE_NAME, SERVICE_VERSION); self->priv->indicator_right_group = GTK_SIZE_GROUP(gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL)); @@ -406,11 +409,10 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) IndicatorDatetime * self = INDICATOR_DATETIME(user_data); g_return_if_fail(self != NULL); + IndicatorDatetimePrivate * priv = self->priv; GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error); - IndicatorDatetimePrivate * priv = INDICATOR_DATETIME_GET_PRIVATE(self); - if (priv->service_proxy_cancel != NULL) { g_object_unref(priv->service_proxy_cancel); priv->service_proxy_cancel = NULL; @@ -441,9 +443,9 @@ indicator_datetime_dispose (GObject *object) self->priv->label = NULL; } - if (self->priv->timer != 0) { - g_source_remove(self->priv->timer); - self->priv->timer = 0; + if (self->priv->clock != NULL) { + g_object_unref (self->priv->clock); + self->priv->clock = NULL; } if (self->priv->idle_measure != 0) { @@ -543,7 +545,8 @@ bind_enum_get (GValue * value, GVariant * variant, gpointer user_data) static void timezone_update_all_labels (IndicatorDatetime * self) { - IndicatorDatetimePrivate *priv = INDICATOR_DATETIME_GET_PRIVATE(self); + IndicatorDatetimePrivate *priv = self->priv; + g_list_foreach(priv->timezone_items, (GFunc)timezone_update_labels, NULL); } @@ -569,7 +572,7 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec if (newval != self->priv->time_mode) { update = TRUE; self->priv->time_mode = newval; - setup_timer(self, NULL); + update_time (self); } break; } @@ -578,8 +581,11 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec self->priv->show_seconds = !self->priv->show_seconds; if (self->priv->time_mode != SETTINGS_TIME_CUSTOM) { update = TRUE; - setup_timer(self, NULL); + update_time (self); } + g_settings_set_boolean (self->priv->gnome_settings, + "clock-show-seconds", + self->priv->show_seconds); } break; } @@ -613,8 +619,11 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec self->priv->custom_show_seconds = (time_mask & STRFTIME_MASK_SECONDS); if (self->priv->time_mode == SETTINGS_TIME_CUSTOM) { update = TRUE; - setup_timer(self, NULL); + update_time (self); } + g_settings_set_boolean (self->priv->gnome_settings, + "clock-show-seconds", + self->priv->show_seconds); } break; } @@ -781,6 +790,12 @@ set_label_to_time_in_zone (IndicatorDatetime * self, GtkLabel * label, } else { timestr = g_date_time_format(datetime_now, format); + if (timestr == NULL) { + g_warning ("The custom date format is not valid, check the\n" + "g_date_time_format() documentation for the supported\n" + "format specifiers "); + timestr = g_strdup ("Date format not supported"); + } } gboolean use_markup = FALSE; @@ -831,11 +846,16 @@ update_time (IndicatorDatetime * self) GDateTime * dt = NULL; update_label(self, &dt); timezone_update_all_labels(self); - if (dt != NULL) { - setup_timer(self, dt); - g_date_time_unref(dt); - } - return; +} + +static void +on_clock_changed (GnomeWallClock *clock, + GParamSpec *pspec, + gpointer user_data) +{ + IndicatorDatetime *self = INDICATOR_DATETIME (user_data); + + update_time (self); } /* Receives all signals from the service, routed to the appropriate functions */ @@ -852,54 +872,6 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, return; } -/* Runs every minute and updates the time */ -gboolean -timer_func (gpointer user_data) -{ - IndicatorDatetime * self = INDICATOR_DATETIME(user_data); - self->priv->timer = 0; - GDateTime * dt = NULL; - update_label(self, &dt); - timezone_update_all_labels(self); - if (dt != NULL) { - setup_timer(self, dt); - g_date_time_unref(dt); - } - return FALSE; -} - -/* Configure the timer to run the next time through */ -static void -setup_timer (IndicatorDatetime * self, GDateTime * datetime) -{ - gboolean unref = FALSE; - - if (self->priv->timer != 0) { - g_source_remove(self->priv->timer); - self->priv->timer = 0; - } - - if (self->priv->show_seconds || - (self->priv->time_mode == SETTINGS_TIME_CUSTOM && self->priv->custom_show_seconds)) { - self->priv->timer = g_timeout_add_full(G_PRIORITY_HIGH, 999, timer_func, self, NULL); - } else { - if (datetime == NULL) { - datetime = g_date_time_new_now_local(); - unref = TRUE; - } - - /* Plus 2 so we're just after the minute, don't want to be early. */ - gint seconds = (gint)g_date_time_get_seconds(datetime); - self->priv->timer = g_timeout_add_seconds(60 - seconds + 2, timer_func, self); - - if (unref) { - g_date_time_unref(datetime); - } - } - - return; -} - /* Does a quick meausre of how big the string is in pixels with a Pango layout */ static gint @@ -1392,8 +1364,7 @@ new_calendar_item (DbusmenuMenuitem * newitem, /* Note: not checking parent, it's reasonable for it to be NULL */ IndicatorDatetime *self = INDICATOR_DATETIME(user_data); - self->priv = INDICATOR_DATETIME_GET_PRIVATE(self); - + IdoCalendarMenuItem *ido = IDO_CALENDAR_MENU_ITEM (ido_calendar_menu_item_new ()); self->priv->ido_calendar = ido; @@ -1437,7 +1408,9 @@ timezone_toggled_cb (GtkCheckMenuItem *checkmenuitem, DbusmenuMenuitem * dbusite static void timezone_destroyed_cb (indicator_item_t * mi_data, DbusmenuMenuitem * dbusitem) { - IndicatorDatetimePrivate *priv = INDICATOR_DATETIME_GET_PRIVATE(mi_data->self); + IndicatorDatetime *self = INDICATOR_DATETIME (mi_data->self); + IndicatorDatetimePrivate *priv = self->priv; + priv->timezone_items = g_list_remove(priv->timezone_items, mi_data); g_signal_handlers_disconnect_by_func(G_OBJECT(mi_data->gmi), G_CALLBACK(timezone_toggled_cb), dbusitem); g_free(mi_data); @@ -1455,7 +1428,7 @@ new_timezone_item(DbusmenuMenuitem * newitem, /* Note: not checking parent, it's reasonable for it to be NULL */ IndicatorDatetime * self = INDICATOR_DATETIME(user_data); - IndicatorDatetimePrivate *priv = INDICATOR_DATETIME_GET_PRIVATE(self); + IndicatorDatetimePrivate *priv = self->priv; // Menu item with a radio button and a right aligned time indicator_item_t * mi_data = g_new0(indicator_item_t, 1); @@ -1519,10 +1492,6 @@ get_label (IndicatorObject * io) gtk_widget_set_visible(GTK_WIDGET (self->priv->label), self->priv->show_clock); } - if (self->priv->timer == 0) { - setup_timer(self, NULL); - } - return self->priv->label; } diff --git a/src/timezone-completion.c b/src/timezone-completion.c index d190035..f223bf4 100644 --- a/src/timezone-completion.c +++ b/src/timezone-completion.c @@ -35,7 +35,6 @@ enum { /* static guint signals[LAST_SIGNAL] = { }; */ -typedef struct _TimezoneCompletionPrivate TimezoneCompletionPrivate; struct _TimezoneCompletionPrivate { GtkTreeModel * initial_model; @@ -48,8 +47,6 @@ struct _TimezoneCompletionPrivate GHashTable * request_table; }; -#define TIMEZONE_COMPLETION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), TIMEZONE_COMPLETION_TYPE, TimezoneCompletionPrivate)) - #define GEONAME_URL "http://geoname-lookup.ubuntu.com/?query=%s&release=%s&lang=%s" /* Prototypes */ @@ -71,7 +68,7 @@ match_func (GtkEntryCompletion *completion, const gchar *key, static void save_and_use_model (TimezoneCompletion * completion, GtkTreeModel * model) { - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE(completion); + TimezoneCompletionPrivate * priv = completion->priv; g_hash_table_insert (priv->request_table, g_strdup (priv->request_text), g_object_ref_sink (model)); @@ -129,7 +126,7 @@ static void json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data) { TimezoneCompletion * completion = TIMEZONE_COMPLETION (user_data); - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE(completion); + TimezoneCompletionPrivate * priv = completion->priv; GError * error = NULL; const gchar * prev_name = NULL; const gchar * prev_admin1 = NULL; @@ -257,7 +254,7 @@ static void geonames_data_ready (GObject *object, GAsyncResult *res, gpointer user_data) { TimezoneCompletion * completion = TIMEZONE_COMPLETION (user_data); - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion); + TimezoneCompletionPrivate * priv = completion->priv; GError * error = NULL; GFileInputStream * stream; @@ -335,7 +332,7 @@ get_version (void) static gboolean request_zones (TimezoneCompletion * completion) { - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion); + TimezoneCompletionPrivate * priv = completion->priv; priv->queued_request = 0; @@ -373,7 +370,7 @@ request_zones (TimezoneCompletion * completion) static void entry_changed (GtkEntry * entry, TimezoneCompletion * completion) { - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion); + TimezoneCompletionPrivate * priv = completion->priv; if (priv->queued_request) { g_source_remove (priv->queued_request); @@ -484,7 +481,7 @@ entry_keypress (GtkEntry * entry, GdkEventKey *event, TimezoneCompletion * comp void timezone_completion_watch_entry (TimezoneCompletion * completion, GtkEntry * entry) { - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion); + TimezoneCompletionPrivate * priv = completion->priv; if (priv->queued_request) { g_source_remove (priv->queued_request); @@ -604,7 +601,12 @@ timezone_completion_class_init (TimezoneCompletionClass *klass) static void timezone_completion_init (TimezoneCompletion * self) { - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (self); + TimezoneCompletionPrivate *priv; + + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + TIMEZONE_COMPLETION_TYPE, + TimezoneCompletionPrivate); + priv = self->priv; priv->initial_model = GTK_TREE_MODEL (get_initial_model ()); @@ -630,7 +632,7 @@ timezone_completion_dispose (GObject * object) G_OBJECT_CLASS (timezone_completion_parent_class)->dispose (object); TimezoneCompletion * completion = TIMEZONE_COMPLETION (object); - TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion); + TimezoneCompletionPrivate * priv = completion->priv; if (priv->changed_id) { if (priv->entry) diff --git a/src/timezone-completion.h b/src/timezone-completion.h index fdfb234..1592d79 100644 --- a/src/timezone-completion.h +++ b/src/timezone-completion.h @@ -34,15 +34,18 @@ G_BEGIN_DECLS #define IS_TIMEZONE_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TIMEZONE_COMPLETION_TYPE)) #define TIMEZONE_COMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TIMEZONE_COMPLETION_TYPE, TimezoneCompletionClass)) -typedef struct _TimezoneCompletion TimezoneCompletion; -typedef struct _TimezoneCompletionClass TimezoneCompletionClass; - -struct _TimezoneCompletionClass { - GtkEntryCompletionClass parent_class; -}; +typedef struct _TimezoneCompletion TimezoneCompletion; +typedef struct _TimezoneCompletionPrivate TimezoneCompletionPrivate; +typedef struct _TimezoneCompletionClass TimezoneCompletionClass; struct _TimezoneCompletion { GtkEntryCompletion parent; + + TimezoneCompletionPrivate *priv; +}; + +struct _TimezoneCompletionClass { + GtkEntryCompletionClass parent_class; }; #define TIMEZONE_COMPLETION_ZONE 0 @@ -53,7 +56,7 @@ struct _TimezoneCompletion { #define TIMEZONE_COMPLETION_LATITUDE 5 #define TIMEZONE_COMPLETION_LAST 6 -GType timezone_completion_get_type (void); +GType timezone_completion_get_type (void) G_GNUC_CONST; TimezoneCompletion * timezone_completion_new (); void timezone_completion_watch_entry (TimezoneCompletion * completion, GtkEntry * entry); |