Opened 9 years ago

Closed 7 years ago

#4830 closed defect (fixed)

Icon from Gnome theme is displayed in a activity toolbar on F21

Reported by: godiard Owned by:
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Sugar Version: Unspecified
Severity: Unspecified Keywords:
Cc: Distribution/OS: Unspecified
Bug Status: Unconfirmed

Description

In Paint activity, the buttons with the icons 'rotate-object-left' and 'rotate-object-right' display the Adwaita icon instead of the icon provided in the activity icons directory.

In src/sugar3/activity/activity.py we have:

@@ -290,7 +290,8 @@ class Activity(Window, Gtk.Container):
         """
         # Stuff that needs to be done early
         icons_path = os.path.join(get_bundle_path(), 'icons')
-        Gtk.IconTheme.get_default().append_search_path(icons_path)

I have tried replace append_search_path() by prepend_search_path() but didn't have any effect.

from gi.repository import Gtk

icon_theme = Gtk.IconTheme.get_default()

icon_theme.get_search_path()
['/home/gonzalo/sugar-build/home/default/data/icons',
 '/home/gonzalo/.icons',
 '/home/gonzalo/sugar-build/build/out/install/share/icons',
 '/usr/share/icons',
 '/home/gonzalo/sugar-build/build/out/install/share/pixmaps',
 '/usr/share/pixmaps']

pwd
Out[4]: u'/home/gonzalo/sugar-devel/honey/paint/paint-activity'

icon_theme.prepend_search_path('/home/gonzalo/sugar-devel/honey/paint/paint-activity/icons')

icon_theme.get_search_path()
Out[6]: 
['/home/gonzalo/sugar-devel/honey/paint/paint-activity/icons',
 '/home/gonzalo/sugar-build/home/default/data/icons',
 '/home/gonzalo/.icons',
 '/home/gonzalo/sugar-build/build/out/install/share/icons',
 '/usr/share/icons',
 '/home/gonzalo/sugar-build/build/out/install/share/pixmaps',
 '/usr/share/pixmaps']

info = icon_theme.lookup_icon('object-rotate-left',50, 0)
info.get_filename()
Out[8]: '/usr/share/icons/Adwaita/48x48/actions/object-rotate-left.png'


Change History (4)

comment:1 Changed 9 years ago by SAMdroid

Can reproduce on f21 with sugar-build (no chroot or whatever magic is uses by default)

comment:2 Changed 9 years ago by godiard

asking in GimpNet #gtk+, mclassen pointed to http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

A suspecting paragraph is:
"Implementation Notes

The algorithm as described in this document works by always looking up filenames in directories (a stat in unix terminology). A good implementation is expected to read the directories once, and do all lookups in memory using that information.

This caching can make it impossible for users to add icons without having to restart applications. In order to handle this, any implementation that does caching is required to look at the mtime of the toplevel icon directories when doing a cache lookup, unless it already did so less than 5 seconds ago. This means that any icon editor or theme installation program need only to change the mtime of the the toplevel directory where it changed the theme to make sure that the new icons will eventually get used."

Anyway, I have tried:

diff --git a/src/sugar3/activity/activity.py b/src/sugar3/activity/activity.py
index d56c620..640c31c 100644
--- a/src/sugar3/activity/activity.py
+++ b/src/sugar3/activity/activity.py
@@ -290,7 +290,10 @@ class Activity(Window, Gtk.Container):
         """
         # Stuff that needs to be done early
         icons_path = os.path.join(get_bundle_path(), 'icons')
-        Gtk.IconTheme.get_default().append_search_path(icons_path)
+        icon_theme = Gtk.IconTheme.get_default()
+        icon_theme.prepend_search_path(icons_path)
+        os.utime(icons_path, None)
+        icon_theme.rescan_if_needed()

but didn't solve the problem.

comment:4 Changed 7 years ago by quozl

  • Resolution set to fixed
  • Status changed from new to closed

Tested on Ubuntu 16.04 and 16.10, in light of https://github.com/sugarlabs/imageviewer-activity/pull/11 and everything worked, so I'll close this ticket for now. Please re-open if the problem is seen to repeat.

Note: See TracTickets for help on using tickets.