[rhythmbox] media-player: add encoding-settings property



commit e05c88a77f5d6efbd74fa0e181f24e4ab2b6b387
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed Jul 29 21:34:02 2015 +1000

    media-player: add encoding-settings property
    
    This holds the settings that will be used when transferring to the device.
    Currently these are stored with the plugin settings, so one configuration
    applies to all devices of the same type, but ultimately they should be
    stored per-device.

 data/org.gnome.rhythmbox.gschema.xml              |    3 ++
 plugins/generic-player/rb-generic-player-plugin.c |    1 +
 plugins/ipod/rb-ipod-source.c                     |    1 +
 plugins/mtpdevice/rb-mtp-source.c                 |    1 +
 sources/rb-media-player-source.c                  |   25 ++++++++++++++++++++-
 5 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/data/org.gnome.rhythmbox.gschema.xml b/data/org.gnome.rhythmbox.gschema.xml
index d2a6d10..3dc678c 100644
--- a/data/org.gnome.rhythmbox.gschema.xml
+++ b/data/org.gnome.rhythmbox.gschema.xml
@@ -308,10 +308,12 @@
 
   <schema id="org.gnome.rhythmbox.plugins.generic-player" 
path="/org/gnome/rhythmbox/plugins/generic-player/">
     <child name='source' schema='org.gnome.rhythmbox.source'/>
+    <child name="encoding" schema="org.gnome.rhythmbox.encoding-settings"/>
   </schema>
 
   <schema id="org.gnome.rhythmbox.plugins.ipod" path="/org/gnome/rhythmbox/plugins/ipod/">
     <child name="source" schema="org.gnome.rhythmbox.source"/>
+    <child name="encoding" schema="org.gnome.rhythmbox.encoding-settings"/>
   </schema>
 
   <schema id="org.gnome.rhythmbox.plugins.iradio.source" extends="org.gnome.rhythmbox.source">
@@ -375,6 +377,7 @@
 
   <schema id="org.gnome.rhythmbox.plugins.mtpdevice" path="/org/gnome/rhythmbox/plugins/mtpdevice/">
     <child name="source" schema="org.gnome.rhythmbox.source"/>
+    <child name="encoding" schema="org.gnome.rhythmbox.encoding-settings"/>
   </schema>
 
   <enum id="org.gnome.rhythmbox.plugins.replaygain.mode">
diff --git a/plugins/generic-player/rb-generic-player-plugin.c 
b/plugins/generic-player/rb-generic-player-plugin.c
index 855361e..d479609 100644
--- a/plugins/generic-player/rb-generic-player-plugin.c
+++ b/plugins/generic-player/rb-generic-player-plugin.c
@@ -176,6 +176,7 @@ create_source_cb (RBRemovableMediaManager *rmm, GMount *mount, MPIDDevice *devic
                                          "device-info", device_info,
                                          "load-status", RB_SOURCE_LOAD_STATUS_LOADING,
                                          "settings", g_settings_get_child (settings, "source"),
+                                         "encoding-settings", g_settings_get_child (settings, "encoding"),
                                          "toolbar-menu", toolbar,
                                          NULL));
 
diff --git a/plugins/ipod/rb-ipod-source.c b/plugins/ipod/rb-ipod-source.c
index 21059ec..a8a1a4a 100644
--- a/plugins/ipod/rb-ipod-source.c
+++ b/plugins/ipod/rb-ipod-source.c
@@ -636,6 +636,7 @@ rb_ipod_source_new (GObject *plugin,
                                               "device-info", device_info,
                                               "load-status", RB_SOURCE_LOAD_STATUS_LOADING,
                                               "settings", g_settings_get_child (settings, "source"),
+                                              "encoding-settings", g_settings_get_child (settings, 
"encoding"),
                                               "toolbar-menu", toolbar,
                                               NULL));
        g_object_unref (settings);
diff --git a/plugins/mtpdevice/rb-mtp-source.c b/plugins/mtpdevice/rb-mtp-source.c
index b10844a..119b729 100644
--- a/plugins/mtpdevice/rb-mtp-source.c
+++ b/plugins/mtpdevice/rb-mtp-source.c
@@ -599,6 +599,7 @@ rb_mtp_source_new (RBShell *shell,
 #endif
                                              "load-status", RB_SOURCE_LOAD_STATUS_LOADING,
                                              "settings", g_settings_get_child (settings, "source"),
+                                             "encoding-settings", g_settings_get_child (settings, 
"encoding"),
                                              "toolbar-menu", toolbar,
                                              "name", _("Media Player"),
                                              NULL));
diff --git a/sources/rb-media-player-source.c b/sources/rb-media-player-source.c
index 8eb3160..9affb61 100644
--- a/sources/rb-media-player-source.c
+++ b/sources/rb-media-player-source.c
@@ -68,6 +68,7 @@ typedef struct {
        gboolean syncing;
 
        GstEncodingTarget *encoding_target;
+       GSettings *encoding_settings;
 } RBMediaPlayerSourcePrivate;
 
 G_DEFINE_TYPE (RBMediaPlayerSource, rb_media_player_source, RB_TYPE_BROWSER_SOURCE);
@@ -101,7 +102,8 @@ enum
 {
        PROP_0,
        PROP_DEVICE_SERIAL,
-       PROP_ENCODING_TARGET
+       PROP_ENCODING_TARGET,
+       PROP_ENCODING_SETTINGS
 };
 
 static void
@@ -155,6 +157,18 @@ rb_media_player_source_class_init (RBMediaPlayerSourceClass *klass)
                                                              "GstEncodingTarget",
                                                              GST_TYPE_ENCODING_TARGET,
                                                              G_PARAM_READWRITE));
+       /**
+        * RBMediaPlayerSource:encoding-settings
+        *
+        * The #GSettings instance holding encoding settings for this device
+        */
+       g_object_class_install_property (object_class,
+                                        PROP_ENCODING_SETTINGS,
+                                        g_param_spec_object ("encoding-settings",
+                                                             "encoding settings",
+                                                             "GSettings holding encoding settings",
+                                                             G_TYPE_SETTINGS,
+                                                             G_PARAM_READWRITE));
 
        g_type_class_add_private (klass, sizeof (RBMediaPlayerSourcePrivate));
 }
@@ -201,6 +215,12 @@ rb_media_player_source_set_property (GObject *object,
                }
                priv->encoding_target = GST_ENCODING_TARGET (g_value_dup_object (value));
                break;
+       case PROP_ENCODING_SETTINGS:
+               if (priv->encoding_settings) {
+                       g_object_unref (priv->encoding_settings);
+               }
+               priv->encoding_settings = g_value_dup_object (value);
+               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                break;
@@ -221,6 +241,9 @@ rb_media_player_source_get_property (GObject *object,
        case PROP_ENCODING_TARGET:
                g_value_set_object (value, priv->encoding_target);
                break;
+       case PROP_ENCODING_SETTINGS:
+               g_value_set_object (value, priv->encoding_settings);
+               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]