[totem] Port C plugins to GSettings
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] Port C plugins to GSettings
- Date: Sat, 4 Sep 2010 15:47:10 +0000 (UTC)
commit 84403b142e6c42b8b17a106562e3b919400d8b6c
Author: Philip Withnall <philip tecnocode co uk>
Date: Wed Aug 18 09:52:25 2010 +0100
Port C plugins to GSettings
configure.in | 6 +-
po/POTFILES.in | 1 +
po/POTFILES.skip | 1 +
src/plugins/bemused/Makefile.am | 1 -
src/plugins/brasero-disc-recorder/Makefile.am | 1 -
src/plugins/chapters/Makefile.am | 1 -
src/plugins/chapters/totem-chapters.c | 40 ++-----
src/plugins/galago/Makefile.am | 1 -
src/plugins/gromit/Makefile.am | 1 -
src/plugins/lirc/Makefile.am | 1 -
src/plugins/media-player-keys/Makefile.am | 1 -
src/plugins/mythtv/Makefile.am | 14 +--
src/plugins/mythtv/totem-mythtv.c | 10 --
src/plugins/ontop/Makefile.am | 1 -
src/plugins/properties/Makefile.am | 1 -
src/plugins/publish/Makefile.am | 15 ++-
...g.gnome.totem.plugins.publish.gschema.xml.in.in | 28 +++++
src/plugins/publish/publish.convert | 3 +
src/plugins/publish/totem-publish.c | 121 ++++++--------------
src/plugins/sample-vala/Makefile.am | 1 -
src/plugins/screensaver/Makefile.am | 1 -
src/plugins/screensaver/totem-screensaver.c | 29 +----
src/plugins/screenshot/Makefile.am | 1 -
src/plugins/screenshot/totem-screenshot-plugin.c | 43 +++----
src/plugins/sidebar-test/Makefile.am | 1 -
src/plugins/skipto/Makefile.am | 1 -
src/plugins/thumbnail/Makefile.am | 1 -
src/plugins/tracker/Makefile.am | 1 -
src/plugins/youtube/Makefile.am | 1 -
29 files changed, 118 insertions(+), 210 deletions(-)
---
diff --git a/configure.in b/configure.in
index f9a0000..edf32f3 100644
--- a/configure.in
+++ b/configure.in
@@ -416,9 +416,6 @@ for plugin in ${used_plugins}; do
plugin_error_or_ignore "the coherence_upnp plugin uses PyGTK and conflicts with the new pygobject bindings"
add_plugin="0"
;;
- screensaver)
- PKG_CHECK_MODULES(SCREENSAVER, gconf-2.0)
- ;;
galago)
PKG_CHECK_MODULES(LIBGALAGO, libgalago >= 0.5.2,
[HAVE_LIBGALAGO=yes], [HAVE_LIBGALAGO=no])
@@ -456,7 +453,7 @@ for plugin in ${used_plugins}; do
fi
;;
mythtv)
- PKG_CHECK_MODULES(GMYTH, gmyth >= 0.7.1 gmyth-upnp >= 0.7.1 gconf-2.0,
+ PKG_CHECK_MODULES(GMYTH, gmyth >= 0.7.1 gmyth-upnp >= 0.7.1,
[HAVE_GMYTH=yes], [HAVE_GMYTH=no])
if test "${HAVE_GMYTH}" != "yes"; then
plugin_error_or_ignore "you need GMyth >= 0.7 installed for the MythTV plugin"
@@ -811,6 +808,7 @@ src/plugins/tracker/Makefile
src/plugins/youtube/Makefile
src/plugins/pythonconsole/Makefile
src/plugins/publish/Makefile
+src/plugins/publish/org.gnome.totem.plugins.publish.gschema.xml.in
src/plugins/jamendo/Makefile
src/plugins/brasero-disc-recorder/Makefile
src/plugins/chapters/Makefile
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4efa280..fba63df 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -70,6 +70,7 @@ src/plugins/opensubtitles/opensubtitles.py
src/plugins/properties/totem-movie-properties.c
src/plugins/properties/bacon-video-widget-properties.c
[type: gettext/ini]src/plugins/properties/movie-properties.totem-plugin.in
+src/plugins/publish/org.gnome.totem.plugins.publish.gschema.xml.in.in
src/plugins/publish/totem-publish.c
[type: gettext/ini]src/plugins/publish/publish.totem-plugin.in
[type: gettext/glade]src/plugins/publish/publish-plugin.ui
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index d51a833..980bbd4 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -15,6 +15,7 @@ src/backend/gstscreenshot.c
src/totem-video-indexer.c
src/totem-video-thumbnailer.c
src/plugins/iplayer/httplib2.py
+src/plugins/publish/org.gnome.totem.plugins.publish.gschema.xml.in
src/plugins/publish/publish-plugin.glade
src/plugins/sample-python/sample-python.totem-plugin.in
src/plugins/sample-vala/sample-vala.totem-plugin.in
diff --git a/src/plugins/bemused/Makefile.am b/src/plugins/bemused/Makefile.am
index 82b66fb..103b756 100644
--- a/src/plugins/bemused/Makefile.am
+++ b/src/plugins/bemused/Makefile.am
@@ -13,7 +13,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/brasero-disc-recorder/Makefile.am b/src/plugins/brasero-disc-recorder/Makefile.am
index 5f49e87..5688b65 100644
--- a/src/plugins/brasero-disc-recorder/Makefile.am
+++ b/src/plugins/brasero-disc-recorder/Makefile.am
@@ -13,7 +13,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/chapters/Makefile.am b/src/plugins/chapters/Makefile.am
index b4f638f..0ca54a4 100644
--- a/src/plugins/chapters/Makefile.am
+++ b/src/plugins/chapters/Makefile.am
@@ -16,7 +16,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/chapters/totem-chapters.c b/src/plugins/chapters/totem-chapters.c
index e18dda9..2a56949 100644
--- a/src/plugins/chapters/totem-chapters.c
+++ b/src/plugins/chapters/totem-chapters.c
@@ -32,7 +32,6 @@
#include <gmodule.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#include <gdk/gdkkeysyms.h>
-#include <gconf/gconf-client.h>
#include <unistd.h>
#include <math.h>
@@ -81,7 +80,7 @@ typedef struct {
gchar *cmml_mrl;
gboolean autoload;
GCancellable *cancellable[2];
- GConfClient *gconf;
+ GSettings *settings;
guint autoload_handle_id;
} TotemChaptersPluginPrivate;
@@ -123,7 +122,7 @@ static void show_chapter_edit_dialog (TotemChaptersPlugin *plugin);
static void save_chapters_result_cb (gpointer data, gpointer user_data);
static GList * get_chapters_list (TotemChaptersPlugin *plugin);
static gboolean show_popup_menu (TotemChaptersPlugin *plugin, GdkEventButton *event);
-static void gconf_autoload_changed_cb (GConfClient *gconf, guint cnx_id, GConfEntry *entry, TotemChaptersPlugin *plugin);
+static void autoload_changed_cb (GSettings *settigs, const gchar *key, TotemChaptersPlugin *plugin);
static void load_chapters_from_file (const gchar *uri, gboolean from_dialog, TotemChaptersPlugin *plugin);
static void set_no_data_visible (gboolean visible, gboolean show_buttons, TotemChaptersPlugin *plugin);
@@ -632,19 +631,15 @@ chapter_selection_changed_cb (GtkTreeSelection *tree_selection,
}
static void
-gconf_autoload_changed_cb (GConfClient *gconf,
- guint cnx_id,
- GConfEntry *entry,
- TotemChaptersPlugin *plugin)
+autoload_changed_cb (GSettings *settings,
+ const gchar *key,
+ TotemChaptersPlugin *plugin)
{
- g_return_if_fail (GCONF_IS_CLIENT (gconf));
- g_return_if_fail (entry != NULL);
+ g_return_if_fail (G_IS_SETTINGS (settings));
+ g_return_if_fail (key != NULL);
g_return_if_fail (TOTEM_IS_CHAPTERS_PLUGIN (plugin));
- if (G_LIKELY (entry->value != NULL))
- plugin->priv->autoload = gconf_value_get_bool (entry->value);
- else
- plugin->priv->autoload = TRUE;
+ plugin->priv->autoload = g_settings_get_boolean (settings, key);
}
static void
@@ -1104,7 +1099,6 @@ impl_activate (PeasActivatable *plugin)
{
TotemObject *totem;
GtkWindow *main_window;
- GConfClient *gconf;
GtkBuilder *builder;
GtkWidget *main_box;
GtkTreeSelection *selection;
@@ -1126,15 +1120,9 @@ impl_activate (PeasActivatable *plugin)
if (builder == NULL)
return;
- gconf = gconf_client_get_default ();
- if (G_LIKELY (gconf != NULL)) {
- cplugin->priv->autoload = gconf_client_get_bool (gconf, GCONF_PREFIX"/autoload_chapters", NULL);
- cplugin->priv->autoload_handle_id = gconf_client_notify_add (gconf, GCONF_PREFIX"/autoload_chapters",
- (GConfClientNotifyFunc) gconf_autoload_changed_cb,
- cplugin, NULL, NULL);
- } else
- cplugin->priv->autoload = TRUE;
- cplugin->priv->gconf = gconf;
+ cplugin->priv->settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
+ cplugin->priv->autoload = g_settings_get_boolean (cplugin->priv->settings, "autoload-chapters");
+ g_signal_connect (cplugin->priv->settings, "changed::autoload-chapters", (GCallback) autoload_changed_cb, cplugin);
cplugin->priv->tree = GTK_WIDGET (gtk_builder_get_object (builder, "chapters_tree_view"));
cplugin->priv->action_group = GTK_ACTION_GROUP (gtk_builder_get_object (builder, "chapters-action-group"));
@@ -1232,10 +1220,8 @@ impl_deactivate (PeasActivatable *plugin)
g_signal_handlers_disconnect_by_func (G_OBJECT (totem),
totem_file_closed_cb,
plugin);
- if (cplugin->priv->gconf != NULL) {
- gconf_client_notify_remove (cplugin->priv->gconf, cplugin->priv->autoload_handle_id);
- g_object_unref (cplugin->priv->gconf);
- }
+ if (cplugin->priv->settings != NULL)
+ g_object_unref (cplugin->priv->settings);
if (G_UNLIKELY (cplugin->priv->last_frame != NULL))
g_object_unref (G_OBJECT (cplugin->priv->last_frame));
diff --git a/src/plugins/galago/Makefile.am b/src/plugins/galago/Makefile.am
index cb592ce..a43f735 100644
--- a/src/plugins/galago/Makefile.am
+++ b/src/plugins/galago/Makefile.am
@@ -13,7 +13,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/gromit/Makefile.am b/src/plugins/gromit/Makefile.am
index e7902a3..0432ff8 100644
--- a/src/plugins/gromit/Makefile.am
+++ b/src/plugins/gromit/Makefile.am
@@ -13,7 +13,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/lirc/Makefile.am b/src/plugins/lirc/Makefile.am
index c15e2e7..4814c47 100644
--- a/src/plugins/lirc/Makefile.am
+++ b/src/plugins/lirc/Makefile.am
@@ -16,7 +16,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/media-player-keys/Makefile.am b/src/plugins/media-player-keys/Makefile.am
index e1b5313..5ffa06b 100644
--- a/src/plugins/media-player-keys/Makefile.am
+++ b/src/plugins/media-player-keys/Makefile.am
@@ -13,7 +13,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/mythtv/Makefile.am b/src/plugins/mythtv/Makefile.am
index 13d10d1..9034092 100644
--- a/src/plugins/mythtv/Makefile.am
+++ b/src/plugins/mythtv/Makefile.am
@@ -7,22 +7,12 @@ plugin_in_files = mythtv.totem-plugin.in
%.totem-plugin: %.totem-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-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
-
plugin_DATA = $(plugin_in_files:.totem-plugin.in=.totem-plugin)
common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
@@ -47,8 +37,8 @@ libtotem_mythtv_la_CFLAGS = \
-I$(top_srcdir)/src/backend \
-I$(top_srcdir)/src/plugins
-EXTRA_DIST = $(plugin_in_files) $(schema_in_files)
+EXTRA_DIST = $(plugin_in_files)
-CLEANFILES = $(noinst_DATA) $(BUILT_SOURCES) $(schema_DATA)
+CLEANFILES = $(noinst_DATA) $(BUILT_SOURCES)
DISTCLEANFILES = $(plugin_DATA)
diff --git a/src/plugins/mythtv/totem-mythtv.c b/src/plugins/mythtv/totem-mythtv.c
index 0fde2cf..4027f5e 100644
--- a/src/plugins/mythtv/totem-mythtv.c
+++ b/src/plugins/mythtv/totem-mythtv.c
@@ -30,7 +30,6 @@
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
-#include <gconf/gconf-client.h>
#include <gmodule.h>
#include <string.h>
@@ -77,7 +76,6 @@ typedef struct
GMythUPnP *upnp;
TotemObject *totem;
- GConfClient *client;
GtkWidget *sidebar_recordings;
GtkWidget *sidebar_livetv;
@@ -458,10 +456,6 @@ totem_mythtv_plugin_finalize (GObject *object)
g_list_free (tm->lst_b_info);
tm->lst_b_info = NULL;
}
- if (tm->client != NULL) {
- g_object_unref (tm->client);
- tm->client = NULL;
- }
if (tm->upnp != NULL) {
g_object_unref (tm->upnp);
tm->upnp = NULL;
@@ -540,10 +534,6 @@ impl_deactivate (PeasActivatable *plugin)
g_list_free (tm->lst_b_info);
tm->lst_b_info = NULL;
}
- if (tm->client != NULL) {
- g_object_unref (tm->client);
- tm->client = NULL;
- }
if (tm->upnp != NULL) {
g_object_unref (tm->upnp);
tm->upnp = NULL;
diff --git a/src/plugins/ontop/Makefile.am b/src/plugins/ontop/Makefile.am
index 22b5507..605221f 100644
--- a/src/plugins/ontop/Makefile.am
+++ b/src/plugins/ontop/Makefile.am
@@ -13,7 +13,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/properties/Makefile.am b/src/plugins/properties/Makefile.am
index 51026bb..96a63d3 100644
--- a/src/plugins/properties/Makefile.am
+++ b/src/plugins/properties/Makefile.am
@@ -15,7 +15,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/publish/Makefile.am b/src/plugins/publish/Makefile.am
index 5044aed..abfb7fc 100644
--- a/src/plugins/publish/Makefile.am
+++ b/src/plugins/publish/Makefile.am
@@ -16,7 +16,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
@@ -41,8 +40,16 @@ libpublish_la_CFLAGS = \
-I$(top_srcdir)/src/backend \
-I$(top_srcdir)/src/plugins
-EXTRA_DIST = $(plugin_in_files) $(ui_DATA)
+gsettings_SCHEMAS = org.gnome.totem.plugins.publish.gschema.xml
-CLEANFILES = $(plugin_DATA) $(BUILT_SOURCES)
-DISTCLEANFILES = $(plugin_DATA)
+ INTLTOOL_XML_NOMERGE_RULE@
+ GSETTINGS_RULES@
+convertdir = $(datadir)/GConf/gsettings
+convert_DATA = publish.convert
+
+EXTRA_DIST = $(plugin_in_files) $(ui_DATA) org.gnome.totem.plugins.publish.gschema.xml.in.in publish.convert
+
+CLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS)
+DISTCLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS)
+MAINTAINERCLEANFILES = $(gsettings_SCHEMAS:.xml=.valid)
diff --git a/src/plugins/publish/org.gnome.totem.plugins.publish.gschema.xml.in.in b/src/plugins/publish/org.gnome.totem.plugins.publish.gschema.xml.in.in
new file mode 100644
index 0000000..ed3df12
--- /dev/null
+++ b/src/plugins/publish/org.gnome.totem.plugins.publish.gschema.xml.in.in
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+ <schema id="org.gnome.totem.plugins.publish" path="/apps/totem/plugins/publish/" gettext-domain="@GETTEXT_PACKAGE@">
+ <key name="protocol" type="s">
+ <choices>
+ <choice value='http'/>
+ <choice value='https'/>
+ </choices>
+ <default>'http'</default>
+ <_summary>Publisher protocol to use</_summary>
+ <_description>The transport protocol to use when publishing playlists over the network.</_description>
+ </key>
+ <key name="name-format" type="s">
+ <default l10n="messages">
+ <!-- Translators: format for the service name to use when publishing playlists over the network -->
+ '%a of %u on %h'</default>
+ <_summary>Format for network service name</_summary>
+ <_description>A format string used to build the network service name used when publishing playlists over the network. The following format placeholders can be used:
+ â?¢ %a: the program name as returned by g_get_application_name()
+ â?¢ %h: the machine's host name in title case
+ â?¢ %u: the user's login name in title case
+ â?¢ %U: the user's real name
+ â?¢ %%: the percent sign</_description>
+ </key>
+ </schema>
+</schemalist>
+
+
diff --git a/src/plugins/publish/publish.convert b/src/plugins/publish/publish.convert
new file mode 100644
index 0000000..c0653c8
--- /dev/null
+++ b/src/plugins/publish/publish.convert
@@ -0,0 +1,3 @@
+[org.gnome.totem.plugins.publish]
+name-format = /apps/totem/plugins/publish/name
+protocol = /apps/totem/plugins/publish/protocol
diff --git a/src/plugins/publish/totem-publish.c b/src/plugins/publish/totem-publish.c
index 19dc1f3..7d84cd4 100644
--- a/src/plugins/publish/totem-publish.c
+++ b/src/plugins/publish/totem-publish.c
@@ -32,7 +32,6 @@
#include <glib-object.h>
#include <glib/gi18n-lib.h>
-#include <gconf/gconf-client.h>
#include <gio/gio.h>
#include <libepc/consumer.h>
@@ -59,9 +58,7 @@
#define TOTEM_IS_PUBLISH_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_PUBLISH_PLUGIN))
#define TOTEM_PUBLISH_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_PUBLISH_PLUGIN, TotemPublishPluginClass))
-#define TOTEM_PUBLISH_CONFIG_ROOT GCONF_PREFIX "/plugins/publish"
-#define TOTEM_PUBLISH_CONFIG_NAME GCONF_PREFIX "/plugins/publish/name"
-#define TOTEM_PUBLISH_CONFIG_PROTOCOL GCONF_PREFIX "/plugins/publish/protocol"
+#define TOTEM_PUBLISH_SCHEMA TOTEM_GSETTINGS_SCHEMA ".plugins.publish"
enum
{
@@ -75,7 +72,7 @@ typedef struct
PeasExtensionBase parent;
TotemObject *totem;
- GConfClient *client;
+ GSettings *gsettings;
GtkWidget *settings;
GtkWidget *scanning;
GtkBuilder *ui;
@@ -85,9 +82,6 @@ typedef struct
GtkListStore *neighbours;
GSList *playlist;
- guint name_id;
- guint protocol_id;
-
guint scanning_id;
gulong item_added_id;
@@ -102,9 +96,9 @@ typedef struct
GType totem_publish_plugin_get_type (void) G_GNUC_CONST;
void totem_publish_plugin_service_name_entry_changed_cb (GtkEntry *entry,
- gpointer data);
+ TotemPublishPlugin *self);
void totem_publish_plugin_encryption_button_toggled_cb (GtkToggleButton *button,
- gpointer data);
+ TotemPublishPlugin *self);
void totem_publish_plugin_dialog_response_cb (GtkDialog *dialog,
gint response,
gpointer data);
@@ -117,14 +111,13 @@ G_LOCK_DEFINE_STATIC(totem_publish_plugin_lock);
TOTEM_PLUGIN_REGISTER_CONFIGURABLE (TOTEM_TYPE_PUBLISH_PLUGIN, TotemPublishPlugin, totem_publish_plugin);
static void
-totem_publish_plugin_name_changed_cb (GConfClient *client,
- guint id,
- GConfEntry *entry,
- gpointer data)
+totem_publish_plugin_name_changed_cb (GSettings *settings, const gchar *key, TotemPublishPlugin *self)
{
- TotemPublishPlugin *self = TOTEM_PUBLISH_PLUGIN (data);
- const gchar *pattern = gconf_value_get_string (entry->value);
- gchar *name = epc_publisher_expand_name (pattern, NULL);
+ gchar *pattern, *name;
+
+ pattern = g_settings_get_string (settings, "name-format");
+ name = epc_publisher_expand_name (pattern, NULL);
+ g_free (pattern);
epc_publisher_set_service_name (self->publisher, name);
@@ -132,45 +125,27 @@ totem_publish_plugin_name_changed_cb (GConfClient *client,
}
void
-totem_publish_plugin_service_name_entry_changed_cb (GtkEntry *entry,
- gpointer data)
+totem_publish_plugin_service_name_entry_changed_cb (GtkEntry *entry, TotemPublishPlugin *self)
{
- GConfClient *client = gconf_client_get_default ();
- gconf_client_set_string (client,
- TOTEM_PUBLISH_CONFIG_NAME,
- gtk_entry_get_text (entry),
- NULL);
- g_object_unref (client);
+ g_settings_set_string (self->gsettings, "name-format", gtk_entry_get_text (entry));
}
void
-totem_publish_plugin_encryption_button_toggled_cb (GtkToggleButton *button,
- gpointer data)
+totem_publish_plugin_encryption_button_toggled_cb (GtkToggleButton *button, TotemPublishPlugin *self)
{
- GConfClient *client;
- gboolean encryption = gtk_toggle_button_get_active (button);
-
- client = gconf_client_get_default ();
- gconf_client_set_string (client,
- TOTEM_PUBLISH_CONFIG_PROTOCOL,
- encryption ? "https" : "http",
- NULL);
- g_object_unref (client);
+ g_settings_set_string (self->gsettings, "protocol", gtk_toggle_button_get_active (button) ? "https" : "http");
}
static void
-totem_publish_plugin_protocol_changed_cb (GConfClient *client,
- guint id,
- GConfEntry *entry,
- gpointer data)
+totem_publish_plugin_protocol_changed_cb (GSettings *settings, const gchar *key, TotemPublishPlugin *self)
{
- TotemPublishPlugin *self = TOTEM_PUBLISH_PLUGIN (data);
- const gchar *protocol_name;
+ gchar *protocol_name;
EpcProtocol protocol;
GError *error = NULL;
- protocol_name = gconf_value_get_string (entry->value);
+ protocol_name = g_settings_get_string (settings, "protocol");
protocol = epc_protocol_from_name (protocol_name, EPC_PROTOCOL_HTTPS);
+ g_free (protocol_name);
epc_publisher_quit (self->publisher);
epc_publisher_set_protocol (self->publisher, protocol);
@@ -546,36 +521,23 @@ impl_activate (PeasActivatable *plugin)
epc_progress_window_install (window);
g_object_unref (window);
- gconf_client_add_dir (self->client,
- TOTEM_PUBLISH_CONFIG_ROOT,
- GCONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
+ self->gsettings = g_settings_new (TOTEM_PUBLISH_SCHEMA);
- protocol_name = gconf_client_get_string (self->client, TOTEM_PUBLISH_CONFIG_PROTOCOL, NULL);
- service_pattern = gconf_client_get_string (self->client, TOTEM_PUBLISH_CONFIG_NAME, NULL);
+ protocol_name = g_settings_get_string (self->gsettings, "protocol");
+ service_pattern = g_settings_get_string (self->gsettings, "name-format");
if (!protocol_name) {
protocol_name = g_strdup ("http");
- gconf_client_set_string (self->client,
- TOTEM_PUBLISH_CONFIG_PROTOCOL,
- protocol_name, NULL);
+ g_settings_set_string (self->gsettings, "protocol", protocol_name);
}
if (!service_pattern) {
service_pattern = g_strdup ("%a of %u on %h");
- gconf_client_set_string (self->client,
- TOTEM_PUBLISH_CONFIG_NAME,
- service_pattern, NULL);
+ g_settings_set_string (self->gsettings, "name-format", service_pattern);
}
- self->name_id = gconf_client_notify_add (self->client,
- TOTEM_PUBLISH_CONFIG_NAME,
- totem_publish_plugin_name_changed_cb,
- self, NULL, NULL);
- self->protocol_id = gconf_client_notify_add (self->client,
- TOTEM_PUBLISH_CONFIG_PROTOCOL,
- totem_publish_plugin_protocol_changed_cb,
- self, NULL, NULL);
+ g_signal_connect (self->gsettings, "changed::name", (GCallback) totem_publish_plugin_name_changed_cb, self);
+ g_signal_connect (self->gsettings, "changed::protocol", (GCallback) totem_publish_plugin_protocol_changed_cb, self);
protocol = epc_protocol_from_name (protocol_name, EPC_PROTOCOL_HTTPS);
service_name = epc_publisher_expand_name (service_pattern, &internal_error);
@@ -661,11 +623,11 @@ impl_deactivate (PeasActivatable *plugin)
self->publisher = NULL;
}
- if (self->totem) {
- gconf_client_notify_remove (self->client, self->name_id);
- gconf_client_notify_remove (self->client, self->protocol_id);
- gconf_client_remove_dir (self->client, TOTEM_PUBLISH_CONFIG_ROOT, NULL);
+ if (self->gsettings != NULL)
+ g_object_unref (self->gsettings);
+ self->gsettings = NULL;
+ if (self->totem) {
ev_sidebar_remove_page (EV_SIDEBAR (self->totem->sidebar), "neighbours");
g_object_unref (self->totem);
@@ -696,16 +658,16 @@ impl_create_configure_widget (PeasGtkConfigurable *configurable)
GtkBuilder *builder;
GtkWidget *widget;
EpcProtocol protocol;
- GConfClient *client;
+ GSettings *settings;
/* This function has to be independent of the rest of the plugin, as it's executed under a different plugin instance.
* FIXME: bgo#624073 */
builder = totem_plugin_load_interface ("publish", "publish-plugin.ui", TRUE, NULL, self);
- client = gconf_client_get_default ();
- service_name = gconf_client_get_string (client, TOTEM_PUBLISH_CONFIG_NAME, NULL);
- protocol_name = gconf_client_get_string (client, TOTEM_PUBLISH_CONFIG_PROTOCOL, NULL);
- g_object_unref (client);
+ settings = g_settings_new (TOTEM_PUBLISH_SCHEMA);
+ service_name = g_settings_get_string (settings, "name-format");
+ protocol_name = g_settings_get_string (settings, "protocol");
+ g_object_unref (settings);
protocol = epc_protocol_from_name (protocol_name, EPC_PROTOCOL_HTTPS);
g_free (protocol_name);
@@ -723,20 +685,6 @@ impl_create_configure_widget (PeasGtkConfigurable *configurable)
static void
totem_publish_plugin_init (TotemPublishPlugin *self)
{
- self->client = gconf_client_get_default ();
-}
-
-static void
-totem_publish_plugin_dispose (GObject *object)
-{
- TotemPublishPlugin *self = TOTEM_PUBLISH_PLUGIN (object);
-
- if (self->client != NULL) {
- g_object_unref (self->client);
- self->client = NULL;
- }
-
- G_OBJECT_CLASS (totem_publish_plugin_parent_class)->dispose (object);
}
static void
@@ -746,7 +694,6 @@ totem_publish_plugin_class_init (TotemPublishPluginClass *klass)
object_class->set_property = set_property;
object_class->get_property = get_property;
- object_class->dispose = totem_publish_plugin_dispose;
g_object_class_override_property (object_class, PROP_OBJECT, "object");
}
diff --git a/src/plugins/sample-vala/Makefile.am b/src/plugins/sample-vala/Makefile.am
index b70370f..67ea72d 100644
--- a/src/plugins/sample-vala/Makefile.am
+++ b/src/plugins/sample-vala/Makefile.am
@@ -17,7 +17,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/screensaver/Makefile.am b/src/plugins/screensaver/Makefile.am
index a3a7f2c..5d52e92 100644
--- a/src/plugins/screensaver/Makefile.am
+++ b/src/plugins/screensaver/Makefile.am
@@ -13,7 +13,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/screensaver/totem-screensaver.c b/src/plugins/screensaver/totem-screensaver.c
index df20851..ce93528 100644
--- a/src/plugins/screensaver/totem-screensaver.c
+++ b/src/plugins/screensaver/totem-screensaver.c
@@ -30,7 +30,6 @@
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
-#include <gconf/gconf-client.h>
#include <libpeas/peas-extension-base.h>
#include <libpeas/peas-object-module.h>
#include <libpeas/peas-activatable.h>
@@ -53,11 +52,11 @@ typedef struct
PeasExtensionBase parent;
TotemObject *totem;
BaconVideoWidget *bvw;
+ GSettings *settings;
TotemScrsaver *scr;
guint handler_id_playing;
guint handler_id_metadata;
- guint handler_id_gconf;
} TotemScreensaverPlugin;
typedef struct
@@ -111,14 +110,10 @@ totem_screensaver_update_from_state (TotemObject *totem,
{
gboolean lock_screensaver_on_audio, can_get_frames;
BaconVideoWidget *bvw;
- GConfClient *gc;
bvw = BACON_VIDEO_WIDGET (totem_get_video_widget ((Totem *)(totem)));
- gc = gconf_client_get_default ();
- lock_screensaver_on_audio = gconf_client_get_bool (gc,
- GCONF_PREFIX"/lock_screensaver_on_audio",
- NULL);
+ lock_screensaver_on_audio = g_settings_get_boolean (pi->settings, "lock-screensaver-on-audio");
can_get_frames = bacon_video_widget_can_get_frames (bvw, NULL);
if (totem_is_playing (totem) != FALSE && can_get_frames)
@@ -127,8 +122,6 @@ totem_screensaver_update_from_state (TotemObject *totem,
totem_scrsaver_disable (pi->scr);
else
totem_scrsaver_enable (pi->scr);
-
- g_object_unref (gc);
}
static void
@@ -146,8 +139,7 @@ got_metadata_cb (BaconVideoWidget *bvw, TotemScreensaverPlugin *pi)
}
static void
-lock_screensaver_on_audio_changed_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, TotemScreensaverPlugin *pi)
+lock_screensaver_on_audio_changed_cb (GSettings *settings, const gchar *key, TotemScreensaverPlugin *pi)
{
totem_screensaver_update_from_state (pi->totem, pi);
}
@@ -157,18 +149,12 @@ impl_activate (PeasActivatable *plugin)
{
TotemScreensaverPlugin *pi = TOTEM_SCREENSAVER_PLUGIN (plugin);
TotemObject *totem;
- GConfClient *gc;
totem = g_object_get_data (G_OBJECT (plugin), "object");
pi->bvw = BACON_VIDEO_WIDGET (totem_get_video_widget (totem));
- gc = gconf_client_get_default ();
- gconf_client_add_dir (gc, GCONF_PREFIX,
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- pi->handler_id_gconf = gconf_client_notify_add (gc, GCONF_PREFIX"/lock_screensaver_on_audio",
- (GConfClientNotifyFunc) lock_screensaver_on_audio_changed_cb,
- plugin, NULL, NULL);
- g_object_unref (gc);
+ pi->settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
+ g_signal_connect (pi->settings, "changed::lock-screensaver-on-audio", (GCallback) lock_screensaver_on_audio_changed_cb, plugin);
pi->handler_id_playing = g_signal_connect (G_OBJECT (totem),
"notify::playing",
@@ -189,11 +175,8 @@ static void
impl_deactivate (PeasActivatable *plugin)
{
TotemScreensaverPlugin *pi = TOTEM_SCREENSAVER_PLUGIN (plugin);
- GConfClient *gc;
- gc = gconf_client_get_default ();
- gconf_client_notify_remove (gc, pi->handler_id_gconf);
- g_object_unref (gc);
+ g_object_unref (pi->settings);
if (pi->handler_id_playing != 0) {
TotemObject *totem;
diff --git a/src/plugins/screenshot/Makefile.am b/src/plugins/screenshot/Makefile.am
index c7d6277..5af3423 100644
--- a/src/plugins/screenshot/Makefile.am
+++ b/src/plugins/screenshot/Makefile.am
@@ -15,7 +15,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/screenshot/totem-screenshot-plugin.c b/src/plugins/screenshot/totem-screenshot-plugin.c
index fa596b6..e8d0d04 100644
--- a/src/plugins/screenshot/totem-screenshot-plugin.c
+++ b/src/plugins/screenshot/totem-screenshot-plugin.c
@@ -32,7 +32,6 @@
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include <libpeas/peas-activatable.h>
-#include <gconf/gconf-client.h>
#ifdef HAVE_XFREE
#include <X11/XF86keysym.h>
@@ -53,7 +52,7 @@ struct TotemScreenshotPluginPrivate {
gulong notify_logo_mode_signal;
gulong key_press_event_signal;
- guint gconf_id;
+ GSettings *settings;
gboolean save_to_disk;
guint ui_merge_id;
@@ -195,9 +194,9 @@ notify_logo_mode_cb (GObject *object, GParamSpec *pspec, TotemScreenshotPlugin *
}
static void
-disable_save_to_disk_changed_cb (GConfClient *client, guint connection_id, GConfEntry *entry, TotemScreenshotPlugin *self)
+disable_save_to_disk_changed_cb (GSettings *settings, const gchar *key, TotemScreenshotPlugin *self)
{
- self->priv->save_to_disk = !gconf_client_get_bool (client, "/desktop/gnome/lockdown/disable_save_to_disk", NULL);
+ self->priv->save_to_disk = !g_settings_get_boolean (settings, "disable-save-to-disk");
}
static void
@@ -205,7 +204,6 @@ impl_activate (PeasActivatable *plugin)
{
GtkWindow *window;
GtkUIManager *manager;
- GConfClient *client;
TotemScreenshotPlugin *self = TOTEM_SCREENSHOT_PLUGIN (plugin);
TotemScreenshotPluginPrivate *priv = self->priv;
const GtkActionEntry menu_entries[] = {
@@ -254,13 +252,10 @@ impl_activate (PeasActivatable *plugin)
"/ui/tmw-menubar/edit/repeat-mode", NULL,
NULL, GTK_UI_MANAGER_SEPARATOR, TRUE);
- /* Set up a GConf watch for lockdown keys */
- client = gconf_client_get_default ();
- priv->gconf_id = gconf_client_notify_add (client, "/desktop/gnome/lockdown/disable_save_to_disk",
- (GConfClientNotifyFunc) disable_save_to_disk_changed_cb,
- self, NULL, NULL);
- disable_save_to_disk_changed_cb (client, priv->gconf_id, NULL, self);
- g_object_unref (client);
+ /* Set up a GSettings watch for lockdown keys */
+ priv->settings = g_settings_new ("org.gnome.desktop.lockdown");
+ g_signal_connect (priv->settings, "changed::disable-save-to-disk", (GCallback) disable_save_to_disk_changed_cb, self);
+ disable_save_to_disk_changed_cb (priv->settings, "disable-save-to-disk", self);
/* Update the menu entries' states */
update_state (self);
@@ -272,7 +267,6 @@ impl_deactivate (PeasActivatable *plugin)
TotemScreenshotPluginPrivate *priv = TOTEM_SCREENSHOT_PLUGIN (plugin)->priv;
GtkWindow *window;
GtkUIManager *manager;
- GConfClient *client;
/* Disconnect signal handlers */
g_signal_handler_disconnect (G_OBJECT (priv->bvw), priv->got_metadata_signal);
@@ -282,10 +276,8 @@ impl_deactivate (PeasActivatable *plugin)
g_signal_handler_disconnect (G_OBJECT (window), priv->key_press_event_signal);
g_object_unref (window);
- /* Disconnect from GConf */
- client = gconf_client_get_default ();
- gconf_client_notify_remove (client, priv->gconf_id);
- g_object_unref (client);
+ /* Disconnect from GSettings */
+ g_object_unref (priv->settings);
/* Remove the menu */
manager = totem_get_ui_manager (priv->totem);
@@ -321,14 +313,14 @@ make_filename_for_dir (const char *directory, const char *format, const char *mo
gchar *
totem_screenshot_plugin_setup_file_chooser (const char *filename_format, const char *movie_title)
{
- GConfClient *client;
+ GSettings *settings;
char *path, *filename, *full, *uri;
GFile *file;
/* Set the default path */
- client = gconf_client_get_default ();
- path = gconf_client_get_string (client, "/apps/totem/screenshot_save_path", NULL);
- g_object_unref (client);
+ settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
+ path = g_settings_get_string (settings, "screenshot-save-path");
+ g_object_unref (settings);
/* Default to the Pictures directory */
if (path == NULL || path[0] == '\0') {
@@ -357,7 +349,7 @@ totem_screenshot_plugin_setup_file_chooser (const char *filename_format, const c
void
totem_screenshot_plugin_update_file_chooser (const char *uri)
{
- GConfClient *client;
+ GSettings *settings;
char *dir;
GFile *file, *parent;
@@ -368,10 +360,9 @@ totem_screenshot_plugin_update_file_chooser (const char *uri)
dir = g_file_get_path (parent);
g_object_unref (parent);
- client = gconf_client_get_default ();
- gconf_client_set_string (client,
- "/apps/totem/screenshot_save_path",
- dir, NULL);
+ settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
+ g_settings_set_string (settings, "screenshot-save-path", dir);
+ g_object_unref (settings);
g_free (dir);
}
diff --git a/src/plugins/sidebar-test/Makefile.am b/src/plugins/sidebar-test/Makefile.am
index a389037..42ea659 100644
--- a/src/plugins/sidebar-test/Makefile.am
+++ b/src/plugins/sidebar-test/Makefile.am
@@ -15,7 +15,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/skipto/Makefile.am b/src/plugins/skipto/Makefile.am
index 54c2ae0..0712b27 100644
--- a/src/plugins/skipto/Makefile.am
+++ b/src/plugins/skipto/Makefile.am
@@ -15,7 +15,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/thumbnail/Makefile.am b/src/plugins/thumbnail/Makefile.am
index c0b33a7..14d4fed 100644
--- a/src/plugins/thumbnail/Makefile.am
+++ b/src/plugins/thumbnail/Makefile.am
@@ -13,7 +13,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/tracker/Makefile.am b/src/plugins/tracker/Makefile.am
index 409fc6e..0ce8322 100644
--- a/src/plugins/tracker/Makefile.am
+++ b/src/plugins/tracker/Makefile.am
@@ -13,7 +13,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
diff --git a/src/plugins/youtube/Makefile.am b/src/plugins/youtube/Makefile.am
index 0605f6f..78b0e88 100644
--- a/src/plugins/youtube/Makefile.am
+++ b/src/plugins/youtube/Makefile.am
@@ -16,7 +16,6 @@ common_defines = \
-D_REENTRANT \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DGCONF_PREFIX=\""/apps/totem"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DBINDIR=\""$(bindir)"\" \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]