[Bugs] #4841 Sugar NORM: Only some newly installed system-wide activities are favorites

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Wed Jun 10 17:28:13 EDT 2015


#4841: Only some newly installed system-wide activities are favorites
---------------------+-------------------------------------
  Reporter:  quozl   |            Owner:
      Type:  defect  |           Status:  new
  Priority:  Normal  |        Milestone:
 Component:  Sugar   |          Version:  Git as of bugdate
  Severity:  Minor   |       Resolution:
  Keywords:          |  Distribution/OS:  Ubuntu
Bug Status:  New     |
---------------------+-------------------------------------
\
\
\
\
\
\

Comment (by tch):

 I have been experimenting with an approach that is similar to James
 approach, but it is simpler and does not break the current format (which
 is still necessary to store icon positions for favorites).

 This approach follows the "The user has the last word, unless he hasn't
 said anything" guideline. At the implementation level, the
 "favorite_activities" JSON is extended with only one more key called
 "favorite" aside with the current "position" key. This new key stores the
 favorite state (True or False). The "activities.defaults" file is
 completely removed.

 So how does it work? When Sugar starts up it loads the
 "favorite_activities" JSON file to the "self._favorite_bundles" list as
 usual. Then instead of merging the "activities.defaults" (which is now
 gone) is will be able to detect new activities and favorite them. This
 behavior is the exact same as it happens when the activities are installed
 when sugar is running, so it is consistent.

 How does it know is a new activity? Because the bundle id is not yet in
 "favorites_activities" JSON file, which now knows which activities are
 favorites and which are not (similar to James approach).

 How it handles hidden? A new "activities.hidden" file is added. Sugar
 reads this file during start up and simply does not favorite, unless the
 user has said something directly (which should be reflected in the JSON
 file).

 An initial working implementation can be found here [1]. The important
 changes are here [2,3], the rest of the commits are just for removing
 traces of "activities.defaults".

 Please give it a try!

 [1] https://github.com/tchx84/sugar/commits/enhance-favorites-try1
 [2]
 https://github.com/tchx84/sugar/commit/a4e65086d3c8fd18012b4012e6d692ce452ab15a
 [3]
 https://github.com/tchx84/sugar/commit/c1886be8c0bd7fceb04735900178aa1247284a2b
\
\
\

--
Ticket URL: <http://bugs.sugarlabs.org/ticket/4841#comment:8>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list