1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
From e43385126cf6f5187f98f940b8c04c3e99202b0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <ballogyor@gmail.com>
Date: Thu, 28 Feb 2013 05:45:12 +0100
Subject: [PATCH 1/4] Fix crashing and compatibility with gnome-screensaver's
D-Bus interface
---
src/cinnamon-screensaver-command.c | 4 ++--
src/gs-listener-dbus.c | 10 ++++++++--
src/gs-manager.c | 14 +++++++++++---
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/cinnamon-screensaver-command.c b/src/cinnamon-screensaver-command.c
index 4267bd0..5c90916 100644
--- a/src/cinnamon-screensaver-command.c
+++ b/src/cinnamon-screensaver-command.c
@@ -311,11 +311,11 @@
if (do_lock) {
if (g_strcmp0 (away_message, "DEFAULT") == 0) {
- reply = screensaver_send_message_string (connection, "Lock", away_message);
+ reply = screensaver_send_message_string (connection, "LockMessage", away_message);
}
else {
gchar * custom_message = g_strdup_printf("CUSTOM###%s", away_message);
- reply = screensaver_send_message_string (connection, "Lock", custom_message);
+ reply = screensaver_send_message_string (connection, "LockMessage", custom_message);
g_free (custom_message);
}
if (reply == NULL) {
diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c
index 2a98aee..6dbf12d 100644
--- a/src/gs-listener-dbus.c
+++ b/src/gs-listener-dbus.c
@@ -653,6 +653,8 @@ enum {
xml = g_string_append (xml,
" <interface name=\""GS_INTERFACE"\">\n"
" <method name=\"Lock\">\n"
+ " </method>\n"
+ " <method name=\"LockMessage\">\n"
" <arg name=\"body\" direction=\"in\" type=\"s\"/>\n"
" </method>\n"
" <method name=\"SimulateUserActivity\">\n"
@@ -744,6 +746,10 @@ enum {
g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
if (dbus_message_is_method_call (message, GS_SERVICE, "Lock")) {
+ g_signal_emit (listener, signals [LOCK], 0);
+ return send_success_reply (connection, message);
+ }
+ if (dbus_message_is_method_call (message, GS_SERVICE, "LockMessage")) {
return listener_lock (listener, connection, message);
}
if (dbus_message_is_method_call (message, GS_SERVICE, "Quit")) {
@@ -906,7 +912,7 @@ enum {
} else if (dbus_message_is_signal (message, SYSTEMD_LOGIND_SESSION_INTERFACE, "Lock")) {
if (_listener_message_path_is_our_session (listener, message)) {
gs_debug ("systemd requested session lock");
- return listener_lock (listener, connection, message);
+ g_signal_emit (listener, signals [LOCK], 0);
}
return DBUS_HANDLER_RESULT_HANDLED;
@@ -948,7 +954,7 @@ enum {
} else if (dbus_message_is_signal (message, CK_SESSION_INTERFACE, "Lock")) {
if (_listener_message_path_is_our_session (listener, message)) {
gs_debug ("ConsoleKit requested session lock");
- return listener_lock (listener, connection, message);
+ g_signal_emit (listener, signals [LOCK], 0);
}
return DBUS_HANDLER_RESULT_HANDLED;
diff --git a/src/gs-manager.c b/src/gs-manager.c
index 1544921..bc09cb9 100644
--- a/src/gs-manager.c
+++ b/src/gs-manager.c
@@ -1275,10 +1275,18 @@ enum {
gs_manager_set_away_message (GSManager *manager,
const char *message)
{
- g_free (manager->priv->logout_command);
-
- manager->priv->away_message = g_strdup(message);
GSList *l;
+
+ g_return_if_fail (GS_IS_MANAGER (manager));
+
+ g_free (manager->priv->away_message);
+
+ if (message) {
+ manager->priv->away_message = g_strdup (message);
+ } else {
+ manager->priv->away_message = NULL;
+ }
+
for (l = manager->priv->windows; l; l = l->next) {
gs_window_set_away_message (l->data, manager->priv->away_message);
}
--
1.8.1.6
From 4db01451afbb246213f483805f81a77c4c7371a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <ballogyor@gmail.com>
Date: Fri, 1 Mar 2013 05:17:46 +0100
Subject: [PATCH 2/4] Update dbus document with the new LockMessage method
---
doc/dbus-interface.html | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/doc/dbus-interface.html b/doc/dbus-interface.html
index faff26c..c9f95ba 100644
--- a/doc/dbus-interface.html
+++ b/doc/dbus-interface.html
@@ -2,6 +2,8 @@
<code class="email"><<a class="email" href="mailto:mccann@jhu.edu">mccann@jhu.edu</a>></code><br>
</p></div></div></div></div></div><div><p class="releaseinfo">Version 1.7.1</p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="#dbus-interface">1. DBUS Interface</a></span></dt><dd><dl><dt><span class="sect1"><a href="#gs-intro">Introduction</a></span></dt><dt><span class="sect1"><a href="#gs-methods">Methods</a></span></dt><dd><dl><dt><span class="sect2"><a href="#gs-method-Lock">
<code class="literal">Lock</code>
+ </a></span></dt><dt><span class="sect2"><a href="#gs-method-LockMessage">
+ <code class="literal">LockMessage</code>
</a></span></dt><dt><span class="sect2"><a href="#gs-method-Cycle">
<code class="literal">Cycle</code>
</a></span></dt><dt><span class="sect2"><a href="#gs-method-SimulateUserActivity">
@@ -30,6 +32,8 @@
<code class="literal">AuthenticationRequestEnd</code>
</a></span></dt></dl></dd><dt><span class="sect1"><a href="#gs-examples">Examples</a></span></dt></dl></dd></dl></div><div class="chapter" title="Chapter 1. DBUS Interface"><div class="titlepage"><div><div><h2 class="title"><a name="dbus-interface"></a>Chapter 1. DBUS Interface</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#gs-intro">Introduction</a></span></dt><dt><span class="sect1"><a href="#gs-methods">Methods</a></span></dt><dd><dl><dt><span class="sect2"><a href="#gs-method-Lock">
<code class="literal">Lock</code>
+ </a></span></dt><dt><span class="sect2"><a href="#gs-method-LockMessage">
+ <code class="literal">LockMessage</code>
</a></span></dt><dt><span class="sect2"><a href="#gs-method-Cycle">
<code class="literal">Cycle</code>
</a></span></dt><dt><span class="sect2"><a href="#gs-method-SimulateUserActivity">
@@ -70,7 +74,11 @@
<code class="literal">Lock</code>
</h3></div></div></div><p>
Request that the screen be locked.
- </p></div><div class="sect2" title="Cycle"><div class="titlepage"><div><div><h3 class="title"><a name="gs-method-Cycle"></a>
+ </p></div><div class="sect2" title="LockMessage"><div class="titlepage"><div><div><h3 class="title"><a name="gs-method-LockMessage"></a>
+ <code class="literal">LockMessage</code>
+ </h3></div></div></div><p>
+ Request that the screen be locked, and set an away message.
+ </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th>Direction</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>in</td><td>string</td><td>the away message</td></tr></tbody></table></div></div><div class="sect2" title="Cycle"><div class="titlepage"><div><div><h3 class="title"><a name="gs-method-Cycle"></a>
<code class="literal">Cycle</code>
</h3></div></div></div><p>
Request that the screen saver theme be restarted and, if applicable,
--
1.8.1.6
|