So, I am trying to port the C GNOME applet to MATE, and faced with many different problems, I decided to rewrite it from scratch to python. In the end, I found the not-so-terribly outdated documentation, which is located here: http://wiki.mate-desktop.org/docs:devel:mate-panel
Apparently, the new way to write applets in python is to use the introspection of PyGObject, rather than the "old" PyGtk.
So, I have a few questions:
1. Why is it better to use PyGObject instead of PyGtk etc 2. Is the end user who downloads a python applet expected to have pygobject installed? It looks like it. 3. The MATE documentation says 'ensure we are using Gtk 2, not Gtk3', but http://python-gtk-3-tutorial.readthedocs.org/en/latest/install.html says that its exclusively supports Gtk+ 3 and higher.
EDIT: If I run
import gi gi.require_version("Gtk", "2.0")
in a python session, I get a warning:
RuntimeWarning: You have imported the Gtk 2.0 module. Because Gtk 2.0 was not designed for use with introspection some of the interfaces and API will fail. As such this is not supported by the pygobject development team and we encourage you to port your app to Gtk 3 or greater. PyGTK is the recomended python module to use with Gtk 2.0
Which pretty much answers question 3, but then raises question 1. Again, running from gi.repository import MatePanelApplet gives ImportError Could not find any typelib for MatePanelApplet , although I have libmatepanelapplet-dev installed.
EDIT AGAIN: I found a solution for ImportError here: Unable to import Webkit from gi.repository . (Just install gir1.2-mate-panel instead of webkit)
And more errors:
./xmonad-log-applet.py:66: Warning: g_closure_set_marshal: assertion `closure != NULL' failed applet = MatePanelApplet.Applet() (xmonad-log-applet.py:10928): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion `G_IS_DBUS_CONNECTION (connection)' failed Segmentation fault (core dumped)