Merge lp:~elementary-apps/pantheon-files/contractor-supports-multiple into lp:~elementary-apps/pantheon-files/trunk

Proposed by Tom Beckmann
Status: Work in progress
Proposed branch: lp:~elementary-apps/pantheon-files/contractor-supports-multiple
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 35 lines (+8/-0)
1 file modified
plugins/contractor/plugin.vala (+8/-0)
To merge this branch: bzr merge lp:~elementary-apps/pantheon-files/contractor-supports-multiple
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+231134@code.launchpad.net

Description of the change

This branch implements the new functionality provided by contractor's support_multiple_files field by filtering out contracts which only support a single file, if multiple have been selected.

Depends on https://code.launchpad.net/~elementary-apps/granite/contractor-supports-multiple/+merge/231133
which depends on https://code.launchpad.net/~elementary-apps/contractor/multiple-files/+merge/231132

To post a comment you must log in.

Unmerged revisions

1579. By Tom Beckmann

add support for contractor's support_multiple_files field

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/contractor/plugin.vala'
2--- plugins/contractor/plugin.vala 2013-05-12 05:49:12 +0000
3+++ plugins/contractor/plugin.vala 2014-08-17 21:26:01 +0000
4@@ -56,6 +56,8 @@
5 File[] files = null;
6 Gee.List<Granite.Services.Contract> contracts = null;
7
8+ bool needs_multiple_support;
9+
10 try {
11 if (gof_files == null) {
12 if (current_directory == null)
13@@ -69,9 +71,11 @@
14 if (mimetype == null)
15 return;
16
17+ needs_multiple_support = false;
18 contracts = Granite.Services.ContractorProxy.get_contracts_by_mime (mimetype);
19 } else {
20 files = get_file_array (gof_files);
21+ needs_multiple_support = gof_files.length () > 1;
22 var mimetypes = get_mimetypes (gof_files);
23 contracts = Granite.Services.ContractorProxy.get_contracts_by_mimelist (mimetypes);
24 }
25@@ -81,6 +85,10 @@
26
27 for (int i = 0; i < contracts.size; i++) {
28 var contract = contracts.get (i);
29+
30+ if (needs_multiple_support && !contract.supports_multiple_files ())
31+ continue;
32+
33 Gtk.MenuItem menu_item;
34
35 // insert separator if we got at least 1 contract

Subscribers

People subscribed via source and target branches