~ubuntu-branches/ubuntu/natty/rhythmbox/natty

« back to all changes in this revision

Viewing changes to sources/rb-library-source.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-01-20 18:41:16 UTC
  • mfrom: (1.1.56 upstream)
  • Revision ID: james.westby@ubuntu.com-20110120184116-gs8yr7px9cf2bfql
Tags: 0.13.3-0ubuntu1
* New upstream version
* debian/patches/01_dlna_vorbis.patch:
  - dropped, the fix is in the new version
* debian/patches/16_ubuntu_ayatana_register.patch,
  debian/rules:
  - dropped, the sound indicator registration relies only on mpris now
* debian/control.in,
  debian/patches/19_build_vala.patch,
  debian/rules:
  - drop vala build, it's not really useful and still on vala 0.10
* debian/patches/21_update_louie_imports.patch:
  - dropped, the fix is in the new version
* Updated the .installs

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
#include "rb-auto-playlist-source.h"
69
69
#include "rb-encoder.h"
70
70
#include "rb-missing-plugins.h"
 
71
#include "gseal-gtk-compat.h"
71
72
 
72
73
static void rb_library_source_class_init (RBLibrarySourceClass *klass);
73
74
static void rb_library_source_init (RBLibrarySource *source);
75
76
static void rb_library_source_dispose (GObject *object);
76
77
static void rb_library_source_finalize (GObject *object);
77
78
 
78
 
/* RBSource implementations */
79
 
static gboolean impl_show_popup (RBSource *source);
80
 
static GtkWidget *impl_get_config_widget (RBSource *source, RBShellPreferences *prefs);
 
79
static gboolean impl_show_popup (RBDisplayPage *source);
 
80
static GtkWidget *impl_get_config_widget (RBDisplayPage *source, RBShellPreferences *prefs);
 
81
static gboolean impl_receive_drag (RBDisplayPage *source, GtkSelectionData *data);
 
82
static void impl_get_status (RBDisplayPage *source, char **text, char **progress_text, float *progress);
 
83
 
81
84
static char *impl_get_browser_key (RBSource *source);
82
85
static char *impl_get_paned_key (RBBrowserSource *source);
83
 
static gboolean impl_receive_drag (RBSource *source, GtkSelectionData *data);
84
86
static gboolean impl_can_paste (RBSource *asource);
85
87
static RBTrackTransferBatch *impl_paste (RBSource *source, GList *entries);
86
88
static guint impl_want_uri (RBSource *source, const char *uri);
91
93
                          RBSourceAddCallback callback,
92
94
                          gpointer data,
93
95
                          GDestroyNotify destroy_data);
94
 
static void impl_get_status (RBSource *source, char **text, char **progress_text, float *progress);
95
96
 
