static void default_move_to_trash (RBSource *source) { GList *sel, *tem; RBEntryView *entry_view; RhythmDB *db; RBSourcePrivate *priv = RB_SOURCE_GET_PRIVATE (source); g_object_get (priv->shell, "db", &db, NULL); sel = NULL; entry_view = rb_source_get_entry_view (source); if (entry_view != NULL) { sel = rb_entry_view_get_selected_entries (entry_view); } for (tem = sel; tem != NULL; tem = tem->next) { rhythmdb_entry_move_to_trash (db, (RhythmDBEntry *)tem->data); rhythmdb_commit (db); } g_list_foreach (sel, (GFunc)rhythmdb_entry_unref, NULL); g_list_free (sel); g_object_unref (db); }
/** * rb_source_gather_selected_properties: * @source: a #RBSource * @prop: property for which to gather selection * * Returns a list containing the values of the specified * property from the selected entries in the source. * This is used to implement the 'browse this artist' (etc.) * actions. * * Return value: (element-type utf8) (transfer full): list of property values */ GList * rb_source_gather_selected_properties (RBSource *source, RhythmDBPropType prop) { RBEntryView *entryview; GList *selected, *tem; GHashTable *selected_set; entryview = rb_source_get_entry_view (source); if (entryview == NULL) return NULL; selected_set = g_hash_table_new (g_str_hash, g_str_equal); selected = rb_entry_view_get_selected_entries (entryview); for (tem = selected; tem; tem = tem->next) { RhythmDBEntry *entry = tem->data; char *val = g_strdup (rhythmdb_entry_get_string (entry, prop)); g_hash_table_insert (selected_set, val, NULL); } g_list_foreach (selected, (GFunc)rhythmdb_entry_unref, NULL); g_list_free (selected); tem = NULL; g_hash_table_foreach (selected_set, (GHFunc) rb_source_gather_hash_keys, &tem); g_hash_table_destroy (selected_set); return tem; }
static GList * default_copy (RBSource *source) { RBEntryView *entry_view; entry_view = rb_source_get_entry_view (source); if (entry_view == NULL) return NULL; return rb_entry_view_get_selected_entries (entry_view); }
static void impl_delete (RBSource *source) { GList *sel; RBEntryView *songs; songs = rb_source_get_entry_view (source); sel = rb_entry_view_get_selected_entries (songs); impl_delete_entries (RB_MEDIA_PLAYER_SOURCE (source), sel, NULL, NULL, NULL); rb_list_destroy_free (sel, (GDestroyNotify) rhythmdb_entry_unref); }
static void impl_delete_selected (RBSource *source) { RBEntryView *view; GList *sel; view = rb_source_get_entry_view (source); sel = rb_entry_view_get_selected_entries (view); delete_entries (RB_ANDROID_SOURCE (source), sel); g_list_foreach (sel, (GFunc)rhythmdb_entry_unref, NULL); g_list_free (sel); }
static GList * impl_cut (RBSource *asource) { RBStaticPlaylistSource *source = RB_STATIC_PLAYLIST_SOURCE (asource); RBEntryView *songs = rb_source_get_entry_view (asource); GList *sel = rb_entry_view_get_selected_entries (songs); GList *tem; for (tem = sel; tem; tem = tem->next) rb_static_playlist_source_remove_entry (source, (RhythmDBEntry *) tem->data); return sel; }
static void impl_delete (RBSource *source) { RBEntryView *view; GList *sel; view = rb_source_get_entry_view (source); sel = rb_entry_view_get_selected_entries (view); rb_generic_player_source_delete_entries (RB_GENERIC_PLAYER_SOURCE (source), sel); g_list_foreach (sel, (GFunc)rhythmdb_entry_unref, NULL); g_list_free (sel); }
static void impl_delete (RBSource *asource) { RBEntryView *songs = rb_source_get_entry_view (asource); RBStaticPlaylistSource *source = RB_STATIC_PLAYLIST_SOURCE (asource); GList *sel, *tem; sel = rb_entry_view_get_selected_entries (songs); for (tem = sel; tem != NULL; tem = tem->next) { rb_static_playlist_source_remove_entry (source, (RhythmDBEntry *) tem->data); } g_list_foreach (sel, (GFunc)rhythmdb_entry_unref, NULL); g_list_free (sel); }
static void impl_move_to_trash (RBSource *source) { RBGenericPlayerPlaylistSourcePrivate *priv = GET_PRIVATE (source); RBEntryView *songs; GList *sel; songs = rb_source_get_entry_view (source); sel = rb_entry_view_get_selected_entries (songs); rb_generic_player_source_trash_or_delete_entries (priv->player_source, sel, FALSE); g_list_foreach (sel, (GFunc) rhythmdb_entry_unref, NULL); g_list_free (sel); }
static void rb_static_playlist_source_browser_changed_cb (RBLibraryBrowser *browser, GParamSpec *pspec, RBStaticPlaylistSource *source) { RBEntryView *songs = rb_source_get_entry_view (RB_SOURCE (source)); RhythmDBQueryModel *query_model; g_object_get (browser, "output-model", &query_model, NULL); rb_entry_view_set_model (songs, query_model); rb_playlist_source_set_query_model (RB_PLAYLIST_SOURCE (source), query_model); g_object_unref (query_model); rb_source_notify_filter_changed (RB_SOURCE (source)); }
static void impl_delete (RBSource *source) { RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source); GList *sel; GList *tem; RBEntryView *tracks; RhythmDB *db; int ret; db = get_db_for_source (RB_MTP_SOURCE (source)); tracks = rb_source_get_entry_view (source); sel = rb_entry_view_get_selected_entries (tracks); for (tem = sel; tem != NULL; tem = tem->next) { LIBMTP_track_t *track; RhythmDBEntry *entry; const char *uri; const char *album_name; entry = (RhythmDBEntry *)tem->data; uri = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION); track = g_hash_table_lookup (priv->entry_map, entry); if (track == NULL) { rb_debug ("Couldn't find track on mtp-device! (%s)", uri); continue; } ret = LIBMTP_Delete_Object (priv->device, track->item_id); if (ret != 0) { rb_debug ("Delete track %d failed", track->item_id); report_libmtp_errors (priv->device, TRUE); continue; } album_name = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM); if (strcmp (album_name, _("Unknown")) != 0) { remove_track_from_album (RB_MTP_SOURCE (source), album_name, track); } g_hash_table_remove (priv->entry_map, entry); rhythmdb_entry_delete (db, entry); } rhythmdb_commit (db); g_list_free (sel); g_list_free (tem); }
static gboolean impl_can_move_to_trash (RBSource *source) { RBGenericPlayerPlaylistSourcePrivate *priv = GET_PRIVATE (source); RBEntryView *songs; GList *sel; gboolean ret; songs = rb_source_get_entry_view (source); sel = rb_entry_view_get_selected_entries (songs); ret = rb_generic_player_source_can_trash_entries (priv->player_source, sel); g_list_foreach (sel, (GFunc) rhythmdb_entry_unref, NULL); g_list_free (sel); return ret; }
static GList * impl_copy (RBSource *source) { RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (RB_MTP_SOURCE (source)); RhythmDB *db; GList *selected_entries; GList *iter; GList *copy_entries; int ret = -1; LIBMTP_track_t *track = NULL; db = get_db_for_source (RB_MTP_SOURCE (source)); copy_entries = NULL; selected_entries = rb_entry_view_get_selected_entries (rb_source_get_entry_view (source)); for (iter = selected_entries; iter != NULL; iter = g_list_next (iter)) { RhythmDBEntry *entry; char *path; char *uri; entry = (RhythmDBEntry *)iter->data; track = g_hash_table_lookup (priv->entry_map, entry); if (track == NULL) continue; path = g_strdup_printf ("%s/%s", g_get_tmp_dir (), track->filename); uri = g_filename_to_uri (path, NULL, NULL); g_free (path); ret = rb_mtp_source_transfer_track_to_disk (priv->device, track, uri); if (ret == 0) { entry_set_string_prop (RHYTHMDB (db), entry, RHYTHMDB_PROP_LOCATION, uri); copy_entries = g_list_prepend (copy_entries, entry); } g_free (uri); } g_list_free (selected_entries); g_object_unref (G_OBJECT (db)); return copy_entries; }
static void default_add_to_queue (RBSource *source, RBSource *queue) { RBEntryView *songs = rb_source_get_entry_view (source); GList *selection = rb_entry_view_get_selected_entries (songs); GList *iter; if (selection == NULL) return; for (iter = selection; iter; iter = iter->next) { rb_static_playlist_source_add_entry (RB_STATIC_PLAYLIST_SOURCE (queue), (RhythmDBEntry *)iter->data, -1); } g_list_foreach (selection, (GFunc)rhythmdb_entry_unref, NULL); g_list_free (selection); }
static gboolean impl_can_move_to_trash (RBSource *source) { RBEntryView *view; GList *sel; gboolean ret; view = rb_source_get_entry_view (source); sel = rb_entry_view_get_selected_entries (view); ret = rb_generic_player_source_can_trash_entries (RB_GENERIC_PLAYER_SOURCE (source), sel); g_list_foreach (sel, (GFunc)rhythmdb_entry_unref, NULL); g_list_free (sel); return ret; }
static gboolean impl_can_move_to_trash (RBSource *source) { RBGenericPlayerSourcePrivate *priv = GENERIC_PLAYER_SOURCE_GET_PRIVATE (source); RBEntryView *view; GList *sel, *tem; gboolean ret; if (priv->read_only != FALSE) return FALSE; ret = FALSE; view = rb_source_get_entry_view (source); sel = rb_entry_view_get_selected_entries (view); for (tem = sel; tem != NULL; tem = tem->next) { RhythmDBEntry *entry; const char *uri; GFile *file; GFileInfo *info; entry = tem->data; uri = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION); file = g_file_new_for_uri (uri); info = g_file_query_info (file, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, G_FILE_QUERY_INFO_NONE, NULL, NULL); g_object_unref (file); if (info == NULL) { ret = FALSE; break; } ret = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH); g_object_unref (info); if (ret == FALSE) break; } g_list_foreach (sel, (GFunc)rhythmdb_entry_unref, NULL); g_list_free (sel); return ret; }
static void rb_mtp_source_constructed (GObject *object) { RBMtpSource *source; RBEntryView *tracks; RBShell *shell; RBShellPlayer *shell_player; GObject *player_backend; RB_CHAIN_GOBJECT_METHOD (rb_mtp_source_parent_class, constructed, object); source = RB_MTP_SOURCE (object); 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); g_object_get (shell, "shell-player", &shell_player, NULL); g_object_get (shell_player, "player", &player_backend, NULL); g_object_unref (shell_player); 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); rb_display_page_set_icon_name (RB_DISPLAY_PAGE (source), "multimedia-player-symbolic"); }
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 GObject * rb_mtp_source_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties) { RBMtpSource *source; RBMtpSourcePrivate *priv; RBEntryView *tracks; GtkIconTheme *theme; GdkPixbuf *pixbuf; gint size; guint16 *types = NULL; guint16 num_types= 0; source = RB_MTP_SOURCE (G_OBJECT_CLASS (rb_mtp_source_parent_class)-> constructor (type, n_construct_properties, construct_properties)); 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); /* 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); g_signal_connect (G_OBJECT (source), "notify::name", (GCallback)rb_mtp_source_name_changed_cb, NULL); /* figure out supported file types */ priv = MTP_SOURCE_GET_PRIVATE (source); if (LIBMTP_Get_Supported_Filetypes(priv->device, &types, &num_types) == 0) { int i; gboolean has_mp3 = FALSE; for (i = 0; i < num_types; i++) { const char *mediatype; if (i <= LIBMTP_FILETYPE_UNKNOWN) { priv->supported_types[types[i]] = 1; } /* this has to work with the remapping done in * rb-removable-media-source.c:impl_paste. */ switch (types[i]) { case LIBMTP_FILETYPE_WAV: mediatype = "audio/x-wav"; break; case LIBMTP_FILETYPE_MP3: /* special handling for mp3: always put it at the front of the list * if it's supported. */ has_mp3 = TRUE; mediatype = NULL; break; case LIBMTP_FILETYPE_WMA: mediatype = "audio/x-ms-wma"; break; case LIBMTP_FILETYPE_OGG: mediatype = "application/ogg"; break; case LIBMTP_FILETYPE_MP4: case LIBMTP_FILETYPE_M4A: case LIBMTP_FILETYPE_AAC: mediatype = "audio/aac"; break; case LIBMTP_FILETYPE_WMV: mediatype = "audio/x-ms-wmv"; break; case LIBMTP_FILETYPE_ASF: mediatype = "video/x-ms-asf"; break; case LIBMTP_FILETYPE_FLAC: mediatype = "audio/flac"; break; case LIBMTP_FILETYPE_JPEG: rb_debug ("JPEG (album art) supported"); mediatype = NULL; priv->album_art_supported = TRUE; break; default: rb_debug ("unknown libmtp filetype %s supported", LIBMTP_Get_Filetype_Description (types[i])); mediatype = NULL; break; } if (mediatype != NULL) { rb_debug ("media type %s supported", mediatype); priv->mediatypes = g_list_prepend (priv->mediatypes, g_strdup (mediatype)); } } if (has_mp3) { rb_debug ("audio/mpeg supported"); priv->mediatypes = g_list_prepend (priv->mediatypes, g_strdup ("audio/mpeg")); } } else { report_libmtp_errors (priv->device, FALSE); } 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); } rb_mtp_source_load_tracks (source); return G_OBJECT (source); }
static void rb_audiocd_source_constructed (GObject *object) { RBAudioCdSourcePrivate *priv; RBAudioCdSource *source; RBEntryView *entry_view; GtkCellRenderer *renderer; GtkTreeViewColumn *extract; GtkWidget *widget; GtkAction *action; RhythmDB *db; RBPlugin *plugin; RBShell *shell; char *ui_file; int toggle_width; RB_CHAIN_GOBJECT_METHOD (rb_audiocd_source_parent_class, constructed, object); source = RB_AUDIOCD_SOURCE (object); priv = AUDIOCD_SOURCE_GET_PRIVATE (source); g_object_set (G_OBJECT (source), "name", "Unknown Audio", NULL); g_object_get (source, "shell", &shell, NULL); priv->action_group = _rb_source_register_action_group (RB_SOURCE (source), "AudioCdActions", NULL, 0, NULL); _rb_action_group_add_source_actions (priv->action_group, G_OBJECT (shell), rb_audiocd_source_actions, G_N_ELEMENTS (rb_audiocd_source_actions)); g_object_unref (shell); action = gtk_action_group_get_action (priv->action_group, "AudioCdCopyTracks"); /* Translators: this is the toolbar button label for Copy to Library action. */ g_object_set (action, "short-label", _("Extract"), NULL); #if !defined(HAVE_SJ_METADATA_GETTER) action = gtk_action_group_get_action (priv->action_group, "AudioCdSourceReloadMetadata"); g_object_set (action, "visible", FALSE, NULL); #endif /* we want audio cds to sort by track# by default */ entry_view = rb_source_get_entry_view (RB_SOURCE (source)); rb_entry_view_set_sorting_order (entry_view, "Track", GTK_SORT_ASCENDING); /* enable in-place editing for titles, artists, and genres */ rb_entry_view_set_column_editable (entry_view, RB_ENTRY_VIEW_COL_TITLE, TRUE); rb_entry_view_set_column_editable (entry_view, RB_ENTRY_VIEW_COL_ARTIST, TRUE); rb_entry_view_set_column_editable (entry_view, RB_ENTRY_VIEW_COL_GENRE, TRUE); /* create the 'extract' column */ renderer = gtk_cell_renderer_toggle_new (); extract = gtk_tree_view_column_new (); gtk_tree_view_column_pack_start (extract, renderer, FALSE); gtk_tree_view_column_set_cell_data_func (extract, renderer, (GtkTreeCellDataFunc) extract_cell_data_func, source, NULL); gtk_tree_view_column_set_clickable (extract, TRUE); widget = gtk_check_button_new (); g_object_set (widget, "active", TRUE, NULL); gtk_widget_show_all (widget); g_signal_connect_object (extract, "clicked", G_CALLBACK (extract_column_clicked_cb), source, 0); gtk_tree_view_column_set_widget (extract, widget); g_signal_connect_object (renderer, "toggled", G_CALLBACK (extract_toggled_cb), source, 0); /* set column width */ gtk_cell_renderer_get_size (renderer, GTK_WIDGET (entry_view), NULL, NULL, NULL, &toggle_width, NULL); gtk_tree_view_column_set_sizing (extract, GTK_TREE_VIEW_COLUMN_FIXED); gtk_tree_view_column_set_fixed_width (extract, toggle_width + 5); rb_entry_view_insert_column_custom (entry_view, extract, "", "Extract", NULL, NULL, NULL, 1); gtk_widget_set_tooltip_text (gtk_tree_view_column_get_widget (extract), _("Select tracks to be extracted")); /* hide the 'album' column */ gtk_tree_view_column_set_visible (rb_entry_view_get_column (entry_view, RB_ENTRY_VIEW_COL_ALBUM), FALSE); /* handle extra metadata requests for album artist and album artist sortname */ db = get_db_for_source (source); g_signal_connect_object (G_OBJECT (db), "entry-extra-metadata-request::" RHYTHMDB_PROP_ALBUM_ARTIST, G_CALLBACK (album_artist_metadata_request_cb), source, 0); g_signal_connect_object (G_OBJECT (db), "entry-extra-metadata-request::" RHYTHMDB_PROP_ALBUM_ARTIST_SORTNAME, G_CALLBACK (album_artist_sortname_metadata_request_cb), source, 0); g_signal_connect_object (G_OBJECT (db), "entry-extra-metadata-gather", G_CALLBACK (metadata_gather_cb), source, 0); g_object_unref (db); /* set up the album info widgets */ g_object_get (source, "plugin", &plugin, NULL); ui_file = rb_plugin_find_file (plugin, "album-info.ui"); g_object_unref (plugin); if (ui_file == NULL) { g_warning ("couldn't find album-info.ui"); } else { RBAudioCdSourcePrivate *priv; GtkWidget *table; GtkBuilder *builder; #if defined(HAVE_SJ_METADATA_GETTER) && GTK_CHECK_VERSION(2,17,6) GtkWidget *box; char *message; #endif priv = AUDIOCD_SOURCE_GET_PRIVATE (source); builder = rb_builder_load (ui_file, NULL); g_free (ui_file); table = GTK_WIDGET (gtk_builder_get_object (builder, "album_info")); g_assert (table != NULL); #if defined(HAVE_SJ_METADATA_GETTER) && GTK_CHECK_VERSION(2,17,6) /* Info bar for non-Musicbrainz data */ priv->info_bar = gtk_info_bar_new_with_buttons (_("S_ubmit Album"), GTK_RESPONSE_OK, _("Hide"), GTK_RESPONSE_CANCEL, NULL); message = g_strdup_printf ("<b>%s</b>\n%s", _("Could not find this album on MusicBrainz."), _("You can improve the MusicBrainz database by adding this album.")); priv->info_bar_label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (priv->info_bar_label), message); gtk_label_set_justify (GTK_LABEL (priv->info_bar_label), GTK_JUSTIFY_LEFT); g_free (message); box = gtk_info_bar_get_content_area (GTK_INFO_BAR (priv->info_bar)); gtk_container_add (GTK_CONTAINER (box), priv->info_bar_label); gtk_widget_show_all (box); gtk_widget_set_no_show_all (priv->info_bar, TRUE); g_signal_connect (G_OBJECT (priv->info_bar), "response", G_CALLBACK (info_bar_response_cb), source); gtk_table_attach_defaults (GTK_TABLE (table), priv->info_bar, 0, 2, 0, 1); #endif priv->artist_entry = GTK_WIDGET (gtk_builder_get_object (builder, "artist_entry")); priv->artist_sort_entry = GTK_WIDGET (gtk_builder_get_object (builder, "artist_sort_entry")); priv->album_entry = GTK_WIDGET (gtk_builder_get_object (builder, "album_entry")); priv->year_entry = GTK_WIDGET (gtk_builder_get_object (builder, "year_entry")); priv->genre_entry = GTK_WIDGET (gtk_builder_get_object (builder, "genre_entry")); priv->disc_number_entry = GTK_WIDGET (gtk_builder_get_object (builder, "disc_number_entry")); g_signal_connect_object (priv->album_entry, "focus-out-event", G_CALLBACK (update_album_cb), source, 0); g_signal_connect_object (priv->genre_entry, "focus-out-event", G_CALLBACK (update_genre_cb), source, 0); g_signal_connect_object (priv->year_entry, "focus-out-event", G_CALLBACK (update_year_cb), source, 0); g_signal_connect_object (priv->disc_number_entry, "focus-out-event", G_CALLBACK (update_disc_number_cb), source, 0); gtk_box_pack_start (GTK_BOX (priv->box), table, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (priv->box), table, 0); g_object_unref (builder); } g_object_ref (G_OBJECT (source)); g_thread_create ((GThreadFunc)rb_audiocd_load_songs, source, FALSE, NULL); }
static void rb_static_playlist_source_constructed (GObject *object) { RBStaticPlaylistSource *source; RBStaticPlaylistSourcePrivate *priv; RBPlaylistSource *psource; RBEntryView *songs; RBShell *shell; RhythmDBEntryType *entry_type; RB_CHAIN_GOBJECT_METHOD (rb_static_playlist_source_parent_class, constructed, object); source = RB_STATIC_PLAYLIST_SOURCE (object); priv = RB_STATIC_PLAYLIST_SOURCE_GET_PRIVATE (source); psource = RB_PLAYLIST_SOURCE (source); priv->base_model = rb_playlist_source_get_query_model (RB_PLAYLIST_SOURCE (psource)); g_object_set (priv->base_model, "show-hidden", TRUE, NULL); g_object_ref (priv->base_model); g_signal_connect_object (priv->base_model, "filter-entry-drop", G_CALLBACK (rb_static_playlist_source_filter_entry_drop), source, 0); priv->paned = gtk_vpaned_new (); g_object_get (source, "shell", &shell, NULL); priv->action_group = _rb_display_page_register_action_group (RB_DISPLAY_PAGE (source), "StaticPlaylistActions", NULL, 0, shell); if (gtk_action_group_get_action (priv->action_group, rb_static_playlist_source_radio_actions[0].name) == NULL) { gtk_action_group_add_radio_actions (priv->action_group, rb_static_playlist_source_radio_actions, G_N_ELEMENTS (rb_static_playlist_source_radio_actions), 0, NULL, NULL); rb_source_search_basic_create_for_actions (priv->action_group, rb_static_playlist_source_radio_actions, G_N_ELEMENTS (rb_static_playlist_source_radio_actions)); } priv->default_search = rb_source_search_basic_new (RHYTHMDB_PROP_SEARCH_MATCH); g_object_unref (shell); g_object_get (source, "entry-type", &entry_type, NULL); priv->browser = rb_library_browser_new (rb_playlist_source_get_db (RB_PLAYLIST_SOURCE (source)), entry_type); if (entry_type != NULL) { g_object_unref (entry_type); } gtk_paned_pack1 (GTK_PANED (priv->paned), GTK_WIDGET (priv->browser), TRUE, FALSE); g_signal_connect_object (priv->browser, "notify::output-model", G_CALLBACK (rb_static_playlist_source_browser_changed_cb), source, 0); rb_library_browser_set_model (priv->browser, priv->base_model, FALSE); rb_static_playlist_source_do_query (source); /* reparent the entry view */ songs = rb_source_get_entry_view (RB_SOURCE (source)); g_object_ref (songs); gtk_container_remove (GTK_CONTAINER (source), GTK_WIDGET (songs)); gtk_paned_pack2 (GTK_PANED (priv->paned), GTK_WIDGET (songs), TRUE, FALSE); gtk_container_add (GTK_CONTAINER (source), priv->paned); rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (songs), priv->paned, GTK_WIDGET (priv->browser)); g_object_unref (songs); /* watch these to find out when things are dropped into the entry view */ g_signal_connect_object (priv->base_model, "row-inserted", G_CALLBACK (rb_static_playlist_source_row_inserted), source, 0); g_signal_connect_object (priv->base_model, "non-entry-dropped", G_CALLBACK (rb_static_playlist_source_non_entry_dropped), source, 0); g_signal_connect_object (priv->base_model, "rows-reordered", G_CALLBACK (rb_static_playlist_source_rows_reordered), source, 0); gtk_widget_show_all (GTK_WIDGET (source)); }
static GList * default_copy (RBSource *source) { return rb_entry_view_get_selected_entries (rb_source_get_entry_view (source)); }