aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-04-04 16:23:58 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-04-04 16:23:58 -0500
commitbe334e9a0fede5823076f487d89e3994d426ff0b (patch)
tree141b2e78b9cbd9df07a8afe3954acad263267d42 /src
parentfdd6962b447fe840027077d78a5ff6e8232ec70a (diff)
parent75d3c8be473b6c2600f187f77ffb25b21700a373 (diff)
downloadayatana-indicator-datetime-be334e9a0fede5823076f487d89e3994d426ff0b.tar.gz
ayatana-indicator-datetime-be334e9a0fede5823076f487d89e3994d426ff0b.tar.bz2
ayatana-indicator-datetime-be334e9a0fede5823076f487d89e3994d426ff0b.zip
* New upstream release.
* Fix location timezone sorting issue. * Clicking the systems settings window shouldn't close the Locations dialog. (LP: #947315) * Add gcov targets to autotools build for code-coverage reporting.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in1
-rw-r--r--src/datetime-prefs.c9
-rw-r--r--src/datetime-service.c19
3 files changed, 12 insertions, 17 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 83c5ec2..f06faba 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -172,7 +172,6 @@ CCDEPMODE = @CCDEPMODE@
CCPANELDIR = @CCPANELDIR@
CFLAGS = @CFLAGS@
COVERAGE_CFLAGS = @COVERAGE_CFLAGS@
-COVERAGE_CXXFLAGS = @COVERAGE_CXXFLAGS@
COVERAGE_LDFLAGS = @COVERAGE_LDFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index fbb8ea1..0e2e99c 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -577,21 +577,14 @@ setup_time_spinners (IndicatorDatetimePanel * self, GtkWidget * time, GtkWidget
}
static void
-hide_locations (IndicatorDatetimePanel * self)
-{
- if (self->priv->loc_dlg != NULL)
- gtk_widget_destroy (self->priv->loc_dlg);
-}
-
-static void
show_locations (IndicatorDatetimePanel * self)
{
if (self->priv->loc_dlg == NULL) {
self->priv->loc_dlg = datetime_setup_locations_dialog (self->priv->tzmap);
GtkWidget * dlg = gtk_widget_get_toplevel (GTK_WIDGET (self));
+ gtk_window_set_type_hint (GTK_WINDOW(self->priv->loc_dlg), GDK_WINDOW_TYPE_HINT_DIALOG);
gtk_window_set_transient_for (GTK_WINDOW (self->priv->loc_dlg), GTK_WINDOW (dlg));
g_signal_connect (self->priv->loc_dlg, "destroy", G_CALLBACK (gtk_widget_destroyed), &self->priv->loc_dlg);
- g_signal_connect_swapped (dlg, "focus-in-event", G_CALLBACK (hide_locations), self);
gtk_widget_show_all (self->priv->loc_dlg);
}
else {
diff --git a/src/datetime-service.c b/src/datetime-service.c
index fb95928..8ecef1c 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -108,7 +108,7 @@ struct comp_instance {
};
/**
- * A temp struct used by update_location_menu_items() for pruning duplicates.
+ * A temp struct used by update_location_menu_items() for pruning duplicates and sorting.
*/
struct TimeLocation
{
@@ -124,14 +124,16 @@ time_location_free (struct TimeLocation * loc)
g_free (loc);
}
static struct TimeLocation*
-time_location_new (const char * zone, const char * name)
+time_location_new (const char * zone, const char * name, time_t now)
{
struct TimeLocation * loc = g_new (struct TimeLocation, 1);
GTimeZone * tz = g_time_zone_new (zone);
- loc->offset = g_time_zone_get_offset (tz, 0);
+ gint interval = g_time_zone_find_interval (tz, G_TIME_TYPE_UNIVERSAL, now);
+ loc->offset = g_time_zone_get_offset (tz, interval);
loc->zone = g_strdup (zone);
loc->name = g_strdup (name);
g_time_zone_unref (tz);
+ g_debug ("%s zone '%s' name '%s' offset is %d", G_STRLOC, zone, name, (int)loc->offset);
return loc;
}
static int
@@ -146,9 +148,9 @@ time_location_compare (const struct TimeLocation * a, const struct TimeLocation
return ret;
}
static GSList*
-locations_add (GSList * locations, const char * zone, const char * name)
+locations_add (GSList * locations, const char * zone, const char * name, time_t now)
{
- struct TimeLocation * loc = time_location_new (zone, name);
+ struct TimeLocation * loc = time_location_new (zone, name, now);
if (g_slist_find_custom (locations, loc, (GCompareFunc)time_location_compare) == NULL) {
g_debug ("%s Adding zone '%s', name '%s'", G_STRLOC, zone, name);
@@ -182,18 +184,19 @@ update_location_menu_items (void)
***/
GSList * locations = NULL;
+ const time_t now = time(NULL);
/* maybe add geo_timezone */
if (geo_timezone != NULL) {
gchar * name = get_current_zone_name (geo_timezone);
- locations = locations_add (locations, geo_timezone, name);
+ locations = locations_add (locations, geo_timezone, name, now);
g_free (name);
}
/* maybe add current_timezone */
if (current_timezone != NULL) {
gchar * name = get_current_zone_name (current_timezone);
- locations = locations_add (locations, current_timezone, name);
+ locations = locations_add (locations, current_timezone, name, now);
g_free (name);
}
@@ -207,7 +210,7 @@ update_location_menu_items (void)
gchar * zone;
gchar * name;
split_settings_location (user_locations[i], &zone, &name);
- locations = locations_add (locations, zone, name);
+ locations = locations_add (locations, zone, name, now);
g_free (name);
g_free (zone);
}