[rhythmbox] convert rb_source_reset_filters into an action signal



commit e04bf37bf9a2d8e7eab9a0c3b3a3f669ecb13a33
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sun Mar 3 23:18:00 2013 +1000

    convert rb_source_reset_filters into an action signal

 plugins/iradio/rb-iradio-source.c   |    2 +-
 podcast/rb-podcast-source.c         |    7 ++++---
 sources/rb-auto-playlist-source.c   |    2 +-
 sources/rb-browser-source.c         |    2 +-
 sources/rb-source.c                 |   32 +++++++++++++++++---------------
 sources/rb-source.h                 |    4 +---
 sources/rb-static-playlist-source.c |    2 +-
 widgets/rb-source-toolbar.c         |    2 +-
 8 files changed, 27 insertions(+), 26 deletions(-)
---
diff --git a/plugins/iradio/rb-iradio-source.c b/plugins/iradio/rb-iradio-source.c
index 48ffaff..da2de04 100644
--- a/plugins/iradio/rb-iradio-source.c
+++ b/plugins/iradio/rb-iradio-source.c
@@ -196,6 +196,7 @@ rb_iradio_source_class_init (RBIRadioSourceClass *klass)
 
        page_class->get_status  = impl_get_status;
 
+       source_class->reset_filters = impl_reset_filters;
        source_class->impl_can_copy = (RBSourceFeatureFunc) rb_false_function;
        source_class->impl_can_delete = (RBSourceFeatureFunc) rb_true_function;
        source_class->impl_can_pause = (RBSourceFeatureFunc) rb_false_function;
@@ -205,7 +206,6 @@ rb_iradio_source_class_init (RBIRadioSourceClass *klass)
        source_class->impl_song_properties = impl_song_properties;
        source_class->impl_want_uri = impl_want_uri;
        source_class->impl_add_uri = impl_add_uri;
