diff options
-rw-r--r-- | src/datetime-prefs.c | 26 | ||||
-rw-r--r-- | src/indicator-datetime.c | 4 | ||||
-rw-r--r-- | src/timezone-completion.c | 4 |
3 files changed, 22 insertions, 12 deletions
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c index 20f9829..3f5e5e6 100644 --- a/src/datetime-prefs.c +++ b/src/datetime-prefs.c @@ -43,7 +43,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #define DATETIME_DIALOG_UI_FILE PKGDATADIR "/datetime-dialog.ui" GDBusProxy * proxy = NULL; -GtkWidget * autoRadio = NULL; +GtkWidget * auto_radio = NULL; +GtkWidget * tz_entry = NULL; CcTimezoneMap * tzmap = NULL; /* Turns the boolean property into a string gsettings */ @@ -203,15 +204,24 @@ ntp_query_answered (GObject *object, GAsyncResult *res, gpointer user_data) gboolean can_use_ntp, is_using_ntp; g_variant_get (answers, "(bb)", &can_use_ntp, &is_using_ntp); - gtk_widget_set_sensitive (GTK_WIDGET (autoRadio), can_use_ntp); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (autoRadio), is_using_ntp); + gtk_widget_set_sensitive (GTK_WIDGET (auto_radio), can_use_ntp); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (auto_radio), is_using_ntp); - g_signal_connect (autoRadio, "notify::active", G_CALLBACK (toggle_ntp), NULL); + g_signal_connect (auto_radio, "notify::active", G_CALLBACK (toggle_ntp), NULL); g_variant_unref (answers); } static void +sync_entry (const gchar * location) +{ + gchar * name; + split_settings_location (location, NULL, &name); + gtk_entry_set_text (GTK_ENTRY (tz_entry), name); + g_free (name); +} + +static void tz_changed (CcTimezoneMap * map, TzLocation * location) { if (location == NULL) @@ -221,6 +231,8 @@ tz_changed (CcTimezoneMap * map, TzLocation * location) g_dbus_proxy_call (proxy, "SetTimezone", g_variant_new ("(s)", file), G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "timezone"); g_free (file); + + sync_entry (location->zone); } static void @@ -240,6 +252,7 @@ tz_query_answered (GObject *object, GAsyncResult *res, gpointer user_data) cc_timezone_map_set_timezone (tzmap, timezone); + sync_entry (timezone); g_signal_connect (tzmap, "location-changed", G_CALLBACK (tz_changed), NULL); g_variant_unref (answers); @@ -259,7 +272,7 @@ void proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data) /* And now, do initial proxy configuration */ g_dbus_proxy_call (proxy, "GetUsingNtp", NULL, G_DBUS_CALL_FLAGS_NONE, -1, - NULL, ntp_query_answered, autoRadio); + NULL, ntp_query_answered, auto_radio); g_dbus_proxy_call (proxy, "GetTimezone", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, tz_query_answered, NULL); } @@ -543,7 +556,8 @@ create_dialog (void) setup_time_spinner (WIG ("dateSpinner"), WIG ("timeSpinner"), FALSE); GtkWidget * dlg = WIG ("timeDateDialog"); - autoRadio = WIG ("automaticTimeRadio"); + auto_radio = WIG ("automaticTimeRadio"); + tz_entry = WIG ("timezoneEntry"); g_signal_connect (WIG ("locationsButton"), "clicked", G_CALLBACK (show_locations), dlg); diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 33f78c4..2e336c7 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -1176,7 +1176,7 @@ timezone_toggled_cb (GtkCheckMenuItem *checkmenuitem, DbusmenuMenuitem * dbusite } static void -timezone_destroyed_cb (DbusmenuMenuitem * dbusitem, indicator_item_t * mi_data) +timezone_destroyed_cb (indicator_item_t * mi_data, DbusmenuMenuitem * dbusitem) { IndicatorDatetimePrivate *priv = INDICATOR_DATETIME_GET_PRIVATE(mi_data->self); priv->timezone_items = g_list_remove(priv->timezone_items, mi_data); @@ -1241,7 +1241,7 @@ new_timezone_item(DbusmenuMenuitem * newitem, g_signal_connect(G_OBJECT(mi_data->gmi), "toggled", G_CALLBACK(timezone_toggled_cb), newitem); g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(indicator_prop_change_cb), mi_data); - g_signal_connect(G_OBJECT(newitem), "destroyed", G_CALLBACK(timezone_destroyed_cb), mi_data); + g_object_weak_ref(G_OBJECT(newitem), (GWeakNotify)timezone_destroyed_cb, mi_data); return TRUE; } diff --git a/src/timezone-completion.c b/src/timezone-completion.c index a1b4d00..840b3e4 100644 --- a/src/timezone-completion.c +++ b/src/timezone-completion.c @@ -76,7 +76,6 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data) return; } -g_print("got json\n"); GtkListStore * store = GTK_LIST_STORE (gtk_entry_completion_get_model (GTK_ENTRY_COMPLETION (completion))); JsonReader * reader = json_reader_new (json_parser_get_root (JSON_PARSER (object))); @@ -115,7 +114,6 @@ g_print("got json\n"); json_reader_end_member (reader); } -g_print("adding %s\n", name); GtkTreeIter iter; gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, @@ -166,7 +164,6 @@ request_zones (TimezoneCompletion * completion) priv->queued_request = 0; -g_print("requesting json?\n"); if (priv->entry == NULL) { return FALSE; } @@ -185,7 +182,6 @@ g_print("requesting json?\n"); priv->request_text = g_strdup (text); -g_print("requesting json now\n"); gchar * escaped = g_uri_escape_string (text, NULL, FALSE); gchar * url = g_strdup_printf (GEONAME_URL, escaped, "11.04"); |