aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/datetime-prefs-locations.c6
-rw-r--r--src/timezone-completion.c25
2 files changed, 28 insertions, 3 deletions
diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c
index 5e93a56..b8d9f8f 100644
--- a/src/datetime-prefs-locations.c
+++ b/src/datetime-prefs-locations.c
@@ -39,6 +39,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define COL_TIME 1
#define COL_ZONE 2
+static gboolean update_times (TimezoneCompletion * completion);
+
static void
handle_add (GtkWidget * button, GtkTreeView * tree)
{
@@ -103,8 +105,6 @@ timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model,
TIMEZONE_COMPLETION_NAME, &name,
-1);
- g_debug("match selected: %s, %s", name, zone);
-
if (zone == NULL || zone[0] == 0) {
const gchar * strlon, * strlat;
gdouble lon = 0.0, lat = 0.0;
@@ -132,6 +132,8 @@ timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model,
gtk_list_store_set (store, store_iter, COL_NAME, name, COL_ZONE, zone, -1);
}
+ update_times (TIMEZONE_COMPLETION (widget));
+
return FALSE; // Do normal action too
}
diff --git a/src/timezone-completion.c b/src/timezone-completion.c
index a73ebf9..2e1afc0 100644
--- a/src/timezone-completion.c
+++ b/src/timezone-completion.c
@@ -230,6 +230,20 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
json_reader_end_element (reader);
}
+ if (strlen (priv->request_text) < 4) {
+ gchar * lower_text = g_ascii_strdown (priv->request_text, -1);
+ if (g_strcmp0 (lower_text, "ut") == 0 ||
+ g_strcmp0 (lower_text, "utc") == 0) {
+ GtkTreeIter iter;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ TIMEZONE_COMPLETION_ZONE, "UTC",
+ TIMEZONE_COMPLETION_NAME, "UTC",
+ -1);
+ }
+ g_free (lower_text);
+ }
+
save_and_use_model (completion, GTK_TREE_MODEL (store));
g_object_unref (G_OBJECT (reader));
}
@@ -374,6 +388,13 @@ get_initial_model (void)
g_free (name);
}
+ GtkTreeIter iter;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ TIMEZONE_COMPLETION_ZONE, "UTC",
+ TIMEZONE_COMPLETION_NAME, "UTC",
+ -1);
+
tz_db_free (db);
return store;
}
@@ -391,7 +412,9 @@ data_func (GtkCellLayout *cell_layout, GtkCellRenderer *cell,
-1);
gchar * user_name;
- if (admin1 == NULL || admin1[0] == 0) {
+ if (country == NULL || country[0] == 0) {
+ user_name = g_strdup (name);
+ } else if (admin1 == NULL || admin1[0] == 0) {
user_name = g_strdup_printf ("%s <small>(%s)</small>", name, country);
} else {
user_name = g_strdup_printf ("%s <small>(%s, %s)</small>", name, admin1, country);