forked from pool/gnome-control-center
Dominique Leuenberger
d3f31ae0b0
Resubmit, with g-c-c-allow-yast rebased OBS-URL: https://build.opensuse.org/request/show/159240 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-control-center?expand=0&rev=178
96 lines
3.5 KiB
Diff
96 lines
3.5 KiB
Diff
commit 4300867b7bfc4f67a0e8b273aa7d2d13973ea7ac
|
|
Author: Vincent Untz <vuntz@gnome.org>
|
|
Date: Mon Mar 12 15:31:40 2012 +0100
|
|
|
|
datetime: Allow changing timezone without auth if action is allowed
|
|
|
|
As changing the time can have security implications, while changing the
|
|
timezone doesn't, it's not unusual to have a setup where
|
|
org.freedesktop.timedate1.set-timezone is allowed while other
|
|
time-related actions aren't.
|
|
|
|
Therefore, if org.freedesktop.timedate1.set-timezone is allowed, there's
|
|
no reason to require that the user unlocks the panel to enable him to
|
|
change the timezone.
|
|
|
|
https://bugzilla.gnome.org/show_bug.cgi?id=646185
|
|
|
|
Index: gnome-control-center-3.7.3/panels/datetime/cc-datetime-panel.c
|
|
===================================================================
|
|
--- gnome-control-center-3.7.3.orig/panels/datetime/cc-datetime-panel.c
|
|
+++ gnome-control-center-3.7.3/panels/datetime/cc-datetime-panel.c
|
|
@@ -88,6 +88,7 @@ struct _CcDateTimePanelPrivate
|
|
GCancellable *cancellable;
|
|
|
|
GPermission *permission;
|
|
+ GPermission *permission_tz;
|
|
};
|
|
|
|
static void update_time (CcDateTimePanel *self);
|
|
@@ -166,6 +167,12 @@ cc_date_time_panel_dispose (GObject *obj
|
|
priv->permission = NULL;
|
|
}
|
|
|
|
+ if (priv->permission_tz)
|
|
+ {
|
|
+ g_object_unref (priv->permission_tz);
|
|
+ priv->permission_tz = NULL;
|
|
+ }
|
|
+
|
|
G_OBJECT_CLASS (cc_date_time_panel_parent_class)->dispose (object);
|
|
}
|
|
|
|
@@ -818,19 +825,33 @@ on_permission_changed (GPermission *perm
|
|
gpointer data)
|
|
{
|
|
CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (data)->priv;
|
|
- gboolean allowed, using_ntp;
|
|
+ gboolean allowed, allowed_tz, using_ntp;
|
|
|
|
allowed = g_permission_get_allowed (permission);
|
|
+ allowed_tz = priv->permission_tz && g_permission_get_allowed (priv->permission_tz);
|
|
using_ntp = gtk_switch_get_active (GTK_SWITCH (W("network_time_switch")));
|
|
|
|
/* All the widgets but the lock button and the 24h setting */
|
|
- gtk_widget_set_sensitive (W("map-vbox"), allowed);
|
|
+ gtk_widget_set_sensitive (W("map-vbox"), allowed || allowed_tz);
|
|
gtk_widget_set_sensitive (W("hbox2"), allowed);
|
|
gtk_widget_set_sensitive (W("alignment2"), allowed);
|
|
update_widget_state_for_ntp (data, using_ntp);
|
|
}
|
|
|
|
static void
|
|
+on_permission_tz_changed (GPermission *permission,
|
|
+ GParamSpec *pspec,
|
|
+ gpointer data)
|
|
+{
|
|
+ CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (data)->priv;
|
|
+ gboolean allowed;
|
|
+
|
|
+ allowed = g_permission_get_allowed (permission) || g_permission_get_allowed (priv->permission);
|
|
+
|
|
+ gtk_widget_set_sensitive (W("map-vbox"), allowed);
|
|
+}
|
|
+
|
|
+static void
|
|
update_ntp_switch_from_system (CcDateTimePanel *self)
|
|
{
|
|
CcDateTimePanelPrivate *priv = self->priv;
|
|
@@ -1134,4 +1155,16 @@ cc_date_time_panel_init (CcDateTimePanel
|
|
g_signal_connect (priv->permission, "notify",
|
|
G_CALLBACK (on_permission_changed), self);
|
|
on_permission_changed (priv->permission, NULL, self);
|
|
+
|
|
+ priv->permission_tz = polkit_permission_new_sync ("org.freedesktop.timedate1.set-timezone", NULL, NULL, NULL);
|
|
+ if (priv->permission_tz == NULL)
|
|
+ {
|
|
+ g_warning ("Your system does not have the '%s' PolicyKit files installed. Please check your installation",
|
|
+ "org.freedesktop.timedate1.set-timezone");
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ g_signal_connect (priv->permission_tz, "notify",
|
|
+ G_CALLBACK (on_permission_tz_changed), self);
|
|
+ on_permission_tz_changed (priv->permission_tz, NULL, self);
|
|
}
|