Merge lp:~ted/policykit-unity8/lp1579837-fallback-true into lp:policykit-unity8

Proposed by Ted Gould
Status: Merged
Approved by: Charles Kerr
Approved revision: 11
Merged at revision: 8
Proposed branch: lp:~ted/policykit-unity8/lp1579837-fallback-true
Merge into: lp:policykit-unity8
Diff against target: 40 lines (+12/-4)
2 files modified
service/agent.cpp (+10/-2)
tests/policykit-mock.h (+2/-2)
To merge this branch: bzr merge lp:~ted/policykit-unity8/lp1579837-fallback-true
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Review via email: mp+294158@code.launchpad.net

Commit message

Setup Agent so that it is the fallback agent

Description of the change

We're dealing with where USS wants to be its own agent. Fine, we'll let it, whatevs.

To post a comment you must log in.
10. By Ted Gould

Switch to vardict and add a clarifying comment

11. By Ted Gould

Code formatting

Revision history for this message
Charles Kerr (charlesk) wrote :

LGTM. Thanks, Ted!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'service/agent.cpp'
2--- service/agent.cpp 2016-04-14 18:23:56 +0000
3+++ service/agent.cpp 2016-05-09 22:16:51 +0000
4@@ -44,11 +44,19 @@
5 /* Build our Agent subclass */
6 auto glibagent = std::shared_ptr<AgentGlib>(agent_glib_new(this), [](AgentGlib *ptr) { g_clear_object(&ptr); });
7
8+ /* Setup registration options */
9+ GVariantBuilder builder;
10+ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
11+ /* Makes us the fallback agent so that system settings can override
12+ when it is setting multiple password settings all at once. */
13+ g_variant_builder_add_parsed(&builder, "{'fallback', true}");
14+
15 /* Register it */
16 GError *registererror = nullptr;
17- gpointer registration_handle = polkit_agent_listener_register(
18+ gpointer registration_handle = polkit_agent_listener_register_with_options(
19 reinterpret_cast<PolkitAgentListener *>(glibagent.get()), POLKIT_AGENT_REGISTER_FLAGS_NONE, subject.get(),
20- "/com/canonical/unity8/policyKit", _thread.getCancellable().get(), &registererror);
21+ "/com/canonical/unity8/policyKit", g_variant_builder_end(&builder), _thread.getCancellable().get(),
22+ &registererror);
23 if (registererror != nullptr)
24 {
25 auto memwrapper = std::shared_ptr<GError>(registererror, [](GError *error) { g_error_free(error); });
26
27=== modified file 'tests/policykit-mock.h'
28--- tests/policykit-mock.h 2016-03-21 17:08:17 +0000
29+++ tests/policykit-mock.h 2016-05-09 22:16:51 +0000
30@@ -46,8 +46,8 @@
31 baseobj = dbus_test_dbus_mock_get_object(mock, "/org/freedesktop/PolicyKit1/Authority",
32 "org.freedesktop.PolicyKit1.Authority", nullptr);
33
34- dbus_test_dbus_mock_object_add_method(mock, baseobj, "RegisterAuthenticationAgent",
35- G_VARIANT_TYPE("((sa{sv})ss)"), nullptr, "", nullptr);
36+ dbus_test_dbus_mock_object_add_method(mock, baseobj, "RegisterAuthenticationAgentWithOptions",
37+ G_VARIANT_TYPE("((sa{sv})ssa{sv})"), nullptr, "", nullptr);
38
39 dbus_test_dbus_mock_object_add_method(mock, baseobj, "UnregisterAuthenticationAgent",
40 G_VARIANT_TYPE("((sa{sv})s)"), nullptr, "", nullptr);

Subscribers

People subscribed via source and target branches

to all changes: