[totem] Port to GSettings
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] Port to GSettings
- Date: Sat, 4 Sep 2010 15:46:50 +0000 (UTC)
commit 8d65909f1207f6316b2055565b0e94c099c5e916
Author: Philip Withnall <philip tecnocode co uk>
Date: Wed Aug 18 00:00:36 2010 +0100
Port to GSettings
browser-plugin/totem-plugin-viewer.c | 1 -
configure.in | 10 +-
data/Makefile.am | 51 +++---
data/handlers.sh | 49 ++---
data/org.gnome.totem.gschema.xml.in.in | 120 +++++++++++
data/schemas.sh | 66 +++---
data/totem.convert | 26 +++
data/totem.schemas.in | 332 -----------------------------
docs/reference/totem-sections.txt | 2 +-
po/POTFILES.in | 2 +-
po/POTFILES.skip | 1 +
src/backend/bacon-video-widget-gst-0.10.c | 77 +++----
src/plugins/totem-dirs.c | 11 +-
src/plugins/totem-plugins-engine.c | 139 +-----------
src/totem-interface.c | 1 -
src/totem-object.c | 4 +-
src/totem-options.c | 3 +-
src/totem-options.h | 1 -
src/totem-playlist.c | 76 +++----
src/totem-preferences.c | 226 ++++++--------------
src/totem-private.h | 3 +-
src/totem-uri.c | 23 +-
src/totem.c | 20 +-
src/totem.h | 6 +-
24 files changed, 412 insertions(+), 838 deletions(-)
---
diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c
index 6335489..a0ecbb2 100644
--- a/browser-plugin/totem-plugin-viewer.c
+++ b/browser-plugin/totem-plugin-viewer.c
@@ -35,7 +35,6 @@
#include <gio/gio.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
diff --git a/configure.in b/configure.in
index f0232f0..f9a0000 100644
--- a/configure.in
+++ b/configure.in
@@ -43,6 +43,7 @@ AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
# Requirements
GLIB_REQS=2.25.11
+GIO_REQS=2.25.0
GTK_REQS=2.90.3
TOTEM_PLPARSER_REQS=2.29.1
GNOMEICON_REQS=2.15.90
@@ -109,7 +110,7 @@ if test "x$enable_easy_codec_installation" != "xno"; then
])
fi
-MM="gstreamer-0.10 >= $GST_REQS gstreamer-base-0.10 >= $GST_REQS gstreamer-plugins-base-0.10 >= $GSTPLUG_REQS gstreamer-tag-0.10 >= $GSTPLUG_REQS gconf-2.0"
+MM="gstreamer-0.10 >= $GST_REQS gstreamer-base-0.10 >= $GST_REQS gstreamer-plugins-base-0.10 >= $GSTPLUG_REQS gstreamer-tag-0.10 >= $GSTPLUG_REQS"
PKG_CHECK_MODULES(GST, $MM)
GST_LIBS="$GST_LIBS -lgstbase-$GST_MAJORMINOR -lgstinterfaces-$GST_MAJORMINOR -lgstvideo-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR -lgstpbutils-$GST_MAJORMINOR -lgsttag-$GST_MAJORMINOR"
AC_SUBST(GST_LIBS)
@@ -190,10 +191,9 @@ dnl Pkg-config checks
PKG_CHECK_MODULES([DEPENDENCY],[
glib-2.0 >= $GLIB_REQS
- gio-2.0
+ gio-2.0 >= $GIO_REQS
gtk+-3.0 >= $GTK_REQS
gmodule-2.0
- gconf-2.0
totem-plparser >= $TOTEM_PLPARSER_REQS
gstreamer-tag-0.10 >= 0.10.26
cairo])
@@ -726,9 +726,10 @@ if test "x$with_dbus" != "xno"; then
fi
AM_CONDITIONAL(WITH_DBUS, test "x$enable_dbus" = "xyes")
-AC_PATH_PROG(GCONFTOOL, gconftool-2)
AM_GCONF_SOURCE_2
+GLIB_GSETTINGS
+
GNOME_COMMON_INIT
GNOME_DEBUG_CHECK
GNOME_COMPILE_WARNINGS([maximum])
@@ -816,6 +817,7 @@ src/plugins/chapters/Makefile
src/backend/Makefile
browser-plugin/Makefile
data/Makefile
+data/org.gnome.totem.gschema.xml.in
data/totem.desktop.in.in
data/totem.pc
data/icons/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index 4025049..4ab25f0 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -54,34 +54,33 @@ nautilus-audio-mime-types.h: mime-type-include.sh mime-type-list.txt mime-functi
$(AM_V_GEN) $(srcdir)/mime-type-include.sh --nautilus $(srcdir)/mime-type-list.txt \
> $@
-update-gconf.sh: totem-video-thumbnail.schemas.in
+update-gsettings.sh: org.gnome.desktop.thumbnailers.gschema.xml.in
-totem-video-thumbnail.schemas.in: schemas.sh mime-type-list.txt mime-functions.sh
+org.gnome.desktop.thumbnailers.gschema.xml.in: schemas.sh mime-type-list.txt mime-functions.sh
$(AM_V_GEN) $(srcdir)/schemas.sh $(srcdir)/mime-type-list.txt $(bindir) \
> $@ \
- 3> update-gconf.sh
+ 3> update-gsettings.sh
-totem-handlers.schemas.in: handlers.sh
+org.gnome.desktop.url-handlers.gschema.xml.in: handlers.sh
$(AM_V_GEN) $(srcdir)/handlers.sh > $@
-generated_schema_in_files = totem-video-thumbnail.schemas.in totem-handlers.schemas.in
-schema_in_files = totem.schemas.in $(generated_schema_in_files)
-schemadir = $(GCONF_SCHEMA_FILE_DIR)
-schema_DATA = $(schema_in_files:.schemas.in=.schemas)
- INTLTOOL_SCHEMAS_RULE@
+generated_schema_files = org.gnome.desktop.thumbnailers.gschema.xml org.gnome.desktop.url-handlers.gschema.xml
+gsettings_ENUM_NAMESPACE = org.gnome.totem
+gsettings_ENUM_FILES = $(top_srcdir)/src/*.h $(top_srcdir)/src/backend/*.h
+gsettings_SCHEMAS = org.gnome.totem.gschema.xml $(generated_schema_files)
+
+ INTLTOOL_XML_NOMERGE_RULE@
+
+ GSETTINGS_RULES@
+
+convertdir = $(datadir)/GConf/gsettings
+convert_DATA = totem.convert
+
+# Man pages
totem-video-thumbnailer.1: totem-video-thumbnailer.pod
$(AM_V_GEN) pod2man -c "" -s 1 -q none -n totem-video-thumbnailer -r GNOME $< > $@
-install-data-local: $(schema_DATA)
-if GCONF_SCHEMAS_INSTALL
- if test -z "$(DESTDIR)" ; then \
- for p in $^ ; do \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p 2>&1 > /dev/null; \
- done \
- fi
-endif
-
# pkg-config file for the plugin API
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = totem.pc
@@ -96,7 +95,8 @@ EXTRA_DIST = \
mime-type-list.txt \
schemas.sh \
mime-functions.sh \
- totem.schemas.in \
+ org.gnome.totem.gschema.xml.in.in \
+ totem.convert \
totem-video-thumbnailer.1 \
totem-video-thumbnailer.pod
@@ -104,12 +104,13 @@ CLEANFILES = \
*.bak *.uip core* *.orig *~ \
$(desktop_in_files) \
$(desktop_DATA) \
- $(generated_schema_in_files) \
- $(schema_DATA) \
- totem-handlers.schemas.in \
+ $(generated_schema_files) \
+ $(gsettings_SCHEMAS) \
+ totem-handlers.gschema.xml.in \
totem-mime-types.h \
- totem-video-thumbnail.schemas.in\
nautilus-audio-mime-types.h \
- update-gconf.sh
+ update-gsettings.sh
+
+DISTCLEANFILES = $(gsettings_SCHEMAS)
-DISTCLEANFILES =
+MAINTAINERCLEANFILES = $(gsettings_SCHEMAS:.xml=.valid)
diff --git a/data/handlers.sh b/data/handlers.sh
index c3fc8cc..1549323 100755
--- a/data/handlers.sh
+++ b/data/handlers.sh
@@ -1,48 +1,47 @@
#!/bin/sh
-OWNER=totem
-
schema()
{
- echo ;
- echo " <schema>";
- echo " <key>/schemas/desktop/gnome/url-handlers/$NAME/$KEY</key>";
- echo " <applyto>/desktop/gnome/url-handlers/$NAME/$KEY</applyto>";
- echo " <owner>$OWNER</owner>";
- echo " <type>$TYPE</type>";
- echo " <default>$DEFAULT</default>";
- echo " <locale name=\"C\">";
- echo " <short></short>";
- echo " <long></long>";
- echo " </locale>";
- echo " </schema>";
- echo;
+ echo " <key name='$KEY' type='$TYPE'>";
+ echo " <default>$DEFAULT</default>";
+ echo " </key>";
}
SCHEMES="pnm mms net rtp rtsp mmsh uvox icy icyx"
-echo "<gconfschemafile>";
-echo " <schemalist>";
+echo "<schemalist>";
+
+echo " <schema id='org.gnome.desktop.url-handlers' path='/desktop/gnome/url-handlers/'>";
+
+for i in $SCHEMES ; do
+ NAME=`echo $i | sed 's,/,-,' | sed 's,+,-,' | sed 's,\.,-,'`
+ echo " <child name='$NAME' schema='org.gnome.desktop.url-handlers.$NAME'/>";
+done
+
+echo " </schema>";
for i in $SCHEMES ; do
NAME="$i";
+ echo " <schema id='org.gnome.desktop.url-handlers.$NAME' path='/desktop/gnome/url-handlers/$NAME/'>";
+
KEY="command"
- TYPE="string";
- DEFAULT="totem \"%s\"";
+ TYPE="s";
+ DEFAULT="'totem \"%s\"'";
schema;
- KEY="needs_terminal"
- TYPE="bool";
+ KEY="needs-terminal"
+ TYPE="b";
DEFAULT="false";
schema;
KEY="enabled";
- TYPE="bool";
+ TYPE="b";
DEFAULT="true";
- schema
+ schema;
+
+ echo " </schema>"
done
-echo " </schemalist>";
-echo "</gconfschemafile>"
+echo "</schemalist>"
diff --git a/data/org.gnome.totem.gschema.xml.in.in b/data/org.gnome.totem.gschema.xml.in.in
new file mode 100644
index 0000000..26aeda3
--- /dev/null
+++ b/data/org.gnome.totem.gschema.xml.in.in
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+ <schema id="org.gnome.totem" path="/apps/totem/" gettext-domain="@GETTEXT_PACKAGE@">
+ <key name="lock-screensaver-on-audio" type="b">
+ <default>true</default>
+ <_summary>Allow the screensaver to activate when playing audio</_summary>
+ <_description>Allow the screensaver to activate when playing audio. Disable if you have monitor-powered speakers.</_description>
+ </key>
+ <key name="show-vfx" type="b">
+ <default>true</default>
+ <_summary>Show visual effects when no video is displayed</_summary>
+ <_description>Show visual effects when playing an audio only file.</_description>
+ </key>
+ <key name="visual" type="s">
+ <default>'goom'</default>
+ <_summary>Name of the visual effects plugins</_summary>
+ </key>
+ <key name="brightness" type="i">
+ <default>32767</default>
+ <_summary>The brightness of the video</_summary>
+ </key>
+ <key name="contrast" type="i">
+ <default>32767</default>
+ <_summary>The contrast of the video</_summary>
+ </key>
+ <key name="hue" type="i">
+ <default>32767</default>
+ <_summary>The hue of the video</_summary>
+ </key>
+ <key name="saturation" type="i">
+ <default>32767</default>
+ <_summary>The saturation of the video</_summary>
+ </key>
+ <key name="auto-resize" type="b">
+ <default>false</default>
+ <_summary>Resize the canvas automatically on file load</_summary>
+ </key>
+ <key name="connection-speed" type="i">
+ <default>11</default>
+ <_summary>Network connection speed</_summary>
+ <_description>Approximate network connection speed, used to select quality on media over the network: "0" for 14.4 Kbps Modem, "1" for 19.2 Kbps Modem, "2" for 28.8 Kbps Modem, "3" for 33.6 Kbps Modem, "4" for 34.4 Kbps Modem, "5" for 56 Kbps Modem/ISDN, "6" for 112 Kbps Dual ISDN/DSL, "7" for 256 Kbps DSL/Cable, "8" for 384 Kbps DSL/Cable, "9" for 512 Kbps DSL/Cable, "10" for 1.5 Mbps T1/Intranet/LAN, "11" for Intranet/LAN.</_description>
+ </key>
+ <key name="repeat" type="b">
+ <default>false</default>
+ <_summary>Repeat mode</_summary>
+ </key>
+ <key name="shuffle" type="b">
+ <default>false</default>
+ <_summary>Shuffle mode</_summary>
+ </key>
+ <key name="disable-deinterlacing" type="b">
+ <default>false</default>
+ <_summary>Whether to disable deinterlacing for interlaced movies</_summary>
+ </key>
+ <key name="debug" type="b">
+ <default>false</default>
+ <_summary>Whether to enable debug for the playback engine</_summary>
+ </key>
+ <key name="audio-output-type" type="i">
+ <default>0</default>
+ <_summary>Type of audio output to use</_summary>
+ <_description>Type of audio output to use: "0" for stereo, "1" for 4-channel output, "2" for 5.0 channel output, "3" for 5.1 channel output, "4" for AC3 Passthrough.</_description>
+ </key>
+ <key name="visual-quality" type="i">
+ <default>0</default>
+ <_summary>Visualization quality setting</_summary>
+ <_description>Quality settings for the audio visualization: "0" for small, "1" for normal, "2" for large, "3" for extra large.</_description>
+ </key>
+ <key name="network-buffer-threshold" type="d">
+ <default>2</default>
+ <_summary>Network buffering threshold</_summary>
+ <_description>Amount of data to buffer for network streams before starting to display the stream (in seconds).</_description>
+ </key>
+ <key name="subtitle-font" type="s">
+ <default>'Sans Bold 20'</default>
+ <_summary>Subtitle font</_summary>
+ <_description>Pango font description for subtitle rendering.</_description>
+ </key>
+ <key name="subtitle-encoding" type="s">
+ <default l10n="messages" context="subtitle-encoding">
+ <!-- Translators: This is default subtitle encoding
+ character set. You can change this to be the most common
+ encoding for fansub subtitles in your language. File a bug
+ against Totem, and leave UTF-8 as the default if in doubt. -->
+ 'UTF-8'</default>
+ <_summary>Subtitle encoding</_summary>
+ <_description>Encoding character set for subtitle.</_description>
+ </key>
+ <key name="open-path" type="s">
+ <default>''</default>
+ <_summary>Default location for the "Open..." dialogs</_summary>
+ <_description>Default location for the "Open..." dialogs. Default is the current directory.</_description>
+ </key>
+ <key name="screenshot-save-path" type="s">
+ <default>''</default>
+ <_summary>Default location for the "Take Screenshot" dialogs</_summary>
+ <_description>Default location for the "Take Screenshot" dialogs. Default is the Pictures directory.</_description>
+ </key>
+ <key name="disable-user-plugins" type="b">
+ <default>false</default>
+ <_summary>Whether to disable the plugins in the user's home directory</_summary>
+ </key>
+ <key name="disable-keyboard-shortcuts" type="b">
+ <default>false</default>
+ <_summary>Whether to disable the keyboard shortcuts</_summary>
+ </key>
+ <key name="autoload-subtitles" type="b">
+ <default>false</default>
+ <_summary>Whether to autoload text subtitle files when a movie is loaded</_summary>
+ </key>
+ <key name="autoload-chapters" type="b">
+ <default>true</default>
+ <_summary>Whether to autoload external chapter files when a movie is loaded</_summary>
+ </key>
+ <key name="remember-position" type="b">
+ <default>false</default>
+ <_summary>Whether to remember the position of played audio/video files when pausing or closing them</_summary>
+ </key>
+ </schema>
+</schemalist>
diff --git a/data/schemas.sh b/data/schemas.sh
index 8c53b0d..7484452 100755
--- a/data/schemas.sh
+++ b/data/schemas.sh
@@ -1,30 +1,19 @@
#!/bin/sh
-OWNER=totem
COMMAND="$2/totem-video-thumbnailer -s %s %u %o"
. `dirname $0`/mime-functions.sh
upd_schema()
{
- echo "gconftool-2 --set --type $TYPE /desktop/gnome/thumbnailers/$NAME \"$DEFAULT\"" 1>&3
+ echo "gsettings set org.gnome.desktop.thumbnailers.$DIR $NAME \"$DEFAULT\"" 1>&3
}
schema()
{
- echo ;
- echo " <schema>";
- echo " <key>/schemas/desktop/gnome/thumbnailers/$NAME</key>";
- echo " <applyto>/desktop/gnome/thumbnailers/$NAME</applyto>";
- echo " <owner>$OWNER</owner>";
- echo " <type>$TYPE</type>";
- echo " <default>$DEFAULT</default>";
- echo " <locale name=\"C\">";
- echo " <short></short>";
- echo " <long></long>";
- echo " </locale>";
- echo " </schema>";
- echo;
+ echo " <key name='$NAME' type='$TYPE'>";
+ echo " <default>$DEFAULT</default>";
+ echo " </key>";
upd_schema;
}
@@ -32,39 +21,54 @@ schema()
get_video_mimetypes $1;
-echo "<gconfschemafile>";
-echo " <schemalist>";
+echo "<schemalist>";
+
+echo " <schema id='org.gnome.desktop.thumbnailers' path='/desktop/gnome/thumbnailers/'>";
+
+for i in $MIMETYPES ; do
+ NAME=`echo $i | sed 's,/,-,' | sed 's,+,-,' | sed 's,\.,-,'`
+ echo " <child name='$NAME' schema='org.gnome.desktop.thumbnailers.$NAME'/>";
+done
+
+echo " </schema>";
for i in $MIMETYPES ; do
- DIR=`echo $i | sed 's,/,@,' | sed 's,+,@,'`
+ DIR=`echo $i | sed 's,/,-,' | sed 's,+,-,' | sed 's,\.,-,'`
- NAME="$DIR/enable";
- TYPE="bool";
+ echo " <schema id='org.gnome.desktop.thumbnailers.$DIR' path='/desktop/gnome/thumbnailers/$DIR/'>";
+
+ NAME="enable";
+ TYPE="b";
DEFAULT="true";
schema;
- NAME="$DIR/command";
- TYPE="string";
- DEFAULT="$COMMAND";
+ NAME="command";
+ TYPE="s";
+ DEFAULT="'$COMMAND'";
schema;
+
+ echo " </schema>";
done
get_audio_mimetypes $1;
for i in $MIMETYPES ; do
- DIR=`echo $i | sed 's,/,@,' | sed 's,+,@,'`
+ DIR=`echo $i | sed 's,/,-,' | sed 's,+,-,' | sed 's,\.,-,'`
- NAME="$DIR/enable";
- TYPE="bool";
+ echo " <schema id='org.gnome.desktop.thumbnailers.$DIR' path='/desktop/gnome/thumbnailers/$DIR/'>";
+
+ NAME="enable";
+ TYPE="b";
DEFAULT="false";
schema;
- NAME="$DIR/command";
- TYPE="string";
- DEFAULT="$COMMAND";
+ NAME="command";
+ TYPE="s";
+ DEFAULT="'$COMMAND'";
schema;
+
+ echo " </schema>";
done
-echo " </schemalist>";
-echo "</gconfschemafile>"
+echo "</schemalist>"
diff --git a/data/totem.convert b/data/totem.convert
new file mode 100644
index 0000000..b422301
--- /dev/null
+++ b/data/totem.convert
@@ -0,0 +1,26 @@
+[org.gnome.totem]
+lock-screensaver-on-audio = /apps/totem/lock_screensaver_on_audio
+show-vfx = /apps/totem/show_vfx
+visual = /apps/totem/visual
+brightness = /apps/totem/brightness
+contrast = /apps/totem/contrast
+hue = /apps/totem/hue
+saturation = /apps/totem/saturation
+auto-resize = /apps/totem/auto_resize
+connection-speed = /apps/totem/connection_speed
+repeat = /apps/totem/repeat
+shuffle = /apps/totem/shuffle
+disable-deinterlacing = /apps/totem/disable_deinterlacing
+debug = /apps/totem/debug
+audio-output-type = /apps/totem/audio_output_type
+visual-quality = /apps/totem/visual_quality
+network-buffer-threshold = /apps/totem/network-buffer-threshold
+subtitle-font = /apps/totem/subtitle_font
+subtitle-encoding = /apps/totem/subtitle_encoding
+open-path = /apps/totem/open_path
+screenshot-save-path = /apps/totem/screenshot_save_path
+disable-user-plugins = /apps/totem/disable_user_plugins
+disable-keyboard-shortcuts = /apps/totem/disable_keyboard_shortcuts
+autoload-subtitles = /apps/totem/autoload_subtitles
+autoload-chapters = /apps/totem/autoload_chapters
+remember-position = /apps/totem/remember_position
diff --git a/docs/reference/totem-sections.txt b/docs/reference/totem-sections.txt
index b065815..98fdbce 100644
--- a/docs/reference/totem-sections.txt
+++ b/docs/reference/totem-sections.txt
@@ -6,7 +6,7 @@ TotemObject
TotemObjectClass
TotemRemoteCommand
TotemRemoteSetting
-TOTEM_GCONF_PREFIX
+TOTEM_GSETTINGS_SCHEMA
totem_object_plugins_init
totem_object_plugins_shutdown
totem_file_opened
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a61eb2f..4efa280 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,7 +7,7 @@
[type: gettext/glade]data/video-list.ui
data/totem.desktop.in.in.in
[type: gettext/glade]data/totem.ui
-data/totem.schemas.in
+data/org.gnome.totem.gschema.xml.in.in
[type: gettext/glade]data/uri.ui
src/eggdesktopfile.c
src/eggfileformatchooser.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 4dd3716..d51a833 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,4 +1,5 @@
data/mozilla-viewer.ui
+data/org.gnome.totem.gschema.xml.in
data/totem-handlers.schemas.in
data/totem-video-thumbnail.schemas.in
data/totem.desktop.in
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 01062f9..f17c05d 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -76,7 +76,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
-#include <gconf/gconf-client.h>
#include "bacon-video-widget.h"
#include "bacon-video-widget-gst-missing-plugins.h"
@@ -143,10 +142,10 @@ enum
};
static const gchar *video_props_str[4] = {
- GCONF_PREFIX "/brightness",
- GCONF_PREFIX "/contrast",
- GCONF_PREFIX "/saturation",
- GCONF_PREFIX "/hue"
+ "brightness",
+ "contrast",
+ "saturation",
+ "hue"
};
/* GstPlayFlags flags from playbin2 */
@@ -240,7 +239,7 @@ struct BaconVideoWidgetPrivate
GstMessageType ignore_messages_mask;
- GConfClient *gc;
+ GSettings *settings;
GstBus *bus;
gulong sig_bus_sync;
@@ -3277,8 +3276,7 @@ bacon_video_widget_set_connection_speed (BaconVideoWidget * bvw, int speed)
if (bvw->priv->connection_speed != speed) {
bvw->priv->connection_speed = speed;
- gconf_client_set_int (bvw->priv->gc,
- GCONF_PREFIX"/connection_speed", speed, NULL);
+ g_settings_set_int (bvw->priv->settings, "connection-speed", speed);
g_object_notify (G_OBJECT (bvw), "connection-speed");
}
@@ -3457,7 +3455,7 @@ bacon_video_widget_get_audio_out_type (BaconVideoWidget *bvw)
* @type: the new audio output type
*
* Sets the audio output type (number of speaker channels) in the video widget,
- * and stores it in GConf.
+ * and stores it in GSettings.
**/
void
bacon_video_widget_set_audio_out_type (BaconVideoWidget *bvw,
@@ -3472,8 +3470,7 @@ bacon_video_widget_set_audio_out_type (BaconVideoWidget *bvw,
return;
bvw->priv->speakersetup = type;
- gconf_client_set_int (bvw->priv->gc,
- GCONF_PREFIX"/audio_output_type", type, NULL);
+ g_settings_set_int (bvw->priv->settings, "audio-output-type", type);
set_audio_filter (bvw);
}
@@ -4865,8 +4862,8 @@ setup_vis_find_factory (BaconVideoWidget * bvw, const gchar * vis_name)
/* set to long name as key so that the preferences dialog gets it right */
if (f && strcmp (vis_name, GST_PLUGIN_FEATURE_NAME (f)) == 0) {
- gconf_client_set_string (bvw->priv->gc, GCONF_PREFIX "/visual",
- gst_element_factory_get_longname (f), NULL);
+ g_settings_set_string (bvw->priv->settings, "visual",
+ gst_element_factory_get_longname (f));
fac = f;
goto done;
}
@@ -5395,11 +5392,11 @@ bacon_video_widget_get_video_property (BaconVideoWidget *bvw,
}
}
- /* value wasn't found, get from gconf */
+ /* value wasn't found, get from GSettings */
if (ret == 0)
- ret = gconf_client_get_int (bvw->priv->gc, video_props_str[type], NULL);
+ ret = g_settings_get_int (bvw->priv->settings, video_props_str[type]);
- GST_DEBUG ("nothing found for type %d, returning value %d from gconf key %s",
+ GST_DEBUG ("nothing found for type %d, returning value %d from GSettings key %s",
type, ret, video_props_str[type]);
done:
@@ -5501,10 +5498,10 @@ bacon_video_widget_set_video_property (BaconVideoWidget *bvw,
}
}
- /* save in gconf */
- gconf_client_set_int (bvw->priv->gc, video_props_str[type], value, NULL);
+ /* save in GSettings */
+ g_settings_set_int (bvw->priv->settings, video_props_str[type], value);
- GST_DEBUG ("setting value %d on gconf key %s", value, video_props_str[type]);
+ GST_DEBUG ("setting value %d on GSettings key %s", value, video_props_str[type]);
}
/**
@@ -6520,23 +6517,18 @@ find_colorbalance_element (GstElement *element, GValue * ret, GstElement **cb)
}
static void
-bvw_update_brightness_and_contrast_from_gconf (BaconVideoWidget * bvw)
+bvw_update_brightness_and_contrast_from_gsettings (BaconVideoWidget * bvw)
{
- GConfValue *confvalue;
guint i;
g_return_if_fail (g_thread_self() == gui_thread);
/* Setup brightness and contrast */
- GST_LOG ("updating brightness and contrast from GConf settings");
+ GST_LOG ("updating brightness and contrast from GSettings settings");
for (i = 0; i < G_N_ELEMENTS (video_props_str); i++) {
- confvalue = gconf_client_get_without_default (bvw->priv->gc,
- video_props_str[i], NULL);
- if (confvalue != NULL) {
- bacon_video_widget_set_video_property (bvw, i,
- gconf_value_get_int (confvalue));
- gconf_value_free (confvalue);
- }
+ gint value = g_settings_get_int (bvw->priv->settings, video_props_str[i]);
+ if (value > 0)
+ bacon_video_widget_set_video_property (bvw, i, value);
}
}
@@ -6657,10 +6649,10 @@ bvw_update_interface_implementations (BaconVideoWidget *bvw)
}
/* Setup brightness and contrast from configured values (do it delayed if
- * we're within a streaming thread, otherwise gconf/orbit/whatever may
+ * we're within a streaming thread, otherwise GSettings/orbit/whatever may
* iterate or otherwise mess with the default main context and cause all
* kinds of nasty issues) */
- bvw_update_brightness_and_contrast_from_gconf (bvw);
+ bvw_update_brightness_and_contrast_from_gsettings (bvw);
if (old_xoverlay)
gst_object_unref (GST_OBJECT (old_xoverlay));
@@ -6802,11 +6794,11 @@ GtkWidget *
bacon_video_widget_new (int width, int height,
BvwUseType type, GError ** error)
{
- GConfValue *confvalue;
BaconVideoWidget *bvw;
GstElement *audio_sink = NULL, *video_sink = NULL;
gchar *version_str;
GstPlayFlags flags;
+ gint value;
#ifndef GST_DISABLE_GST_DEBUG
if (_totem_gst_debug_cat == NULL) {
@@ -6875,8 +6867,8 @@ bacon_video_widget_new (int width, int height,
bvw->priv->logo_mode = FALSE;
bvw->priv->auto_resize = FALSE;
- /* gconf setting in backend */
- bvw->priv->gc = gconf_client_get_default ();
+ /* GSettings setting in backend */
+ bvw->priv->settings = g_settings_new ("org.gnome.totem");
if (type == BVW_USE_TYPE_VIDEO || type == BVW_USE_TYPE_AUDIO) {
audio_sink = gst_element_factory_make ("gconfaudiosink", "audio-sink");
@@ -7105,13 +7097,11 @@ bacon_video_widget_new (int width, int height,
}
/* audio out, if any */
- confvalue = gconf_client_get_without_default (bvw->priv->gc,
- GCONF_PREFIX"/audio_output_type", NULL);
- if (confvalue != NULL &&
+ value = g_settings_get_int (bvw->priv->settings, "audio-output-type");
+ if (value > 0 &&
(type != BVW_USE_TYPE_METADATA && type != BVW_USE_TYPE_CAPTURE)) {
- bvw->priv->speakersetup = gconf_value_get_int (confvalue);
+ bvw->priv->speakersetup = value;
bacon_video_widget_set_audio_out_type (bvw, bvw->priv->speakersetup);
- gconf_value_free (confvalue);
} else if (type == BVW_USE_TYPE_METADATA || type == BVW_USE_TYPE_CAPTURE) {
bvw->priv->speakersetup = -1;
/* don't set up a filter for the speaker setup, anything is fine */
@@ -7121,12 +7111,9 @@ bacon_video_widget_new (int width, int height,
}
/* tv/conn (not used yet) */
- confvalue = gconf_client_get_without_default (bvw->priv->gc,
- GCONF_PREFIX "/connection_speed", NULL);
- if (confvalue != NULL) {
- bacon_video_widget_set_connection_speed (bvw,
- gconf_value_get_int (confvalue));
- gconf_value_free (confvalue);
+ value = g_settings_get_int (bvw->priv->settings, "connection-speed");
+ if (value > 0) {
+ bacon_video_widget_set_connection_speed (bvw, value);
} else {
bacon_video_widget_set_connection_speed (bvw,
bvw->priv->connection_speed);
diff --git a/src/plugins/totem-dirs.c b/src/plugins/totem-dirs.c
index 3f34c30..f5604a8 100644
--- a/src/plugins/totem-dirs.c
+++ b/src/plugins/totem-dirs.c
@@ -40,7 +40,6 @@
#endif
#include <glib.h>
-#include <gconf/gconf-client.h>
#include "totem-dirs.h"
#include "totem-plugins-engine.h"
@@ -52,7 +51,7 @@
/**
* totem_get_plugin_paths:
*
- * Return a %NULL-terminated array of paths to directories which can contain Totem plugins. This respects the GConf disable_user_plugins setting.
+ * Return a %NULL-terminated array of paths to directories which can contain Totem plugins. This respects the GSettings disable_user_plugins setting.
*
* Return value: a %NULL-terminated array of paths to plugin directories
*
@@ -63,7 +62,7 @@ totem_get_plugin_paths (void)
{
GPtrArray *paths;
char *path;
- GConfClient *client;
+ GSettings *settings;
gboolean uninstalled;
paths = g_ptr_array_new ();
@@ -77,12 +76,14 @@ totem_get_plugin_paths (void)
}
#endif
- client = gconf_client_get_default ();
- if (gconf_client_get_bool (client, GCONF_PREFIX"/disable_user_plugins", NULL) == FALSE) {
+ settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
+ if (g_settings_get_boolean (settings, "disable-user-plugins") == FALSE) {
path = g_build_filename (totem_data_dot_dir (), "plugins", NULL);
g_ptr_array_add (paths, path);
}
+ g_object_unref (settings);
+
if (uninstalled == FALSE) {
path = g_strdup (TOTEM_PLUGIN_DIR);
g_ptr_array_add (paths, path);
diff --git a/src/plugins/totem-plugins-engine.c b/src/plugins/totem-plugins-engine.c
index bf6f76c..04f58e2 100644
--- a/src/plugins/totem-plugins-engine.c
+++ b/src/plugins/totem-plugins-engine.c
@@ -35,7 +35,6 @@
#include <glib/gi18n.h>
#include <glib.h>
-#include <gconf/gconf-client.h>
#include <girepository.h>
#include <libpeas/peas-activatable.h>
#include <libpeas/peas-extension-set.h>
@@ -43,25 +42,16 @@
#include "totem-dirs.h"
#include "totem-plugins-engine.h"
-#define GCONF_PREFIX_PLUGINS GCONF_PREFIX"/plugins"
-#define GCONF_PREFIX_PLUGIN GCONF_PREFIX"/plugins/%s"
-#define GCONF_PLUGIN_ACTIVE GCONF_PREFIX_PLUGINS"/%s/active"
-
typedef struct _TotemPluginsEnginePrivate{
PeasExtensionSet *activatable_extensions;
TotemObject *totem;
- GConfClient *client;
- guint notification_id;
+ GSettings *settings;
guint garbage_collect_id;
} _TotemPluginsEnginePrivate;
G_DEFINE_TYPE(TotemPluginsEngine, totem_plugins_engine, PEAS_TYPE_ENGINE)
static void totem_plugins_engine_finalize (GObject *object);
-static void totem_plugins_engine_gconf_cb (GConfClient *gconf_client,
- guint cnxn_id,
- GConfEntry *entry,
- TotemPluginsEngine *engine);
#if 0
static void totem_plugins_engine_activate_plugin (PeasEngine *engine,
PeasPluginInfo *info);
@@ -86,67 +76,13 @@ totem_plugins_engine_class_init (TotemPluginsEngineClass *klass)
}
static void
-totem_plugins_engine_load_all (TotemPluginsEngine *engine)
-{
- const GList *list, *l;
- GPtrArray *activate;
-
- g_message ("totem_plugins_engine_load_all");
-
- activate = g_ptr_array_new ();
- list = peas_engine_get_plugin_list (PEAS_ENGINE (engine));
- for (l = list; l != NULL; l = l->next) {
- PeasPluginInfo *info = l->data;
- char *key_name;
-
- g_message ("checking peas_plugin_info_get_module_name (info) %s", peas_plugin_info_get_module_name (info));
-
- /* Builtin plugins are activated by default; other plugins aren't */
- if (peas_plugin_info_is_builtin (info)) {
- g_ptr_array_add (activate, (gpointer) peas_plugin_info_get_module_name (info));
- g_message ("peas_plugin_info_get_module_name (info) %s, to activate", peas_plugin_info_get_module_name (info));
- continue;
- }
- key_name = g_strdup_printf (GCONF_PLUGIN_ACTIVE, peas_plugin_info_get_module_name (info));
- if (gconf_client_get_bool (engine->priv->client, key_name, NULL) != FALSE) {
- g_message ("peas_plugin_info_get_module_name (info) %s, to activate", peas_plugin_info_get_module_name (info));
- g_ptr_array_add (activate, (gpointer) peas_plugin_info_get_module_name (info));
- }
- g_free (key_name);
- }
- g_ptr_array_add (activate, NULL);
-
- peas_engine_set_loaded_plugins (PEAS_ENGINE (engine), (const char **) activate->pdata);
- g_ptr_array_free (activate, TRUE);
-}
-
-static void
-totem_plugins_engine_monitor (TotemPluginsEngine *engine)
-{
- engine->priv->notification_id = gconf_client_notify_add (engine->priv->client,
- GCONF_PREFIX_PLUGINS,
- (GConfClientNotifyFunc)totem_plugins_engine_gconf_cb,
- engine,
- NULL,
- NULL);
-}
-
-static void
on_activatable_extension_added (PeasExtensionSet *set,
PeasPluginInfo *info,
PeasExtension *exten,
TotemPluginsEngine *engine)
{
g_message ("on_activatable_extension_added");
- if (peas_extension_call (exten, "activate", engine->priv->totem)) {
- if (peas_plugin_info_is_builtin (info) == FALSE) {
- char *key_name;
-
- key_name = g_strdup_printf (GCONF_PLUGIN_ACTIVE,
- peas_plugin_info_get_module_name (info));
- gconf_client_set_bool (engine->priv->client, key_name, TRUE, NULL);
- }
- }
+ peas_extension_call (exten, "activate");
}
static void
@@ -156,15 +92,7 @@ on_activatable_extension_removed (PeasExtensionSet *set,
TotemPluginsEngine *engine)
{
g_message ("on_activatable_extension_removed");
- peas_extension_call (exten, "deactivate", engine->priv->totem);
-
- if (peas_plugin_info_is_builtin (info) == FALSE) {
- char *key_name;
-
- key_name = g_strdup_printf (GCONF_PLUGIN_ACTIVE,
- peas_plugin_info_get_module_name (info));
- gconf_client_set_bool (engine->priv->client, key_name, FALSE, NULL);
- }
+ peas_extension_call (exten, "deactivate");
}
TotemPluginsEngine *
@@ -210,16 +138,14 @@ totem_plugins_engine_get_default (TotemObject *totem)
PEAS_TYPE_ACTIVATABLE,
"object", totem,
NULL);
- totem_plugins_engine_load_all (engine);
- totem_plugins_engine_monitor (engine);
-
- peas_extension_set_call (engine->priv->activatable_extensions, "activate", engine->priv->totem);
g_signal_connect (engine->priv->activatable_extensions, "extension-added",
G_CALLBACK (on_activatable_extension_added), engine);
g_signal_connect (engine->priv->activatable_extensions, "extension-removed",
G_CALLBACK (on_activatable_extension_removed), engine);
+ g_settings_bind (engine->priv->settings, "active-plugins", engine, "loaded-plugins", G_SETTINGS_BIND_DEFAULT);
+
return engine;
}
@@ -229,8 +155,8 @@ totem_plugins_engine_init (TotemPluginsEngine *engine)
engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine,
TOTEM_TYPE_PLUGINS_ENGINE,
TotemPluginsEnginePrivate);
- engine->priv->client = gconf_client_get_default ();
- gconf_client_add_dir (engine->priv->client, GCONF_PREFIX_PLUGINS, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
+
+ engine->priv->settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
/* Commented out because it's a no-op. A further section is commented out below, and more's commented out
* in totem-python-module.c. */
@@ -248,8 +174,7 @@ totem_plugins_engine_finalize (GObject *object)
G_CALLBACK (on_activatable_extension_removed), engine);
if (engine->priv->totem) {
- peas_extension_set_call (engine->priv->activatable_extensions,
- "deactivate", engine->priv->totem);
+ peas_extension_set_call (engine->priv->activatable_extensions, "deactivate");
g_object_unref (engine->priv->totem);
engine->priv->totem = NULL;
@@ -260,51 +185,9 @@ totem_plugins_engine_finalize (GObject *object)
engine->priv->garbage_collect_id = 0;
peas_engine_garbage_collect (PEAS_ENGINE (engine));
- if (engine->priv->notification_id > 0)
- gconf_client_notify_remove (engine->priv->client,
- engine->priv->notification_id);
- engine->priv->notification_id = 0;
-
- if (engine->priv->client != NULL)
- g_object_unref (engine->priv->client);
- engine->priv->client = NULL;
+ if (engine->priv->settings != NULL)
+ g_object_unref (engine->priv->settings);
+ engine->priv->settings = NULL;
G_OBJECT_CLASS (totem_plugins_engine_parent_class)->finalize (object);
}
-
-static void
-totem_plugins_engine_gconf_cb (GConfClient *gconf_client,
- guint cnxn_id,
- GConfEntry *entry,
- TotemPluginsEngine *engine)
-{
- char *dirname;
- char *plugin_name;
- char *action_name;
- PeasPluginInfo *info;
-
- dirname = g_path_get_dirname (gconf_entry_get_key (entry));
- plugin_name = g_path_get_basename (dirname);
- g_free (dirname);
-
- info = peas_engine_get_plugin_info (PEAS_ENGINE (engine), plugin_name);
- g_free (plugin_name);
-
- if (info == NULL)
- return;
-
- action_name = g_path_get_basename (gconf_entry_get_key (entry));
- if (action_name == NULL)
- return;
-
- if (g_str_equal (action_name, "active") != FALSE) {
- if (gconf_value_get_bool (entry->value)) {
- peas_engine_load_plugin (PEAS_ENGINE (engine), info);
- } else {
- peas_engine_unload_plugin (PEAS_ENGINE (engine), info);
- }
- }
-
- g_free (action_name);
-}
-
diff --git a/src/totem-interface.c b/src/totem-interface.c
index e10782b..6ea6c0a 100644
--- a/src/totem-interface.c
+++ b/src/totem-interface.c
@@ -44,7 +44,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
-#include <gconf/gconf-client.h>
#include "totem-interface.h"
diff --git a/src/totem-object.c b/src/totem-object.c
index f4530a5..c759427 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -994,8 +994,8 @@ totem_object_action_exit (TotemObject *totem)
totem_sublang_exit (totem);
totem_destroy_file_filters ();
- if (totem->gc)
- g_object_unref (G_OBJECT (totem->gc));
+ if (totem->settings)
+ g_object_unref (totem->settings);
if (totem->fs)
g_object_unref (totem->fs);
diff --git a/src/totem-options.c b/src/totem-options.c
index dcdd19d..3c7104c 100644
--- a/src/totem-options.c
+++ b/src/totem-options.c
@@ -107,8 +107,7 @@ totem_options_process_early (Totem *totem, const TotemCmdLineOptions* options)
exit (0);
}
- gconf_client_set_bool (totem->gc, GCONF_PREFIX"/debug",
- options->debug, NULL);
+ g_settings_set_boolean (totem->settings, "debug", options->debug);
}
static char *
diff --git a/src/totem-options.h b/src/totem-options.h
index d178134..a8cbed7 100644
--- a/src/totem-options.h
+++ b/src/totem-options.h
@@ -23,7 +23,6 @@
#ifndef TOTEM_OPTIONS_H
#define TOTEM_OPTIONS_H
-#include <gconf/gconf-client.h>
#include <gtk/gtk.h>
#include "totem.h"
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index b2eed50..bc7a5b3 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -28,7 +28,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
-#include <gconf/gconf-client.h>
#include <gio/gio.h>
#include <string.h>
@@ -93,7 +92,8 @@ struct TotemPlaylistPrivate
int *shuffled;
int current_shuffled, shuffle_len;
- GConfClient *gc;
+ GSettings *settings;
+ GSettings *lockdown_settings;
/* Used to know the position for drops */
GtkTreePath *tree_path;
@@ -1422,20 +1422,16 @@ init_treeview (GtkWidget *treeview, TotemPlaylist *playlist)
}
static void
-update_repeat_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, TotemPlaylist *playlist)
+update_repeat_cb (GSettings *settings, const gchar *key, TotemPlaylist *playlist)
{
- gboolean repeat;
-
- repeat = gconf_value_get_bool (entry->value);
- playlist->priv->repeat = (repeat != FALSE);
+ playlist->priv->repeat = g_settings_get_boolean (settings, "repeat");
g_signal_emit (G_OBJECT (playlist),
totem_playlist_table_signals[CHANGED], 0,
NULL);
g_signal_emit (G_OBJECT (playlist),
totem_playlist_table_signals[REPEAT_TOGGLED], 0,
- repeat, NULL);
+ playlist->priv->repeat, NULL);
}
typedef struct {
@@ -1511,14 +1507,11 @@ ensure_shuffled (TotemPlaylist *playlist)
}
static void
-update_shuffle_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, TotemPlaylist *playlist)
+update_shuffle_cb (GSettings *settings, const gchar *key, TotemPlaylist *playlist)
{
- gboolean shuffle;
+ playlist->priv->shuffle = g_settings_get_boolean (settings, "shuffle");
- shuffle = gconf_value_get_bool (entry->value);
- playlist->priv->shuffle = shuffle;
- if (shuffle == FALSE) {
+ if (playlist->priv->shuffle == FALSE) {
g_free (playlist->priv->shuffled);
playlist->priv->shuffled = NULL;
playlist->priv->shuffle_len = 0;
@@ -1531,49 +1524,32 @@ update_shuffle_cb (GConfClient *client, guint cnxn_id,
NULL);
g_signal_emit (G_OBJECT (playlist),
totem_playlist_table_signals[SHUFFLE_TOGGLED], 0,
- shuffle, NULL);
+ playlist->priv->shuffle, NULL);
}
static void
-update_lockdown (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, TotemPlaylist *playlist)
+update_lockdown_cb (GSettings *settings, const gchar *key, TotemPlaylist *playlist)
{
- playlist->priv->disable_save_to_disk = gconf_client_get_bool
- (playlist->priv->gc,
- "/desktop/gnome/lockdown/disable_save_to_disk", NULL) != FALSE;
+ playlist->priv->disable_save_to_disk = g_settings_get_boolean (settings, "disable-save-to-disk");
totem_playlist_update_save_button (playlist);
}
static void
init_config (TotemPlaylist *playlist)
{
- playlist->priv->gc = gconf_client_get_default ();
+ playlist->priv->settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
+ playlist->priv->lockdown_settings = g_settings_new ("org.gnome.desktop.lockdown");
- playlist->priv->disable_save_to_disk = gconf_client_get_bool
- (playlist->priv->gc,
- "/desktop/gnome/lockdown/disable_save_to_disk", NULL) != FALSE;
+ playlist->priv->disable_save_to_disk = g_settings_get_boolean (playlist->priv->lockdown_settings, "disable-save-to-disk");
totem_playlist_update_save_button (playlist);
- gconf_client_add_dir (playlist->priv->gc, GCONF_PREFIX,
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- gconf_client_notify_add (playlist->priv->gc, GCONF_PREFIX"/repeat",
- (GConfClientNotifyFunc) update_repeat_cb,
- playlist, NULL, NULL);
- gconf_client_notify_add (playlist->priv->gc, GCONF_PREFIX"/shuffle",
- (GConfClientNotifyFunc) update_shuffle_cb,
- playlist, NULL, NULL);
+ g_signal_connect (playlist->priv->lockdown_settings, "changed::disable-save-to-disk", (GCallback) update_lockdown_cb, playlist);
- gconf_client_add_dir (playlist->priv->gc, "/desktop/gnome/lockdown",
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- gconf_client_notify_add (playlist->priv->gc,
- "/desktop/gnome/lockdown/disable_save_to_disk",
- (GConfClientNotifyFunc) update_lockdown,
- playlist, NULL, NULL);
+ playlist->priv->repeat = g_settings_get_boolean (playlist->priv->settings, "repeat");
+ playlist->priv->shuffle = g_settings_get_boolean (playlist->priv->settings, "shuffle");
- playlist->priv->repeat = gconf_client_get_bool (playlist->priv->gc,
- GCONF_PREFIX"/repeat", NULL) != FALSE;
- playlist->priv->shuffle = gconf_client_get_bool (playlist->priv->gc,
- GCONF_PREFIX"/shuffle", NULL) != FALSE;
+ g_signal_connect (playlist->priv->settings, "changed::repeat", (GCallback) update_repeat_cb, playlist);
+ g_signal_connect (playlist->priv->settings, "changed::shuffle", (GCallback) update_shuffle_cb, playlist);
}
static void
@@ -1648,6 +1624,14 @@ totem_playlist_dispose (GObject *object)
playlist->priv->action_group = NULL;
}
+ if (playlist->priv->settings != NULL)
+ g_object_unref (playlist->priv->settings);
+ playlist->priv->settings = NULL;
+
+ if (playlist->priv->lockdown_settings != NULL)
+ g_object_unref (playlist->priv->lockdown_settings);
+ playlist->priv->lockdown_settings = NULL;
+
G_OBJECT_CLASS (totem_playlist_parent_class)->dispose (object);
}
@@ -2527,8 +2511,7 @@ totem_playlist_set_repeat (TotemPlaylist *playlist, gboolean repeat)
{
g_return_if_fail (TOTEM_IS_PLAYLIST (playlist));
- gconf_client_set_bool (playlist->priv->gc, GCONF_PREFIX"/repeat",
- repeat, NULL);
+ g_settings_set_boolean (playlist->priv->settings, "repeat", repeat);
}
gboolean
@@ -2544,8 +2527,7 @@ totem_playlist_set_shuffle (TotemPlaylist *playlist, gboolean shuffle)
{
g_return_if_fail (TOTEM_IS_PLAYLIST (playlist));
- gconf_client_set_bool (playlist->priv->gc, GCONF_PREFIX"/shuffle",
- shuffle, NULL);
+ g_settings_set_boolean (playlist->priv->settings, "shuffle", shuffle);
}
void
diff --git a/src/totem-preferences.c b/src/totem-preferences.c
index d261825..af7331a 100644
--- a/src/totem-preferences.c
+++ b/src/totem-preferences.c
@@ -61,8 +61,6 @@ G_MODULE_EXPORT void tpw_color_reset_clicked_cb (GtkButton *button, Totem *totem
G_MODULE_EXPORT void audio_out_menu_changed (GtkComboBox *combobox, Totem *totem);
G_MODULE_EXPORT void font_set_cb (GtkFontButton * fb, Totem * totem);
G_MODULE_EXPORT void encoding_set_cb (GtkComboBox *cb, Totem *totem);
-G_MODULE_EXPORT void font_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, Totem *totem);
-G_MODULE_EXPORT void encoding_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, Totem *totem);
G_MODULE_EXPORT void auto_chapters_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
static gboolean
@@ -96,8 +94,7 @@ checkbutton1_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
gboolean value;
value = gtk_toggle_button_get_active (togglebutton);
- gconf_client_set_bool (totem->gc, GCONF_PREFIX"/auto_resize",
- value, NULL);
+ g_settings_set_boolean (totem->settings, "auto-resize", value);
bacon_video_widget_set_auto_resize
(BACON_VIDEO_WIDGET (totem->bvw), value);
}
@@ -107,8 +104,7 @@ totem_prefs_set_show_visuals (Totem *totem, gboolean value)
{
GtkWidget *item;
- gconf_client_set_bool (totem->gc,
- GCONF_PREFIX"/show_vfx", value, NULL);
+ g_settings_set_boolean (totem->settings, "show-vfx", value);
item = GTK_WIDGET (gtk_builder_get_object (totem->xml, "tpw_visuals_type_label"));
gtk_widget_set_sensitive (item, value);
@@ -136,8 +132,7 @@ checkbutton2_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
{
if (ask_show_visuals (totem) == FALSE)
{
- gconf_client_set_bool (totem->gc,
- GCONF_PREFIX"/show_vfx", FALSE, NULL);
+ g_settings_set_boolean (totem->settings, "show-vfx", FALSE);
gtk_toggle_button_set_active (togglebutton, FALSE);
return;
}
@@ -152,9 +147,7 @@ checkbutton3_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
gboolean value;
value = gtk_toggle_button_get_active (togglebutton);
-
- gconf_client_set_bool (totem->gc,
- GCONF_PREFIX"/autoload_subtitles", value, NULL);
+ g_settings_set_boolean (totem->settings, "autoload-subtitles", value);
totem->autoload_subs = value;
}
@@ -164,10 +157,7 @@ audio_screensaver_button_toggled_cb (GtkToggleButton *togglebutton, Totem *totem
gboolean value;
value = gtk_toggle_button_get_active (togglebutton);
-
- gconf_client_set_bool (totem->gc,
- GCONF_PREFIX"/lock_screensaver_on_audio",
- value, NULL);
+ g_settings_set_boolean (totem->settings, "lock-screensaver-on-audio", value);
}
void
@@ -178,16 +168,11 @@ no_deinterlace_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
value = gtk_toggle_button_get_active (togglebutton);
bacon_video_widget_set_deinterlacing (totem->bvw, !value);
- gconf_client_set_bool (totem->gc,
- GCONF_PREFIX"/disable_deinterlacing",
- value, NULL);
+ g_settings_set_boolean (totem->settings, "disable-deinterlacing", value);
}
static void
-no_deinterlace_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- Totem *totem)
+no_deinterlace_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
{
GObject *button;
gboolean value;
@@ -197,8 +182,7 @@ no_deinterlace_changed_cb (GConfClient *client,
g_signal_handlers_block_matched (button,
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, totem);
- value = gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/disable_deinterlacing", NULL);
+ value = g_settings_get_boolean (totem->settings, "disable-deinterlacing");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), value);
bacon_video_widget_set_deinterlacing (totem->bvw, !value);
@@ -214,15 +198,12 @@ remember_position_checkbutton_toggled_cb (GtkToggleButton *togglebutton, Totem *
value = gtk_toggle_button_get_active (togglebutton);
- gconf_client_set_bool (totem->gc,
- GCONF_PREFIX"/remember_position",
- value, NULL);
+ g_settings_set_boolean (totem->settings, "remember-position", value);
totem->remember_position = value;
}
static void
-remember_position_changed_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, Totem *totem)
+remember_position_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
{
GObject *item;
@@ -230,17 +211,14 @@ remember_position_changed_cb (GConfClient *client, guint cnxn_id,
g_signal_handlers_block_by_func (item, remember_position_checkbutton_toggled_cb,
totem);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item),
- gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/remember_position", NULL));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), g_settings_get_boolean (settings, "remember-position"));
g_signal_handlers_unblock_by_func (item, remember_position_checkbutton_toggled_cb,
totem);
}
static void
-auto_resize_changed_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, Totem *totem)
+auto_resize_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
{
GObject *item;
@@ -248,17 +226,14 @@ auto_resize_changed_cb (GConfClient *client, guint cnxn_id,
g_signal_handlers_disconnect_by_func (item,
checkbutton1_toggled_cb, totem);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item),
- gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/auto_resize", NULL));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), g_settings_get_boolean (settings, "auto-resize"));
g_signal_connect (item, "toggled",
G_CALLBACK (checkbutton1_toggled_cb), totem);
}
static void
-show_vfx_changed_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, Totem *totem)
+show_vfx_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
{
GObject *item;
@@ -266,27 +241,20 @@ show_vfx_changed_cb (GConfClient *client, guint cnxn_id,
g_signal_handlers_disconnect_by_func (item,
checkbutton2_toggled_cb, totem);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item),
- gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/show_vfx", NULL));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), g_settings_get_boolean (totem->settings, "show-vfx"));
g_signal_connect (item, "toggled",
G_CALLBACK (checkbutton2_toggled_cb), totem);
}
static void
-disable_kbd_shortcuts_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- Totem *totem)
+disable_kbd_shortcuts_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
{
- totem->disable_kbd_shortcuts = gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/disable_keyboard_shortcuts", NULL);
+ totem->disable_kbd_shortcuts = g_settings_get_boolean (totem->settings, "disable-keyboard-shortcuts");
}
static void
-lock_screensaver_on_audio_changed_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, Totem *totem)
+lock_screensaver_on_audio_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
{
GObject *item, *radio;
gboolean value;
@@ -295,8 +263,7 @@ lock_screensaver_on_audio_changed_cb (GConfClient *client, guint cnxn_id,
g_signal_handlers_disconnect_by_func (item,
audio_screensaver_button_toggled_cb, totem);
- value = gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/lock_screensaver_on_audio", NULL);
+ value = g_settings_get_boolean (totem->settings, "lock-screensaver-on-audio");
if (value != FALSE) {
radio = gtk_builder_get_object (totem->xml, "tpw_audio_toggle_button");
} else {
@@ -309,8 +276,7 @@ lock_screensaver_on_audio_changed_cb (GConfClient *client, guint cnxn_id,
}
static void
-autoload_subtitles_changed_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, Totem *totem)
+autoload_subtitles_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
{
GObject *item;
@@ -318,17 +284,14 @@ autoload_subtitles_changed_cb (GConfClient *client, guint cnxn_id,
g_signal_handlers_disconnect_by_func (item,
checkbutton3_toggled_cb, totem);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item),
- gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/autoload_subtitles", NULL));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), g_settings_get_boolean (totem->settings, "autoload-subtitles"));
g_signal_connect (item, "toggled",
G_CALLBACK (checkbutton3_toggled_cb), totem);
}
static void
-autoload_chapters_changed_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, Totem *totem)
+autoload_chapters_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
{
GObject *item;
@@ -336,8 +299,7 @@ autoload_chapters_changed_cb (GConfClient *client, guint cnxn_id,
g_signal_handlers_disconnect_by_func (item,
auto_chapters_toggled_cb, totem);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item),
- gconf_client_get_bool (totem->gc, GCONF_PREFIX"/autoload_chapters", NULL));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), g_settings_get_boolean (totem->settings, "autoload-chapters"));
g_signal_connect (item, "toggled",
G_CALLBACK (auto_chapters_toggled_cb), totem);
@@ -364,13 +326,11 @@ visual_menu_changed (GtkComboBox *combobox, Totem *totem)
list = bacon_video_widget_get_visualization_list (totem->bvw);
name = g_list_nth_data (list, i);
- old_name = gconf_client_get_string (totem->gc,
- GCONF_PREFIX"/visual", NULL);
+ old_name = g_settings_get_string (totem->settings, "visual");
if (old_name == NULL || strcmp (old_name, name) != 0)
{
- gconf_client_set_string (totem->gc, GCONF_PREFIX"/visual",
- name, NULL);
+ g_settings_set_string (totem->settings, "visual", name);
bacon_video_widget_set_visualization (totem->bvw, name);
}
@@ -384,8 +344,7 @@ visual_quality_menu_changed (GtkComboBox *combobox, Totem *totem)
int i;
i = gtk_combo_box_get_active (combobox);
- gconf_client_set_int (totem->gc,
- GCONF_PREFIX"/visual_quality", i, NULL);
+ g_settings_set_int (totem->settings, "visual-quality", i);
bacon_video_widget_set_visualization_quality (totem->bvw, i);
}
@@ -462,8 +421,7 @@ font_set_cb (GtkFontButton * fb, Totem * totem)
const gchar *font;
font = gtk_font_button_get_font_name (fb);
- gconf_client_set_string (totem->gc, GCONF_PREFIX"/subtitle_font",
- font, NULL);
+ g_settings_set_string (totem->settings, "subtitle-font", font);
}
void
@@ -473,45 +431,39 @@ encoding_set_cb (GtkComboBox *cb, Totem *totem)
encoding = totem_subtitle_encoding_get_selected (cb);
if (encoding)
- gconf_client_set_string (totem->gc,
- GCONF_PREFIX"/subtitle_encoding",
- encoding, NULL);
+ g_settings_set_string (totem->settings, "subtitle-encoding", encoding);
}
-void
-font_changed_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, Totem *totem)
+static void
+font_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
{
- const gchar *font;
+ gchar *font;
GtkFontButton *item;
item = GTK_FONT_BUTTON (gtk_builder_get_object (totem->xml, "font_sel_button"));
- font = gconf_value_get_string (entry->value);
+ font = g_settings_get_string (settings, "subtitle-font");
gtk_font_button_set_font_name (item, font);
bacon_video_widget_set_subtitle_font (totem->bvw, font);
+ g_free (font);
}
-void
-encoding_changed_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, Totem *totem)
+static void
+encoding_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
{
- const gchar *encoding;
+ gchar *encoding;
GtkComboBox *item;
item = GTK_COMBO_BOX (gtk_builder_get_object (totem->xml, "subtitle_encoding_combo"));
- encoding = gconf_value_get_string (entry->value);
+ encoding = g_settings_get_string (settings, "subtitle-encoding");
totem_subtitle_encoding_set (item, encoding);
bacon_video_widget_set_subtitle_encoding (totem->bvw, encoding);
+ g_free (encoding);
}
void
auto_chapters_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
{
- gboolean value;
-
- value = gtk_toggle_button_get_active (togglebutton);
-
- gconf_client_set_bool (totem->gc, GCONF_PREFIX"/autoload_chapters", value, NULL);
+ g_settings_set_boolean (totem->settings, "autoload-chapters", gtk_toggle_button_get_active (togglebutton));
}
void
@@ -524,7 +476,6 @@ totem_setup_preferences (Totem *totem)
char *visual, *font, *encoding;
GList *list, *l;
BvwAudioOutType audio_out;
- GConfValue *value;
GObject *item;
static struct {
@@ -538,17 +489,11 @@ totem_setup_preferences (Totem *totem)
{ "tpw_hue_scale", BVW_VIDEO_HUE, "tpw_hue_label" }
};
- g_return_if_fail (totem->gc != NULL);
+ g_return_if_fail (totem->settings != NULL);
is_local = totem_display_is_local ();
- gconf_client_add_dir (totem->gc, GCONF_PREFIX,
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- gconf_client_notify_add (totem->gc, GCONF_PREFIX"/auto_resize",
- (GConfClientNotifyFunc) auto_resize_changed_cb,
- totem, NULL, NULL);
- gconf_client_add_dir (totem->gc, "/desktop/gnome/lockdown",
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+ g_signal_connect (totem->settings, "changed::auto-resize", (GCallback) auto_resize_changed_cb, totem);
/* Work-around builder dialogue not parenting properly for
* On top windows */
@@ -576,43 +521,33 @@ totem_setup_preferences (Totem *totem)
G_CALLBACK (gtk_widget_destroyed), &totem->prefs);
/* Remember position */
- totem->remember_position = gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/remember_position", NULL);
+ totem->remember_position = g_settings_get_boolean (totem->settings, "remember-position");
item = gtk_builder_get_object (totem->xml, "tpw_remember_position_checkbutton");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), totem->remember_position);
- gconf_client_notify_add (totem->gc, GCONF_PREFIX"/remember_position",
- (GConfClientNotifyFunc) remember_position_changed_cb,
- totem, NULL, NULL);
+ g_signal_connect (totem->settings, "changed::remember-position", (GCallback) remember_position_changed_cb, totem);
/* Auto-resize */
- auto_resize = gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/auto_resize", NULL);
+ auto_resize = g_settings_get_boolean (totem->settings, "auto-resize");
item = gtk_builder_get_object (totem->xml, "tpw_display_checkbutton");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), auto_resize);
bacon_video_widget_set_auto_resize
(BACON_VIDEO_WIDGET (totem->bvw), auto_resize);
/* Screensaver audio locking */
- lock_screensaver_on_audio = gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/lock_screensaver_on_audio", NULL);
+ lock_screensaver_on_audio = g_settings_get_boolean (totem->settings, "lock-screensaver-on-audio");
if (lock_screensaver_on_audio != FALSE)
item = gtk_builder_get_object (totem->xml, "tpw_audio_toggle_button");
else
item = gtk_builder_get_object (totem->xml, "tpw_video_toggle_button");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), TRUE);
- gconf_client_notify_add (totem->gc, GCONF_PREFIX"/lock_screensaver_on_audio",
- (GConfClientNotifyFunc) lock_screensaver_on_audio_changed_cb,
- totem, NULL, NULL);
+ g_signal_connect (totem->settings, "changed::lock-screensaver-on-audio", (GCallback) lock_screensaver_on_audio_changed_cb, totem);
/* Disable deinterlacing */
item = gtk_builder_get_object (totem->xml, "tpw_no_deinterlace_checkbutton");
- no_deinterlace = gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/disable_deinterlacing", NULL);
+ no_deinterlace = g_settings_get_boolean (totem->settings, "disable-deinterlacing");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), no_deinterlace);
bacon_video_widget_set_deinterlacing (totem->bvw, !no_deinterlace);
- gconf_client_notify_add (totem->gc, GCONF_PREFIX"/disable_deinterlacing",
- (GConfClientNotifyFunc) no_deinterlace_changed_cb,
- totem, NULL, NULL);
+ g_signal_connect (totem->settings, "changed::disable-deinterlacing", (GCallback) no_deinterlace_changed_cb, totem);
/* Connection Speed */
connection_speed = bacon_video_widget_get_connection_speed (totem->bvw);
@@ -621,8 +556,7 @@ totem_setup_preferences (Totem *totem)
/* Enable visuals */
item = gtk_builder_get_object (totem->xml, "tpw_visuals_checkbutton");
- show_visuals = gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/show_vfx", NULL);
+ show_visuals = g_settings_get_boolean (totem->settings, "show-vfx");
if (is_local == FALSE && show_visuals != FALSE)
show_visuals = ask_show_visuals (totem);
@@ -632,43 +566,34 @@ totem_setup_preferences (Totem *totem)
totem_prefs_set_show_visuals (totem, show_visuals);
g_signal_connect (item, "toggled", G_CALLBACK (checkbutton2_toggled_cb), totem);
- gconf_client_notify_add (totem->gc, GCONF_PREFIX"/show_vfx",
- (GConfClientNotifyFunc) show_vfx_changed_cb,
- totem, NULL, NULL);
+ g_signal_connect (totem->settings, "changed::show-vfx", (GCallback) show_vfx_changed_cb, totem);
/* Auto-load subtitles */
item = gtk_builder_get_object (totem->xml, "tpw_auto_subtitles_checkbutton");
- totem->autoload_subs = gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/autoload_subtitles", NULL);
+ totem->autoload_subs = g_settings_get_boolean (totem->settings, "autoload-subtitles");
g_signal_handlers_disconnect_by_func (item, checkbutton3_toggled_cb, totem);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), totem->autoload_subs);
g_signal_connect (item, "toggled", G_CALLBACK (checkbutton3_toggled_cb), totem);
- gconf_client_notify_add (totem->gc, GCONF_PREFIX"/autoload_subtitles",
- (GConfClientNotifyFunc) autoload_subtitles_changed_cb,
- totem, NULL, NULL);
+ g_signal_connect (totem->settings, "changed::autoload-subtitles", (GCallback) autoload_subtitles_changed_cb, totem);
/* Auto-load external chapters */
item = gtk_builder_get_object (totem->xml, "tpw_auto_chapters_checkbutton");
- auto_chapters = gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/autoload_chapters", NULL);
+ auto_chapters = g_settings_get_boolean (totem->settings, "autoload-chapters");
g_signal_handlers_disconnect_by_func (item, auto_chapters_toggled_cb, totem);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), auto_chapters);
g_signal_connect (item, "toggled", G_CALLBACK (auto_chapters_toggled_cb), totem);
- gconf_client_notify_add (totem->gc, GCONF_PREFIX"/autoload_chapters",
- (GConfClientNotifyFunc) autoload_chapters_changed_cb,
- totem, NULL, NULL);
+ g_signal_connect (totem->settings, "changed::autoload-chapters", (GCallback) autoload_chapters_changed_cb, totem);
/* Visuals list */
list = bacon_video_widget_get_visualization_list (totem->bvw);
menu = gtk_menu_new ();
gtk_widget_show (menu);
- visual = gconf_client_get_string (totem->gc,
- GCONF_PREFIX"/visual", NULL);
+ visual = g_settings_get_string (totem->settings, "visual");
if (visual == NULL || strcmp (visual, "") == 0) {
g_free (visual);
visual = g_strdup ("goom");
@@ -690,8 +615,7 @@ totem_setup_preferences (Totem *totem)
g_free (visual);
/* Visualisation quality */
- i = gconf_client_get_int (totem->gc,
- GCONF_PREFIX"/visual_quality", NULL);
+ i = g_settings_get_int (totem->settings, "visual-quality");
bacon_video_widget_set_visualization_quality (totem->bvw, i);
item = gtk_builder_get_object (totem->xml, "tpw_visuals_size_combobox");
gtk_combo_box_set_active (GTK_COMBO_BOX (item), i);
@@ -728,35 +652,21 @@ totem_setup_preferences (Totem *totem)
item = gtk_builder_get_object (totem->xml, "font_sel_button");
gtk_font_button_set_title (GTK_FONT_BUTTON (item),
_("Select Subtitle Font"));
- font = gconf_client_get_string (totem->gc,
- GCONF_PREFIX"/subtitle_font", NULL);
+ font = g_settings_get_string (totem->settings, "subtitle-font");
if (font && strcmp (font, "") != 0) {
gtk_font_button_set_font_name (GTK_FONT_BUTTON (item), font);
bacon_video_widget_set_subtitle_font (totem->bvw, font);
}
g_free (font);
- gconf_client_notify_add (totem->gc, GCONF_PREFIX"/subtitle_font",
- (GConfClientNotifyFunc) font_changed_cb,
- totem, NULL, NULL);
+ g_signal_connect (totem->settings, "changed::subtitle-font", (GCallback) font_changed_cb, totem);
/* Subtitle encoding selection */
item = gtk_builder_get_object (totem->xml, "subtitle_encoding_combo");
totem_subtitle_encoding_init (GTK_COMBO_BOX (item));
- value = gconf_client_get_without_default (totem->gc,
- GCONF_PREFIX"/subtitle_encoding", NULL);
+ encoding = g_settings_get_string (totem->settings, "subtitle-encoding");
/* Make sure the default is UTF-8 */
- if (value != NULL) {
- if (gconf_value_get_string (value) == NULL) {
- encoding = g_strdup ("UTF-8");
- } else {
- encoding = g_strdup (gconf_value_get_string (value));
- if (encoding[0] == '\0') {
- g_free (encoding);
- encoding = g_strdup ("UTF-8");
- }
- }
- gconf_value_free (value);
- } else {
+ if (encoding == NULL || *encoding == '\0') {
+ g_free (encoding);
encoding = g_strdup ("UTF-8");
}
totem_subtitle_encoding_set (GTK_COMBO_BOX(item), encoding);
@@ -764,16 +674,11 @@ totem_setup_preferences (Totem *totem)
bacon_video_widget_set_subtitle_encoding (totem->bvw, encoding);
}
g_free (encoding);
- gconf_client_notify_add (totem->gc, GCONF_PREFIX"/subtitle_encoding",
- (GConfClientNotifyFunc) encoding_changed_cb,
- totem, NULL, NULL);
+ g_signal_connect (totem->settings, "changed::subtitle-encoding", (GCallback) encoding_changed_cb, totem);
/* Disable keyboard shortcuts */
- totem->disable_kbd_shortcuts = gconf_client_get_bool (totem->gc,
- GCONF_PREFIX"/disable_keyboard_shortcuts", NULL);
- gconf_client_notify_add (totem->gc, GCONF_PREFIX"/disable_keyboard_shortcuts",
- (GConfClientNotifyFunc) disable_kbd_shortcuts_changed_cb,
- totem, NULL, NULL);
+ totem->disable_kbd_shortcuts = g_settings_get_boolean (totem->settings, "disable-keyboard-shortcuts");
+ g_signal_connect (totem->settings, "changed::disable-keyboard-shortcuts", (GCallback) disable_kbd_shortcuts_changed_cb, totem);
}
void
@@ -781,8 +686,7 @@ totem_preferences_visuals_setup (Totem *totem)
{
char *visual;
- visual = gconf_client_get_string (totem->gc,
- GCONF_PREFIX"/visual", NULL);
+ visual = g_settings_get_string (totem->settings, "visual");
if (visual == NULL || strcmp (visual, "") == 0) {
g_free (visual);
visual = g_strdup ("goom");
diff --git a/src/totem-private.h b/src/totem-private.h
index 8caef97..5d62477 100644
--- a/src/totem-private.h
+++ b/src/totem-private.h
@@ -28,7 +28,6 @@
#ifndef __TOTEM_PRIVATE_H__
#define __TOTEM_PRIVATE_H__
-#include <gconf/gconf-client.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
@@ -158,7 +157,7 @@ struct _TotemObject {
char *mrl;
gint64 seek_to;
TotemPlaylist *playlist;
- GConfClient *gc;
+ GSettings *settings;
GApplication *app;
TotemStates state;
TotemOpenLocation *open_location;
diff --git a/src/totem-uri.c b/src/totem-uri.c
index b55a4fb..38bdfa3 100644
--- a/src/totem-uri.c
+++ b/src/totem-uri.c
@@ -581,7 +581,7 @@ char *
totem_add_subtitle (GtkWindow *parent, const char *uri)
{
GtkWidget *fs;
- GConfClient *conf;
+ GSettings *settings;
char *new_path;
char *subtitle = NULL;
gboolean folder_set;
@@ -598,7 +598,7 @@ totem_add_subtitle (GtkWindow *parent, const char *uri)
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (fs), filter_subs);
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (fs), filter_subs);
- conf = gconf_client_get_default ();
+ settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
folder_set = FALSE;
/* Add the subtitles cache dir as a shortcut */
@@ -610,7 +610,7 @@ totem_add_subtitle (GtkWindow *parent, const char *uri)
g_free (new_path);
/* Add the last open path as a shortcut */
- new_path = gconf_client_get_string (conf, "/apps/totem/open_path", NULL);
+ new_path = g_settings_get_string (settings, "open-path");
if (new_path != NULL && *new_path != '\0') {
gtk_file_chooser_add_shortcut_folder_uri (GTK_FILE_CHOOSER (fs), new_path, NULL);
}
@@ -635,6 +635,8 @@ totem_add_subtitle (GtkWindow *parent, const char *uri)
}
gtk_widget_destroy (fs);
+ g_object_unref (settings);
+
return subtitle;
}
@@ -645,7 +647,7 @@ totem_add_files (GtkWindow *parent, const char *path)
int response;
GSList *filenames;
char *mrl, *new_path;
- GConfClient *conf;
+ GSettings *settings;
gboolean set_folder;
fs = gtk_file_chooser_dialog_new (_("Select Movies or Playlists"),
@@ -663,13 +665,13 @@ totem_add_files (GtkWindow *parent, const char *path)
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (fs), TRUE);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fs), FALSE);
- conf = gconf_client_get_default ();
+ settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
set_folder = TRUE;
if (path != NULL) {
set_folder = gtk_file_chooser_set_current_folder_uri
(GTK_FILE_CHOOSER (fs), path);
} else {
- new_path = gconf_client_get_string (conf, "/apps/totem/open_path", NULL);
+ new_path = g_settings_get_string (settings, "open-path");
if (new_path != NULL && *new_path != '\0') {
set_folder = gtk_file_chooser_set_current_folder_uri
(GTK_FILE_CHOOSER (fs), new_path);
@@ -688,14 +690,14 @@ totem_add_files (GtkWindow *parent, const char *path)
if (response != GTK_RESPONSE_ACCEPT) {
gtk_widget_destroy (fs);
- g_object_unref (conf);
+ g_object_unref (settings);
return NULL;
}
filenames = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (fs));
if (filenames == NULL) {
gtk_widget_destroy (fs);
- g_object_unref (conf);
+ g_object_unref (settings);
return NULL;
}
gtk_widget_destroy (fs);
@@ -703,12 +705,11 @@ totem_add_files (GtkWindow *parent, const char *path)
mrl = filenames->data;
if (mrl != NULL) {
new_path = g_path_get_dirname (mrl);
- gconf_client_set_string (conf, "/apps/totem/open_path",
- new_path, NULL);
+ g_settings_set_string (settings, "open-path", new_path);
g_free (new_path);
}
- g_object_unref (conf);
+ g_object_unref (settings);
return filenames;
}
diff --git a/src/totem.c b/src/totem.c
index af267de..6e3c94b 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -140,12 +140,12 @@ static void
debug_handler (const char *log_domain,
GLogLevelFlags log_level,
const char *message,
- GConfClient *gc)
+ GSettings *settings)
{
static int debug = -1;
if (debug < 0)
- debug = gconf_client_get_bool (gc, GCONF_PREFIX"/debug", NULL);
+ debug = g_settings_get_boolean (settings, "debug");
if (debug)
g_log_default_handler (log_domain, log_level, message, NULL);
@@ -155,11 +155,11 @@ int
main (int argc, char **argv)
{
Totem *totem;
- GConfClient *gc;
+ GSettings *settings;
GError *error = NULL;
GOptionContext *context;
GOptionGroup *baconoptiongroup;
- GtkSettings *settings;
+ GtkSettings *gtk_settings;
char *sidebar_pageid;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
@@ -202,21 +202,21 @@ main (int argc, char **argv)
gtk_about_dialog_set_url_hook (about_url_hook, NULL, NULL);
gtk_about_dialog_set_email_hook (about_email_hook, NULL, NULL);
- settings = gtk_settings_get_default ();
- g_object_set (G_OBJECT (settings), "gtk-application-prefer-dark-theme", TRUE, NULL);
+ gtk_settings = gtk_settings_get_default ();
+ g_object_set (G_OBJECT (gtk_settings), "gtk-application-prefer-dark-theme", TRUE, NULL);
- gc = gconf_client_get_default ();
- if (gc == NULL) {
+ settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
+ if (settings == NULL) {
totem_action_error_and_exit (_("Totem could not initialize the configuration engine."),
_("Make sure that GNOME is properly installed."), NULL);
}
/* Debug log handling */
- g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, (GLogFunc) debug_handler, gc);
+ g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, (GLogFunc) debug_handler, settings);
/* Build the main Totem object */
totem = g_object_new (TOTEM_TYPE_OBJECT, NULL);
- totem->gc = gc;
+ totem->settings = settings;
/* IPC stuff */
if (optionstate.notconnectexistingsession == FALSE) {
diff --git a/src/totem.h b/src/totem.h
index 4674e68..d4a0b17 100644
--- a/src/totem.h
+++ b/src/totem.h
@@ -34,11 +34,11 @@
#include "totem-playlist.h"
/**
- * TOTEM_GCONF_PREFIX:
+ * TOTEM_GSETTINGS_SCHEMA:
*
- * The GConf prefix under which all Totem GConf keys are stored.
+ * The GSettings schema under which all Totem settings are stored.
**/
-#define TOTEM_GCONF_PREFIX "/apps/totem"
+#define TOTEM_GSETTINGS_SCHEMA "org.gnome.totem"
G_BEGIN_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]