Merge lp:~elementary-apps/granite/document-contract-interface into lp:~elementary-pantheon/granite/granite

Proposed by Sergey "Shnatsel" Davidoff
Status: Merged
Approved by: Victor Martinez
Approved revision: 717
Merged at revision: 716
Proposed branch: lp:~elementary-apps/granite/document-contract-interface
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 61 lines (+40/-0)
1 file modified
lib/Services/ContractorProxy.vala (+40/-0)
To merge this branch: bzr merge lp:~elementary-apps/granite/document-contract-interface
Reviewer Review Type Date Requested Status
Victor Martinez (community) Approve
Review via email: mp+214846@code.launchpad.net

Commit message

Documentation: Add descriptions for Granite.Services.Contract and Granite.Services.ContractorError.

Description of the change

Document Granite.Services.Contract interface to the extent of my knowledge: I know how Contractor works but I'm no good at Vala.

To post a comment you must log in.
716. By Sergey "Shnatsel" Davidoff

document ContractorError.SERVICE_NOT_AVAILABLE

Revision history for this message
Victor Martinez (victored) wrote :

Great work!

The description for the Contract interface isn't very accurate. As the API is quite self-describing, it'd be better to keep it simple. For example:

"Interface for accessing contract actions and properties." instead of "Opaque object representing a Contractor action".
We could simply avoid "Returned by" as it's rarely used in Vala documentation and you'd have to list every method of ContractorProxy returning such objects.

That said, you've done a great job documenting the methods of the Contract interface and you're also providing proper guidance on handling ContractorError.SERVICE_NOT_AVAILABLE.

review: Needs Fixing
717. By Sergey "Shnatsel" Davidoff

Improve description of Services.Contract interface according to Victor's guidance

Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

Fixed, thanks!

Is this good to go now?

Revision history for this message
Victor Martinez (victored) wrote :

Absolutely!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/Services/ContractorProxy.vala'
2--- lib/Services/ContractorProxy.vala 2014-04-05 04:36:31 +0000
3+++ lib/Services/ContractorProxy.vala 2014-04-09 00:03:36 +0000
4@@ -20,11 +20,42 @@
5 ***/
6
7 namespace Granite.Services {
8+ /**
9+ * Interface for executing and accessing properties of Contractor actions
10+ */
11 public interface Contract : Object {
12+
13+ /**
14+ * Returns the display name of the contract, already internationalized
15+ *
16+ * @return The internationalized value of the 'Name' key in the .contract file.
17+ * As of 2014, Contractor uses gettext to handle internationalization.
18+ */
19 public abstract string get_display_name ();
20+
21+ /**
22+ * Returns the description of the contract, already internationalized
23+ *
24+ * @return The internationalized value of the 'Description' key in the .contract file.
25+ * As of 2014, Contractor uses gettext to handle internationalization.
26+ */
27 public abstract string get_description ();
28+
29+ /**
30+ * Returns an icon for this contract
31+ *
32+ * @return {@link Glib.Icon} based on the 'Icon' key in the .contract file.
33+ */
34 public abstract Icon get_icon ();
35+
36+ /**
37+ * Executes the action on the given file
38+ */
39 public abstract void execute_with_file (File file) throws Error;
40+
41+ /**
42+ * Executes the action on the given list of files
43+ */
44 public abstract void execute_with_files (File[] files) throws Error;
45 }
46
47@@ -32,6 +63,15 @@
48 * thrown by {@link Granite.Services.ContractorProxy}
49 */
50 public errordomain ContractorError {
51+ /**
52+ * Usually means that Contractor is not installed or not configured properly
53+ *
54+ * Contractor is not a compile-time dependency, so it is possible to
55+ * install an application that uses it without installing Contractor.
56+ *
57+ * Upon receiving this error the application should disable its Contractor-related
58+ * functionality, which typically means hiding the relevant UI elements.
59+ */
60 SERVICE_NOT_AVAILABLE
61 }
62

Subscribers

People subscribed via source and target branches