diff options
author | Ted Gould <ted@gould.cx> | 2011-03-29 11:18:57 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-03-29 11:18:57 -0500 |
commit | 5e0da43a9b1a98225279161db5b5f574b409736f (patch) | |
tree | 5db05fce6fdcec93cb4f145561556132d675e295 | |
parent | 72b47b902755c77611774e082e1f3f7d66f171f1 (diff) | |
parent | 143f495ab94cb006954c036cf29079cbb49d584b (diff) | |
download | ayatana-indicator-datetime-5e0da43a9b1a98225279161db5b5f574b409736f.tar.gz ayatana-indicator-datetime-5e0da43a9b1a98225279161db5b5f574b409736f.tar.bz2 ayatana-indicator-datetime-5e0da43a9b1a98225279161db5b5f574b409736f.zip |
Update to map to make it lovely and UTC fixes
-rw-r--r-- | data/datetime-dialog.ui | 25 | ||||
-rw-r--r-- | libmap/cc-timezone-map.c | 16 | ||||
-rw-r--r-- | src/datetime-prefs-locations.c | 6 | ||||
-rw-r--r-- | src/timezone-completion.c | 25 |
4 files changed, 58 insertions, 14 deletions
diff --git a/data/datetime-dialog.ui b/data/datetime-dialog.ui index 7545227..ead11d1 100644 --- a/data/datetime-dialog.ui +++ b/data/datetime-dialog.ui @@ -7,11 +7,6 @@ <property name="step_increment">86400</property> <property name="page_increment">864000</property> </object> - <object class="GtkAdjustment" id="timeAdjustment"> - <property name="upper">1.8446744073709552e+19</property> - <property name="step_increment">60</property> - <property name="page_increment">3600</property> - </object> <object class="GtkWindow" id="locationsDialog"> <property name="can_focus">False</property> <property name="title" translatable="yes">Locations</property> @@ -47,6 +42,17 @@ </packing> </child> <child> + <object class="GtkHSeparator" id="hseparator1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> <object class="GtkHBox" id="hbox10"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -55,7 +61,6 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Add a Location…</property> <property name="use_action_appearance">False</property> <child> <object class="GtkImage" id="addImage"> @@ -76,7 +81,6 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Remove This Location</property> <property name="use_action_appearance">False</property> <child> <object class="GtkImage" id="removeImage"> @@ -96,7 +100,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> </object> @@ -112,6 +116,11 @@ <column type="gchararray"/> </columns> </object> + <object class="GtkAdjustment" id="timeAdjustment"> + <property name="upper">1.8446744073709552e+19</property> + <property name="step_increment">60</property> + <property name="page_increment">3600</property> + </object> <object class="GtkWindow" id="timeDateDialog"> <property name="can_focus">False</property> <property name="border_width">5</property> diff --git a/libmap/cc-timezone-map.c b/libmap/cc-timezone-map.c index ec12c84..7b7d704 100644 --- a/libmap/cc-timezone-map.c +++ b/libmap/cc-timezone-map.c @@ -766,13 +766,23 @@ cc_timezone_map_draw (GtkWidget *widget, gchar *file; GError *err = NULL; gdouble pointx, pointy; + gdouble alpha = 1.0; + GtkStyle *style; char buf[16]; gtk_widget_get_allocation (widget, &alloc); + style = gtk_widget_get_style (widget); + + /* Check if insensitive */ + if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) + alpha = 0.5; + /* paint background */ - gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0); + gdk_cairo_set_source_color (cr, &style->bg[gtk_widget_get_state (widget)]); cairo_paint (cr); + gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0); + cairo_paint_with_alpha (cr, alpha); /* paint watermark */ if (priv->watermark) { @@ -813,7 +823,7 @@ cc_timezone_map_draw (GtkWidget *widget, alloc.height, GDK_INTERP_BILINEAR); gdk_cairo_set_source_pixbuf (cr, hilight, 0, 0); - cairo_paint (cr); + cairo_paint_with_alpha (cr, alpha); g_object_unref (hilight); g_object_unref (orig_hilight); } @@ -836,7 +846,7 @@ cc_timezone_map_draw (GtkWidget *widget, if (pin) { gdk_cairo_set_source_pixbuf (cr, pin, pointx - 8, pointy - 14); - cairo_paint (cr); + cairo_paint_with_alpha (cr, alpha); g_object_unref (pin); } 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); |