[rhythmbox] source: make binding sort order to settings optional



commit 754b152ffc8e210b1e5b3e0dba4824f284c56090
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Oct 1 09:24:49 2013 +1000

    source: make binding sort order to settings optional
    
    Binding the sort order for static playlists turns out to be a
    terrible idea, since it means they get the default sort order
    and there's no way to change it.  Oops.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709143

 plugins/audiocd/rb-audiocd-source.c                |    2 +-
 .../rb-audioscrobbler-radio-source.c               |    2 +-
 plugins/grilo/rb-grilo-source.c                    |    2 +-
 plugins/iradio/rb-iradio-source.c                  |    3 ++-
 podcast/rb-podcast-source.c                        |    3 ++-
 sources/rb-auto-playlist-source.c                  |    2 +-
 sources/rb-browser-source.c                        |    3 ++-
 sources/rb-source.c                                |    7 ++++---
 sources/rb-source.h                                |    3 ++-
 sources/rb-static-playlist-source.c                |    2 +-
 10 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/plugins/audiocd/rb-audiocd-source.c b/plugins/audiocd/rb-audiocd-source.c
index d8def59..32c1016 100644
--- a/plugins/audiocd/rb-audiocd-source.c
+++ b/plugins/audiocd/rb-audiocd-source.c
@@ -415,7 +415,7 @@ rb_audiocd_source_constructed (GObject *object)
        gtk_widget_set_margin_top (GTK_WIDGET (grid), 6);
        g_object_unref (builder);
 
-       rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (source->priv->entry_view), NULL, NULL);
+       rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (source->priv->entry_view), NULL, NULL, 
FALSE);
 
        gtk_widget_show_all (grid);
        gtk_container_add (GTK_CONTAINER (source), grid);
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c 
b/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c
index 346e963..54ad2b1 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-radio-source.c
@@ -428,7 +428,7 @@ rb_audioscrobbler_radio_source_constructed (GObject *object)
 
        gtk_box_pack_start (GTK_BOX (main_vbox), GTK_WIDGET (source->priv->track_view), TRUE, TRUE, 0);
 
-       rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (source->priv->track_view), NULL, NULL);
+       rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (source->priv->track_view), NULL, NULL, TRUE);
 
        /* query model */
        source->priv->track_model = rhythmdb_query_model_new_empty (db);
diff --git a/plugins/grilo/rb-grilo-source.c b/plugins/grilo/rb-grilo-source.c
index 404fc7b..b475303 100644
--- a/plugins/grilo/rb-grilo-source.c
+++ b/plugins/grilo/rb-grilo-source.c
@@ -391,7 +391,7 @@ rb_grilo_source_constructed (GObject *object)
 
        /* don't allow the browser to be hidden? */
        source->priv->paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
-       rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (source->priv->entry_view), 
source->priv->paned, NULL);
+       rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (source->priv->entry_view), 
source->priv->paned, NULL, TRUE);
        gtk_paned_pack1 (GTK_PANED (source->priv->paned), browserbox, FALSE, FALSE);
 
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
diff --git a/plugins/iradio/rb-iradio-source.c b/plugins/iradio/rb-iradio-source.c
index 90886e5..4a9f997 100644
--- a/plugins/iradio/rb-iradio-source.c
+++ b/plugins/iradio/rb-iradio-source.c
@@ -377,7 +377,8 @@ rb_iradio_source_constructed (GObject *object)
        rb_source_bind_settings (RB_SOURCE (source),
                                 GTK_WIDGET (source->priv->stations),
                                 paned,
-                                GTK_WIDGET (source->priv->genres));
+                                GTK_WIDGET (source->priv->genres),
+                                TRUE);
 
        gtk_widget_show_all (GTK_WIDGET (source));
 
diff --git a/podcast/rb-podcast-source.c b/podcast/rb-podcast-source.c
index a21a4a9..73c7c20 100644
--- a/podcast/rb-podcast-source.c
+++ b/podcast/rb-podcast-source.c
@@ -1615,7 +1615,8 @@ impl_constructed (GObject *object)
        rb_source_bind_settings (RB_SOURCE (source),
                                 GTK_WIDGET (source->priv->posts),
                                 source->priv->paned,
-                                GTK_WIDGET (source->priv->feeds));
+                                GTK_WIDGET (source->priv->feeds),
+                                TRUE);
 
        g_object_unref (settings);
        g_object_unref (accel_group);
