[rhythmbox] port plugins to use GSettings
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] port plugins to use GSettings
- Date: Sat, 9 Apr 2011 07:22:15 +0000 (UTC)
commit 6fe21e1bbcfaa76f4b9920befc128ce78082f30e
Author: Jonathan Matthew <jonathan d14n org>
Date: Sat Apr 9 17:15:19 2011 +1000
port plugins to use GSettings
.../artdisplay/artdisplay/LastFMCoverArtSearch.py | 18 +-
plugins/audiocd/rb-audiocd-source.c | 7 +-
plugins/audioscrobbler/Makefile.am | 1 -
plugins/audioscrobbler/audioscrobbler-radio-ui.xml | 2 +-
plugins/audioscrobbler/rb-audioscrobbler-account.c | 11 -
plugins/audioscrobbler/rb-audioscrobbler-plugin.c | 104 +++++----
.../rb-audioscrobbler-profile-page.c | 68 +++---
.../rb-audioscrobbler-radio-source.c | 2 +-
plugins/audioscrobbler/rb-audioscrobbler-service.h | 7 +
plugins/audioscrobbler/rb-audioscrobbler.c | 3 -
plugins/context/context/ContextView.py | 2 +-
plugins/context/context/LastFM.py | 17 +-
plugins/daap/rb-daap-plugin.c | 244 +++++++-------------
plugins/daap/rb-daap-sharing.c | 189 +++++-----------
plugins/daap/rb-daap-source.c | 44 ++---
plugins/daap/rb-dacp-pairing-page.c | 57 +++--
plugins/daap/rb-dacp-pairing-page.h | 4 -
plugins/daap/rb-dmap-container-db-adapter.c | 5 +-
.../rb-dbus-media-server-plugin.c | 12 +-
plugins/fmradio/rb-fm-radio-source.c | 16 +-
plugins/generic-player/rb-generic-player-source.c | 5 +-
plugins/generic-player/rb-nokia770-source.c | 1 -
plugins/generic-player/rb-psp-source.c | 1 -
plugins/ipod/rb-ipod-source.c | 27 +--
plugins/iradio/rb-iradio-source.c | 190 ++++-----------
plugins/jamendo/jamendo/JamendoConfigureDialog.py | 15 +-
plugins/jamendo/jamendo/JamendoSource.py | 15 +-
plugins/lyrics/lyrics/LyricsConfigureDialog.py | 25 +--
plugins/lyrics/lyrics/LyricsParse.py | 11 +-
plugins/lyrics/lyrics/__init__.py | 13 +-
plugins/magnatune/magnatune/MagnatuneSource.py | 20 +-
plugins/magnatune/magnatune/__init__.py | 22 +--
plugins/mtpdevice/rb-mtp-source.c | 26 +--
plugins/pythonconsole/pythonconsole.py | 13 +-
plugins/rb/__init__.py | 16 --
plugins/replaygain/Makefile.am | 6 +-
plugins/replaygain/replaygain-prefs.ui | 32 ++--
plugins/replaygain/replaygain/config.py | 37 +---
plugins/replaygain/replaygain/player.py | 15 +-
39 files changed, 508 insertions(+), 795 deletions(-)
---
diff --git a/plugins/artdisplay/artdisplay/LastFMCoverArtSearch.py b/plugins/artdisplay/artdisplay/LastFMCoverArtSearch.py
index 00d448c..2690649 100644
--- a/plugins/artdisplay/artdisplay/LastFMCoverArtSearch.py
+++ b/plugins/artdisplay/artdisplay/LastFMCoverArtSearch.py
@@ -27,9 +27,10 @@
import urllib
import xml.dom.minidom as dom
import re
+import ConfigParser
+import os
import rb
-from gi.repository import GConf
from gi.repository import RB
# this API key belongs to jonathan d14n org
@@ -51,11 +52,18 @@ DISC_NUMBER_REGEXS = (
" cd *[0-9]+$"
)
-USERNAME_GCONF_KEY = "/apps/rhythmbox/audioscrobbler/username"
-
def user_has_account():
- username = GConf.Client.get_default().get_string(USERNAME_GCONF_KEY)
- return (username is not None and username != "")
+ session_file = os.path.join(RB.user_data_dir(), "audioscrobbler", "sessions")
+
+ if os.path.exists(session_file) == False:
+ return False
+
+ sessions = ConfigParser.RawConfigParser()
+ sessions.read(session_file)
+ try:
+ return (sessions.get('Last.fm', 'username') != "")
+ except:
+ return False
class LastFMCoverArtSearch (object):
def __init__(self):
diff --git a/plugins/audiocd/rb-audiocd-source.c b/plugins/audiocd/rb-audiocd-source.c
index 4872a5e..9c36402 100644
--- a/plugins/audiocd/rb-audiocd-source.c
+++ b/plugins/audiocd/rb-audiocd-source.c
@@ -41,7 +41,6 @@
#include "rb-plugin.h"
#include "rhythmdb.h"
-#include "eel-gconf-extensions.h"
#include "rb-shell.h"
#include "rb-audiocd-source.h"
#include "rb-util.h"
@@ -452,6 +451,7 @@ rb_audiocd_source_new (RBPlugin *plugin,
GVolume *volume)
{
GObject *source;
+ GSettings *settings;
RhythmDBEntryType *entry_type;
RhythmDB *db;
char *name;
@@ -473,13 +473,16 @@ rb_audiocd_source_new (RBPlugin *plugin,
g_object_unref (db);
g_free (name);
+ settings = g_settings_new ("org.gnome.rhythmbox.plugins.audiocd");
source = g_object_new (RB_TYPE_AUDIOCD_SOURCE,
"entry-type", entry_type,
"volume", volume,
"shell", shell,
- "sorting-key", NULL,
"plugin", plugin,
+ "show-browser", FALSE,
+ "settings", g_settings_get_child (settings, "source"),
NULL);
+ g_object_unref (settings);
rb_shell_register_entry_type_for_source (shell, RB_SOURCE (source), entry_type);
diff --git a/plugins/audioscrobbler/Makefile.am b/plugins/audioscrobbler/Makefile.am
index 747b7c2..fbcff38 100644
--- a/plugins/audioscrobbler/Makefile.am
+++ b/plugins/audioscrobbler/Makefile.am
@@ -65,7 +65,6 @@ uixml_DATA = \
audioscrobbler-profile-ui.xml \
audioscrobbler-radio-ui.xml
-
plugin_in_files = audioscrobbler.rb-plugin.in
%.rb-plugin: %.rb-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
diff --git a/plugins/audioscrobbler/audioscrobbler-radio-ui.xml b/plugins/audioscrobbler/audioscrobbler-radio-ui.xml
index 34604e5..6b41462 100644
--- a/plugins/audioscrobbler/audioscrobbler-radio-ui.xml
+++ b/plugins/audioscrobbler/audioscrobbler-radio-ui.xml
@@ -1,5 +1,5 @@
<ui>
- <popup name="AudioscrobblerRadioSourcePopup">
+ <popup name="AudioscrobblerRadioPagePopup">
<menuitem name="RenameStation" action="AudioscrobblerRadioRenameStation"/>
<menuitem name="DeleteStation" action="AudioscrobblerRadioDeleteStation"/>
</popup>
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-account.c b/plugins/audioscrobbler/rb-audioscrobbler-account.c
index 519d44b..80b060c 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-account.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-account.c
@@ -38,9 +38,7 @@
#include "rb-builder-helpers.h"
#include "rb-debug.h"
#include "rb-file-helpers.h"
-#include "rb-preferences.h"
#include "rb-util.h"
-#include "eel-gconf-extensions.h"
#define SESSION_SETTINGS_FILE "sessions"
#define SESSION_KEY_REQUEST_TIMEOUT 5
@@ -395,15 +393,6 @@ save_session_settings (RBAudioscrobblerAccount *account)
} else {
g_key_file_remove_group (key_file, service_name, NULL);
}
-
- /* If Last.fm, set the username in gconf to allow other plugins,
- * such as cover art and context pane, to make use of it.
- */
- if (strcmp (service_name, "Last.fm") == 0) {
- eel_gconf_set_string (CONF_AUDIOSCROBBLER_USERNAME,
- account->priv->username != NULL ? account->priv->username : "");
- }
-
g_free (service_name);
data = g_key_file_to_data (key_file, &data_length, NULL);
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
index 851f5ce..f660561 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
@@ -35,7 +35,6 @@
#include <glib.h>
#include <glib-object.h>
-#include <lib/eel-gconf-extensions.h>
#include <lib/rb-builder-helpers.h>
#include <lib/rb-debug.h>
#include <sources/rb-display-page-group.h>
@@ -45,7 +44,6 @@
#include "rb-audioscrobbler-service.h"
#include "rb-audioscrobbler-profile-page.h"
-
#define RB_TYPE_AUDIOSCROBBLER_PLUGIN (rb_audioscrobbler_plugin_get_type ())
#define RB_AUDIOSCROBBLER_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_AUDIOSCROBBLER_PLUGIN, RBAudioscrobblerPlugin))
#define RB_AUDIOSCROBBLER_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_AUDIOSCROBBLER_PLUGIN, RBAudioscrobblerPluginClass))
@@ -53,10 +51,6 @@
#define RB_IS_AUDIOSCROBBLER_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_AUDIOSCROBBLER_PLUGIN))
#define RB_AUDIOSCROBBLER_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_AUDIOSCROBBLER_PLUGIN, RBAudioscrobblerPluginClass))
-#define CONF_AUDIOSCROBBLER_PREFIX CONF_PREFIX "/plugins/audioscrobbler"
-#define CONF_LASTFM_ENABLED CONF_AUDIOSCROBBLER_PREFIX "/Last.fm/enabled"
-#define CONF_LIBREFM_ENABLED CONF_AUDIOSCROBBLER_PREFIX "/Libre.fm/enabled"
-
typedef struct
{
RBPlugin parent;
@@ -65,13 +59,13 @@ typedef struct
GtkWidget *config_dialog;
/* Last.fm */
+ GSettings *lastfm_settings;
GtkWidget *lastfm_enabled_check;
- guint lastfm_enabled_notification_id;
RBDisplayPage *lastfm_page;
/* Libre.fm */
+ GSettings *librefm_settings;
GtkWidget *librefm_enabled_check;
- guint librefm_enabled_notification_id;
RBDisplayPage *librefm_page;
} RBAudioscrobblerPlugin;
@@ -83,8 +77,6 @@ typedef struct
G_MODULE_EXPORT GType register_rb_plugin (GTypeModule *module);
GType rb_audioscrobbler_plugin_get_type (void) G_GNUC_CONST;
-
-
static void rb_audioscrobbler_plugin_init (RBAudioscrobblerPlugin *plugin);
static void rb_audioscrobbler_plugin_finalize (GObject *object);
static void impl_activate (RBPlugin *plugin, RBShell *shell);
@@ -95,16 +87,14 @@ void config_dialog_response_cb (GtkWidget *dialog, gint response,
RBAudioscrobblerPlugin *plugin);
void lastfm_enabled_check_toggled_cb (GtkToggleButton *togglebutton,
RBAudioscrobblerPlugin *plugin);
-static void lastfm_enabled_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBAudioscrobblerPlugin *plugin);
+static void lastfm_settings_changed_cb (GSettings *settings,
+ const char *key,
+ RBAudioscrobblerPlugin *plugin);
void librefm_enabled_check_toggled_cb (GtkToggleButton *togglebutton,
RBAudioscrobblerPlugin *plugin);
-static void librefm_enabled_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBAudioscrobblerPlugin *plugin);
+static void librefm_settings_changed_cb (GSettings *settings,
+ const char *key,
+ RBAudioscrobblerPlugin *plugin);
RB_PLUGIN_REGISTER(RBAudioscrobblerPlugin, rb_audioscrobbler_plugin)
@@ -139,19 +129,23 @@ static void
impl_activate (RBPlugin *bplugin,
RBShell *shell)
{
+ gboolean enabled;
RBAudioscrobblerPlugin *plugin;
+
plugin = RB_AUDIOSCROBBLER_PLUGIN (bplugin);
plugin->shell = shell;
init_config_dialog (plugin);
- plugin->lastfm_enabled_notification_id =
- eel_gconf_notification_add (CONF_LASTFM_ENABLED,
- (GConfClientNotifyFunc) lastfm_enabled_changed_cb,
- plugin);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->lastfm_enabled_check),
- eel_gconf_get_boolean (CONF_LASTFM_ENABLED));
- if (eel_gconf_get_boolean (CONF_LASTFM_ENABLED) == TRUE) {
+ plugin->lastfm_settings = g_settings_new_with_path (AUDIOSCROBBLER_SETTINGS_SCHEMA,
+ AUDIOSCROBBLER_SETTINGS_PATH "/Last.fm");
+ g_signal_connect_object (plugin->lastfm_settings,
+ "changed",
+ G_CALLBACK (lastfm_settings_changed_cb),
+ plugin, 0);
+ enabled = g_settings_get_boolean (plugin->lastfm_settings, AUDIOSCROBBLER_SERVICE_ENABLED_KEY);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->lastfm_enabled_check), enabled);
+ if (enabled) {
RBAudioscrobblerService *lastfm;
lastfm = rb_audioscrobbler_service_new_lastfm ();
plugin->lastfm_page = rb_audioscrobbler_profile_page_new (plugin->shell,
@@ -160,13 +154,15 @@ impl_activate (RBPlugin *bplugin,
g_object_unref (lastfm);
}
- plugin->librefm_enabled_notification_id =
- eel_gconf_notification_add (CONF_LIBREFM_ENABLED,
- (GConfClientNotifyFunc) librefm_enabled_changed_cb,
- plugin);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->librefm_enabled_check),
- eel_gconf_get_boolean (CONF_LIBREFM_ENABLED));
- if (eel_gconf_get_boolean (CONF_LIBREFM_ENABLED) == TRUE) {
+ plugin->librefm_settings = g_settings_new_with_path (AUDIOSCROBBLER_SETTINGS_SCHEMA,
+ AUDIOSCROBBLER_SETTINGS_PATH "/Libre.fm");
+ g_signal_connect_object (plugin->librefm_settings,
+ "changed",
+ G_CALLBACK (librefm_settings_changed_cb),
+ plugin, 0);
+ enabled = g_settings_get_boolean (plugin->librefm_settings, AUDIOSCROBBLER_SERVICE_ENABLED_KEY);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->librefm_enabled_check), enabled);
+ if (enabled) {
RBAudioscrobblerService *librefm;
librefm = rb_audioscrobbler_service_new_librefm ();
plugin->librefm_page = rb_audioscrobbler_profile_page_new (plugin->shell,
@@ -187,11 +183,21 @@ impl_deactivate (RBPlugin *bplugin,
plugin->config_dialog = NULL;
}
+ if (plugin->lastfm_settings != NULL) {
+ g_object_unref (plugin->lastfm_settings);
+ plugin->lastfm_settings = NULL;
+ }
+
if (plugin->lastfm_page != NULL) {
rb_display_page_delete_thyself (plugin->lastfm_page);
plugin->lastfm_page = NULL;
}
+ if (plugin->librefm_settings != NULL) {
+ g_object_unref (plugin->librefm_settings);
+ plugin->librefm_settings = NULL;
+ }
+
if (plugin->librefm_page != NULL) {
rb_display_page_delete_thyself (plugin->librefm_page);
plugin->librefm_page = NULL;
@@ -251,19 +257,22 @@ void
lastfm_enabled_check_toggled_cb (GtkToggleButton *togglebutton,
RBAudioscrobblerPlugin *plugin)
{
- eel_gconf_set_boolean (CONF_LASTFM_ENABLED,
- gtk_toggle_button_get_active (togglebutton));
+ g_settings_set_boolean (plugin->lastfm_settings,
+ AUDIOSCROBBLER_SERVICE_ENABLED_KEY,
+ gtk_toggle_button_get_active (togglebutton));
}
static void
-lastfm_enabled_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBAudioscrobblerPlugin *plugin)
+lastfm_settings_changed_cb (GSettings *settings,
+ const char *key,
+ RBAudioscrobblerPlugin *plugin)
{
gboolean enabled;
- enabled = gconf_value_get_bool (entry->value);
+ if (g_strcmp0 (key, AUDIOSCROBBLER_SERVICE_ENABLED_KEY) != 0) {
+ return;
+ }
+ enabled = g_settings_get_boolean (settings, key);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->lastfm_enabled_check),
enabled);
if (enabled == TRUE && plugin->lastfm_page == NULL) {
@@ -283,19 +292,22 @@ void
librefm_enabled_check_toggled_cb (GtkToggleButton *togglebutton,
RBAudioscrobblerPlugin *plugin)
{
- eel_gconf_set_boolean (CONF_LIBREFM_ENABLED,
- gtk_toggle_button_get_active (togglebutton));
+ g_settings_set_boolean (plugin->librefm_settings,
+ AUDIOSCROBBLER_SERVICE_ENABLED_KEY,
+ gtk_toggle_button_get_active (togglebutton));
}
static void
-librefm_enabled_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBAudioscrobblerPlugin *plugin)
+librefm_settings_changed_cb (GSettings *settings,
+ const char *key,
+ RBAudioscrobblerPlugin *plugin)
{
gboolean enabled;
- enabled = gconf_value_get_bool (entry->value);
+ if (g_strcmp0 (key, AUDIOSCROBBLER_SERVICE_ENABLED_KEY) != 0) {
+ return;
+ }
+ enabled = g_settings_get_boolean (settings, key);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->librefm_enabled_check),
enabled);
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c b/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
index eec7c1c..457c0f1 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
@@ -35,11 +35,9 @@
#include <json-glib/json-glib.h>
#include <math.h>
-#include <lib/eel-gconf-extensions.h>
#include <lib/rb-debug.h>
#include <lib/rb-builder-helpers.h>
#include <lib/rb-file-helpers.h>
-#include <lib/rb-preferences.h>
#include <lib/rb-util.h>
#include <sources/rb-display-page-tree.h>
#include <sources/rb-display-page-group.h>
@@ -51,13 +49,13 @@
#include "rb-audioscrobbler-radio-source.h"
#include "rb-audioscrobbler-radio-track-entry-type.h"
-#define CONF_AUDIOSCROBBLER_ENABLE_SCROBBLING CONF_PLUGINS_PREFIX "/audioscrobbler/%s/scrobbling_enabled"
#define AUDIOSCROBBLER_PROFILE_PAGE_POPUP_PATH "/AudioscrobblerProfilePagePopup"
struct _RBAudioscrobblerProfilePagePrivate {
RBAudioscrobblerService *service;
RBAudioscrobblerAccount *account;
RBAudioscrobbler *audioscrobbler;
+ GSettings *settings;
/* Used to request the user's profile data */
RBAudioscrobblerUser *user;
@@ -150,9 +148,8 @@ static void login_status_change_cb (RBAudioscrobblerAccount *account,
/* scrobbling enabled preference */
void scrobbling_enabled_check_toggled_cb (GtkToggleButton *togglebutton,
RBAudioscrobblerProfilePage *page);
-static void scrobbling_enabled_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+static void scrobbler_settings_changed_cb (GSettings *settings,
+ const char *key,
RBAudioscrobblerProfilePage *page);
/* callbacks from scrobbler object */
@@ -339,8 +336,8 @@ rb_audioscrobbler_profile_page_constructed (GObject *object)
{
RBAudioscrobblerProfilePage *page;
RBShell *shell;
+ char *scrobbler_settings;
RBShellPlayer *shell_player;
- char *scrobbling_enabled_conf_key;
RB_CHAIN_GOBJECT_METHOD (rb_audioscrobbler_profile_page_parent_class, constructed, object);
@@ -398,23 +395,26 @@ rb_audioscrobbler_profile_page_constructed (GObject *object)
"login-status-changed",
(GCallback)login_status_change_cb,
page);
+ /* scrobbler settings */
+ scrobbler_settings = g_strconcat (AUDIOSCROBBLER_SETTINGS_PATH "/",
+ rb_audioscrobbler_service_get_name (page->priv->service),
+ NULL);
+ page->priv->settings = g_settings_new_with_path (AUDIOSCROBBLER_SETTINGS_SCHEMA,
+ scrobbler_settings);
login_status_change_cb (page->priv->account,
rb_audioscrobbler_account_get_login_status (page->priv->account),
page);
- /* scrobbling enabled gconf stuff */
- scrobbling_enabled_conf_key = g_strdup_printf (CONF_AUDIOSCROBBLER_ENABLE_SCROBBLING,
- rb_audioscrobbler_service_get_name (page->priv->service));
- page->priv->scrobbling_enabled_notification_id =
- eel_gconf_notification_add (scrobbling_enabled_conf_key,
- (GConfClientNotifyFunc) scrobbling_enabled_changed_cb,
- page);
+ g_signal_connect_object (page->priv->settings,
+ "changed",
+ G_CALLBACK (scrobbler_settings_changed_cb),
+ page, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->priv->scrobbling_enabled_check),
- eel_gconf_get_boolean (scrobbling_enabled_conf_key));
-
+ g_settings_get_boolean (page->priv->settings,
+ AUDIOSCROBBLER_SCROBBLING_ENABLED_KEY));
g_object_unref (shell);
- g_free (scrobbling_enabled_conf_key);
+ g_free (scrobbler_settings);
}
static void
@@ -444,9 +444,9 @@ rb_audioscrobbler_profile_page_dispose (GObject* object)
page->priv->user = NULL;
}
- if (page->priv->scrobbling_enabled_notification_id != 0) {
- eel_gconf_notification_remove (page->priv->scrobbling_enabled_notification_id);
- page->priv->scrobbling_enabled_notification_id = 0;
+ if (page->priv->settings != NULL) {
+ g_object_unref (page->priv->settings);
+ page->priv->settings = NULL;
}
if (page->priv->button_to_popup_menu_map != NULL) {
@@ -694,7 +694,6 @@ login_status_change_cb (RBAudioscrobblerAccount *account,
{
const char *username;
const char *session_key;
- char *scrobbling_enabled_conf_key;
char *label_text = NULL;
char *button_text = NULL;
gboolean show_login_bar;
@@ -710,10 +709,8 @@ login_status_change_cb (RBAudioscrobblerAccount *account,
}
/* create new scrobbler if new user has logged in and scrobbling is enabled */
- scrobbling_enabled_conf_key = g_strdup_printf (CONF_AUDIOSCROBBLER_ENABLE_SCROBBLING,
- rb_audioscrobbler_service_get_name (page->priv->service));
if (status == RB_AUDIOSCROBBLER_ACCOUNT_LOGIN_STATUS_LOGGED_IN &&
- eel_gconf_get_boolean (scrobbling_enabled_conf_key)) {
+ g_settings_get_boolean (page->priv->settings, AUDIOSCROBBLER_SCROBBLING_ENABLED_KEY)) {
RBShell *shell;
RBShellPlayer *shell_player;
g_object_get (page, "shell", &shell, NULL);
@@ -799,7 +796,6 @@ login_status_change_cb (RBAudioscrobblerAccount *account,
gtk_widget_hide (page->priv->profile_window);
}
- g_free (scrobbling_enabled_conf_key);
g_free (label_text);
g_free (button_text);
}
@@ -808,22 +804,22 @@ void
scrobbling_enabled_check_toggled_cb (GtkToggleButton *togglebutton,
RBAudioscrobblerProfilePage *page)
{
- char *conf_key;
-
- conf_key = g_strdup_printf (CONF_AUDIOSCROBBLER_ENABLE_SCROBBLING,
- rb_audioscrobbler_service_get_name (page->priv->service));
- eel_gconf_set_boolean (conf_key,
- gtk_toggle_button_get_active (togglebutton));
- g_free (conf_key);
+ g_settings_set_boolean (page->priv->settings,
+ AUDIOSCROBBLER_SCROBBLING_ENABLED_KEY,
+ gtk_toggle_button_get_active (togglebutton));
}
static void
-scrobbling_enabled_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+scrobbler_settings_changed_cb (GSettings *settings,
+ const char *key,
RBAudioscrobblerProfilePage *page)
{
- gboolean enabled = gconf_value_get_bool (entry->value);
+ gboolean enabled;
+ if (g_strcmp0 (key, AUDIOSCROBBLER_SCROBBLING_ENABLED_KEY) != 0) {
+ return;
+ }
+
+ enabled = g_settings_get_boolean (settings, key);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->priv->scrobbling_enabled_check),
enabled);
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c b/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c
index 6390f33..c505a99 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c
@@ -477,7 +477,7 @@ rb_audioscrobbler_radio_source_constructed (GObject *object)
gtk_box_pack_start (GTK_BOX (main_vbox), source->priv->password_info_bar, FALSE, FALSE, 0);
/* entry view */
- source->priv->track_view = rb_entry_view_new (db, G_OBJECT (shell_player), NULL, FALSE, FALSE);
+ source->priv->track_view = rb_entry_view_new (db, G_OBJECT (shell_player), FALSE, FALSE);
rb_entry_view_append_column (source->priv->track_view, RB_ENTRY_VIEW_COL_TITLE, TRUE);
rb_entry_view_append_column (source->priv->track_view, RB_ENTRY_VIEW_COL_ARTIST, FALSE);
rb_entry_view_append_column (source->priv->track_view, RB_ENTRY_VIEW_COL_ALBUM, FALSE);
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-service.h b/plugins/audioscrobbler/rb-audioscrobbler-service.h
index b8d1ed3..5ac91c8 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-service.h
+++ b/plugins/audioscrobbler/rb-audioscrobbler-service.h
@@ -31,6 +31,13 @@
#include <glib-object.h>
+/* not sure these belong here */
+#define AUDIOSCROBBLER_SETTINGS_SCHEMA "org.gnome.rhythmbox.plugins.audioscrobbler.service"
+#define AUDIOSCROBBLER_SETTINGS_PATH "/org/gnome/rhythmbox/plugins/audioscrobbler"
+#define AUDIOSCROBBLER_SERVICE_ENABLED_KEY "enabled"
+#define AUDIOSCROBBLER_SCROBBLING_ENABLED_KEY "scrobbling-enabled"
+
+
G_BEGIN_DECLS
#define RB_TYPE_AUDIOSCROBBLER_SERVICE (rb_audioscrobbler_service_get_type ())
diff --git a/plugins/audioscrobbler/rb-audioscrobbler.c b/plugins/audioscrobbler/rb-audioscrobbler.c
index 8a62426..2aaaf4e 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler.c
@@ -41,17 +41,14 @@
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include <gtk/gtk.h>
-#include <gconf/gconf-value.h>
#include <libsoup/soup.h>
#include <libsoup/soup-gnome.h>
-#include "eel-gconf-extensions.h"
#include "rb-audioscrobbler.h"
#include "rb-debug.h"
#include "rb-file-helpers.h"
#include "rb-builder-helpers.h"
-#include "rb-preferences.h"
#include "rb-shell.h"
#include "rb-shell-player.h"
#include "rb-source.h"
diff --git a/plugins/context/context/ContextView.py b/plugins/context/context/ContextView.py
index 209d569..f9e3a2f 100644
--- a/plugins/context/context/ContextView.py
+++ b/plugins/context/context/ContextView.py
@@ -84,7 +84,7 @@ class ContextView (gobject.GObject):
self.load_top_five (self.ds['artist'])
# Set currently displayed tab
- # TODO: make this persistent via gconf key
+ # TODO: make this persistent via gsettings key
self.current = 'artist'
self.tab[self.current].activate ()
diff --git a/plugins/context/context/LastFM.py b/plugins/context/context/LastFM.py
index ffa673c..9aa0df0 100644
--- a/plugins/context/context/LastFM.py
+++ b/plugins/context/context/LastFM.py
@@ -24,7 +24,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-from gi.repository import GConf
+import ConfigParser
# utility things for dealing with last.fm
@@ -35,11 +35,18 @@ API_KEY = '27151108bfce62e12c1f6341437e0e83'
NO_ACCOUNT_ERROR = _("This information is only available to Last.fm users. Ensure the Last.fm plugin is enabled, select Last.fm in the side pane, and log in.")
-USERNAME_GCONF_KEY = "/apps/rhythmbox/audioscrobbler/username"
-
def user_has_account():
- username = GConf.Client.get_default().get_string(USERNAME_GCONF_KEY)
- return (username is not None and username != "")
+ session_file = os.path.join(RB.user_data_dir(), "audioscrobbler", "sessions")
+
+ if os.path.exists(session_file) == False:
+ return False
+
+ sessions = ConfigParser.RawConfigParser()
+ sessions.read(session_file)
+ try:
+ return (sessions.get('Last.fm', 'username') != "")
+ except:
+ return False
def datasource_link(path):
return "<a href='http://last.fm/'><img src='%s/img/lastfm.png'></a>" % path
diff --git a/plugins/daap/rb-daap-plugin.c b/plugins/daap/rb-daap-plugin.c
index 414f726..6632e1c 100644
--- a/plugins/daap/rb-daap-plugin.c
+++ b/plugins/daap/rb-daap-plugin.c
@@ -46,7 +46,6 @@
#include "rb-dialog.h"
#include "rb-file-helpers.h"
#include "rb-builder-helpers.h"
-#include "eel-gconf-extensions.h"
#include "rb-daap-source.h"
#include "rb-daap-sharing.h"
#include "rb-daap-src.h"
@@ -56,11 +55,6 @@
#include <libdmapsharing/dmap.h>
-/* preferences */
-#define CONF_DAAP_PREFIX CONF_PREFIX "/plugins/daap"
-#define CONF_ENABLE_BROWSING CONF_DAAP_PREFIX "/enable_browsing"
-#define CONF_ENABLE_REMOTE CONF_DAAP_PREFIX "/enable_remote"
-
#define DAAP_DBUS_PATH "/org/gnome/Rhythmbox/DAAP"
#define DAAP_DBUS_IFACE "org.gnome.Rhythmbox.DAAP"
@@ -97,8 +91,8 @@ struct RBDaapPluginPrivate
GHashTable *source_lookup;
- guint enable_browsing_notify_id;
- guint enable_remote_notify_id;
+ GSettings *settings;
+ GSettings *dacp_settings;
GdkPixbuf *daap_share_pixbuf;
GdkPixbuf *daap_share_locked_pixbuf;
@@ -133,14 +127,12 @@ static void rb_daap_plugin_cmd_connect (GtkAction *action, RBDaapPlugin *plugin)
static void create_pixbufs (RBDaapPlugin *plugin);
static void start_browsing (RBDaapPlugin *plugin);
static void stop_browsing (RBDaapPlugin *plugin);
-static void enable_browsing_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBDaapPlugin *plugin);
-static void enable_remote_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBDaapPlugin *plugin);
+static void settings_changed_cb (GSettings *settings,
+ const char *key,
+ RBDaapPlugin *plugin);
+static void dacp_settings_changed_cb (GSettings *settings,
+ const char *key,
+ RBDaapPlugin *plugin);
static void libdmapsharing_debug (const char *domain,
GLogLevelFlags level,
const char *message,
@@ -259,12 +251,9 @@ impl_activate (RBPlugin *bplugin,
{
RBDaapPlugin *plugin = RB_DAAP_PLUGIN (bplugin);
gboolean no_registration;
- gboolean enabled = TRUE;
- gboolean remote_enabled = TRUE;
- GConfValue *value;
- GConfClient *client = eel_gconf_client_get_global ();
GtkUIManager *uimanager = NULL;
char *uifile;
+ GSettings *daap_settings;
plugin->priv->shutdown = FALSE;
plugin->priv->shell = g_object_ref (shell);
@@ -274,40 +263,18 @@ impl_activate (RBPlugin *bplugin,
libdmapsharing_debug,
NULL);
- value = gconf_client_get_without_default (client,
- CONF_ENABLE_BROWSING, NULL);
- if (value != NULL) {
- enabled = gconf_value_get_bool (value);
- gconf_value_free (value);
- }
-
- if (enabled) {
- start_browsing (plugin);
- }
+ plugin->priv->settings = g_settings_new ("org.gnome.rhythmbox.sharing");
+ g_signal_connect_object (plugin->priv->settings, "changed", G_CALLBACK (settings_changed_cb), plugin, 0);
- plugin->priv->enable_browsing_notify_id =
- eel_gconf_notification_add (CONF_ENABLE_BROWSING,
- (GConfClientNotifyFunc) enable_browsing_changed_cb,
- plugin);
-
- /* Check if Remote (DACP) lookup is enabled */
- value = gconf_client_get_without_default (client,
- CONF_ENABLE_REMOTE, NULL);
- if (value != NULL) {
- remote_enabled = gconf_value_get_bool (value);
- gconf_value_free (value);
- }
+ daap_settings = g_setting_new ("org.gnome.rhythmbox.plugins.daap");
+ plugin->priv->dacp_settings = g_settings_get_child (daap_settings, "dacp");
+ g_object_unref (daap_settings);
+ g_signal_connect_object (plugin->priv->dacp_settings, "changed", G_CALLBACK (dacp_settings_changed_cb), plugin, 0);
- plugin->priv->dacp_share = rb_daap_create_dacp_share (RB_PLUGIN (plugin));
- if (remote_enabled) {
- dacp_share_start_lookup (plugin->priv->dacp_share);
+ if (g_settings_get_boolean (plugin->priv->settings, "enable-browsing")) {
+ start_browsing (plugin);
}
- plugin->priv->enable_remote_notify_id =
- eel_gconf_notification_add (CONF_ENABLE_REMOTE,
- (GConfClientNotifyFunc) enable_remote_changed_cb,
- plugin);
-
create_pixbufs (plugin);
g_object_get (shell,
@@ -348,6 +315,11 @@ impl_activate (RBPlugin *bplugin,
if (plugin->priv->sharing)
rb_daap_sharing_init (shell);
+ plugin->priv->dacp_share = rb_daap_create_dacp_share (RB_PLUGIN (plugin));
+ if (g_settings_get_boolean (plugin->priv->dacp_settings, "enable-remote")) {
+ dacp_share_start_lookup (plugin->priv->dacp_share);
+ }
+
register_daap_dbus_iface (plugin);
}
@@ -370,18 +342,13 @@ impl_deactivate (RBPlugin *bplugin,
stop_browsing (plugin);
}
- if (plugin->priv->enable_browsing_notify_id != EEL_GCONF_UNDEFINED_CONNECTION) {
- eel_gconf_notification_remove (plugin->priv->enable_browsing_notify_id);
- plugin->priv->enable_browsing_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
+ if (plugin->priv->settings) {
+ g_object_unref (plugin->priv->settings);
+ plugin->priv->settings = NULL;
}
g_object_unref (plugin->priv->dacp_share);
- if (plugin->priv->enable_remote_notify_id != EEL_GCONF_UNDEFINED_CONNECTION) {
- eel_gconf_notification_remove (plugin->priv->enable_remote_notify_id);
- plugin->priv->enable_remote_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
- }
-
g_object_get (shell,
"ui-manager", &uimanager,
NULL);
@@ -655,32 +622,36 @@ stop_browsing (RBDaapPlugin *plugin)
}
static void
-enable_browsing_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBDaapPlugin *plugin)
+dacp_settings_changed_cb (GSettings *settings, const char *key, RBDaapPlugin *plugin)
{
- gboolean enabled = eel_gconf_get_boolean (CONF_ENABLE_BROWSING);
-
- if (enabled) {
- start_browsing (plugin);
- } else {
- stop_browsing (plugin);
+ if (g_strcmp0 (key, "enable-remote") == 0) {
+ if (g_settings_get_boolean (settings, key)) {
+ dacp_share_start_lookup (plugin->priv->dacp_share);
+ } else {
+ dacp_share_stop_lookup (plugin->priv->dacp_share);
+ }
}
}
static void
-enable_remote_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBDaapPlugin *plugin)
+settings_changed_cb (GSettings *settings, const char *key, RBDaapPlugin *plugin)
{
- gboolean enabled = eel_gconf_get_boolean (CONF_ENABLE_REMOTE);
+ if (g_strcmp0 (key, "enable-browsing") == 0) {
+ if (g_settings_get_boolean (settings, key)) {
+ start_browsing (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);
- if (enabled) {
- dacp_share_start_lookup (plugin->priv->dacp_share);
- } else {
- dacp_share_stop_lookup (plugin->priv->dacp_share);
+ password_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (plugin->priv->builder, "daap_password_check"));
+ password_entry = GTK_WIDGET (gtk_builder_get_object (plugin->priv->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);
}
}
@@ -809,66 +780,23 @@ preferences_response_cb (GtkWidget *dialog, gint response, RBPlugin *plugin)
}
static void
-share_check_button_toggled_cb (GtkToggleButton *button,
- GtkBuilder *builder)
-{
- gboolean b;
- GtkToggleButton *password_check;
- GtkWidget *password_entry;
-
- b = gtk_toggle_button_get_active (button);
-
- eel_gconf_set_boolean (CONF_DAAP_ENABLE_SHARING, b);
-
- password_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "daap_password_check"));
- password_entry = GTK_WIDGET (gtk_builder_get_object (builder, "daap_password_entry"));
-
- gtk_widget_set_sensitive (password_entry, b && gtk_toggle_button_get_active (password_check));
- gtk_widget_set_sensitive (GTK_WIDGET (password_check), b);
-}
-
-static void
-remote_check_button_toggled_cb (GtkToggleButton *button,
- gpointer data)
-{
- gboolean b;
-
- b = gtk_toggle_button_get_active (button);
-
- eel_gconf_set_boolean (CONF_ENABLE_REMOTE, b);
-}
-
-static void
-password_check_button_toggled_cb (GtkToggleButton *button,
- GtkWidget *widget)
-{
- gboolean b;
-
- b = gtk_toggle_button_get_active (button);
-
- eel_gconf_set_boolean (CONF_DAAP_REQUIRE_PASSWORD, b);
-
- gtk_widget_set_sensitive (widget, b);
-}
-
-static void
forget_remotes_button_toggled_cb (GtkToggleButton *button,
- gpointer data)
+ RBDaapPlugin *plugin)
{
- eel_gconf_unset (CONF_KNOWN_REMOTES);
+ g_settings_reset (plugin->priv->dacp_settings, "known-remotes");
}
static gboolean
share_name_entry_focus_out_event_cb (GtkEntry *entry,
GdkEventFocus *event,
- gpointer data)
+ RBDaapPlugin *plugin)
{
gboolean changed;
const char *name;
char *old_name;
name = gtk_entry_get_text (entry);
- old_name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
+ old_name = g_settings_get_string (plugin->priv->settings, "share-name");
if (name == NULL && old_name == NULL) {
changed = FALSE;
@@ -880,8 +808,9 @@ share_name_entry_focus_out_event_cb (GtkEntry *entry,
changed = FALSE;
}
- if (changed)
- eel_gconf_set_string (CONF_DAAP_SHARE_NAME, name);
+ if (changed) {
+ g_settings_set_string (plugin->priv->settings, "share-name", name);
+ }
g_free (old_name);
@@ -891,14 +820,14 @@ share_name_entry_focus_out_event_cb (GtkEntry *entry,
static gboolean
share_password_entry_focus_out_event_cb (GtkEntry *entry,
GdkEventFocus *event,
- gpointer data)
+ RBDaapPlugin *plugin)
{
gboolean changed;
const char *pw;
char *old_pw;
pw = gtk_entry_get_text (entry);
- old_pw = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
+ old_pw = g_settings_get_string (plugin->priv->settings, "share-password");
if (pw == NULL && old_pw == NULL) {
changed = FALSE;
@@ -910,8 +839,9 @@ share_password_entry_focus_out_event_cb (GtkEntry *entry,
changed = FALSE;
}
- if (changed)
- eel_gconf_set_string (CONF_DAAP_SHARE_PASSWORD, pw);
+ if (changed) {
+ g_settings_set_string (plugin->priv->settings, "share-password", pw);
+ }
g_free (old_pw);
@@ -927,9 +857,6 @@ update_config_widget (RBDaapPlugin *plugin)
GtkWidget *password_entry;
GtkWidget *password_check;
GtkWidget *forget_remotes_button;
- gboolean sharing_enabled;
- gboolean remote_enabled;
- gboolean require_password;
char *name;
char *password;
@@ -940,37 +867,44 @@ update_config_widget (RBDaapPlugin *plugin)
password_entry = GTK_WIDGET (gtk_builder_get_object (plugin->priv->builder, "daap_password_entry"));
forget_remotes_button = GTK_WIDGET (gtk_builder_get_object (plugin->priv->builder, "forget_remotes_button"));
- sharing_enabled = eel_gconf_get_boolean (CONF_DAAP_ENABLE_SHARING);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), sharing_enabled);
- g_signal_connect (check, "toggled", G_CALLBACK (share_check_button_toggled_cb), plugin->priv->builder);
+ g_settings_bind (plugin->priv->settings, "enable-sharing", check, "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (plugin->priv->dacp_settings, "enable-remote", remote_check, "active", G_SETTINGS_BIND_DEFAULT);
- remote_enabled = eel_gconf_get_boolean (CONF_ENABLE_REMOTE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (remote_check), remote_enabled);
- g_signal_connect (remote_check, "toggled", G_CALLBACK (remote_check_button_toggled_cb), plugin->priv->builder);
+ /*g_signal_connect (check, "toggled", G_CALLBACK (share_check_button_toggled_cb), plugin->priv->builder);*/
- require_password = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (password_check), require_password);
- g_signal_connect (password_check, "toggled", G_CALLBACK (password_check_button_toggled_cb), password_entry);
+ /* probably needs rethinking to deal with remotes.. */
+ g_settings_bind (plugin->priv->settings, "require-password", password_check, "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (plugin->priv->settings, "require-password", password_entry, "sensitive", G_SETTINGS_BIND_NO_SENSITIVITY);
- g_signal_connect (forget_remotes_button, "clicked", G_CALLBACK (forget_remotes_button_toggled_cb), NULL);
+ g_signal_connect_object (forget_remotes_button, "clicked", G_CALLBACK (forget_remotes_button_toggled_cb), plugin, 0);
- name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
- if (name == NULL || name[0] == '\0')
+ name = g_settings_get_string (plugin->priv->settings, "share-name");
+ if (name == NULL || name[0] == '\0') {
+ g_free (name);
name = rb_daap_sharing_default_share_name ();
- if (name != NULL)
+ }
+ if (name != NULL) {
gtk_entry_set_text (GTK_ENTRY (name_entry), name);
- g_free (name);
- g_signal_connect (name_entry, "focus-out-event",
- G_CALLBACK (share_name_entry_focus_out_event_cb), NULL);
+ g_free (name);
+ }
+ g_signal_connect_object (name_entry,
+ "focus-out-event",
+ G_CALLBACK (share_name_entry_focus_out_event_cb),
+ plugin,
+ 0);
- password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
- if (password != NULL)
+ password = g_settings_get_string (plugin->priv->settings, "share-password");
+ if (password != NULL) {
gtk_entry_set_text (GTK_ENTRY (password_entry), password);
- g_free (password);
- g_signal_connect (password_entry, "focus-out-event",
- G_CALLBACK (share_password_entry_focus_out_event_cb), NULL);
+ g_free (password);
+ }
+ g_signal_connect_object (password_entry,
+ "focus-out-event",
+ G_CALLBACK (share_password_entry_focus_out_event_cb),
+ plugin,
+ 0);
- gtk_widget_set_sensitive (password_entry, require_password);
+ /*gtk_widget_set_sensitive (password_entry, require_password);*/
}
static GtkWidget *
diff --git a/plugins/daap/rb-daap-sharing.c b/plugins/daap/rb-daap-sharing.c
index 4b446fa..4d8e100 100644
--- a/plugins/daap/rb-daap-sharing.c
+++ b/plugins/daap/rb-daap-sharing.c
@@ -32,6 +32,7 @@
#include <string.h>
+#include <gio/gio.h>
#include <glib/gi18n.h>
#include <glib/gprintf.h>
@@ -41,16 +42,11 @@
#include "rb-debug.h"
#include "rb-dialog.h"
#include "rb-playlist-manager.h"
-#include "eel-gconf-extensions.h"
-#include "rb-preferences.h"
#include <libdmapsharing/dmap.h>
static DAAPShare *share = NULL;
-static guint enable_sharing_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
-static guint require_password_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
-static guint share_name_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
-static guint share_password_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
+static GSettings *settings = NULL;
char *
rb_daap_sharing_default_share_name ()
@@ -65,6 +61,20 @@ rb_daap_sharing_default_share_name ()
return g_strdup_printf (_("%s's Music"), real_name);
}
+static gboolean
+share_name_get_mapping (GValue *value, GVariant *variant, gpointer data)
+{
+ const char *name;
+ name = g_variant_get_string (variant, NULL);
+
+ if (name != NULL || name[0] != '\0') {
+ g_value_set_string (value, name);
+ } else {
+ g_value_take_string (value, rb_daap_sharing_default_share_name ());
+ }
+ return TRUE;
+}
+
static void
create_share (RBShell *shell)
{
@@ -79,7 +89,7 @@ create_share (RBShell *shell)
g_assert (share == NULL);
rb_debug ("initialize daap sharing");
- name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
+ name = g_settings_get_string (settings, "share-name");
if (name == NULL || *name == '\0') {
g_free (name);
name = rb_daap_sharing_default_share_name ();
@@ -91,15 +101,24 @@ create_share (RBShell *shell)
db = DMAP_DB (rb_rhythmdb_dmap_db_adapter_new (rdb, RHYTHMDB_ENTRY_TYPE_SONG));
container_db = DMAP_CONTAINER_DB (rb_dmap_container_db_adapter_new (playlist_manager));
- require_password = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD);
+ require_password = g_settings_get_boolean (settings, "require-password");
if (require_password) {
- password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
+ password = g_settings_get_string (settings, "share-password");
} else {
password = NULL;
}
share = daap_share_new (name, password, db, container_db, NULL);
+ g_settings_bind_with_mapping (settings, "share-name",
+ share, "name",
+ G_SETTINGS_BIND_GET,
+ share_name_get_mapping, NULL,
+ NULL, NULL);
+ if (g_settings_get_boolean (settings, "require-password")) {
+ g_settings_bind (settings, "share-password", share, "password", G_SETTINGS_BIND_DEFAULT);
+ }
+
g_object_unref (db);
g_object_unref (container_db);
g_object_unref (rdb);
@@ -110,99 +129,34 @@ create_share (RBShell *shell)
}
static void
-enable_sharing_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBShell *shell)
+sharing_settings_changed_cb (GSettings *settings, const char *key, RBShell *shell)
{
- gboolean enabled;
-
- enabled = eel_gconf_get_boolean (CONF_DAAP_ENABLE_SHARING);
-
- if (enabled) {
- if (share == NULL) {
- create_share (shell);
+ if (g_strcmp0 (key, "enable-sharing") == 0) {
+ gboolean enabled;
+
+ enabled = g_settings_get_boolean (settings, key);
+ if (enabled) {
+ if (share == NULL) {
+ create_share (shell);
+ }
+ } else {
+ if (share != NULL) {
+ rb_debug ("shutting down daap share");
+ g_object_unref (share);
+ share = NULL;
+ }
}
- } else {
- rb_debug ("shutdown daap sharing");
-
- if (share) {
- g_object_unref (share);
+ } else if (g_strcmp0 (key, "require-password") == 0) {
+
+ if (share != NULL) {
+ if (g_settings_get_boolean (settings, key)) {
+ g_settings_bind (settings, "share-password", share, "password", G_SETTINGS_BIND_DEFAULT);
+ } else {
+ g_settings_unbind (share, "password");
+ g_object_set (share, "password", NULL, NULL);
+ }
}
- share = NULL;
- }
-}
-
-static void
-require_password_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBShell *shell)
-{
- gboolean required;
- char *password;
-
- if (share == NULL) {
- return;
- }
-
- required = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD);
-
- if (required) {
- password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
- } else {
- password = NULL;
- }
-
- g_object_set (G_OBJECT (share), "password", password, NULL);
- g_free (password);
-}
-
-static void
-share_name_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBShell *shell)
-{
- char *name;
-
- if (share == NULL) {
- return;
- }
-
- name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
- if (name == NULL || name[0] == '\0') {
- g_free (name);
- name = rb_daap_sharing_default_share_name ();
- }
-
- g_object_set (G_OBJECT (share), "name", name, NULL);
- g_free (name);
-}
-
-static void
-share_password_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBShell *shell)
-{
- gboolean require_password;
- char *password;
-
- if (share == NULL) {
- return;
- }
-
- require_password = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD);
-
- /* Don't do anything unless we require a password */
- if (! require_password) {
- return;
}
-
- password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
- g_object_set (G_OBJECT (share), "password", password, NULL);
- g_free (password);
}
void
@@ -210,26 +164,13 @@ rb_daap_sharing_init (RBShell *shell)
{
g_object_ref (shell);
- if (eel_gconf_get_boolean (CONF_DAAP_ENABLE_SHARING)) {
+ settings = g_settings_new ("org.gnome.rhythmbox.sharing");
+
+ if (g_settings_get_boolean (settings, "enable-sharing")) {
create_share (shell);
}
- enable_sharing_notify_id =
- eel_gconf_notification_add (CONF_DAAP_ENABLE_SHARING,
- (GConfClientNotifyFunc) enable_sharing_changed_cb,
- shell);
- require_password_notify_id =
- eel_gconf_notification_add (CONF_DAAP_REQUIRE_PASSWORD,
- (GConfClientNotifyFunc) require_password_changed_cb,
- shell);
- share_name_notify_id =
- eel_gconf_notification_add (CONF_DAAP_SHARE_NAME,
- (GConfClientNotifyFunc) share_name_changed_cb,
- shell);
- share_password_notify_id =
- eel_gconf_notification_add (CONF_DAAP_SHARE_PASSWORD,
- (GConfClientNotifyFunc) share_password_changed_cb,
- shell);
+ g_signal_connect_object (settings, "changed", G_CALLBACK (sharing_settings_changed_cb), share, 0);
}
void
@@ -242,21 +183,9 @@ rb_daap_sharing_shutdown (RBShell *shell)
share = NULL;
}
- if (enable_sharing_notify_id != EEL_GCONF_UNDEFINED_CONNECTION) {
- eel_gconf_notification_remove (enable_sharing_notify_id);
- enable_sharing_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
- }
- if (require_password_notify_id != EEL_GCONF_UNDEFINED_CONNECTION) {
- eel_gconf_notification_remove (require_password_notify_id);
- require_password_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
- }
- if (share_name_notify_id != EEL_GCONF_UNDEFINED_CONNECTION) {
- eel_gconf_notification_remove (share_name_notify_id);
- share_name_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
- }
- if (share_password_notify_id != EEL_GCONF_UNDEFINED_CONNECTION) {
- eel_gconf_notification_remove (share_password_notify_id);
- share_password_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
+ if (settings) {
+ g_object_unref (settings);
+ settings = NULL;
}
g_object_unref (shell);
diff --git a/plugins/daap/rb-daap-source.c b/plugins/daap/rb-daap-source.c
index bea1f1b..2ab2f46 100644
--- a/plugins/daap/rb-daap-source.c
+++ b/plugins/daap/rb-daap-source.c
@@ -41,14 +41,12 @@
#include "rhythmdb.h"
#include "rb-shell.h"
-#include "eel-gconf-extensions.h"
#include "rb-daap-source.h"
#include "rb-stock-icons.h"
#include "rb-debug.h"
#include "rb-util.h"
#include "rb-file-helpers.h"
#include "rb-dialog.h"
-#include "rb-preferences.h"
#include "rb-daap-src.h"
#include "rb-daap-record-factory.h"
#include "rb-rhythmdb-dmap-db-adapter.h"
@@ -78,17 +76,10 @@ static void rb_daap_source_selected (RBDisplayPage *page);
static gboolean rb_daap_source_show_popup (RBDisplayPage *page);
static void rb_daap_source_get_status (RBDisplayPage *page, char **text, char **progress_text, float *progress);
-static char * rb_daap_source_get_browser_key (RBSource *source);
-static char * rb_daap_source_get_paned_key (RBBrowserSource *source);
-
static void rb_daap_entry_type_class_init (RBDAAPEntryTypeClass *klass);
static void rb_daap_entry_type_init (RBDAAPEntryType *etype);
GType rb_daap_entry_type_get_type (void);
-#define CONF_STATE_SORTING CONF_PREFIX "/state/daap/sorting"
-#define CONF_STATE_PANED_POSITION CONF_PREFIX "/state/daap/paned_position"
-#define CONF_STATE_SHOW_BROWSER CONF_PREFIX "/state/daap/show_browser"
-
struct RBDAAPSourcePrivate
{
GtkActionGroup *action_group;
@@ -190,9 +181,7 @@ rb_daap_source_class_init (RBDAAPSourceClass *klass)
source_class->impl_can_cut = (RBSourceFeatureFunc) rb_false_function;
source_class->impl_can_copy = (RBSourceFeatureFunc) rb_true_function;
source_class->impl_can_delete = (RBSourceFeatureFunc) rb_false_function;
- source_class->impl_get_browser_key = rb_daap_source_get_browser_key;
- browser_source_class->impl_get_paned_key = rb_daap_source_get_paned_key;
browser_source_class->impl_has_drop_support = (RBBrowserSourceFeatureFunc) rb_false_function;
g_object_class_install_property (object_class,
@@ -313,6 +302,7 @@ rb_daap_source_new (RBShell *shell,
GdkPixbuf *icon;
RhythmDB *db;
char *entry_type_name;
+ GSettings *settings;
g_object_get (shell, "db", &db, NULL);
entry_type_name = g_strdup_printf ("daap:%s:%s:%s", service_name, name, host);
@@ -328,6 +318,8 @@ rb_daap_source_new (RBShell *shell,
g_free (entry_type_name);
icon = rb_daap_plugin_get_icon (RB_DAAP_PLUGIN (plugin), password_protected, FALSE);
+
+ settings = g_settings_new ("org.gnome.rhythmbox.plugins.daap");
source = RB_SOURCE (g_object_new (RB_TYPE_DAAP_SOURCE,
"service-name", service_name,
"name", name,
@@ -337,10 +329,11 @@ rb_daap_source_new (RBShell *shell,
"pixbuf", icon,
"shell", shell,
"visibility", TRUE,
- "sorting-key", CONF_STATE_SORTING,
"password-protected", password_protected,
"plugin", RB_PLUGIN (plugin),
+ "settings", g_settings_get_child (settings, "source"),
NULL));
+ g_object_unref (settings);
if (icon != NULL) {
g_object_unref (icon);
@@ -520,7 +513,7 @@ connection_connecting_cb (DMAPConnection *connection,
icon = rb_daap_plugin_get_icon (RB_DAAP_PLUGIN (plugin),
source->priv->password_protected,
is_connected);
- g_object_set (source, "icon", icon, NULL);
+ g_object_set (source, "pixbuf", icon, NULL);
if (icon != NULL) {
g_object_unref (icon);
}
@@ -606,13 +599,16 @@ rb_daap_source_connection_cb (DMAPConnection *connection,
for (l = playlists; l != NULL; l = g_slist_next (l)) {
DMAPPlaylist *playlist = l->data;
RBSource *playlist_source;
- char *sorting_name;
+ char *settings_name;
- /* Construct a unique sorting name for this playlist, as <Share Name>_<Playlist> */
- sorting_name = g_strjoin (NULL, daap_source->priv->service_name, "_", playlist->name, NULL);
+ /* Construct a unique settings name for this playlist, as <Share Name>_<Playlist> */
+ /* XXX disabled for now, not sure it's a good idea */
+ /*settings_name = g_strjoin (NULL, daap_source->priv->service_name, "_", playlist->name, NULL); */
- playlist_source = rb_static_playlist_source_new (shell, playlist->name, sorting_name, FALSE, entry_type);
- g_free (sorting_name);
+ settings_name = "/org/gnome/rhythmbox/plugins/daap/source";
+
+ playlist_source = rb_static_playlist_source_new (shell, playlist->name, settings_name, FALSE, entry_type);
+ /*g_free (settings_name);*/
g_list_foreach (playlist->uris, (GFunc)_add_location_to_playlist, playlist_source);
@@ -781,18 +777,6 @@ rb_daap_source_get_headers (RBDAAPSource *source,
return dmap_connection_get_headers (source->priv->connection, uri);
}
-static char *
-rb_daap_source_get_browser_key (RBSource *source)
-{
- return g_strdup (CONF_STATE_SHOW_BROWSER);
-}
-
-static char *
-rb_daap_source_get_paned_key (RBBrowserSource *source)
-{
- return g_strdup (CONF_STATE_PANED_POSITION);
-}
-
static void
rb_daap_source_get_status (RBDisplayPage *page,
char **text,
diff --git a/plugins/daap/rb-dacp-pairing-page.c b/plugins/daap/rb-dacp-pairing-page.c
index 8ef9a0b..0dc9150 100644
--- a/plugins/daap/rb-dacp-pairing-page.c
+++ b/plugins/daap/rb-dacp-pairing-page.c
@@ -40,14 +40,12 @@
#include "rhythmdb.h"
#include "rb-shell.h"
#include "rb-display-page-group.h"
-#include "eel-gconf-extensions.h"
#include "rb-stock-icons.h"
#include "rb-debug.h"
#include "rb-util.h"
#include "rb-file-helpers.h"
#include "rb-builder-helpers.h"
#include "rb-dialog.h"
-#include "rb-preferences.h"
#include "rb-playlist-manager.h"
#include "rb-shell-player.h"
#include "rb-display-page-model.h"
@@ -82,8 +80,8 @@ static void dacp_remote_added (DACPShare *share, gchar *service_name, gchar *dis
static void dacp_remote_removed (DACPShare *share, gchar *service_name, RBDaapPlugin *plugin);
/* DACPShare signals */
-static gboolean dacp_lookup_guid (DACPShare *share, gchar *guid);
-static void dacp_add_guid (DACPShare *share, gchar *guid);
+static gboolean dacp_lookup_guid (DACPShare *share, gchar *guid, GSettings *settings);
+static void dacp_add_guid (DACPShare *share, gchar *guid, GSettings *settings);
static void dacp_player_updated (RBDACPPlayer *player, DACPShare *share);
@@ -440,6 +438,8 @@ rb_daap_create_dacp_share (RBPlugin *plugin)
DMAPContainerDb *container_db;
RBPlaylistManager *playlist_manager;
RBShell *shell;
+ GSettings *share_settings;
+ GSettings *settings;
gchar *name;
g_object_get (plugin, "shell", &shell, NULL);
@@ -453,23 +453,26 @@ rb_daap_create_dacp_share (RBPlugin *plugin)
player = DACP_PLAYER (rb_dacp_player_new (shell));
- name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
+ share_settings = g_settings_new ("org.gnome.rhythmbox.sharing");
+ name = g_settings_get_string (share_settings, "share-name");
if (name == NULL || *name == '\0') {
g_free (name);
name = rb_daap_sharing_default_share_name ();
}
+ g_object_unref (share_settings);
share = dacp_share_new (name, player, db, container_db);
+ settings = g_settings_new ("org.gnome.rhythmbox.plugins.daap.dacp");
g_signal_connect_object (share,
"add-guid",
G_CALLBACK (dacp_add_guid),
- RB_DAAP_PLUGIN (plugin),
+ settings,
0);
g_signal_connect_object (share,
"lookup-guid",
G_CALLBACK (dacp_lookup_guid),
- RB_DAAP_PLUGIN (plugin),
+ settings,
0);
g_signal_connect_object (share,
@@ -507,32 +510,40 @@ dacp_player_updated (RBDACPPlayer *player,
static void
dacp_add_guid (DACPShare *share,
- gchar *guid)
+ gchar *guid,
+ GSettings *settings)
{
- GSList *known_guids;
+ GVariantBuilder *vb;
+ GVariantIter iter;
+ GVariant *v;
+ const char *g;
- known_guids = eel_gconf_get_string_list (CONF_KNOWN_REMOTES);
- if (g_slist_find_custom (known_guids, guid, (GCompareFunc) g_strcmp0)) {
- g_slist_free (known_guids);
- return;
+ v = g_settings_get_value (settings, "known-remotes");
+
+ vb = g_variant_builder_new (G_VARIANT_TYPE ("as"));
+ g_variant_iter_init (&iter, v);
+ while (g_variant_iter_loop (&iter, "s", &g)) {
+ g_variant_builder_add (vb, "s", g);
}
- known_guids = g_slist_insert_sorted (known_guids, guid, (GCompareFunc) g_strcmp0);
- eel_gconf_set_string_list (CONF_KNOWN_REMOTES, known_guids);
- g_slist_free (known_guids);
+ g_variant_builder_add (vb, "s", guid);
+ g_variant_unref (v);
+
+ g_settings_set_value (settings, "known-remotes", g_variant_builder_end (vb));
+ g_variant_builder_unref (vb);
}
static gboolean
dacp_lookup_guid (DACPShare *share,
- gchar *guid)
+ gchar *guid,
+ GSettings *settings)
{
- GSList *known_guids;
- int found;
-
- known_guids = eel_gconf_get_string_list (CONF_KNOWN_REMOTES);
- found = g_slist_find_custom (known_guids, guid, (GCompareFunc) g_strcmp0) != NULL;
+ char **guids;
+ gboolean found;
- g_slist_free (known_guids);
+ guids = g_settings_get_strv (settings, "known-remotes");
+ found = rb_str_in_strv (guid, (const char **)guids);
+ g_strfreev (guids);
return found;
}
diff --git a/plugins/daap/rb-dacp-pairing-page.h b/plugins/daap/rb-dacp-pairing-page.h
index a8634df..e1db334 100644
--- a/plugins/daap/rb-dacp-pairing-page.h
+++ b/plugins/daap/rb-dacp-pairing-page.h
@@ -38,10 +38,6 @@
G_BEGIN_DECLS
-/* preferences */
-#define CONF_DACP_PREFIX CONF_PREFIX "/plugins/daap"
-#define CONF_KNOWN_REMOTES CONF_DACP_PREFIX "/known_remotes"
-
#define RB_TYPE_DACP_PAIRING_PAGE (rb_dacp_pairing_page_get_type ())
#define RB_DACP_PAIRING_PAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_DACP_PAIRING_PAGE, RBDACPPairingPage))
#define RB_DACP_PAIRING_PAGE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_DACP_PAIRING_PAGE, RBDACPPairingPageClass))
diff --git a/plugins/daap/rb-dmap-container-db-adapter.c b/plugins/daap/rb-dmap-container-db-adapter.c
index e7a4b1a..fce821c 100644
--- a/plugins/daap/rb-dmap-container-db-adapter.c
+++ b/plugins/daap/rb-dmap-container-db-adapter.c
@@ -171,7 +171,10 @@ rb_dmap_container_db_adapter_new (RBPlaylistManager *playlist_manager)
* general-purpose RBPlaylistSource class:
*/
if (playlists != NULL && playlists->data != NULL) {
- g_list_foreach (playlists, (GFunc) assign_id, NULL);
+ GList *l;
+ for (l = playlists; l != NULL; l = l->next) {
+ assign_id (playlist_manager, RB_SOURCE (l->data));
+ }
}
g_signal_connect (G_OBJECT (playlist_manager),
diff --git a/plugins/dbus-media-server/rb-dbus-media-server-plugin.c b/plugins/dbus-media-server/rb-dbus-media-server-plugin.c
index 009d9e4..69de16a 100644
--- a/plugins/dbus-media-server/rb-dbus-media-server-plugin.c
+++ b/plugins/dbus-media-server/rb-dbus-media-server-plugin.c
@@ -36,7 +36,6 @@
#include <glib-object.h>
#include <gio/gio.h>
-#include <lib/eel-gconf-extensions.h>
#include <lib/rb-util.h>
#include <lib/rb-debug.h>
#include <shell/rb-plugin.h>
@@ -85,6 +84,7 @@ typedef struct
GList *sources;
GList *categories;
+ GSettings *settings;
RBShell *shell;
RhythmDB *db;
RBDisplayPageModel *display_page_model;
@@ -1258,8 +1258,9 @@ get_root_property (GDBusConnection *connection,
} else if (g_strcmp0 (property_name, "Path") == 0) {
return g_variant_new_string (object_path);
} else if (g_strcmp0 (property_name, "DisplayName") == 0) {
- char *share_name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
+ char *share_name = g_settings_get_string (plugin->settings, "share-name");
if (share_name == NULL || share_name[0] == '\0') {
+ g_free (share_name);
share_name = g_strdup ("@REALNAME@'s Rhythmbox on @HOSTNAME@");
}
v = g_variant_new_string (share_name);
@@ -1427,6 +1428,8 @@ impl_activate (RBPlugin *bplugin,
NULL);
plugin->shell = g_object_ref (shell);
+ plugin->settings = g_settings_new ("org.gnome.rhythmbox.sharing");
+
plugin->node_info = g_dbus_node_info_new_for_xml (media_server2_spec, &error);
if (error != NULL) {
g_warning ("Unable to parse MediaServer2 spec: %s", error->message);
@@ -1518,6 +1521,11 @@ impl_deactivate (RBPlugin *bplugin,
plugin->entry_reg_id = 0;
}
+ if (plugin->settings != NULL) {
+ g_object_unref (plugin->settings);
+ plugin->settings = NULL;
+ }
+
if (plugin->display_page_model != NULL) {
g_signal_handlers_disconnect_by_func (plugin->display_page_model,
display_page_inserted_cb,
diff --git a/plugins/fmradio/rb-fm-radio-source.c b/plugins/fmradio/rb-fm-radio-source.c
index 2dad6a2..61f9de5 100644
--- a/plugins/fmradio/rb-fm-radio-source.c
+++ b/plugins/fmradio/rb-fm-radio-source.c
@@ -51,9 +51,9 @@ static void rb_fm_radio_source_init (RBFMRadioSource *self);
static void rb_fm_radio_source_constructed (GObject *object);
static void rb_fm_radio_source_dispose (GObject *object);
static void rb_fm_radio_source_do_query (RBFMRadioSource *self);
-static void rb_fm_radio_source_songs_view_sort_order_changed (
- RBEntryView *view,
- RBFMRadioSource *self);
+static void rb_fm_radio_source_songs_view_sort_order_changed (GObject *obj,
+ GParamSpec *pspec,
+ RBFMRadioSource *self);
static void rb_fm_radio_source_songs_view_show_popup (
RBEntryView *view,
gboolean over_entry,
@@ -174,7 +174,6 @@ rb_fm_radio_source_constructed (GObject *object)
self->priv->stations = rb_entry_view_new (self->priv->db,
G_OBJECT (self->priv->player),
- NULL,
FALSE, FALSE);
rb_entry_view_append_column (self->priv->stations,
RB_ENTRY_VIEW_COL_TITLE, TRUE);
@@ -183,8 +182,8 @@ rb_fm_radio_source_constructed (GObject *object)
rb_entry_view_append_column (self->priv->stations,
RB_ENTRY_VIEW_COL_LAST_PLAYED, TRUE);
- g_signal_connect_object (G_OBJECT (self->priv->stations),
- "sort-order-changed",
+ g_signal_connect_object (self->priv->stations,
+ "notify::sort-order",
G_CALLBACK (rb_fm_radio_source_songs_view_sort_order_changed),
self, 0);
/* sort order */
@@ -286,10 +285,9 @@ rb_fm_radio_source_do_query (RBFMRadioSource *self)
}
static void
-rb_fm_radio_source_songs_view_sort_order_changed (RBEntryView *view,
- RBFMRadioSource *self)
+rb_fm_radio_source_songs_view_sort_order_changed (GObject *object, GParamSpec *pspec, RBFMRadioSource *self)
{
- rb_entry_view_resort_model (view);
+ rb_entry_view_resort_model (RB_ENTRY_VIEW (object));
}
static void
diff --git a/plugins/generic-player/rb-generic-player-source.c b/plugins/generic-player/rb-generic-player-source.c
index 17c8964..cea01a6 100644
--- a/plugins/generic-player/rb-generic-player-source.c
+++ b/plugins/generic-player/rb-generic-player-source.c
@@ -39,7 +39,6 @@
#include "mediaplayerid.h"
-#include "eel-gconf-extensions.h"
#include "rb-generic-player-source.h"
#include "rb-generic-player-playlist-source.h"
#include "rb-removable-media-manager.h"
@@ -361,6 +360,7 @@ rb_generic_player_source_new (RBPlugin *plugin, RBShell *shell, GMount *mount, M
RhythmDBEntryType *ignore_type;
RhythmDB *db;
GVolume *volume;
+ GSettings *settings;
char *name;
char *path;
@@ -403,6 +403,7 @@ rb_generic_player_source_new (RBPlugin *plugin, RBShell *shell, GMount *mount, M
g_object_unref (volume);
g_free (path);
+ settings = g_settings_new ("org.gnome.rhythmbox.plugins.generic-player");
source = RB_GENERIC_PLAYER_SOURCE (g_object_new (RB_TYPE_GENERIC_PLAYER_SOURCE,
"plugin", plugin,
"entry-type", entry_type,
@@ -411,7 +412,9 @@ rb_generic_player_source_new (RBPlugin *plugin, RBShell *shell, GMount *mount, M
"mount", mount,
"shell", shell,
"device-info", device_info,
+ "settings", g_settings_get_child (settings, "source"),
NULL));
+ g_object_unref (settings);
rb_shell_register_entry_type_for_source (shell, RB_SOURCE (source), entry_type);
diff --git a/plugins/generic-player/rb-nokia770-source.c b/plugins/generic-player/rb-nokia770-source.c
index 648dc6c..8725b65 100644
--- a/plugins/generic-player/rb-nokia770-source.c
+++ b/plugins/generic-player/rb-nokia770-source.c
@@ -37,7 +37,6 @@
#include "mediaplayerid.h"
-#include "eel-gconf-extensions.h"
#include "rb-nokia770-source.h"
#include "rb-debug.h"
#include "rb-util.h"
diff --git a/plugins/generic-player/rb-psp-source.c b/plugins/generic-player/rb-psp-source.c
index eeff992..036b013 100644
--- a/plugins/generic-player/rb-psp-source.c
+++ b/plugins/generic-player/rb-psp-source.c
@@ -37,7 +37,6 @@
#include "mediaplayerid.h"
-#include "eel-gconf-extensions.h"
#include "rb-psp-source.h"
#include "rb-debug.h"
#include "rb-util.h"
diff --git a/plugins/ipod/rb-ipod-source.c b/plugins/ipod/rb-ipod-source.c
index e6f1e21..6de98a4 100644
--- a/plugins/ipod/rb-ipod-source.c
+++ b/plugins/ipod/rb-ipod-source.c
@@ -35,7 +35,6 @@
#include <gtk/gtk.h>
#include <gpod/itdb.h>
-#include "eel-gconf-extensions.h"
#include "rb-ipod-source.h"
#include "rb-ipod-db.h"
#include "rb-ipod-helpers.h"
@@ -56,16 +55,10 @@
#include "rb-podcast-entry-types.h"
#include "rb-stock-icons.h"
-#define CONF_STATE_PANED_POSITION CONF_PREFIX "/state/ipod/paned_position"
-#define CONF_STATE_SHOW_BROWSER CONF_PREFIX "/state/ipod/show_browser"
-
static void rb_ipod_source_constructed (GObject *object);
static void rb_ipod_source_class_init (RBiPodSourceClass *klass);
static void rb_ipod_source_dispose (GObject *object);
-static char *impl_get_browser_key (RBSource *source);
-static char *impl_get_paned_key (RBBrowserSource *source);
-
static void impl_delete (RBSource *asource);
static void rb_ipod_load_songs (RBiPodSource *source);
@@ -166,7 +159,6 @@ rb_ipod_source_class_init (RBiPodSourceClass *klass)
RBSourceClass *source_class = RB_SOURCE_CLASS (klass);
RBMediaPlayerSourceClass *mps_class = RB_MEDIA_PLAYER_SOURCE_CLASS (klass);
RBRemovableMediaSourceClass *rms_class = RB_REMOVABLE_MEDIA_SOURCE_CLASS (klass);
- RBBrowserSourceClass *browser_source_class = RB_BROWSER_SOURCE_CLASS (klass);
object_class->constructed = rb_ipod_source_constructed;
object_class->dispose = rb_ipod_source_dispose;
@@ -179,7 +171,6 @@ rb_ipod_source_class_init (RBiPodSourceClass *klass)
page_class->get_ui_actions = impl_get_ui_actions;
source_class->impl_can_browse = (RBSourceFeatureFunc) rb_true_function;
- source_class->impl_get_browser_key = impl_get_browser_key;
source_class->impl_can_move_to_trash = (RBSourceFeatureFunc) rb_false_function;
source_class->impl_can_rename = (RBSourceFeatureFunc) rb_true_function;
source_class->impl_can_delete = (RBSourceFeatureFunc) rb_true_function;
@@ -200,8 +191,6 @@ rb_ipod_source_class_init (RBiPodSourceClass *klass)
rms_class->impl_build_dest_uri = impl_build_dest_uri;
rms_class->impl_get_mime_types = impl_get_mime_types;
- browser_source_class->impl_get_paned_key = impl_get_paned_key;
-
g_object_class_install_property (object_class,
PROP_DEVICE_INFO,
g_param_spec_object ("device-info",
@@ -366,6 +355,7 @@ rb_ipod_source_new (RBPlugin *plugin,
RhythmDBEntryType *entry_type;
RhythmDB *db;
GVolume *volume;
+ GSettings *settings;
char *name;
char *path;
@@ -388,13 +378,16 @@ rb_ipod_source_new (RBPlugin *plugin,
g_free (name);
g_free (path);
+ settings = g_settings_new ("org.gnome.rhythmbox.plugins.ipod");
source = RB_IPOD_SOURCE (g_object_new (RB_TYPE_IPOD_SOURCE,
"plugin", plugin,
"entry-type", entry_type,
"mount", mount,
"shell", shell,
"device-info", device_info,
+ "settings", g_settings_get_child (settings, "source"),
NULL));
+ g_object_unref (settings);
rb_shell_register_entry_type_for_source (shell, RB_SOURCE (source), entry_type);
g_object_unref (entry_type);
@@ -1233,18 +1226,6 @@ impl_get_ui_actions (RBDisplayPage *page)
return actions;
}
-static char *
-impl_get_browser_key (RBSource *source)
-{
- return g_strdup (CONF_STATE_SHOW_BROWSER);
-}
-
-static char *
-impl_get_paned_key (RBBrowserSource *source)
-{
- return g_strdup (CONF_STATE_PANED_POSITION);
-}
-
static gboolean
impl_show_popup (RBDisplayPage *page)
{
diff --git a/plugins/iradio/rb-iradio-source.c b/plugins/iradio/rb-iradio-source.c
index 3802638..8f8d060 100644
--- a/plugins/iradio/rb-iradio-source.c
+++ b/plugins/iradio/rb-iradio-source.c
@@ -44,12 +44,10 @@
#include "rb-util.h"
#include "rb-file-helpers.h"
#include "totem-pl-parser.h"
-#include "rb-preferences.h"
#include "rb-dialog.h"
#include "rb-station-properties-dialog.h"
#include "rb-uri-dialog.h"
#include "rb-debug.h"
-#include "eel-gconf-extensions.h"
#include "rb-shell-player.h"
#include "rb-player.h"
#include "rb-metadata.h"
@@ -79,24 +77,10 @@ static void rb_iradio_source_get_property (GObject *object,
static void rb_iradio_source_songs_show_popup_cb (RBEntryView *view,
gboolean over_entry,
RBIRadioSource *source);
-static void paned_size_allocate_cb (GtkWidget *widget,
- GtkAllocation *allocation,
- RBIRadioSource *source);
-static void rb_iradio_source_state_pref_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBIRadioSource *source);
-static void rb_iradio_source_first_time_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBIRadioSource *source);
-static void rb_iradio_source_show_browser (RBIRadioSource *source,
- gboolean show);
-static void rb_iradio_source_state_prefs_sync (RBIRadioSource *source);
static void genre_selected_cb (RBPropertyView *propview, const char *name,
RBIRadioSource *iradio_source);
static void genre_selection_reset_cb (RBPropertyView *propview, RBIRadioSource *iradio_source);
-static void rb_iradio_source_songs_view_sort_order_changed_cb (RBEntryView *view, RBIRadioSource *source);
+static void rb_iradio_source_songs_view_sort_order_changed_cb (GObject *object, GParamSpec *pspec, RBIRadioSource *source);
static char *guess_uri_scheme (const char *uri);
/* entry type */
@@ -110,7 +94,6 @@ static GList *impl_get_ui_actions (RBDisplayPage *page);
static void impl_get_status (RBDisplayPage *page, char **text, char **progress_text, float *progress);
/* source methods */
-static char *impl_get_browser_key (RBSource *source);
static RBEntryView *impl_get_entry_view (RBSource *source);
static void impl_search (RBSource *source, RBSourceSearch *search, const char *cur_text, const char *new_text);
static void impl_delete (RBSource *source);
@@ -141,16 +124,11 @@ static void playing_source_changed_cb (RBShellPlayer *player,
RBSource *source,
RBIRadioSource *iradio_source);
-#define CMD_PATH_SHOW_BROWSER "/commands/ShowBrowser"
-#define CMD_PATH_CURRENT_STATION "/commands/CurrentStation"
-#define CMD_PATH_SONG_INFO "/commands/SongInfo"
-
-#define CONF_UI_IRADIO_DIR CONF_PREFIX "/ui/iradio"
-#define CONF_UI_IRADIO_COLUMNS_SETUP CONF_PREFIX "/ui/iradio/columns_setup"
-#define CONF_STATE_IRADIO_DIR CONF_PREFIX "/state/iradio"
-#define CONF_STATE_PANED_POSITION CONF_PREFIX "/state/iradio/paned_position"
-#define CONF_STATE_IRADIO_SORTING CONF_PREFIX "/state/iradio/sorting"
-#define CONF_STATE_SHOW_BROWSER CONF_PREFIX "/state/iradio/show_browser"
+enum
+{
+ PROP_0,
+ PROP_SHOW_BROWSER
+};
struct RBIRadioSourcePrivate
{
@@ -168,15 +146,13 @@ struct RBIRadioSourcePrivate
RhythmDBQuery *search_query;
RBSourceSearch *default_search;
- guint prefs_notify_id;
- guint first_time_notify_id;
- gboolean firstrun_done;
-
RBShellPlayer *player;
gint info_available_id;
gboolean dispose_has_run;
+
+ GSettings *settings;
};
#define RB_IRADIO_SOURCE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RB_TYPE_IRADIO_SOURCE, RBIRadioSourcePrivate))
@@ -232,13 +208,16 @@ rb_iradio_source_class_init (RBIRadioSourceClass *klass)
source_class->impl_can_delete = (RBSourceFeatureFunc) rb_true_function;
source_class->impl_can_pause = (RBSourceFeatureFunc) rb_false_function;
source_class->impl_delete = impl_delete;
- source_class->impl_get_browser_key = impl_get_browser_key;
source_class->impl_get_entry_view = impl_get_entry_view;
source_class->impl_search = impl_search;
source_class->impl_song_properties = impl_song_properties;
source_class->impl_want_uri = impl_want_uri;
source_class->impl_add_uri = impl_add_uri;
+ g_object_class_override_property (object_class,
+ PROP_SHOW_BROWSER,
+ "show-browser");
+
g_type_class_add_private (klass, sizeof (RBIRadioSourcePrivate));
}
@@ -304,9 +283,6 @@ rb_iradio_source_dispose (GObject *object)
source->priv->search_query = NULL;
}
- eel_gconf_notification_remove (source->priv->prefs_notify_id);
- eel_gconf_notification_remove (source->priv->first_time_notify_id);
-
G_OBJECT_CLASS (rb_iradio_source_parent_class)->dispose (object);
}
@@ -316,6 +292,7 @@ rb_iradio_source_constructed (GObject *object)
RBIRadioSource *source;
RBShell *shell;
GtkAction *action;
+ GSettings *settings;
RB_CHAIN_GOBJECT_METHOD (rb_iradio_source_parent_class, constructed, object);
source = RB_IRADIO_SOURCE (object);
@@ -329,6 +306,27 @@ rb_iradio_source_constructed (GObject *object)
NULL);
g_object_unref (shell);
+ settings = g_settings_new ("org.gnome.rhythmbox.plugins.iradio");
+ if (g_settings_get_boolean (settings, "initial-stations-loaded") == FALSE) {
+ RBPlugin *plugin;
+ char *file;
+
+ g_object_get (source, "plugin", &plugin, NULL);
+ file = rb_plugin_find_file (plugin, "iradio-initial.xspf");
+ if (file != NULL) {
+ char *uri = g_filename_to_uri (file, NULL, NULL);
+ if (uri != NULL) {
+ rb_iradio_source_add_from_playlist (source, uri);
+ g_free (uri);
+ }
+ }
+ g_free (file);
+ g_object_unref (plugin);
+ }
+
+ source->priv->settings = g_settings_get_child (settings, "source");
+ g_object_unref (settings);
+
source->priv->action_group = _rb_display_page_register_action_group (RB_DISPLAY_PAGE (source),
"IRadioActions",
rb_iradio_source_actions,
@@ -344,7 +342,6 @@ rb_iradio_source_constructed (GObject *object)
/* set up stations view */
source->priv->stations = rb_entry_view_new (source->priv->db, G_OBJECT (source->priv->player),
- CONF_STATE_IRADIO_SORTING,
FALSE, FALSE);
rb_entry_view_append_column (source->priv->stations, RB_ENTRY_VIEW_COL_TITLE, TRUE);
@@ -354,7 +351,7 @@ rb_iradio_source_constructed (GObject *object)
/* rb_entry_view_append_column (source->priv->stations, RB_ENTRY_VIEW_COL_PLAY_COUNT, FALSE);*/
rb_entry_view_append_column (source->priv->stations, RB_ENTRY_VIEW_COL_LAST_PLAYED, FALSE);
g_signal_connect_object (source->priv->stations,
- "sort-order-changed",
+ "notify::sort-order",
G_CALLBACK (rb_iradio_source_songs_view_sort_order_changed_cb),
source, 0);
@@ -371,10 +368,6 @@ rb_iradio_source_constructed (GObject *object)
stations_view_drag_types, 2,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
- g_signal_connect_object (source->priv->stations,
- "size_allocate",
- G_CALLBACK (paned_size_allocate_cb),
- source, 0);
g_signal_connect_object (source->priv->stations, "show_popup",
G_CALLBACK (rb_iradio_source_songs_show_popup_cb), source, 0);
@@ -401,21 +394,13 @@ rb_iradio_source_constructed (GObject *object)
gtk_box_pack_start (GTK_BOX (source->priv->vbox), source->priv->paned, TRUE, TRUE, 0);
- source->priv->prefs_notify_id =
- eel_gconf_notification_add (CONF_STATE_IRADIO_DIR,
- (GConfClientNotifyFunc) rb_iradio_source_state_pref_changed,
- source);
- source->priv->firstrun_done = eel_gconf_get_boolean (CONF_FIRST_TIME);
-
- source->priv->first_time_notify_id =
- eel_gconf_notification_add (CONF_FIRST_TIME,
- (GConfClientNotifyFunc) rb_iradio_source_first_time_changed,
- source);
+ rb_source_bind_settings (RB_SOURCE (source),
+ GTK_WIDGET (source->priv->stations),
+ source->priv->paned,
+ GTK_WIDGET (source->priv->genres));
gtk_widget_show_all (GTK_WIDGET (source));
- rb_iradio_source_state_prefs_sync (source);
-
g_signal_connect_object (source->priv->player, "playing-source-changed",
G_CALLBACK (playing_source_changed_cb),
source, 0);
@@ -431,9 +416,12 @@ rb_iradio_source_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- /*RBIRadioSource *source = RB_IRADIO_SOURCE (object);*/
+ RBIRadioSource *source = RB_IRADIO_SOURCE (object);
switch (prop_id) {
+ case PROP_SHOW_BROWSER:
+ gtk_widget_set_visible (GTK_WIDGET (source->priv->genres), g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -446,9 +434,12 @@ rb_iradio_source_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- /*RBIRadioSource *source = RB_IRADIO_SOURCE (object);*/
+ RBIRadioSource *source = RB_IRADIO_SOURCE (object);
switch (prop_id) {
+ case PROP_SHOW_BROWSER:
+ g_value_set_boolean (value, gtk_widget_get_visible (GTK_WIDGET (source->priv->genres)));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -621,12 +612,6 @@ impl_get_status (RBDisplayPage *page,
rb_streaming_source_get_progress (RB_STREAMING_SOURCE (source), progress_text, progress);
}
-static char *
-impl_get_browser_key (RBSource *asource)
-{
- return g_strdup (CONF_STATE_SHOW_BROWSER);
-}
-
static void
impl_delete (RBSource *asource)
{
@@ -704,43 +689,12 @@ impl_add_uri (RBSource *source,
}
static void
-paned_size_allocate_cb (GtkWidget *widget,
- GtkAllocation *allocation,
- RBIRadioSource *source)
-{
- /* save state */
- rb_debug ("paned size allocate");
- eel_gconf_set_integer (CONF_STATE_PANED_POSITION,
- gtk_paned_get_position (GTK_PANED (source->priv->paned)));
-}
-
-static void
-rb_iradio_source_state_prefs_sync (RBIRadioSource *source)
-{
- rb_debug ("syncing state");
- gtk_paned_set_position (GTK_PANED (source->priv->paned),
- eel_gconf_get_integer (CONF_STATE_PANED_POSITION));
- rb_iradio_source_show_browser (source,
- eel_gconf_get_boolean (CONF_STATE_SHOW_BROWSER));
-}
-
-static void
-rb_iradio_source_state_pref_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBIRadioSource *source)
-{
- rb_debug ("state prefs changed");
- rb_iradio_source_state_prefs_sync (source);
-}
-
-static void
-rb_iradio_source_songs_view_sort_order_changed_cb (RBEntryView *view,
+rb_iradio_source_songs_view_sort_order_changed_cb (GObject *object,
+ GParamSpec *pspec,
RBIRadioSource *source)
{
rb_debug ("sort order changed");
-
- rb_entry_view_resort_model (view);
+ rb_entry_view_resort_model (RB_ENTRY_VIEW (object));
}
static void
@@ -788,19 +742,6 @@ genre_selection_reset_cb (RBPropertyView *propview,
}
static void
-rb_iradio_source_show_browser (RBIRadioSource *source,
- gboolean show)
-{
- GtkWidget *genreswidget = GTK_WIDGET (source->priv->genres);
-
- if (show == TRUE) {
- gtk_widget_show (genreswidget);
- } else {
- gtk_widget_hide (genreswidget);
- }
-}
-
-static void
rb_iradio_source_do_query (RBIRadioSource *source)
{
RhythmDBQueryModel *genre_query_model = NULL;
@@ -941,37 +882,6 @@ rb_iradio_source_add_from_playlist (RBIRadioSource *source,
}
static void
-rb_iradio_source_first_time_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- RBIRadioSource *source)
-{
- char *uri;
- char *file;
- RBPlugin *plugin;
-
- if (source->priv->firstrun_done || !gconf_value_get_bool (entry->value))
- return;
-
- g_object_get (source, "plugin", &plugin, NULL);
- file = rb_plugin_find_file (plugin, "iradio-initial.xspf");
- if (file != NULL) {
- GFile *f;
-
- f = g_file_new_for_path (file);
- uri = g_file_get_uri (f);
-
- rb_iradio_source_add_from_playlist (source, uri);
-
- g_object_unref (f);
- g_free (uri);
- }
- g_free (file);
-
- source->priv->firstrun_done = TRUE;
-}
-
-static void
stations_view_drag_data_received_cb (GtkWidget *widget,
GdkDragContext *dc,
gint x,
diff --git a/plugins/jamendo/jamendo/JamendoConfigureDialog.py b/plugins/jamendo/jamendo/JamendoConfigureDialog.py
index 7bdb536..3fe72b9 100644
--- a/plugins/jamendo/jamendo/JamendoConfigureDialog.py
+++ b/plugins/jamendo/jamendo/JamendoConfigureDialog.py
@@ -21,16 +21,13 @@
import gobject
import rb
-from gi.repository import Gtk, GConf
+from gi.repository import Gtk, Gio
-gconf_keys = { 'format' : '/apps/rhythmbox/plugins/jamendo/format',
- 'sorting': '/apps/rhythmbox/plugins/jamendo/sorting'
- }
-format_list = ['ogg3', 'mp32']
+# format_list = ['ogg3', 'mp32']
class JamendoConfigureDialog (object):
def __init__(self, builder_file):
- self.gconf = GConf.Client.get_default()
+ self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.jamendo")
builder = Gtk.Builder()
builder.add_from_file(builder_file)
@@ -38,7 +35,9 @@ class JamendoConfigureDialog (object):
self.dialog = builder.get_object('preferences_dialog')
self.audio_combobox = builder.get_object("audio_combobox")
- format_text = self.gconf.get_string(gconf_keys['format'])
+ # probably should just bind this, but too lazy
+
+ format_text = self.settings['format']
if not format_text:
format_text = "ogg3"
try:
@@ -58,4 +57,4 @@ class JamendoConfigureDialog (object):
def audio_combobox_changed (self, combobox):
format = self.audio_combobox.get_active()
- self.gconf.set_string(gconf_keys['format'], format_list[format])
+ self.settings['format'] = format_list[format]
diff --git a/plugins/jamendo/jamendo/JamendoSource.py b/plugins/jamendo/jamendo/JamendoSource.py
index 3139374..a069478 100644
--- a/plugins/jamendo/jamendo/JamendoSource.py
+++ b/plugins/jamendo/jamendo/JamendoSource.py
@@ -28,7 +28,7 @@ import gzip
import datetime
import rb
-from gi.repository import Gtk, Gdk, GConf
+from gi.repository import Gtk, Gdk, Gio
from gi.repository import RB
from JamendoSaxHandler import JamendoSaxHandler
@@ -60,7 +60,7 @@ class JamendoSource(RB.BrowserSource):
def __init__(self):
- RB.BrowserSource.__init__(self, name=_("Jamendo"))
+ RB.BrowserSource.__init__(self, name=_("Jamendo"), settings=Gio.Settings("org.gnome.rhythmbox.plugins.jamendo").get_child("source"))
# catalogue stuff
self.__db = None
@@ -84,6 +84,8 @@ class JamendoSource(RB.BrowserSource):
self.__local_catalogue_path = os.path.join(self.__jamendo_dir, "dbdump.xml")
self.__local_catalogue_temp = os.path.join(self.__jamendo_dir, "dbdump.xml.tmp")
+ self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.jamendo")
+
def do_set_property(self, property, value):
if property.name == 'plugin':
self.__plugin = value
@@ -139,11 +141,6 @@ class JamendoSource(RB.BrowserSource):
self.__update_id = gobject.timeout_add_seconds(6 * 60 * 60, self.__update_catalogue)
self.__update_catalogue()
- sort_key = GConf.Client.get_default().get_string(JamendoConfigureDialog.gconf_keys['sorting'])
- if not sort_key:
- sort_key = "Artist,ascending"
- self.get_entry_view().set_sorting_type(sort_key)
-
def do_delete_thyself(self):
if self.__update_id != 0:
@@ -162,8 +159,6 @@ class JamendoSource(RB.BrowserSource):
self.__catalogue_check.cancel()
self.__catalogue_check = None
- GConf.Client.get_default().set_string(JamendoConfigureDialog.gconf_keys['sorting'], self.get_entry_view().get_sorting_type())
-
#
# internal catalogue downloading and loading
@@ -282,7 +277,7 @@ class JamendoSource(RB.BrowserSource):
# Download album
def download_album (self):
tracks = self.get_entry_view().get_selected_entries()
- format = GConf.Client.get_default().get_string(JamendoConfigureDialog.gconf_keys['format'])
+ format = self.settings['format']
if not format or format not in JamendoConfigureDialog.format_list:
format = 'ogg3'
diff --git a/plugins/lyrics/lyrics/LyricsConfigureDialog.py b/plugins/lyrics/lyrics/LyricsConfigureDialog.py
index 487bf14..fcf1274 100644
--- a/plugins/lyrics/lyrics/LyricsConfigureDialog.py
+++ b/plugins/lyrics/lyrics/LyricsConfigureDialog.py
@@ -31,12 +31,11 @@ import gobject
from os import system, path
import rb
-from gi.repository import Gtk, GConf
+from gi.repository import Gtk, Gio
class LyricsConfigureDialog (object):
- def __init__(self, builder_file, gconf_keys):
- self.gconf = GConf.Client.get_default()
- self.gconf_keys = gconf_keys
+ def __init__(self, builder_file):
+ self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.lyrics")
builder = Gtk.Builder()
builder.add_from_file(builder_file)
@@ -49,7 +48,6 @@ class LyricsConfigureDialog (object):
self.choose_button.connect("clicked", self.choose_callback)
self.dialog.connect("response", self.dialog_response)
- # set fields from gconf
engines, self.folder = self.get_prefs()
if self.folder is None:
self.folder = '~/.lyrics'
@@ -78,21 +76,20 @@ class LyricsConfigureDialog (object):
def set_values(self):
- engines = []
+ sites = []
for s in lyrics_sites:
check = self.site_checks[s['id']]
if check is None:
continue
if check.get_active():
- engines.append(s['id'])
+ sites.append(s['id'])
if len(self.path_display.get_text()) is not 0:
self.folder = self.path_display.get_text()
- # XXX can't set gconf string lists; doesn't matter, none of the sites work anyway
- # self.gconf.set_list(self.gconf_keys['engines'], GConf.ValueType.STRING, engines)
- self.gconf.set_string(self.gconf_keys['folder'], self.folder)
+ self.settings['sites'] = sites
+ self.settings['folder'] = self.folder
def choose_callback(self, widget):
def response_handler(widget, response):
@@ -119,12 +116,12 @@ class LyricsConfigureDialog (object):
def get_prefs (self):
try:
- engines = rb.get_gconf_string_list(self.gconf_keys['engines'])
+ sites = self.settings['sites']
except gobject.GError, e:
print e
engines = []
- folder = GConf.Client.get_default().get_string(self.gconf_keys['folder'])
+ folder = self.settings['folder']
- print "lyric engines: " + str (engines)
+ print "lyric sites: " + str (sites)
print "lyric folder: " + folder
- return (engines, folder)
+ return (sites, folder)
diff --git a/plugins/lyrics/lyrics/LyricsParse.py b/plugins/lyrics/lyrics/LyricsParse.py
index a17a785..995c986 100644
--- a/plugins/lyrics/lyrics/LyricsParse.py
+++ b/plugins/lyrics/lyrics/LyricsParse.py
@@ -29,24 +29,25 @@ import re
import gobject
import rb
-from gi.repository import GConf
+from gi.repository import Gio
from LyricsSites import lyrics_sites
class Parser (object):
- def __init__(self, gconf_keys, artist, title):
+ def __init__(self, artist, title):
self.title = title
self.artist = artist
try:
- self.engines = rb.get_gconf_string_list(gconf_keys['engines'])
+ settings = Gio.Settings("org.gnome.rhythmbox.plugins.lyrics")
+ self.sites = settings['sites']
except gobject.GError, e:
print e
- self.engines = []
+ self.sites = []
def searcher(self, plexer, callback, *data):
for site in lyrics_sites:
- if site['id'] not in self.engines:
+ if site['id'] not in self.sites:
print site['id'] + " search is disabled"
continue
diff --git a/plugins/lyrics/lyrics/__init__.py b/plugins/lyrics/lyrics/__init__.py
index 2baee09..99bbb48 100644
--- a/plugins/lyrics/lyrics/__init__.py
+++ b/plugins/lyrics/lyrics/__init__.py
@@ -29,7 +29,7 @@
import os, re
import rb
-from gi.repository import Gtk, GConf
+from gi.repository import Gtk, Gio
from gi.repository import RB
import LyricsParse
@@ -50,10 +50,6 @@ LYRIC_TITLE_REPLACE=[("/", "-"), (" & ", " and ")]
LYRIC_ARTIST_REPLACE=[("/", "-"), (" & ", " and ")]
STREAM_SONG_TITLE='rb:stream-song-title'
-gconf_keys = { 'engines' : '/apps/rhythmbox/plugins/lyrics/engines',
- 'folder': '/apps/rhythmbox/plugins/lyrics/folder'
- }
-
def create_lyrics_view():
tview = Gtk.TextView()
tview.set_wrap_mode(Gtk.WrapMode.WORD)
@@ -125,7 +121,8 @@ def extract_artist_and_title(stream_song_title):
return (artist, title)
def build_cache_path(artist, title):
- folder = GConf.Client.get_default().get_string(gconf_keys['folder'])
+ settings = Gio.Settings("org.gnome.rhythmbox.plugins.lyrics")
+ folder = settings['folder']
if folder is None or folder == "":
folder = os.path.join(RB.user_cache_dir(), "lyrics")
@@ -173,7 +170,7 @@ class LyricGrabber(object):
else:
self.callback(_("No lyrics found"))
- parser = LyricsParse.Parser(gconf_keys, self.artist, self.title)
+ parser = LyricsParse.Parser(self.artist, self.title)
parser.get_lyrics(lyric_callback)
class LyricPane(object):
@@ -385,7 +382,7 @@ class LyricsDisplayPlugin(RB.Plugin):
def create_configure_dialog(self):
builder_file = self.find_file("lyrics-prefs.ui")
- dialog = LyricsConfigureDialog (builder_file, gconf_keys).get_dialog()
+ dialog = LyricsConfigureDialog (builder_file).get_dialog()
dialog.present()
return dialog
diff --git a/plugins/magnatune/magnatune/MagnatuneSource.py b/plugins/magnatune/magnatune/MagnatuneSource.py
index 9aab99d..b183c6f 100644
--- a/plugins/magnatune/magnatune/MagnatuneSource.py
+++ b/plugins/magnatune/magnatune/MagnatuneSource.py
@@ -36,7 +36,7 @@ import gnomekeyring as keyring
import rb
from gi.repository import RB
-from gi.repository import Gtk, GConf
+from gi.repository import Gtk, Gio
# XXX use GnomeKeyring when introspection is available
from TrackListHandler import TrackListHandler
@@ -61,11 +61,9 @@ class MagnatuneSource(RB.BrowserSource):
'plugin': (RB.Plugin, 'plugin', 'plugin', gobject.PARAM_WRITABLE|gobject.PARAM_CONSTRUCT_ONLY),
}
- __client = GConf.Client.get_default()
-
-
def __init__(self):
- RB.BrowserSource.__init__(self, name=_("Magnatune"))
+ self.__settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")
+ RB.BrowserSource.__init__(self, name=_("Magnatune"), settings=self.__settings.get_child("source"))
# source state
self.__activated = False
@@ -212,14 +210,15 @@ class MagnatuneSource(RB.BrowserSource):
urls.add(url)
def download_album(self):
- if self.__client.get_string(self.__plugin.gconf_keys['account_type']) != 'download':
+ if selt.__settings['account_type'] != 'download':
# The user doesn't have a download account, so redirect them to the purchase page.
self.purchase_redirect()
return
try:
# Just use the first library location
- library_location = rb.get_gconf_string_list("/apps/rhythmbox/library_locations")[0];
+ library = Gio.Settings("org.gnome.rhythmbox.rhythmdb")
+ library_location = library['locations'][0]
except IndexError, e:
RB.error_dialog(title = _("Couldn't purchase album"),
message = _("You must have a library location set to purchase an album."))
@@ -304,7 +303,7 @@ class MagnatuneSource(RB.BrowserSource):
def load_catalogue():
def got_items(result, items):
- account_type = self.__client.get_string(self.__plugin.gconf_keys['account_type'])
+ account_type = self.__settings['account_type']
username = ""
password = ""
if account_type == 'none':
@@ -431,7 +430,7 @@ class MagnatuneSource(RB.BrowserSource):
l.get_url(url, auth_data_cb, (username, password))
def auth_data_cb(data, (username, password)):
- buy_album_handler = BuyAlbumHandler(self.__client.get_string(self.__plugin.gconf_keys['format']))
+ buy_album_handler = BuyAlbumHandler(self.__settings['format'])
auth_parser = xml.sax.make_parser()
auth_parser.setContentHandler(buy_album_handler)
@@ -499,7 +498,8 @@ class MagnatuneSource(RB.BrowserSource):
def unzip_album():
# just use the first library location
- library_location = gio.File(uri=rb.get_gconf_string_list("/apps/rhythmbox/library_locations")[0]);
+ library = Gio.Settings("org.gnome.rhythmbox.rhythmdb")
+ library_location = gio.File(library['locations'][0])
album = zipfile.ZipFile(dest.get_path())
for track in album.namelist():
diff --git a/plugins/magnatune/magnatune/__init__.py b/plugins/magnatune/magnatune/__init__.py
index 7b48dc9..5d8a74c 100644
--- a/plugins/magnatune/magnatune/__init__.py
+++ b/plugins/magnatune/magnatune/__init__.py
@@ -37,7 +37,7 @@ import gnomekeyring as keyring
import rb
from gi.repository import RB
-from gi.repository import GConf, Gtk
+from gi.repository import Gtk, Gio
# XXX use GnomeKeyring when available
from MagnatuneSource import MagnatuneSource
@@ -70,19 +70,9 @@ class MagnatuneEntryType(RB.RhythmDBEntryType):
return
class Magnatune(RB.Plugin):
- client = GConf.Client.get_default()
format_list = ['ogg', 'flac', 'wav', 'mp3-vbr', 'mp3-cbr']
- gconf_keys = {
- 'format': "/apps/rhythmbox/plugins/magnatune/format",
- 'pay': "/apps/rhythmbox/plugins/magnatune/pay",
- 'ccauthtoken': "/apps/rhythmbox/plugins/magnatune/ccauthtoken",
- 'continue': "/apps/rhythmbox/plugins/magnatune/continue",
- 'account_type': "/apps/rhythmbox/plugins/magnatune/account_type"
- }
-
-
#
# Core methods
#
@@ -97,6 +87,8 @@ class Magnatune(RB.Plugin):
self.entry_type = MagnatuneEntryType()
self.db.register_entry_type(self.entry_type)
+ self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")
+
theme = Gtk.IconTheme.get_default()
rb.append_plugin_source_path(theme, "/icons")
@@ -203,7 +195,7 @@ class Magnatune(RB.Plugin):
if dialog == None:
def fill_account_details():
- account_type = self.client.get_string(self.gconf_keys['account_type'])
+ account_type = self.settings['account_type'])
builder.get_object("no_account_radio").set_active(account_type == "none")
builder.get_object("stream_account_radio").set_active(account_type == "stream")
builder.get_object("download_account_radio").set_active(account_type == "download")
@@ -230,7 +222,7 @@ class Magnatune(RB.Plugin):
print "account type radiobutton toggled: " + button.get_name()
account_type = {"no_account_radio": "none", "stream_account_radio": "stream", "download_account_radio": "download"}
if button.get_active():
- self.client.set_string(self.gconf_keys['account_type'], account_type[button.get_name()])
+ self.settings['account_type'] = account_type[button.get_name()]
if account_type[button.get_name()] == 'none':
builder.get_object("username_label").set_sensitive(False)
builder.get_object("username_entry").set_sensitive(False)
@@ -266,7 +258,7 @@ class Magnatune(RB.Plugin):
self.configure_callback_dic = {
- "rb_magnatune_audio_combobox_changed_cb" : lambda w: self.client.set_string(self.gconf_keys['format'], self.format_list[w.get_active()]),
+ "rb_magnatune_audio_combobox_changed_cb" : lambda w: self.settings['format'] = self.format_list[w.get_active()],
"rb_magnatune_radio_account_toggled_cb" : account_type_toggled,
"rb_magnatune_username_changed_cb" : account_details_changed,
@@ -282,7 +274,7 @@ class Magnatune(RB.Plugin):
for name in ("no_account_radio", "stream_account_radio", "download_account_radio"):
builder.get_object(name).set_name(name)
- builder.get_object("audio_combobox").set_active(self.format_list.index(self.client.get_string(self.gconf_keys['format'])))
+ builder.get_object("audio_combobox").set_active(self.format_list.index(self.settings['format']))
builder.connect_signals(self.configure_callback_dic)
dialog.connect("response", close_button_pressed)
diff --git a/plugins/mtpdevice/rb-mtp-source.c b/plugins/mtpdevice/rb-mtp-source.c
index e854694..8030100 100644
--- a/plugins/mtpdevice/rb-mtp-source.c
+++ b/plugins/mtpdevice/rb-mtp-source.c
@@ -38,7 +38,6 @@
#endif
#include "rhythmdb.h"
-#include "eel-gconf-extensions.h"
#include "rb-debug.h"
#include "rb-file-helpers.h"
#include "rb-plugin.h"
@@ -62,9 +61,6 @@
#define g_mount_unmount_with_operation(m,f,mo,ca,cb,ud) g_mount_unmount(m,f,ca,cb,ud)
#endif
-#define CONF_STATE_PANED_POSITION CONF_PREFIX "/state/mtp/paned_position"
-#define CONF_STATE_SHOW_BROWSER CONF_PREFIX "/state/mtp/show_browser"
-
static void rb_mtp_source_constructed (GObject *object);
static void rb_mtp_source_dispose (GObject *object);
static void rb_mtp_source_finalize (GObject *object);
@@ -77,8 +73,6 @@ static void rb_mtp_source_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static char *impl_get_browser_key (RBSource *source);
-static char *impl_get_paned_key (RBBrowserSource *source);
static void impl_delete (RBSource *asource);
static gboolean impl_show_popup (RBDisplayPage *page);
@@ -185,7 +179,6 @@ rb_mtp_source_class_init (RBMtpSourceClass *klass)
RBDisplayPageClass *page_class = RB_DISPLAY_PAGE_CLASS (klass);
RBSourceClass *source_class = RB_SOURCE_CLASS (klass);
RBRemovableMediaSourceClass *rms_class = RB_REMOVABLE_MEDIA_SOURCE_CLASS (klass);
- RBBrowserSourceClass *browser_source_class = RB_BROWSER_SOURCE_CLASS (klass);
RBMediaPlayerSourceClass *mps_class = RB_MEDIA_PLAYER_SOURCE_CLASS (klass);
object_class->constructed = rb_mtp_source_constructed;
@@ -198,7 +191,6 @@ rb_mtp_source_class_init (RBMtpSourceClass *klass)
page_class->get_ui_actions = impl_get_ui_actions;
source_class->impl_can_browse = (RBSourceFeatureFunc) rb_true_function;
- source_class->impl_get_browser_key = impl_get_browser_key;
source_class->impl_can_rename = (RBSourceFeatureFunc) rb_true_function;
source_class->impl_can_delete = (RBSourceFeatureFunc) rb_true_function;
@@ -208,8 +200,6 @@ rb_mtp_source_class_init (RBMtpSourceClass *klass)
source_class->impl_can_cut = (RBSourceFeatureFunc) rb_false_function;
source_class->impl_delete = impl_delete;
- browser_source_class->impl_get_paned_key = impl_get_paned_key;
-
rms_class->impl_track_added = impl_track_added;
rms_class->impl_track_add_error = impl_track_add_error;
rms_class->impl_build_dest_uri = impl_build_dest_uri;
@@ -546,18 +536,6 @@ rb_mtp_source_finalize (GObject *object)
G_OBJECT_CLASS (rb_mtp_source_parent_class)->finalize (object);
}
-static char *
-impl_get_browser_key (RBSource *source)
-{
- return g_strdup (CONF_STATE_SHOW_BROWSER);
-}
-
-static char *
-impl_get_paned_key (RBBrowserSource *source)
-{
- return g_strdup (CONF_STATE_PANED_POSITION);
-}
-
RBSource *
rb_mtp_source_new (RBShell *shell,
RBPlugin *plugin,
@@ -571,6 +549,7 @@ rb_mtp_source_new (RBShell *shell,
RBMtpSource *source = NULL;
RhythmDBEntryType *entry_type;
RhythmDB *db = NULL;
+ GSettings *settings;
char *name = NULL;
g_object_get (shell, "db", &db, NULL);
@@ -585,6 +564,7 @@ rb_mtp_source_new (RBShell *shell,
g_free (name);
g_object_unref (db);
+ settings = g_settings_new ("org.gnome.rhythmbox.plugins.mtpdevice");
source = RB_MTP_SOURCE (g_object_new (RB_TYPE_MTP_SOURCE,
"plugin", plugin,
"entry-type", entry_type,
@@ -597,7 +577,9 @@ rb_mtp_source_new (RBShell *shell,
#else
"udi", udi,
#endif
+ "settings", g_settings_get_child (settings, "source"),
NULL));
+ g_object_unref (settings);
rb_shell_register_entry_type_for_source (shell, RB_SOURCE (source), entry_type);
diff --git a/plugins/pythonconsole/pythonconsole.py b/plugins/pythonconsole/pythonconsole.py
index 3ca971e..bd82b9f 100644
--- a/plugins/pythonconsole/pythonconsole.py
+++ b/plugins/pythonconsole/pythonconsole.py
@@ -38,7 +38,7 @@ import re
import traceback
import gobject
-from gi.repository import Gtk, Gdk, Pango, GConf
+from gi.repository import Gtk, Gdk, Pango
from gi.repository import RB
try:
@@ -128,11 +128,16 @@ class PythonConsolePlugin(RB.Plugin):
self.window.grab_focus()
def enable_debugging(self, action, shell):
- msg = _("After you press OK, Rhythmbox will wait until you connect to it with winpdb or rpdb2. If you have not set a debugger password in GConf, it will use the default password ('rhythmbox').")
+ pwd_path = os.path.join(rb.user_data_dir(), "rpdb2_password")
+ msg = _("After you press OK, Rhythmbox will wait until you connect to it with winpdb or rpdb2. If you have not set a debugger password in the file %s, it will use the default password ('rhythmbox').") % pwd_path
dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.OK_CANCEL, msg)
if dialog.run() == Gtk.RESPONSE_OK:
- gconfclient = GConf.Client.get_default()
- password = gconfclient.get_string('/apps/rhythmbox/plugins/pythonconsole/rpdb2_password') or "rhythmbox"
+ password = "rhythmbox"
+ if os.path.exists(pwd_path):
+ pwd_file = open(pwd_path)
+ password = pwd_file.read().rstrip()
+ pwd_file.close()
+
def start_debugger(password):
rpdb2.start_embedded_debugger(password)
return False
diff --git a/plugins/rb/__init__.py b/plugins/rb/__init__.py
index 13e4f16..df817cb 100644
--- a/plugins/rb/__init__.py
+++ b/plugins/rb/__init__.py
@@ -33,7 +33,6 @@ import time
import thread
from gi.repository import RB
-from gi.repository import GConf
# rb classes
from Loader import Loader
@@ -68,21 +67,6 @@ def entry_equal(a, b):
return False
return a.get_string(RB.RhythmDBPropType.LOCATION) == b.get_string(RB.RhythmDBPropType.LOCATION)
-def get_gconf_string_list(key):
- gconf = GConf.Client().get_default()
- l = gconf.get_without_default(key)
- if l is None or \
- l.type != GConf.ValueType.LIST or \
- l.get_list_type() != GConf.ValueType.STRING:
- return []
- sl = []
- for e in l.get_list():
- sl.append(e.get_string())
-
- return sl
-
-
-
class _rbdebugfile:
def __init__(self, fn):
self.fn = fn
diff --git a/plugins/replaygain/Makefile.am b/plugins/replaygain/Makefile.am
index 8194d8b..6731456 100644
--- a/plugins/replaygain/Makefile.am
+++ b/plugins/replaygain/Makefile.am
@@ -3,8 +3,6 @@ SUBDIRS = replaygain
plugindir = $(PLUGINDIR)/replaygain
%.rb-plugin: %.rb-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-plugin_DATA = $(plugin_in_files:.rb-plugin.in=.rb-plugin)
-
plugin_in_files = replaygain.rb-plugin.in
@@ -15,3 +13,7 @@ gtkbuilderdir = $(plugindir)
EXTRA_DIST = $(plugin_in_files) $(gtkbuilder_DATA)
CLEANFILES = $(plugin_DATA)
DISTCLEANFILES = $(plugin_DATA)
+
+BUILT_SOURCES = $(plugin_in_files:.rb-plugin.in=.rb-plugin)
+
+plugin_DATA = $(BUILT_SOURCES)
diff --git a/plugins/replaygain/replaygain-prefs.ui b/plugins/replaygain/replaygain-prefs.ui
index 0223b2b..1ea9732 100644
--- a/plugins/replaygain/replaygain-prefs.ui
+++ b/plugins/replaygain/replaygain-prefs.ui
@@ -2,20 +2,6 @@
<interface>
<requires lib="gtk+" version="2.14"/>
<!-- interface-naming-policy project-wide -->
- <object class="GtkListStore" id="replaygainmodemodel">
- <columns>
- <!-- column-name name -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Radio (equal loudness for all tracks)</col>
- </row>
- <row>
- <col id="0" translatable="yes">Album (ideal loudness for all tracks)</col>
- </row>
- </data>
- </object>
<object class="GtkAdjustment" id="preampadjustment">
<property name="lower">-15</property>
<property name="upper">25</property>
@@ -160,4 +146,22 @@
</packing>
</child>
</object>
+ <object class="GtkListStore" id="replaygainmodemodel">
+ <columns>
+ <!-- column-name display -->
+ <column type="gchararray"/>
+ <!-- column-name setting -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Radio (equal loudness for all tracks)</col>
+ <col id="1" translatable="no">radio</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Album (ideal loudness for all tracks)</col>
+ <col id="1" translatable="no">album</col>
+ </row>
+ </data>
+ </object>
</interface>
diff --git a/plugins/replaygain/replaygain/config.py b/plugins/replaygain/replaygain/config.py
index e4c2710..eccb44e 100644
--- a/plugins/replaygain/replaygain/config.py
+++ b/plugins/replaygain/replaygain/config.py
@@ -28,17 +28,9 @@
import gobject
import rb
from gi.repository import Gtk
-from gi.repository import GConf
+from gi.repository import Gio
from gi.repository import RB
-GCONF_DIR = '/apps/rhythmbox/plugins/replaygain'
-
-GCONF_KEYS = {
- 'mode': GCONF_DIR + '/mode',
- 'preamp': GCONF_DIR + '/preamp',
- 'limiter': GCONF_DIR + '/limiter'
-}
-
# modes
REPLAYGAIN_MODE_RADIO = 0
REPLAYGAIN_MODE_ALBUM = 1
@@ -52,7 +44,7 @@ class ReplayGainConfigDialog(Gtk.Dialog):
Gtk.Dialog.__init__(self)
self.set_border_width(12)
- self.gconf = GConf.Client.get_default()
+ self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.replaygain")
ui_file = plugin.find_file("replaygain-prefs.ui")
self.builder = Gtk.Builder()
@@ -69,11 +61,11 @@ class ReplayGainConfigDialog(Gtk.Dialog):
label.set_use_markup(True)
combo = self.builder.get_object("replaygainmode")
- combo.set_active(self.gconf.get_int(GCONF_KEYS['mode']))
- combo.connect("changed", self.mode_changed_cb)
+ combo.props.id_column = 1
+ self.settings.bind("mode", combo, "active-id", Gio.SettingsBindFlags.DEFAULT)
preamp = self.builder.get_object("preamp")
- preamp.set_value(self.gconf.get_float(GCONF_KEYS['preamp']))
+ self.settings.bind("preamp", preamp.props.adjustment, "value", Gio.SettingsBindFlags.GET)
preamp.connect("value-changed", self.preamp_changed_cb)
preamp.add_mark(-15.0, Gtk.PositionType.BOTTOM, _("-15.0 dB"))
@@ -81,23 +73,14 @@ class ReplayGainConfigDialog(Gtk.Dialog):
preamp.add_mark(15.0, Gtk.PositionType.BOTTOM, _("15.0 dB"))
limiter = self.builder.get_object("limiter")
- limiter.set_active(self.gconf.get_bool(GCONF_KEYS['limiter']))
- limiter.connect("toggled", self.limiter_changed_cb)
-
-
- def mode_changed_cb(self, combo):
- v = combo.get_active()
- print "replaygain mode changed to %d" % v
- self.gconf.set_int(GCONF_KEYS['mode'], v)
+ self.settings.bind("limiter", limiter, "active", Gio.SettingsBindFlags.DEFAULT)
def preamp_changed_cb(self, preamp):
+ RB.settings_delayed_sync(self.settings, self.sync_preamp, preamp)
+
+ def sync_preamp(self, settings, preamp):
v = preamp.get_value()
print "preamp gain changed to %f" % v
- self.gconf.set_float(GCONF_KEYS['preamp'], v)
-
- def limiter_changed_cb(self, limiter):
- v = limiter.get_active()
- print "limiter changed to %d" % v
- self.gconf.set_bool(GCONF_KEYS['limiter'], v)
+ settings['preamp'] = v
gobject.type_register(ReplayGainConfigDialog)
diff --git a/plugins/replaygain/replaygain/player.py b/plugins/replaygain/replaygain/player.py
index 4106220..130004d 100644
--- a/plugins/replaygain/replaygain/player.py
+++ b/plugins/replaygain/replaygain/player.py
@@ -29,8 +29,8 @@ import gobject
import gst
import rb
-from gi.repository import GConf
from gi.repository import RB
+from gi.repository import Gio
import config
@@ -52,10 +52,9 @@ class ReplayGainPlayer(object):
self.shell_player = shell.props.shell_player
self.player = self.shell_player.props.player
- self.gconf = GConf.Client.get_default()
+ self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.replaygain")
- self.gconf.add_dir(config.GCONF_DIR, GConf.ClientPreloadType.PRELOAD_NONE)
- self.gconf.notify_add(config.GCONF_KEYS['limiter'], self.limiter_changed_cb, None)
+ self.settings.connect("changed::limiter", self.limiter_changed_cb)
self.previous_gain = []
self.fallback_gain = 0.0
@@ -80,13 +79,13 @@ class ReplayGainPlayer(object):
def set_rgvolume(self, rgvolume):
# set preamp level
- preamp = self.gconf.get_float(config.GCONF_KEYS['preamp'])
+ preamp = self.settings['preamp']
rgvolume.props.pre_amp = preamp
# set mode
# there may eventually be a 'guess' mode here that tries to figure out
# what to do based on the upcoming tracks
- mode = self.gconf.get_int(config.GCONF_KEYS['mode'])
+ mode = self.settings['mode']
if mode == config.REPLAYGAIN_MODE_ALBUM:
rgvolume.props.album_mode = 1
else:
@@ -219,9 +218,9 @@ class ReplayGainPlayer(object):
self.set_rgvolume(rgvolume)
return [rgvolume]
- def limiter_changed_cb(self, client, id, entry, d):
+ def limiter_changed_cb(self, settings, key):
if self.rglimiter is not None:
- limiter = self.gconf.get_bool(config.GCONF_KEYS['limiter'])
+ limiter = settings['limiter']
print "limiter setting is now %s" % str(limiter)
self.rglimiter.props.enabled = limiter
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]