-       source_class->impl_reset_filters = impl_reset_filters;
 
        g_object_class_override_property (object_class,
                                          PROP_SHOW_BROWSER,
diff --git a/podcast/rb-podcast-source.c b/podcast/rb-podcast-source.c
index c599a57..b178b21 100644
--- a/podcast/rb-podcast-source.c
+++ b/podcast/rb-podcast-source.c
@@ -329,7 +329,6 @@ feed_select_change_cb (RBPropertyView *propview,
        rb_source_notify_filter_changed (RB_SOURCE (source));
 }
 
-
 static void
 posts_view_drag_data_received_cb (GtkWidget *widget,
                                  GdkDragContext *dc,
@@ -1246,13 +1245,15 @@ static void
 impl_reset_filters (RBSource *asource)
 {
        RBPodcastSource *source = RB_PODCAST_SOURCE (asource);
+
        if (source->priv->search_query != NULL) {
                rhythmdb_query_free (source->priv->search_query);
                source->priv->search_query = NULL;
        }
        rb_source_toolbar_clear_search_entry (source->priv->toolbar);
-
+       
        rb_property_view_set_selection (source->priv->feeds, NULL);
+       rb_podcast_source_do_query (source, TRUE);
 }
 
 static void
@@ -1717,6 +1718,7 @@ rb_podcast_source_class_init (RBPodcastSourceClass *klass)
        page_class->get_status = impl_get_status;
        page_class->receive_drag = impl_receive_drag;
 
+       source_class->reset_filters = impl_reset_filters;
        source_class->impl_add_to_queue = impl_add_to_queue;
        source_class->impl_can_add_to_queue = impl_can_add_to_queue;
        source_class->impl_can_copy = (RBSourceFeatureFunc) rb_false_function;
@@ -1728,7 +1730,6 @@ rb_podcast_source_class_init (RBPodcastSourceClass *klass)
        source_class->impl_search = impl_search;
        source_class->impl_song_properties = impl_song_properties;
        source_class->impl_get_delete_label = impl_get_delete_label;
-       source_class->impl_reset_filters = impl_reset_filters;
 
        g_object_class_install_property (object_class,
                                         PROP_PODCAST_MANAGER,
diff --git a/sources/rb-auto-playlist-source.c b/sources/rb-auto-playlist-source.c
index 47f930b..8be963e 100644
--- a/sources/rb-auto-playlist-source.c
+++ b/sources/rb-auto-playlist-source.c
@@ -150,10 +150,10 @@ rb_auto_playlist_source_class_init (RBAutoPlaylistSourceClass *klass)
 
        page_class->receive_drag = impl_receive_drag;
 
+       source_class->reset_filters = impl_reset_filters;
        source_class->impl_can_cut = (RBSourceFeatureFunc) rb_false_function;
        source_class->impl_can_delete = (RBSourceFeatureFunc) rb_false_function;
        source_class->impl_search = impl_search;
-       source_class->impl_reset_filters = impl_reset_filters;
        source_class->impl_get_property_views = impl_get_property_views;
 
        playlist_class->impl_save_contents_to_xml = impl_save_contents_to_xml;
diff --git a/sources/rb-browser-source.c b/sources/rb-browser-source.c
index 225021e..eed4ac6 100644
--- a/sources/rb-browser-source.c
+++ b/sources/rb-browser-source.c
@@ -160,10 +160,10 @@ rb_browser_source_class_init (RBBrowserSourceClass *klass)
        object_class->set_property = rb_browser_source_set_property;
        object_class->get_property = rb_browser_source_get_property;
 
+       source_class->reset_filters = impl_reset_filters;
        source_class->impl_search = impl_search;
        source_class->impl_get_entry_view = impl_get_entry_view;
        source_class->impl_get_property_views = impl_get_property_views;
-       source_class->impl_reset_filters = impl_reset_filters;
        source_class->impl_song_properties = impl_song_properties;
        source_class->impl_can_cut = (RBSourceFeatureFunc) rb_false_function;
        source_class->impl_can_copy = (RBSourceFeatureFunc) rb_true_function;
diff --git a/sources/rb-source.c b/sources/rb-source.c
index 2ce6c21..a75cc87 100644
--- a/sources/rb-source.c
+++ b/sources/rb-source.c
@@ -134,6 +134,7 @@ enum
 enum
 {
        FILTER_CHANGED,
+       RESET_FILTERS,
        LAST_SIGNAL
 };
 
@@ -153,6 +154,7 @@ rb_source_class_init (RBSourceClass *klass)
        page_class->activate = default_activate;
        page_class->get_status = default_get_status;
 
+       klass->reset_filters = default_reset_filters;
        klass->impl_get_property_views = default_get_property_views;
        klass->impl_can_rename = default_can_rename;
        klass->impl_can_cut = (RBSourceFeatureFunc) rb_false_function;
@@ -164,7 +166,6 @@ rb_source_class_init (RBSourceClass *klass)
        klass->impl_can_pause = (RBSourceFeatureFunc) rb_true_function;
        klass->impl_get_entry_view = default_get_entry_view;
        klass->impl_copy = default_copy;
-       klass->impl_reset_filters = default_reset_filters;
        klass->impl_handle_eos = default_handle_eos;
        klass->impl_try_playlist = default_try_playlist;
        klass->impl_add_to_queue = default_add_to_queue;
@@ -326,6 +327,21 @@ rb_source_class_init (RBSourceClass *klass)
                              g_cclosure_marshal_VOID__VOID,
                              G_TYPE_NONE,
                              0);
+       /**
+        * RBSource::reset-filters:
+        * @source: the #RBSource
+        *
+        * Action signal used to reset the source's filters.
+        */
+       rb_source_signals[RESET_FILTERS] =
+               g_signal_new ("reset-filters",
+                             RB_TYPE_SOURCE,
+                             G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                             G_STRUCT_OFFSET (RBSourceClass, reset_filters),
+                             NULL, NULL,
+                             g_cclosure_marshal_VOID__VOID,
+                             G_TYPE_NONE,
+                             0);
 
        g_type_class_add_private (object_class, sizeof (RBSourcePrivate));
 }
@@ -1012,20 +1028,6 @@ default_reset_filters (RBSource *source)
 }
 
 /**
- * rb_source_reset_filters:
- * @source: a #RBSource
- *
- * Clears all filters (browser selections, etc.) in this source.
- */
-void
-rb_source_reset_filters (RBSource *source)
-{
-       RBSourceClass *klass = RB_SOURCE_GET_CLASS (source);
-
-       klass->impl_reset_filters (source);
-}
-
-/**
  * rb_source_can_show_properties:
  * @source: a #RBSource
  *
diff --git a/sources/rb-source.h b/sources/rb-source.h
index fd9bb08..cbae67a 100644
--- a/sources/rb-source.h
+++ b/sources/rb-source.h
@@ -90,6 +90,7 @@ struct _RBSourceClass
 
        /* signals */
        void (*filter_changed)  (RBSource *source);
