[vino] Do not crash if a GConf server is not available. Ubuntu #267760.



commit ad0339bd1cee61ef6dbbd50a9a6ccb4c572e17ac
Author: Jonh Wendell <jwendell gnome org>
Date:   Wed Aug 12 14:51:30 2009 -0300

    Do not crash if a GConf server is not available. Ubuntu #267760.

 tools/vino-passwd.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/tools/vino-passwd.c b/tools/vino-passwd.c
index 03a2e2e..fe6b1b3 100644
--- a/tools/vino-passwd.c
+++ b/tools/vino-passwd.c
@@ -173,6 +173,17 @@ vino_passwd_change (GConfClient *conf)
     }
 }
 
+static void
+gconf_error_handle (GConfClient *client, GError *error)
+{
+  g_print (_("Error while communicating with GConf. Are you logged into a GNOME session?"));
+  g_print ("\n");
+  g_print (_("Error message:"));
+  g_print ("\n\n%s\n\n", error->message);
+
+  exit (1);
+}
+
 int 
 main(int argc, char *argv[])
 {
@@ -214,6 +225,8 @@ main(int argc, char *argv[])
      return 0;
    }
 
+  g_type_init ();
+  gconf_client_set_global_default_error_handler (gconf_error_handle);
   conf = gconf_client_get_default ();
 
   if (gconf_client_key_is_writable (conf, VINO_PREFS_VNC_PASSWORD, NULL))



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