From 8ff835556e10253d7661b2d9ad47062c1ff8884e Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 2 Aug 2015 06:20:53 +0200 Subject: [PATCH] Additional windows icon loading works better, and respect the theme changes. --- terminatorlib/layoutlauncher.py | 12 ++++++------ terminatorlib/plugins/custom_commands.py | 14 +++++++------- terminatorlib/prefseditor.py | 12 ++++++------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/terminatorlib/layoutlauncher.py b/terminatorlib/layoutlauncher.py index 8ea5bba5..3ae727bb 100755 --- a/terminatorlib/layoutlauncher.py +++ b/terminatorlib/layoutlauncher.py @@ -46,13 +46,13 @@ class LayoutLauncher: self.builder.add_from_string(gladedata) self.window = self.builder.get_object('layoutlauncherwin') - icon_theme = gtk.IconTheme() - try: - icon = icon_theme.load_icon('terminator-layout', 48, 0) - except (NameError, gobject.GError): - dbg('Unable to load 48px Terminator preferences icon') + icon_theme = gtk.icon_theme_get_default() + if icon_theme.lookup_icon('terminator-layout', 48, 0): + self.window.set_icon_name('terminator-layout') + else: + dbg('Unable to load Terminator layout launcher icon') icon = self.window.render_icon(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON) - self.window.set_icon(icon) + self.window.set_icon(icon) self.builder.connect_signals(self) self.window.connect('destroy', self.on_destroy_event) diff --git a/terminatorlib/plugins/custom_commands.py b/terminatorlib/plugins/custom_commands.py index eff7c6e7..fccb89a0 100755 --- a/terminatorlib/plugins/custom_commands.py +++ b/terminatorlib/plugins/custom_commands.py @@ -71,7 +71,7 @@ class CustomCommandsMenu(plugin.MenuItem): menuitem = gtk.SeparatorMenuItem() submenu.append(menuitem) - theme = gtk.IconTheme() + theme = gtk.icon_theme_get_default() for command in [ self.cmd_list[key] for key in sorted(self.cmd_list.keys()) ] : if not command['enabled']: continue @@ -126,13 +126,13 @@ class CustomCommandsMenu(plugin.MenuItem): ) ) - icon_theme = gtk.IconTheme() - try: - icon = icon_theme.load_icon('terminator-custom-commands', 48, 0) - except (NameError, gobject.GError): - dbg('Unable to load 48px Terminator preferences icon') + icon_theme = gtk.icon_theme_get_default() + if icon_theme.lookup_icon('terminator-custom-commands', 48, 0): + dbox.set_icon_name('terminator-custom-commands') + else: + dbg('Unable to load Terminator custom command icon') icon = dbox.render_icon(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON) - dbox.set_icon(icon) + dbox.set_icon(icon) store = gtk.ListStore(bool, str, str) diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 1c3ce964..c3f8900f 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -172,13 +172,13 @@ class PrefsEditor: self.builder.add_from_string(gladedata) self.window = self.builder.get_object('prefswin') - icon_theme = gtk.IconTheme() - try: - icon = icon_theme.load_icon('terminator-preferences', 48, 0) - except (NameError, gobject.GError): - dbg('Unable to load 48px Terminator preferences icon') + icon_theme = gtk.icon_theme_get_default() + if icon_theme.lookup_icon('terminator-preferences', 48, 0): + self.window.set_icon_name('terminator-preferences') + else: + dbg('Unable to load Terminator preferences icon') icon = self.window.render_icon(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON) - self.window.set_icon(icon) + self.window.set_icon(icon) self.layouteditor = LayoutEditor(self.builder) self.builder.connect_signals(self)