+       void (*reset_filters)   (RBSource *source);
 
        /* methods */
 
@@ -99,7 +100,6 @@ struct _RBSourceClass
        gboolean        (*impl_can_rename)      (RBSource *source);
 
        void            (*impl_search)          (RBSource *source, RBSourceSearch *search, const char 
*cur_text, const char *new_text);
-       void            (*impl_reset_filters)   (RBSource *source);
 
        gboolean        (*impl_can_cut)         (RBSource *source);
        gboolean        (*impl_can_delete)      (RBSource *source);
@@ -154,8 +154,6 @@ void                rb_source_search                (RBSource *source,
                                                 const char *cur_text,
                                                 const char *new_text);
 
-void           rb_source_reset_filters         (RBSource *source);
-
 gboolean       rb_source_can_cut               (RBSource *source);
 gboolean       rb_source_can_delete            (RBSource *source);
 gboolean       rb_source_can_move_to_trash     (RBSource *source);
diff --git a/sources/rb-static-playlist-source.c b/sources/rb-static-playlist-source.c
index 304db81..135862e 100644
--- a/sources/rb-static-playlist-source.c
+++ b/sources/rb-static-playlist-source.c
@@ -165,6 +165,7 @@ rb_static_playlist_source_class_init (RBStaticPlaylistSourceClass *klass)
 
        page_class->receive_drag = impl_receive_drag;
 
+       source_class->reset_filters = impl_reset_filters;
        source_class->impl_can_cut = (RBSourceFeatureFunc) rb_true_function;
        source_class->impl_can_paste = (RBSourceFeatureFunc) rb_true_function;
        source_class->impl_can_delete = (RBSourceFeatureFunc) rb_true_function;
@@ -172,7 +173,6 @@ rb_static_playlist_source_class_init (RBStaticPlaylistSourceClass *klass)
        source_class->impl_paste = impl_paste;
        source_class->impl_delete = impl_delete;
        source_class->impl_search = impl_search;
-       source_class->impl_reset_filters = impl_reset_filters;
        source_class->impl_get_property_views = impl_get_property_views;
        source_class->impl_want_uri = impl_want_uri;
 
diff --git a/widgets/rb-source-toolbar.c b/widgets/rb-source-toolbar.c
index fd4e5b1..df0ff90 100644
--- a/widgets/rb-source-toolbar.c
+++ b/widgets/rb-source-toolbar.c
@@ -374,7 +374,7 @@ rb_source_toolbar_add_search_entry (RBSourceToolbar *toolbar, const char *placeh
  * rb_source_toolbar_clear_search_entry:
  * @toolbar: a #RBSourceToolbar
  *
- * Clears the search entry text.  Call this from RBSource:impl_reset_filters.
+ * Clears the search entry text.  Call this from RBSource:reset_filters.
  */
 void
 rb_source_toolbar_clear_search_entry (RBSourceToolbar *toolbar)


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