From c0ea7fefe55f518145afd68f201bb6ed07d6e866 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Fri, 28 Sep 2012 13:56:41 +0200 Subject: fix gsettings again remove g_object_unref add static GSettings* settings add g_signal_connect as substitution for mateconf_client_notify_add --- src/file-share-properties.c | 3 +-- src/user_share.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/file-share-properties.c b/src/file-share-properties.c index 6d0fbd6..0ec5594 100644 --- a/src/file-share-properties.c +++ b/src/file-share-properties.c @@ -46,6 +46,7 @@ #define GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_OBEXPUSH_NOTIFY "bluetooth-notify" static GtkBuilder* builder; +static GSettings* settings; static void @@ -624,8 +625,6 @@ main (int argc, char *argv[]) - g_object_unref (settings); - gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (builder, "user_share_dialog"))); gtk_main (); diff --git a/src/user_share.c b/src/user_share.c index 83f005c..ae7b5ff 100644 --- a/src/user_share.c +++ b/src/user_share.c @@ -63,7 +63,19 @@ static BluetoothClient *client = NULL; static gboolean bluetoothd_enabled = FALSE; #define OBEX_ENABLED (bluetoothd_enabled && has_console) + #define GSETTINGS_SCHEMA "org.mate.FileSharing" +#define GSETTINGS_KEY_FILE_SHARING_ENABLED "enabled" +#define GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_ENABLED "bluetooth-enabled" +#define GSETTINGS_KEY_FILE_SHARING_REQUIRE_PASSWORD "require-password" +#define GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_ALLOW_WRITE "bluetooth-allow-write" +#define GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_REQUIRE_PAIRING "bluetooth-require-pairing" +#define GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_OBEXPUSH_ENABLED "bluetooth-obexpush-enabled" +#define GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_OBEXPUSH_ACCEPT_FILES "bluetooth-accept-files" +#define GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_OBEXPUSH_NOTIFY "bluetooth-notify" + + +static GSettings* settings; static void obex_services_start (void) @@ -477,7 +489,38 @@ main (int argc, char **argv) if (obexpush_init () == FALSE) return 1; - g_object_unref (client); + g_signal_connect (settings, + "changed::" GSETTINGS_KEY_FILE_SHARING_ENABLED, + G_CALLBACK (file_sharing_enabled_changed), NULL); + + g_signal_connect (settings, + "changed::" GSETTINGS_KEY_FILE_SHARING_REQUIRE_PASSWORD, + G_CALLBACK (require_password_changed), NULL); + + g_signal_connect (settings, + "changed::" GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_ENABLED, + G_CALLBACK (file_sharing_bluetooth_enabled_changed), NULL); + + g_signal_connect (settings, + "changed::" GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_ALLOW_WRITE, + G_CALLBACK (file_sharing_bluetooth_allow_write_changed), NULL); + + g_signal_connect (settings, + "changed::" GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_REQUIRE_PAIRING, + G_CALLBACK (file_sharing_bluetooth_require_pairing_changed), NULL); + + g_signal_connect (settings, + "changed::" GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_OBEXPUSH_ENABLED, + G_CALLBACK (file_sharing_bluetooth_obexpush_enabled_changed), NULL); + + g_signal_connect (settings, + "changed::" GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_OBEXPUSH_ACCEPT_FILES, + G_CALLBACK (file_sharing_bluetooth_obexpush_accept_files_changed), NULL); + + g_signal_connect (settings, + "changed::" GSETTINGS_KEY_FILE_SHARING_BLUETOOTH_OBEXPUSH_NOTIFY, + G_CALLBACK (file_sharing_bluetooth_obexpush_notify_changed), NULL); + bluez_init (); consolekit_init (); -- cgit v1.2.1