static void prepare_source (RBMtpSource *source, const char *stream_uri, GObject *src) { RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source); RhythmDBEntry *entry; RhythmDB *db; /* make sure this stream is for a file on our device */ if (g_str_has_prefix (stream_uri, "xrbmtp://") == FALSE) return; db = get_db_for_source (source); entry = rhythmdb_entry_lookup_by_location (db, stream_uri); g_object_unref (db); if (entry == NULL) return; if (_rb_source_check_entry_type (RB_SOURCE (source), entry) == FALSE) { rhythmdb_entry_unref (entry); return; } rb_debug ("setting device-thread for stream %s", stream_uri); g_object_set (src, "device-thread", priv->device_thread, NULL); rhythmdb_entry_unref (entry); }
static void rb_static_playlist_source_add_location_internal (RBStaticPlaylistSource *source, const char *location, gint index) { RhythmDB *db; RhythmDBEntry *entry; RBPlaylistSource *psource = RB_PLAYLIST_SOURCE (source); if (rb_playlist_source_location_in_map (psource, location)) return; db = rb_playlist_source_get_db (psource); entry = rhythmdb_entry_lookup_by_location (db, location); if (entry) { RBStaticPlaylistSourcePrivate *priv = RB_STATIC_PLAYLIST_SOURCE_GET_PRIVATE (source); if (_rb_source_check_entry_type (RB_SOURCE (source), entry)) { rhythmdb_entry_ref (entry); rhythmdb_query_model_add_entry (priv->base_model, entry, index); rhythmdb_entry_unref (entry); } } rb_playlist_source_add_to_map (psource, location); rb_playlist_source_mark_dirty (psource); }
static gboolean rb_static_playlist_source_filter_entry_drop (RhythmDBQueryModel *model, RhythmDBEntry *entry, RBStaticPlaylistSource *source) { if (_rb_source_check_entry_type (RB_SOURCE (source), entry)) { rb_debug ("allowing drop of entry %s", rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION)); return TRUE; } rb_debug ("preventing drop of entry %s", rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION)); return FALSE; }
static GValue * album_artist_sortname_metadata_request_cb (RhythmDB *db, RhythmDBEntry *entry, RBAudioCdSource *source) { RBAudioCdSourcePrivate *priv = AUDIOCD_SOURCE_GET_PRIVATE (source); GValue *value = NULL; if (_rb_source_check_entry_type (RB_SOURCE (source), entry) == FALSE) { return NULL; } if (gtk_entry_get_text_length (GTK_ENTRY (priv->artist_sort_entry)) > 0) { value = g_new0 (GValue, 1); g_value_init (value, G_TYPE_STRING); g_value_set_string (value, gtk_entry_get_text (GTK_ENTRY (priv->artist_sort_entry))); } return value; }
static void rb_playlist_source_entry_added_cb (RhythmDB *db, RhythmDBEntry *entry, RBPlaylistSource *source) { RBRefString *location; location = rhythmdb_entry_get_refstring (entry, RHYTHMDB_PROP_LOCATION); if (g_hash_table_lookup (source->priv->entries, location)) { if (_rb_source_check_entry_type (RB_SOURCE (source), entry)) { rhythmdb_query_model_add_entry (source->priv->model, entry, -1); source->priv->dirty = TRUE; } else { g_hash_table_remove (source->priv->entries, location); } } rb_refstring_unref (location); }
static void metadata_gather_cb (RhythmDB *db, RhythmDBEntry *entry, RBStringValueMap *data, RBAudioCdSource *source) { RBAudioCdSourcePrivate *priv = AUDIOCD_SOURCE_GET_PRIVATE (source); GValue value = {0,}; if (_rb_source_check_entry_type (RB_SOURCE (source), entry) == FALSE) { return; } if (gtk_entry_get_text_length (GTK_ENTRY (priv->artist_entry)) > 0) { g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, gtk_entry_get_text (GTK_ENTRY (priv->artist_entry))); rb_string_value_map_set (data, RHYTHMDB_PROP_ALBUM_ARTIST, &value); g_value_unset (&value); } if (gtk_entry_get_text_length (GTK_ENTRY (priv->artist_sort_entry)) > 0) { g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, gtk_entry_get_text (GTK_ENTRY (priv->artist_sort_entry))); rb_string_value_map_set (data, RHYTHMDB_PROP_ALBUM_ARTIST_SORTNAME, &value); g_value_unset (&value); } }