cinnamon-screensaver: update to 2.2.4.

This commit is contained in:
Christian Neukirchen 2014-08-30 18:39:13 +02:00
parent 792a1665ba
commit b660fa9d1b
4 changed files with 1 additions and 361 deletions

View File

@ -1,226 +0,0 @@
diff -Naur cinnamon-screensaver-2.0.3.orig/doc/dbus-interface.html cinnamon-screensaver-2.0.3/doc/dbus-interface.html
--- cinnamon-screensaver-2.0.3.orig/doc/dbus-interface.html 2013-10-26 19:34:39.000000000 +0200
+++ cinnamon-screensaver-2.0.3/doc/dbus-interface.html 2013-10-29 10:08:06.568038245 +0100
@@ -70,7 +70,7 @@
<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 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,
diff -Naur cinnamon-screensaver-2.0.3.orig/src/cinnamon-screensaver-command.c cinnamon-screensaver-2.0.3/src/cinnamon-screensaver-command.c
--- cinnamon-screensaver-2.0.3.orig/src/cinnamon-screensaver-command.c 2013-10-26 19:34:39.000000000 +0200
+++ cinnamon-screensaver-2.0.3/src/cinnamon-screensaver-command.c 2013-10-29 22:32:13.127650887 +0100
@@ -41,7 +41,7 @@
static gboolean do_query = FALSE;
static gboolean do_time = FALSE;
-static gchar *away_message = "DEFAULT";
+static gchar *away_message = "";
static GOptionEntry entries [] = {
{ "exit", 0, 0, G_OPTION_ARG_NONE, &do_quit,
@@ -114,7 +114,7 @@
static GDBusMessage *
screensaver_send_message_string (GDBusConnection *connection,
const char *name,
- gboolean value)
+ gchar *value)
{
GDBusMessage *message, *reply;
GError *error;
@@ -310,14 +310,7 @@
}
if (do_lock) {
- if (g_strcmp0 (away_message, "DEFAULT") == 0) {
- reply = screensaver_send_message_string (connection, "Lock", away_message);
- }
- else {
- gchar * custom_message = g_strdup_printf("CUSTOM###%s", away_message);
- reply = screensaver_send_message_string (connection, "Lock", custom_message);
- g_free (custom_message);
- }
+ reply = screensaver_send_message_string (connection, "Lock", away_message);
if (reply == NULL) {
g_message ("Did not receive a reply from the screensaver.");
goto done;
diff -Naur cinnamon-screensaver-2.0.3.orig/src/cinnamon-screensaver-dialog.c cinnamon-screensaver-2.0.3/src/cinnamon-screensaver-dialog.c
--- cinnamon-screensaver-2.0.3.orig/src/cinnamon-screensaver-dialog.c 2013-10-26 19:34:39.000000000 +0200
+++ cinnamon-screensaver-2.0.3/src/cinnamon-screensaver-dialog.c 2013-10-29 18:34:38.042752214 +0100
@@ -49,7 +49,6 @@
static gboolean enable_logout = FALSE;
static gboolean enable_switch = FALSE;
static char *logout_command = NULL;
-static char *away_message = NULL;
static GOptionEntry entries [] = {
{ "verbose", 0, 0, G_OPTION_ARG_NONE, &verbose,
diff -Naur cinnamon-screensaver-2.0.3.orig/src/gs-listener-dbus.c cinnamon-screensaver-2.0.3/src/gs-listener-dbus.c
--- cinnamon-screensaver-2.0.3.orig/src/gs-listener-dbus.c 2013-10-26 19:34:39.000000000 +0200
+++ cinnamon-screensaver-2.0.3/src/gs-listener-dbus.c 2013-10-30 03:04:42.134732524 +0100
@@ -570,7 +570,7 @@
if (! dbus_message_get_args (message, &error,
DBUS_TYPE_STRING, &body,
DBUS_TYPE_INVALID)) {
- raise_syntax (connection, message, "ShowMessage");
+ raise_syntax (connection, message, "Lock");
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -584,6 +584,7 @@
return DBUS_HANDLER_RESULT_HANDLED;
}
+
static DBusHandlerResult
listener_show_message (GSListener *listener,
DBusConnection *connection,
@@ -906,7 +907,7 @@
} 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 +949,7 @@
} 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 -Naur cinnamon-screensaver-2.0.3.orig/src/gs-manager.c cinnamon-screensaver-2.0.3/src/gs-manager.c
--- cinnamon-screensaver-2.0.3.orig/src/gs-manager.c 2013-10-26 19:34:39.000000000 +0200
+++ cinnamon-screensaver-2.0.3/src/gs-manager.c 2013-10-29 20:27:40.394604570 +0100
@@ -1097,6 +1097,7 @@
g_object_unref (manager->priv->settings);
}
+ g_free (manager->priv->away_message);
g_free (manager->priv->logout_command);
g_free (manager->priv->keyboard_command);
@@ -1261,6 +1262,8 @@
gs_manager_destroy_windows (manager);
+ gs_manager_set_away_message (manager, NULL);
+
/* reset state */
manager->priv->active = FALSE;
manager->priv->activate_time = 0;
@@ -1275,10 +1278,18 @@
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);
}
@@ -1293,7 +1304,6 @@
if (active) {
res = gs_manager_activate (manager);
} else {
- gs_manager_set_away_message(manager, "");
res = gs_manager_deactivate (manager);
}
diff -Naur cinnamon-screensaver-2.0.3.orig/src/gs-window-x11.c cinnamon-screensaver-2.0.3/src/gs-window-x11.c
--- cinnamon-screensaver-2.0.3.orig/src/gs-window-x11.c 2013-10-26 19:34:39.000000000 +0200
+++ cinnamon-screensaver-2.0.3/src/gs-window-x11.c 2013-10-29 23:11:15.240828725 +0100
@@ -2132,38 +2132,19 @@
return utf8_name;
}
-static gchar *
-str_replace(const char *string, const char *delimiter, const char *replacement)
-{
- gchar **split;
- gchar *ret;
- g_return_val_if_fail(string != NULL, NULL);
- g_return_val_if_fail(delimiter != NULL, NULL);
- g_return_val_if_fail(replacement != NULL, NULL);
- split = g_strsplit(string, delimiter, 0);
- ret = g_strjoinv(replacement, split);
- g_strfreev(split);
- return ret;
-}
-
static void
update_clock (GSWindow *window)
{
- char *markup;
- char *away_message;
-
- if (window->priv->away_message != NULL && g_str_has_prefix (window->priv->away_message, "CUSTOM###") && g_strcmp0(window->priv->away_message, "") != 0) {
- away_message = str_replace(window->priv->away_message, "CUSTOM###", "");
- markup = g_strdup_printf ("%s\n\n<b><span font_desc=\"Ubuntu 14\" foreground=\"#CCCCCC\"> %s</span></b>\n<b><span font_desc=\"Ubuntu 10\" foreground=\"#ACACAC\"> ~ %s</span></b>", gnome_wall_clock_get_clock (window->priv->clock_tracker), away_message, get_user_display_name());
- }
- else {
- away_message = g_strdup_printf (_("%s"), window->priv->default_message);
- markup = g_strdup_printf ("%s\n\n<b><span font_desc=\"Ubuntu 14\" foreground=\"#CCCCCC\">%s</span></b>", gnome_wall_clock_get_clock (window->priv->clock_tracker), away_message);
- }
-
- gtk_label_set_markup (GTK_LABEL (window->priv->clock), markup);
- g_free (markup);
- g_free (away_message);
+ char *markup;
+
+ if (window->priv->away_message != NULL && g_strcmp0(window->priv->away_message, "") != 0) {
+ markup = g_strdup_printf ("%s\n\n<b><span font_desc=\"Ubuntu 14\" foreground=\"#CCCCCC\"> %s</span></b>\n<b><span font_desc=\"Ubuntu 10\" foreground=\"#ACACAC\"> ~ %s</span></b>", gnome_wall_clock_get_clock (window->priv->clock_tracker), g_markup_escape_text(window->priv->away_message, -1), get_user_display_name());
+ } else {
+ markup = g_strdup_printf ("%s\n\n<b><span font_desc=\"Ubuntu 14\" foreground=\"#CCCCCC\">%s</span></b>", gnome_wall_clock_get_clock (window->priv->clock_tracker), g_markup_escape_text(window->priv->default_message, -1));
+ }
+
+ gtk_label_set_markup (GTK_LABEL (window->priv->clock), markup);
+ g_free (markup);
}
static void
@@ -2197,7 +2178,16 @@
gs_window_set_away_message (GSWindow *window,
const char *message)
{
- window->priv->away_message = message;
+ g_return_if_fail (GS_IS_WINDOW (window));
+
+ g_free (window->priv->away_message);
+
+ if (message) {
+ window->priv->away_message = g_strdup (message);
+ } else {
+ window->priv->away_message = NULL;
+ }
+
update_clock (window);
}
@@ -2320,6 +2310,7 @@
g_return_if_fail (window->priv != NULL);
+ g_free (window->priv->away_message);
g_free (window->priv->logout_command);
g_free (window->priv->keyboard_command);

