[rhythmbox] daap: Fix warnings when configuring music sharing
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] daap: Fix warnings when configuring music sharing
- Date: Wed, 15 Jun 2016 12:12:35 +0000 (UTC)
commit 2ef1ca8e191ff28f9d206695f41a21efc71e5dad
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jun 9 19:11:07 2016 +0200
daap: Fix warnings when configuring music sharing
Even though both "plugin" instances we get for the main plugin and the
configuration widget are RbDaapPlugin types, they're separate instances.
So we cannot expect ->builder to be available in the main plugin.
https://bugzilla.gnome.org/show_bug.cgi?id=767466
plugins/daap/rb-daap-plugin.c | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/plugins/daap/rb-daap-plugin.c b/plugins/daap/rb-daap-plugin.c
index fd62d34..6f7119d 100644
--- a/plugins/daap/rb-daap-plugin.c
+++ b/plugins/daap/rb-daap-plugin.c
@@ -449,16 +449,6 @@ settings_changed_cb (GSettings *settings, const char *key, RBDaapPlugin *plugin)
} else {
stop_browsing (plugin);
}
- } else if (g_strcmp0 (key, "enable-sharing") == 0) {
- GtkToggleButton *password_check;
- GtkWidget *password_entry;
- gboolean enabled = g_settings_get_boolean (settings, key);
-
- password_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (plugin->builder,
"daap_password_check"));
- password_entry = GTK_WIDGET (gtk_builder_get_object (plugin->builder, "daap_password_entry"));
-
- gtk_widget_set_sensitive (password_entry, enabled && gtk_toggle_button_get_active
(password_check));
- gtk_widget_set_sensitive (GTK_WIDGET (password_check), enabled);
}
}
@@ -679,6 +669,22 @@ share_password_entry_focus_out_event_cb (GtkEntry *entry,
}
static void
+config_settings_changed_cb (GSettings *settings, const char *key, RBDaapPlugin *plugin)
+{
+ if (g_strcmp0 (key, "enable-sharing") == 0) {
+ GtkToggleButton *password_check;
+ GtkWidget *password_entry;
+ gboolean enabled = g_settings_get_boolean (settings, key);
+
+ password_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (plugin->builder,
"daap_password_check"));
+ password_entry = GTK_WIDGET (gtk_builder_get_object (plugin->builder, "daap_password_entry"));
+
+ gtk_widget_set_sensitive (password_entry, enabled && gtk_toggle_button_get_active
(password_check));
+ gtk_widget_set_sensitive (GTK_WIDGET (password_check), enabled);
+ }
+}
+
+static void
update_config_widget (RBDaapPlugin *plugin)
{
GtkWidget *check;
@@ -700,6 +706,8 @@ update_config_widget (RBDaapPlugin *plugin)
g_settings_bind (plugin->settings, "enable-sharing", check, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind (plugin->dacp_settings, "enable-remote", remote_check, "active",
G_SETTINGS_BIND_DEFAULT);
+ g_signal_connect_object (plugin->settings, "changed", G_CALLBACK (config_settings_changed_cb),
plugin, 0);
+
/*g_signal_connect (check, "toggled", G_CALLBACK (share_check_button_toggled_cb), plugin->builder);*/
/* probably needs rethinking to deal with remotes.. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]