[gnome-initial-setup] timezone: Remove geoclue integration... for now...
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] timezone: Remove geoclue integration... for now...
- Date: Fri, 1 Nov 2013 16:29:56 +0000 (UTC)
commit b7dca1d7ed9b03154462b8a56cb6517b2d705185
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Nov 1 02:09:58 2013 -0400
timezone: Remove geoclue integration... for now...
I think we'll add this back when gnome-settings-daemon provides
information about what timezone it picked automatically for us.
.../pages/timezone/gis-timezone-page.c | 163 +-------------------
.../pages/timezone/gis-timezone-page.ui | 49 +------
2 files changed, 3 insertions(+), 209 deletions(-)
---
diff --git a/gnome-initial-setup/pages/timezone/gis-timezone-page.c
b/gnome-initial-setup/pages/timezone/gis-timezone-page.c
index 749e8aa..1ce134f 100644
--- a/gnome-initial-setup/pages/timezone/gis-timezone-page.c
+++ b/gnome-initial-setup/pages/timezone/gis-timezone-page.c
@@ -49,13 +49,9 @@
struct _GisTimezonePagePrivate
{
GtkWidget *map;
- GtkWidget *stack;
- GtkWidget *auto_result;
- GtkWidget *search_button;
GtkWidget *search_entry;
GtkWidget *search_overlay;
- GWeatherLocation *auto_location;
GWeatherLocation *current_location;
Timedate1 *dtm;
};
@@ -125,133 +121,6 @@ set_location (GisTimezonePage *page,
}
}
-static char *
-get_location_name (GWeatherLocation *location)
-{
- GWeatherTimezone *zone = gweather_location_get_timezone (location);
-
- /* XXX -- do something smarter eventually */
- return g_strdup_printf ("%s (GMT%+g)",
- gweather_location_get_name (location),
- gweather_timezone_get_offset (zone) / 60.0);
-}
-
-static void
-set_auto_location (GisTimezonePage *page,
- GWeatherLocation *location)
-{
- GisTimezonePagePrivate *priv = gis_timezone_page_get_instance_private (page);
-
- if (priv->auto_location)
- gweather_location_unref (priv->auto_location);
-
- if (location)
- {
- char *tzname, *markup;
- priv->auto_location = gweather_location_ref (location);
-
- tzname = get_location_name (location);
- markup = g_strdup_printf (_("We think that your time zone is <b>%s</b>. Press Next to continue"
- " or search for a city to manually set the time zone."),
- tzname);
- gtk_label_set_markup (GTK_LABEL (priv->auto_result), markup);
- g_free (tzname);
- g_free (markup);
- }
- else
- {
- priv->auto_location = NULL;
-
- /* We have no automatic location; transition to search automatically */
- gtk_widget_hide (priv->search_button);
- gtk_widget_hide (priv->auto_result);
- }
-
- gtk_widget_show (priv->stack);
-}
-
-static void
-get_location_from_geoclue (GisTimezonePage *page)
-{
- GDBusProxy *manager = NULL, *client = NULL, *location = NULL;
- GVariant *value;
- const char *object_path;
- double latitude, longitude;
- GWeatherLocation *glocation = NULL;
-
- manager = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.GeoClue2",
- "/org/freedesktop/GeoClue2/Manager",
- "org.freedesktop.GeoClue2.Manager",
- NULL, NULL);
- if (!manager)
- goto out;
-
- value = g_dbus_proxy_call_sync (manager, "GetClient", NULL,
- G_DBUS_CALL_FLAGS_NONE, -1,
- NULL, NULL);
- if (!value)
- goto out;
-
- g_variant_get_child (value, 0, "&o", &object_path);
-
- client = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.GeoClue2",
- object_path,
- "org.freedesktop.GeoClue2.Client",
- NULL, NULL);
- g_variant_unref (value);
-
- if (!client)
- goto out;
-
- value = g_dbus_proxy_get_cached_property (client, "Location");
- object_path = g_variant_get_string (value, NULL);
-
- location = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.GeoClue2",
- object_path,
- "org.freedesktop.GeoClue2.Location",
- NULL, NULL);
- g_variant_unref (value);
-
- if (!location)
- goto out;
-
- value = g_dbus_proxy_get_cached_property (location, "Latitude");
-
- /* this happens under some circumstances, iunno why. needs zeenix */
- if (!value)
- goto out;
-
- latitude = g_variant_get_double (value);
- g_variant_unref (value);
- value = g_dbus_proxy_get_cached_property (location, "Longitude");
- longitude = g_variant_get_double (value);
- g_variant_unref (value);
-
- glocation = gweather_location_find_nearest_city (NULL, latitude, longitude);
-
- out:
- set_auto_location (page, glocation);
- set_location (page, glocation);
- if (glocation)
- gweather_location_unref (glocation);
-
- if (manager)
- g_object_unref (manager);
- if (client)
- g_object_unref (client);
- if (location)
- g_object_unref (location);
-}
-
static void
entry_location_changed (GObject *object, GParamSpec *param, GisTimezonePage *page)
{
@@ -273,29 +142,6 @@ entry_mapped (GtkWidget *widget,
}
static void
-visible_child_changed (GObject *object, GParamSpec *param, GisTimezonePage *page)
-{
- /* xxx -- text bubble */
- /*
- GtkWidget *child = gtk_stack_get_visible_child (GTK_STACK (WID ("timezone-stack")));
-
- if (child == WID ("timezone-search")) {
- }
- */
-}
-
-static void
-search_button_toggled (GtkToggleButton *button,
- GisTimezonePage *page)
-{
- GisTimezonePagePrivate *priv = gis_timezone_page_get_instance_private (page);
- gboolean want_search = gtk_toggle_button_get_active (button);
-
- gtk_stack_set_visible_child_name (GTK_STACK (priv->stack),
- want_search ? "search" : "status");
-}
-
-static void
gis_timezone_page_constructed (GObject *object)
{
GisTimezonePage *page = GIS_TIMEZONE_PAGE (object);
@@ -316,16 +162,12 @@ gis_timezone_page_constructed (GObject *object)
exit (1);
}
- get_location_from_geoclue (page);
+ set_location (page, NULL);
g_signal_connect (priv->search_entry, "notify::location",
G_CALLBACK (entry_location_changed), page);
g_signal_connect (priv->search_entry, "map",
G_CALLBACK (entry_mapped), page);
- g_signal_connect (priv->stack, "notify::visible-child",
- G_CALLBACK (visible_child_changed), page);
- g_signal_connect (priv->search_button, "toggled",
- G_CALLBACK (search_button_toggled), page);
gtk_widget_show (GTK_WIDGET (page));
}
@@ -356,9 +198,6 @@ gis_timezone_page_class_init (GisTimezonePageClass *klass)
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
"/org/gnome/initial-setup/gis-timezone-page.ui");
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisTimezonePage, map);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisTimezonePage, stack);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisTimezonePage, auto_result);
- gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisTimezonePage, search_button);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisTimezonePage, search_entry);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisTimezonePage, search_overlay);
diff --git a/gnome-initial-setup/pages/timezone/gis-timezone-page.ui
b/gnome-initial-setup/pages/timezone/gis-timezone-page.ui
index 3ce3d35..57365a4 100644
--- a/gnome-initial-setup/pages/timezone/gis-timezone-page.ui
+++ b/gnome-initial-setup/pages/timezone/gis-timezone-page.ui
@@ -32,54 +32,9 @@
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
- <object class="GtkBox" id="status_box">
+ <object class="GWeatherLocationEntry" id="search_entry">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">8</property>
- <child>
- <object class="GtkStack" id="stack">
- <property name="transition-type">crossfade</property>
- <child>
- <object class="GtkLabel" id="auto_result">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="wrap">True</property>
- </object>
- <packing>
- <property name="name">status</property>
- </packing>
- </child>
- <child>
- <object class="GWeatherLocationEntry" id="search_entry">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- </object>
- <packing>
- <property name="name">search</property>
- </packing>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkToggleButton" id="search_button">
- <property name="width_request">32</property>
- <property name="height_request">32</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <child>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="pixel_size">16</property>
- <property name="icon_name">edit-find-symbolic</property>
- <property name="icon_size">0</property>
- </object>
- </child>
- </object>
- </child>
+ <property name="hexpand">True</property>
</object>
</child>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]