summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-03-05 11:28:50 +0300
committerStefano Karapetsas <[email protected]>2015-03-13 09:21:36 +0100
commit3d5ee3fb42945c03bda045411419d024389daefe (patch)
treef93a824a567317720142d9211c5761a8eaabfe3c /src
parentac77fb9abfa4504d965cd9e9c9837dc0bb4f5b81 (diff)
downloadmate-user-share-3d5ee3fb42945c03bda045411419d024389daefe.tar.bz2
mate-user-share-3d5ee3fb42945c03bda045411419d024389daefe.tar.xz
first connect to settings, then read them.
fixes the issue with GLib >= 2.43, https://git.gnome.org/browse/glib/commit/?id=8ff5668a458344da22d30491e3ce726d861b3619 Closes https://github.com/mate-desktop/mate-user-share/pull/29
Diffstat (limited to 'src')
-rw-r--r--src/file-share-properties.c4
-rw-r--r--src/user_share.c32
2 files changed, 24 insertions, 12 deletions
diff --git a/src/file-share-properties.c b/src/file-share-properties.c
index 4886ef3..27669f6 100644
--- a/src/file-share-properties.c
+++ b/src/file-share-properties.c
@@ -587,8 +587,6 @@ main (int argc, char *argv[])
g_object_unref (store);
#endif /* HAVE_BLUETOOTH */
- update_ui ();
-
g_signal_connect (check,
"toggled", G_CALLBACK (enable_check_toggled), NULL);
g_signal_connect (password_combo,
@@ -614,7 +612,6 @@ main (int argc, char *argv[])
"clicked", G_CALLBACK (help_button_clicked),
gtk_builder_get_object (builder, "user_share_dialog"));
-
g_signal_connect (settings,
"changed::" GSETTINGS_KEY_FILE_SHARING_ENABLED,
G_CALLBACK (file_sharing_enabled_changed), NULL);
@@ -642,6 +639,7 @@ main (int argc, char *argv[])
G_CALLBACK (file_sharing_bluetooth_obexpush_notify_changed), NULL);
#endif /* HAVE_BLUETOOTH */
+ update_ui ();
gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (builder, "user_share_dialog")));
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);