From a1d4564883ff1020d4de28343550b827c1b803c6 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Thu, 14 Jul 2011 10:26:01 -0400 Subject: don't unref a NULL GDateTime object; original patch by Dave Gilbert --- src/indicator-datetime.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 072253b..163804b 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -829,11 +829,13 @@ update_label (IndicatorDatetime * io, GDateTime ** datetime) static void update_time (IndicatorDatetime * self) { - GDateTime * dt; + GDateTime * dt = NULL; update_label(self, &dt); timezone_update_all_labels(self); - setup_timer(self, dt); - g_date_time_unref(dt); + if (dt != NULL) { + setup_timer(self, dt); + g_date_time_unref(dt); + } return; } @@ -857,11 +859,13 @@ timer_func (gpointer user_data) { IndicatorDatetime * self = INDICATOR_DATETIME(user_data); self->priv->timer = 0; - GDateTime * dt; + GDateTime * dt = NULL; update_label(self, &dt); timezone_update_all_labels(self); - setup_timer(self, dt); - g_date_time_unref(dt); + if (dt != NULL) { + setup_timer(self, dt); + g_date_time_unref(dt); + } return FALSE; } -- cgit v1.2.3 From 470d42294db9a759565b4dbf4f2494084b365ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Wed, 20 Jul 2011 11:47:35 +0200 Subject: Update autotools configuration a bit Do not use deprecated autoconf macros Use new libtool syntax General cleanup --- Makefile.am | 5 +++-- configure.ac | 49 +++++++++++++++++++++---------------------------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4de650a..feea4de 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,4 @@ +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} SUBDIRS = \ libmap \ @@ -16,7 +17,7 @@ dist-hook: echo Creating ChangeLog && \ ( cd "$(top_srcdir)" && \ echo '# Generated by Makefile. Do not edit.'; echo; \ - $(top_srcdir)/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \ + $(top_srcdir)/build-aux/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \ && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \ || (rm -f ChangeLog.tmp; \ echo Failed to generate ChangeLog >&2 ); \ @@ -28,7 +29,7 @@ dist-hook: echo Creating AUTHORS && \ ( cd "$(top_srcdir)" && \ echo '# Generated by Makefile. Do not edit.'; echo; \ - $(top_srcdir)/missing --run bzr log --long --levels=0 | grep -e "^\s*author:" -e "^\s*committer:" | cut -d ":" -f 2 | cut -d "<" -f 1 | sort -u) > AUTHORS.tmp \ + $(top_srcdir)/build-aux/missing --run bzr log --long --levels=0 | grep -e "^\s*author:" -e "^\s*committer:" | cut -d ":" -f 2 | cut -d "<" -f 1 | sort -u) > AUTHORS.tmp \ && mv -f AUTHORS.tmp $(top_distdir)/AUTHORS \ || (rm -f AUTHORS.tmp; \ echo Failed to generate AUTHORS >&2 ); \ diff --git a/configure.ac b/configure.ac index 2420923..defb12e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,27 +1,31 @@ - -AC_INIT(indicator-datetime, 0.2.91, ted@canonical.com) +AC_INIT([indicator-datetime], + [0.2.91], + [http://bugs.launchpad.net/indicator-datetime], + [indicator-datetime], + [http://launchpad.net/indicator-datetime]) AC_COPYRIGHT([Copyright 2009,2010 Canonical]) -AC_PREREQ(2.53) +AC_PREREQ([2.64]) -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-datetime, 0.2.91) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_SRCDIR([configure.ac]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([build-aux]) -AM_MAINTAINER_MODE +AM_INIT_AUTOMAKE([1.11 -Wall dist-xz]) +AM_MAINTAINER_MODE([enable]) -IT_PROG_INTLTOOL([0.35.0]) +AM_SILENT_RULES([yes]) -AC_ISC_POSIX +# Check for programs AC_PROG_CC AM_PROG_CC_C_O -AC_STDC_HEADERS -AC_DISABLE_STATIC -AC_PROG_LIBTOOL +AC_HEADER_STDC -AC_SUBST(VERSION) -AC_CONFIG_MACRO_DIR([m4]) +# Initialize libtool +LT_PREREQ([2.2]) +LT_INIT([disable-static]) -m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) AC_ARG_ENABLE([deprecations], [AS_HELP_STRING([--enable-deprecations], @@ -108,19 +112,6 @@ PKG_CHECK_MODULES(PREF, gio-2.0 >= $GIO_REQUIRED_VERSION PKG_CHECK_MODULES(LIBMAP, gio-2.0 >= $GIO_REQUIRED_VERSION gtk+-3.0 >= $GTK3_REQUIRED_VERSION) -AC_SUBST(INDICATOR_CFLAGS) -AC_SUBST(INDICATOR_LIBS) - -AC_SUBST(SERVICE_CFLAGS) -AC_SUBST(SERVICE_LIBS) - -AC_SUBST(PREF_CFLAGS) -AC_SUBST(PREF_LIBS) - -AC_SUBST(LIBMAP_CFLAGS) -AC_SUBST(LIBMAP_LIBS) -AC_SUBST(LIBMAP_LDFLAGS) - ########################### # Grab the GSettings Macros ########################### @@ -200,6 +191,7 @@ AC_DEFUN([AC_DEFINE_PATH], [ ########################### # Internationalization ########################### +IT_PROG_INTLTOOL([0.41.0]) GETTEXT_PACKAGE=indicator-datetime AC_SUBST(GETTEXT_PACKAGE) @@ -212,7 +204,7 @@ AM_GLIB_GNU_GETTEXT # Files ########################### -AC_OUTPUT([ +AC_CONFIG_FILES([ Makefile libmap/Makefile src/Makefile @@ -220,6 +212,7 @@ data/Makefile tests/Makefile po/Makefile.in ]) +AC_OUTPUT ########################### # Results -- cgit v1.2.3 From ed5958ee3a0e10fe0bb523f815b4553d0d7a9cec Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Wed, 3 Aug 2011 13:38:26 -0400 Subject: don't show timezones or settings links when used in a greeter --- src/datetime-service.c | 89 +++++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 37 deletions(-) diff --git a/src/datetime-service.c b/src/datetime-service.c index 6c876aa..8d25b3c 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -60,6 +60,7 @@ 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); static IndicatorService * service = NULL; static GMainLoop * mainloop = NULL; @@ -534,6 +535,10 @@ static gboolean update_timezone_menu_items(gpointer user_data) { g_debug("Updating timezone menu items"); + if (locations_separator == NULL || current_location == NULL) { + return FALSE; + } + gchar ** locations = g_settings_get_strv(conf, SETTINGS_LOCATIONS_S); if (locations == NULL) { @@ -1077,45 +1082,47 @@ build_menus (DbusmenuMenuitem * root) g_idle_add(check_for_calendar, NULL); } + + if (!get_greeter_mode ()) { + locations_separator = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(locations_separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); + dbusmenu_menuitem_property_set_bool (locations_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + dbusmenu_menuitem_child_append(root, locations_separator); + + geo_location = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set (geo_location, DBUSMENU_MENUITEM_PROP_TYPE, TIMEZONE_MENUITEM_TYPE); + set_current_timezone_label (geo_location, ""); + dbusmenu_menuitem_property_set_bool (geo_location, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); + dbusmenu_menuitem_property_set_bool (geo_location, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + g_signal_connect(G_OBJECT(geo_location), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(quick_set_tz), NULL); + dbusmenu_menuitem_child_append(root, geo_location); + + current_location = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set (current_location, DBUSMENU_MENUITEM_PROP_TYPE, TIMEZONE_MENUITEM_TYPE); + set_current_timezone_label (current_location, ""); + dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); + dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + dbusmenu_menuitem_child_append(root, current_location); - locations_separator = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(locations_separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); - dbusmenu_menuitem_property_set_bool (locations_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); - dbusmenu_menuitem_child_append(root, locations_separator); - - geo_location = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (geo_location, DBUSMENU_MENUITEM_PROP_TYPE, TIMEZONE_MENUITEM_TYPE); - set_current_timezone_label (geo_location, ""); - dbusmenu_menuitem_property_set_bool (geo_location, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); - dbusmenu_menuitem_property_set_bool (geo_location, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - g_signal_connect(G_OBJECT(geo_location), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(quick_set_tz), NULL); - dbusmenu_menuitem_child_append(root, geo_location); - - current_location = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (current_location, DBUSMENU_MENUITEM_PROP_TYPE, TIMEZONE_MENUITEM_TYPE); - set_current_timezone_label (current_location, ""); - dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); - dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); - dbusmenu_menuitem_child_append(root, current_location); - - check_timezone_sync(); + check_timezone_sync(); - g_signal_connect (conf, "changed::" SETTINGS_SHOW_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); - g_signal_connect (conf, "changed::" SETTINGS_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); - g_signal_connect (conf, "changed::" SETTINGS_SHOW_EVENTS_S, G_CALLBACK (show_events_changed), NULL); - g_signal_connect (conf, "changed::" SETTINGS_TIME_FORMAT_S, G_CALLBACK (time_format_changed), NULL); - - DbusmenuMenuitem * separator = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); - dbusmenu_menuitem_child_append(root, separator); - - settings = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set (settings, DBUSMENU_MENUITEM_PROP_LABEL, _("Time & Date Settings...")); - /* insensitive until we check for available apps */ - dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); - g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "gnome-control-center indicator-datetime"); - dbusmenu_menuitem_child_append(root, settings); - g_idle_add(check_for_timeadmin, NULL); + g_signal_connect (conf, "changed::" SETTINGS_SHOW_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); + g_signal_connect (conf, "changed::" SETTINGS_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); + g_signal_connect (conf, "changed::" SETTINGS_SHOW_EVENTS_S, G_CALLBACK (show_events_changed), NULL); + g_signal_connect (conf, "changed::" SETTINGS_TIME_FORMAT_S, G_CALLBACK (time_format_changed), NULL); + + DbusmenuMenuitem * separator = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); + dbusmenu_menuitem_child_append(root, separator); + + settings = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set (settings, DBUSMENU_MENUITEM_PROP_LABEL, _("Time & Date Settings...")); + /* insensitive until we check for available apps */ + dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); + g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "gnome-control-center indicator-datetime"); + dbusmenu_menuitem_child_append(root, settings); + g_idle_add(check_for_timeadmin, NULL); + } return; } @@ -1396,6 +1403,14 @@ geo_create_client (GeoclueMaster * master, GeoclueMasterClient * client, gchar * return; } +static gboolean +get_greeter_mode (void) +{ + const gchar *var; + var = g_getenv("INDICATOR_GREETER_MODE"); + return (g_strcmp0(var, "1") == 0); +} + /* Repsonds to the service object saying it's time to shutdown. It stops the mainloop. */ static void -- cgit v1.2.3 From 535f3a157ed42ea19e74f1f2ed194500b29b150e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Aug 2011 09:56:04 -0500 Subject: 0.2.92 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index defb12e..ec4720e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([indicator-datetime], - [0.2.91], + [0.2.92], [http://bugs.launchpad.net/indicator-datetime], [indicator-datetime], [http://launchpad.net/indicator-datetime]) -- cgit v1.2.3