41
41
#include "rb-stock-icons.h"
42
42
#include "rb-playlist-xml.h"
43
43
#include "rb-source-search-basic.h"
44
#include "rb-source-toolbar.h"
46
47
* SECTION:rb-auto-playlist-source
78
79
static gboolean impl_receive_drag (RBDisplayPage *page, GtkSelectionData *data);
79
80
static void impl_search (RBSource *source, RBSourceSearch *search, const char *cur_text, const char *new_text);
80
81
static void impl_reset_filters (RBSource *asource);
81
static GList *impl_get_search_actions (RBSource *source);
83
83
/* playlist methods */
84
84
static void impl_save_contents_to_xml (RBPlaylistSource *source,
101
101
static GtkRadioActionEntry rb_auto_playlist_source_radio_actions [] =
103
{ "AutoPlaylistSearchAll", NULL, N_("All"), NULL, N_("Search all fields"), RHYTHMDB_PROP_SEARCH_MATCH },
104
{ "AutoPlaylistSearchArtists", NULL, N_("Artists"), NULL, N_("Search artists"), RHYTHMDB_PROP_ARTIST_FOLDED },
105
{ "AutoPlaylistSearchAlbums", NULL, N_("Albums"), NULL, N_("Search albums"), RHYTHMDB_PROP_ALBUM_FOLDED },
106
{ "AutoPlaylistSearchTitles", NULL, N_("Titles"), NULL, N_("Search titles"), RHYTHMDB_PROP_TITLE_FOLDED }
103
{ "AutoPlaylistSearchAll", NULL, N_("Search all fields"), NULL, NULL, RHYTHMDB_PROP_SEARCH_MATCH },
104
{ "AutoPlaylistSearchArtists", NULL, N_("Search artists"), NULL, NULL, RHYTHMDB_PROP_ARTIST_FOLDED },
105
{ "AutoPlaylistSearchAlbums", NULL, N_("Search albums"), NULL, NULL, RHYTHMDB_PROP_ALBUM_FOLDED },
106
{ "AutoPlaylistSearchTitles", NULL, N_("Search titles"), NULL, NULL, RHYTHMDB_PROP_TITLE_FOLDED }
162
163
source_class->impl_can_cut = (RBSourceFeatureFunc) rb_false_function;
163
164
source_class->impl_can_delete = (RBSourceFeatureFunc) rb_false_function;
164
source_class->impl_can_browse = (RBSourceFeatureFunc) rb_true_function;
165
165
source_class->impl_search = impl_search;
166
166
source_class->impl_reset_filters = impl_reset_filters;
167
167
source_class->impl_get_property_views = impl_get_property_views;
168
source_class->impl_get_search_actions = impl_get_search_actions;
170
169
playlist_class->impl_save_contents_to_xml = impl_save_contents_to_xml;
250
249
RBAutoPlaylistSourcePrivate *priv;
252
251
RhythmDBEntryType *entry_type;
252
GtkUIManager *ui_manager;
254
255
RB_CHAIN_GOBJECT_METHOD (rb_auto_playlist_source_parent_class, constructed, object);
292
293
priv->default_search = rb_source_search_basic_new (RHYTHMDB_PROP_SEARCH_MATCH);
297
g_object_get (shell, "ui-manager", &ui_manager, NULL);
298
priv->toolbar = rb_source_toolbar_new (RB_SOURCE (source), ui_manager);
299
rb_source_toolbar_add_search_entry (priv->toolbar, "/AutoPlaylistSourceSearchMenu", NULL);
301
g_object_unref (ui_manager);
294
302
g_object_unref (shell);
296
304
/* reparent the entry view */
297
305
g_object_ref (songs);
298
306
gtk_container_remove (GTK_CONTAINER (source), GTK_WIDGET (songs));
299
307
gtk_paned_pack2 (GTK_PANED (priv->paned), GTK_WIDGET (songs), TRUE, FALSE);
300
gtk_container_add (GTK_CONTAINER (source), priv->paned);
309
grid = gtk_grid_new ();
310
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
311
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
312
gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (priv->toolbar), 0, 0, 1, 1);
313
gtk_grid_attach (GTK_GRID (grid), priv->paned, 0, 1, 1, 1);
314
gtk_container_add (GTK_CONTAINER (source), grid);
302
316
rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (songs), priv->paned, GTK_WIDGET (priv->browser));
303
317
g_object_unref (songs);
327
341
"is-local", local,
328
342
"entry-type", RHYTHMDB_ENTRY_TYPE_SONG,
329
"search-type", RB_SOURCE_SEARCH_INCREMENTAL,
343
"toolbar-path", "/AutoPlaylistSourceToolBar",
914
930
rb_source_notify_filter_changed (RB_SOURCE (source));
918
impl_get_search_actions (RBSource *source)
920
GList *actions = NULL;
922
actions = g_list_prepend (actions, g_strdup ("AutoPlaylistSearchTitles"));
923
actions = g_list_prepend (actions, g_strdup ("AutoPlaylistSearchAlbums"));
924
actions = g_list_prepend (actions, g_strdup ("AutoPlaylistSearchArtists"));
925
actions = g_list_prepend (actions, g_strdup ("AutoPlaylistSearchAll"));