[Rhythmbox-devel] Get a list of sources

Hi everybody, due to recent changes in rhythmbox 0.13 I've lost the ability of getting a list of registered sources in my rhytmweb plugin, it appears that the shell property sourcelist_model has simply dissapeared.

This is what I was doing:


    def get_sourcelist(self):
        index = 0
        sources = []
        for sourcelist in self.shell.props.sourcelist_model:
            category = sourcelist[RB_SOURCELIST_MODEL_COLUMN_GROUP_CATEGORY]
            if category == rb.SOURCE_GROUP_CATEGORY_PERSISTENT or \
                    category == rb.SOURCE_GROUP_CATEGORY_REMOVABLE:
                for playlist in sourcelist.iterchildren():
                    sources.append(RBSource(index, playlist, SOURCETYPE_PLAYLIST))
                    index += 1
            elif category == rb.SOURCE_GROUP_CATEGORY_FIXED:
                for source in sourcelist.iterchildren():
                    if all_sources:
                        sources.append(RBSource(index, source, SOURCETYPE_SOURCE))
                    index += 1
        return sources

# Just to show how the source is returned

class RBSource():
    Source wrapper
    def __init__(self, index, entry, source_type):
        self.id = index
        self.index = index
        self.source_type = source_type
        self.is_playing = entry[RB_SOURCELIST_MODEL_COLUMN_PLAYING]
        self.pixbuf = entry[RB_SOURCELIST_MODEL_COLUMN_PIXBUF]
        self.name = entry[RB_SOURCELIST_MODEL_COLUMN_NAME]
        self.source = entry[RB_SOURCELIST_MODEL_COLUMN_SOURCE]
        self.attributes = entry[RB_SOURCELIST_MODEL_COLUMN_ATTRIBUTES]
        self.visibility = entry[RB_SOURCELIST_MODEL_COLUMN_VISIBILITY]
        self.is_group = entry[RB_SOURCELIST_MODEL_COLUMN_IS_GROUP]
        self.group_category = entry[RB_SOURCELIST_MODEL_COLUMN_GROUP_CATEGORY]
        self.query_model = self.source.props.query_model


Can anyone  give me a direction to go on how to do this in rhythmbox 0.13? It was working ok in 0.11 at least.

Best regards

Pablo Carranza

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]