Place this file in the same directory as the changer script and run patch -p0 < changer.txt *** changer 2006-10-26 22:59:52.000000000 +0200 --- changer2 2007-01-15 17:49:05.000000000 +0100 *************** *** 2,5 **** --- 2,6 ---- from xml.dom import minidom + from sys import exit import gconf import os *************** *** 9,21 **** def decodeWP(node): ! results = {} ! for value in node.childNodes: ! if value.nodeType==1: ! ndata = '' ! for val in value.childNodes: ! if val.nodeType==3: # TEXT_NODE ! ndata = ndata + val.data ! results[value.tagName] = ndata ! return results; settings = os.path.expanduser('~') + '/.gnome2/backgrounds.xml' --- 10,26 ---- def decodeWP(node): ! if node.hasAttribute( "deleted" ) and node.getAttribute( "deleted" ) == "true": ! return None ! results = {} ! for value in node.childNodes: ! if value.nodeType==1: ! ndata = '' ! for val in value.childNodes: ! if val.nodeType==3: # TEXT_NODE ! ndata = ndata + val.data ! results[value.tagName] = ndata ! if results["name"] == "No Wallpaper": ! return None ! return results; settings = os.path.expanduser('~') + '/.gnome2/backgrounds.xml' *************** *** 24,33 **** wallpapers = []; for child in xmldoc.childNodes: ! if child.nodeType==1: ! if child.tagName=='wallpapers': ! for wp in child.childNodes: ! if wp.nodeType==1: ! if wp.tagName=='wallpaper': ! wallpapers.append(decodeWP(wp)) random.seed() --- 29,42 ---- wallpapers = []; for child in xmldoc.childNodes: ! if child.nodeType==1: ! if child.tagName=='wallpapers': ! for wp in child.childNodes: ! if wp.nodeType==1: ! if wp.tagName=='wallpaper': ! w = decodeWP(wp) ! if w: ! wallpapers.append(w) ! if wallpapers == []: ! exit() random.seed() *************** *** 38,42 **** gs = '/desktop/gnome/background/' ! print 'Setting background to: ' + wp['name'] changeSet.set_string(gs + 'picture_filename', wp['filename']) changeSet.set_string(gs + 'picture_options', wp['options']) --- 47,51 ---- gs = '/desktop/gnome/background/' ! #print 'Setting background to: ' + wp['name'] changeSet.set_string(gs + 'picture_filename', wp['filename']) changeSet.set_string(gs + 'picture_options', wp['options'])