Archive for July, 2006

Gnome Deskbar Bookmarks

2006-07-10

Unlike Chris I found that the new
gnome deskbar was not that helpful to me. I was missing the firefox
bookmarks and shortcuts in particular. Reading
Peter‘s blog he had originally found
the same but after making a tweak with gconf-editor he found most
functionality was restored. Alas not so easy for me…

After a little hunting I find that deskbar is a Python script
/usr/lib/deskbar-applet/deskbar-applet which excepts option ‘-w’
which enables me to “Launch the applet in a standalone window for test
purposes”.

Executing deskbar-applet with -w option one quickly learns that it
loads extensions from ~/.gnome2/deskbar-applet/handlers/ and
/usr/lib/deskbar-applet/handlers/. Each module is loaded and handlers
are initialised. As I’m only interested in debugging ‘web bookmarks’
I disabled the other extensions from the deskbar-applet preferences,
exited applet and copied the interested party to my own directory.

$ cd /usr/lib/deskbar-applet
$ cp handlers/mozilla.py ~/.gnome2/deskbar-applet/handlers
$ /usr/bin/python ./deskbar-applet -w
Running installed deskbar, using [/usr/lib/python2.4/vendor-packages/deskbar:$PYTHONPATH]
Data Dir: /usr/share/deskbar-applet
Handlers Dir: ['/home/sjm/.gnome2/deskbar-applet/handlers', '/usr/lib/deskbar-applet/handlers']
/usr/lib/python2.4/vendor-packages/deskbar/DeskbarApplet.py:10:
DeprecationWarning: Non-ASCII character '\xc2' in file /usr/lib/python2.4/vendor-packages/deskbar/ui/About.py
on line 26, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details from deskbar.ui.About import show_about Binding Global shortcut ‹Alt›F3 to focus the deskbar Unable to set processName Starting Deskbar instance: ‹gnome.applet.Applet object (PanelApplet) at 0x5aa260› None Traceback (most recent call last): File "/usr/lib/python2.4/vendor-packages/deskbar/Watcher.py", line 28, in add self.watched[name] = gnomevfs.monitor_add(name, self.monitor_type, self._on_change)

NotSupportedError: Unsupported operation Traceback (most recent call last): File "/usr/lib/python2.4/vendor-packages/deskbar/Watcher.py", line 28, in add self.watched[name] = gnomevfs.monitor_add(name, self.monitor_type, self._on_change) NotSupportedError: Unsupported operation esd: Esound sound daemon unable to create unix domain socket: /tmp/.esd/30/socket The socket is not accessible by esd. Exiting... Loading module 'SSH' from file /home/sjm/.gnome2/deskbar-applet/handlers/ssh.py. Loading module 'Del.icio.us Search' from file /home/sjm/.gnome2/deskbar-applet/handlers/delicious-deskbar.py. Loading module 'Web Searches' from file /home/sjm/.gnome2/deskbar-applet/handlers/mozilla.py. Loading module 'Web History' from file /home/sjm/.gnome2/deskbar-applet/handlers/mozilla.py. Loading module 'Web Bookmarks' from file /home/sjm/.gnome2/deskbar-applet/handlers/mozilla.py. *** ....

Having never looked at Python code before I was pleased to find
‘print’ 😉 Diligently I placed a few ‘print “DEBUG: Method: Value”,
variable’ statements and rerun where upon I got the following output:

Initializing Web Bookmarks
DEBUG: get_firefox_home_file: reading /home/sjm/.mozilla/firefox/profiles.ini
DEBUG: get_firefox_home_file: checking section:  Profile2
DEBUG: get_firefox_home_file: checking section:  Profile1
DEBUG: get_firefox_home_file: checking section:  Profile0
DEBUG: get_firefox_home_file: checking section:  General
DEBUG: get_firefox_home_file: path  ghogpt3y.VNC
DEBUG: _parse_bookmarks returned
/home/sjm/.mozilla/firefox/ghogpt3y.VNC/bookmarks.html

It is using my VNC bookmarks and not my default bookmarks which it should from my cursory review of the source; as shown here:

$ cat -n .gnome2/deskbar-applet/handlers/mozilla.py | head -45 | tail
36          config.read(expanduser(join(firefox_dir, "profiles.ini")))
37          print "DEBUG: get_firefox_home_file: reading", join(firefox_dir, "profiles.ini")
38          path = None
39
40          for section in config.sections():
41                  print "DEBUG: get_firefox_home_file: checking section: ", section
42                  if config.get (section, "Default") == 1:
43                          path = config.get (section, "Path")
44                          print "DEBUG: get_firefox_home_file: default found ***"
45                          break

A quick little patch, and all is well 🙂

$ diff handlers/mozilla.py ~/.gnome2/deskbar-applet/handlers/mozilla.py
40c40
               if config.get (section, "Default") == "1":

Logged as CR 6447265.

Stace

Technorati: