Add notification-daemon to deps, required by gnome-fallback.session
[git/cygwin-packages/gnome-session.git] / 3.0.1-upower.patch
CommitLineData
450d5fdf
YS
1--- origsrc/gnome-session-3.0.1/configure.ac 2011-04-04 16:15:41.000000000 -0500
2+++ src/gnome-session-3.0.1/configure.ac 2011-05-13 16:46:12.842482800 -0500
3@@ -56,10 +56,19 @@ PKG_CHECK_MODULES(GNOME_SESSION,
7452dfe5 4 gio-2.0 >= $GLIB_REQUIRED
450d5fdf 5 gtk+-3.0 >= $GTK3_REQUIRED
7452dfe5
YS
6 dbus-glib-1 >= $DBUS_GLIB_REQUIRED
7- upower-glib >= $UPOWER_REQUIRED
450d5fdf 8 librsvg-2.0
7452dfe5
YS
9 )
10
11+PKG_CHECK_MODULES(UPOWER,
12+ upower-glib >= $UPOWER_REQUIRED,
13+ have_upower=true,
450d5fdf
YS
14+ have_upower=false
15+)
7452dfe5
YS
16+
17+if test "$have_upower" = true; then
18+ AC_DEFINE(WITH_UPOWER, 1, [Set to 1 if upower-glib is available.])
19+fi
20+
21 PKG_CHECK_MODULES(SESSION_PROPERTIES,
22 glib-2.0 >= $GLIB_REQUIRED
450d5fdf
YS
23 gtk+-3.0 >= $GTK3_REQUIRED
24--- origsrc/gnome-session-3.0.1/gnome-session/gsm-logout-dialog.c 2011-03-22 15:31:43.000000000 -0500
25+++ src/gnome-session-3.0.1/gnome-session/gsm-logout-dialog.c 2011-05-13 16:48:12.608396400 -0500
7452dfe5
YS
26@@ -27,7 +27,9 @@
27 #include <glib/gi18n.h>
28 #include <gtk/gtk.h>
29
30+#ifdef WITH_UPOWER
31 #include <upower.h>
32+#endif
33
34 #include "gsm-logout-dialog.h"
35 #include "gsm-consolekit.h"
450d5fdf 36@@ -52,7 +54,9 @@ struct _GsmLogoutDialogPrivate
7452dfe5
YS
37 {
38 GsmDialogLogoutType type;
39
40+#ifdef WITH_UPOWER
41 UpClient *up_client;
42+#endif
43 GsmConsolekit *consolekit;
44
45 int timeout;
450d5fdf 46@@ -144,7 +148,9 @@ gsm_logout_dialog_init (GsmLogoutDialog
7452dfe5
YS
47 gtk_window_set_keep_above (GTK_WINDOW (logout_dialog), TRUE);
48 gtk_window_stick (GTK_WINDOW (logout_dialog));
49
50+#ifdef WITH_UPOWER
51 logout_dialog->priv->up_client = up_client_new ();
52+#endif
53
54 logout_dialog->priv->consolekit = gsm_get_consolekit ();
55
450d5fdf 56@@ -168,10 +174,12 @@ gsm_logout_dialog_destroy (GsmLogoutDial
7452dfe5
YS
57 logout_dialog->priv->timeout_id = 0;
58 }
59
60+#ifdef WITH_UPOWER
61 if (logout_dialog->priv->up_client) {
62 g_object_unref (logout_dialog->priv->up_client);
63 logout_dialog->priv->up_client = NULL;
64 }
65+#endif
66
67 if (logout_dialog->priv->consolekit) {
68 g_object_unref (logout_dialog->priv->consolekit);
450d5fdf 69@@ -184,13 +192,21 @@ gsm_logout_dialog_destroy (GsmLogoutDial
7452dfe5
YS
70 static gboolean
71 gsm_logout_supports_system_suspend (GsmLogoutDialog *logout_dialog)
72 {
73+#ifdef WITH_UPOWER
74 return up_client_get_can_suspend (logout_dialog->priv->up_client);
75+#else
76+ return FALSE;
77+#endif
78 }
79
80 static gboolean
81 gsm_logout_supports_system_hibernate (GsmLogoutDialog *logout_dialog)
82 {
83+#ifdef WITH_UPOWER
84 return up_client_get_can_hibernate (logout_dialog->priv->up_client);
85+#else
86+ return FALSE;
87+#endif
88 }
89
90 static gboolean
450d5fdf
YS
91--- origsrc/gnome-session-3.0.1/gnome-session/gsm-manager.c 2011-03-30 02:47:33.000000000 -0500
92+++ src/gnome-session-3.0.1/gnome-session/gsm-manager.c 2011-05-13 16:53:38.163147400 -0500
93@@ -39,7 +39,9 @@
7452dfe5 94 #include <dbus/dbus-glib-lowlevel.h>
450d5fdf 95 #include <librsvg/rsvg.h>
7452dfe5
YS
96
97+#ifdef WITH_UPOWER
98 #include <upower.h>
99+#endif
100
101 #include <gtk/gtk.h> /* for logout dialog */
450d5fdf
YS
102
103@@ -153,8 +155,10 @@ struct GsmManagerPrivate
7452dfe5
YS
104 DBusGProxy *bus_proxy;
105 DBusGConnection *connection;
106
107+#ifdef WITH_UPOWER
108 /* Interface with other parts of the system */
109 UpClient *up_client;
110+#endif
7452dfe5 111
450d5fdf
YS
112 GsmShell *shell;
113 guint shell_end_session_dialog_canceled_id;
114@@ -1096,6 +1100,7 @@ manager_perhaps_lock (GsmManager *manage
7452dfe5
YS
115 static void
116 manager_attempt_hibernate (GsmManager *manager)
117 {
118+#ifdef WITH_UPOWER
119 gboolean can_hibernate;
120 GError *error;
121 gboolean ret;
450d5fdf 122@@ -1114,11 +1119,13 @@ manager_attempt_hibernate (GsmManager *m
7452dfe5
YS
123 g_error_free (error);
124 }
125 }
126+#endif
127 }
128
129 static void
130 manager_attempt_suspend (GsmManager *manager)
131 {
132+#ifdef WITH_UPOWER
133 gboolean can_suspend;
134 GError *error;
135 gboolean ret;
450d5fdf 136@@ -1137,6 +1144,7 @@ manager_attempt_suspend (GsmManager *man
7452dfe5
YS
137 g_error_free (error);
138 }
139 }
140+#endif
141 }
142
143 static void
450d5fdf
YS
144@@ -2519,10 +2527,12 @@ gsm_manager_dispose (GObject *object)
145 manager->priv->lockdown_settings = NULL;
7452dfe5
YS
146 }
147
148+#ifdef WITH_UPOWER
149 if (manager->priv->up_client != NULL) {
150 g_object_unref (manager->priv->up_client);
151 manager->priv->up_client = NULL;
152 }
153+#endif
154
450d5fdf
YS
155 if (manager->priv->shell != NULL) {
156 g_object_unref (manager->priv->shell);
157@@ -2728,7 +2738,9 @@ gsm_manager_init (GsmManager *manager)
158 NULL,
159 NULL, NULL);
7452dfe5
YS
160
161+#ifdef WITH_UPOWER
162 manager->priv->up_client = up_client_new ();
163+#endif
164
450d5fdf
YS
165 manager->priv->shell = gsm_get_shell ();
166 }
167@@ -3329,13 +3341,15 @@ gsm_manager_can_shutdown (GsmManager *ma
168 GError **error)
169 {
170 GsmConsolekit *consolekit;
171- gboolean can_suspend;
172- gboolean can_hibernate;
173+ gboolean can_suspend = FALSE;
174+ gboolean can_hibernate = FALSE;
7452dfe5
YS
175
176+#ifdef WITH_UPOWER
177 g_object_get (manager->priv->up_client,
178 "can-suspend", &can_suspend,
179 "can-hibernate", &can_hibernate,
180 NULL);
7452dfe5
YS
181+#endif
182
183 g_debug ("GsmManager: CanShutdown called");
184
This page took 0.036912 seconds and 5 git commands to generate.