Changes

no edit summary
Line 7: Line 7:  
= Location =
 
= Location =
 
Activities are installed and removed automatically by [[Sugar]], in response to user actions.  Sugar places activities in directory of its choice.  Activities should not rely on being installed in a specific location, and should use relative paths where paths are necessary (i.e., for shared library linkage, activity resources such as images, sounds, etc).  They should also not rely on the bundle's base directory name remaining the same.  Sugar may rename the activity bundle base directory at any time to prevent bundle conflicts.
 
Activities are installed and removed automatically by [[Sugar]], in response to user actions.  Sugar places activities in directory of its choice.  Activities should not rely on being installed in a specific location, and should use relative paths where paths are necessary (i.e., for shared library linkage, activity resources such as images, sounds, etc).  They should also not rely on the bundle's base directory name remaining the same.  Sugar may rename the activity bundle base directory at any time to prevent bundle conflicts.
 +
 +
Currently Sugar on jhbuild looks for bundles in the "activities" subfolders of XDG_DATA_DIRS.  Right now this is /usr/share/activities and the usr/share/activities subfolder of the jhbuild build folder.
    
Sugar will automatically generate and remove the .service files necessary to launch the activity through D-Bus service activation when the activity is installed or removed.
 
Sugar will automatically generate and remove the .service files necessary to launch the activity through D-Bus service activation when the activity is installed or removed.
    
Activities should also NEVER store local state or preferences in the activity bundle itself.  These should always be stored in an activity-specific directory in the user's sugar profile, available through the SUGAR_PROFILE environment variable.
 
Activities should also NEVER store local state or preferences in the activity bundle itself.  These should always be stored in an activity-specific directory in the user's sugar profile, available through the SUGAR_PROFILE environment variable.
 +
 +
Python developers can also get the profile folder this way:
 +
import sugar.env
 +
profile_path = sugar.env.get_profile_path()
    
= Bundle Structure =
 
= Bundle Structure =
Line 40: Line 46:  
  activity_version = 1
 
  activity_version = 1
 
  host_version = 1
 
  host_version = 1
  service = com.redhat.Sugar.BrowserActivity
+
  service_name = com.redhat.Sugar.BrowserActivity
 
  icon = activity-web
 
  icon = activity-web
 
  exec = sugar-activity-factory com.redhat.Sugar.BrowserActivity BrowserActivity.BrowserActivity
 
  exec = sugar-activity-factory com.redhat.Sugar.BrowserActivity BrowserActivity.BrowserActivity
Line 59: Line 65:  
: Each activity.info file must have a "host_version" key.  The version is a single positive integer, and may only contain the characters 1 through 9.  This specifies the version of the Sugar environment which the activity is compatible with.  (fixme: need to specify sugar versions somewhere.  Obviously we start with 1.)
 
: Each activity.info file must have a "host_version" key.  The version is a single positive integer, and may only contain the characters 1 through 9.  This specifies the version of the Sugar environment which the activity is compatible with.  (fixme: need to specify sugar versions somewhere.  Obviously we start with 1.)
   −
  service = com.redhat.Sugar.BrowserActivity
+
  service_name = com.redhat.Sugar.BrowserActivity
 
: This is the activity's dbus service name.  It is required.  It is also used as the activity's default service type when the activity is shared on the network.  To determine this type, the distince parts (separated by the '.' character) are reversed, any '.' is replaced by a '_' character, and the type is prefixed by a '_' character.  So in this example, the default service type would be "_BrowserActivity_Sugar_redhat_com".
 
: This is the activity's dbus service name.  It is required.  It is also used as the activity's default service type when the activity is shared on the network.  To determine this type, the distince parts (separated by the '.' character) are reversed, any '.' is replaced by a '_' character, and the type is prefixed by a '_' character.  So in this example, the default service type would be "_BrowserActivity_Sugar_redhat_com".
    
  icon = activity-web
 
  icon = activity-web
: This key is optional.  It points to the activity's icon.  The icon is first searched for in the activity bundle's base directory, and if not found, is looked up in the current GTK icon theme.  It cannot contain a path.  When searching for the icon in the activity bundle's base directory, only an file with the icon name and the extension '.svg' is looked for.
+
: This key is optional.  It points to the activity's icon.  The icon will be first searched for in the activity bundle's base directory, and if not found, is looked up in the current GTK icon theme.  It cannot contain a path.  When searching for the icon in the activity bundle's base directory, only an file with the icon name and the extension '.svg' will be looked for.  Currently this is not implemented, and icons must be in the current icon theme.  
    
  exec = sugar-activity-factory com.redhat.Sugar.BrowserActivity BrowserActivity.BrowserActivity
 
  exec = sugar-activity-factory com.redhat.Sugar.BrowserActivity BrowserActivity.BrowserActivity
Anonymous user