Comment 4 for bug 877044

Revision history for this message
secretrobotron (secretrobotron) wrote :

Same problem here. Did a whole bunch of debugging this morning.

Apparently, gtk hates your signals because they're not specific enough. I changed the __gsignals__ dict in widgets/launcherview.py's LauncherView to this:

@@@
    __gsignals__ = {
                    "selection-changed" : (gobject.SIGNAL_RUN_LAST,
                                           gobject.TYPE_NONE,
                                           (gtk.ListStore,
                                            gtk.TreeIter,
                                            gobject.TYPE_OBJECT),),
@@@

That got things working a little better, but another error occured where the object emitted from the "selection-changed" signal is None. This problem stems from the "add_row" function in LauncherView where "new_iter = self.listmodel.append(row_data)" ever successfully executes because of a problem similar to the one above: the type of DesktopParser is wrong (not inherited from a GObject).

So, I created a very simple wrapper in core/desktop.py:
@@@
class DesktopParserWrapper(gobject.GObject):
    def __init__(self, parser):
        self._parser = parser
        gobject.GObject.__init__(self)
@@@

Problem almost solved. The only thing left is to change the LauncherView's listmodel to
@@@
        self.listmodel = gtk.ListStore(Pixbuf,
                              gobject.TYPE_STRING,
                              gobject.TYPE_OBJECT,
                              gobject.TYPE_STRING,
                              gobject.TYPE_STRING
                              )
@@@

and to change every call to "add_row" to use a DesktopParserWrapper instead of a DesktopParser. This last change is why I'm not just submitting a patch. There's simply too many of these and I don't know how the entirety of the program will react when I change them all.

In general, I have no idea why all of this change is required. Did GTK get a whole bunch more specific recently? gtk.ListStore seems to act... however it wants. I would guess that a gobject.TYPE_PYOBJECT would be fine for passing a DesktopParser, but, apparently it's not.

Some or all of this work may be unnecessary. This is just the result of my endless struggle with unity's launcher.