Browse Source

Remove deprecated pygtkcompat

Fixes #32
master 2.4
George Vlahavas 3 months ago
parent
commit
7ff68163d1
  1. 16
      src/xdgmenumaker

16
src/xdgmenumaker

@ -13,11 +13,9 @@ from operator import attrgetter
import configparser as cp import configparser as cp
# Load the gtk compatibility layer import gi
from gi import pygtkcompat gi.require_version('Gtk', '3.0')
pygtkcompat.enable() from gi.repository import Gtk, Gdk
pygtkcompat.enable_gtk(version='3.0')
import gtk
xopts = { xopts = {
'seticon': False, 'seticon': False,
@ -303,14 +301,16 @@ def icon_full_path(icon):
return icon return icon
# fall back to looking for the icon elsewhere in the system # fall back to looking for the icon elsewhere in the system
icon = icon_strip(icon) icon = icon_strip(icon)
icon_theme = gtk.icon_theme_get_default() icon_theme = Gtk.IconTheme.get_default()
try: try:
# Only some WMs support svg icons # Only some WMs support svg icons
if wm_supports_icons(xopts['desktop']) and not xopts['nosvg']: if wm_supports_icons(xopts['desktop']) and not xopts['nosvg']:
icon = icon_theme.lookup_icon(icon, xopts['iconsize'], gtk.ICON_LOOKUP_FORCE_SVG) icon = icon_theme.lookup_icon(icon, xopts['iconsize'],
Gtk.IconLookupFlags.FORCE_SVG)
# but none of the other WMs does # but none of the other WMs does
else: else:
icon = icon_theme.lookup_icon(icon, xopts['iconsize'], gtk.ICON_LOOKUP_NO_SVG) icon = icon_theme.lookup_icon(icon, xopts['iconsize'],
Gtk.IconLookupFlags.NO_SVG)
except AttributeError: except AttributeError:
sys.exit('ERROR: You need to run xdgmenumaker inside an X session.') sys.exit('ERROR: You need to run xdgmenumaker inside an X session.')
if icon: if icon:

Loading…
Cancel
Save