After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 588305 - Add a GSettings option to disable notifications on connect
Add a GSettings option to disable notifications on connect
Status: RESOLVED FIXED
Product: vino
Classification: Applications
Component: Server
2.25.x
Other Linux
: Normal enhancement
: ---
Assigned To: Vino Maintainer(s)
Vino Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2009-07-11 09:53 UTC by Emilio Pozuelo Monfort
Modified: 2011-11-22 16:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch from Chris Butler to add an option to disable notifications (14.69 KB, patch)
2009-07-11 09:53 UTC, Emilio Pozuelo Monfort
rejected Details | Review
Vino patch - disable notifications when client connects - using GSettings. (6.06 KB, patch)
2011-11-22 06:29 UTC, Mateusz Maćkowski
needs-work Details | Review
Vino patch - disable notifications when client connects - using GSettings. It's fixed version - according to David King's hints. (5.40 KB, patch)
2011-11-22 16:16 UTC, Mateusz Maćkowski
committed Details | Review

Description Emilio Pozuelo Monfort 2009-07-11 09:53:02 UTC
[ From http://bugs.debian.org/535693 ]

Hi Jonh

I've got this request to have an option to disable notification bubbles when a user connects to your desktop. The patch is against 2.24.

"
While I don't doubt that the notifications that pop up when a remote
user connects is a useful feature, it can be annoying at times. For
example, when I want to control my mythtv machine from another computer,
I'd rather not have the notification pop up over the video I'm watching.
It looks like I'm not the only one who wants this feature either:

http://ubuntuforums.org/showthread.php?t=690885
"
Comment 1 Emilio Pozuelo Monfort 2009-07-11 09:53:59 UTC
Created attachment 138232 [details] [review]
Patch from Chris Butler to add an option to disable notifications
Comment 2 David King 2011-10-30 09:07:21 UTC
Comment on attachment 138232 [details] [review]
Patch from Chris Butler to add an option to disable notifications

This is an old patch, which will no longer apply, as Vino now uses GSettings for storing application settings, so rejecting it and marking as obsolete

If a new patch was submitted, I would not want the option exposed in the preferences dialog, but only added to the GSettings schema. This has the benefit of keeping Vino more secure for average users, still configurable for power uses and will make the patch simpler.
Comment 3 Mateusz Maćkowski 2011-11-22 06:29:40 UTC
Created attachment 201899 [details] [review]
Vino patch - disable notifications when client connects - using GSettings.

Patch to Vino that adds ability to disable notifications when client connects - using GSettings
Comment 4 David King 2011-11-22 07:33:19 UTC
Review of attachment 201899 [details] [review]:

Looks good overall. I do not see any changes to the GSettings schema, so plase make sure that the new key ‘notify-on-connect’ is added there (common/org.gnome.Vino.gschema.xml.in). Additionally, please make the following changes:

::: server/vino-server.c
@@ +88,3 @@
   guint             use_upnp : 1;
   guint             disable_xdamage : 1;
+  guint				notify_on_connect : 1;

Use spaces and not tabs for indentation.

@@ +1197,3 @@
       vino_server_set_disable_xdamage (server, g_value_get_boolean (value));
       break;
+    case PROP_NOTIFY_ON_CONNECT:

I do not think that there is any requirement for a property setter here. It would be easy to add one later, so please remove this part.

@@ +1499,3 @@
 
+  g_object_class_install_property (gobject_class,
+				   PROP_NOTIFY_ON_CONNECT,

Again, check your indentation and please use spaces rather than tabs.

@@ +1505,3 @@
+							 TRUE,
+                                                         G_PARAM_READWRITE   |
+                                                         G_PARAM_CONSTRUCT   |

Set this to G_PARAM_CONSTRUCT_ONLY, as it is not currently set from within Vino.

@@ +1915,3 @@
+
+void
+vino_server_set_notify_on_connect (VinoServer *server,

Remove this function, as I mentioned in the comments above.

::: server/vino-server.h
@@ +124,3 @@
+void                 vino_server_set_notify_on_connect (VinoServer *server,
+                                                        gboolean    notify_on_connect);
+gboolean             vino_server_get_notify_on_connect (VinoServer *server);

Remove this prototype, as mentioned in the vino-server.c comments.
Comment 5 Mateusz Maćkowski 2011-11-22 16:09:02 UTC
Comment on attachment 201899 [details] [review]
Vino patch - disable notifications when client connects - using GSettings.

From d849b31ccf2017f7f82d64ac9a481cd65c6e504e Mon Sep 17 00:00:00 2001
From: m4tx1 <m4tx1@m4tx-EP35-DS4.(none)>
Date: Tue, 22 Nov 2011 07:18:07 +0100
Subject: [PATCH] Added ability to disable notifications when client connects
 using GSettings

Replaced tabs by spaces in some places; removed 2 new functions prototypes in
vino-server.h; replaced G_PARAM_CONTRUCT by G_PARAM_CONSTRUCT_ONLY in
installing a notify-on-connect property; added notify-on-connect key in
GSettings schema
---
 common/org.gnome.Vino.gschema.xml.in |    8 ++++++++
 server/vino-prefs.c                  |    2 ++
 server/vino-server.c                 |   29 +++++++++++++++++++++++++++--
 server/vino-status-icon.c            |    2 +-
 4 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/common/org.gnome.Vino.gschema.xml.in b/common/org.gnome.Vino.gschema.xml.in
index ec1f472..821c4e2 100644
--- a/common/org.gnome.Vino.gschema.xml.in
+++ b/common/org.gnome.Vino.gschema.xml.in
@@ -161,6 +161,14 @@
       </_description>
       <default>false</default>
     </key>
+
+    <key name='notify-on-connect' type='b'>
+      <_summary>Notify on connect</_summary>
+      <_description>
+        If true, we will notify, when the user connects to the system.
+      </_description>
+      <default>true</default>
+    </key>
   </schema>
 </schemalist>
 
diff --git a/server/vino-prefs.c b/server/vino-prefs.c
index b3792e1..3aca534 100644
--- a/server/vino-prefs.c
+++ b/server/vino-prefs.c
@@ -91,6 +91,8 @@ vino_prefs_create_server (GdkScreen *screen)
                    server, "use-upnp", G_SETTINGS_BIND_GET);
   g_settings_bind (settings, "disable-xdamage",
                    server, "disable-xdamage", G_SETTINGS_BIND_GET);
+  g_settings_bind (settings, "notify-on-connect",
+                   server, "notify-on-connect", G_SETTINGS_BIND_GET);
   g_settings_bind (settings, "icon-visibility",
                    icon, "visibility", G_SETTINGS_BIND_GET);
 
diff --git a/server/vino-server.c b/server/vino-server.c
index 7ae4c7c..6231d29 100644
--- a/server/vino-server.c
+++ b/server/vino-server.c
@@ -87,6 +87,7 @@ struct _VinoServerPrivate
   guint             disable_background : 1;
   guint             use_upnp : 1;
   guint             disable_xdamage : 1;
+  guint             notify_on_connect : 1;
 };
 
 struct _VinoClient
@@ -121,7 +122,8 @@ enum
   PROP_LOCK_SCREEN,
   PROP_DISABLE_BACKGROUND,
   PROP_USE_UPNP,
-  PROP_DISABLE_XDAMAGE
+  PROP_DISABLE_XDAMAGE,
+  PROP_NOTIFY_ON_CONNECT
 };
 
 static enum rfbNewClientAction vino_server_auth_client (VinoServer *server,
@@ -1258,6 +1260,9 @@ vino_server_get_property (GObject    *object,
     case PROP_DISABLE_XDAMAGE:
       g_value_set_boolean (value, server->priv->disable_xdamage);
       break;
+    case PROP_NOTIFY_ON_CONNECT:
+      g_value_set_boolean (value, server->priv->notify_on_connect);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1389,7 +1394,7 @@ vino_server_class_init (VinoServerClass *klass)
                                                        G_PARAM_STATIC_NAME |
                                                        G_PARAM_STATIC_NICK |
                                                        G_PARAM_STATIC_BLURB));
