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:
parent
88f4c30c04
commit
c68f9eca50
3 changed files with 24 additions and 3 deletions
|
@ -63,6 +63,9 @@ enum {
|
|||
#define CLOCK_SCHEMA "org.gnome.desktop.interface"
|
||||
#define CLOCK_FORMAT_KEY "clock-format"
|
||||
|
||||
#define DATETIME_SCHEMA "org.gnome.desktop.datetime"
|
||||
#define AUTO_TIMEZONE_KEY "automatic-timezone"
|
||||
|
||||
struct _CcDateTimePanelPrivate
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
|
@ -75,6 +78,7 @@ struct _CcDateTimePanelPrivate
|
|||
GDateTime *date;
|
||||
|
||||
GSettings *clock_settings;
|
||||
GSettings *datetime_settings;
|
||||
GDesktopClockFormat clock_format;
|
||||
gboolean ampm_available;
|
||||
GtkWidget *am_label;
|
||||
|
@ -739,15 +743,17 @@ on_permission_changed (GPermission *permission,
|
|||
gpointer data)
|
||||
{
|
||||
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));
|
||||
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 */
|
||||
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("timezone-button"), allowed);
|
||||
gtk_widget_set_sensitive (W("timezone-button"), allowed && !auto_timezone);
|
||||
|
||||
/* Hide the subdialogs if we no longer have permissions */
|
||||
if (!allowed)
|
||||
|
@ -913,6 +919,10 @@ list_box_row_activated (GtkListBox *listbox,
|
|||
{
|
||||
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")))
|
||||
{
|
||||
/* 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_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 */
|
||||
priv->clock_settings = g_settings_new (CLOCK_SCHEMA);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue