static void rb_import_errors_source_constructed (GObject *object) { GObject *shell_player; RBImportErrorsSource *source; RBShell *shell; GPtrArray *query; RhythmDBQueryModel *model; RhythmDBEntryType *entry_type; GtkWidget *box; GtkWidget *label; RB_CHAIN_GOBJECT_METHOD (rb_import_errors_source_parent_class, constructed, object); source = RB_IMPORT_ERRORS_SOURCE (object); g_object_get (source, "shell", &shell, "entry-type", &entry_type, NULL); g_object_get (shell, "db", &source->priv->db, NULL); shell_player = rb_shell_get_player (shell); g_object_unref (shell); /* construct real query */ query = rhythmdb_query_parse (source->priv->db, RHYTHMDB_QUERY_PROP_EQUALS, RHYTHMDB_PROP_TYPE, entry_type, RHYTHMDB_QUERY_END); model = rhythmdb_query_model_new (source->priv->db, query, (GCompareDataFunc) rhythmdb_query_model_string_sort_func, GUINT_TO_POINTER (RHYTHMDB_PROP_LOCATION), NULL, FALSE); rhythmdb_query_free (query); /* set up entry view */ source->priv->view = rb_entry_view_new (source->priv->db, shell_player, NULL, FALSE, FALSE); rb_entry_view_set_model (source->priv->view, model); rb_entry_view_append_column (source->priv->view, RB_ENTRY_VIEW_COL_LOCATION, TRUE); rb_entry_view_append_column (source->priv->view, RB_ENTRY_VIEW_COL_ERROR, TRUE); g_signal_connect_object (source->priv->view, "show_popup", G_CALLBACK (rb_import_errors_source_songs_show_popup_cb), source, 0); g_object_set (source, "query-model", model, NULL); g_object_unref (model); /* set up query model for tracking missing plugin information */ query = rhythmdb_query_parse (source->priv->db, RHYTHMDB_QUERY_PROP_EQUALS, RHYTHMDB_PROP_TYPE, entry_type, RHYTHMDB_QUERY_PROP_NOT_EQUAL, RHYTHMDB_PROP_COMMENT, "", RHYTHMDB_QUERY_END); source->priv->missing_plugin_model = rhythmdb_query_model_new_empty (source->priv->db); rhythmdb_do_full_query_async_parsed (source->priv->db, RHYTHMDB_QUERY_RESULTS (source->priv->missing_plugin_model), query); rhythmdb_query_free (query); /* set up info bar for triggering codec installation */ source->priv->infobar = gtk_info_bar_new_with_buttons (_("Install Plugins"), GTK_RESPONSE_OK, NULL); g_signal_connect_object (source->priv->infobar, "response", G_CALLBACK (infobar_response_cb), source, 0); label = gtk_label_new (_("Additional GStreamer plugins are required to play some of these files.")); gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (source->priv->infobar))), label); g_object_unref (entry_type); box = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (source->priv->view), TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box), source->priv->infobar, FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (source), box); gtk_widget_show_all (GTK_WIDGET (source)); gtk_widget_hide (source->priv->infobar); /* show the info bar when there are missing plugin entries */ g_signal_connect_object (source->priv->missing_plugin_model, "row-inserted", G_CALLBACK (missing_plugin_row_inserted_cb), source, 0); g_signal_connect_object (source->priv->missing_plugin_model, "row-deleted", G_CALLBACK (missing_plugin_row_deleted_cb), source, 0); }
static void rb_missing_files_source_constructed (GObject *object) { GObject *shell_player; RBMissingFilesSource *source; RBShell *shell; GPtrArray *query; RhythmDBQueryModel *model; RhythmDBEntryType *entry_type; RB_CHAIN_GOBJECT_METHOD (rb_missing_files_source_parent_class, constructed, object); source = RB_MISSING_FILES_SOURCE (object); g_object_get (source, "shell", &shell, "entry-type", &entry_type, NULL); g_object_get (shell, "db", &source->priv->db, NULL); shell_player = rb_shell_get_player (shell); g_object_unref (shell); /* construct real query */ query = rhythmdb_query_parse (source->priv->db, RHYTHMDB_QUERY_PROP_EQUALS, RHYTHMDB_PROP_TYPE, entry_type, RHYTHMDB_QUERY_PROP_EQUALS, RHYTHMDB_PROP_HIDDEN, TRUE, RHYTHMDB_QUERY_END); g_object_unref (entry_type); model = rhythmdb_query_model_new (source->priv->db, query, NULL, NULL, NULL, FALSE); rhythmdb_query_free (query); g_object_set (model, "show-hidden", TRUE, NULL); /* set up entry view */ source->priv->view = rb_entry_view_new (source->priv->db, shell_player, NULL, FALSE, FALSE); rb_entry_view_set_model (source->priv->view, model); rb_entry_view_append_column (source->priv->view, RB_ENTRY_VIEW_COL_TRACK_NUMBER, FALSE); rb_entry_view_append_column (source->priv->view, RB_ENTRY_VIEW_COL_TITLE, TRUE); /* rb_entry_view_append_column (source->priv->view, RB_ENTRY_VIEW_COL_GENRE, FALSE); */ rb_entry_view_append_column (source->priv->view, RB_ENTRY_VIEW_COL_ARTIST, FALSE); rb_entry_view_append_column (source->priv->view, RB_ENTRY_VIEW_COL_ALBUM, FALSE); rb_entry_view_append_column (source->priv->view, RB_ENTRY_VIEW_COL_LOCATION, TRUE); rb_entry_view_append_column (source->priv->view, RB_ENTRY_VIEW_COL_LAST_SEEN, TRUE); rb_entry_view_set_columns_clickable (source->priv->view, TRUE); gtk_container_add (GTK_CONTAINER (source), GTK_WIDGET (source->priv->view)); g_signal_connect_object (source->priv->view, "show_popup", G_CALLBACK (rb_missing_files_source_songs_show_popup_cb), source, 0); g_signal_connect_object (source->priv->view, "sort-order-changed", G_CALLBACK (rb_missing_files_source_songs_sort_order_changed_cb), source, 0); gtk_widget_show_all (GTK_WIDGET (source)); g_object_set (source, "query-model", model, NULL); g_object_unref (model); }
static void rb_mtp_source_constructed (GObject *object) { RBMtpSource *source; RBMtpSourcePrivate *priv; RBEntryView *tracks; RBShell *shell; RBShellPlayer *shell_player; GObject *player_backend; GtkIconTheme *theme; GdkPixbuf *pixbuf; #if defined(HAVE_GUDEV) GMount *mount; #endif gint size; RB_CHAIN_GOBJECT_METHOD (rb_mtp_source_parent_class, constructed, object); source = RB_MTP_SOURCE (object); priv = MTP_SOURCE_GET_PRIVATE (source); /* try to open the device. if gvfs has mounted it, unmount it first */ #if defined(HAVE_GUDEV) mount = find_mount_for_device (priv->udev_device); if (mount != NULL) { rb_debug ("device is already mounted, waiting until activated"); g_mount_unmount_with_operation (mount, G_MOUNT_UNMOUNT_NONE, NULL, NULL, unmount_done_cb, g_object_ref (source)); /* mount gets unreffed in callback */ } else #endif open_device (source); tracks = rb_source_get_entry_view (RB_SOURCE (source)); rb_entry_view_append_column (tracks, RB_ENTRY_VIEW_COL_RATING, FALSE); rb_entry_view_append_column (tracks, RB_ENTRY_VIEW_COL_LAST_PLAYED, FALSE); /* the source element needs our cooperation */ g_object_get (source, "shell", &shell, NULL); shell_player = RB_SHELL_PLAYER (rb_shell_get_player (shell)); g_object_get (shell_player, "player", &player_backend, NULL); g_signal_connect_object (player_backend, "prepare-source", G_CALLBACK (prepare_player_source_cb), source, 0); g_object_unref (player_backend); g_object_unref (shell); g_signal_connect_object (rb_encoder_factory_get (), "prepare-source", G_CALLBACK (prepare_encoder_source_cb), source, 0); g_signal_connect_object (rb_encoder_factory_get (), "prepare-sink", G_CALLBACK (prepare_encoder_sink_cb), source, 0); /* icon */ theme = gtk_icon_theme_get_default (); gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &size, NULL); pixbuf = gtk_icon_theme_load_icon (theme, "multimedia-player", size, 0, NULL); rb_source_set_pixbuf (RB_SOURCE (source), pixbuf); g_object_unref (pixbuf); if (priv->album_art_supported) { RhythmDB *db; db = get_db_for_source (source); g_signal_connect_object (db, "entry-extra-metadata-notify::rb:coverArt", G_CALLBACK (artwork_notify_cb), source, 0); g_object_unref (db); } }
static void impl_activate (RBPlugin *plugin, RBShell *shell) { RBAudioCdPlugin *pi = RB_AUDIOCD_PLUGIN (plugin); RBRemovableMediaManager *rmm; gboolean scanned; GObject *shell_player; RBPlayer *player_backend; GtkUIManager *uimanager; char *filename; pi->sources = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, g_object_unref); pi->shell = shell; g_object_get (shell, "removable-media-manager", &rmm, "ui-manager", &uimanager, NULL); filename = rb_plugin_find_file (plugin, "audiocd-ui.xml"); if (filename != NULL) { pi->ui_merge_id = gtk_ui_manager_add_ui_from_file (uimanager, filename, NULL); } else { g_warning ("Unable to find file: audiocd-ui.xml"); } g_free (filename); g_object_unref (uimanager); /* watch for new removable media. use connect_after so * plugins for more specific device types can get in first. */ g_signal_connect_after (rmm, "create-source-mount", G_CALLBACK (create_source_cb), pi); /* only scan if we're being loaded after the initial scan has been done */ g_object_get (G_OBJECT (rmm), "scanned", &scanned, NULL); if (scanned) { rb_removable_media_manager_scan (rmm); } g_object_unref (rmm); /* player backend hooks: specify the device, limit read speed, and disable paranoia * in source elements, and when changing between tracks on the same CD, just seek * between them, rather than closing and reopening the device. */ shell_player = rb_shell_get_player (shell); g_object_get (shell_player, "player", &player_backend, NULL); if (player_backend) { GObjectClass *klass = G_OBJECT_GET_CLASS (player_backend); if (g_signal_lookup ("prepare-source", G_OBJECT_CLASS_TYPE (klass)) != 0) { g_signal_connect_object (player_backend, "prepare-source", G_CALLBACK (rb_audiocd_plugin_prepare_player_source_cb), plugin, 0); } if (g_signal_lookup ("reuse-stream", G_OBJECT_CLASS_TYPE (klass)) != 0) { g_signal_connect_object (player_backend, "can-reuse-stream", G_CALLBACK (rb_audiocd_plugin_can_reuse_stream_cb), plugin, 0); g_signal_connect_object (player_backend, "reuse-stream", G_CALLBACK (rb_audiocd_plugin_reuse_stream_cb), plugin, 0); } } /* encoder hooks: specify the device and set the paranoia level (if available) on * source elements. */ g_signal_connect_object (rb_encoder_factory_get (), "prepare-source", G_CALLBACK (rb_audiocd_plugin_prepare_encoder_source_cb), plugin, 0); g_signal_connect_object (shell_player, "playing-uri-changed", G_CALLBACK (rb_audiocd_plugin_playing_uri_changed_cb), plugin, 0); }