~muktupavels/gnome-panel/fix-for-lp-1310929-and-lp-1222339

« back to all changes in this revision

Viewing changes to debian/patches/14_revert-timedate-change.patch

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-02-10 14:48:34 UTC
  • Revision ID: package-import@ubuntu.com-20120210144834-dl29m703zbq86h95
Tags: 1:3.3.5-0ubuntu2
* debian/patches/41_classic_layout.patch:
  - Change the defaults to be more "classic Ubuntu": Show indicators
    & show desktop, drop GNOME clock & notification area (LP: #846378)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: gnome-panel-3.3.5/applets/clock/clock.c
2
 
===================================================================
3
 
--- gnome-panel-3.3.5.orig/applets/clock/clock.c        2012-02-02 11:51:27.000000000 -0500
4
 
+++ gnome-panel-3.3.5/applets/clock/clock.c     2012-02-07 22:57:41.193548904 -0500
5
 
@@ -68,6 +68,7 @@
6
 
 #include "clock-location-tile.h"
7
 
 #include "clock-map.h"
8
 
 #include "clock-utils.h"
9
 
+#include "set-timezone.h"
10
 
 #include "system-timezone.h"
11
 
 
12
 
 #define INTERNETSECOND (864)
13
 
Index: gnome-panel-3.3.5/applets/clock/set-timezone.c
14
 
===================================================================
15
 
--- gnome-panel-3.3.5.orig/applets/clock/set-timezone.c 2012-02-02 11:51:54.000000000 -0500
16
 
+++ gnome-panel-3.3.5/applets/clock/set-timezone.c      2012-02-07 22:58:04.109662547 -0500
17
 
@@ -23,17 +23,23 @@
18
 
 #endif
19
 
 
20
 
 #include <gio/gio.h>
21
 
-#include <polkit/polkit.h>
22
 
+#include <stdlib.h>
23
 
+#include <stdio.h>
24
 
+#include <fcntl.h>
25
 
+#include <unistd.h>
26
 
+#include <string.h>
27
 
+#include <sys/wait.h>
28
 
 
29
 
 #include "set-timezone.h"
30
 
 
31
 
 #define CACHE_VALIDITY_SEC 20
32
 
 
33
 
-#define MECHANISM_BUS_NAME    "org.freedesktop.timedate1"
34
 
-#define MECHANISM_OBJECT_PATH "/org/freedesktop/timedate1"
35
 
-#define MECHANISM_INTERFACE   "org.freedesktop.timedate1"
36
 
+#define MECHANISM_BUS_NAME "org.gnome.SettingsDaemon.DateTimeMechanism"
37
 
+#define MECHANISM_OBJECT_PATH "/"
38
 
+#define MECHANISM_INTERFACE "org.gnome.SettingsDaemon.DateTimeMechanism"
39
 
 
40
 
 typedef struct {
41
 
+  gboolean in_progress;
42
 
   gint     value;
43
 
   guint64  stamp;
44
 
 } Cache;
45
 
@@ -59,6 +65,27 @@
46
 
   return system;
47
 
 }
48
 
 
49
 
+static void
50
 
+can_set_call_finished (GObject *source,
51
 
+ GAsyncResult *result,
52
 
+ gpointer user_data)
53
 
+{
54
 
+ Cache *cache = user_data;
55
 
+ GVariant *reply;
56
 
+
57
 
+ reply = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source),
58
 
+ result, NULL);
59
 
+
60
 
+ if (reply != NULL)
61
 
+ {
62
 
+ g_variant_get (reply, "(i)", &cache->value);
63
 
+ g_variant_unref (reply);
64
 
+ }
65
 
+
66
 
+ cache->stamp = g_get_monotonic_time ();
67
 
+ cache->in_progress = FALSE;
68
 
+}
69
 
+
70
 
 static int
71
 
 can_set (Cache *cache, const gchar *method_name)
