diff options
author | Ted Gould <ted@gould.cx> | 2011-09-15 10:43:59 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-09-15 10:43:59 -0500 |
commit | 3b73d2cfdda5f13b338cb5eb37e0f1da2c43242b (patch) | |
tree | b6569d20efbf55cdbc74f6e3061f43ed57fd8aa6 | |
parent | 34a42266114d26f09a7470706cc43196ebe8b302 (diff) | |
parent | 1e2f73f716198aec43b76570e1926d73ddfeca19 (diff) | |
download | ayatana-indicator-datetime-3b73d2cfdda5f13b338cb5eb37e0f1da2c43242b.tar.gz ayatana-indicator-datetime-3b73d2cfdda5f13b338cb5eb37e0f1da2c43242b.tar.bz2 ayatana-indicator-datetime-3b73d2cfdda5f13b338cb5eb37e0f1da2c43242b.zip |
Update to release 0.2.95
-rw-r--r-- | ChangeLog | 8 | ||||
-rwxr-xr-x | configure | 49 | ||||
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | src/datetime-service.c | 77 | ||||
-rw-r--r-- | src/indicator-datetime.c | 101 |
6 files changed, 152 insertions, 95 deletions
@@ -2,6 +2,14 @@ 2011-09-15 Ted Gould <ted@gould.cx> + 0.2.95 + +2011-09-15 Ted Gould <ted@gould.cx> + + Dropping the wall clock branch. Bad touch. + +2011-09-15 Ted Gould <ted@gould.cx> + 0.2.94 2011-09-15 Ted Gould <ted@gould.cx> @@ -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.94. +# Generated by GNU Autoconf 2.68 for indicator-datetime 0.2.95. # # Report bugs to <http://bugs.launchpad.net/indicator-datetime>. # @@ -572,8 +572,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='indicator-datetime' PACKAGE_TARNAME='indicator-datetime' -PACKAGE_VERSION='0.2.94' -PACKAGE_STRING='indicator-datetime 0.2.94' +PACKAGE_VERSION='0.2.95' +PACKAGE_STRING='indicator-datetime 0.2.95' 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.94 to adapt to many kinds of systems. +\`configure' configures indicator-datetime 0.2.95 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.94:";; + short | recursive ) echo "Configuration of indicator-datetime 0.2.95:";; esac cat <<\_ACEOF @@ -1578,7 +1578,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-datetime configure 0.2.94 +indicator-datetime configure 0.2.95 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -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.94, which was +It was created by indicator-datetime $as_me 0.2.95, 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.94' + VERSION='0.2.95' cat >>confdefs.h <<_ACEOF @@ -11790,8 +11790,6 @@ 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.29.19 @@ -11810,15 +11808,11 @@ 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 @@ -11827,8 +11821,6 @@ 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` @@ -11845,15 +11837,11 @@ 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 @@ -11862,8 +11850,6 @@ 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` @@ -11889,16 +11875,12 @@ 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` @@ -11908,8 +11890,6 @@ 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: @@ -12104,7 +12084,6 @@ 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 @@ -12119,7 +12098,6 @@ 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 @@ -12137,7 +12115,6 @@ 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 @@ -12163,7 +12140,6 @@ 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 @@ -12178,7 +12154,6 @@ 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 @@ -12196,7 +12171,6 @@ 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 @@ -12231,7 +12205,6 @@ 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 @@ -12247,7 +12220,6 @@ 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 @@ -12266,7 +12238,6 @@ 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 @@ -14683,7 +14654,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.94, which was +This file was extended by indicator-datetime $as_me 0.2.95, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14750,7 +14721,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.94 +indicator-datetime config.status 0.2.95 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index b980185..fd87af8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([indicator-datetime], - [0.2.94], + [0.2.95], [http://bugs.launchpad.net/indicator-datetime], [indicator-datetime], [http://launchpad.net/indicator-datetime]) @@ -65,8 +65,6 @@ 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.29.19 @@ -76,8 +74,6 @@ 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) @@ -105,7 +101,6 @@ 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/debian/changelog b/debian/changelog index a8ad207..54b6879 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,14 +1,13 @@ -indicator-datetime (0.2.94-0ubuntu1~ppa1) UNRELEASED; urgency=low +indicator-datetime (0.2.95-0ubuntu1~ppa1) UNRELEASED; urgency=low * New upstream release. * Set default timezone on events without (LP: #837359) * Update docs to specify correct custom formats (LP: #775113) - * Use GNOME wall clock interface for time (LP: #837440) * Remove add event when using greeter (LP: #836521) * Fix gettext domain for builder files (LP: #845473) * Update date correctly when opening menu (LP: #793450) - -- Ted Gould <ted@ubuntu.com> Thu, 15 Sep 2011 10:08:06 -0500 + -- Ted Gould <ted@ubuntu.com> Thu, 15 Sep 2011 10:43:27 -0500 indicator-datetime (0.2.93-0ubuntu2) oneiric; urgency=low diff --git a/src/datetime-service.c b/src/datetime-service.c index 5a492c1..80c0b57 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -38,10 +38,6 @@ 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> @@ -61,6 +57,7 @@ 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); @@ -1142,12 +1139,67 @@ build_menus (DbusmenuMenuitem * root) return; } +/* Run when the timezone file changes */ static void -on_clock_changed (GnomeWallClock *clock, - GParamSpec *pspec, - gpointer user_data) +timezone_changed (GFileMonitor * monitor, GFile * file, GFile * otherfile, GFileMonitorEvent event, gpointer user_data) { - update_datetime (NULL); + 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; } static void @@ -1161,6 +1213,7 @@ 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; @@ -1384,8 +1437,6 @@ 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 */ @@ -1421,9 +1472,11 @@ 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 */ - clock = g_object_new (GNOME_TYPE_WALL_CLOCK, NULL); - g_signal_connect (clock, "notify::clock", G_CALLBACK (on_clock_changed), NULL); + setup_timer(); /* 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 61cfc5f..339ea2f 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -45,10 +45,6 @@ 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" @@ -76,6 +72,7 @@ struct _IndicatorDatetime { struct _IndicatorDatetimePrivate { GtkLabel * label; + guint timer; gchar * time_string; @@ -104,11 +101,8 @@ 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 @@ -172,8 +166,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); @@ -299,6 +293,7 @@ indicator_datetime_init (IndicatorDatetime *self) IndicatorDatetimePrivate); self->priv->label = NULL; + self->priv->timer = 0; self->priv->idle_measure = 0; self->priv->max_width = 0; @@ -367,11 +362,6 @@ 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)); @@ -443,9 +433,9 @@ indicator_datetime_dispose (GObject *object) self->priv->label = NULL; } - if (self->priv->clock != NULL) { - g_object_unref (self->priv->clock); - self->priv->clock = NULL; + if (self->priv->timer != 0) { + g_source_remove(self->priv->timer); + self->priv->timer = 0; } if (self->priv->idle_measure != 0) { @@ -572,7 +562,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; - update_time (self); + setup_timer(self, NULL); } break; } @@ -581,11 +571,8 @@ 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; - update_time (self); + setup_timer(self, NULL); } - g_settings_set_boolean (self->priv->gnome_settings, - "clock-show-seconds", - self->priv->show_seconds); } break; } @@ -619,11 +606,8 @@ 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; - update_time (self); + setup_timer(self, NULL); } - g_settings_set_boolean (self->priv->gnome_settings, - "clock-show-seconds", - self->priv->show_seconds); } break; } @@ -846,16 +830,11 @@ update_time (IndicatorDatetime * self) GDateTime * dt = NULL; update_label(self, &dt); timezone_update_all_labels(self); -} - -static void -on_clock_changed (GnomeWallClock *clock, - GParamSpec *pspec, - gpointer user_data) -{ - IndicatorDatetime *self = INDICATOR_DATETIME (user_data); - - update_time (self); + if (dt != NULL) { + setup_timer(self, dt); + g_date_time_unref(dt); + } + return; } /* Receives all signals from the service, routed to the appropriate functions */ @@ -872,6 +851,54 @@ 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 @@ -1492,6 +1519,10 @@ 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; } |