summaryrefslogtreecommitdiff
path: root/src/user_share.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user_share.c')
-rw-r--r--src/user_share.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/user_share.c b/src/user_share.c
index e435b3d..d210ce6 100644
--- a/src/user_share.c
+++ b/src/user_share.c
@@ -212,6 +212,26 @@ bluez_init (void)
}
#endif /* HAVE_BLUETOOTH */
+static gboolean
+file_sharing_enabled (void)
+{
+ gboolean enabled = TRUE;
+ settings = g_settings_new (GSETTINGS_SCHEMA);
+
+#ifdef HAVE_BLUETOOTH
+ if (g_settings_get_boolean (settings, FILE_SHARING_ENABLED) == FALSE &&
+ g_settings_get_boolean (settings, FILE_SHARING_BLUETOOTH_ENABLED) == FALSE &&
+ g_settings_get_boolean (settings, FILE_SHARING_BLUETOOTH_OBEXPUSH_ENABLED) == FALSE)
+#else /* HAVE_BLUETOOTH */
+ if (g_settings_get_boolean (settings, FILE_SHARING_ENABLED) == FALSE)
+#endif /* HAVE_BLUETOOTH */
+ enabled = FALSE;
+
+ g_object_unref (settings);
+
+ return enabled;
+}
+
static void
migrate_old_configuration (void)
{
@@ -420,16 +440,10 @@ main (int argc, char **argv)
migrate_old_configuration ();
- settings = g_settings_new (GSETTINGS_SCHEMA);
-#ifdef HAVE_BLUETOOTH
- if (g_settings_get_boolean (settings, FILE_SHARING_ENABLED) == FALSE &&
- g_settings_get_boolean (settings, FILE_SHARING_BLUETOOTH_ENABLED) == FALSE &&
- g_settings_get_boolean (settings, FILE_SHARING_BLUETOOTH_OBEXPUSH_ENABLED) == FALSE)
+ if (!file_sharing_enabled ())
return 1;
-#else /* HAVE_BLUETOOTH */
- if (g_settings_get_boolean (settings, FILE_SHARING_ENABLED) == FALSE)
- return 1;
-#endif /* HAVE_BLUETOOTH */
+
+ settings = g_settings_new (GSETTINGS_SCHEMA);
x_fd = ConnectionNumber (xdisplay);
XSetIOErrorHandler (x_io_error_handler);