datetime: Show the automatic timezone switch

The backend in gnome-settings-daemon is now functional, so we can expose
the option in the UI.

https://bugzilla.gnome.org/show_bug.cgi?id=707252
This commit is contained in:
Kalev Lember 2013-09-02 00:37:12 +02:00
parent 88f4c30c04
commit c68f9eca50
3 changed files with 24 additions and 3 deletions

View file

@ -95,7 +95,7 @@ NETWORK_MANAGER_APPLET_REQUIRED_VERSION=0.9.7.995
MODEM_MANAGER_REQUIRED_VERSION=0.7 MODEM_MANAGER_REQUIRED_VERSION=0.7
LIBNOTIFY_REQUIRED_VERSION=0.7.3 LIBNOTIFY_REQUIRED_VERSION=0.7.3
GNOME_DESKTOP_REQUIRED_VERSION=3.9.90 GNOME_DESKTOP_REQUIRED_VERSION=3.9.90
SCHEMAS_REQUIRED_VERSION=3.7.2.2 SCHEMAS_REQUIRED_VERSION=3.9.91
LIBWACOM_REQUIRED_VERSION=0.7 LIBWACOM_REQUIRED_VERSION=0.7
CLUTTER_REQUIRED_VERSION=1.11.3 CLUTTER_REQUIRED_VERSION=1.11.3
GOA_REQUIRED_VERSION=3.9.90 GOA_REQUIRED_VERSION=3.9.90

View file

@ -63,6 +63,9 @@ enum {
#define CLOCK_SCHEMA "org.gnome.desktop.interface" #define CLOCK_SCHEMA "org.gnome.desktop.interface"
#define CLOCK_FORMAT_KEY "clock-format" #define CLOCK_FORMAT_KEY "clock-format"
#define DATETIME_SCHEMA "org.gnome.desktop.datetime"
#define AUTO_TIMEZONE_KEY "automatic-timezone"
struct _CcDateTimePanelPrivate struct _CcDateTimePanelPrivate
{ {
GtkBuilder *builder; GtkBuilder *builder;
@ -75,6 +78,7 @@ struct _CcDateTimePanelPrivate
GDateTime *date; GDateTime *date;
GSettings *clock_settings; GSettings *clock_settings;
GSettings *datetime_settings;
GDesktopClockFormat clock_format; GDesktopClockFormat clock_format;
gboolean ampm_available; gboolean ampm_available;
GtkWidget *am_label; GtkWidget *am_label;
@ -739,15 +743,17 @@ on_permission_changed (GPermission *permission,
gpointer data) gpointer data)
{ {
CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (data)->priv; CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (data)->priv;
gboolean allowed, using_ntp; gboolean allowed, auto_timezone, using_ntp;
allowed = (priv->permission == NULL || g_permission_get_allowed (priv->permission)); allowed = (priv->permission == NULL || g_permission_get_allowed (priv->permission));
using_ntp = gtk_switch_get_active (GTK_SWITCH (W("network_time_switch"))); using_ntp = gtk_switch_get_active (GTK_SWITCH (W("network_time_switch")));
auto_timezone = gtk_switch_get_active (GTK_SWITCH (W("auto_timezone_switch")));
/* All the widgets but the lock button and the 24h setting */ /* All the widgets but the lock button and the 24h setting */
gtk_widget_set_sensitive (W("auto-datetime-row"), allowed); gtk_widget_set_sensitive (W("auto-datetime-row"), allowed);
gtk_widget_set_sensitive (W("auto-timezone-row"), allowed);
gtk_widget_set_sensitive (W("datetime-button"), allowed && !using_ntp); gtk_widget_set_sensitive (W("datetime-button"), allowed && !using_ntp);
gtk_widget_set_sensitive (W("timezone-button"), allowed); gtk_widget_set_sensitive (W("timezone-button"), allowed && !auto_timezone);
/* Hide the subdialogs if we no longer have permissions */ /* Hide the subdialogs if we no longer have permissions */
if (!allowed) if (!allowed)
@ -913,6 +919,10 @@ list_box_row_activated (GtkListBox *listbox,
{ {
toggle_switch (W ("network_time_switch")); toggle_switch (W ("network_time_switch"));
} }
else if (!g_strcmp0 (widget_name, "auto-timezone-row"))
{
toggle_switch (W ("auto_timezone_switch"));
}
else if ((found = g_strrstr (widget_name, "button"))) else if ((found = g_strrstr (widget_name, "button")))
{ {
/* replace "button" with "dialog" */ /* replace "button" with "dialog" */
@ -1233,6 +1243,16 @@ cc_date_time_panel_init (CcDateTimePanel *self)
g_signal_connect (W("network_time_switch"), "notify::active", g_signal_connect (W("network_time_switch"), "notify::active",
G_CALLBACK (change_ntp), self); G_CALLBACK (change_ntp), self);
/* Timezone settings */
bind_switch_to_row (self,
W ("auto_timezone_switch"),
W ("timezone-button"));
priv->datetime_settings = g_settings_new (DATETIME_SCHEMA);
g_settings_bind (priv->datetime_settings, AUTO_TIMEZONE_KEY,
W ("auto_timezone_switch"), "active",
G_SETTINGS_BIND_DEFAULT);
/* Clock settings */ /* Clock settings */
priv->clock_settings = g_settings_new (CLOCK_SCHEMA); priv->clock_settings = g_settings_new (CLOCK_SCHEMA);

View file

@ -565,6 +565,7 @@
</child> </child>
<child> <child>
<object class="GtkListBoxRow" id="auto-timezone-row"> <object class="GtkListBoxRow" id="auto-timezone-row">
<property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<child> <child>
<object class="GtkBox" id="box3"> <object class="GtkBox" id="box3">