58
58
#include "rb-file-helpers.h"
59
59
#include "rb-playlist-xml.h"
60
60
#include "rb-source-search-basic.h"
61
#include "rb-source-toolbar.h"
62
63
static void rb_static_playlist_source_constructed (GObject *object);
63
64
static void rb_static_playlist_source_dispose (GObject *object);
78
79
static void impl_search (RBSource *asource, RBSourceSearch *search, const char *cur_text, const char *new_text);
79
80
static void impl_reset_filters (RBSource *asource);
80
81
static gboolean impl_receive_drag (RBDisplayPage *page, GtkSelectionData *data);
81
static GList *impl_get_search_actions (RBSource *source);
82
82
static guint impl_want_uri (RBSource *source, const char *uri);
84
84
static GPtrArray *construct_query_from_selection (RBStaticPlaylistSource *source);
121
121
static GtkRadioActionEntry rb_static_playlist_source_radio_actions [] =
123
{ "StaticPlaylistSearchAll", NULL, N_("All"), NULL, N_("Search all fields"), RHYTHMDB_PROP_SEARCH_MATCH },
124
{ "StaticPlaylistSearchArtists", NULL, N_("Artists"), NULL, N_("Search artists"), RHYTHMDB_PROP_ARTIST_FOLDED },
125
{ "StaticPlaylistSearchAlbums", NULL, N_("Albums"), NULL, N_("Search albums"), RHYTHMDB_PROP_ALBUM_FOLDED },
126
{ "StaticPlaylistSearchTitles", NULL, N_("Titles"), NULL, N_("Search titles"), RHYTHMDB_PROP_TITLE_FOLDED }
123
{ "StaticPlaylistSearchAll", NULL, N_("Search all fields"), NULL, NULL, RHYTHMDB_PROP_SEARCH_MATCH },
124
{ "StaticPlaylistSearchArtists", NULL, N_("Search artists"), NULL, NULL, RHYTHMDB_PROP_ARTIST_FOLDED },
125
{ "StaticPlaylistSearchAlbums", NULL, N_("Search albums"), NULL, NULL, RHYTHMDB_PROP_ALBUM_FOLDED },
126
{ "StaticPlaylistSearchTitles", NULL, N_("Search titles"), NULL, NULL, RHYTHMDB_PROP_TITLE_FOLDED }
143
143
RhythmDBQueryModel *base_model;
144
144
RhythmDBQueryModel *filter_model;
146
RBSourceToolbar *toolbar;
147
147
RBLibraryBrowser *browser;
148
gboolean browser_shown;
150
149
RBSourceSearch *default_search;
151
150
RhythmDBQuery *search_query;
180
179
source_class->impl_delete = impl_delete;
181
180
source_class->impl_search = impl_search;
182
181
source_class->impl_reset_filters = impl_reset_filters;
183
source_class->impl_can_browse = (RBSourceFeatureFunc) rb_true_function;
184
182
source_class->impl_get_property_views = impl_get_property_views;
185
source_class->impl_get_search_actions = impl_get_search_actions;
186
183
source_class->impl_want_uri = impl_want_uri;
188
185
playlist_class->impl_save_contents_to_xml = impl_save_contents_to_xml;
298
298
G_CALLBACK (rb_static_playlist_source_filter_entry_drop),
301
priv->paned = gtk_vpaned_new ();
301
paned = gtk_vpaned_new ();
302
gtk_widget_set_hexpand (paned, TRUE);
303
gtk_widget_set_vexpand (paned, TRUE);
303
305
g_object_get (source, "shell", &shell, NULL);
304
306
priv->action_group = _rb_display_page_register_action_group (RB_DISPLAY_PAGE (source),
320
322
priv->default_search = rb_source_search_basic_new (RHYTHMDB_PROP_SEARCH_MATCH);
324
g_object_get (shell, "ui-manager", &ui_manager, NULL);
322
325
g_object_unref (shell);
324
327
g_object_get (source, "entry-type", &entry_type, NULL);
328
331
g_object_unref (entry_type);
331
gtk_paned_pack1 (GTK_PANED (priv->paned), GTK_WIDGET (priv->browser), TRUE, FALSE);
334
gtk_paned_pack1 (GTK_PANED (paned), GTK_WIDGET (priv->browser), TRUE, FALSE);
332
335
g_signal_connect_object (priv->browser, "notify::output-model",
333
336
G_CALLBACK (rb_static_playlist_source_browser_changed_cb),
340
343
songs = rb_source_get_entry_view (RB_SOURCE (source));
341
344
g_object_ref (songs);
342
345
gtk_container_remove (GTK_CONTAINER (source), GTK_WIDGET (songs));
343
gtk_paned_pack2 (GTK_PANED (priv->paned), GTK_WIDGET (songs), TRUE, FALSE);
344
gtk_container_add (GTK_CONTAINER (source), priv->paned);
346
rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (songs), priv->paned, GTK_WIDGET (priv->browser));
346
gtk_paned_pack2 (GTK_PANED (paned), GTK_WIDGET (songs), TRUE, FALSE);
348
/* set up search box / toolbar */
349
priv->toolbar = rb_source_toolbar_new (RB_SOURCE (source), ui_manager);
350
rb_source_toolbar_add_search_entry (priv->toolbar, "/StaticPlaylistSourceSearchMenu", NULL);
351
g_object_unref (ui_manager);
353
/* put it all together */
354
grid = gtk_grid_new ();
355
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
356
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
357
gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (priv->toolbar), 0, 0, 1, 1);
358
gtk_grid_attach (GTK_GRID (grid), paned, 0, 1, 1, 1);
359
gtk_container_add (GTK_CONTAINER (source), grid);
361
rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (songs), paned, GTK_WIDGET (priv->browser));
347
362
g_object_unref (songs);
349
364
/* watch these to find out when things are dropped into the entry view */
396
411
"is-local", local,
397
412
"entry-type", entry_type,
398
"search-type", RB_SOURCE_SEARCH_INCREMENTAL,
413
"toolbar-path", "/StaticPlaylistSourceToolBar",
996
impl_get_search_actions (RBSource *source)
998
GList *actions = NULL;
1000
actions = g_list_prepend (actions, g_strdup ("StaticPlaylistSearchTitles"));
1001
actions = g_list_prepend (actions, g_strdup ("StaticPlaylistSearchAlbums"));
1002
actions = g_list_prepend (actions, g_strdup ("StaticPlaylistSearchArtists"));
1003
actions = g_list_prepend (actions, g_strdup ("StaticPlaylistSearchAll"));
1009
1013
impl_want_uri (RBSource *source, const char *uri)