[Xfce4-commits] <parole:master> Finished porting all settings to Xfconf.
Sean Davis
noreply at xfce.org
Thu Dec 20 21:50:01 CET 2012
Updating branch refs/heads/master
to 5d84cc65f25ba221fd63d77032ecd8f0b5ce7872 (commit)
from 1ac7329ce4af4adfb8c05f448b8efbe911d64124 (commit)
commit 5d84cc65f25ba221fd63d77032ecd8f0b5ce7872
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Thu Dec 20 15:48:05 2012 -0500
Finished porting all settings to Xfconf.
src/common/parole-rc-utils.c | 88 -------
src/common/parole-rc-utils.h | 31 ---
src/gst/parole-gst.c | 5 +-
src/main.c | 9 +-
src/parole-conf.c | 540 ++++++++++++++++++++++++++++--------------
src/parole-conf.h | 7 +
src/parole-mediachooser.c | 12 +-
src/parole-medialist.c | 8 +-
src/parole-module.c | 1 -
src/parole-player.c | 38 +++-
src/parole-plugins-manager.c | 29 ++-
11 files changed, 436 insertions(+), 332 deletions(-)
diff --git a/src/common/parole-rc-utils.c b/src/common/parole-rc-utils.c
index 5631d26..3a17521 100644
--- a/src/common/parole-rc-utils.c
+++ b/src/common/parole-rc-utils.c
@@ -47,94 +47,6 @@ parole_get_resource_file (const gchar *group, gboolean readonly)
return rc;
}
-void parole_rc_write_entry_bool (const gchar *property, const gchar *group, gboolean value)
-{
- XfceRc *rc = parole_get_resource_file (group, FALSE);
-
- xfce_rc_write_bool_entry (rc, property, value);
- xfce_rc_close (rc);
-}
-
-void parole_rc_write_entry_int (const gchar *property, const gchar *group, gint value)
-{
- XfceRc *rc = parole_get_resource_file (group, FALSE);
-
- xfce_rc_write_int_entry (rc, property, value);
- xfce_rc_close (rc);
-}
-
-void parole_rc_write_entry_string (const gchar *property, const gchar *group, const gchar *value)
-{
- XfceRc *rc = parole_get_resource_file (group, FALSE);
-
- xfce_rc_write_entry (rc, property, value);
- xfce_rc_close (rc);
-}
-
-void parole_rc_write_entry_list (const gchar *property, const gchar *group, gchar **value)
-{
- XfceRc *rc = parole_get_resource_file (group, FALSE);
-
- xfce_rc_write_list_entry (rc, property, value, ";");
- xfce_rc_close (rc);
-}
-
-gboolean parole_rc_read_entry_bool (const gchar *property, const gchar *group, gboolean fallback)
-{
- XfceRc *rc = parole_get_resource_file (group, TRUE);
- gboolean ret_val = fallback;
-
- if ( rc )
- {
- ret_val = xfce_rc_read_bool_entry (rc, property, fallback);
- xfce_rc_close (rc);
- }
-
- return ret_val;
-}
-
-gint parole_rc_read_entry_int (const gchar *property, const gchar *group, gint fallback)
-{
- XfceRc *rc = parole_get_resource_file (group, TRUE);
- gint ret_val = fallback;
-
- if ( rc )
- {
- ret_val = xfce_rc_read_int_entry (rc, property, fallback);
- xfce_rc_close (rc);
- }
-
- return ret_val;
-}
-
-const gchar *parole_rc_read_entry_string (const gchar *property, const gchar *group, const gchar *fallback)
-{
- const gchar *ret_val = fallback;
- XfceRc *rc = parole_get_resource_file (group, TRUE);
-
- if ( rc )
- {
- ret_val = xfce_rc_read_entry (rc, property, fallback);
- xfce_rc_close (rc);
- }
-
- return ret_val;
-}
-
-gchar **parole_rc_read_entry_list (const gchar *property, const gchar *group)
-{
- gchar **ret_val = NULL;
- XfceRc *rc = parole_get_resource_file (group, TRUE);
-
- if ( rc )
- {
- ret_val = xfce_rc_read_list_entry (rc, property, ";");
- xfce_rc_close (rc);
- }
-
- return ret_val;
-}
-
gchar **parole_get_history_full (const gchar *relpath)
{
gchar **lines = NULL;
diff --git a/src/common/parole-rc-utils.h b/src/common/parole-rc-utils.h
index 8492a78..fd7c623 100644
--- a/src/common/parole-rc-utils.h
+++ b/src/common/parole-rc-utils.h
@@ -32,37 +32,6 @@
XfceRc *parole_get_resource_file (const gchar *group,
gboolean readonly);
-void parole_rc_write_entry_bool (const gchar *property,
- const gchar *group,
- gboolean value);
-
-void parole_rc_write_entry_int (const gchar *property,
- const gchar *group,
- gint value);
-
-void parole_rc_write_entry_string (const gchar *property,
- const gchar *group,
- const gchar *value);
-
-void parole_rc_write_entry_list (const gchar *property,
- const gchar *group,
- gchar **value);
-
-gboolean parole_rc_read_entry_bool (const gchar *property,
- const gchar *group,
- gboolean fallback);
-
-gint parole_rc_read_entry_int (const gchar *property,
- const gchar *group,
- gint fallback);
-
-const gchar *parole_rc_read_entry_string (const gchar *property,
- const gchar *group,
- const gchar *fallback);
-
-gchar **parole_rc_read_entry_list (const gchar *property,
- const gchar *group);
-
gchar **parole_get_history (void);
gchar **parole_get_history_full (const gchar *relpath);
diff --git a/src/gst/parole-gst.c b/src/gst/parole-gst.c
index ba67e64..83b63af 100644
--- a/src/gst/parole-gst.c
+++ b/src/gst/parole-gst.c
@@ -44,7 +44,6 @@
#include "parole-gst.h"
#include "common/parole-common.h"
-#include "common/parole-rc-utils.h"
#include "parole-utils.h"
@@ -2020,7 +2019,9 @@ parole_gst_constructed (GObject *object)
gst = PAROLE_GST (object);
- enable_xv = parole_rc_read_entry_bool ("enable-xv", PAROLE_RC_GROUP_GENERAL, TRUE);
+ g_object_get (G_OBJECT (gst->priv->conf),
+ "enable-xv", &enable_xv,
+ NULL);
gst->priv->playbin = gst_element_factory_make ("playbin2", "player");
diff --git a/src/main.c b/src/main.c
index 7174e52..831a2b4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,7 +46,7 @@
#include "parole-utils.h"
#include "parole-dbus.h"
#include "parole-builder.h"
-#include "parole-rc-utils.h"
+#include "parole-conf.h"
#include <X11/X.h>
#include <X11/Xlib.h>
@@ -220,6 +220,7 @@ static gboolean
xv_option_given (const gchar *name, const gchar *value, gpointer data, GError **error)
{
gboolean enabled = TRUE;
+ ParoleConf *conf;
if ( !g_strcmp0 (value, "TRUE") || !g_strcmp0 (value, "true"))
enabled = TRUE;
@@ -231,8 +232,12 @@ xv_option_given (const gchar *name, const gchar *value, gpointer data, GError **
return FALSE;
}
- parole_rc_write_entry_bool ("enable-xv", PAROLE_RC_GROUP_GENERAL, enabled);
+ conf = parole_conf_new ();
+ g_object_set (G_OBJECT (conf),
+ "enable-xv", enabled,
+ NULL);
+ g_object_unref(conf);
exit (0);
}
diff --git a/src/parole-conf.c b/src/parole-conf.c
index 61c9d5b..1abb2b4 100644
--- a/src/parole-conf.c
+++ b/src/parole-conf.c
@@ -44,37 +44,41 @@ static gpointer parole_conf_object = NULL;
enum
{
PROP_0,
- /*Visualisations*/
+ /* Audio */
PROP_VIS_ENABLED,
PROP_VIS_NAME,
- /*Screensaver*/
- PROP_DISABLE_SCREEN_SAVER,
- /*Subtitles*/
- PROP_SUBTITLE_ENABLED,
- PROP_SUBTITLE_FONT,
- PROP_SUBTITLE_ENCODING,
- /*Playback*/
+ PROP_VOLUME,
+ /* Folders */
+ PROP_ISO_IMAGE_FOLDER,
+ PROP_MEDIA_CHOOSER_FOLDER,
+ /* Parole General */
+ PROP_MULTIMEDIA_KEYS,
+ PROP_PLUGINS,
+ PROP_SCAN_FOLDER_RECURSIVELY,
+ /* Playlist */
+ PROP_REMEMBER_PLAYLIST,
+ PROP_REMOVE_DUPLICATED_PLAYLIST_ENTRIES,
PROP_REPEAT,
+ PROP_REPLACE_PLAYLIST,
+ PROP_SHOWHIDE_PLAYLIST,
PROP_SHUFFLE,
- /*Video properties*/
+ PROP_START_PLAYING_OPENED_FILES,
+ /* Subtitles */
+ PROP_SUBTITLE_ENABLED,
+ PROP_SUBTITLE_ENCODING,
+ PROP_SUBTITLE_FONT,
+ /* Video */
+ PROP_ASPECT_RATIO,
PROP_BRIGHTNESS,
PROP_CONTRAST,
+ PROP_DISABLE_SCREEN_SAVER,
+ PROP_ENABLE_XV,
PROP_HUE,
PROP_SATURATION,
- PROP_ASPECT_RATIO,
- /*Window properties*/
- PROP_WINDOW_WIDTH,
+ /* Window properties */
PROP_WINDOW_HEIGHT,
PROP_MINIMIZED,
- /*Grab Multimedia keys*/
- PROP_MULTIMEDIA_KEYS,
- /*Playlist*/
- PROP_SHOWHIDE_PLAYLIST,
- PROP_REPLACE_PLAYLIST,
- PROP_SCAN_FOLDER_RECURSIVELY,
- PROP_START_PLAYING_OPENED_FILES,
- PROP_REMEMBER_PLAYLIST,
- PROP_REMOVE_DUPLICATED_PLAYLIST_ENTRIES,
+ PROP_WINDOW_WIDTH,
N_PROP
};
@@ -139,6 +143,7 @@ static void parole_conf_set_property (GObject *object,
ParoleConf *conf = PAROLE_CONF (object);
GValue dst = { 0, };
gchar prop_name[64];
+ const gchar *xfconf_nick;
gchar **array;
/* leave if the channel is not set */
@@ -147,6 +152,9 @@ static void parole_conf_set_property (GObject *object,
/* build property name */
g_snprintf (prop_name, sizeof (prop_name), "/%s", g_param_spec_get_name (pspec));
+
+ /* store xfconf values using the spec nick */
+ xfconf_nick = g_strdup_printf("%s", g_param_spec_get_nick(pspec));
/* freeze */
g_signal_handler_block (conf->channel, conf->property_changed_id);
@@ -156,7 +164,7 @@ static void parole_conf_set_property (GObject *object,
/* convert into a string */
g_value_init (&dst, G_TYPE_STRING);
if (g_value_transform (value, &dst))
- xfconf_channel_set_property (conf->channel, prop_name, &dst);
+ xfconf_channel_set_property (conf->channel, xfconf_nick, &dst);
g_value_unset (&dst);
}
else if (G_VALUE_HOLDS (value, G_TYPE_STRV))
@@ -164,14 +172,14 @@ static void parole_conf_set_property (GObject *object,
/* convert to a GValue GPtrArray in xfconf */
array = g_value_get_boxed (value);
if (array != NULL && *array != NULL)
- xfconf_channel_set_string_list (conf->channel, prop_name, (const gchar * const *) array);
+ xfconf_channel_set_string_list (conf->channel, xfconf_nick, (const gchar * const *) array);
else
- xfconf_channel_reset_property (conf->channel, prop_name, FALSE);
+ xfconf_channel_reset_property (conf->channel, xfconf_nick, FALSE);
}
else
{
/* other types we support directly */
- xfconf_channel_set_property (conf->channel, prop_name, value);
+ xfconf_channel_set_property (conf->channel, xfconf_nick, value);
}
/* thaw */
@@ -195,6 +203,7 @@ static void parole_conf_get_property (GObject *object,
ParoleConf *conf = PAROLE_CONF (object);
GValue src = { 0, };
gchar prop_name[64];
+ const gchar *xfconf_nick;
gchar **array;
/* only set defaults if channel is not set */
@@ -206,14 +215,17 @@ static void parole_conf_get_property (GObject *object,
/* build property name */
g_snprintf (prop_name, sizeof (prop_name), "/%s", g_param_spec_get_name (pspec));
+
+ /* store xfconf values using the spec nick */
+ xfconf_nick = g_strdup_printf("%s", g_param_spec_get_nick(pspec));
if (G_VALUE_TYPE (value) == G_TYPE_STRV)
{
/* handle arrays directly since we cannot transform those */
- array = xfconf_channel_get_string_list (conf->channel, prop_name);
+ array = xfconf_channel_get_string_list (conf->channel, xfconf_nick);
g_value_take_boxed (value, array);
}
- else if (xfconf_channel_get_property (conf->channel, prop_name, &src))
+ else if (xfconf_channel_get_property (conf->channel, xfconf_nick, &src))
{
if (G_VALUE_TYPE (value) == G_VALUE_TYPE (&src))
g_value_copy (&src, value);
@@ -345,103 +357,197 @@ parole_conf_class_init (ParoleConfClass *klass)
/**
* ParoleConf:vis-enabled:
*
+ * Xfconf property: /audio/visualization-enabled
+ *
* If visualizations are enabled.
**/
g_object_class_install_property (object_class,
PROP_VIS_ENABLED,
g_param_spec_boolean ("vis-enabled",
- "VisEnabled",
+ "/audio/visualization-enabled",
NULL,
FALSE,
G_PARAM_READWRITE));
/**
- * ParoleConf:reset-saver:
+ * ParoleConf:vis-name:
*
- * If screensavers should be disabled when a video is playing.
+ * Xfconf property: /audio/visualization-name
+ *
+ * Name of the selected visualization.
**/
g_object_class_install_property (object_class,
- PROP_DISABLE_SCREEN_SAVER,
- g_param_spec_boolean ("reset-saver",
- "ResetSaver",
+ PROP_VIS_NAME,
+ g_param_spec_string ("vis-name",
+ "/audio/visualization-name",
NULL,
- TRUE,
+ "none",
G_PARAM_READWRITE));
/**
- * ParoleConf:vis-name:
+ * ParoleConf:volume:
*
- * Name of the selected visualization.
+ * Xfconf property: /audio/volume
+ *
+ * Audio volume level.
**/
g_object_class_install_property (object_class,
- PROP_VIS_NAME,
- g_param_spec_string ("vis-name",
- "VisName",
+ PROP_VOLUME,
+ g_param_spec_int ("volume",
+ "/audio/volume",
+ NULL,
+ 0,
+ 100,
+ 50,
+ G_PARAM_READWRITE));
+
+ /**
+ * ParoleConf:iso-image-folder:
+ *
+ * Xfconf property: /folders/last-used-iso
+ *
+ * Path to directory containing last used iso image.
+ **/
+ g_object_class_install_property (object_class,
+ PROP_ISO_IMAGE_FOLDER,
+ g_param_spec_string ("iso-image-folder",
+ "/folders/last-used-iso",
NULL,
"none",
G_PARAM_READWRITE));
/**
- * ParoleConf:subtitle-encoding:
+ * ParoleConf:media-chooser-folder:
*
- * Encoding for subtitle text.
+ * Xfconf property: /folders/last-used-media
+ *
+ * Path to directory containing last used media.
**/
g_object_class_install_property (object_class,
- PROP_SUBTITLE_ENCODING,
- g_param_spec_string ("subtitle-encoding",
- "SubtitleEncoding",
+ PROP_MEDIA_CHOOSER_FOLDER,
+ g_param_spec_string ("media-chooser-folder",
+ "/folders/last-used-media",
NULL,
- "UTF-8",
+ "none",
G_PARAM_READWRITE));
/**
- * ParoleConf:enable-subtitle:
+ * ParoleConf:multimedia-keys:
*
- * If subtitles are enabled.
+ * Xfconf property: /parole/multimedia-keys
+ *
+ * If multimedia keys are enabled for controlling playback.
**/
g_object_class_install_property (object_class,
- PROP_SUBTITLE_ENABLED,
- g_param_spec_boolean ("enable-subtitle",
- "EnableSubtitle",
+ PROP_MULTIMEDIA_KEYS,
+ g_param_spec_boolean ("multimedia-keys",
+ "/parole/multimedia-keys",
NULL,
TRUE,
G_PARAM_READWRITE));
/**
- * ParoleConf:minimized:
+ * ParoleConf:plugins:
*
- * If Parole should start minimized.
+ * Xfconf property: /parole/plugins
+ *
+ * List of enabled plugins.
**/
g_object_class_install_property (object_class,
- PROP_MINIMIZED,
- g_param_spec_boolean ("minimized",
- "Minimized",
+ PROP_PLUGINS,
+ g_param_spec_string ("plugins",
+ "/parole/plugins",
NULL,
- FALSE,
+ "none",
G_PARAM_READWRITE));
/**
- * ParoleConf:subtitle-font:
+ * ParoleConf:scan-recursive:
*
- * Name and size of the subtitle font size.
+ * Xfconf property: /parole/scan-recursive
+ *
+ * If openening a directory should also open subdirectories.
**/
g_object_class_install_property (object_class,
- PROP_SUBTITLE_FONT,
- g_param_spec_string ("subtitle-font",
- "SubtitleFont",
+ PROP_SCAN_FOLDER_RECURSIVELY,
+ g_param_spec_boolean ("scan-recursive",
+ "/parole/scan-recursive",
NULL,
- "Sans Bold 20",
+ TRUE,
+ G_PARAM_READWRITE));
+
+ /**
+ * ParoleConf:remember-playlist:
+ *
+ * Xfconf property: /playlist/remember-playlist
+ *
+ * If the playlist should be persistent across application sessions.
+ **/
+ g_object_class_install_property (object_class,
+ PROP_REMEMBER_PLAYLIST,
+ g_param_spec_boolean ("remember-playlist",
+ "/playlist/remember-playlist",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ /**
+ * ParoleConf:remove-duplicated:
+ *
+ * Xfconf property: /playlist/remove-duplicates
+ *
+ * If duplicate playlist entries should be removed from the playlist.
+ **/
+ g_object_class_install_property (object_class,
+ PROP_REMOVE_DUPLICATED_PLAYLIST_ENTRIES,
+ g_param_spec_boolean ("remove-duplicated",
+ "/playlist/remove-duplicates",
+ NULL,
+ FALSE,
G_PARAM_READWRITE));
/**
* ParoleConf:repeat:
- *
+ *
+ * Xfconf property: /playlist/repeat
+ *
* If the playlist should automatically repeat when finished.
**/
g_object_class_install_property (object_class,
PROP_REPEAT,
g_param_spec_boolean ("repeat",
- "Repeat",
+ "/playlist/repeat",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ /**
+ * ParoleConf:replace-playlist:
+ *
+ * Xfconf property: /playlist/replace-playlist
+ *
+ * If the playlist should be replaced (as opposed to being appended to)
+ * when files are opened.
+ **/
+ g_object_class_install_property (object_class,
+ PROP_REPLACE_PLAYLIST,
+ g_param_spec_boolean ("replace-playlist",
+ "/playlist/replace-playlist",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ /**
+ * ParoleConf:showhide-playlist:
+ *
+ * Xfconf property: /playlist/show-playlist
+ *
+ * If the playlist is shown or hidden.
+ **/
+ g_object_class_install_property (object_class,
+ PROP_SHOWHIDE_PLAYLIST,
+ g_param_spec_boolean ("showhide-playlist",
+ "/playlist/show-playlist",
NULL,
FALSE,
G_PARAM_READWRITE));
@@ -449,213 +555,242 @@ parole_conf_class_init (ParoleConfClass *klass)
/**
* ParoleConf:shuffle:
*
+ * Xfconf property: /playlist/shuffle
+ *
* If the playlist should be played in shuffled order.
**/
g_object_class_install_property (object_class,
PROP_SHUFFLE,
g_param_spec_boolean ("shuffle",
- "Shuffle",
+ "/playlist/shuffle",
NULL,
FALSE,
G_PARAM_READWRITE));
/**
- * ParoleConf:contrast:
+ * ParoleConf:play-opened-files:
*
- * Video contrast level.
+ * Xfconf property: /playlist/play-opened-files
+ *
+ * If files should automatically play when opened, or just be appended to
+ * the playlist.
**/
g_object_class_install_property (object_class,
- PROP_CONTRAST,
- g_param_spec_int ("contrast",
- "Contrast",
- NULL,
- -1000,
- 1000,
- 0,
- G_PARAM_READWRITE));
+ PROP_START_PLAYING_OPENED_FILES,
+ g_param_spec_boolean ("play-opened-files",
+ "/playlist/play-opened-files",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
/**
- * ParoleConf:hue:
+ * ParoleConf:enable-subtitle:
*
- * Video hue level.
+ * Xfconf property: /subtitles/enabled
+ *
+ * If subtitles are enabled.
**/
g_object_class_install_property (object_class,
- PROP_HUE,
- g_param_spec_int ("hue",
- "Hue",
- NULL,
- -1000,
- 1000,
- 0,
- G_PARAM_READWRITE));
+ PROP_SUBTITLE_ENABLED,
+ g_param_spec_boolean ("enable-subtitle",
+ "/subtitles/enabled",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
/**
- * ParoleConf:saturation:
+ * ParoleConf:subtitle-encoding:
*
- * Video saturation level.
+ * Xfconf property: /subtitles/encoding
+ *
+ * Encoding for subtitle text.
**/
g_object_class_install_property (object_class,
- PROP_SATURATION,
- g_param_spec_int ("saturation",
- "Saturation",
- NULL,
- -1000,
- 1000,
- 0,
- G_PARAM_READWRITE));
-
+ PROP_SUBTITLE_ENCODING,
+ g_param_spec_string ("subtitle-encoding",
+ "/subtitles/encoding",
+ NULL,
+ "UTF-8",
+ G_PARAM_READWRITE));
+
/**
- * ParoleConf:brightness:
+ * ParoleConf:subtitle-font:
*
- * Video brightness level.
+ * Xfconf property: /subtitles/font
+ *
+ * Name and size of the subtitle font size.
**/
g_object_class_install_property (object_class,
- PROP_BRIGHTNESS,
- g_param_spec_int ("brightness",
- "Brightness",
- NULL,
- -1000,
- 1000,
- 0,
- G_PARAM_READWRITE));
+ PROP_SUBTITLE_FONT,
+ g_param_spec_string ("subtitle-font",
+ "/subtitles/font",
+ NULL,
+ "Sans Bold 20",
+ G_PARAM_READWRITE));
/**
* ParoleConf:aspect-ratio:
*
+ * Xfconf property: /video/aspect-ratio
+ *
* Video aspect ratio.
**/
g_object_class_install_property (object_class,
PROP_ASPECT_RATIO,
g_param_spec_enum ("aspect-ratio",
- "AspectRatio",
+ "/video/aspect-ratio",
NULL,
GST_ENUM_TYPE_ASPECT_RATIO,
PAROLE_ASPECT_RATIO_AUTO,
G_PARAM_READWRITE));
/**
- * ParoleConf:window-width:
+ * ParoleConf:brightness:
+ *
+ * Xfconf property: /video/brightness
*
- * Saved width of the application window.
+ * Video brightness level.
**/
g_object_class_install_property (object_class,
- PROP_WINDOW_WIDTH,
- g_param_spec_int ("window-width",
- "WindowWidth",
+ PROP_BRIGHTNESS,
+ g_param_spec_int ("brightness",
+ "/video/brightness",
NULL,
- 100,
- G_MAXINT16,
- 760,
+ -1000,
+ 1000,
+ 0,
G_PARAM_READWRITE));
/**
- * ParoleConf:window-height:
+ * ParoleConf:contrast:
*
- * Saved height of the application window.
+ * Xfconf property: /video/contrast
+ *
+ * Video contrast level.
**/
g_object_class_install_property (object_class,
- PROP_WINDOW_HEIGHT,
- g_param_spec_int ("window-height",
- "WindowHeight",
+ PROP_CONTRAST,
+ g_param_spec_int ("contrast",
+ "/video/contrast",
NULL,
- 100,
- G_MAXINT16,
- 420,
+ -1000,
+ 1000,
+ 0,
G_PARAM_READWRITE));
/**
- * ParoleConf:multimedia-keys:
+ * ParoleConf:reset-saver:
*
- * If multimedia keys are enabled for controlling playback.
+ * Xfconf property: /video/disable-screensaver
+ *
+ * If screensavers should be disabled when a video is playing.
**/
g_object_class_install_property (object_class,
- PROP_MULTIMEDIA_KEYS,
- g_param_spec_boolean ("multimedia-keys",
- "MultimediaKeys",
+ PROP_DISABLE_SCREEN_SAVER,
+ g_param_spec_boolean ("reset-saver",
+ "/video/disable-screensaver",
NULL,
TRUE,
G_PARAM_READWRITE));
/**
- * ParoleConf:showhide-playlist:
+ * ParoleConf:enable-xv:
*
- * If the playlist is shown or hidden.
+ * Xfconf property: /video/enable-xv
+ *
+ * Enable xv hardware extensions.
**/
g_object_class_install_property (object_class,
- PROP_SHOWHIDE_PLAYLIST,
- g_param_spec_boolean ("showhide-playlist",
- "ShowhidePlaylist",
+ PROP_ENABLE_XV,
+ g_param_spec_boolean ("enable-xv",
+ "/video/enable-xv",
NULL,
- FALSE,
+ TRUE,
G_PARAM_READWRITE));
/**
- * ParoleConf:replace-playlist:
+ * ParoleConf:hue:
*
- * If the playlist should be replaced (as opposed to being appended to)
- * when files are opened.
+ * Xfconf property: /video/hue
+ *
+ * Video hue level.
**/
g_object_class_install_property (object_class,
- PROP_REPLACE_PLAYLIST,
- g_param_spec_boolean ("replace-playlist",
- "ReplacePlaylist",
- NULL,
- FALSE,
- G_PARAM_READWRITE));
-
+ PROP_HUE,
+ g_param_spec_int ("hue",
+ "/video/hue",
+ NULL,
+ -1000,
+ 1000,
+ 0,
+ G_PARAM_READWRITE));
+
/**
- * ParoleConf:scan-recursive:
+ * ParoleConf:saturation:
*
- * If openening a directory should also open subdirectories.
+ * Xfconf property: /video/saturation
+ *
+ * Video saturation level.
**/
g_object_class_install_property (object_class,
- PROP_SCAN_FOLDER_RECURSIVELY,
- g_param_spec_boolean ("scan-recursive",
- "ScanRecursive",
- NULL,
- TRUE,
- G_PARAM_READWRITE));
-
+ PROP_SATURATION,
+ g_param_spec_int ("saturation",
+ "/video/saturation",
+ NULL,
+ -1000,
+ 1000,
+ 0,
+ G_PARAM_READWRITE));
+
/**
- * ParoleConf:play-opened-files:
+ * ParoleConf:window-height:
*
- * If files should automatically play when opened, or just be appended to
- * the playlist.
+ * Xfconf property: /window/height
+ *
+ * Saved height of the application window.
**/
g_object_class_install_property (object_class,
- PROP_START_PLAYING_OPENED_FILES,
- g_param_spec_boolean ("play-opened-files",
- "PlayOpenedFiles",
- NULL,
- TRUE,
- G_PARAM_READWRITE));
+ PROP_WINDOW_HEIGHT,
+ g_param_spec_int ("window-height",
+ "/window/height",
+ NULL,
+ 100,
+ G_MAXINT16,
+ 420,
+ G_PARAM_READWRITE));
/**
- * ParoleConf:remember-playlist:
+ * ParoleConf:minimized:
+ *
+ * Xfconf property: /window/minimized
*
- * If the playlist should be persistent across application sessions.
+ * If Parole should start minimized.
**/
g_object_class_install_property (object_class,
- PROP_REMEMBER_PLAYLIST,
- g_param_spec_boolean ("remember-playlist",
- "RememberPlaylist",
+ PROP_MINIMIZED,
+ g_param_spec_boolean ("minimized",
+ "/window/minimized",
NULL,
FALSE,
G_PARAM_READWRITE));
/**
- * ParoleConf:remove-duplicated:
- *
- * If duplicate playlist entries should be removed from the playlist.
+ * ParoleConf:window-width:
+ *
+ * Xfconf property: /window/width
+ *
+ * Saved width of the application window.
**/
g_object_class_install_property (object_class,
- PROP_REMOVE_DUPLICATED_PLAYLIST_ENTRIES,
- g_param_spec_boolean ("remove-duplicated",
- "RemoveDuplicated",
- NULL,
- FALSE,
- G_PARAM_READWRITE));
-
+ PROP_WINDOW_WIDTH,
+ g_param_spec_int ("window-width",
+ "/window/width",
+ NULL,
+ 100,
+ G_MAXINT16,
+ 760,
+ G_PARAM_READWRITE));
+
}
/**
@@ -754,7 +889,7 @@ parole_conf_load_rc_file (ParoleConf *conf)
static void
parole_conf_init (ParoleConf *conf)
{
- const gchar check_prop[] = "/subtitle-font";
+ const gchar check_prop[] = "/subtitles/font";
/* don't set a channel if xfconf init failed */
if (no_xfconf)
@@ -820,6 +955,55 @@ parole_conf_get_property_bool (ParoleConf *conf,
return value;
}
+void
+parole_conf_write_entry_list (ParoleConf *conf, const gchar *name, gchar **value)
+{
+ gchar *value_string = "";
+ guint num = 0, i, count = 0;
+
+ TRACE("START");
+
+ num = g_strv_length (value);
+ for ( i = 0; i < num; i++ )
+ {
+ if (value[i] && g_strcmp0(value[i], "") != 0 && g_strcmp0(value[i], "none") != 0 )
+ {
+ if (count == 0)
+ value_string = g_strdup(value[i]);
+ else
+ value_string = g_strconcat (value_string, ";", value[i], NULL);
+ count++;
+ }
+ }
+
+ g_object_set (G_OBJECT (conf),
+ name, value_string,
+ NULL);
+
+ if (count > 0) /* FIXME Do I need to be freed no matter what? */
+ g_free(value_string);
+}
+
+gchar**
+parole_conf_read_entry_list (ParoleConf *conf, const gchar *name)
+{
+ gchar *value_string;
+ gchar **ret_val = NULL;
+
+ TRACE("START");
+
+ g_object_get (G_OBJECT (conf),
+ name, &value_string,
+ NULL);
+
+ if ( g_strcmp0(value_string, "") == 0 )
+ return ret_val;
+
+ ret_val = g_strsplit(value_string, ";", 0);
+
+ return ret_val;
+}
+
void
diff --git a/src/parole-conf.h b/src/parole-conf.h
index fb49bab..b2dc0f7 100644
--- a/src/parole-conf.h
+++ b/src/parole-conf.h
@@ -41,6 +41,13 @@ ParoleConf *parole_conf_new (void);
gboolean parole_conf_get_property_bool (ParoleConf *conf,
const gchar *name);
+
+gchar **parole_conf_read_entry_list (ParoleConf *conf,
+ const gchar *name);
+
+void parole_conf_write_entry_list (ParoleConf *conf,
+ const gchar *name,
+ gchar **value);
void parole_conf_xfconf_init_failed (void);
diff --git a/src/parole-mediachooser.c b/src/parole-mediachooser.c
index 44bd87e..dcc292d 100644
--- a/src/parole-mediachooser.c
+++ b/src/parole-mediachooser.c
@@ -54,7 +54,7 @@ void parole_media_chooser_destroy_cb (GtkWidget *widget,
ParoleMediaChooser *chooser);
void media_chooser_folder_changed_cb (GtkWidget *widget,
- gpointer data);
+ ParoleMediaChooser *chooser);
void media_chooser_file_activate_cb (GtkFileChooser *filechooser,
ParoleMediaChooser *chooser);
@@ -88,14 +88,16 @@ static guint signals [LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (ParoleMediaChooser, parole_media_chooser, G_TYPE_OBJECT)
void
-media_chooser_folder_changed_cb (GtkWidget *widget, gpointer data)
+media_chooser_folder_changed_cb (GtkWidget *widget, ParoleMediaChooser *chooser)
{
gchar *folder;
folder = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (widget));
if ( folder )
{
- parole_rc_write_entry_string ("media-chooser-folder", PAROLE_RC_GROUP_GENERAL, folder);
+ g_object_set (G_OBJECT (chooser->conf),
+ "media-chooser-folder", folder,
+ NULL);
g_free (folder);
}
}
@@ -219,7 +221,9 @@ parole_media_chooser_open_internal (ParoleMediaChooser *media_chooser)
gtk_file_chooser_add_filter( GTK_FILE_CHOOSER(file_chooser), all_files );
/* Set the folder that is shown */
- folder = parole_rc_read_entry_string ("media-chooser-folder", PAROLE_RC_GROUP_GENERAL, NULL);
+ g_object_get (G_OBJECT (media_chooser->conf),
+ "media-chooser-folder", &folder,
+ NULL);
if ( folder )
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (file_chooser), folder);
diff --git a/src/parole-medialist.c b/src/parole-medialist.c
index 2b10100..9ac532e 100644
--- a/src/parole-medialist.c
+++ b/src/parole-medialist.c
@@ -51,7 +51,6 @@
#include "parole-filters.h"
#include "parole-pl-parser.h"
#include "parole-utils.h"
-#include "parole-rc-utils.h"
#include "parole-dbus.h"
#include "common/parole-common.h"
@@ -1730,10 +1729,9 @@ void parole_media_list_load (ParoleMediaList *list)
g_object_get (G_OBJECT (list->priv->conf),
"play-opened-files", &play,
+ "remember-playlist", &load_saved_list,
NULL);
- load_saved_list = parole_rc_read_entry_bool ("SAVE_LIST_ON_EXIT", PAROLE_RC_GROUP_GENERAL, FALSE);
-
if ( load_saved_list )
{
gchar *playlist_file;
@@ -2102,7 +2100,9 @@ void parole_media_list_save_list (ParoleMediaList *list)
{
gboolean save;
- save = parole_rc_read_entry_bool ("SAVE_LIST_ON_EXIT", PAROLE_RC_GROUP_GENERAL, FALSE);
+ g_object_get (G_OBJECT (list->priv->conf),
+ "remember-playlist", &save,
+ NULL);
if ( save )
{
diff --git a/src/parole-module.c b/src/parole-module.c
index 3a04ad5..4ec6dcd 100644
--- a/src/parole-module.c
+++ b/src/parole-module.c
@@ -114,7 +114,6 @@ parole_module_unload (GTypeModule *gtype_module)
(*module->shutdown) ();
g_module_close (module->library);
-
module->initialize = NULL;
module->shutdown = NULL;
module->library = NULL;
diff --git a/src/parole-player.c b/src/parole-player.c
index 3fddfa4..29dd32f 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -467,14 +467,16 @@ typedef enum
static void
-iso_files_folder_changed_cb (GtkFileChooser *widget, gpointer data)
+iso_files_folder_changed_cb (GtkFileChooser *widget, ParolePlayer *player)
{
gchar *folder;
folder = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (widget));
if ( folder )
{
- parole_rc_write_entry_string ("iso-image-folder", PAROLE_RC_GROUP_GENERAL, folder);
+ g_object_set (G_OBJECT (player->priv->conf),
+ "iso-image-folder", folder,
+ NULL);
g_free (folder);
}
}
@@ -496,13 +498,15 @@ parole_player_open_iso_image (ParolePlayer *player, ParoleIsoImage image)
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), FALSE);
- folder = parole_rc_read_entry_string ("iso-image-folder", PAROLE_RC_GROUP_GENERAL, NULL);
+ g_object_get (G_OBJECT (player->priv->conf),
+ "iso-image-folder", &folder,
+ NULL);
if ( folder )
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser), folder);
g_signal_connect (chooser, "current-folder-changed",
- G_CALLBACK (iso_files_folder_changed_cb), NULL);
+ G_CALLBACK (iso_files_folder_changed_cb), player);
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, image == PAROLE_ISO_IMAGE_CD ? _("CD image") : _("DVD image"));
@@ -899,7 +903,9 @@ parole_player_select_custom_subtitle (GtkMenuItem *widget, gpointer data)
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), FALSE);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), FALSE);
- folder = parole_rc_read_entry_string ("media-chooser-folder", PAROLE_RC_GROUP_GENERAL, NULL);
+ g_object_get (G_OBJECT (player->priv->conf),
+ "media-chooser-folder", &folder,
+ NULL);
if ( folder )
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser), folder);
@@ -1022,8 +1028,11 @@ parole_player_media_activated_cb (ParoleMediaList *list, GtkTreeRowReference *ro
gtk_window_set_title (GTK_WINDOW (player->priv->window), parole_file_get_display_name(file));
if ( directory )
- parole_rc_write_entry_string ("media-chooser-folder", PAROLE_RC_GROUP_GENERAL, directory);
-
+ {
+ g_object_set (G_OBJECT (player->priv->conf),
+ "media-chooser-folder", directory,
+ NULL);
+ }
g_object_unref (file);
}
@@ -2168,7 +2177,9 @@ void
parole_player_volume_value_changed_cb (GtkScaleButton *widget, gdouble value, ParolePlayer *player)
{
parole_player_change_volume (player, value);
- parole_rc_write_entry_int ("volume", PAROLE_RC_GROUP_GENERAL, (gint)(value * 100));
+ g_object_set (G_OBJECT (player->priv->conf),
+ "volume", (gint)(value * 100),
+ NULL);
}
void
@@ -2228,10 +2239,12 @@ parole_player_finalize (GObject *object)
g_object_unref (player->priv->sm_client);
#ifdef HAVE_XF86_KEYSYM
+ if (player->priv->button)
g_object_unref (player->priv->button);
#endif
gtk_widget_destroy (player->priv->fs_window);
+
G_OBJECT_CLASS (parole_player_parent_class)->finalize (object);
}
@@ -2726,6 +2739,8 @@ parole_player_init (ParolePlayer *player)
gboolean showhide;
GdkColor background;
+ gint volume;
+
GtkWidget *hbox_audiobox;
GtkWidget *recent_menu;
@@ -2950,8 +2965,11 @@ parole_player_init (ParolePlayer *player)
player->priv->update_languages = FALSE;
player->priv->updated_subs = FALSE;
+ g_object_get (G_OBJECT (player->priv->conf),
+ "volume", &volume,
+ NULL);
gtk_scale_button_set_value (GTK_SCALE_BUTTON (player->priv->volume),
- (gdouble) (parole_rc_read_entry_int ("volume", PAROLE_RC_GROUP_GENERAL, 100)/100.));
+ (gdouble) (volume/100.));
/*
* Pack the playlist.
*/
@@ -2986,7 +3004,7 @@ parole_player_init (ParolePlayer *player)
G_CALLBACK (parole_player_seekable_notify), player);
parole_player_change_volume (player,
- (gdouble) (parole_rc_read_entry_int ("volume", PAROLE_RC_GROUP_GENERAL, 100)/100.));
+ (gdouble) (volume/100.));
g_signal_connect (player->priv->list, "media_activated",
G_CALLBACK (parole_player_media_activated_cb), player);
diff --git a/src/parole-plugins-manager.c b/src/parole-plugins-manager.c
index 7216d9b..dafceff 100644
--- a/src/parole-plugins-manager.c
+++ b/src/parole-plugins-manager.c
@@ -40,10 +40,10 @@
#include "interfaces/plugins_ui.h"
#include "parole-builder.h"
-#include "parole-rc-utils.h"
#include "parole-utils.h"
#include "parole-plugins-manager.h"
#include "parole-module.h"
+#include "parole-conf.h"
#include "gst/parole-gst.h"
#include "common/parole-common.h"
@@ -107,6 +107,8 @@ struct ParolePluginsManagerPrivate
GPtrArray *array;
gboolean load_plugins;
+
+ ParoleConf *conf;
};
static gpointer parole_plugins_manager_object = NULL;
@@ -190,13 +192,13 @@ void parole_plugins_manager_show_configure (GtkButton *button, PrefData *pref)
}
static void
-parole_plugins_manager_save_rc (gchar *filename, gboolean active)
+parole_plugins_manager_save_rc (ParolePluginsManager *manager, gchar *filename, gboolean active)
{
gchar **saved_plugins;
gchar **plugins_rc;
- guint num = 0, i;
+ guint num = 0, i, count = 0;
- saved_plugins = parole_rc_read_entry_list ("plugins", PAROLE_RC_GROUP_PLUGINS);
+ saved_plugins = parole_conf_read_entry_list (PAROLE_CONF(manager->priv->conf), "plugins");
if ( saved_plugins )
num = g_strv_length (saved_plugins);
@@ -212,7 +214,7 @@ parole_plugins_manager_save_rc (gchar *filename, gboolean active)
plugins_rc[num] = g_strdup (filename);
plugins_rc[num + 1] = NULL;
- parole_rc_write_entry_list ("plugins", PAROLE_RC_GROUP_PLUGINS, plugins_rc);
+ parole_conf_write_entry_list (PAROLE_CONF(manager->priv->conf), "plugins", plugins_rc);
}
else
{
@@ -221,12 +223,13 @@ parole_plugins_manager_save_rc (gchar *filename, gboolean active)
for ( i = 0; i < num; i++)
{
if ( g_strcmp0 (saved_plugins[i], filename) != 0 )
- plugins_rc[i] = g_strdup (saved_plugins[i]);
- else
- plugins_rc[i] = NULL;
+ {
+ plugins_rc[count] = g_strdup (saved_plugins[i]);
+ count++;
+ }
}
plugins_rc[num] = NULL;
- parole_rc_write_entry_list ("plugins", PAROLE_RC_GROUP_PLUGINS, plugins_rc);
+ parole_conf_write_entry_list (PAROLE_CONF(manager->priv->conf), "plugins", plugins_rc);
}
g_strfreev (plugins_rc);
g_strfreev (saved_plugins);
@@ -273,7 +276,7 @@ parole_plugins_manager_cell_toggled_cb (GtkCellRendererToggle *cell_renderer,
gtk_tree_path_free (path);
- parole_plugins_manager_save_rc (G_TYPE_MODULE (module)->name, active);
+ parole_plugins_manager_save_rc (pref->manager, G_TYPE_MODULE (module)->name, active);
}
void parole_plugins_manager_tree_cursor_changed_cb (GtkTreeView *view,
@@ -531,7 +534,7 @@ parole_plugins_manager_load_plugins (ParolePluginsManager *manager)
gchar **plugins_rc;
guint len = 0, i, j;
- plugins_rc = parole_rc_read_entry_list ("plugins", PAROLE_RC_GROUP_PLUGINS);
+ plugins_rc = parole_conf_read_entry_list (PAROLE_CONF(manager->priv->conf), "plugins");
if ( plugins_rc && plugins_rc[0] )
len = g_strv_length (plugins_rc);
@@ -548,7 +551,7 @@ parole_plugins_manager_load_plugins (ParolePluginsManager *manager)
TRACE ("Loading plugin :%s", module->name);
if ( !g_type_module_use (module) )
{
- parole_plugins_manager_save_rc (module->name, FALSE);
+ parole_plugins_manager_save_rc (manager, module->name, FALSE);
g_ptr_array_remove (manager->priv->array, module);
g_object_unref (module);
}
@@ -599,6 +602,8 @@ parole_plugins_manager_init (ParolePluginsManager *manager)
manager->priv->list_nt = GTK_WIDGET (gtk_builder_get_object (builder, "notebook-playlist"));
manager->priv->main_nt = GTK_WIDGET (gtk_builder_get_object (builder, "main-notebook"));
+ manager->priv->conf = parole_conf_new();
+
g_signal_connect (manager->priv->list_nt, "page-added",
G_CALLBACK (parole_plugins_manager_page_added_cb), NULL);
More information about the Xfce4-commits
mailing list