aboutsummaryrefslogtreecommitdiff
path: root/src/datetime-prefs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/datetime-prefs.c')
-rw-r--r--src/datetime-prefs.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index 1b7ddd2..9fdfbed 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -34,13 +34,13 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <gtk/gtk.h>
#include <polkit/polkit.h>
#include <libgnome-control-center/cc-panel.h>
+#include <timezonemap/cc-timezone-map.h>
+#include <timezonemap/timezone-completion.h>
#include "dbus-shared.h"
#include "settings-shared.h"
#include "utils.h"
#include "datetime-prefs-locations.h"
-#include "timezone-completion.h"
-#include "cc-timezone-map.h"
#define DATETIME_DIALOG_UI_FILE PKGDATADIR "/datetime-dialog.ui"
@@ -69,7 +69,7 @@ struct _IndicatorDatetimePanelPrivate
gboolean user_edited_time;
gboolean changing_time;
GtkWidget * loc_dlg;
- TimezoneCompletion * completion;
+ CcTimezoneCompletion * completion;
};
struct _IndicatorDatetimePanelClass
@@ -243,15 +243,20 @@ sync_entry (IndicatorDatetimePanel * self, const gchar * location)
}
static void
-tz_changed (CcTimezoneMap * map, TzLocation * location, IndicatorDatetimePanel * self)
+tz_changed (CcTimezoneMap * map, CcTimezoneLocation * location, IndicatorDatetimePanel * self)
{
if (location == NULL)
return;
- g_dbus_proxy_call (self->priv->proxy, "SetTimezone", g_variant_new ("(s)", location->zone),
+ gchar * zone;
+ g_object_get (location, "zone", &zone, NULL);
+
+ g_dbus_proxy_call (self->priv->proxy, "SetTimezone", g_variant_new ("(s)", zone),
G_DBUS_CALL_FLAGS_NONE, -1, NULL, dbus_set_answered, "timezone");
- sync_entry (self, location->zone);
+ sync_entry (self, zone);
+
+ g_free (zone);
}
static void
@@ -585,8 +590,8 @@ timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model,
const gchar * name, * zone;
gtk_tree_model_get (model, iter,
- TIMEZONE_COMPLETION_NAME, &name,
- TIMEZONE_COMPLETION_ZONE, &zone,
+ CC_TIMEZONE_COMPLETION_NAME, &name,
+ CC_TIMEZONE_COMPLETION_ZONE, &zone,
-1);
if (zone == NULL || zone[0] == 0) {
@@ -594,8 +599,8 @@ timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model,
gdouble lon = 0.0, lat = 0.0;
gtk_tree_model_get (model, iter,
- TIMEZONE_COMPLETION_LONGITUDE, &strlon,
- TIMEZONE_COMPLETION_LATITUDE, &strlat,
+ CC_TIMEZONE_COMPLETION_LONGITUDE, &strlon,
+ CC_TIMEZONE_COMPLETION_LATITUDE, &strlat,
-1);
if (strlon != NULL && strlon[0] != 0) {
@@ -626,13 +631,17 @@ entry_focus_out (GtkEntry * entry, GdkEventFocus * event, IndicatorDatetimePanel
// If the name left in the entry doesn't match the current timezone name,
// show an error icon. It's always an error for the user to manually type in
// a timezone.
- TzLocation * location = cc_timezone_map_get_location (self->priv->tzmap);
+ CcTimezoneLocation * location = cc_timezone_map_get_location (self->priv->tzmap);
if (location == NULL)
return FALSE;
- gchar * name = get_current_zone_name (location->zone);
+ gchar * zone;
+ g_object_get (location, "zone", &zone, NULL);
+
+ gchar * name = get_current_zone_name (zone);
gboolean correct = (g_strcmp0 (gtk_entry_get_text (entry), name) == 0);
g_free (name);
+ g_free (zone);
gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_SECONDARY,
correct ? NULL : GTK_STOCK_DIALOG_ERROR);
@@ -685,8 +694,8 @@ indicator_datetime_panel_init (IndicatorDatetimePanel * self)
cc_timezone_map_set_watermark (self->priv->tzmap, "Geonames.org");
/* And completion entry */
- self->priv->completion = timezone_completion_new ();
- timezone_completion_watch_entry (self->priv->completion, GTK_ENTRY (WIG ("timezoneEntry")));
+ self->priv->completion = cc_timezone_completion_new ();
+ cc_timezone_completion_watch_entry (self->priv->completion, GTK_ENTRY (WIG ("timezoneEntry")));
g_signal_connect (self->priv->completion, "match-selected", G_CALLBACK (timezone_selected), self);
g_signal_connect (WIG ("timezoneEntry"), "focus-out-event", G_CALLBACK (entry_focus_out), self);
@@ -789,7 +798,7 @@ indicator_datetime_panel_dispose (GObject * object)
}
if (self->priv->completion) {
- timezone_completion_watch_entry (self->priv->completion, NULL);
+ cc_timezone_completion_watch_entry (self->priv->completion, NULL);
g_object_unref (self->priv->completion);
self->priv->completion = NULL;
}