Merge lp:~mhr3/libunity/pass-up-goto-uri into lp:libunity

Proposed by Michal Hruby
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 277
Merged at revision: 277
Proposed branch: lp:~mhr3/libunity/pass-up-goto-uri
Merge into: lp:libunity
Diff against target: 78 lines (+48/-1)
2 files modified
src/unity-scope-dbus-impl.vala (+5/-1)
test/vala/test-scope.vala (+43/-0)
To merge this branch: bzr merge lp:~mhr3/libunity/pass-up-goto-uri
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+180371@code.launchpad.net

Commit message

Properly pass goto_uri to activation response.

Description of the change

Properly pass goto_uri to activation response.

This will allow a preview action to let the shell open a URI that isn't the result URI.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Looks good, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/unity-scope-dbus-impl.vala'
--- src/unity-scope-dbus-impl.vala 2013-08-06 08:24:48 +0000
+++ src/unity-scope-dbus-impl.vala 2013-08-15 15:56:16 +0000
@@ -454,8 +454,12 @@
454 if (response == null)454 if (response == null)
455 response = new ActivationResponse (HandledType.NOT_HANDLED);455 response = new ActivationResponse (HandledType.NOT_HANDLED);
456456
457 // FIXME: pass goto_uri ?
458 reply.uri = scope_result.uri;457 reply.uri = scope_result.uri;
458 if (response.goto_uri != null)
459 {
460 var stripped = response.goto_uri.strip ();
461 if (stripped != "") reply.uri = stripped;
462 }
459 reply.handled = response.handled;463 reply.handled = response.handled;
460 reply.hints = response.get_hints ();464 reply.hints = response.get_hints ();
461465
462466
=== modified file 'test/vala/test-scope.vala'
--- test/vala/test-scope.vala 2013-08-05 10:01:26 +0000
+++ test/vala/test-scope.vala 2013-08-15 15:56:16 +0000
@@ -114,6 +114,8 @@
114 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_results_invalidated));114 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_results_invalidated));
115 Test.add_data_func ("/Unit/MasterScope/Activation",115 Test.add_data_func ("/Unit/MasterScope/Activation",
116 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_activation));116 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_activation));
117 Test.add_data_func ("/Unit/MasterScope/OverriddenGotoUri",
118 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_overridden_goto_uri));
117 Test.add_data_func ("/Unit/MasterScope/Sorting/Ascending",119 Test.add_data_func ("/Unit/MasterScope/Sorting/Ascending",
118 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_sorting_asc));120 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_sorting_asc));
119 Test.add_data_func ("/Unit/MasterScope/Sorting/Descending",121 Test.add_data_func ("/Unit/MasterScope/Sorting/Descending",
@@ -1768,6 +1770,47 @@
1768 assert (activated_scopes.length == 3);1770 assert (activated_scopes.length == 3);
1769 }1771 }
17701772
1773 public void test_master_overridden_goto_uri ()
1774 {
1775 // we need channel first
1776 Dee.SerializableModel model;
1777 var channel_id = ScopeTester.open_channel (proxy, ChannelType.DEFAULT,
1778 out model);
1779 ScopeTester.perform_search (proxy, channel_id, "", null, model);
1780 assert (model.get_n_rows () == 3);
1781
1782 // NOTE: the order of the results is not defined, so result1 will not
1783 // necesarily belong to child_scopes[0]
1784 var iter = model.get_first_iter ();
1785 var result = model.get_row (iter, null);
1786 var uri = result[Unity.Internal.ResultColumn.URI].get_string ();
1787 int scope_index = "childscope_1" in uri ? 0 : ("childscope_2" in uri ? 1 : 2);
1788 child_scopes[scope_index].set_activate_func((result, metadata, act_id) =>
1789 {
1790 return new Unity.ActivationResponse (Unity.HandledType.NOT_HANDLED,
1791 "test://overridden_uri");
1792 });
1793
1794 var ml = new MainLoop ();
1795 ActivationReplyRaw? reply = null;
1796 proxy.activate.begin (channel_id, result,
1797 Unity.Protocol.ActionType.ACTIVATE_RESULT,
1798 new HashTable<string, Variant> (null, null), null,
1799 (obj, res) =>
1800 {
1801 try
1802 {
1803 reply = proxy.activate.end (res);
1804 }
1805 catch (Error err) { assert_not_reached (); }
1806 ml.quit ();
1807 });
1808 assert (run_with_timeout (ml));
1809
1810 assert (reply != null);
1811 assert (reply.uri == "test://overridden_uri");
1812 }
1813
1771 public void test_master_sorting_asc ()1814 public void test_master_sorting_asc ()
1772 {1815 {
1773 results_per_scope = 100;1816 results_per_scope = 100;

Subscribers

People subscribed via source and target branches