96
97
static void rb_library_source_ui_prefs_sync (RBLibrarySource *source);
97
98
static void rb_library_source_preferences_sync (RBLibrarySource *source);
193
194
rb_library_source_class_init (RBLibrarySourceClass *klass)
194
195
{
195
196
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
197
        RBDisplayPageClass *page_class = RB_DISPLAY_PAGE_CLASS (klass);
196
198
        RBSourceClass *source_class = RB_SOURCE_CLASS (klass);
197
199
        RBBrowserSourceClass *browser_source_class = RB_BROWSER_SOURCE_CLASS (klass);
198
200
 
200
202
        object_class->finalize = rb_library_source_finalize;
201
203
        object_class->constructed = rb_library_source_constructed;
202
204
 
203
 
        source_class->impl_show_popup = impl_show_popup;
204
 
        source_class->impl_get_config_widget = impl_get_config_widget;
 
205
        page_class->show_popup = impl_show_popup;
 
206
        page_class->get_config_widget = impl_get_config_widget;
 
207
        page_class->receive_drag = impl_receive_drag;
 
208
        page_class->get_status = impl_get_status;
 
209
 
205
210
        source_class->impl_get_browser_key = impl_get_browser_key;
206
 
        source_class->impl_receive_drag = impl_receive_drag;
207
211
        source_class->impl_can_copy = (RBSourceFeatureFunc) rb_true_function;
208
212
        source_class->impl_can_paste = (RBSourceFeatureFunc) impl_can_paste;
209
213
        source_class->impl_paste = impl_paste;
210
214
        source_class->impl_want_uri = impl_want_uri;
211
215
        source_class->impl_add_uri = impl_add_uri;
212
 
        source_class->impl_get_status = impl_get_status;
213
216
 
214
217
        browser_source_class->impl_get_paned_key = impl_get_paned_key;
215
218
        browser_source_class->impl_has_drop_support = (RBBrowserSourceFeatureFunc) rb_true_function;
408
411
        source = RB_SOURCE (g_object_new (RB_TYPE_LIBRARY_SOURCE,
409
412
                                          "name", _("Music"),
410
413
                                          "entry-type", RHYTHMDB_ENTRY_TYPE_SONG,
411
 
                                          "source-group", RB_SOURCE_GROUP_LIBRARY,
412
414
                                          "sorting-key", CONF_STATE_LIBRARY_SORTING,
413
415
                                          "shell", shell,
414
 
                                          "icon", icon,
 
416
                                          "pixbuf", icon,
415
417
                                          "populate", FALSE,            /* wait until the database is loaded */
416
418
                                          NULL));
417
419
        if (icon != NULL) {
463
465
}
464
466
 
465
467
static GtkWidget *
466
 
impl_get_config_widget (RBSource *asource, RBShellPreferences *prefs)
 
468
impl_get_config_widget (RBDisplayPage *asource, RBShellPreferences *prefs)
467
469
{
468
470
        RBLibrarySource *source = RB_LIBRARY_SOURCE (asource);
469
471
        GtkBuilder *builder;
474
476
        if (source->priv->config_widget)
475
477
                return source->priv->config_widget;
476
478
 
477
 
        g_object_ref (G_OBJECT (prefs));
 
479
        g_object_ref (prefs);
478
480
        source->priv->shell_prefs = prefs;
479
481
 
480
482
        builder = rb_builder_load ("library-prefs.ui", source);
504
506
 
505
507
        tmp = gtk_builder_get_object (builder, "layout_path_menu_box");
506
508
        label = gtk_builder_get_object (builder, "layout_path_menu_label");
507
 
        source->priv->layout_path_menu = gtk_combo_box_new_text ();
 
509
        source->priv->layout_path_menu = gtk_combo_box_text_new ();
508
510
        gtk_box_pack_start (GTK_BOX (tmp), source->priv->layout_path_menu, TRUE, TRUE, 0);
509
511
        gtk_label_set_mnemonic_widget (GTK_LABEL (label), source->priv->layout_path_menu);
510
512
        g_signal_connect (G_OBJECT (source->priv->layout_path_menu),
512
514
                          G_CALLBACK (rb_library_source_path_changed_cb),
513
515
                          asource);
514
516
        for (i = 0; i < num_library_layout_paths; i++) {
515
 
                gtk_combo_box_append_text (GTK_COMBO_BOX (source->priv->layout_path_menu),
516
 
                                           _(library_layout_paths[i].title));
 
517
                gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (source->priv->layout_path_menu),
 
518
                                                _(library_layout_paths[i].title));
517
519
        }
518
520
 
519
521
        tmp = gtk_builder_get_object (builder, "layout_filename_menu_box");
520
522
        label = gtk_builder_get_object (builder, "layout_filename_menu_label");
521
 
        source->priv->layout_filename_menu = gtk_combo_box_new_text ();
 
523
        source->priv->layout_filename_menu = gtk_combo_box_text_new ();
522
524
        gtk_box_pack_start (GTK_BOX (tmp), source->priv->layout_filename_menu, TRUE, TRUE, 0);
523
525
        gtk_label_set_mnemonic_widget (GTK_LABEL (label), source->priv->layout_filename_menu);
524
526
        g_signal_connect (G_OBJECT (source->priv->layout_filename_menu),
526
528
                          G_CALLBACK (rb_library_source_filename_changed_cb),
527
529
                          asource);
528
530
        for (i = 0; i < num_library_layout_filenames; i++) {
529
 
                gtk_combo_box_append_text (GTK_COMBO_BOX (source->priv->layout_filename_menu),
530
 
                                           _(library_layout_filenames[i].title));
 
531
                gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (source->priv->layout_filename_menu),
 
532
                                                _(library_layout_filenames[i].title));
531
533
        }
532
534
 
