void-packages/srcpkgs/cinnamon-screensaver/patches/away-message-fixes.patch

227 lines
10 KiB
Diff

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);