Friday, September 4, 2015

Well as the saying goes anything worth doing will not come without challenges. Case in point is bringing back the abilities of GnoMenu, which was originally made to work with Gnome 2 to MATE which is a continuation of the afore mentioned Gnome 2. Now oddly enough the challenge is caused by the deprecation of the one thing that caused the GnoMenu the most issues, Bonobo.

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.

Catastrophe in the making

Follow by RSS Feed

Proud Navy Veteran

Search This Blog

About Me

Not so typical guy in a all to typical world fighting a personal battle with life, others who think they have a right to control me (NOPE) and idiots in general. Not timid but quiet. Not brash but bold. Not one you would understand immediately or why I allow my life to be the way it is at any given moment. My reasons are my own and unless you really know me you can't understand, even then it will most likely confuse you.I simply am not someone who can be molded into another's ideals or desire