aboutsummaryrefslogtreecommitdiff
path: root/src/datetime-prefs-locations.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-06-17 09:06:02 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-06-17 09:06:02 -0500
commit72f23220db542cb8e41e9492528e79082c916804 (patch)
tree0ec9b3df80e55a3686d06bd9595c77a4a008f41f /src/datetime-prefs-locations.c
parent49ee32fefe869a778f39f88a936f546ef2c68737 (diff)
downloadayatana-indicator-datetime-72f23220db542cb8e41e9492528e79082c916804.tar.gz
ayatana-indicator-datetime-72f23220db542cb8e41e9492528e79082c916804.tar.bz2
ayatana-indicator-datetime-72f23220db542cb8e41e9492528e79082c916804.zip
in service.c, replace all calls to time(NULL) and g_date_time_new_now_local() with a call to the new 'indicator_datetime_service_get_localtime()' func. This is currently a passthrough to _new_now_local(), but we'll need this control point to override the system time in unit testing
Diffstat (limited to 'src/datetime-prefs-locations.c')
-rw-r--r--src/datetime-prefs-locations.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c
index 33fd660..4bbf053 100644
--- a/src/datetime-prefs-locations.c
+++ b/src/datetime-prefs-locations.c
@@ -25,6 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
#include <stdlib.h>
+#include <time.h> /* time_t */
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <timezonemap/timezone-completion.h>
@@ -416,10 +417,9 @@ update_times (GtkWidget * dlg)
g_signal_handlers_block_by_func (store, save_when_idle, dlg);
- GDateTime * now = g_date_time_new_now_local ();
-
GtkTreeIter iter;
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) {
+ GDateTime * now = g_date_time_new_now_local ();
do {
gchar * strzone;
@@ -428,7 +428,7 @@ update_times (GtkWidget * dlg)
if (strzone && *strzone) {
GTimeZone * tz = g_time_zone_new (strzone);
GDateTime * now_tz = g_date_time_to_timezone (now, tz);
- gchar * format = generate_format_string_at_time (now_tz);
+ gchar * format = generate_format_string_at_time (now, now_tz);
gchar * time_str = g_date_time_format (now_tz, format);
gchar * old_time_str;
@@ -444,10 +444,9 @@ update_times (GtkWidget * dlg)
}
g_free (strzone);
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
+ g_date_time_unref (now);
}
- g_date_time_unref (now);
-
g_signal_handlers_unblock_by_func (store, save_when_idle, dlg);
return TRUE;