RBSource * rb_generic_player_playlist_source_new (RBShell *shell, RBGenericPlayerSource *player_source, const char *playlist_file, const char *device_root, RhythmDBEntryType entry_type) { RBSource *source; source = RB_SOURCE (g_object_new (RB_TYPE_GENERIC_PLAYER_PLAYLIST_SOURCE, "shell", shell, "is-local", FALSE, "entry-type", entry_type, "source-group", RB_SOURCE_GROUP_DEVICES, "player-source", player_source, "playlist-path", playlist_file, "device-root", device_root, NULL)); if (load_playlist (RB_GENERIC_PLAYER_PLAYLIST_SOURCE (source)) == FALSE) { rb_debug ("playlist didn't parse; killing the source"); if (g_object_is_floating (source)) g_object_ref_sink (source); g_object_unref (source); return NULL; } return source; }
static void load_playlist_file (RBGenericPlayerSource *source, const char *playlist_path, const char *rel_path) { RhythmDBEntryType entry_type; RBGenericPlayerPlaylistSource *playlist; RBShell *shell; char *mount_path; g_object_get (source, "shell", &shell, "entry-type", &entry_type, NULL); mount_path = rb_generic_player_source_get_mount_path (source); rb_debug ("loading playlist %s", playlist_path); playlist = RB_GENERIC_PLAYER_PLAYLIST_SOURCE ( rb_generic_player_playlist_source_new (shell, source, playlist_path, mount_path, entry_type)); if (playlist != NULL) { rb_generic_player_source_add_playlist (source, shell, RB_SOURCE (playlist)); } g_boxed_free (RHYTHMDB_TYPE_ENTRY_TYPE, entry_type); g_object_unref (shell); g_free (mount_path); }
static void rb_generic_player_plugin_delete_playlist (GtkAction *action, RBSource *source) { g_return_if_fail (RB_IS_GENERIC_PLAYER_PLAYLIST_SOURCE (source)); rb_generic_player_playlist_delete_from_player (RB_GENERIC_PLAYER_PLAYLIST_SOURCE (source)); rb_source_delete_thyself (source); }
static void impl_remove_playlists (RBMediaPlayerSource *source) { RBGenericPlayerSourcePrivate *priv = GET_PRIVATE (source); GList *playlists; GList *t; playlists = g_list_copy (priv->playlists); for (t = playlists; t != NULL; t = t->next) { RBGenericPlayerPlaylistSource *p = RB_GENERIC_PLAYER_PLAYLIST_SOURCE (t->data); rb_generic_player_playlist_delete_from_player (p); rb_display_page_delete_thyself (RB_DISPLAY_PAGE (p)); } g_list_free (playlists); }
static void impl_dispose (GObject *object) { RBGenericPlayerPlaylistSourcePrivate *priv = GET_PRIVATE (object); if (priv->save_playlist_id != 0) { g_source_remove (priv->save_playlist_id); save_playlist (RB_GENERIC_PLAYER_PLAYLIST_SOURCE (object)); } if (priv->player_source != NULL) { g_object_unref (priv->player_source); priv->player_source = NULL; } G_OBJECT_CLASS (rb_generic_player_playlist_source_parent_class)->dispose (object); }
static GObject * impl_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties) { RBGenericPlayerPlaylistSource *source; source = RB_GENERIC_PLAYER_PLAYLIST_SOURCE (G_OBJECT_CLASS (rb_generic_player_playlist_source_parent_class) -> constructor (type, n_construct_properties, construct_properties)); if (load_playlist (source) == FALSE) { rb_debug ("playlist didn't parse; killing the source"); if (g_object_is_floating (source)) g_object_ref_sink (source); g_object_unref (source); return NULL; } return G_OBJECT (source); }