Bugzilla – Attachment 519087 Details for
Bug 796055
GNOME Control Center NTP integration broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
[patch]
Rebase finegrained timezone permissions patch
gnome-control-center-fine-grained-tz-polkit.patch (text/plain), 3.75 KB, created by
Michael Catanzaro
on 2013-01-07 03:39:53 UTC
(
hide
)
Description:
Rebase finegrained timezone permissions patch
Filename:
MIME Type:
Creator:
Michael Catanzaro
Created:
2013-01-07 03:39:53 UTC
Size:
3.75 KB
patch
obsolete
>From 24e633505ba76e1726eb56c7ccb9c6be13d21216 Mon Sep 17 00:00:00 2001 >From: Michael Catanzaro <mike.catanzaro@gmail.com> >Date: Sun, 6 Jan 2013 18:43:18 -0600 >Subject: [PATCH] Use fine-grained timezone permissions > >This is the same as Vincent's patch, except applied on top of the >gnome-settings-daemon logic instead of the timedated logic. We'll >reuse the timedate1 permission since that will still be installed. > >Vincent's original note: > >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. >--- > panels/datetime/cc-datetime-panel.c | 37 +++++++++++++++++++++++++++++++++-- > 1 file changed, 35 insertions(+), 2 deletions(-) > >diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c >index 7e3e909..7940691 100644 >--- a/panels/datetime/cc-datetime-panel.c >+++ b/panels/datetime/cc-datetime-panel.c >@@ -86,6 +86,7 @@ struct _CcDateTimePanelPrivate > GCancellable *cancellable; > > GPermission *permission; >+ GPermission *permission_tz; > }; > > static void update_time (CcDateTimePanel *self); >@@ -164,6 +165,12 @@ cc_date_time_panel_dispose (GObject *object) > 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); > } > >@@ -821,19 +828,33 @@ on_permission_changed (GPermission *permission, > 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); > gtk_widget_set_sensitive (W("table1"), allowed && !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 > reorder_date_widget (DateEndianess endianess, > CcDateTimePanelPrivate *priv) > { >@@ -1037,6 +1058,18 @@ cc_date_time_panel_init (CcDateTimePanel *self) > 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); > } > > void >-- >1.7.10.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 796055
:
519085
|
519086
| 519087