Merge lp:~saviq/unity8/drop-network-agents into lp:unity8
- drop-network-agents
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~saviq/unity8/drop-network-agents |
Merge into: | lp:unity8 |
Diff against target: |
1346 lines (+18/-1145) 18 files modified
Panel/Indicators.qml (+4/-1) Panel/Indicators/NetworkIndicatorPage.qml (+0/-82) Panel/Indicators/client/IndicatorsList.qml (+3/-1) Panel/IndicatorsDataModel.qml (+0/-34) debian/changelog (+6/-0) debian/control (+3/-7) plugins/Unity/Indicators/Network/CMakeLists.txt (+0/-44) plugins/Unity/Indicators/Network/networkagent.cpp (+0/-146) plugins/Unity/Indicators/Network/networkagent.h (+0/-65) plugins/Unity/Indicators/Network/plugin.cpp (+0/-31) plugins/Unity/Indicators/Network/plugin.h (+0/-32) plugins/Unity/Indicators/Network/qml/PasswordPage.qml (+0/-88) plugins/Unity/Indicators/Network/qml/PasswordTextField.qml (+0/-68) plugins/Unity/Indicators/Network/qml/qmldir (+0/-5) plugins/Unity/Indicators/Network/secret-agent.c (+0/-382) plugins/Unity/Indicators/Network/secret-agent.h (+0/-102) plugins/Unity/Indicators/indicatorsmodel.cpp (+2/-49) plugins/Unity/Indicators/indicatorsmodel.h (+0/-8) |
To merge this branch: | bzr merge lp:~saviq/unity8/drop-network-agents |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Nick Dedekind | Pending | ||
Review via email:
|
This proposal supersedes a proposal from 2013-10-01.
This proposal has been superseded by a proposal from 2013-10-03.
Commit message
Drop network agents now that they're in indicator-network instead.
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
- 250. By Michał Sawicz
-
merge trunk
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:249
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 251. By Michał Sawicz
-
One more cleanup.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:250
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 252. By Michał Sawicz
-
One more unneeded line.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:251
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:252
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 253. By Michał Sawicz
-
Add Breaks: for indicator-network, so that we don't end up with no password agent on upgrade.
- 254. By Michał Sawicz
-
merge version bump
Unmerged revisions
Preview Diff
1 | === modified file 'Panel/Indicators.qml' | |||
2 | --- Panel/Indicators.qml 2013-09-16 16:42:24 +0000 | |||
3 | +++ Panel/Indicators.qml 2013-10-03 12:34:55 +0000 | |||
4 | @@ -17,6 +17,7 @@ | |||
5 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.0 |
6 | 18 | import Ubuntu.Components 0.1 | 18 | import Ubuntu.Components 0.1 |
7 | 19 | import Ubuntu.Gestures 0.1 | 19 | import Ubuntu.Gestures 0.1 |
8 | 20 | import Unity.Indicators 0.1 as Indicators | ||
9 | 20 | 21 | ||
10 | 21 | import "../Components" | 22 | import "../Components" |
11 | 22 | import "../Components/ListItems" | 23 | import "../Components/ListItems" |
12 | @@ -249,8 +250,10 @@ | |||
13 | 249 | anchors.fill: indicatorRow | 250 | anchors.fill: indicatorRow |
14 | 250 | } | 251 | } |
15 | 251 | 252 | ||
17 | 252 | IndicatorsDataModel { | 253 | Indicators.IndicatorsModel { |
18 | 253 | id: indicatorsModel | 254 | id: indicatorsModel |
19 | 255 | |||
20 | 256 | Component.onCompleted: load() | ||
21 | 254 | } | 257 | } |
22 | 255 | 258 | ||
23 | 256 | IndicatorRow { | 259 | IndicatorRow { |
24 | 257 | 260 | ||
25 | === removed file 'Panel/Indicators/NetworkIndicatorPage.qml' | |||
26 | --- Panel/Indicators/NetworkIndicatorPage.qml 2013-10-02 16:07:39 +0000 | |||
27 | +++ Panel/Indicators/NetworkIndicatorPage.qml 1970-01-01 00:00:00 +0000 | |||
28 | @@ -1,82 +0,0 @@ | |||
29 | 1 | /* | ||
30 | 2 | * Copyright 2013 Canonical Ltd. | ||
31 | 3 | * | ||
32 | 4 | * This program is free software; you can redistribute it and/or modify | ||
33 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
34 | 6 | * the Free Software Foundation; version 3. | ||
35 | 7 | * | ||
36 | 8 | * This program is distributed in the hope that it will be useful, | ||
37 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
38 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
39 | 11 | * GNU Lesser General Public License for more details. | ||
40 | 12 | * | ||
41 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
42 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
43 | 15 | * | ||
44 | 16 | * Authors: | ||
45 | 17 | * Renato Araujo Oliveira Filho <renato@canonical.com> | ||
46 | 18 | */ | ||
47 | 19 | |||
48 | 20 | import QtQuick 2.0 | ||
49 | 21 | import Unity.Indicators 0.1 as Indicators | ||
50 | 22 | import Unity.Indicators.Network 0.1 as ICNetwork | ||
51 | 23 | import Ubuntu.Components 0.1 | ||
52 | 24 | |||
53 | 25 | PageStack { | ||
54 | 26 | id: networkPage | ||
55 | 27 | // Stops the search for a parent tree node. | ||
56 | 28 | // We don't want it going up to the indicator tabs. | ||
57 | 29 | // FIXME: need a better way of doing this. | ||
58 | 30 | // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1211704 | ||
59 | 31 | __propagated: null | ||
60 | 32 | |||
61 | 33 | property alias title: pluginItem.title | ||
62 | 34 | property alias emptyText: pluginItem.emptyText | ||
63 | 35 | property alias busName: pluginItem.busName | ||
64 | 36 | property alias actionsObjectPath : pluginItem.actionsObjectPath | ||
65 | 37 | property alias menuObjectPaths : pluginItem.menuObjectPaths | ||
66 | 38 | |||
67 | 39 | anchors.fill: parent | ||
68 | 40 | |||
69 | 41 | Page { | ||
70 | 42 | id: _mainPage | ||
71 | 43 | |||
72 | 44 | Indicators.IndicatorPage { | ||
73 | 45 | id: pluginItem | ||
74 | 46 | anchors.fill: parent | ||
75 | 47 | } | ||
76 | 48 | } | ||
77 | 49 | |||
78 | 50 | Component { | ||
79 | 51 | id: passwordPageComponent | ||
80 | 52 | |||
81 | 53 | ICNetwork.PasswordPage { | ||
82 | 54 | agent: networkAgent | ||
83 | 55 | } | ||
84 | 56 | } | ||
85 | 57 | |||
86 | 58 | ICNetwork.NetworkAgent { | ||
87 | 59 | id: networkAgent | ||
88 | 60 | |||
89 | 61 | onSecretRequested: { | ||
90 | 62 | networkPage.push(passwordPageComponent, {"token": token}); | ||
91 | 63 | } | ||
92 | 64 | } | ||
93 | 65 | |||
94 | 66 | function start() | ||
95 | 67 | { | ||
96 | 68 | push(_mainPage); | ||
97 | 69 | pluginItem.start(); | ||
98 | 70 | } | ||
99 | 71 | |||
100 | 72 | function stop() | ||
101 | 73 | { | ||
102 | 74 | clear(); | ||
103 | 75 | pluginItem.stop(); | ||
104 | 76 | } | ||
105 | 77 | |||
106 | 78 | function reset() | ||
107 | 79 | { | ||
108 | 80 | pluginItem.reset(); | ||
109 | 81 | } | ||
110 | 82 | } | ||
111 | 83 | 0 | ||
112 | === modified file 'Panel/Indicators/client/IndicatorsList.qml' | |||
113 | --- Panel/Indicators/client/IndicatorsList.qml 2013-10-02 09:38:06 +0000 | |||
114 | +++ Panel/Indicators/client/IndicatorsList.qml 2013-10-03 12:34:55 +0000 | |||
115 | @@ -28,8 +28,10 @@ | |||
116 | 28 | anchors.fill: parent | 28 | anchors.fill: parent |
117 | 29 | title: "Plugin list" | 29 | title: "Plugin list" |
118 | 30 | 30 | ||
120 | 31 | IndicatorsDataModel { | 31 | Indicators.IndicatorsModel { |
121 | 32 | id: indicatorsModel | 32 | id: indicatorsModel |
122 | 33 | |||
123 | 34 | Component.onCompleted: load() | ||
124 | 33 | } | 35 | } |
125 | 34 | 36 | ||
126 | 35 | ListView { | 37 | ListView { |
127 | 36 | 38 | ||
128 | === removed file 'Panel/IndicatorsDataModel.qml' | |||
129 | --- Panel/IndicatorsDataModel.qml 2013-10-02 16:07:39 +0000 | |||
130 | +++ Panel/IndicatorsDataModel.qml 1970-01-01 00:00:00 +0000 | |||
131 | @@ -1,34 +0,0 @@ | |||
132 | 1 | /* | ||
133 | 2 | * Copyright 2013 Canonical Ltd. | ||
134 | 3 | * | ||
135 | 4 | * This program is free software; you can redistribute it and/or modify | ||
136 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
137 | 6 | * the Free Software Foundation; version 3. | ||
138 | 7 | * | ||
139 | 8 | * This program is distributed in the hope that it will be useful, | ||
140 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
141 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
142 | 11 | * GNU Lesser General Public License for more details. | ||
143 | 12 | * | ||
144 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
145 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
146 | 15 | * | ||
147 | 16 | * Authors: | ||
148 | 17 | * Renato Araujo Oliveira Filho <renato@canonical.com> | ||
149 | 18 | */ | ||
150 | 19 | |||
151 | 20 | import QtQuick 2.0 | ||
152 | 21 | import Unity.Indicators 0.1 as Indicators | ||
153 | 22 | import Utils 0.1 | ||
154 | 23 | |||
155 | 24 | Indicators.IndicatorsModel { | ||
156 | 25 | id: ic_model | ||
157 | 26 | |||
158 | 27 | Component.onCompleted: load() | ||
159 | 28 | |||
160 | 29 | indicatorData : { | ||
161 | 30 | 'indicator-network' : { | ||
162 | 31 | 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/NetworkIndicatorPage.qml' | ||
163 | 32 | }, | ||
164 | 33 | } | ||
165 | 34 | } | ||
166 | 35 | 0 | ||
167 | === modified file 'debian/changelog' | |||
168 | --- debian/changelog 2013-09-27 14:13:22 +0000 | |||
169 | +++ debian/changelog 2013-10-03 12:34:55 +0000 | |||
170 | @@ -1,3 +1,9 @@ | |||
171 | 1 | unity8 (7.82) UNRELEASED; urgency=low | ||
172 | 2 | |||
173 | 3 | * Bump to indicate support for extended snap decisions. | ||
174 | 4 | |||
175 | 5 | -- Michał Sawicz <michal.sawicz@canonical.com> Thu, 03 Oct 2013 14:20:23 +0200 | ||
176 | 6 | |||
177 | 1 | unity8 (7.81.3+13.10.20130927.3-0ubuntu1) saucy; urgency=low | 7 | unity8 (7.81.3+13.10.20130927.3-0ubuntu1) saucy; urgency=low |
178 | 2 | 8 | ||
179 | 3 | [ Michal Hruby ] | 9 | [ Michal Hruby ] |
180 | 4 | 10 | ||
181 | === modified file 'debian/control' | |||
182 | --- debian/control 2013-09-26 15:23:37 +0000 | |||
183 | +++ debian/control 2013-10-03 12:34:55 +0000 | |||
184 | @@ -14,8 +14,6 @@ | |||
185 | 14 | libjson-perl, | 14 | libjson-perl, |
186 | 15 | libnih-dbus-dev, | 15 | libnih-dbus-dev, |
187 | 16 | libnih-dev, | 16 | libnih-dev, |
188 | 17 | libnm-glib-dev, | ||
189 | 18 | libnm-util-dev, | ||
190 | 19 | libpulse-dev, | 17 | libpulse-dev, |
191 | 20 | libqmenumodel-dev (>= 0.2.7), | 18 | libqmenumodel-dev (>= 0.2.7), |
192 | 21 | libqt5v8-5-private-dev, | 19 | libqt5v8-5-private-dev, |
193 | @@ -74,16 +72,14 @@ | |||
194 | 74 | qtdeclarative5-unity-notifications-plugin | unity-notifications-impl, | 72 | qtdeclarative5-unity-notifications-plugin | unity-notifications-impl, |
195 | 75 | qtdeclarative5-xmllistmodel-plugin, | 73 | qtdeclarative5-xmllistmodel-plugin, |
196 | 76 | unity-launcher-impl-3, | 74 | unity-launcher-impl-3, |
198 | 77 | unity-notifications-impl-1, | 75 | unity-notifications-impl-2, |
199 | 78 | unity8-fake-env | qtubuntu-shell, | 76 | unity8-fake-env | qtubuntu-shell, |
200 | 79 | unity8-private (= ${binary:Version}), | 77 | unity8-private (= ${binary:Version}), |
201 | 80 | unity8-private | unity-launcher-impl, | 78 | unity8-private | unity-launcher-impl, |
202 | 81 | ${misc:Depends}, | 79 | ${misc:Depends}, |
203 | 82 | ${shlibs:Depends}, | 80 | ${shlibs:Depends}, |
208 | 83 | Recommends: indicator-battery, | 81 | Recommends: ${unity-default-masterscopes}, |
209 | 84 | indicator-messages, | 82 | Breaks: indicator-network (<< 0.5.1) |
206 | 85 | indicator-time, | ||
207 | 86 | ${unity-default-masterscopes}, | ||
210 | 87 | Description: Unity 8 shell | 83 | Description: Unity 8 shell |
211 | 88 | The Unity 8 shell is the primary user interface for Ubuntu devices. | 84 | The Unity 8 shell is the primary user interface for Ubuntu devices. |
212 | 89 | 85 | ||
213 | 90 | 86 | ||
214 | === modified file 'plugins/Unity/Indicators/Network/CMakeLists.txt' | |||
215 | --- plugins/Unity/Indicators/Network/CMakeLists.txt 2013-08-20 19:50:07 +0000 | |||
216 | +++ plugins/Unity/Indicators/Network/CMakeLists.txt 2013-10-03 12:34:55 +0000 | |||
217 | @@ -1,45 +1,1 @@ | |||
218 | 1 | # export_qmlplugin macro | ||
219 | 2 | include(Plugins) | ||
220 | 3 | |||
221 | 4 | project(IndicatorsNetworkQml) | ||
222 | 5 | |||
223 | 6 | pkg_check_modules(GLIB glib-2.0>=2.32) | ||
224 | 7 | pkg_check_modules(LIBNM_GLIB libnm-glib>=0.9.6) | ||
225 | 8 | pkg_check_modules(LIBNM_UTIL libnm-util>=0.9.6) | ||
226 | 9 | |||
227 | 10 | if(LIBNM_GLIB_FOUND AND LIBNM_UTIL_FOUND AND GLIB_FOUND) | ||
228 | 11 | set(INDICATORS_NETWORK_SRC | ||
229 | 12 | networkagent.cpp | ||
230 | 13 | plugin.cpp | ||
231 | 14 | secret-agent.c | ||
232 | 15 | ) | ||
233 | 16 | |||
234 | 17 | add_library(IndicatorsNetworkQml MODULE | ||
235 | 18 | ${INDICATORS_NETWORK_SRC} | ||
236 | 19 | ) | ||
237 | 20 | |||
238 | 21 | qt5_use_modules(IndicatorsNetworkQml Core Qml Widgets) | ||
239 | 22 | |||
240 | 23 | set_target_properties(IndicatorsNetworkQml PROPERTIES COMPILE_FLAGS -fPIC) | ||
241 | 24 | |||
242 | 25 | include_directories( | ||
243 | 26 | ${CMAKE_CURRENT_SOURCE_DIR} | ||
244 | 27 | ${GLIB_INCLUDE_DIRS} | ||
245 | 28 | ${LIBNM_GLIB_INCLUDE_DIRS} | ||
246 | 29 | ${LIBNM_UTIL_INCLUDE_DIRS} | ||
247 | 30 | ) | ||
248 | 31 | |||
249 | 32 | target_link_libraries(IndicatorsNetworkQml | ||
250 | 33 | ${GLIB_LIBRARIES} | ||
251 | 34 | ${LIBNM_GLIB_LIBRARIES} | ||
252 | 35 | ${LIBNM_UTIL_LIBRARIES} | ||
253 | 36 | ) | ||
254 | 37 | |||
255 | 38 | # export the qmltypes and plugin files | ||
256 | 39 | export_qmlplugin(Unity.Indicators.Network 0.1 Unity/Indicators/Network TARGETS IndicatorsNetworkQml) | ||
257 | 40 | |||
258 | 41 | else() | ||
259 | 42 | message(WARNING "Missing glib or libnm dependency for the network plugin, not building") | ||
260 | 43 | endif() | ||
261 | 44 | |||
262 | 45 | add_subdirectory(qml) | 1 | add_subdirectory(qml) |
263 | 46 | 2 | ||
264 | === removed file 'plugins/Unity/Indicators/Network/networkagent.cpp' | |||
265 | --- plugins/Unity/Indicators/Network/networkagent.cpp 2013-06-07 12:51:16 +0000 | |||
266 | +++ plugins/Unity/Indicators/Network/networkagent.cpp 1970-01-01 00:00:00 +0000 | |||
267 | @@ -1,146 +0,0 @@ | |||
268 | 1 | /* | ||
269 | 2 | * Copyright 2013 Canonical Ltd. | ||
270 | 3 | * | ||
271 | 4 | * This program is free software; you can redistribute it and/or modify | ||
272 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
273 | 6 | * the Free Software Foundation; version 3. | ||
274 | 7 | * | ||
275 | 8 | * This program is distributed in the hope that it will be useful, | ||
276 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
277 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
278 | 11 | * GNU Lesser General Public License for more details. | ||
279 | 12 | * | ||
280 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
281 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
282 | 15 | * | ||
283 | 16 | * Authors: | ||
284 | 17 | * Alberto Ruiz <alberto.ruiz@canonical.com> | ||
285 | 18 | * Renato Araujo Oliveira Filho <renato@canonical.com> | ||
286 | 19 | */ | ||
287 | 20 | |||
288 | 21 | #include "networkagent.h" | ||
289 | 22 | |||
290 | 23 | #include <QVariant> | ||
291 | 24 | #include <QApplication> | ||
292 | 25 | #include <QDebug> | ||
293 | 26 | |||
294 | 27 | class NetworkAgentToken | ||
295 | 28 | { | ||
296 | 29 | public: | ||
297 | 30 | NMConnection *connection; | ||
298 | 31 | NMSettingWirelessSecurity *wisec; | ||
299 | 32 | guint id; | ||
300 | 33 | QByteArray keyMgmt; | ||
301 | 34 | |||
302 | 35 | NetworkAgentToken(NMConnection *connection, | ||
303 | 36 | NMSettingWirelessSecurity *wisec, | ||
304 | 37 | guint id, | ||
305 | 38 | QByteArray keyMgmt) | ||
306 | 39 | : connection(connection), | ||
307 | 40 | wisec(wisec), | ||
308 | 41 | id(id), | ||
309 | 42 | keyMgmt(keyMgmt) | ||
310 | 43 | { | ||
311 | 44 | if (connection) { | ||
312 | 45 | g_object_ref(connection); | ||
313 | 46 | } else { | ||
314 | 47 | qWarning() << "invalid connection object"; | ||
315 | 48 | } | ||
316 | 49 | } | ||
317 | 50 | |||
318 | 51 | ~NetworkAgentToken() | ||
319 | 52 | { | ||
320 | 53 | if (connection) { | ||
321 | 54 | g_object_unref(connection); | ||
322 | 55 | } | ||
323 | 56 | } | ||
324 | 57 | }; | ||
325 | 58 | |||
326 | 59 | NetworkAgent::NetworkAgent(QObject *parent) | ||
327 | 60 | : QObject(parent) | ||
328 | 61 | { | ||
329 | 62 | m_agent = unity_settings_secret_agent_new(); | ||
330 | 63 | g_signal_connect(G_OBJECT(m_agent), | ||
331 | 64 | UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED, | ||
332 | 65 | G_CALLBACK(onSecretRequested), | ||
333 | 66 | this); | ||
334 | 67 | |||
335 | 68 | g_signal_connect(G_OBJECT(m_agent), | ||
336 | 69 | UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED, | ||
337 | 70 | G_CALLBACK(onSecretRequestCancelled), | ||
338 | 71 | this); | ||
339 | 72 | } | ||
340 | 73 | |||
341 | 74 | NetworkAgent::~NetworkAgent() | ||
342 | 75 | { | ||
343 | 76 | nm_secret_agent_unregister(NM_SECRET_AGENT(m_agent)); | ||
344 | 77 | g_object_unref(m_agent); | ||
345 | 78 | } | ||
346 | 79 | |||
347 | 80 | void NetworkAgent::authenticate(const QVariant &token, const QString &key) | ||
348 | 81 | { | ||
349 | 82 | NetworkAgentToken *pToken = (NetworkAgentToken *) token.value<void *>(); | ||
350 | 83 | if (pToken == NULL) { | ||
351 | 84 | return; | ||
352 | 85 | } | ||
353 | 86 | |||
354 | 87 | if ((pToken->keyMgmt == "wpa-none") || (pToken->keyMgmt == "wpa-psk")) { | ||
355 | 88 | g_object_set(G_OBJECT(pToken->wisec), | ||
356 | 89 | NM_SETTING_WIRELESS_SECURITY_PSK, qPrintable(key), | ||
357 | 90 | NULL); | ||
358 | 91 | } else if (pToken->keyMgmt == "none") { | ||
359 | 92 | g_object_set(G_OBJECT(pToken->wisec), | ||
360 | 93 | NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, qPrintable(key), | ||
361 | 94 | NULL); | ||
362 | 95 | } | ||
363 | 96 | |||
364 | 97 | GHashTable *settings = nm_connection_to_hash(pToken->connection, | ||
365 | 98 | NM_SETTING_HASH_FLAG_ALL); | ||
366 | 99 | |||
367 | 100 | unity_settings_secret_agent_provide_secret(m_agent, | ||
368 | 101 | pToken->id, settings); | ||
369 | 102 | g_hash_table_unref(settings); | ||
370 | 103 | delete pToken; | ||
371 | 104 | } | ||
372 | 105 | |||
373 | 106 | void NetworkAgent::cancel(const QVariant &token) | ||
374 | 107 | { | ||
375 | 108 | NetworkAgentToken *pToken = (NetworkAgentToken *) token.value<void *>(); | ||
376 | 109 | if (pToken != NULL) { | ||
377 | 110 | unity_settings_secret_agent_cancel_request(m_agent, pToken->id); | ||
378 | 111 | delete pToken; | ||
379 | 112 | } | ||
380 | 113 | } | ||
381 | 114 | |||
382 | 115 | void NetworkAgent::onSecretRequested(UnitySettingsSecretAgent* /*agent*/, | ||
383 | 116 | guint id, | ||
384 | 117 | NMConnection* connection, | ||
385 | 118 | const char* /*setting_name*/, | ||
386 | 119 | const char** /*hints*/, | ||
387 | 120 | NMSecretAgentGetSecretsFlags /*flags*/, | ||
388 | 121 | NetworkAgent* self) | ||
389 | 122 | { | ||
390 | 123 | NetworkAgentToken *token = new NetworkAgentToken(connection, | ||
391 | 124 | NULL, | ||
392 | 125 | id, | ||
393 | 126 | NULL); | ||
394 | 127 | |||
395 | 128 | token->wisec = nm_connection_get_setting_wireless_security(connection); | ||
396 | 129 | if (token->wisec) { | ||
397 | 130 | token->keyMgmt = nm_setting_wireless_security_get_key_mgmt(token->wisec); | ||
398 | 131 | } | ||
399 | 132 | |||
400 | 133 | QVariant varToken = qVariantFromValue((void *) token); | ||
401 | 134 | Q_EMIT self->secretRequested(varToken); | ||
402 | 135 | } | ||
403 | 136 | |||
404 | 137 | void NetworkAgent::onSecretRequestCancelled(UnitySettingsSecretAgent* /*agent*/, | ||
405 | 138 | guint /*id*/, | ||
406 | 139 | NMConnection* /*connection*/, | ||
407 | 140 | const char* /*setting_name*/, | ||
408 | 141 | const char** /*hints*/, | ||
409 | 142 | NMSecretAgentGetSecretsFlags /*flags*/, | ||
410 | 143 | NetworkAgent* /*self*/) | ||
411 | 144 | { | ||
412 | 145 | //Do nothing for now | ||
413 | 146 | } | ||
414 | 147 | 0 | ||
415 | === removed file 'plugins/Unity/Indicators/Network/networkagent.h' | |||
416 | --- plugins/Unity/Indicators/Network/networkagent.h 2013-06-07 12:51:16 +0000 | |||
417 | +++ plugins/Unity/Indicators/Network/networkagent.h 1970-01-01 00:00:00 +0000 | |||
418 | @@ -1,65 +0,0 @@ | |||
419 | 1 | /* | ||
420 | 2 | * Copyright 2013 Canonical Ltd. | ||
421 | 3 | * | ||
422 | 4 | * This program is free software; you can redistribute it and/or modify | ||
423 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
424 | 6 | * the Free Software Foundation; version 3. | ||
425 | 7 | * | ||
426 | 8 | * This program is distributed in the hope that it will be useful, | ||
427 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
428 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
429 | 11 | * GNU Lesser General Public License for more details. | ||
430 | 12 | * | ||
431 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
432 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
433 | 15 | * | ||
434 | 16 | * Authors: | ||
435 | 17 | * Alberto Ruiz <alberto.ruiz@canonical.com> | ||
436 | 18 | * Renato Araujo Oliveira Filho <renato@canonical.com> | ||
437 | 19 | */ | ||
438 | 20 | |||
439 | 21 | #ifndef NETWORKAGENT_H | ||
440 | 22 | #define NETWORKAGENT_H | ||
441 | 23 | |||
442 | 24 | #include "secret-agent.h" | ||
443 | 25 | |||
444 | 26 | #include <QObject> | ||
445 | 27 | |||
446 | 28 | class NetworkAgentToken; | ||
447 | 29 | |||
448 | 30 | class NetworkAgent : public QObject | ||
449 | 31 | { | ||
450 | 32 | Q_OBJECT | ||
451 | 33 | public: | ||
452 | 34 | NetworkAgent(QObject *parent=0); | ||
453 | 35 | ~NetworkAgent(); | ||
454 | 36 | |||
455 | 37 | Q_INVOKABLE void authenticate(const QVariant &token, const QString &key); | ||
456 | 38 | Q_INVOKABLE void cancel(const QVariant &token); | ||
457 | 39 | |||
458 | 40 | Q_SIGNALS: | ||
459 | 41 | void secretRequested(const QVariant &token); | ||
460 | 42 | void secretRequestCancelled(); | ||
461 | 43 | |||
462 | 44 | private: | ||
463 | 45 | UnitySettingsSecretAgent *m_agent; | ||
464 | 46 | |||
465 | 47 | static void onSecretRequested(UnitySettingsSecretAgent *agent, | ||
466 | 48 | guint id, | ||
467 | 49 | NMConnection *connection, | ||
468 | 50 | const char *setting_name, | ||
469 | 51 | const char **hints, | ||
470 | 52 | NMSecretAgentGetSecretsFlags flags, | ||
471 | 53 | NetworkAgent *self); | ||
472 | 54 | |||
473 | 55 | static void onSecretRequestCancelled(UnitySettingsSecretAgent *agent, | ||
474 | 56 | guint id, | ||
475 | 57 | NMConnection *connection, | ||
476 | 58 | const char *setting_name, | ||
477 | 59 | const char **hints, | ||
478 | 60 | NMSecretAgentGetSecretsFlags flags, | ||
479 | 61 | NetworkAgent *self); | ||
480 | 62 | |||
481 | 63 | }; | ||
482 | 64 | |||
483 | 65 | #endif | ||
484 | 66 | 0 | ||
485 | === removed file 'plugins/Unity/Indicators/Network/plugin.cpp' | |||
486 | --- plugins/Unity/Indicators/Network/plugin.cpp 2013-08-23 11:56:44 +0000 | |||
487 | +++ plugins/Unity/Indicators/Network/plugin.cpp 1970-01-01 00:00:00 +0000 | |||
488 | @@ -1,31 +0,0 @@ | |||
489 | 1 | /* | ||
490 | 2 | * Copyright (C) 2012 Canonical, Ltd. | ||
491 | 3 | * | ||
492 | 4 | * This program is free software; you can redistribute it and/or modify | ||
493 | 5 | * it under the terms of the GNU General Public License as published by | ||
494 | 6 | * the Free Software Foundation; version 3. | ||
495 | 7 | * | ||
496 | 8 | * This program is distributed in the hope that it will be useful, | ||
497 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
498 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
499 | 11 | * GNU General Public License for more details. | ||
500 | 12 | * | ||
501 | 13 | * You should have received a copy of the GNU General Public License | ||
502 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
503 | 15 | * | ||
504 | 16 | * Author: Nick Dedekind <nick.dedekind@canonical.com> | ||
505 | 17 | */ | ||
506 | 18 | |||
507 | 19 | // Qt | ||
508 | 20 | #include <QtQml/qqml.h> | ||
509 | 21 | |||
510 | 22 | // self | ||
511 | 23 | #include "plugin.h" | ||
512 | 24 | |||
513 | 25 | // local | ||
514 | 26 | #include "networkagent.h" | ||
515 | 27 | |||
516 | 28 | void IndicatorsNetworkPlugin::registerTypes(const char *uri) | ||
517 | 29 | { | ||
518 | 30 | qmlRegisterType<NetworkAgent>(uri, 0, 1, "NetworkAgent"); | ||
519 | 31 | } | ||
520 | 32 | 0 | ||
521 | === removed file 'plugins/Unity/Indicators/Network/plugin.h' | |||
522 | --- plugins/Unity/Indicators/Network/plugin.h 2013-06-17 08:14:24 +0000 | |||
523 | +++ plugins/Unity/Indicators/Network/plugin.h 1970-01-01 00:00:00 +0000 | |||
524 | @@ -1,32 +0,0 @@ | |||
525 | 1 | /* | ||
526 | 2 | * Copyright (C) 2012 Canonical, Ltd. | ||
527 | 3 | * | ||
528 | 4 | * This program is free software; you can redistribute it and/or modify | ||
529 | 5 | * it under the terms of the GNU General Public License as published by | ||
530 | 6 | * the Free Software Foundation; version 3. | ||
531 | 7 | * | ||
532 | 8 | * This program is distributed in the hope that it will be useful, | ||
533 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
534 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
535 | 11 | * GNU General Public License for more details. | ||
536 | 12 | * | ||
537 | 13 | * You should have received a copy of the GNU General Public License | ||
538 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
539 | 15 | * | ||
540 | 16 | * Author: Nick Dedekind <nick.dedekind@canonical.com> | ||
541 | 17 | */ | ||
542 | 18 | |||
543 | 19 | #ifndef INDICATORS_NETWORK_PLUGIN_H | ||
544 | 20 | #define INDICATORS_NETWORK_PLUGIN_H | ||
545 | 21 | |||
546 | 22 | #include <QtQml/QQmlExtensionPlugin> | ||
547 | 23 | |||
548 | 24 | class IndicatorsNetworkPlugin : public QQmlExtensionPlugin | ||
549 | 25 | { | ||
550 | 26 | Q_OBJECT | ||
551 | 27 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") | ||
552 | 28 | public: | ||
553 | 29 | void registerTypes(const char *uri); | ||
554 | 30 | }; | ||
555 | 31 | |||
556 | 32 | #endif // INDICATORS_NETWORK_PLUGIN_H | ||
557 | 33 | 0 | ||
558 | === removed file 'plugins/Unity/Indicators/Network/qml/PasswordPage.qml' | |||
559 | --- plugins/Unity/Indicators/Network/qml/PasswordPage.qml 2013-08-21 21:00:17 +0000 | |||
560 | +++ plugins/Unity/Indicators/Network/qml/PasswordPage.qml 1970-01-01 00:00:00 +0000 | |||
561 | @@ -1,88 +0,0 @@ | |||
562 | 1 | /* | ||
563 | 2 | * Copyright 2013 Canonical Ltd. | ||
564 | 3 | * | ||
565 | 4 | * This program is free software; you can redistribute it and/or modify | ||
566 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
567 | 6 | * the Free Software Foundation; version 3. | ||
568 | 7 | * | ||
569 | 8 | * This program is distributed in the hope that it will be useful, | ||
570 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
571 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
572 | 11 | * GNU Lesser General Public License for more details. | ||
573 | 12 | * | ||
574 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
575 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
576 | 15 | * | ||
577 | 16 | * Authors: | ||
578 | 17 | * Renato Araujo Oliveira Filho <renato@canonical.com> | ||
579 | 18 | */ | ||
580 | 19 | |||
581 | 20 | import QtQuick 2.0 | ||
582 | 21 | import Ubuntu.Components 0.1 | ||
583 | 22 | import Ubuntu.Components.ListItems 0.1 as ListItem | ||
584 | 23 | import Unity.Indicators 0.1 as Indicators | ||
585 | 24 | |||
586 | 25 | Page { | ||
587 | 26 | id: pagePassword | ||
588 | 27 | |||
589 | 28 | property variant agent | ||
590 | 29 | property variant token | ||
591 | 30 | |||
592 | 31 | anchors.fill: parent | ||
593 | 32 | title: "Network Authentication" | ||
594 | 33 | |||
595 | 34 | Column { | ||
596 | 35 | anchors { | ||
597 | 36 | left: parent.left | ||
598 | 37 | right: parent.right | ||
599 | 38 | } | ||
600 | 39 | |||
601 | 40 | Indicators.SectionMenuItem { | ||
602 | 41 | text: "Authentication" | ||
603 | 42 | } | ||
604 | 43 | |||
605 | 44 | Indicators.FramedMenuItem { | ||
606 | 45 | implicitHeight: password.height + units.gu(1) | ||
607 | 46 | |||
608 | 47 | PasswordTextField { | ||
609 | 48 | id: password | ||
610 | 49 | anchors { | ||
611 | 50 | left: parent.left | ||
612 | 51 | right: parent.right | ||
613 | 52 | margins: units.gu(3) | ||
614 | 53 | verticalCenter: parent.verticalCenter | ||
615 | 54 | } | ||
616 | 55 | } | ||
617 | 56 | } | ||
618 | 57 | |||
619 | 58 | Indicators.FramedMenuItem { | ||
620 | 59 | Row { | ||
621 | 60 | anchors { | ||
622 | 61 | right: parent.right | ||
623 | 62 | verticalCenter: parent.verticalCenter | ||
624 | 63 | margins: units.gu(3) | ||
625 | 64 | } | ||
626 | 65 | |||
627 | 66 | spacing: units.gu(1) | ||
628 | 67 | |||
629 | 68 | Button { | ||
630 | 69 | text: "Cancel" | ||
631 | 70 | width: units.gu(10) | ||
632 | 71 | onClicked: { | ||
633 | 72 | agent.cancel(token); | ||
634 | 73 | pageStack.pop(); | ||
635 | 74 | } | ||
636 | 75 | } | ||
637 | 76 | |||
638 | 77 | Button { | ||
639 | 78 | text: "OK" | ||
640 | 79 | width: units.gu(10) | ||
641 | 80 | onClicked: { | ||
642 | 81 | agent.authenticate(token, password.text); | ||
643 | 82 | pageStack.pop(); | ||
644 | 83 | } | ||
645 | 84 | } | ||
646 | 85 | } | ||
647 | 86 | } | ||
648 | 87 | } | ||
649 | 88 | } | ||
650 | 89 | 0 | ||
651 | === removed file 'plugins/Unity/Indicators/Network/qml/PasswordTextField.qml' | |||
652 | --- plugins/Unity/Indicators/Network/qml/PasswordTextField.qml 2013-07-05 15:05:28 +0000 | |||
653 | +++ plugins/Unity/Indicators/Network/qml/PasswordTextField.qml 1970-01-01 00:00:00 +0000 | |||
654 | @@ -1,68 +0,0 @@ | |||
655 | 1 | /* | ||
656 | 2 | * Copyright 2013 Canonical Ltd. | ||
657 | 3 | * | ||
658 | 4 | * This program is free software; you can redistribute it and/or modify | ||
659 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
660 | 6 | * the Free Software Foundation; version 3. | ||
661 | 7 | * | ||
662 | 8 | * This program is distributed in the hope that it will be useful, | ||
663 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
664 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
665 | 11 | * GNU Lesser General Public License for more details. | ||
666 | 12 | * | ||
667 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
668 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
669 | 15 | * | ||
670 | 16 | * Authors: | ||
671 | 17 | * Renato Araujo Oliveira Filho <renato@canonical.com> | ||
672 | 18 | */ | ||
673 | 19 | |||
674 | 20 | import QtQuick 2.0 | ||
675 | 21 | import Ubuntu.Components 0.1 | ||
676 | 22 | |||
677 | 23 | Item { | ||
678 | 24 | id: textMenu | ||
679 | 25 | |||
680 | 26 | property alias text: textField.text | ||
681 | 27 | |||
682 | 28 | height: contentColumn.height | ||
683 | 29 | |||
684 | 30 | Column { | ||
685 | 31 | id: contentColumn | ||
686 | 32 | spacing: units.gu(0.5) | ||
687 | 33 | anchors { | ||
688 | 34 | left: parent.left | ||
689 | 35 | right: parent.right | ||
690 | 36 | } | ||
691 | 37 | |||
692 | 38 | TextField { | ||
693 | 39 | id: textField | ||
694 | 40 | |||
695 | 41 | anchors { | ||
696 | 42 | left: parent.left | ||
697 | 43 | right: parent.right | ||
698 | 44 | } | ||
699 | 45 | |||
700 | 46 | placeholderText: "Password" | ||
701 | 47 | echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password | ||
702 | 48 | } | ||
703 | 49 | |||
704 | 50 | Row { | ||
705 | 51 | anchors { | ||
706 | 52 | left: parent.left | ||
707 | 53 | right: parent.right | ||
708 | 54 | } | ||
709 | 55 | |||
710 | 56 | spacing: units.gu(1) | ||
711 | 57 | |||
712 | 58 | CheckBox { | ||
713 | 59 | id: showPassword | ||
714 | 60 | } | ||
715 | 61 | |||
716 | 62 | Label { | ||
717 | 63 | text: "Show password" | ||
718 | 64 | anchors.verticalCenter: showPassword.verticalCenter | ||
719 | 65 | } | ||
720 | 66 | } | ||
721 | 67 | } | ||
722 | 68 | } | ||
723 | 69 | 0 | ||
724 | === modified file 'plugins/Unity/Indicators/Network/qml/qmldir' | |||
725 | --- plugins/Unity/Indicators/Network/qml/qmldir 2013-08-21 21:00:17 +0000 | |||
726 | +++ plugins/Unity/Indicators/Network/qml/qmldir 2013-10-03 12:34:55 +0000 | |||
727 | @@ -1,8 +1,3 @@ | |||
728 | 1 | module Unity.Indicators.Network | 1 | module Unity.Indicators.Network |
729 | 2 | plugin IndicatorsNetworkQml | ||
730 | 3 | typeinfo plugin.qmltypes | ||
731 | 4 | 2 | ||
732 | 5 | NetworkPage 0.1 NetworkPage.qml | ||
733 | 6 | AccessPoint 0.1 AccessPoint.qml | 3 | AccessPoint 0.1 AccessPoint.qml |
734 | 7 | PasswordPage 0.1 PasswordPage.qml | ||
735 | 8 | PasswordTextField 0.1 PasswordTextField.qml | ||
736 | 9 | \ No newline at end of file | 4 | \ No newline at end of file |
737 | 10 | 5 | ||
738 | === removed file 'plugins/Unity/Indicators/Network/secret-agent.c' | |||
739 | --- plugins/Unity/Indicators/Network/secret-agent.c 2013-06-07 12:51:16 +0000 | |||
740 | +++ plugins/Unity/Indicators/Network/secret-agent.c 1970-01-01 00:00:00 +0000 | |||
741 | @@ -1,382 +0,0 @@ | |||
742 | 1 | /* | ||
743 | 2 | * Copyright 2013 Canonical Ltd. | ||
744 | 3 | * | ||
745 | 4 | * This program is free software; you can redistribute it and/or modify | ||
746 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
747 | 6 | * the Free Software Foundation; version 3. | ||
748 | 7 | * | ||
749 | 8 | * This program is distributed in the hope that it will be useful, | ||
750 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
751 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
752 | 11 | * GNU Lesser General Public License for more details. | ||
753 | 12 | * | ||
754 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
755 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
756 | 15 | * | ||
757 | 16 | * Authors: | ||
758 | 17 | * Alberto Ruiz <alberto.ruiz@canonical.com> | ||
759 | 18 | * Renato Araujo Oliveira Filho <renato@canonical.com> | ||
760 | 19 | */ | ||
761 | 20 | |||
762 | 21 | |||
763 | 22 | #include <glib.h> | ||
764 | 23 | #include <glib-object.h> | ||
765 | 24 | #include <nm-secret-agent.h> | ||
766 | 25 | #include "secret-agent.h" | ||
767 | 26 | |||
768 | 27 | #define UNITY_SETTINGS_TYPE_SECRET_AGENT (unity_settings_secret_agent_get_type ()) | ||
769 | 28 | #define UNITY_SETTINGS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgent)) | ||
770 | 29 | #define UNITY_SETTINGS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass)) | ||
771 | 30 | #define UNITY_SETTINGS_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT)) | ||
772 | 31 | #define UNITY_SETTINGS_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT)) | ||
773 | 32 | #define UNITY_SETTINGS_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass)) | ||
774 | 33 | #define UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentPrivate)) | ||
775 | 34 | |||
776 | 35 | #define AGENT_ID "com.canonical.settings.network.nm-agent" | ||
777 | 36 | |||
778 | 37 | static gpointer unity_settings_secret_agent_parent_class = NULL; | ||
779 | 38 | |||
780 | 39 | typedef struct _UnitySettingsSecretAgentPrivate UnitySettingsSecretAgentPrivate; | ||
781 | 40 | |||
782 | 41 | struct _UnitySettingsSecretAgentPrivate { | ||
783 | 42 | GQueue *requests; | ||
784 | 43 | }; | ||
785 | 44 | |||
786 | 45 | typedef struct _SecretRequest { | ||
787 | 46 | gint id; | ||
788 | 47 | NMSecretAgent *agent; | ||
789 | 48 | NMConnection *connection; | ||
790 | 49 | const char *connection_path; | ||
791 | 50 | const char *setting_name; | ||
792 | 51 | const char **hints; | ||
793 | 52 | NMSecretAgentGetSecretsFlags flags; | ||
794 | 53 | NMSecretAgentGetSecretsFunc callback; | ||
795 | 54 | gpointer callback_data; | ||
796 | 55 | } SecretRequest; | ||
797 | 56 | |||
798 | 57 | GType unity_settings_secret_agent_get_type (void) G_GNUC_CONST; | ||
799 | 58 | enum { | ||
800 | 59 | UNITY_SETTINGS_SECRET_AGENT_DUMMY_PROPERTY | ||
801 | 60 | }; | ||
802 | 61 | |||
803 | 62 | enum { | ||
804 | 63 | SECRET_REQUESTED, | ||
805 | 64 | REQUEST_CANCELLED, | ||
806 | 65 | LAST_SIGNAL | ||
807 | 66 | }; | ||
808 | 67 | |||
809 | 68 | static guint signals[LAST_SIGNAL] = { 0 }; | ||
810 | 69 | |||
811 | 70 | UnitySettingsSecretAgent* unity_settings_secret_agent_new (void); | ||
812 | 71 | UnitySettingsSecretAgent* unity_settings_secret_agent_construct (GType object_type); | ||
813 | 72 | |||
814 | 73 | int | ||
815 | 74 | secret_request_find (SecretRequest *req, | ||
816 | 75 | guint *id) | ||
817 | 76 | { | ||
818 | 77 | if (req->id > *id) | ||
819 | 78 | return -1; | ||
820 | 79 | |||
821 | 80 | if (req->id < *id) | ||
822 | 81 | return 1; | ||
823 | 82 | |||
824 | 83 | return 0; | ||
825 | 84 | } | ||
826 | 85 | |||
827 | 86 | void | ||
828 | 87 | unity_settings_secret_agent_provide_secret (UnitySettingsSecretAgent *agent, | ||
829 | 88 | guint request, | ||
830 | 89 | GHashTable *secrets) | ||
831 | 90 | { | ||
832 | 91 | GList *iter; | ||
833 | 92 | SecretRequest *req; | ||
834 | 93 | UnitySettingsSecretAgentPrivate *priv = agent->priv; | ||
835 | 94 | |||
836 | 95 | iter = g_queue_find_custom (priv->requests, | ||
837 | 96 | &request, | ||
838 | 97 | (GCompareFunc)secret_request_find); | ||
839 | 98 | |||
840 | 99 | if (iter == NULL || iter->data == NULL) | ||
841 | 100 | { | ||
842 | 101 | g_warning ("Secret request with id <%d> was not found", (int)request); | ||
843 | 102 | return; | ||
844 | 103 | } | ||
845 | 104 | |||
846 | 105 | req = iter->data; | ||
847 | 106 | |||
848 | 107 | req->callback (NM_SECRET_AGENT (agent), | ||
849 | 108 | req->connection, | ||
850 | 109 | secrets, | ||
851 | 110 | NULL, | ||
852 | 111 | req->callback_data); | ||
853 | 112 | |||
854 | 113 | g_queue_remove_all (priv->requests, req); | ||
855 | 114 | g_free (req); | ||
856 | 115 | return; | ||
857 | 116 | } | ||
858 | 117 | |||
859 | 118 | void | ||
860 | 119 | free_request (SecretRequest *req) | ||
861 | 120 | { | ||
862 | 121 | g_object_unref (req->connection); | ||
863 | 122 | g_free (req); | ||
864 | 123 | } | ||
865 | 124 | |||
866 | 125 | void | ||
867 | 126 | unity_settings_secret_agent_cancel_request (UnitySettingsSecretAgent *agent, | ||
868 | 127 | guint request) | ||
869 | 128 | { | ||
870 | 129 | GList *iter; | ||
871 | 130 | SecretRequest *req; | ||
872 | 131 | UnitySettingsSecretAgentPrivate *priv = agent->priv; | ||
873 | 132 | GError *error; | ||
874 | 133 | |||
875 | 134 | iter = g_queue_find_custom (priv->requests, | ||
876 | 135 | &request, | ||
877 | 136 | (GCompareFunc)secret_request_find); | ||
878 | 137 | |||
879 | 138 | if (iter == NULL || iter->data == NULL) | ||
880 | 139 | { | ||
881 | 140 | g_warning ("Secret request with id <%d> was not found", (int)request); | ||
882 | 141 | return; | ||
883 | 142 | } | ||
884 | 143 | |||
885 | 144 | req = iter->data; | ||
886 | 145 | error = g_error_new (NM_SECRET_AGENT_ERROR, | ||
887 | 146 | NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, | ||
888 | 147 | "This secret request was canceled by the user."); | ||
889 | 148 | |||
890 | 149 | req->callback (NM_SECRET_AGENT (agent), | ||
891 | 150 | req->connection, | ||
892 | 151 | NULL, | ||
893 | 152 | error, | ||
894 | 153 | req->callback_data); | ||
895 | 154 | |||
896 | 155 | g_queue_remove_all (priv->requests, req); | ||
897 | 156 | free_request (req); | ||
898 | 157 | return; | ||
899 | 158 | } | ||
900 | 159 | |||
901 | 160 | static void | ||
902 | 161 | delete_secrets (NMSecretAgent *agent, | ||
903 | 162 | NMConnection *connection, | ||
904 | 163 | const char *connection_path, | ||
905 | 164 | NMSecretAgentDeleteSecretsFunc callback, | ||
906 | 165 | gpointer callback_data) | ||
907 | 166 | { | ||
908 | 167 | g_debug ("delete secrets"); | ||
909 | 168 | } | ||
910 | 169 | |||
911 | 170 | /* If it returns G_MAXUINT it's considered an error */ | ||
912 | 171 | static guint | ||
913 | 172 | find_available_id (UnitySettingsSecretAgentPrivate *priv) | ||
914 | 173 | { | ||
915 | 174 | guint i = 0; | ||
916 | 175 | guint candidate = 0; | ||
917 | 176 | |||
918 | 177 | if (g_queue_get_length (priv->requests) == G_MAXUINT) | ||
919 | 178 | return G_MAXUINT; | ||
920 | 179 | |||
921 | 180 | while (i < g_queue_get_length (priv->requests)) | ||
922 | 181 | { | ||
923 | 182 | SecretRequest *req = (SecretRequest*)g_queue_peek_nth (priv->requests, i); | ||
924 | 183 | |||
925 | 184 | if (req->id == candidate) | ||
926 | 185 | { | ||
927 | 186 | candidate++; | ||
928 | 187 | i = 0; | ||
929 | 188 | } | ||
930 | 189 | else | ||
931 | 190 | { | ||
932 | 191 | i++; | ||
933 | 192 | } | ||
934 | 193 | } | ||
935 | 194 | |||
936 | 195 | return i; | ||
937 | 196 | } | ||
938 | 197 | |||
939 | 198 | static void | ||
940 | 199 | get_secrets (NMSecretAgent *agent, | ||
941 | 200 | NMConnection *connection, | ||
942 | 201 | const char *connection_path, | ||
943 | 202 | const char *setting_name, | ||
944 | 203 | const char **hints, | ||
945 | 204 | NMSecretAgentGetSecretsFlags flags, | ||
946 | 205 | NMSecretAgentGetSecretsFunc callback, | ||
947 | 206 | gpointer callback_data) | ||
948 | 207 | { | ||
949 | 208 | guint id; | ||
950 | 209 | UnitySettingsSecretAgentPrivate *priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (agent); | ||
951 | 210 | SecretRequest *req = NULL; | ||
952 | 211 | |||
953 | 212 | if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE) | ||
954 | 213 | { | ||
955 | 214 | GError *error = g_error_new (NM_SECRET_AGENT_ERROR, | ||
956 | 215 | NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, | ||
957 | 216 | "No password found for this connection."); | ||
958 | 217 | callback (agent, connection, NULL, error, callback_data); | ||
959 | 218 | g_error_free (error); | ||
960 | 219 | return; | ||
961 | 220 | } | ||
962 | 221 | |||
963 | 222 | id = find_available_id (priv); | ||
964 | 223 | if (id == G_MAXUINT) | ||
965 | 224 | { | ||
966 | 225 | GError *error = g_error_new (NM_SECRET_AGENT_ERROR, | ||
967 | 226 | NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, | ||
968 | 227 | "Reached maximum number of requests."); | ||
969 | 228 | callback (agent, connection, NULL, error, callback_data); | ||
970 | 229 | g_error_free (error); | ||
971 | 230 | return; | ||
972 | 231 | } | ||
973 | 232 | |||
974 | 233 | /* Adding a request */ | ||
975 | 234 | req = (SecretRequest*) g_malloc0 (sizeof (SecretRequest)); | ||
976 | 235 | *req = ((SecretRequest) | ||
977 | 236 | { id, | ||
978 | 237 | agent, | ||
979 | 238 | connection, | ||
980 | 239 | connection_path, | ||
981 | 240 | setting_name, | ||
982 | 241 | hints, | ||
983 | 242 | flags, | ||
984 | 243 | callback, | ||
985 | 244 | callback_data }); | ||
986 | 245 | |||
987 | 246 | g_object_ref (connection); | ||
988 | 247 | |||
989 | 248 | g_queue_push_tail (priv->requests, req); | ||
990 | 249 | |||
991 | 250 | g_signal_emit_by_name (agent, | ||
992 | 251 | UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED, | ||
993 | 252 | id, | ||
994 | 253 | connection, | ||
995 | 254 | setting_name, | ||
996 | 255 | hints, | ||
997 | 256 | flags); | ||
998 | 257 | } | ||
999 | 258 | |||
1000 | 259 | static void | ||
1001 | 260 | save_secrets (NMSecretAgent *agent, | ||
1002 | 261 | NMConnection *connection, | ||
1003 | 262 | const char *connection_path, | ||
1004 | 263 | NMSecretAgentSaveSecretsFunc callback, | ||
1005 | 264 | gpointer callback_data) | ||
1006 | 265 | { | ||
1007 | 266 | g_debug ("save secrets"); | ||
1008 | 267 | } | ||
1009 | 268 | |||
1010 | 269 | static void | ||
1011 | 270 | cancel_get_secrets (NMSecretAgent *agent, | ||
1012 | 271 | const char *connection_path, | ||
1013 | 272 | const char *setting_name) | ||
1014 | 273 | { | ||
1015 | 274 | g_debug ("cancel get secrets"); | ||
1016 | 275 | } | ||
1017 | 276 | |||
1018 | 277 | UnitySettingsSecretAgent* | ||
1019 | 278 | unity_settings_secret_agent_construct (GType object_type) | ||
1020 | 279 | { | ||
1021 | 280 | UnitySettingsSecretAgent * self = NULL; | ||
1022 | 281 | self = (UnitySettingsSecretAgent*) g_object_new (object_type, | ||
1023 | 282 | NM_SECRET_AGENT_IDENTIFIER, AGENT_ID, | ||
1024 | 283 | NULL); | ||
1025 | 284 | return self; | ||
1026 | 285 | } | ||
1027 | 286 | |||
1028 | 287 | |||
1029 | 288 | UnitySettingsSecretAgent* | ||
1030 | 289 | unity_settings_secret_agent_new (void) | ||
1031 | 290 | { | ||
1032 | 291 | return unity_settings_secret_agent_construct (UNITY_SETTINGS_TYPE_SECRET_AGENT); | ||
1033 | 292 | } | ||
1034 | 293 | |||
1035 | 294 | static void | ||
1036 | 295 | destroy_pending_request (gpointer data) | ||
1037 | 296 | { | ||
1038 | 297 | SecretRequest* req = (SecretRequest*)data; | ||
1039 | 298 | /* Reporting the cancellation of all pending requests */ | ||
1040 | 299 | g_signal_emit_by_name (req->agent, | ||
1041 | 300 | UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED, | ||
1042 | 301 | req->id); | ||
1043 | 302 | |||
1044 | 303 | free_request (req); | ||
1045 | 304 | } | ||
1046 | 305 | |||
1047 | 306 | static void | ||
1048 | 307 | unity_settings_secret_agent_finalize (GObject *agent) | ||
1049 | 308 | { | ||
1050 | 309 | UnitySettingsSecretAgentPrivate *priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (agent); | ||
1051 | 310 | |||
1052 | 311 | g_queue_free_full (priv->requests, destroy_pending_request); | ||
1053 | 312 | } | ||
1054 | 313 | |||
1055 | 314 | static void | ||
1056 | 315 | unity_settings_secret_agent_class_init (UnitySettingsSecretAgentClass *klass) | ||
1057 | 316 | { | ||
1058 | 317 | unity_settings_secret_agent_parent_class = g_type_class_peek_parent (klass); | ||
1059 | 318 | NMSecretAgentClass *parent_class = NM_SECRET_AGENT_CLASS (klass); | ||
1060 | 319 | parent_class->get_secrets = get_secrets; | ||
1061 | 320 | parent_class->save_secrets = save_secrets; | ||
1062 | 321 | parent_class->delete_secrets = delete_secrets; | ||
1063 | 322 | parent_class->cancel_get_secrets = cancel_get_secrets; | ||
1064 | 323 | |||
1065 | 324 | g_type_class_add_private (klass, sizeof(UnitySettingsSecretAgentPrivate)); | ||
1066 | 325 | G_OBJECT_CLASS (klass)->finalize = unity_settings_secret_agent_finalize; | ||
1067 | 326 | |||
1068 | 327 | |||
1069 | 328 | signals[SECRET_REQUESTED] = g_signal_new (UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED, | ||
1070 | 329 | G_OBJECT_CLASS_TYPE (G_OBJECT_CLASS (klass)), | ||
1071 | 330 | G_SIGNAL_RUN_FIRST, | ||
1072 | 331 | G_STRUCT_OFFSET (UnitySettingsSecretAgentClass, secret_requested), | ||
1073 | 332 | NULL, NULL, NULL, | ||
1074 | 333 | G_TYPE_NONE, 5, | ||
1075 | 334 | G_TYPE_UINT, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT); | ||
1076 | 335 | |||
1077 | 336 | signals[REQUEST_CANCELLED] = g_signal_new (UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED, | ||
1078 | 337 | G_OBJECT_CLASS_TYPE (G_OBJECT_CLASS (klass)), | ||
1079 | 338 | G_SIGNAL_RUN_FIRST, | ||
1080 | 339 | G_STRUCT_OFFSET (UnitySettingsSecretAgentClass, request_cancelled), | ||
1081 | 340 | NULL, NULL, NULL, | ||
1082 | 341 | G_TYPE_NONE, 1, | ||
1083 | 342 | G_TYPE_UINT); | ||
1084 | 343 | } | ||
1085 | 344 | |||
1086 | 345 | |||
1087 | 346 | static void | ||
1088 | 347 | unity_settings_secret_agent_instance_init (UnitySettingsSecretAgent *self) | ||
1089 | 348 | { | ||
1090 | 349 | self->priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (self); | ||
1091 | 350 | self->priv->requests = g_queue_new (); | ||
1092 | 351 | } | ||
1093 | 352 | |||
1094 | 353 | GType | ||
1095 | 354 | unity_settings_secret_agent_get_type (void) | ||
1096 | 355 | { | ||
1097 | 356 | static volatile gsize unity_settings_secret_agent_type_id__volatile = 0; | ||
1098 | 357 | if (g_once_init_enter (&unity_settings_secret_agent_type_id__volatile)) | ||
1099 | 358 | { | ||
1100 | 359 | static const GTypeInfo g_define_type_info = | ||
1101 | 360 | { | ||
1102 | 361 | sizeof (UnitySettingsSecretAgentClass), | ||
1103 | 362 | (GBaseInitFunc) NULL, | ||
1104 | 363 | (GBaseFinalizeFunc) NULL, | ||
1105 | 364 | (GClassInitFunc) unity_settings_secret_agent_class_init, | ||
1106 | 365 | (GClassFinalizeFunc) NULL, | ||
1107 | 366 | NULL, | ||
1108 | 367 | sizeof (UnitySettingsSecretAgent), | ||
1109 | 368 | 0, | ||
1110 | 369 | (GInstanceInitFunc) unity_settings_secret_agent_instance_init, | ||
1111 | 370 | NULL | ||
1112 | 371 | }; | ||
1113 | 372 | GType unity_settings_secret_agent_type_id; | ||
1114 | 373 | unity_settings_secret_agent_type_id = g_type_register_static (NM_TYPE_SECRET_AGENT, | ||
1115 | 374 | "UnitySettingsSecretAgent", | ||
1116 | 375 | &g_define_type_info, | ||
1117 | 376 | 0); | ||
1118 | 377 | g_once_init_leave (&unity_settings_secret_agent_type_id__volatile, | ||
1119 | 378 | unity_settings_secret_agent_type_id); | ||
1120 | 379 | } | ||
1121 | 380 | |||
1122 | 381 | return unity_settings_secret_agent_type_id__volatile; | ||
1123 | 382 | } | ||
1124 | 383 | 0 | ||
1125 | === removed file 'plugins/Unity/Indicators/Network/secret-agent.h' | |||
1126 | --- plugins/Unity/Indicators/Network/secret-agent.h 2013-06-07 12:51:16 +0000 | |||
1127 | +++ plugins/Unity/Indicators/Network/secret-agent.h 1970-01-01 00:00:00 +0000 | |||
1128 | @@ -1,102 +0,0 @@ | |||
1129 | 1 | /* | ||
1130 | 2 | * Copyright 2013 Canonical Ltd. | ||
1131 | 3 | * | ||
1132 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1133 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1134 | 6 | * the Free Software Foundation; version 3. | ||
1135 | 7 | * | ||
1136 | 8 | * This program is distributed in the hope that it will be useful, | ||
1137 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1138 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1139 | 11 | * GNU Lesser General Public License for more details. | ||
1140 | 12 | * | ||
1141 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1142 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1143 | 15 | * | ||
1144 | 16 | * Authors: | ||
1145 | 17 | * Alberto Ruiz <alberto.ruiz@canonical.com> | ||
1146 | 18 | * Renato Araujo Oliveira Filho <renato@canonical.com> | ||
1147 | 19 | */ | ||
1148 | 20 | |||
1149 | 21 | #ifndef __SECRET_AGENT_H__ | ||
1150 | 22 | #define __SECRET_AGENT_H__ | ||
1151 | 23 | |||
1152 | 24 | #include <glib.h> | ||
1153 | 25 | #include <glib-object.h> | ||
1154 | 26 | #include <nm-secret-agent.h> | ||
1155 | 27 | |||
1156 | 28 | /* | ||
1157 | 29 | * This class is a basic implementation of the NetworkManager SecretAgent base class. | ||
1158 | 30 | * | ||
1159 | 31 | * The purpose of this class is to handle credential requests from the network, | ||
1160 | 32 | * for example, from a WiFi hotspot or a VPN network. | ||
1161 | 33 | * | ||
1162 | 34 | * It queues requests objects (SecretRequest) on a GQueue in the private struct | ||
1163 | 35 | * of the class. And notifies the consumer of the class through the "secret-request" | ||
1164 | 36 | * and the "request-cancelled" signals with the following callback prototypes: | ||
1165 | 37 | * | ||
1166 | 38 | * void (*secret_requested) (UnitySettingsSecretAgent *self, | ||
1167 | 39 | * guint id, | ||
1168 | 40 | * NMConnection *connection, | ||
1169 | 41 | * const char *setting_name, | ||
1170 | 42 | * const char **hints, | ||
1171 | 43 | * NMSecretAgentGetSecretsFlags flags, | ||
1172 | 44 | * gpointer user_data); | ||
1173 | 45 | * | ||
1174 | 46 | * void (*request_cancelled) (UnitySettingsSecretAgent *self, | ||
1175 | 47 | * guint id, | ||
1176 | 48 | * gpointer user_data); | ||
1177 | 49 | * | ||
1178 | 50 | */ | ||
1179 | 51 | |||
1180 | 52 | |||
1181 | 53 | G_BEGIN_DECLS | ||
1182 | 54 | |||
1183 | 55 | |||
1184 | 56 | #define UNITY_SETTINGS_TYPE_SECRET_AGENT (unity_settings_secret_agent_get_type ()) | ||
1185 | 57 | #define UNITY_SETTINGS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgent)) | ||
1186 | 58 | #define UNITY_SETTINGS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass)) | ||
1187 | 59 | #define UNITY_SETTINGS_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT)) | ||
1188 | 60 | #define UNITY_SETTINGS_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT)) | ||
1189 | 61 | #define UNITY_SETTINGS_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass)) | ||
1190 | 62 | |||
1191 | 63 | #define UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED "secret-requested" | ||
1192 | 64 | #define UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED "request-cancelled" | ||
1193 | 65 | |||
1194 | 66 | typedef struct _UnitySettingsSecretAgent UnitySettingsSecretAgent; | ||
1195 | 67 | typedef struct _UnitySettingsSecretAgentClass UnitySettingsSecretAgentClass; | ||
1196 | 68 | typedef struct _UnitySettingsSecretAgentPrivate UnitySettingsSecretAgentPrivate; | ||
1197 | 69 | |||
1198 | 70 | struct _UnitySettingsSecretAgent { | ||
1199 | 71 | NMSecretAgent parent_instance; | ||
1200 | 72 | UnitySettingsSecretAgentPrivate * priv; | ||
1201 | 73 | }; | ||
1202 | 74 | |||
1203 | 75 | struct _UnitySettingsSecretAgentClass { | ||
1204 | 76 | NMSecretAgentClass parent_class; | ||
1205 | 77 | |||
1206 | 78 | void (*secret_requested) (UnitySettingsSecretAgent *self, | ||
1207 | 79 | guint id, | ||
1208 | 80 | NMConnection *connection, | ||
1209 | 81 | const char *setting_name, | ||
1210 | 82 | const char **hints, | ||
1211 | 83 | NMSecretAgentGetSecretsFlags flags); | ||
1212 | 84 | |||
1213 | 85 | void (*request_cancelled) (UnitySettingsSecretAgent *self, | ||
1214 | 86 | guint id); | ||
1215 | 87 | }; | ||
1216 | 88 | |||
1217 | 89 | |||
1218 | 90 | GType unity_settings_secret_agent_get_type (void) G_GNUC_CONST; | ||
1219 | 91 | UnitySettingsSecretAgent* unity_settings_secret_agent_new (void); | ||
1220 | 92 | UnitySettingsSecretAgent* unity_settings_secret_agent_construct (GType object_type); | ||
1221 | 93 | |||
1222 | 94 | void unity_settings_secret_agent_provide_secret (UnitySettingsSecretAgent *agent, | ||
1223 | 95 | guint request, | ||
1224 | 96 | GHashTable *secrets); | ||
1225 | 97 | void unity_settings_secret_agent_cancel_request (UnitySettingsSecretAgent *agent, | ||
1226 | 98 | guint request); | ||
1227 | 99 | |||
1228 | 100 | G_END_DECLS | ||
1229 | 101 | |||
1230 | 102 | #endif | ||
1231 | 103 | 0 | ||
1232 | === modified file 'plugins/Unity/Indicators/indicatorsmodel.cpp' | |||
1233 | --- plugins/Unity/Indicators/indicatorsmodel.cpp 2013-10-02 16:07:39 +0000 | |||
1234 | +++ plugins/Unity/Indicators/indicatorsmodel.cpp 2013-10-03 12:34:55 +0000 | |||
1235 | @@ -214,21 +214,6 @@ | |||
1236 | 214 | return 1; | 214 | return 1; |
1237 | 215 | } | 215 | } |
1238 | 216 | 216 | ||
1239 | 217 | /*! \internal */ | ||
1240 | 218 | QVariant IndicatorsModel::defaultData(Indicator::Ptr indicator, int role) | ||
1241 | 219 | { | ||
1242 | 220 | switch (role) | ||
1243 | 221 | { | ||
1244 | 222 | case IndicatorsModelRole::Position: | ||
1245 | 223 | return 0; | ||
1246 | 224 | case IndicatorsModelRole::WidgetSource: | ||
1247 | 225 | return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorWidget.qml"; | ||
1248 | 226 | case IndicatorsModelRole::PageSource: | ||
1249 | 227 | return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorPage.qml"; | ||
1250 | 228 | } | ||
1251 | 229 | return QVariant(); | ||
1252 | 230 | } | ||
1253 | 231 | |||
1254 | 232 | Q_INVOKABLE QVariant IndicatorsModel::data(int row, int role) const | 217 | Q_INVOKABLE QVariant IndicatorsModel::data(int row, int role) const |
1255 | 233 | { | 218 | { |
1256 | 234 | return data(index(row, 0), role); | 219 | return data(index(row, 0), role); |
1257 | @@ -263,26 +248,15 @@ | |||
1258 | 263 | } | 248 | } |
1259 | 264 | break; | 249 | break; |
1260 | 265 | case IndicatorsModelRole::WidgetSource: | 250 | case IndicatorsModelRole::WidgetSource: |
1261 | 251 | return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorWidget.qml"; | ||
1262 | 266 | case IndicatorsModelRole::PageSource: | 252 | case IndicatorsModelRole::PageSource: |
1264 | 267 | return indicatorData(indicator, role); | 253 | return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorPage.qml"; |
1265 | 268 | default: | 254 | default: |
1266 | 269 | break; | 255 | break; |
1267 | 270 | } | 256 | } |
1268 | 271 | return QVariant(); | 257 | return QVariant(); |
1269 | 272 | } | 258 | } |
1270 | 273 | 259 | ||
1271 | 274 | QVariant IndicatorsModel::indicatorData(const Indicator::Ptr& indicator, int role) const | ||
1272 | 275 | { | ||
1273 | 276 | if (indicator && m_parsed_indicator_data.contains(indicator->identifier())) | ||
1274 | 277 | { | ||
1275 | 278 | QVariantMap data = m_parsed_indicator_data[indicator->identifier()]; | ||
1276 | 279 | if (data.contains(roleNames()[role])) { | ||
1277 | 280 | return data[roleNames()[role]]; | ||
1278 | 281 | } | ||
1279 | 282 | } | ||
1280 | 283 | return defaultData(indicator, role); | ||
1281 | 284 | } | ||
1282 | 285 | |||
1283 | 286 | /*! \internal */ | 260 | /*! \internal */ |
1284 | 287 | QModelIndex IndicatorsModel::parent(const QModelIndex&) const | 261 | QModelIndex IndicatorsModel::parent(const QModelIndex&) const |
1285 | 288 | { | 262 | { |
1286 | @@ -294,24 +268,3 @@ | |||
1287 | 294 | { | 268 | { |
1288 | 295 | return m_indicators.count(); | 269 | return m_indicators.count(); |
1289 | 296 | } | 270 | } |
1290 | 297 | |||
1291 | 298 | void IndicatorsModel::setIndicatorData(const QVariant& data) | ||
1292 | 299 | { | ||
1293 | 300 | m_indicator_data = data; | ||
1294 | 301 | |||
1295 | 302 | m_parsed_indicator_data.clear(); | ||
1296 | 303 | QMap<QString, QVariant> map = data.toMap(); | ||
1297 | 304 | QMapIterator<QString, QVariant> iter(map); | ||
1298 | 305 | while(iter.hasNext()) | ||
1299 | 306 | { | ||
1300 | 307 | iter.next(); | ||
1301 | 308 | m_parsed_indicator_data[iter.key()] = iter.value().toMap(); | ||
1302 | 309 | } | ||
1303 | 310 | |||
1304 | 311 | Q_EMIT indicatorDataChanged(m_indicator_data); | ||
1305 | 312 | } | ||
1306 | 313 | |||
1307 | 314 | QVariant IndicatorsModel::indicatorData() const | ||
1308 | 315 | { | ||
1309 | 316 | return m_indicator_data; | ||
1310 | 317 | } | ||
1311 | 318 | 271 | ||
1312 | === modified file 'plugins/Unity/Indicators/indicatorsmodel.h' | |||
1313 | --- plugins/Unity/Indicators/indicatorsmodel.h 2013-09-02 07:39:53 +0000 | |||
1314 | +++ plugins/Unity/Indicators/indicatorsmodel.h 2013-10-03 12:34:55 +0000 | |||
1315 | @@ -34,7 +34,6 @@ | |||
1316 | 34 | Q_OBJECT | 34 | Q_OBJECT |
1317 | 35 | Q_ENUMS(Roles) | 35 | Q_ENUMS(Roles) |
1318 | 36 | Q_PROPERTY(int count READ count NOTIFY countChanged) | 36 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
1319 | 37 | Q_PROPERTY(QVariant indicatorData READ indicatorData WRITE setIndicatorData NOTIFY indicatorDataChanged) | ||
1320 | 38 | 37 | ||
1321 | 39 | public: | 38 | public: |
1322 | 40 | 39 | ||
1323 | @@ -53,9 +52,6 @@ | |||
1324 | 53 | QModelIndex parent (const QModelIndex &index) const; | 52 | QModelIndex parent (const QModelIndex &index) const; |
1325 | 54 | int rowCount(const QModelIndex &parent = QModelIndex()) const; | 53 | int rowCount(const QModelIndex &parent = QModelIndex()) const; |
1326 | 55 | 54 | ||
1327 | 56 | void setIndicatorData(const QVariant& data); | ||
1328 | 57 | QVariant indicatorData() const; | ||
1329 | 58 | |||
1330 | 59 | 55 | ||
1331 | 60 | Q_SIGNALS: | 56 | Q_SIGNALS: |
1332 | 61 | void countChanged(); | 57 | void countChanged(); |
1333 | @@ -71,13 +67,9 @@ | |||
1334 | 71 | IndicatorsManager *m_manager; | 67 | IndicatorsManager *m_manager; |
1335 | 72 | 68 | ||
1336 | 73 | QList<Indicator::Ptr> m_indicators; | 69 | QList<Indicator::Ptr> m_indicators; |
1337 | 74 | QVariant m_indicator_data; | ||
1338 | 75 | QMap<QString, QVariantMap> m_parsed_indicator_data; | ||
1339 | 76 | 70 | ||
1340 | 77 | void notifyDataChanged(QObject *sender, int role); | 71 | void notifyDataChanged(QObject *sender, int role); |
1341 | 78 | int count() const; | 72 | int count() const; |
1342 | 79 | QVariant indicatorData(const Indicator::Ptr& indicator, int role) const; | ||
1343 | 80 | static QVariant defaultData(Indicator::Ptr indicator, int role); | ||
1344 | 81 | }; | 73 | }; |
1345 | 82 | 74 | ||
1346 | 83 | #endif // INDICATORSMODEL_H | 75 | #endif // INDICATORSMODEL_H |
FAILED: Continuous integration, rev:249 jenkins. qa.ubuntu. com/job/ unity8- ci/1205/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/4307 jenkins. qa.ubuntu. com/job/ generic- mediumtests- touch/2015 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- saucy/1981 jenkins. qa.ubuntu. com/job/ unity8- saucy-amd64- ci/228 jenkins. qa.ubuntu. com/job/ unity8- saucy-armhf- ci/1205 jenkins. qa.ubuntu. com/job/ unity8- saucy-armhf- ci/1205/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity8- saucy-i386- ci/1204 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-saucy/ 597 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-amd64/ 176 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-amd64/ 176/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 2017 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 2017/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- maguro/ 1705 jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/1722
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity8- ci/1205/ rebuild
http://