[gnome-control-center] datetime: Move polkit initialization earlier



commit 853fb8cc9083a20d8505a7caf885dc30d9a1d016
Author: Kalev Lember <kalevlember gmail com>
Date:   Mon Sep 2 00:13:18 2013 +0200

    datetime: Move polkit initialization earlier
    
    ... so that in the following commit, we can rely on the permissions
    being available.
    
    While at this, also create a DATETIME_PERMISSION for the PolicyKit
    action ID at the top of the file.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707252

 panels/datetime/cc-datetime-panel.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index a336ee3..301dd75 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -58,6 +58,8 @@ enum {
 
 #define W(x) (GtkWidget*) gtk_builder_get_object (priv->builder, x)
 
+#define DATETIME_PERMISSION "org.gnome.controlcenter.datetime.configure"
+
 #define CLOCK_SCHEMA "org.gnome.desktop.interface"
 #define CLOCK_FORMAT_KEY "clock-format"
 
@@ -1207,6 +1209,20 @@ cc_date_time_panel_init (CcDateTimePanel *self)
       return;
     }
 
+  /* add the lock button */
+  priv->permission = polkit_permission_new_sync (DATETIME_PERMISSION, NULL, NULL, NULL);
+  if (priv->permission != NULL)
+    {
+      g_signal_connect (priv->permission, "notify",
+                        G_CALLBACK (on_permission_changed), self);
+      on_permission_changed (priv->permission, NULL, self);
+    }
+  else
+    {
+      g_warning ("Your system does not have the '%s' PolicyKit files installed. Please check your 
installation",
+                 DATETIME_PERMISSION);
+    }
+
   priv->date = g_date_time_new_now_local ();
 
   setup_timezone_dialog (self);
@@ -1280,17 +1296,4 @@ cc_date_time_panel_init (CcDateTimePanel *self)
   g_signal_connect_swapped (priv->dtm, "notify::timezone",
                             G_CALLBACK (on_timezone_changed), self);
   /* We ignore UTC <--> LocalRTC changes at the moment */
-
-  /* add the lock button */
-  priv->permission = polkit_permission_new_sync ("org.gnome.controlcenter.datetime.configure", NULL, NULL, 
NULL);
-  if (priv->permission == NULL)
-    {
-      g_warning ("Your system does not have the '%s' PolicyKit files installed. Please check your 
installation",
-                 "org.gnome.controlcenter.datetime.configure");
-      return;
-    }
-
-  g_signal_connect (priv->permission, "notify",
-                    G_CALLBACK (on_permission_changed), self);
-  on_permission_changed (priv->permission, NULL, self);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]