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
=== modified file 'plugins/contractor/plugin.vala'
--- plugins/contractor/plugin.vala 2013-05-12 05:49:12 +0000
+++ plugins/contractor/plugin.vala 2014-08-17 21:26:01 +0000
@@ -56,6 +56,8 @@
56 File[] files = null;56 File[] files = null;
57 Gee.List<Granite.Services.Contract> contracts = null;57 Gee.List<Granite.Services.Contract> contracts = null;
5858
59 bool needs_multiple_support;
60
59 try {61 try {
60 if (gof_files == null) {62 if (gof_files == null) {
61 if (current_directory == null)63 if (current_directory == null)
@@ -69,9 +71,11 @@
69 if (mimetype == null)71 if (mimetype == null)
70 return;72 return;
7173
74 needs_multiple_support = false;
72 contracts = Granite.Services.ContractorProxy.get_contracts_by_mime (mimetype);75 contracts = Granite.Services.ContractorProxy.get_contracts_by_mime (mimetype);
73 } else {76 } else {
74 files = get_file_array (gof_files);77 files = get_file_array (gof_files);
78 needs_multiple_support = gof_files.length () > 1;
75 var mimetypes = get_mimetypes (gof_files);79 var mimetypes = get_mimetypes (gof_files);
76 contracts = Granite.Services.ContractorProxy.get_contracts_by_mimelist (mimetypes);80 contracts = Granite.Services.ContractorProxy.get_contracts_by_mimelist (mimetypes);
77 }81 }
@@ -81,6 +85,10 @@
8185
82 for (int i = 0; i < contracts.size; i++) {86 for (int i = 0; i < contracts.size; i++) {
83 var contract = contracts.get (i);87 var contract = contracts.get (i);
88
89 if (needs_multiple_support && !contract.supports_multiple_files ())
90 continue;
91
84 Gtk.MenuItem menu_item;92 Gtk.MenuItem menu_item;
8593
86 // insert separator if we got at least 1 contract94 // insert separator if we got at least 1 contract

Subscribers

People subscribed via source and target branches