[tracker/gconf-dbus] libtracker-common: Cleanly and silently handle non gconf-dbus situation



commit 38a41402cfc8963ce8535efb99aa15191550a288
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Apr 1 17:48:59 2011 +0200

    libtracker-common: Cleanly and silently handle non gconf-dbus situation

 src/libtracker-common/tracker-locale-gconfdbus.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-common/tracker-locale-gconfdbus.c b/src/libtracker-common/tracker-locale-gconfdbus.c
index 6800a0a..8877bb7 100644
--- a/src/libtracker-common/tracker-locale-gconfdbus.c
+++ b/src/libtracker-common/tracker-locale-gconfdbus.c
@@ -51,6 +51,7 @@ static guint watch_name_id = 0;
 static guint registration_id = 0;
 static GStaticMutex subscribers_mutex = G_STATIC_MUTEX_INIT;
 GDBusNodeInfo *introspection_data = NULL;
+static gboolean non_maemo_mode = FALSE;
 
 /* gconf keys for tracker locales, as defined in:
  * http://apidocs.meego.com/1.0/mtf/i18n.html
@@ -280,7 +281,7 @@ get_value_from_config (const gchar *key_in)
 void
 tracker_locale_gconfdbus_init (void)
 {
-	if (!g_getenv (TRACKER_DISABLE_MEEGOTOUCH_LOCALE_ENV)) {
+	if (!g_getenv (TRACKER_DISABLE_MEEGOTOUCH_LOCALE_ENV) && !non_maemo_mode) {
 		GError *error = NULL;
 		GVariant *reply;
 		guint i;
@@ -316,9 +317,20 @@ tracker_locale_gconfdbus_init (void)
 
 
 		if (error) {
-			g_critical ("%s", error->message);
-			g_clear_error (&error);
-			return;
+			if (error->code == 19) {
+				g_message ("GetDefaultDatabase doesn't exist on %s, this GConf "
+				           "doesn't look like a gconf-dbus.\n"
+				           "Continuing in non-maemo mode",
+				           GCONF_DBUS_SERVER_OBJECT);
+				g_object_unref (connection);
+				connection = NULL;
+				non_maemo_mode = TRUE;
+				return;
+			} else {
+				g_critical ("%s", error->message);
+				g_clear_error (&error);
+				return;
+			}
 		}
 
 		g_variant_get (reply, "(s)", &gconf_dbus_default_db, NULL);



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