Commit cf02733f authored by Jonathan Matthew's avatar Jonathan Matthew

port all core code to use GSettings

A couple of general notes, for future reference:
- widgets don't know anything about GSettings, instead they expose
  properties that can be bound to settings keys
- when a settings key is used to store a value controlled by a slider
  or pane widget, the key is only updated once the value has gone
  unchanged for 500ms (using rb_settings_delayed_sync); writing on
  each value notification is extremely slow.
parent 34e2c0cb
......@@ -30,8 +30,6 @@ gnome-doc-utils.make
rhythmbox.pc
#
bindings/python/rb.c
bindings/python/rhythmdb.c
bindings/gi/MPID-0.13.gir
bindings/gi/MPID-0.13.typelib
bindings/gi/RB-0.13.gir
......@@ -43,6 +41,8 @@ org.gnome.Rhythmbox.service
rhythmbox.desktop.in
rhythmbox-device.desktop.in
playlists.xml
gschemas.compiled
org.gnome.rhythmbox.gschema.valid
#
help/*.omf
......
......@@ -41,8 +41,6 @@
#include <gst/pbutils/missing-plugins.h>
#include "rhythmdb.h"
#include "eel-gconf-extensions.h"
#include "rb-preferences.h"
#include "rb-encoder.h"
#include "rb-encoder-gst.h"
#include "rb-debug.h"
......@@ -1194,7 +1192,8 @@ rb_encoder_gst_get_media_type (RBEncoder *encoder,
*/
if (dest_media_types == NULL) {
if (g_str_has_prefix (src_media_type, "audio/x-raw")) {
const char *profile_name = eel_gconf_get_string (CONF_LIBRARY_PREFERRED_FORMAT);
/* hopefully encodebin stuff will land before i need to replace this with something gsettings wise */
const char *profile_name = "cdlossy"; /* eel_gconf_get_string (CONF_LIBRARY_PREFERRED_FORMAT); */
const char *mt;
profile = gm_audio_profile_lookup (profile_name);
......
......@@ -23,7 +23,6 @@ rb_introspection_sources = \
lib/rb-debug.c \
lib/rb-file-helpers.h \
lib/rb-file-helpers.c \
lib/rb-preferences.h \
lib/rb-stock-icons.h \
lib/rb-stock-icons.c \
lib/rb-string-value-map.h \
......
......@@ -65,6 +65,7 @@ LIBNOTIFY_REQS=0.7.0
BRASERO_MIN_REQS=2.31.5
WEBKIT_MIN_REQS=1.3.9
GLIB_GSETTINGS
......@@ -438,7 +439,6 @@ AC_SUBST(LDFLAGS)
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource)
AC_PATH_PROG(GCONFTOOL, gconftool-2)
AC_SUBST(RHYTHMBOX_CFLAGS)
AC_SUBST(RHYTHMBOX_LIBS)
......
......@@ -7,15 +7,24 @@ Multimediadir = $(datadir)/applications
Multimedia_in_files = rhythmbox.desktop.in rhythmbox-device.desktop.in
Multimedia_DATA = $(Multimedia_in_files:.desktop.in=.desktop)
schemadir = @GCONF_SCHEMA_FILE_DIR@
schema_DATA = rhythmbox.schemas
playlists_in_files = playlists.xml.in
playlists_DATA = playlists.xml
playlistsdir = $(datadir)/rhythmbox
man_MANS = rhythmbox.1 rhythmbox-client.1
# GSettings schemas
# (summaries and descriptions are not translated, so no .xml.in)
gsettings_SCHEMAS = org.gnome.rhythmbox.gschema.xml
@GSETTINGS_RULES@
# compile schemas for running from the source tree
gschemas.compiled: $(gsettings_SCHEMAS:.xml=.valid)
$(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --targetdir=. .
all-local: gschemas.compiled
# Dbus service file
servicedir = $(datadir)/dbus-1/services
service_in_files = org.gnome.Rhythmbox.service.in
......@@ -25,11 +34,6 @@ service_DATA = $(service_in_files:.service.in=.service)
$(service_DATA): $(service_in_files) Makefile
@sed -e "s|\@bindir\@|$(bindir)|" $< > $@
if GCONF_SCHEMAS_INSTALL
install-data-local: $(schema_DATA)
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$(schema_DATA);
endif
# Rule to update the icon cache after installing the icon
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
......@@ -49,8 +53,7 @@ EXTRA_DIST = $(service_in_files) \
$(man_MANS) \
$(playlists_in_files) \
rhythmbox.desktop.in.in \
rhythmbox-device.desktop.in.in \
org.gnome.rhythmbox.gschema.xml
rhythmbox-device.desktop.in.in
CLEANFILES = \
rhythmbox.desktop \
......@@ -58,4 +61,5 @@ CLEANFILES = \
org.gnome.Rhythmbox.service \
playlists.xml \
rhythmbox.desktop.in \
rhythmbox-device.desktop.in
rhythmbox-device.desktop.in \
gschemas.compiled
......@@ -224,7 +224,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="y_options"></property>
......@@ -238,7 +237,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="top_attach">1</property>
......@@ -254,7 +252,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="top_attach">2</property>
......@@ -270,7 +267,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="top_attach">4</property>
......@@ -287,7 +283,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="top_attach">3</property>
......@@ -304,7 +299,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -323,7 +317,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="left_attach">2</property>
......@@ -340,7 +333,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="left_attach">2</property>
......@@ -359,7 +351,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="left_attach">2</property>
......@@ -378,7 +369,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="left_attach">2</property>
......@@ -397,7 +387,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -416,7 +405,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -435,7 +423,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -454,7 +441,6 @@
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="rb_shell_preferences_column_check_changed_cb"/>
</object>
<packing>
<property name="left_attach">1</property>
......
......@@ -52,7 +52,7 @@
</child>
<child>
<object class="GtkCheckButton" id="use_xfade_backend">
<property name="label" translatable="yes">_Use crossfading backend (requires restart)</property>
<property name="label" translatable="yes">_Crossfade between tracks</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
......@@ -130,61 +130,6 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox6">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="buffer_size_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Network Buffer Size (kB)</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label"> </property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHScale" id="network_buffer_size">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment2</property>
<property name="digits">0</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="plugin_box">
<property name="visible">True</property>
......@@ -194,7 +139,7 @@
</child>
</object>
<packing>
<property name="position">3</property>
<property name="position">2</property>
</packing>
</child>
</object>
......
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 2.12 -->
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkListStore" id="model1">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Every hour</col>
</row>
<row>
<col id="0" translatable="yes">Every day</col>
</row>
<row>
<col id="0" translatable="yes">Every week</col>
</row>
<row>
<col id="0" translatable="yes">Manually</col>
</row>
</data>
</object>
<object class="GtkVBox" id="podcast_vbox">
<property name="visible">True</property>
<property name="border_width">12</property>
......@@ -36,8 +16,10 @@
<object class="GtkLabel" id="download_manager_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Download Manager&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="label" translatable="yes">Podcast Downloads</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
......@@ -99,7 +81,7 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">Check for _new episodes:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">cb_update_interval</property>
<property name="mnemonic_widget">update_interval</property>
</object>
<packing>
<property name="top_attach">1</property>
......@@ -109,9 +91,9 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="cb_update_interval">
<object class="GtkComboBox" id="update_interval">
<property name="visible">True</property>
<property name="model">model1</property>
<property name="model">interval-values</property>
<child>
<object class="GtkCellRendererText" id="renderer1"/>
<attributes>
......@@ -173,4 +155,30 @@
</packing>
</child>
</object>
<object class="GtkListStore" id="interval-values">
<columns>
<!-- column-name display -->
<column type="gchararray"/>
<!-- column-name setting -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Every hour</col>
<col id="1" translatable="no">hourly</col>
</row>
<row>
<col id="0" translatable="yes">Every day</col>
<col id="1" translatable="no">daily</col>
</row>
<row>
<col id="0" translatable="yes">Every week</col>
<col id="1" translatable="no">weekly</col>
</row>
<row>
<col id="0" translatable="yes">Manually</col>
<col id="1" translatable="no">manual</col>
</row>
</data>
</object>
</interface>
......@@ -33,7 +33,6 @@ CFILE_GLOB=$(top_srcdir)/lib/*.c
# - plugins (no API there)
IGNORE_HFILES= \
config.h \
eel-gconf-extensions.h \
eggdesktopfile.h \
eggsmclient-private.h \
eggsmclient.h \
......
......@@ -477,8 +477,6 @@ rb_source_update_play_statistics
rb_source_set_pixbuf
rb_source_get_status
rb_source_can_browse
rb_source_get_browser_key
rb_source_browser_toggled
rb_source_get_entry_view
rb_source_get_property_views
rb_source_can_rename
......@@ -991,23 +989,6 @@ rb_stock_icons_init
rb_stock_icons_shutdown
</SECTION>
<SECTION>
<FILE>rb-preferences</FILE>
CONF_PREFIX
CONF_FIRST_TIME
CONF_GRACE_PERIOD
CONF_UI_DIR
CONF_UI_STATUSBAR_HIDDEN
CONF_UI_SMALL_DISPLAY
CONF_UI_OBSOLETE_COLUMNS_SETUP
CONF_UI_COLUMNS_SETUP
CONF_UI_TIME_DISPLAY
CONF_UI_BROWSER_VIEWS
CONF_STATE_PLAY_ORDER
CONF_STATE_VOLUME
CONF_STATE_BURN_DEVICE
</SECTION>
<SECTION>
<FILE>rb-file-helpers</FILE>
rb_file
......@@ -1461,7 +1442,6 @@ RB_MISSING_FILES_SOURCE_GET_CLASS
<TITLE>RBBrowserSource</TITLE>
RBBrowserSource
RBBrowserSourceClass
rb_browser_source_get_paned_key
rb_browser_source_has_drop_support
<SUBSECTION Standard>
RBBrowserSourcePrivate
......
......@@ -2,7 +2,6 @@
#include <glib-object.h>
#include <gtk/gtk.h>
#include "eel-gconf-extensions.h"
#include "rb-auto-playlist-source.h"
#include "rb-cell-renderer-pixbuf.h"
#include "rb-cell-renderer-rating.h"
......@@ -36,7 +35,6 @@
#include "rb-play-order-random.h"
#include "rb-play-queue-source.h"
#include "rb-plugin.h"
#include "rb-preferences.h"
#include "rb-property-view.h"
#include "rb-query-creator.h"
#include "rb-rating.h"
......
......@@ -14,7 +14,6 @@ rbinclude_HEADERS = \
rb-builder-helpers.h \
rb-debug.h \
rb-file-helpers.h \
rb-preferences.h \
rb-stock-icons.h \
rb-string-value-map.h \
rb-util.h
......@@ -23,8 +22,6 @@ librb_la_SOURCES = \
$(MKDTEMP_FILES) \
$(rbinclude_HEADERS) \
rb-debug.c \
eel-gconf-extensions.c \
eel-gconf-extensions.h \
eggdesktopfile.c \
eggdesktopfile.h \
eggsmclient.c \
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
Copyright (C) 2000, 2001 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301 USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#include <stdlib.h>
#include <gconf/gconf-client.h>
#include <gconf/gconf.h>
#include <glib/gi18n.h>
#include "eel-gconf-extensions.h"
#include "rb-dialog.h"
static GConfClient *global_gconf_client = NULL;
static void
global_client_free (void)
{
if (global_gconf_client == NULL) {
return;
}
g_object_unref (G_OBJECT (global_gconf_client));
global_gconf_client = NULL;
}
/* Public */
GConfClient *
eel_gconf_client_get_global (void)
{
if (global_gconf_client == NULL) {
global_gconf_client = gconf_client_get_default ();
g_atexit (global_client_free);
}
return global_gconf_client;
}
gboolean
eel_gconf_handle_error (GError **error)
{
g_return_val_if_fail (error != NULL, FALSE);
if (*error != NULL) {
g_warning ("%s", (*error)->message);
g_error_free (*error);
*error = NULL;
return TRUE;
}
return FALSE;
}
void
eel_gconf_set_boolean (const char *key,
gboolean boolean_value)
{
GConfClient *client;
GError *error = NULL;
g_return_if_fail (key != NULL);
client = eel_gconf_client_get_global ();
g_return_if_fail (client != NULL);
gconf_client_set_bool (client, key, boolean_value, &error);
eel_gconf_handle_error (&error);
}
gboolean
eel_gconf_get_boolean (const char *key)
{
gboolean result;
GConfClient *client;
GError *error = NULL;
g_return_val_if_fail (key != NULL, FALSE);
client = eel_gconf_client_get_global ();
g_return_val_if_fail (client != NULL, FALSE);
result = gconf_client_get_bool (client, key, &error);
if (eel_gconf_handle_error (&error)) {
result = FALSE;
}
return result;
}
void
eel_gconf_set_integer (const char *key,
int int_value)
{
GConfClient *client;
GError *error = NULL;
g_return_if_fail (key != NULL);
client = eel_gconf_client_get_global ();
g_return_if_fail (client != NULL);
gconf_client_set_int (client, key, int_value, &error);
eel_gconf_handle_error (&error);
}
int
eel_gconf_get_integer (const char *key)
{
int result;
GConfClient *client;
GError *error = NULL;
g_return_val_if_fail (key != NULL, 0);
client = eel_gconf_client_get_global ();
g_return_val_if_fail (client != NULL, 0);
result = gconf_client_get_int (client, key, &error);
if (eel_gconf_handle_error (&error)) {
result = 0;
}
return result;
}
void
eel_gconf_set_float (const char *key,
gfloat float_value)
{
GConfClient *client;
GError *error = NULL;
g_return_if_fail (key != NULL);
client = eel_gconf_client_get_global ();
g_return_if_fail (client != NULL);
gconf_client_set_float (client, key, float_value, &error);
eel_gconf_handle_error (&error);
}
gfloat
eel_gconf_get_float (const char *key)
{
gfloat result;
GConfClient *client;
GError *error = NULL;
g_return_val_if_fail (key != NULL, 0);
client = eel_gconf_client_get_global ();
g_return_val_if_fail (client != NULL, 0);
result = gconf_client_get_float (client, key, &error);
if (eel_gconf_handle_error (&error)) {
result = 0;
}
return result;
}
void
eel_gconf_set_string (const char *key,
const char *string_value)
{
GConfClient *client;
GError *error = NULL;
g_return_if_fail (key != NULL);
g_return_if_fail (string_value != NULL);
client = eel_gconf_client_get_global ();
g_return_if_fail (client != NULL);
gconf_client_set_string (client, key, string_value, &error);
eel_gconf_handle_error (&error);
}
char *
eel_gconf_get_string (const char *key)
{
char *result;
GConfClient *client;
GError *error = NULL;
g_return_val_if_fail (key != NULL, NULL);
client = eel_gconf_client_get_global ();
g_return_val_if_fail (client != NULL, NULL);
result = gconf_client_get_string (client, key, &error);
if (eel_gconf_handle_error (&error)) {
result = g_strdup ("");
}
return result;
}
void
eel_gconf_set_string_list (const char *key,
const GSList *slist)
{
GConfClient *client;
GError *error;
g_return_if_fail (key != NULL);
client = eel_gconf_client_get_global ();
g_return_if_fail (client != NULL);
error = NULL;
gconf_client_set_list (client, key, GCONF_VALUE_STRING,
/* Need cast cause of GConf api bug */
(GSList *) slist,
&error);
eel_gconf_handle_error (&error);
}
GSList *
eel_gconf_get_string_list (const char *key)
{
GSList *slist;
GConfClient *client;
GError *error;
g_return_val_if_fail (key != NULL, NULL);
client = eel_gconf_client_get_global ();
g_return_val_if_fail (client != NULL, NULL);