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

« back to all changes in this revision

Viewing changes to sources/rb-auto-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:
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"
44
45
 
45
46
/**
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);
82
82
 
83
83
/* playlist methods */
84
84
static void impl_save_contents_to_xml (RBPlaylistSource *source,
100
100
 
101
101
static GtkRadioActionEntry rb_auto_playlist_source_radio_actions [] =
102
102
{
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 }
107
107
};
108
108
 
109
109
enum
130
130
 
131
131
        GtkWidget *paned;
132
132
        RBLibraryBrowser *browser;
 
133
        RBSourceToolbar *toolbar;
133
134
 
134
135
        RBSourceSearch *default_search;
135
136
        RhythmDBQuery *search_query;
161
162
 
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;
169
168
 
170
169
        playlist_class->impl_save_contents_to_xml = impl_save_contents_to_xml;
171
170
 
250
249
        RBAutoPlaylistSourcePrivate *priv;
251
250
        RBShell *shell;
252
251
        RhythmDBEntryType *entry_type;
 
252
        GtkUIManager *ui_manager;
 
253
        GtkWidget *grid;
253
254
 
254
255
        RB_CHAIN_GOBJECT_METHOD (rb_auto_playlist_source_parent_class, constructed, object);
255
256
 
291
292
        }
292
293
        priv->default_search = rb_source_search_basic_new (RHYTHMDB_PROP_SEARCH_MATCH);
293
294
 
 
295
 
 
296
        /* set up toolbar */
 
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);
 
300
 
 
301
        g_object_unref (ui_manager);
294
302
        g_object_unref (shell);
295
303
 
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);
 
308
 
 
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);
301
315
 
302
316
        rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (songs), priv->paned, GTK_WIDGET (priv->browser));
303
317
        g_object_unref (songs);
326
340
                                        "shell", shell,
327
341
                                        "is-local", local,
328
342
                                        "entry-type", RHYTHMDB_ENTRY_TYPE_SONG,
329
 
                                        "search-type", RB_SOURCE_SEARCH_INCREMENTAL,
 
343
                                        "toolbar-path", "/AutoPlaylistSourceToolBar",
330
344
                                        NULL));
331
345
}
332
346
 
497
511
                priv->search_query = NULL;
498
512
        }
499
513
 
 
514
        rb_source_toolbar_clear_search_entry (priv->toolbar);
 
515
 
500
516
        if (changed)
501
517
                rb_auto_playlist_source_do_query (RB_AUTO_PLAYLIST_SOURCE (source), FALSE);
502
518
}
914
930
        rb_source_notify_filter_changed (RB_SOURCE (source));
915
931
}
916
932
 
917
 
static GList *
918
 
impl_get_search_actions (RBSource *source)
919
 
{
920
 
        GList *actions = NULL;
921
 
 
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"));
926
 
 
927
 
        return actions;
928
 
}
929