-  
+
   g_object_class_install_property (gobject_class,
 				   PROP_VNC_PASSWORD,
 				   g_param_spec_string ("vnc-password",
@@ -1489,6 +1494,18 @@ vino_server_class_init (VinoServerClass *klass)
                                                          G_PARAM_STATIC_NICK |
                                                          G_PARAM_STATIC_BLURB));
 
+  g_object_class_install_property (gobject_class,
+                                   PROP_NOTIFY_ON_CONNECT,
+                                   g_param_spec_boolean ("notify-on-connect",
+                                                         "Notify on connect",
+                                                         "Notifies when the user connects to the system",
+                                                         TRUE,
+                                                         G_PARAM_READWRITE   |
+                                                         G_PARAM_CONSTRUCT_ONLY   |
+                                                         G_PARAM_STATIC_NAME |
+                                                         G_PARAM_STATIC_NICK |
+                                                         G_PARAM_STATIC_BLURB));
+
 }
 
 VinoServer *
@@ -1885,6 +1902,14 @@ vino_server_set_lock_screen (VinoServer *server,
     }
 }
 
+gboolean
+vino_server_get_notify_on_connect (VinoServer *server)
+{
+  g_return_val_if_fail (VINO_IS_SERVER (server), FALSE);
+
+  return server->priv->notify_on_connect;
+}
+
 VinoStatusIcon *
 vino_server_get_status_icon (VinoServer *server)
 {
diff --git a/server/vino-status-icon.c b/server/vino-status-icon.c
index 11c98e2..491aba3 100644
--- a/server/vino-status-icon.c
+++ b/server/vino-status-icon.c
@@ -659,7 +659,7 @@ vino_status_icon_show_new_client_notification (gpointer user_data)
                                    NOTIFICATION_TIMEOUT * 1000);
 
   error = NULL;
-  if (!notify_notification_show (icon->priv->new_client_notification, &error))
+  if (vino_server_get_notify_on_connect (icon->priv->server) && !notify_notification_show (icon->priv->new_client_notification, &error))
     {
       g_printerr (_("Error while displaying notification bubble: %s\n"),
                   error->message);
-- 
1.7.5.4
Comment 6 André Klapper 2011-11-22 16:15:00 UTC
Please attach patches as attachments (files) instead of comments - makes it much easier to apply them, plus no linebreak issues with copy&paste. Thanks!
Comment 7 Mateusz Maćkowski 2011-11-22 16:16:53 UTC
Created attachment 201933 [details] [review]
Vino patch - disable notifications when client connects - using GSettings. It's fixed version - according to David King's hints.

Sorry for the previous comment - i don't know this Bugzilla too well.
Comment 8 David King 2011-11-22 16:48:50 UTC
Comment on attachment 201933 [details] [review]
Vino patch - disable notifications when client connects - using GSettings. It's fixed version - according to David King's hints.

Good work! I pushed this to master as commit 96465ea66d4723dc7397dd31603958a58176892b, thanks.