[vino/3] exit immediately if not enabled
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vino/3] exit immediately if not enabled
- Date: Mon, 5 Jul 2010 18:57:17 +0000 (UTC)
commit 13a2c919405e802fa86efa9a525fc204b9853f93
Author: Ryan Lortie <desrt desrt ca>
Date: Mon Jul 5 14:49:30 2010 -0400
exit immediately if not enabled
capplet/Makefile.am | 2 +
server/vino-prefs.c | 61 +++++++++++++++++++++++++++-----------------------
2 files changed, 35 insertions(+), 28 deletions(-)
---
diff --git a/capplet/Makefile.am b/capplet/Makefile.am
index 27c3db3..2d447ee 100644
--- a/capplet/Makefile.am
+++ b/capplet/Makefile.am
@@ -22,6 +22,8 @@ vino_preferences_SOURCES = \
vino-connectivity-info.c \
vino-url-webservice.h \
vino-url-webservice.c \
+ vino-radio-button.h \
+ vino-radio-button.c \
vino-message-box.h \
vino-message-box.c \
vino-preferences.c \
diff --git a/server/vino-prefs.c b/server/vino-prefs.c
index ccdd825..f6a54df 100644
--- a/server/vino-prefs.c
+++ b/server/vino-prefs.c
@@ -39,7 +39,7 @@
#define VINO_PREFS_LOCKFILE "vino-server.lock"
static GSettings *background_settings = NULL;
-static GSettings *vino_settings = NULL;
+static GSettings *settings = NULL;
static gboolean force_view_only;
static void
@@ -74,44 +74,39 @@ vino_prefs_create_server (GdkScreen *screen)
NULL);
icon = vino_server_get_status_icon (server);
- g_settings_bind (vino_settings, "prompt-enabled",
+ g_settings_bind (settings, "prompt-enabled",
server, "prompt-enabled", G_SETTINGS_BIND_GET);
if (!force_view_only)
- g_settings_bind (vino_settings, "view-only",
+ g_settings_bind (settings, "view-only",
server, "view-only", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "network-interface",
+ g_settings_bind (settings, "network-interface",
server, "network-interface", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "use-alternative-port",
+ g_settings_bind (settings, "use-alternative-port",
server, "use-alternative-port", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "alternative-port",
+ g_settings_bind (settings, "alternative-port",
server, "alternative-port", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "authentication-methods",
+ g_settings_bind (settings, "authentication-methods",
server, "auth-methods", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "require-encryption",
+ g_settings_bind (settings, "require-encryption",
server, "require-encryption", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "require-encryption",
+ g_settings_bind (settings, "require-encryption",
server, "require-encryption", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "vnc-password",
+ g_settings_bind (settings, "vnc-password",
server, "vnc-password", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "lock-screen-on-disconnect",
+ g_settings_bind (settings, "lock-screen-on-disconnect",
server, "lock-screen", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "disable-background",
+ g_settings_bind (settings, "disable-background",
server, "disable-background", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "use-upnp",
+ g_settings_bind (settings, "use-upnp",
server, "use-upnp", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "disable-xdamage",
+ g_settings_bind (settings, "disable-xdamage",
server, "disable-xdamage", G_SETTINGS_BIND_GET);
- g_settings_bind (vino_settings, "icon-visibility",
+ g_settings_bind (settings, "icon-visibility",
icon, "visibility", G_SETTINGS_BIND_GET);
- /* bind this one last */
- g_settings_bind_with_mapping (vino_settings, "enabled",
- server, "on-hold",
- G_SETTINGS_BIND_GET,
- get_inverted_boolean,
- NULL, NULL, NULL);
+ vino_server_set_on_hold (server, FALSE);
g_signal_connect (server, "notify::alternative-port", G_CALLBACK (vino_prefs_restart_mdns), NULL);
g_signal_connect (server, "notify::use-alternative-port", G_CALLBACK(vino_prefs_restart_mdns), NULL);
@@ -123,7 +118,7 @@ vino_prefs_create_server (GdkScreen *screen)
static void
vino_prefs_restore_background (void)
{
- if (g_settings_get_boolean (vino_settings, "disable-background"))
+ if (g_settings_get_boolean (settings, "disable-background"))
g_settings_set_boolean (background_settings, "draw-background", TRUE);
}
@@ -202,19 +197,29 @@ vino_prefs_sighandler (int sig)
exit (0);
}
+static void
+notify_enabled (void)
+{
+ if (!g_settings_get_boolean (settings, "enabled"))
+ {
+ g_message ("The remote desktop service is disabled. Exiting.");
+ exit (0);
+ }
+}
+
void
vino_prefs_init (gboolean view_only)
{
- background_settings = g_settings_new ("org.gnome.desktop.background");
- vino_settings = g_settings_new ("org.gnome.Vino");
+ settings = g_settings_new ("org.gnome.Vino");
signal (SIGINT, vino_prefs_sighandler); /* Ctrl+C */
signal (SIGQUIT, vino_prefs_sighandler);
signal (SIGTERM, vino_prefs_sighandler); /* kill -15 */
signal (SIGSEGV, vino_prefs_sighandler); /* Segmentation fault */
- if(!vino_prefs_lock ())
- vino_prefs_restore_background ();
+ g_signal_connect (settings, "changed::enabled",
+ G_CALLBACK (notify_enabled), NULL);
+ notify_enabled ();
force_view_only = view_only;
}
@@ -223,9 +228,9 @@ void
vino_prefs_shutdown (void)
{
g_object_unref (background_settings);
- g_object_unref (vino_settings);
+ g_object_unref (settings);
background_settings = NULL;
- vino_settings = NULL;
+ settings = NULL;
vino_prefs_unlock ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]