forked from pool/gnome-control-center
bdec9b7c5a
Corrected bug number in changelog. - Remove alacarte from the g-c-c shell for openSUSE while still keeping it for SLE (they use classic gnome, where it still works) - Rebase tz patch and re-enable it to allow tz changing without admin privileges. OBS-URL: https://build.opensuse.org/request/show/349178 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-control-center?expand=0&rev=301
108 lines
4.5 KiB
Diff
108 lines
4.5 KiB
Diff
Index: gnome-control-center-3.18.2/panels/datetime/cc-datetime-panel.c
|
|
===================================================================
|
|
--- gnome-control-center-3.18.2.orig/panels/datetime/cc-datetime-panel.c
|
|
+++ gnome-control-center-3.18.2/panels/datetime/cc-datetime-panel.c
|
|
@@ -59,6 +59,7 @@ enum {
|
|
#define W(x) (GtkWidget*) gtk_builder_get_object (priv->builder, x)
|
|
|
|
#define DATETIME_PERMISSION "org.gnome.controlcenter.datetime.configure"
|
|
+#define DATETIME_TZ_PERMISSION "org.freedesktop.timedate1.set-timezone"
|
|
|
|
#define CLOCK_SCHEMA "org.gnome.desktop.interface"
|
|
#define CLOCK_FORMAT_KEY "clock-format"
|
|
@@ -99,6 +100,7 @@ struct _CcDateTimePanelPrivate
|
|
GCancellable *cancellable;
|
|
|
|
GPermission *permission;
|
|
+ GPermission *tz_permission;
|
|
};
|
|
|
|
static void update_time (CcDateTimePanel *self);
|
|
@@ -133,6 +135,7 @@ cc_date_time_panel_dispose (GObject *obj
|
|
g_clear_object (&priv->clock_tracker);
|
|
g_clear_object (&priv->dtm);
|
|
g_clear_object (&priv->permission);
|
|
+ g_clear_object (&priv->tz_permission);
|
|
g_clear_object (&priv->clock_settings);
|
|
g_clear_object (&priv->datetime_settings);
|
|
g_clear_object (&priv->filechooser_settings);
|
|
@@ -777,24 +780,24 @@ on_permission_changed (GPermission *perm
|
|
gpointer data)
|
|
{
|
|
CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (data)->priv;
|
|
- gboolean allowed, auto_timezone, using_ntp;
|
|
+ gboolean allowed, tz_allowed, auto_timezone, using_ntp;
|
|
|
|
allowed = (priv->permission != NULL && g_permission_get_allowed (priv->permission));
|
|
+ tz_allowed = (priv->tz_permission != NULL && g_permission_get_allowed (priv->tz_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("auto-timezone-row"), allowed || tz_allowed);
|
|
gtk_widget_set_sensitive (W("datetime-button"), allowed && !using_ntp);
|
|
- gtk_widget_set_sensitive (W("timezone-button"), allowed && !auto_timezone);
|
|
+ gtk_widget_set_sensitive (W("timezone-button"), (allowed || tz_allowed) && !auto_timezone);
|
|
|
|
/* Hide the subdialogs if we no longer have permissions */
|
|
if (!allowed)
|
|
- {
|
|
gtk_widget_hide (GTK_WIDGET (W ("datetime-dialog")));
|
|
+ if (!allowed && !tz_allowed)
|
|
gtk_widget_hide (GTK_WIDGET (W ("timezone-dialog")));
|
|
- }
|
|
}
|
|
|
|
static void
|
|
@@ -886,6 +889,25 @@ run_dialog (CcDateTimePanel *self,
|
|
}
|
|
|
|
static gboolean
|
|
+tz_switch_to_row_transform_func (GBinding *binding,
|
|
+ const GValue *source_value,
|
|
+ GValue *target_value,
|
|
+ CcDateTimePanel *self)
|
|
+{
|
|
+ CcDateTimePanelPrivate *priv = self->priv;
|
|
+ gboolean active;
|
|
+ gboolean allowed;
|
|
+
|
|
+ active = g_value_get_boolean (source_value);
|
|
+ allowed = (priv->permission != NULL && g_permission_get_allowed (priv->permission)) ||
|
|
+ (priv->tz_permission != NULL && g_permission_get_allowed (priv->tz_permission));
|
|
+
|
|
+ g_value_set_boolean (target_value, !active && allowed);
|
|
+
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
switch_to_row_transform_func (GBinding *binding,
|
|
const GValue *source_value,
|
|
GValue *target_value,
|
|
@@ -1266,6 +1288,7 @@ cc_date_time_panel_init (CcDateTimePanel
|
|
|
|
/* add the lock button */
|
|
priv->permission = polkit_permission_new_sync (DATETIME_PERMISSION, NULL, NULL, NULL);
|
|
+ priv->tz_permission = polkit_permission_new_sync (DATETIME_TZ_PERMISSION, NULL, NULL, NULL);
|
|
if (priv->permission != NULL)
|
|
{
|
|
g_signal_connect (priv->permission, "notify",
|
|
@@ -1303,9 +1326,11 @@ cc_date_time_panel_init (CcDateTimePanel
|
|
gtk_widget_set_visible (W ("auto-datetime-row"), is_ntp_available (self));
|
|
|
|
/* Timezone settings */
|
|
- bind_switch_to_row (self,
|
|
- W ("auto_timezone_switch"),
|
|
- W ("timezone-button"));
|
|
+ g_object_bind_property_full (W ("auto_timezone_switch"), "active",
|
|
+ W ("timezone-button"), "sensitive",
|
|
+ G_BINDING_SYNC_CREATE,
|
|
+ (GBindingTransformFunc) tz_switch_to_row_transform_func,
|
|
+ NULL, self, NULL);
|
|
|
|
priv->datetime_settings = g_settings_new (DATETIME_SCHEMA);
|
|
g_settings_bind (priv->datetime_settings, AUTO_TIMEZONE_KEY,
|