Skip to content

Commit

Permalink
Fix broken icons on non-GNOME desktops
Browse files Browse the repository at this point in the history
  • Loading branch information
tagoh committed Nov 24, 2012
1 parent 10f2116 commit 70e35ab
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fontstweak/aliasui.py
Expand Up @@ -50,6 +50,13 @@ def __init__(self, config, builder, parent):
self.view_list = builder.get_object('alias-lang-list')
self.filter = builder.get_object('checkbutton-filter')
self.localized_name = builder.get_object('checkbutton-localized-name')

# check if current icon theme supports the symbolic icons
add_icon = builder.get_object('toolbutton-add-alias-lang')
add_icon.set_icon_name(FontsTweakUtil.check_symbolic(add_icon.get_icon_name()))
del_icon = builder.get_object('toolbutton-remove-alias-lang')
del_icon.set_icon_name(FontsTweakUtil.check_symbolic(del_icon.get_icon_name()))

try:
Easyfc.version()
if len(Easyfc.Font.get_list('en', 'sans-serif', False)) == 0:
Expand Down
5 changes: 5 additions & 0 deletions fontstweak/chooserui.py
Expand Up @@ -18,6 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from util import FontsTweakUtil

class ChooserUI:

def __init__(self, builder, model, filter_func):
Expand All @@ -30,6 +32,9 @@ def __init__(self, builder, model, filter_func):
self.view.set_model(self.filtered_model)
self.add = builder.get_object('button-add')

self.filter.set_property('secondary-icon-name',
FontsTweakUtil.check_symbolic(self.filter.get_property('secondary-icon-name')))

def _set_cursor(self):
iter = self.filtered_model.get_iter_first()
path = self.filtered_model.get_path(iter)
Expand Down
10 changes: 10 additions & 0 deletions fontstweak/langui.py
Expand Up @@ -39,6 +39,16 @@ def __init__(self, builder, parent):
self.view.append_column(Gtk.TreeViewColumn(None, Gtk.CellRendererText(), text=0))
self.view_list = builder.get_object('order-lang-list')

# check if current icon theme supports the symbolic icons
add_icon = builder.get_object('add-lang-order')
add_icon.set_icon_name(FontsTweakUtil.check_symbolic(add_icon.get_icon_name()))
del_icon = builder.get_object('remove-lang-order')
del_icon.set_icon_name(FontsTweakUtil.check_symbolic(del_icon.get_icon_name()))
up_icon = builder.get_object('move-up-order')
up_icon.set_icon_name(FontsTweakUtil.check_symbolic(up_icon.get_icon_name()))
down_icon = builder.get_object('move-down-order')
down_icon.set_icon_name(FontsTweakUtil.check_symbolic(down_icon.get_icon_name()))

self.listobj = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)

self.langlist = FontsTweakUtil.get_language_list(False)
Expand Down
6 changes: 6 additions & 0 deletions fontstweak/propui.py
Expand Up @@ -48,6 +48,12 @@ def __init__(self, config, builder, parent):
self.radio_hinting = builder.get_object('radiobutton-hinting')
self.radio_autohinting = builder.get_object('radiobutton-autohinting')

# check if current icon theme supports the symbolic icons
add_icon = builder.get_object('add-font')
add_icon.set_icon_name(FontsTweakUtil.check_symbolic(add_icon.get_icon_name()))
del_icon = builder.get_object('remove-font')
del_icon.set_icon_name(FontsTweakUtil.check_symbolic(del_icon.get_icon_name()))

self.listobj = Gtk.ListStore(GObject.TYPE_STRING)
fonts = Easyfc.Font.get_list(None, None, False)
if len(fonts) == 0:
Expand Down
8 changes: 8 additions & 0 deletions fontstweak/util.py
Expand Up @@ -82,3 +82,11 @@ def get_language_list(self, default):
dict[lang] = string.join(tokens[3:], ' ')

return dict

@classmethod
def check_symbolic(self, name):
theme = Gtk.IconTheme.get_default()
if not theme.has_icon(name):
return name.replace('-symbolic', '')
return name

0 comments on commit 70e35ab

Please sign in to comment.