diff --git a/sources/rb-auto-playlist-source.c b/sources/rb-auto-playlist-source.c
index e075cc4..cc7d638 100644
--- a/sources/rb-auto-playlist-source.c
+++ b/sources/rb-auto-playlist-source.c
@@ -280,7 +280,7 @@ rb_auto_playlist_source_constructed (GObject *object)
        gtk_grid_attach (GTK_GRID (grid), priv->paned, 0, 1, 1, 1);
        gtk_container_add (GTK_CONTAINER (source), grid);
 
-       rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (songs), priv->paned, GTK_WIDGET 
(priv->browser));
+       rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (songs), priv->paned, GTK_WIDGET 
(priv->browser), TRUE);
        g_object_unref (songs);
 
        g_object_set (source,
diff --git a/sources/rb-browser-source.c b/sources/rb-browser-source.c
index bcff8f8..39514b7 100644
--- a/sources/rb-browser-source.c
+++ b/sources/rb-browser-source.c
@@ -370,7 +370,8 @@ rb_browser_source_constructed (GObject *object)
        rb_source_bind_settings (RB_SOURCE (source),
                                 GTK_WIDGET (source->priv->songs),
                                 paned,
-                                GTK_WIDGET (source->priv->browser));
+                                GTK_WIDGET (source->priv->browser),
+                                TRUE);
 
        if (rb_browser_source_has_drop_support (source)) {
                gtk_drag_dest_set (GTK_WIDGET (source->priv->songs),
diff --git a/sources/rb-source.c b/sources/rb-source.c
index a9500bb..3752cca 100644
--- a/sources/rb-source.c
+++ b/sources/rb-source.c
@@ -1404,6 +1404,7 @@ paned_position_changed_cb (GObject *paned, GParamSpec *pspec, GSettings *setting
  * @entry_view: (allow-none): the #RBEntryView for the source
  * @paned: (allow-none): the #GtkPaned containing the entry view and the browser
  * @browser: (allow-none):  the browser (typically a #RBLibraryBrowser) for the source
+ * @sort_order: whether to bind the entry view sort order
  *
  * Binds the source's #GSettings instance to the given widgets.  Should be called
  * from the source's constructed method.
@@ -1412,7 +1413,7 @@ paned_position_changed_cb (GObject *paned, GParamSpec *pspec, GSettings *setting
  * browser-views settings key.
  */
 void
-rb_source_bind_settings (RBSource *source, GtkWidget *entry_view, GtkWidget *paned, GtkWidget *browser)
+rb_source_bind_settings (RBSource *source, GtkWidget *entry_view, GtkWidget *paned, GtkWidget *browser, 
gboolean sort_order)
 {
        char *name;
        GSettings *common_settings;
@@ -1421,8 +1422,8 @@ rb_source_bind_settings (RBSource *source, GtkWidget *entry_view, GtkWidget *pan
        g_object_get (source, "name", &name, NULL);
 
        if (entry_view != NULL) {
-               rb_debug ("binding entry view sort order for %s", name);
-               if (source->priv->settings) {
+               if (sort_order && source->priv->settings) {
+                       rb_debug ("binding entry view sort order for %s", name);
                        g_settings_bind_with_mapping (source->priv->settings, "sorting", entry_view, 
"sort-order",
                                                      G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET | 
G_SETTINGS_BIND_NO_SENSITIVITY,
                                                      (GSettingsBindGetMapping) sort_order_get_mapping,
diff --git a/sources/rb-source.h b/sources/rb-source.h
index 30ff1f3..3e3d99c 100644
--- a/sources/rb-source.h
+++ b/sources/rb-source.h
@@ -201,7 +201,8 @@ gboolean    _rb_source_check_entry_type     (RBSource *source,
 void           rb_source_bind_settings         (RBSource *source,
                                                 GtkWidget *entry_view,
                                                 GtkWidget *paned,
-                                                GtkWidget *browser);
+                                                GtkWidget *browser,
+                                                gboolean sort_order);
 void           rb_source_notify_playback_status_changed (RBSource *source);
 
 G_END_DECLS
diff --git a/sources/rb-static-playlist-source.c b/sources/rb-static-playlist-source.c
index eef4a2e..b50258e 100644
--- a/sources/rb-static-playlist-source.c
+++ b/sources/rb-static-playlist-source.c
@@ -318,7 +318,7 @@ rb_static_playlist_source_constructed (GObject *object)
        gtk_grid_attach (GTK_GRID (grid), paned, 0, 1, 1, 1);
        gtk_container_add (GTK_CONTAINER (source), grid);
 
-       rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (songs), paned, GTK_WIDGET (priv->browser));
+       rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (songs), paned, GTK_WIDGET (priv->browser), 
FALSE);
        g_object_unref (songs);
 
        /* set up playlist menu */


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