Browse Source

desktop files that specify an absolute path to an icon will use

that path, rather than stripping the path and trying to find a
matching icon. This allows for applications that use an icon in a
non-standard directory.
pull/1/merge
Jeff Woods 12 years ago
parent
commit
bad018f59a
  1. 30
      src/xdgmenumaker

30
src/xdgmenumaker

@ -108,18 +108,24 @@ class MenuEntry:
return repr((self.category, self.name, self.icon, self.command)) return repr((self.category, self.name, self.icon, self.command))
def icon_full_path(icon): def icon_full_path(icon):
icon = os.path.basename(icon) # If the icon path is absolute and exists, leave it alone.
if icon.endswith('.png'): # This takes care of software that has its own icons stored
icon = icon.replace('.png', '') # in non-standard directories
elif icon.endswith('.svg'): if os.path.exists(icon) == True:
icon = icon.replace('.svg', '') return icon
elif icon.endswith('.xpm'): else:
icon = icon.replace('.xpm', '') icon = os.path.basename(icon)
icon_theme = gtk.icon_theme_get_default() if icon.endswith('.png'):
icon = icon_theme.lookup_icon(icon, 16, gtk.ICON_LOOKUP_NO_SVG) icon = icon.replace('.png', '')
if icon: elif icon.endswith('.svg'):
icon = icon.get_filename() icon = icon.replace('.svg', '')
return icon elif icon.endswith('.xpm'):
icon = icon.replace('.xpm', '')
icon_theme = gtk.icon_theme_get_default()
icon = icon_theme.lookup_icon(icon, 16, gtk.ICON_LOOKUP_NO_SVG)
if icon:
icon = icon.get_filename()
return icon
def get_entry_info(desktopfile): def get_entry_info(desktopfile):
global desktop global desktop

Loading…
Cancel
Save