awn-core team mailing list archive
-
awn-core team
-
Mailing list archive
-
Message #00002
[patch] Make awn-settings compatible
Hello,
here a patch making awn-settings compatible with dockmanager scripts.
Dockmanagers scripts find items with desktop file name. (name ends with
amarok.desktop for exemple)
So, as awn-settings when editing launchers change their name to
awn_launcher-?.desktop, it make dockmanager fail as soon as an item is edited.
This patch make awn-settings use original desktop file name instead of creating
an awn_launcher one.
For code simplification, i choose to prefix awn_launchers (created by hand) so
you have 1-awn_launchers.desktop.
What do you think about this patch ?
Regards,
--
Cédric
http://identi.ca/gnumdk
=== modified file 'awn-settings/awnClass.py'
--- awn-settings/awnClass.py 2011-02-13 23:43:42 +0000
+++ awn-settings/awnClass.py 2011-04-23 16:07:20 +0000
@@ -1156,9 +1156,9 @@
# Copyright (C) 2006 Travis Watkins
# Edited by Ryan Rushton
- def create_unique_launcher_file(self):
+ def create_unique_launcher_file(self, basename):
path = os.path.join(defs.HOME_LAUNCHERS_DIR,
- self.getUniqueFileId('awn_launcher', '.desktop'))
+ self.getUniqueFileId(basename))
return vfs.File.for_path(path)
def edit(self, button):
@@ -1169,7 +1169,7 @@
if vfile.is_writable():
output = None
else:
- output = self.create_unique_launcher_file()
+ output = self.create_unique_launcher_file(os.path.basename(path))
editor = LauncherEditorDialog(vfile, output)
editor.show_all()
response = editor.run()
@@ -1182,7 +1182,7 @@
def add(self, button):
selection = self.treeview_launchers.get_selection()
(model, iter) = selection.get_selected()
- vfile = self.create_unique_launcher_file()
+ vfile = self.create_unique_launcher_file('awn_launcher.desktop')
editor = LauncherEditorDialog(vfile, None)
editor.show_all()
response = editor.run()
@@ -1203,16 +1203,15 @@
self.client_taskman.set_list(GROUP_DEFAULT, defs.LAUNCHERS_LIST, paths)
self.refresh_tree(paths, model)
- def getUniqueFileId(self, name, extension):
+ def getUniqueFileId(self, name):
append = 0
while 1:
if append == 0:
- filename = name + extension
+ filename = name
else:
- filename = name + '-' + str(append) + extension
- if extension == '.desktop':
- if not os.path.isfile(os.path.join(defs.HOME_LAUNCHERS_DIR, filename)):
- break
+ filename = str(append) + '-' + name
+ if not os.path.isfile(os.path.join(defs.HOME_LAUNCHERS_DIR, filename)):
+ break
append += 1
return filename