View File

@ -1,83 +0,0 @@
From cac2c0ad8f4f40b6b175b9fbcde06935859f1bbc Mon Sep 17 00:00:00 2001
From: Peter de Ridder <peter@xfce.org>
Date: Wed, 20 Mar 2013 20:44:51 +0100
Subject: [PATCH] Use the session path instead of the session id.
---
src/gs-listener-dbus.c | 47 +++++++++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 20 deletions(-)
diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c
index 703d9e1..11fb95e 100644
--- a/src/gs-listener-dbus.c
+++ b/src/gs-listener-dbus.c
@@ -116,19 +117,8 @@ enum {
if (listener->priv->session_id == NULL)
return FALSE;
-#ifdef WITH_SYSTEMD
- /* The bus object path is simply the actual session ID
- * prefixed to make it a bus path */
- if (listener->priv->have_systemd)
- return g_str_has_prefix (ssid, SYSTEMD_LOGIND_SESSION_PATH "/")
- && strcmp (ssid + sizeof (SYSTEMD_LOGIND_SESSION_PATH),
- listener->priv->session_id) == 0;
-#endif
-
-#ifdef WITH_CONSOLE_KIT
if (strcmp (ssid, listener->priv->session_id) == 0)
return TRUE;
-#endif
return FALSE;
}
@@ -416,20 +406,37 @@ enum {
#ifdef WITH_SYSTEMD
if (listener->priv->have_systemd) {
- char *t;
- int r;
+ dbus_uint32_t pid = getpid();
- r = sd_pid_get_session (0, &t);
- if (r < 0) {
- gs_debug ("Couldn't determine our own session id: %s", strerror (-r));
+ message = dbus_message_new_method_call (SYSTEMD_LOGIND_SERVICE, SYSTEMD_LOGIND_PATH, SYSTEMD_LOGIND_INTERFACE, "GetSessionByPID");
+ if (message == NULL) {
+ gs_debug ("Couldn't allocate the dbus message");
return NULL;
}
- /* t is allocated with malloc(), we need it with g_malloc() */
- ssid = g_strdup(t);
- free (t);
+ if (dbus_message_append_args (message, DBUS_TYPE_UINT32, &pid, DBUS_TYPE_INVALID) == FALSE) {
+ gs_debug ("Couldn't add args to the dbus message");
+ return NULL;
+ }
+
+ /* FIXME: use async? */
+ reply = dbus_connection_send_with_reply_and_block (listener->priv->system_connection,
+ message,
+ -1, &error);
+ dbus_message_unref (message);
+
+ if (dbus_error_is_set (&error)) {
+ gs_debug ("%s raised:\n %s\n\n", error.name, error.message);
+ dbus_error_free (&error);
+ return NULL;
+ }
+
+ dbus_message_iter_init (reply, &reply_iter);
+ dbus_message_iter_get_basic (&reply_iter, &ssid);
+
+ dbus_message_unref (reply);
- return ssid;
+ return g_strdup (ssid);
}
#endif
--
1.8.4

View File

@ -1,51 +0,0 @@
From f8f9beb6a3bf81240d36bfec43e5db9b102ea91e Mon Sep 17 00:00:00 2001
From: Martin Pitt <martinpitt@gnome.org>
Date: Wed, 1 May 2013 10:55:49 -0700
Subject: [PATCH] Lock screen on suspend
Listen for logind's PrepareForSleep signal, and lock the screen (if configured
to do so). This mirrors what gnome-shell's screensaver does.
---
src/gs-listener-dbus.c | 28 ++++++++++++++++++++++++++++
src/gs-listener-dbus.h | 1 +
src/gs-monitor.c | 20 ++++++++++++++++++++
3 files changed, 49 insertions(+)
diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c
index 7f718fa..49586fd 100644
--- a/src/gs-listener-dbus.c
+++ b/src/gs-listener-dbus.c
@@ -871,6 +872,17 @@ listener_dbus_handle_system_message (DBusConnection *connection,
}
return DBUS_HANDLER_RESULT_HANDLED;
+ } else if (dbus_message_is_signal (message, SYSTEMD_LOGIND_INTERFACE, "PrepareForSleep")) {
+ gboolean active;
+ if (dbus_message_get_args (message, NULL,
+ DBUS_TYPE_BOOLEAN, &active,
+ DBUS_TYPE_INVALID) && active) {
+ gs_debug ("systemd notified that system is about to sleep");
+ g_signal_emit (listener, signals [LOCK], 0, "");
+ } else {
+ gs_debug ("cannot parse PrepareForSleep");
+ }
+ return DBUS_HANDLER_RESULT_HANDLED;
} else if (dbus_message_is_signal (message, DBUS_INTERFACE_PROPERTIES, "PropertiesChanged")) {
if (_listener_message_path_is_our_session (listener, message)) {
@@ -1370,6 +1392,12 @@ gs_listener_acquire (GSListener *listener,
",interface='"DBUS_INTERFACE_PROPERTIES"'"
",member='PropertiesChanged'",
NULL);
+ dbus_bus_add_match (listener->priv->system_connection,
+ "type='signal'"
+ ",sender='"SYSTEMD_LOGIND_SERVICE"'"
+ ",interface='"SYSTEMD_LOGIND_INTERFACE"'"
+ ",member='PrepareForSleep'",
+ NULL);
return (res != -1);
}
--
1.8.1.2

View File

@ -1,6 +1,6 @@
# Template file for 'cinnamon-screensaver'
pkgname=cinnamon-screensaver
version=2.0.3
version=2.2.4
revision=1
patch_args="-Np1"
short_desc="The Cinnamon screensaver"