diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-04-04 16:23:06 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-04-04 16:23:06 -0500 |
commit | 75d3c8be473b6c2600f187f77ffb25b21700a373 (patch) | |
tree | 3a166215054f6be6c5b44732de9710c042b7124e /src | |
parent | 5261e7f898e82ef03e5e8658253ae0c111d5870e (diff) | |
parent | 5a12bc3c3f41d17934c0773c2214ac6097a9154f (diff) | |
download | ayatana-indicator-datetime-75d3c8be473b6c2600f187f77ffb25b21700a373.tar.gz ayatana-indicator-datetime-75d3c8be473b6c2600f187f77ffb25b21700a373.tar.bz2 ayatana-indicator-datetime-75d3c8be473b6c2600f187f77ffb25b21700a373.zip |
Import upstream version 0.3.94
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.in | 1 | ||||
-rw-r--r-- | src/datetime-prefs.c | 9 | ||||
-rw-r--r-- | src/datetime-service.c | 19 |
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); } |