Bonobo was a component model for creating reusable software components and compound documents in GNOME 2. Bonobo was deprecated in both MATE and GNOME 3 (officially deprecated in GNOME 2.4) and MATE for the sake of backwards compatibility implemented their version of Bonobo which was a short lived stop gap to allow panel apps in MATE to continue functioning while the MATE developers to move the new D-BUS implementation via GSettings/DBUS. To understand how much this changes things you need to understand that syntax is vital in programming. The switch from Bonobo to DBUS changes not only the command and calls but the syntax as well. As an example here is piece of code used in MNWMenu.py that needs to redone to use Gsettings/DBUS:
import gtk
import pygtk
pygtk.require('2.0')
import commands
import sys
import gobject
try:
import mateapplet
except:
from gi.repository import MatePanelApplet as mateapplet
import os
if not os.path.exists(os.path.expanduser("~") + '/.mnwmenu') or not os.path.isdir(os.path.expanduser("~") + '/.mnwmenu'):
os.system('mkdir ~/.mnwmenu')
import gconf
Now here is an example of code that performs this same base function with the new syntax:
import gi
gi.require_version("Gtk", "2.0")
from gi.repository import Gtk
from gi.repository import MatePanelApplet
def applet_fill(applet):
# you can use this path with gio/gsettings
settings_path = applet.get_preferences_path()
label = Gtk.Label("My MATE applet in Python")
applet.add(label)
applet.show_all()
def applet_factory(applet, iid, data):
if iid != "TestApplet":
return False
applet_fill(applet)
return True
MatePanelApplet.Applet.factory_main("TestAppletFactory", True,
MatePanelApplet.Applet.__gtype__,
applet_factory, None)
Though this is not a pure function to function or process to process example it shows how the syntax has changed. Not all syntax changes can be attributed to the change from Bonobo to D-BUS either as Python also has had some changes to its base syntax as well.
I'm just learning Python and haven't written a program in years in any computer language. Beyond shell scripting and some HTML CSS stuff I really haven't kept up with it. Even with shell scripts like pygi-mate-convert.sh to help convert the Python code, because of the changes in the syntax structure, that are required, I quickly realized I am going to have rewrite nearly all of the modules from GnoMenu from scratch to comply with syntax structure and ensure that the proper commands and functions are used. I contacted Helder Fraga and unfortunately he no longer has any notes on GnoMenu, which means (drum roll please) I'm going to have to reverse engineer the GnoMenu code (which means creating lots of flow charts) so I can recreate the app.
You can bet you A$$ there will be follow ups to this Post.
No comments:
Post a Comment