533
535
        tmp = gtk_builder_get_object (builder, "edit_profile_button");
699
701
}
700
702
 
701
703
static gboolean
702
 
impl_receive_drag (RBSource *asource, GtkSelectionData *data)
 
704
impl_receive_drag (RBDisplayPage *asource, GtkSelectionData *data)
703
705
{
704
706
        RBLibrarySource *source = RB_LIBRARY_SOURCE (asource);
705
707
        GList *list, *i;
733
735
 
734
736
        if (entries) {
735
737
                entries = g_list_reverse (entries);
736
 
                if (rb_source_can_paste (asource))
737
 
                        rb_source_paste (asource, entries);
 
738
                if (rb_source_can_paste (RB_SOURCE (asource)))
 
739
                        rb_source_paste (RB_SOURCE (asource), entries);
738
740
                g_list_free (entries);
739
741
        }
740
742
 
743
745
}
744
746
 
745
747
static gboolean
746
 
impl_show_popup (RBSource *source)
 
748
impl_show_popup (RBDisplayPage *source)
747
749
{
748
 
        _rb_source_show_popup (source, "/LibrarySourcePopup");
 
750
        _rb_display_page_show_popup (source, "/LibrarySourcePopup");
749
751
        return TRUE;
750
752
}
751
753
 
1365
1367
{
1366
1368
        RhythmDBImportJob *head = RHYTHMDB_IMPORT_JOB (source->priv->import_jobs->data);
1367
1369
        if (job == head) {              /* it was inevitable */
1368
 
                rb_source_notify_status_changed (RB_SOURCE (source));
 
1370
                _rb_display_page_notify_status_changed (RB_DISPLAY_PAGE (source));
1369
1371
        }
1370
1372
}
1371
1373
 
1520
1522
        rhythmdb_query_free (query);
1521
1523
        g_free (sort_column);
1522
1524
 
1523
 
        g_object_get (library_source, "icon", &icon, NULL);
1524
 
        g_object_set (source, "icon", icon, NULL);
 
1525
        g_object_get (library_source, "pixbuf", &icon, NULL);
 
1526
        g_object_set (source, "pixbuf", icon, NULL);
1525
1527
        if (icon != NULL) {
1526
1528
                g_object_unref (icon);
1527
1529
        }
1528
1530
 
1529
 
        rb_shell_append_source (shell, source, RB_SOURCE (library_source));
 
1531
        rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (source), RB_DISPLAY_PAGE (library_source));
1530
1532
        library_source->priv->child_sources = g_list_prepend (library_source->priv->child_sources, source);
1531
1533
 
1532
1534
        g_object_unref (entry_type);
1542
1544
        list = eel_gconf_get_string_list (CONF_LIBRARY_LOCATION);
1543
1545
 
1544
1546
        /* FIXME: don't delete and re-create sources that are still there */
1545
 
        g_list_foreach (source->priv->child_sources, (GFunc)rb_source_delete_thyself, NULL);
 
1547
        g_list_foreach (source->priv->child_sources, (GFunc)rb_display_page_delete_thyself, NULL);
1546
1548
        g_list_free (source->priv->child_sources);
1547
1549
        source->priv->child_sources = NULL;
1548
1550
 
1552
1554
}
1553
1555
 
1554
1556
static void
1555
 
impl_get_status (RBSource *source, char **text, char **progress_text, float *progress)
 
1557
impl_get_status (RBDisplayPage *source, char **text, char **progress_text, float *progress)
1556
1558
{
1557
 
        RB_SOURCE_CLASS (rb_library_source_parent_class)->impl_get_status (source, text, progress_text, progress);
 
1559
        RB_DISPLAY_PAGE_CLASS (rb_library_source_parent_class)->get_status (source, text, progress_text, progress);
1558
1560
        RBLibrarySource *lsource = RB_LIBRARY_SOURCE (source);
1559
1561
 
1560
1562
        if (lsource->priv->import_jobs != NULL) {
1561
1563
                RhythmDBImportJob *job = RHYTHMDB_IMPORT_JOB (lsource->priv->import_jobs->data);
1562
 
                _rb_source_set_import_status (source, job, progress_text, progress);
 
1564
                _rb_source_set_import_status (RB_SOURCE (source), job, progress_text, progress);
1563
1565
        }
1564
1566
}