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