From b2a6f1b28b7fa31088cab9a90b0f5ab97948534d Mon Sep 17 00:00:00 2001 From: root Date: Thu, 31 Oct 2013 01:12:24 -0700 Subject: Thu Oct 31 01:09:50 PDT 2013 --- community/cinnamon-screensaver/PKGBUILD | 35 ++-- .../cinnamon-screensaver/away-message-fixes.patch | 226 +++++++++++++++++++++ .../fix-dbus-compatibility.patch | 149 -------------- .../cinnamon-screensaver/fix-systemd-lock.patch | 83 ++++++++ .../lock_screen_on_suspend.patch | 2 +- 5 files changed, 323 insertions(+), 172 deletions(-) create mode 100644 community/cinnamon-screensaver/away-message-fixes.patch delete mode 100644 community/cinnamon-screensaver/fix-dbus-compatibility.patch create mode 100644 community/cinnamon-screensaver/fix-systemd-lock.patch (limited to 'community/cinnamon-screensaver') diff --git a/community/cinnamon-screensaver/PKGBUILD b/community/cinnamon-screensaver/PKGBUILD index da8fb0066..a58fa0bfe 100644 --- a/community/cinnamon-screensaver/PKGBUILD +++ b/community/cinnamon-screensaver/PKGBUILD @@ -5,32 +5,36 @@ pkgname=cinnamon-screensaver pkgver=2.0.3 -pkgrel=1 +pkgrel=3 pkgdesc="Screensaver designed to integrate well with the Cinnamon desktop." arch=('i686' 'x86_64') license=('GPL') url="https://github.com/linuxmint/cinnamon-screensaver" backup=(etc/pam.d/cinnamon-screensaver) -depends=('cinnamon' 'cinnamon-desktop') +depends=('cinnamon-desktop' 'cinnamon-translations' 'dbus-glib' 'libgnomekbd') makedepends=('intltool' 'gnome-common') -options=(!emptydirs) source=($pkgname-$pkgver.tar.gz::https://github.com/linuxmint/cinnamon-screensaver/archive/$pkgver.tar.gz cinnamon-screensaver.pam - fix-dbus-compatibility.patch + away-message-fixes.patch + fix-systemd-lock.patch lock_screen_on_suspend.patch) sha256sums=('00c866e98994afc8939d1d347de631cebaa6ec34ad59646a7ccd223bd757cc7d' 'b6ea9e2eb586d94bcabb617a8f1c2958111df87afdbb51f645882bccdc15cbda' - 'eebd1d056c21d2d3f60fb954677b9214fd1d575ed1c2bbb56326cedf41a39eb6' - '516c479558576c6c5a2509abfcbf4fdafb5953d252e7a4ab972f9db6137daca8') + 'f9f3d555b0c325322469be765b488da599fc850f8ff5a74f72fdf69f68e04c96' + '14d3301a03883330bf044a40ea4dce74a829b03174833d21efe66ebeb940dc0c' + '54f281eeb0e97c8c46250e287719051e0a580f6c0de384760aaa3532b42616f1') prepare() { cd $pkgname-$pkgver - # Fix compatibility with gnome-screensaver's D-Bus interface and various fixes - patch -Np1 -i ${srcdir}/fix-dbus-compatibility.patch + # Various fixes for away message handling + patch -Np1 -i ../away-message-fixes.patch + + # Use the session path instead of the session id + patch -Np1 -i ../fix-systemd-lock.patch # Lock screen on suspend with systemd - patch -Np1 -i ${srcdir}/lock_screen_on_suspend.patch + patch -Np1 -i ../lock_screen_on_suspend.patch } build() { @@ -47,17 +51,4 @@ package() { cd $pkgname-$pkgver make DESTDIR="$pkgdir" install install -Dm644 ../cinnamon-screensaver.pam "$pkgdir/etc/pam.d/cinnamon-screensaver" - - # Autostart only in Cinnamon - install -d "$pkgdir/etc/xdg/autostart/" - cp "$pkgdir/usr/share/applications/cinnamon-screensaver.desktop" \ - "$pkgdir/etc/xdg/autostart/cinnamon2d-screensaver.desktop" - cp "$pkgdir/usr/share/applications/cinnamon-screensaver.desktop" \ - "$pkgdir/etc/xdg/autostart/cinnamon-screensaver.desktop" - sed -i 's/^OnlyShowIn=.*/OnlyShowIn=GNOME;/' \ - "$pkgdir"/etc/xdg/autostart/cinnamon{,2d}-screensaver.desktop - echo 'AutostartCondition=GNOME3 if-session cinnamon' \ - >> "$pkgdir/etc/xdg/autostart/cinnamon-screensaver.desktop" - echo 'AutostartCondition=GNOME3 if-session cinnamon2d' \ - >> "$pkgdir/etc/xdg/autostart/cinnamon2d-screensaver.desktop" } diff --git a/community/cinnamon-screensaver/away-message-fixes.patch b/community/cinnamon-screensaver/away-message-fixes.patch new file mode 100644 index 000000000..1828c5beb --- /dev/null +++ b/community/cinnamon-screensaver/away-message-fixes.patch @@ -0,0 +1,226 @@ +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 @@ + Lock +

+ Request that the screen be locked. +-

++

DirectionTypeDescription
instringthe away message

+ Cycle +

+ 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 %s\n ~ %s", 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%s", 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 %s\n ~ %s", 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%s", 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); + diff --git a/community/cinnamon-screensaver/fix-dbus-compatibility.patch b/community/cinnamon-screensaver/fix-dbus-compatibility.patch deleted file mode 100644 index 3d70a79d0..000000000 --- a/community/cinnamon-screensaver/fix-dbus-compatibility.patch +++ /dev/null @@ -1,149 +0,0 @@ -From e43385126cf6f5187f98f940b8c04c3e99202b0b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= -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, - " \n" - " \n" -+ " \n" -+ " \n" - " \n" - " \n" - " \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?= -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 @@ -             
-           

Version 1.7.1


Table of Contents

1. DBUS Interface
Introduction
Methods
- Lock -+
-+ LockMessage -
- Cycle -
-@@ -30,6 +32,8 @@ - AuthenticationRequestEnd -
Examples

Chapter 1. DBUS Interface

- Request that the screen be locked. --

-+

-+ LockMessage -+

-+ Request that the screen be locked, and set an away message. -+

DirectionTypeDescription
instringthe away message

- Cycle -

- Request that the screen saver theme be restarted and, if applicable, --- -1.8.1.6 - diff --git a/community/cinnamon-screensaver/fix-systemd-lock.patch b/community/cinnamon-screensaver/fix-systemd-lock.patch new file mode 100644 index 000000000..7ce3e2394 --- /dev/null +++ b/community/cinnamon-screensaver/fix-systemd-lock.patch @@ -0,0 +1,83 @@ +From cac2c0ad8f4f40b6b175b9fbcde06935859f1bbc Mon Sep 17 00:00:00 2001 +From: Peter de Ridder +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 + diff --git a/community/cinnamon-screensaver/lock_screen_on_suspend.patch b/community/cinnamon-screensaver/lock_screen_on_suspend.patch index 5c273c70e..a6019a503 100644 --- a/community/cinnamon-screensaver/lock_screen_on_suspend.patch +++ b/community/cinnamon-screensaver/lock_screen_on_suspend.patch @@ -25,7 +25,7 @@ index 7f718fa..49586fd 100644 + 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); ++ g_signal_emit (listener, signals [LOCK], 0, ""); + } else { + gs_debug ("cannot parse PrepareForSleep"); + } -- cgit v1.2.3-54-g00ecf