diff options
Diffstat (limited to 'community/cinnamon-screensaver/fix-dbus-compatibility.patch')
-rw-r--r-- | community/cinnamon-screensaver/fix-dbus-compatibility.patch | 245 |
1 files changed, 239 insertions, 6 deletions
diff --git a/community/cinnamon-screensaver/fix-dbus-compatibility.patch b/community/cinnamon-screensaver/fix-dbus-compatibility.patch index fa53f6fac..d4c27a0b1 100644 --- a/community/cinnamon-screensaver/fix-dbus-compatibility.patch +++ b/community/cinnamon-screensaver/fix-dbus-compatibility.patch @@ -1,8 +1,20 @@ +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 @@ do_command (GDBusConnection *connection) +@@ -311,11 +311,11 @@ if (do_lock) { if (g_strcmp0 (away_message, "DEFAULT") == 0) { @@ -20,7 +32,7 @@ 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 @@ do_introspect (DBusConnection *connection, +@@ -653,6 +653,8 @@ enum { xml = g_string_append (xml, " <interface name=\""GS_INTERFACE"\">\n" " <method name=\"Lock\">\n" @@ -29,7 +41,7 @@ index 2a98aee..6dbf12d 100644 " <arg name=\"body\" direction=\"in\" type=\"s\"/>\n" " </method>\n" " <method name=\"SimulateUserActivity\">\n" -@@ -744,6 +746,10 @@ listener_dbus_handle_session_message (DBusConnection *connection, +@@ -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")) { @@ -40,7 +52,7 @@ index 2a98aee..6dbf12d 100644 return listener_lock (listener, connection, message); } if (dbus_message_is_method_call (message, GS_SERVICE, "Quit")) { -@@ -906,7 +912,7 @@ listener_dbus_handle_system_message (DBusConnection *connection, +@@ -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"); @@ -49,7 +61,7 @@ index 2a98aee..6dbf12d 100644 } return DBUS_HANDLER_RESULT_HANDLED; -@@ -948,7 +954,7 @@ listener_dbus_handle_system_message (DBusConnection *connection, +@@ -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"); @@ -62,7 +74,7 @@ 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 @@ void +@@ -1275,10 +1275,18 @@ enum { gs_manager_set_away_message (GSManager *manager, const char *message) { @@ -84,3 +96,224 @@ index 1544921..bc09cb9 100644 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 + + +From 7141e8ce04921ab6d46648cba20c691b8d8f8e0b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <ballogyor@gmail.com> +Date: Sat, 2 Mar 2013 08:11:45 +0100 +Subject: [PATCH 3/4] Revert "Fixed away_message shown as "(null)" (using a + prefix to explicitly mark custom away messages)" + +This reverts commit bf1f42b9f9a673091b0f7bf1118781b2d95c88fd. +--- + src/cinnamon-screensaver-command.c | 9 +------- + src/gs-window-x11.c | 43 ++++++++++++-------------------------- + 2 files changed, 14 insertions(+), 38 deletions(-) + +diff --git a/src/cinnamon-screensaver-command.c b/src/cinnamon-screensaver-command.c +index 5c90916..dbcac8a 100644 +--- a/src/cinnamon-screensaver-command.c ++++ b/src/cinnamon-screensaver-command.c +@@ -310,14 +310,7 @@ + } + + if (do_lock) { +- if (g_strcmp0 (away_message, "DEFAULT") == 0) { +- 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, "LockMessage", custom_message); +- g_free (custom_message); +- } ++ reply = screensaver_send_message_string (connection, "LockMessage", away_message); + if (reply == NULL) { + g_message ("Did not receive a reply from the screensaver."); + goto done; +diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c +index 6858509..0e3bb6f 100644 +--- a/src/gs-window-x11.c ++++ b/src/gs-window-x11.c +@@ -2132,38 +2132,21 @@ enum { + 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###", ""); +- away_message = g_strdup_printf (_("%s: \"%s\""), get_user_display_name(), away_message); +- } +- else { +- away_message = g_strdup_printf (_("%s"), window->priv->default_message); +- } +- +- markup = g_strdup_printf ("%s\n<b><span font_desc=\"Ubuntu 10\" foreground=\"#FFFFFF\">%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; ++ char *away_message; ++ if (g_strcmp0(window->priv->away_message, "DEFAULT") == 0 || g_strcmp0(window->priv->away_message, "") == 0) { ++ away_message = g_strdup_printf (_("%s"), window->priv->default_message); ++ } ++ else { ++ away_message = g_strdup_printf (_("%s: \"%s\""), get_user_display_name(), window->priv->away_message); ++ } ++ markup = g_strdup_printf ("%s\n<b><span font_desc=\"Ubuntu 10\" foreground=\"#FFFFFF\">%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); + } + + static void +-- +1.8.1.6 + + +From 1ed6a959746e115a7f33de2134921c6572185ebd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <ballogyor@gmail.com> +Date: Sat, 2 Mar 2013 08:13:04 +0100 +Subject: [PATCH 4/4] Simplify away message handling + +--- + src/cinnamon-screensaver-command.c | 19 ++++++++++++------- + src/gs-window-x11.c | 7 +++---- + 2 files changed, 15 insertions(+), 11 deletions(-) + +diff --git a/src/cinnamon-screensaver-command.c b/src/cinnamon-screensaver-command.c +index dbcac8a..4836f81 100644 +--- a/src/cinnamon-screensaver-command.c ++++ b/src/cinnamon-screensaver-command.c +@@ -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,12 +310,17 @@ + } + + if (do_lock) { +- reply = screensaver_send_message_string (connection, "LockMessage", away_message); +- if (reply == NULL) { +- g_message ("Did not receive a reply from the screensaver."); +- goto done; ++ if (away_message) { ++ reply = screensaver_send_message_string (connection, "LockMessage", away_message); ++ if (reply == NULL) { ++ g_message ("Did not receive a reply from the screensaver."); ++ goto done; ++ } ++ g_object_unref (reply); ++ } else { ++ reply = screensaver_send_message_void (connection, "Lock", FALSE); ++ g_assert (reply == NULL); + } +- g_object_unref (reply); + } + + if (do_activate) { +diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c +index 0e3bb6f..22f5471 100644 +--- a/src/gs-window-x11.c ++++ b/src/gs-window-x11.c +@@ -2137,11 +2137,10 @@ enum { + { + char *markup; + char *away_message; +- if (g_strcmp0(window->priv->away_message, "DEFAULT") == 0 || g_strcmp0(window->priv->away_message, "") == 0) { +- away_message = g_strdup_printf (_("%s"), window->priv->default_message); +- } +- else { ++ if (window->priv->away_message && g_strcmp0(window->priv->away_message, "") != 0) { + away_message = g_strdup_printf (_("%s: \"%s\""), get_user_display_name(), window->priv->away_message); ++ } else { ++ away_message = g_strdup_printf (_("%s"), window->priv->default_message); + } + markup = g_strdup_printf ("%s\n<b><span font_desc=\"Ubuntu 10\" foreground=\"#FFFFFF\">%s</span></b>", gnome_wall_clock_get_clock (window->priv->clock_tracker), away_message); + gtk_label_set_markup (GTK_LABEL (window->priv->clock), markup); +-- +1.8.1.6 + |