72
 
 {
73
 
@@ -66,39 +93,23 @@
74
 
 
75
 
   if (now - cache->stamp > (CACHE_VALIDITY_SEC * 1000000))
76
 
     {
77
 
-      PolkitAuthority *authority;
78
 
-      PolkitSubject   *subject;
79
 
-      PolkitAuthorizationResult *res;
80
 
-
81
 
-      authority = polkit_authority_get_sync (NULL, NULL);
82
 
-      subject = polkit_unix_session_new_for_process_sync (getpid (), NULL, NULL);
83
 
-
84
 
-      res = polkit_authority_check_authorization_sync (authority,
85
 
-                                                       subject,
86
 
-                                                       "org.freedesktop.timedate1.set-timezone",
87
 
-                                                       NULL,
88
 
-                                                       POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
89
 
-                                                       NULL,
90
 
-                                                       NULL);
91
 
-
92
 
-       cache->stamp = g_get_monotonic_time ();
93
 
-
94
 
-        if (res == NULL)
95
 
-          cache->value = 0;
96
 
-        else
97
 
-          {
98
 
-            if (polkit_authorization_result_get_is_authorized (res))
99
 
-              cache->value = 2;
100
 
-            else if (polkit_authorization_result_get_is_challenge (res))
101
 
-              cache->value = 1;
102
 
-            else
103
 
-              cache->value = 0;
104
 
-
105
 
-            g_object_unref (res);
106
 
-          }
107
 
-
108
 
-        g_object_unref (authority);
109
 
-        g_object_unref (subject);
110
 
+      if (!cache->in_progress)
111
 
+        {
112
 
+          GDBusConnection *system_bus = get_system_bus (NULL);
113
 
+
114
 
+          if (system_bus != NULL)
115
 
+            g_dbus_connection_call (system_bus, MECHANISM_BUS_NAME,
116
 
+                                   MECHANISM_OBJECT_PATH, MECHANISM_INTERFACE,
117
 
+                                   method_name, NULL, G_VARIANT_TYPE ("(i)"),
118
 
+                                   G_DBUS_CALL_FLAGS_NONE, -1, NULL,
119
 
+                                   can_set_call_finished, cache);
120
 
+
121
 
+          /* Even if the system bus was NULL, we want to set this in
122
 
+           * order to effectively wedge ourselves from ever trying
123
 
+           * again.
124
 
+           */
125
 
+          cache->in_progress = TRUE;
126
 
+        }
127
 
     }
128
 
 
129
 
   return cache->value;
130
 
@@ -159,7 +170,7 @@
131
 
 
132
 
   g_dbus_connection_call (system_bus, MECHANISM_BUS_NAME,
133
 
                           MECHANISM_OBJECT_PATH, MECHANISM_INTERFACE,
134
 
-                          "SetTimezone", g_variant_new ("(sb)", tz, TRUE),
135
 
+                          "SetTimezone", g_variant_new ("(s)", tz, TRUE),
136
 
                           NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL,
137
 
                           callback, user_data);
138
 
 }
139
 
Index: gnome-panel-3.3.5/configure.ac
140
 
===================================================================
141
 
--- gnome-panel-3.3.5.orig/configure.ac 2012-02-06 06:18:37.000000000 -0500
142
 
+++ gnome-panel-3.3.5/configure.ac      2012-02-07 22:57:41.201548946 -0500
143
 
@@ -144,7 +144,7 @@
144
 
 AC_SUBST(TZ_CFLAGS)
145
 
 AC_SUBST(TZ_LIBS)
146
 
 
147
 
-PKG_CHECK_MODULES(CLOCK, pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED $LIBECAL_REQUIREMENT librsvg-2.0 gweather-3.0 >= $GWEATHER_REQUIRED gnome-desktop-3.0 >= $LIBGNOME_DESKTOP_REQUIRED polkit-gobject-1)
148
 
+PKG_CHECK_MODULES(CLOCK, pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED $LIBECAL_REQUIREMENT librsvg-2.0 gweather-3.0 >= $GWEATHER_REQUIRED gnome-desktop-3.0 >= $LIBGNOME_DESKTOP_REQUIRED)
149
 
 AC_SUBST(CLOCK_CFLAGS)
150
 
 AC_SUBST(CLOCK_LIBS)
151