[Rhythmbox-devel] Plugin Writing: Convert gpointer to gslist and iterate



Hello Rhythmbox developers,

I'm trying to write a plugin for Rhythmbox that should listen to the
signal 'entry-changed'. If the signal occurs it should check the list of
changes and if a certain prop has changed it should do something. 

I'm not any familiar with Python. This is the first time I'm doing some
Python programming. I read what I could find in the devel reference
manual and plugin writing guides especially

http://library.gnome.org/devel/rhythmbox/0.12/RhythmDB.html#RhythmDB-entry-changed

I played around with it but it didn't work yet and now I'm stuck. I
don't know how to convert the gpointer 'changes' to a GSList and after
that how to iterate through the list entries and do stuff with them. 

Here is what I got:

def connect_signals(self):
    self.db_cbs = (self.db.connect('entry-added', self.entry_added_cb), 
              self.db.connect('entry-changed', self.entry_changed_cb))

def disconnect_signals(self):
    for db_cb in self.db_cbs:
        self.db.disconnect(db_cb)
    self.db_cbs = None

def entry_changed_cb(self, user_data, entry, changes):
    # if some_certain_props_have_changed:
        self.do_some_stuff_with(entry)
    # else: do nothing

Can somebody tell me how to make that if part work? Again: I started to
learn Python 3 days ago, please keep it as simple as possible :-)

Kind regards,
Oliver

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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