[vino] Added option to disable connect notifications



commit 96465ea66d4723dc7397dd31603958a58176892b
Author: Mateusz MaÄkowski <matx-1997 o2 pl>
Date:   Tue Nov 22 07:18:07 2011 +0100

    Added option to disable connect notifications
    
    Fixes bug 588305.

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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]