~ubuntu-branches/ubuntu/quantal/rhythmbox/quantal-proposed

« back to all changes in this revision

Viewing changes to sources/rb-static-playlist-source.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Rico Tzschichholz
  • Date: 2011-12-05 19:31:23 UTC
  • mfrom: (1.1.60)
  • Revision ID: package-import@ubuntu.com-20111205193123-89047p8yplb0w1vx
Tags: 2.90.1~20111126.89c872b0-0ubuntu1
* Upload the new version to Ubuntu, should solve those issues:
  - the lack of rhythmbox-client command (lp: #875064)
  - the music sharing preferences dialog (lp: #894153)
  - several segfaults (lp: #859195, #814614)
* debian/control.in:
  - let the rhythmbox gir depends on gir1.2-peas-1.0 (lp: #874973)

[ Rico Tzschichholz ]
* New upstream git snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
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"
61
62
 
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);
83
83
 
84
84
static GPtrArray *construct_query_from_selection (RBStaticPlaylistSource *source);
120
120
 
121
121
static GtkRadioActionEntry rb_static_playlist_source_radio_actions [] =
122
122
{
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 }
127
127
};
128
128
 
129
129
enum
143
143
        RhythmDBQueryModel *base_model;
144
144
        RhythmDBQueryModel *filter_model;
145
145
 
146
 
        GtkWidget *paned;
 
146
        RBSourceToolbar *toolbar;
147
147
        RBLibraryBrowser *browser;
148
 
        gboolean browser_shown;
149
148
 
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;
187
184
 
188
185
        playlist_class->impl_save_contents_to_xml = impl_save_contents_to_xml;
283
280
        RBEntryView *songs;
284
281
        RBShell *shell;
285
282
        RhythmDBEntryType *entry_type;
 
283
        GtkUIManager *ui_manager;
 
284
        GtkWidget *grid;
 
285
        GtkWidget *paned;
286
286
 
287
287
        RB_CHAIN_GOBJECT_METHOD (rb_static_playlist_source_parent_class, constructed, object);
288
288
 
298
298
                                 G_CALLBACK (rb_static_playlist_source_filter_entry_drop),
299
299
                                 source, 0);
300
300
 
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);
302
304
 
303
305
        g_object_get (source, "shell", &shell, NULL);
304
306
        priv->action_group = _rb_display_page_register_action_group (RB_DISPLAY_PAGE (source),
319
321
        }
320
322
        priv->default_search = rb_source_search_basic_new (RHYTHMDB_PROP_SEARCH_MATCH);
321
323
 
 
324
        g_object_get (shell, "ui-manager", &ui_manager, NULL);
322
325
        g_object_unref (shell);
323
326
 
324
327
        g_object_get (source, "entry-type", &entry_type, NULL);
328
331
                g_object_unref (entry_type);
329
332
        }
330
333
 
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),
334
337
                                 source, 0);
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);
345
 
 
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);
 
347
 
 
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);
 
352
 
 
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);
 
360
 
 
361
        rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (songs), paned, GTK_WIDGET (priv->browser));
347
362
        g_object_unref (songs);
348
363
 
349
364
        /* watch these to find out when things are dropped into the entry view */
395
410
                                        "shell", shell,
396
411
                                        "is-local", local,
397
412
                                        "entry-type", entry_type,
398
 
                                        "search-type", RB_SOURCE_SEARCH_INCREMENTAL,
 
413
                                        "toolbar-path", "/StaticPlaylistSourceToolBar",
399
414
                                        NULL));
400
415
}
401
416
 
548
563
                priv->search_query = NULL;
549
564
        }
550
565
 
 
566
        rb_source_toolbar_clear_search_entry (priv->toolbar);
 
567
 
551
568
        if (changed) {
552
569
                rb_static_playlist_source_do_query (RB_STATIC_PLAYLIST_SOURCE (source));
553
570
                rb_source_notify_filter_changed (source);
992
1009
        return FALSE;
993
1010
}
994
1011
 
995
 
static GList *
996
 
impl_get_search_actions (RBSource *source)
997
 
{
998
 
        GList *actions = NULL;
999
 
 
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"));
1004
 
 
1005
 
        return actions;
1006
 
}
1007
 
 
1008
1012
static guint
1009
1013
impl_want_uri (RBSource *source, const char *uri)
1010
1014
{