Merge lp:~saviq/unity8/drop-network-agents into lp:unity8

Proposed by Michał Sawicz
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
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.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:249
http://jenkins.qa.ubuntu.com/job/unity8-ci/1205/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4307
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2015
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/1981
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/228
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1205
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1205/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1204
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/597
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/176
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/176/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2017
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2017/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/1705
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/1722

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity8-ci/1205/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:250
http://jenkins.qa.ubuntu.com/job/unity8-ci/1242/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4450
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2205
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2048
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/265
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1242
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1242/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1241
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/732
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/325
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/325/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2207
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2207/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/1881
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/1898

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity8-ci/1242/rebuild

review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:251
http://jenkins.qa.ubuntu.com/job/unity8-ci/1243/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4454
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2211
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2050
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/266
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1243
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1243/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1242
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/736
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/329
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/329/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2213
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2213/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/1885
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/1902

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity8-ci/1243/rebuild

review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:252
http://jenkins.qa.ubuntu.com/job/unity8-ci/1244/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4459
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2218
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2052
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/267
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1244
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1244/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1243
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/741
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/334
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/334/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2220
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2220/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/1891
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/1908

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity8-ci/1244/rebuild

review: Approve (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:254
http://jenkins.qa.ubuntu.com/job/unity8-ci/1247/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4466/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2226/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2056
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/270
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1247
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1247/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1246
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/748/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/341
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/341/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2228
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2228/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/1898/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/1916

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity8-ci/1247/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/562/
Executed test runs:
    SUCCESS: http://s-jenkins:8080/job/generic-cleanup-mbs/2674
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4503
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2278/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2072
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-autolanding/147
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-autolanding/566
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-autolanding/566/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-autolanding/566
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/787
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/378
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/378/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2280
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2280/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/1953/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/1967

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/566/
Executed test runs:
    SUCCESS: http://s-jenkins:8080/job/generic-cleanup-mbs/2682
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/4511
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/2286/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/2076
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-autolanding/151
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-autolanding/570
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-autolanding/570/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-autolanding/570
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/795
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/386
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-amd64/386/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2288
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/2288/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/1961
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/1975/console

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Panel/Indicators.qml'
--- Panel/Indicators.qml 2013-09-16 16:42:24 +0000
+++ Panel/Indicators.qml 2013-10-03 12:35:19 +0000
@@ -17,6 +17,7 @@
17import QtQuick 2.017import QtQuick 2.0
18import Ubuntu.Components 0.118import Ubuntu.Components 0.1
19import Ubuntu.Gestures 0.119import Ubuntu.Gestures 0.1
20import Unity.Indicators 0.1 as Indicators
2021
21import "../Components"22import "../Components"
22import "../Components/ListItems"23import "../Components/ListItems"
@@ -249,8 +250,10 @@
249 anchors.fill: indicatorRow250 anchors.fill: indicatorRow
250 }251 }
251252
252 IndicatorsDataModel {253 Indicators.IndicatorsModel {
253 id: indicatorsModel254 id: indicatorsModel
255
256 Component.onCompleted: load()
254 }257 }
255258
256 IndicatorRow {259 IndicatorRow {
257260
=== removed file 'Panel/Indicators/NetworkIndicatorPage.qml'
--- Panel/Indicators/NetworkIndicatorPage.qml 2013-10-02 16:07:39 +0000
+++ Panel/Indicators/NetworkIndicatorPage.qml 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 */
19
20import QtQuick 2.0
21import Unity.Indicators 0.1 as Indicators
22import Unity.Indicators.Network 0.1 as ICNetwork
23import Ubuntu.Components 0.1
24
25PageStack {
26 id: networkPage
27 // Stops the search for a parent tree node.
28 // We don't want it going up to the indicator tabs.
29 // FIXME: need a better way of doing this.
30 // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1211704
31 __propagated: null
32
33 property alias title: pluginItem.title
34 property alias emptyText: pluginItem.emptyText
35 property alias busName: pluginItem.busName
36 property alias actionsObjectPath : pluginItem.actionsObjectPath
37 property alias menuObjectPaths : pluginItem.menuObjectPaths
38
39 anchors.fill: parent
40
41 Page {
42 id: _mainPage
43
44 Indicators.IndicatorPage {
45 id: pluginItem
46 anchors.fill: parent
47 }
48 }
49
50 Component {
51 id: passwordPageComponent
52
53 ICNetwork.PasswordPage {
54 agent: networkAgent
55 }
56 }
57
58 ICNetwork.NetworkAgent {
59 id: networkAgent
60
61 onSecretRequested: {
62 networkPage.push(passwordPageComponent, {"token": token});
63 }
64 }
65
66 function start()
67 {
68 push(_mainPage);
69 pluginItem.start();
70 }
71
72 function stop()
73 {
74 clear();
75 pluginItem.stop();
76 }
77
78 function reset()
79 {
80 pluginItem.reset();
81 }
82}
830
=== modified file 'Panel/Indicators/client/IndicatorsList.qml'
--- Panel/Indicators/client/IndicatorsList.qml 2013-10-02 09:38:06 +0000
+++ Panel/Indicators/client/IndicatorsList.qml 2013-10-03 12:35:19 +0000
@@ -28,8 +28,10 @@
28 anchors.fill: parent28 anchors.fill: parent
29 title: "Plugin list"29 title: "Plugin list"
3030
31 IndicatorsDataModel {31 Indicators.IndicatorsModel {
32 id: indicatorsModel32 id: indicatorsModel
33
34 Component.onCompleted: load()
33 }35 }
3436
35 ListView {37 ListView {
3638
=== removed file 'Panel/IndicatorsDataModel.qml'
--- Panel/IndicatorsDataModel.qml 2013-10-02 16:07:39 +0000
+++ Panel/IndicatorsDataModel.qml 1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 */
19
20import QtQuick 2.0
21import Unity.Indicators 0.1 as Indicators
22import Utils 0.1
23
24Indicators.IndicatorsModel {
25 id: ic_model
26
27 Component.onCompleted: load()
28
29 indicatorData : {
30 'indicator-network' : {
31 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/NetworkIndicatorPage.qml'
32 },
33 }
34}
350
=== modified file 'debian/control'
--- debian/control 2013-10-03 12:35:19 +0000
+++ debian/control 2013-10-03 12:35:19 +0000
@@ -14,8 +14,6 @@
14 libjson-perl,14 libjson-perl,
15 libnih-dbus-dev,15 libnih-dbus-dev,
16 libnih-dev,16 libnih-dev,
17 libnm-glib-dev,
18 libnm-util-dev,
19 libpulse-dev,17 libpulse-dev,
20 libqmenumodel-dev (>= 0.2.7),18 libqmenumodel-dev (>= 0.2.7),
21 libqt5v8-5-private-dev,19 libqt5v8-5-private-dev,
@@ -80,10 +78,8 @@
80 unity8-private | unity-launcher-impl,78 unity8-private | unity-launcher-impl,
81 ${misc:Depends},79 ${misc:Depends},
82 ${shlibs:Depends},80 ${shlibs:Depends},
83Recommends: indicator-battery,81Recommends: ${unity-default-masterscopes},
84 indicator-messages,82Breaks: indicator-network (<< 0.5.1)
85 indicator-time,
86 ${unity-default-masterscopes},
87Description: Unity 8 shell83Description: Unity 8 shell
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.
8985
9086
=== modified file 'plugins/Unity/Indicators/Network/CMakeLists.txt'
--- plugins/Unity/Indicators/Network/CMakeLists.txt 2013-08-20 19:50:07 +0000
+++ plugins/Unity/Indicators/Network/CMakeLists.txt 2013-10-03 12:35:19 +0000
@@ -1,45 +1,1 @@
1# export_qmlplugin macro
2include(Plugins)
3
4project(IndicatorsNetworkQml)
5
6pkg_check_modules(GLIB glib-2.0>=2.32)
7pkg_check_modules(LIBNM_GLIB libnm-glib>=0.9.6)
8pkg_check_modules(LIBNM_UTIL libnm-util>=0.9.6)
9
10if(LIBNM_GLIB_FOUND AND LIBNM_UTIL_FOUND AND GLIB_FOUND)
11 set(INDICATORS_NETWORK_SRC
12 networkagent.cpp
13 plugin.cpp
14 secret-agent.c
15 )
16
17 add_library(IndicatorsNetworkQml MODULE
18 ${INDICATORS_NETWORK_SRC}
19 )
20
21 qt5_use_modules(IndicatorsNetworkQml Core Qml Widgets)
22
23 set_target_properties(IndicatorsNetworkQml PROPERTIES COMPILE_FLAGS -fPIC)
24
25 include_directories(
26 ${CMAKE_CURRENT_SOURCE_DIR}
27 ${GLIB_INCLUDE_DIRS}
28 ${LIBNM_GLIB_INCLUDE_DIRS}
29 ${LIBNM_UTIL_INCLUDE_DIRS}
30 )
31
32 target_link_libraries(IndicatorsNetworkQml
33 ${GLIB_LIBRARIES}
34 ${LIBNM_GLIB_LIBRARIES}
35 ${LIBNM_UTIL_LIBRARIES}
36 )
37
38 # export the qmltypes and plugin files
39 export_qmlplugin(Unity.Indicators.Network 0.1 Unity/Indicators/Network TARGETS IndicatorsNetworkQml)
40
41else()
42 message(WARNING "Missing glib or libnm dependency for the network plugin, not building")
43endif()
44
45add_subdirectory(qml)1add_subdirectory(qml)
462
=== removed file 'plugins/Unity/Indicators/Network/networkagent.cpp'
--- plugins/Unity/Indicators/Network/networkagent.cpp 2013-06-07 12:51:16 +0000
+++ plugins/Unity/Indicators/Network/networkagent.cpp 1970-01-01 00:00:00 +0000
@@ -1,146 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Alberto Ruiz <alberto.ruiz@canonical.com>
18 * Renato Araujo Oliveira Filho <renato@canonical.com>
19 */
20
21#include "networkagent.h"
22
23#include <QVariant>
24#include <QApplication>
25#include <QDebug>
26
27class NetworkAgentToken
28{
29public:
30 NMConnection *connection;
31 NMSettingWirelessSecurity *wisec;
32 guint id;
33 QByteArray keyMgmt;
34
35 NetworkAgentToken(NMConnection *connection,
36 NMSettingWirelessSecurity *wisec,
37 guint id,
38 QByteArray keyMgmt)
39 : connection(connection),
40 wisec(wisec),
41 id(id),
42 keyMgmt(keyMgmt)
43 {
44 if (connection) {
45 g_object_ref(connection);
46 } else {
47 qWarning() << "invalid connection object";
48 }
49 }
50
51 ~NetworkAgentToken()
52 {
53 if (connection) {
54 g_object_unref(connection);
55 }
56 }
57};
58
59NetworkAgent::NetworkAgent(QObject *parent)
60 : QObject(parent)
61{
62 m_agent = unity_settings_secret_agent_new();
63 g_signal_connect(G_OBJECT(m_agent),
64 UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
65 G_CALLBACK(onSecretRequested),
66 this);
67
68 g_signal_connect(G_OBJECT(m_agent),
69 UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
70 G_CALLBACK(onSecretRequestCancelled),
71 this);
72}
73
74NetworkAgent::~NetworkAgent()
75{
76 nm_secret_agent_unregister(NM_SECRET_AGENT(m_agent));
77 g_object_unref(m_agent);
78}
79
80void NetworkAgent::authenticate(const QVariant &token, const QString &key)
81{
82 NetworkAgentToken *pToken = (NetworkAgentToken *) token.value<void *>();
83 if (pToken == NULL) {
84 return;
85 }
86
87 if ((pToken->keyMgmt == "wpa-none") || (pToken->keyMgmt == "wpa-psk")) {
88 g_object_set(G_OBJECT(pToken->wisec),
89 NM_SETTING_WIRELESS_SECURITY_PSK, qPrintable(key),
90 NULL);
91 } else if (pToken->keyMgmt == "none") {
92 g_object_set(G_OBJECT(pToken->wisec),
93 NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, qPrintable(key),
94 NULL);
95 }
96
97 GHashTable *settings = nm_connection_to_hash(pToken->connection,
98 NM_SETTING_HASH_FLAG_ALL);
99
100 unity_settings_secret_agent_provide_secret(m_agent,
101 pToken->id, settings);
102 g_hash_table_unref(settings);
103 delete pToken;
104}
105
106void NetworkAgent::cancel(const QVariant &token)
107{
108 NetworkAgentToken *pToken = (NetworkAgentToken *) token.value<void *>();
109 if (pToken != NULL) {
110 unity_settings_secret_agent_cancel_request(m_agent, pToken->id);
111 delete pToken;
112 }
113}
114
115void NetworkAgent::onSecretRequested(UnitySettingsSecretAgent* /*agent*/,
116 guint id,
117 NMConnection* connection,
118 const char* /*setting_name*/,
119 const char** /*hints*/,
120 NMSecretAgentGetSecretsFlags /*flags*/,
121 NetworkAgent* self)
122{
123 NetworkAgentToken *token = new NetworkAgentToken(connection,
124 NULL,
125 id,
126 NULL);
127
128 token->wisec = nm_connection_get_setting_wireless_security(connection);
129 if (token->wisec) {
130 token->keyMgmt = nm_setting_wireless_security_get_key_mgmt(token->wisec);
131 }
132
133 QVariant varToken = qVariantFromValue((void *) token);
134 Q_EMIT self->secretRequested(varToken);
135}
136
137void NetworkAgent::onSecretRequestCancelled(UnitySettingsSecretAgent* /*agent*/,
138 guint /*id*/,
139 NMConnection* /*connection*/,
140 const char* /*setting_name*/,
141 const char** /*hints*/,
142 NMSecretAgentGetSecretsFlags /*flags*/,
143 NetworkAgent* /*self*/)
144{
145 //Do nothing for now
146}
1470
=== removed file 'plugins/Unity/Indicators/Network/networkagent.h'
--- plugins/Unity/Indicators/Network/networkagent.h 2013-06-07 12:51:16 +0000
+++ plugins/Unity/Indicators/Network/networkagent.h 1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Alberto Ruiz <alberto.ruiz@canonical.com>
18 * Renato Araujo Oliveira Filho <renato@canonical.com>
19 */
20
21#ifndef NETWORKAGENT_H
22#define NETWORKAGENT_H
23
24#include "secret-agent.h"
25
26#include <QObject>
27
28class NetworkAgentToken;
29
30class NetworkAgent : public QObject
31{
32 Q_OBJECT
33public:
34 NetworkAgent(QObject *parent=0);
35 ~NetworkAgent();
36
37 Q_INVOKABLE void authenticate(const QVariant &token, const QString &key);
38 Q_INVOKABLE void cancel(const QVariant &token);
39
40Q_SIGNALS:
41 void secretRequested(const QVariant &token);
42 void secretRequestCancelled();
43
44private:
45 UnitySettingsSecretAgent *m_agent;
46
47 static void onSecretRequested(UnitySettingsSecretAgent *agent,
48 guint id,
49 NMConnection *connection,
50 const char *setting_name,
51 const char **hints,
52 NMSecretAgentGetSecretsFlags flags,
53 NetworkAgent *self);
54
55 static void onSecretRequestCancelled(UnitySettingsSecretAgent *agent,
56 guint id,
57 NMConnection *connection,
58 const char *setting_name,
59 const char **hints,
60 NMSecretAgentGetSecretsFlags flags,
61 NetworkAgent *self);
62
63};
64
65#endif
660
=== removed file 'plugins/Unity/Indicators/Network/plugin.cpp'
--- plugins/Unity/Indicators/Network/plugin.cpp 2013-08-23 11:56:44 +0000
+++ plugins/Unity/Indicators/Network/plugin.cpp 1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
1/*
2 * Copyright (C) 2012 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
17 */
18
19// Qt
20#include <QtQml/qqml.h>
21
22// self
23#include "plugin.h"
24
25// local
26#include "networkagent.h"
27
28void IndicatorsNetworkPlugin::registerTypes(const char *uri)
29{
30 qmlRegisterType<NetworkAgent>(uri, 0, 1, "NetworkAgent");
31}
320
=== removed file 'plugins/Unity/Indicators/Network/plugin.h'
--- plugins/Unity/Indicators/Network/plugin.h 2013-06-17 08:14:24 +0000
+++ plugins/Unity/Indicators/Network/plugin.h 1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
1/*
2 * Copyright (C) 2012 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Nick Dedekind <nick.dedekind@canonical.com>
17 */
18
19#ifndef INDICATORS_NETWORK_PLUGIN_H
20#define INDICATORS_NETWORK_PLUGIN_H
21
22#include <QtQml/QQmlExtensionPlugin>
23
24class IndicatorsNetworkPlugin : public QQmlExtensionPlugin
25{
26 Q_OBJECT
27 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28public:
29 void registerTypes(const char *uri);
30};
31
32#endif // INDICATORS_NETWORK_PLUGIN_H
330
=== removed file 'plugins/Unity/Indicators/Network/qml/PasswordPage.qml'
--- plugins/Unity/Indicators/Network/qml/PasswordPage.qml 2013-08-21 21:00:17 +0000
+++ plugins/Unity/Indicators/Network/qml/PasswordPage.qml 1970-01-01 00:00:00 +0000
@@ -1,88 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 */
19
20import QtQuick 2.0
21import Ubuntu.Components 0.1
22import Ubuntu.Components.ListItems 0.1 as ListItem
23import Unity.Indicators 0.1 as Indicators
24
25Page {
26 id: pagePassword
27
28 property variant agent
29 property variant token
30
31 anchors.fill: parent
32 title: "Network Authentication"
33
34 Column {
35 anchors {
36 left: parent.left
37 right: parent.right
38 }
39
40 Indicators.SectionMenuItem {
41 text: "Authentication"
42 }
43
44 Indicators.FramedMenuItem {
45 implicitHeight: password.height + units.gu(1)
46
47 PasswordTextField {
48 id: password
49 anchors {
50 left: parent.left
51 right: parent.right
52 margins: units.gu(3)
53 verticalCenter: parent.verticalCenter
54 }
55 }
56 }
57
58 Indicators.FramedMenuItem {
59 Row {
60 anchors {
61 right: parent.right
62 verticalCenter: parent.verticalCenter
63 margins: units.gu(3)
64 }
65
66 spacing: units.gu(1)
67
68 Button {
69 text: "Cancel"
70 width: units.gu(10)
71 onClicked: {
72 agent.cancel(token);
73 pageStack.pop();
74 }
75 }
76
77 Button {
78 text: "OK"
79 width: units.gu(10)
80 onClicked: {
81 agent.authenticate(token, password.text);
82 pageStack.pop();
83 }
84 }
85 }
86 }
87 }
88}
890
=== removed file 'plugins/Unity/Indicators/Network/qml/PasswordTextField.qml'
--- plugins/Unity/Indicators/Network/qml/PasswordTextField.qml 2013-07-05 15:05:28 +0000
+++ plugins/Unity/Indicators/Network/qml/PasswordTextField.qml 1970-01-01 00:00:00 +0000
@@ -1,68 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 */
19
20import QtQuick 2.0
21import Ubuntu.Components 0.1
22
23Item {
24 id: textMenu
25
26 property alias text: textField.text
27
28 height: contentColumn.height
29
30 Column {
31 id: contentColumn
32 spacing: units.gu(0.5)
33 anchors {
34 left: parent.left
35 right: parent.right
36 }
37
38 TextField {
39 id: textField
40
41 anchors {
42 left: parent.left
43 right: parent.right
44 }
45
46 placeholderText: "Password"
47 echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password
48 }
49
50 Row {
51 anchors {
52 left: parent.left
53 right: parent.right
54 }
55
56 spacing: units.gu(1)
57
58 CheckBox {
59 id: showPassword
60 }
61
62 Label {
63 text: "Show password"
64 anchors.verticalCenter: showPassword.verticalCenter
65 }
66 }
67 }
68}
690
=== modified file 'plugins/Unity/Indicators/Network/qml/qmldir'
--- plugins/Unity/Indicators/Network/qml/qmldir 2013-08-21 21:00:17 +0000
+++ plugins/Unity/Indicators/Network/qml/qmldir 2013-10-03 12:35:19 +0000
@@ -1,8 +1,3 @@
1module Unity.Indicators.Network1module Unity.Indicators.Network
2plugin IndicatorsNetworkQml
3typeinfo plugin.qmltypes
42
5NetworkPage 0.1 NetworkPage.qml
6AccessPoint 0.1 AccessPoint.qml3AccessPoint 0.1 AccessPoint.qml
7PasswordPage 0.1 PasswordPage.qml
8PasswordTextField 0.1 PasswordTextField.qml
9\ No newline at end of file4\ No newline at end of file
105
=== removed file 'plugins/Unity/Indicators/Network/secret-agent.c'
--- plugins/Unity/Indicators/Network/secret-agent.c 2013-06-07 12:51:16 +0000
+++ plugins/Unity/Indicators/Network/secret-agent.c 1970-01-01 00:00:00 +0000
@@ -1,382 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Alberto Ruiz <alberto.ruiz@canonical.com>
18 * Renato Araujo Oliveira Filho <renato@canonical.com>
19 */
20
21
22#include <glib.h>
23#include <glib-object.h>
24#include <nm-secret-agent.h>
25#include "secret-agent.h"
26
27#define UNITY_SETTINGS_TYPE_SECRET_AGENT (unity_settings_secret_agent_get_type ())
28#define UNITY_SETTINGS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgent))
29#define UNITY_SETTINGS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
30#define UNITY_SETTINGS_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT))
31#define UNITY_SETTINGS_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT))
32#define UNITY_SETTINGS_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
33#define UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentPrivate))
34
35#define AGENT_ID "com.canonical.settings.network.nm-agent"
36
37static gpointer unity_settings_secret_agent_parent_class = NULL;
38
39typedef struct _UnitySettingsSecretAgentPrivate UnitySettingsSecretAgentPrivate;
40
41struct _UnitySettingsSecretAgentPrivate {
42 GQueue *requests;
43};
44
45typedef struct _SecretRequest {
46 gint id;
47 NMSecretAgent *agent;
48 NMConnection *connection;
49 const char *connection_path;
50 const char *setting_name;
51 const char **hints;
52 NMSecretAgentGetSecretsFlags flags;
53 NMSecretAgentGetSecretsFunc callback;
54 gpointer callback_data;
55} SecretRequest;
56
57GType unity_settings_secret_agent_get_type (void) G_GNUC_CONST;
58enum {
59 UNITY_SETTINGS_SECRET_AGENT_DUMMY_PROPERTY
60};
61
62enum {
63 SECRET_REQUESTED,
64 REQUEST_CANCELLED,
65 LAST_SIGNAL
66};
67
68static guint signals[LAST_SIGNAL] = { 0 };
69
70UnitySettingsSecretAgent* unity_settings_secret_agent_new (void);
71UnitySettingsSecretAgent* unity_settings_secret_agent_construct (GType object_type);
72
73int
74secret_request_find (SecretRequest *req,
75 guint *id)
76{
77 if (req->id > *id)
78 return -1;
79
80 if (req->id < *id)
81 return 1;
82
83 return 0;
84}
85
86void
87unity_settings_secret_agent_provide_secret (UnitySettingsSecretAgent *agent,
88 guint request,
89 GHashTable *secrets)
90{
91 GList *iter;
92 SecretRequest *req;
93 UnitySettingsSecretAgentPrivate *priv = agent->priv;
94
95 iter = g_queue_find_custom (priv->requests,
96 &request,
97 (GCompareFunc)secret_request_find);
98
99 if (iter == NULL || iter->data == NULL)
100 {
101 g_warning ("Secret request with id <%d> was not found", (int)request);
102 return;
103 }
104
105 req = iter->data;
106
107 req->callback (NM_SECRET_AGENT (agent),
108 req->connection,
109 secrets,
110 NULL,
111 req->callback_data);
112
113 g_queue_remove_all (priv->requests, req);
114 g_free (req);
115 return;
116}
117
118void
119free_request (SecretRequest *req)
120{
121 g_object_unref (req->connection);
122 g_free (req);
123}
124
125void
126unity_settings_secret_agent_cancel_request (UnitySettingsSecretAgent *agent,
127 guint request)
128{
129 GList *iter;
130 SecretRequest *req;
131 UnitySettingsSecretAgentPrivate *priv = agent->priv;
132 GError *error;
133
134 iter = g_queue_find_custom (priv->requests,
135 &request,
136 (GCompareFunc)secret_request_find);
137
138 if (iter == NULL || iter->data == NULL)
139 {
140 g_warning ("Secret request with id <%d> was not found", (int)request);
141 return;
142 }
143
144 req = iter->data;
145 error = g_error_new (NM_SECRET_AGENT_ERROR,
146 NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
147 "This secret request was canceled by the user.");
148
149 req->callback (NM_SECRET_AGENT (agent),
150 req->connection,
151 NULL,
152 error,
153 req->callback_data);
154
155 g_queue_remove_all (priv->requests, req);
156 free_request (req);
157 return;
158}
159
160static void
161delete_secrets (NMSecretAgent *agent,
162 NMConnection *connection,
163 const char *connection_path,
164 NMSecretAgentDeleteSecretsFunc callback,
165 gpointer callback_data)
166{
167 g_debug ("delete secrets");
168}
169
170/* If it returns G_MAXUINT it's considered an error */
171static guint
172find_available_id (UnitySettingsSecretAgentPrivate *priv)
173{
174 guint i = 0;
175 guint candidate = 0;
176
177 if (g_queue_get_length (priv->requests) == G_MAXUINT)
178 return G_MAXUINT;
179
180 while (i < g_queue_get_length (priv->requests))
181 {
182 SecretRequest *req = (SecretRequest*)g_queue_peek_nth (priv->requests, i);
183
184 if (req->id == candidate)
185 {
186 candidate++;
187 i = 0;
188 }
189 else
190 {
191 i++;
192 }
193 }
194
195 return i;
196}
197
198static void
199get_secrets (NMSecretAgent *agent,
200 NMConnection *connection,
201 const char *connection_path,
202 const char *setting_name,
203 const char **hints,
204 NMSecretAgentGetSecretsFlags flags,
205 NMSecretAgentGetSecretsFunc callback,
206 gpointer callback_data)
207{
208 guint id;
209 UnitySettingsSecretAgentPrivate *priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (agent);
210 SecretRequest *req = NULL;
211
212 if (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE)
213 {
214 GError *error = g_error_new (NM_SECRET_AGENT_ERROR,
215 NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
216 "No password found for this connection.");
217 callback (agent, connection, NULL, error, callback_data);
218 g_error_free (error);
219 return;
220 }
221
222 id = find_available_id (priv);
223 if (id == G_MAXUINT)
224 {
225 GError *error = g_error_new (NM_SECRET_AGENT_ERROR,
226 NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
227 "Reached maximum number of requests.");
228 callback (agent, connection, NULL, error, callback_data);
229 g_error_free (error);
230 return;
231 }
232
233 /* Adding a request */
234 req = (SecretRequest*) g_malloc0 (sizeof (SecretRequest));
235 *req = ((SecretRequest)
236 { id,
237 agent,
238 connection,
239 connection_path,
240 setting_name,
241 hints,
242 flags,
243 callback,
244 callback_data });
245
246 g_object_ref (connection);
247
248 g_queue_push_tail (priv->requests, req);
249
250 g_signal_emit_by_name (agent,
251 UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
252 id,
253 connection,
254 setting_name,
255 hints,
256 flags);
257}
258
259static void
260save_secrets (NMSecretAgent *agent,
261 NMConnection *connection,
262 const char *connection_path,
263 NMSecretAgentSaveSecretsFunc callback,
264 gpointer callback_data)
265{
266 g_debug ("save secrets");
267}
268
269static void
270cancel_get_secrets (NMSecretAgent *agent,
271 const char *connection_path,
272 const char *setting_name)
273{
274 g_debug ("cancel get secrets");
275}
276
277UnitySettingsSecretAgent*
278unity_settings_secret_agent_construct (GType object_type)
279{
280 UnitySettingsSecretAgent * self = NULL;
281 self = (UnitySettingsSecretAgent*) g_object_new (object_type,
282 NM_SECRET_AGENT_IDENTIFIER, AGENT_ID,
283 NULL);
284 return self;
285}
286
287
288UnitySettingsSecretAgent*
289unity_settings_secret_agent_new (void)
290{
291 return unity_settings_secret_agent_construct (UNITY_SETTINGS_TYPE_SECRET_AGENT);
292}
293
294static void
295destroy_pending_request (gpointer data)
296{
297 SecretRequest* req = (SecretRequest*)data;
298 /* Reporting the cancellation of all pending requests */
299 g_signal_emit_by_name (req->agent,
300 UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
301 req->id);
302
303 free_request (req);
304}
305
306static void
307unity_settings_secret_agent_finalize (GObject *agent)
308{
309 UnitySettingsSecretAgentPrivate *priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (agent);
310
311 g_queue_free_full (priv->requests, destroy_pending_request);
312}
313
314static void
315unity_settings_secret_agent_class_init (UnitySettingsSecretAgentClass *klass)
316{
317 unity_settings_secret_agent_parent_class = g_type_class_peek_parent (klass);
318 NMSecretAgentClass *parent_class = NM_SECRET_AGENT_CLASS (klass);
319 parent_class->get_secrets = get_secrets;
320 parent_class->save_secrets = save_secrets;
321 parent_class->delete_secrets = delete_secrets;
322 parent_class->cancel_get_secrets = cancel_get_secrets;
323
324 g_type_class_add_private (klass, sizeof(UnitySettingsSecretAgentPrivate));
325 G_OBJECT_CLASS (klass)->finalize = unity_settings_secret_agent_finalize;
326
327
328 signals[SECRET_REQUESTED] = g_signal_new (UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED,
329 G_OBJECT_CLASS_TYPE (G_OBJECT_CLASS (klass)),
330 G_SIGNAL_RUN_FIRST,
331 G_STRUCT_OFFSET (UnitySettingsSecretAgentClass, secret_requested),
332 NULL, NULL, NULL,
333 G_TYPE_NONE, 5,
334 G_TYPE_UINT, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT);
335
336 signals[REQUEST_CANCELLED] = g_signal_new (UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED,
337 G_OBJECT_CLASS_TYPE (G_OBJECT_CLASS (klass)),
338 G_SIGNAL_RUN_FIRST,
339 G_STRUCT_OFFSET (UnitySettingsSecretAgentClass, request_cancelled),
340 NULL, NULL, NULL,
341 G_TYPE_NONE, 1,
342 G_TYPE_UINT);
343}
344
345
346static void
347unity_settings_secret_agent_instance_init (UnitySettingsSecretAgent *self)
348{
349 self->priv = UNITY_SETTINGS_SECRET_AGENT_GET_PRIVATE (self);
350 self->priv->requests = g_queue_new ();
351}
352
353GType
354unity_settings_secret_agent_get_type (void)
355{
356 static volatile gsize unity_settings_secret_agent_type_id__volatile = 0;
357 if (g_once_init_enter (&unity_settings_secret_agent_type_id__volatile))
358 {
359 static const GTypeInfo g_define_type_info =
360 {
361 sizeof (UnitySettingsSecretAgentClass),
362 (GBaseInitFunc) NULL,
363 (GBaseFinalizeFunc) NULL,
364 (GClassInitFunc) unity_settings_secret_agent_class_init,
365 (GClassFinalizeFunc) NULL,
366 NULL,
367 sizeof (UnitySettingsSecretAgent),
368 0,
369 (GInstanceInitFunc) unity_settings_secret_agent_instance_init,
370 NULL
371 };
372 GType unity_settings_secret_agent_type_id;
373 unity_settings_secret_agent_type_id = g_type_register_static (NM_TYPE_SECRET_AGENT,
374 "UnitySettingsSecretAgent",
375 &g_define_type_info,
376 0);
377 g_once_init_leave (&unity_settings_secret_agent_type_id__volatile,
378 unity_settings_secret_agent_type_id);
379 }
380
381 return unity_settings_secret_agent_type_id__volatile;
382}
3830
=== removed file 'plugins/Unity/Indicators/Network/secret-agent.h'
--- plugins/Unity/Indicators/Network/secret-agent.h 2013-06-07 12:51:16 +0000
+++ plugins/Unity/Indicators/Network/secret-agent.h 1970-01-01 00:00:00 +0000
@@ -1,102 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Alberto Ruiz <alberto.ruiz@canonical.com>
18 * Renato Araujo Oliveira Filho <renato@canonical.com>
19 */
20
21#ifndef __SECRET_AGENT_H__
22#define __SECRET_AGENT_H__
23
24#include <glib.h>
25#include <glib-object.h>
26#include <nm-secret-agent.h>
27
28/*
29 * This class is a basic implementation of the NetworkManager SecretAgent base class.
30 *
31 * The purpose of this class is to handle credential requests from the network,
32 * for example, from a WiFi hotspot or a VPN network.
33 *
34 * It queues requests objects (SecretRequest) on a GQueue in the private struct
35 * of the class. And notifies the consumer of the class through the "secret-request"
36 * and the "request-cancelled" signals with the following callback prototypes:
37 *
38 * void (*secret_requested) (UnitySettingsSecretAgent *self,
39 * guint id,
40 * NMConnection *connection,
41 * const char *setting_name,
42 * const char **hints,
43 * NMSecretAgentGetSecretsFlags flags,
44 * gpointer user_data);
45 *
46 * void (*request_cancelled) (UnitySettingsSecretAgent *self,
47 * guint id,
48 * gpointer user_data);
49 *
50 */
51
52
53G_BEGIN_DECLS
54
55
56#define UNITY_SETTINGS_TYPE_SECRET_AGENT (unity_settings_secret_agent_get_type ())
57#define UNITY_SETTINGS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgent))
58#define UNITY_SETTINGS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
59#define UNITY_SETTINGS_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT))
60#define UNITY_SETTINGS_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_SETTINGS_TYPE_SECRET_AGENT))
61#define UNITY_SETTINGS_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_SETTINGS_TYPE_SECRET_AGENT, UnitySettingsSecretAgentClass))
62
63#define UNITY_SETTINGS_SECRET_AGENT_SECRET_REQUESTED "secret-requested"
64#define UNITY_SETTINGS_SECRET_AGENT_REQUEST_CANCELLED "request-cancelled"
65
66typedef struct _UnitySettingsSecretAgent UnitySettingsSecretAgent;
67typedef struct _UnitySettingsSecretAgentClass UnitySettingsSecretAgentClass;
68typedef struct _UnitySettingsSecretAgentPrivate UnitySettingsSecretAgentPrivate;
69
70struct _UnitySettingsSecretAgent {
71 NMSecretAgent parent_instance;
72 UnitySettingsSecretAgentPrivate * priv;
73};
74
75struct _UnitySettingsSecretAgentClass {
76 NMSecretAgentClass parent_class;
77
78 void (*secret_requested) (UnitySettingsSecretAgent *self,
79 guint id,
80 NMConnection *connection,
81 const char *setting_name,
82 const char **hints,
83 NMSecretAgentGetSecretsFlags flags);
84
85 void (*request_cancelled) (UnitySettingsSecretAgent *self,
86 guint id);
87};
88
89
90GType unity_settings_secret_agent_get_type (void) G_GNUC_CONST;
91UnitySettingsSecretAgent* unity_settings_secret_agent_new (void);
92UnitySettingsSecretAgent* unity_settings_secret_agent_construct (GType object_type);
93
94void unity_settings_secret_agent_provide_secret (UnitySettingsSecretAgent *agent,
95 guint request,
96 GHashTable *secrets);
97void unity_settings_secret_agent_cancel_request (UnitySettingsSecretAgent *agent,
98 guint request);
99
100G_END_DECLS
101
102#endif
1030
=== modified file 'plugins/Unity/Indicators/indicatorsmodel.cpp'
--- plugins/Unity/Indicators/indicatorsmodel.cpp 2013-10-02 16:07:39 +0000
+++ plugins/Unity/Indicators/indicatorsmodel.cpp 2013-10-03 12:35:19 +0000
@@ -214,21 +214,6 @@
214 return 1;214 return 1;
215}215}
216216
217/*! \internal */
218QVariant IndicatorsModel::defaultData(Indicator::Ptr indicator, int role)
219{
220 switch (role)
221 {
222 case IndicatorsModelRole::Position:
223 return 0;
224 case IndicatorsModelRole::WidgetSource:
225 return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorWidget.qml";
226 case IndicatorsModelRole::PageSource:
227 return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorPage.qml";
228 }
229 return QVariant();
230}
231
232Q_INVOKABLE QVariant IndicatorsModel::data(int row, int role) const217Q_INVOKABLE QVariant IndicatorsModel::data(int row, int role) const
233{218{
234 return data(index(row, 0), role);219 return data(index(row, 0), role);
@@ -263,26 +248,15 @@
263 }248 }
264 break;249 break;
265 case IndicatorsModelRole::WidgetSource:250 case IndicatorsModelRole::WidgetSource:
251 return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorWidget.qml";
266 case IndicatorsModelRole::PageSource:252 case IndicatorsModelRole::PageSource:
267 return indicatorData(indicator, role);253 return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorPage.qml";
268 default:254 default:
269 break;255 break;
270 }256 }
271 return QVariant();257 return QVariant();
272}258}
273259
274QVariant IndicatorsModel::indicatorData(const Indicator::Ptr& indicator, int role) const
275{
276 if (indicator && m_parsed_indicator_data.contains(indicator->identifier()))
277 {
278 QVariantMap data = m_parsed_indicator_data[indicator->identifier()];
279 if (data.contains(roleNames()[role])) {
280 return data[roleNames()[role]];
281 }
282 }
283 return defaultData(indicator, role);
284}
285
286/*! \internal */260/*! \internal */
287QModelIndex IndicatorsModel::parent(const QModelIndex&) const261QModelIndex IndicatorsModel::parent(const QModelIndex&) const
288{262{
@@ -294,24 +268,3 @@
294{268{
295 return m_indicators.count();269 return m_indicators.count();
296}270}
297
298void IndicatorsModel::setIndicatorData(const QVariant& data)
299{
300 m_indicator_data = data;
301
302 m_parsed_indicator_data.clear();
303 QMap<QString, QVariant> map = data.toMap();
304 QMapIterator<QString, QVariant> iter(map);
305 while(iter.hasNext())
306 {
307 iter.next();
308 m_parsed_indicator_data[iter.key()] = iter.value().toMap();
309 }
310
311 Q_EMIT indicatorDataChanged(m_indicator_data);
312}
313
314QVariant IndicatorsModel::indicatorData() const
315{
316 return m_indicator_data;
317}
318271
=== modified file 'plugins/Unity/Indicators/indicatorsmodel.h'
--- plugins/Unity/Indicators/indicatorsmodel.h 2013-09-02 07:39:53 +0000
+++ plugins/Unity/Indicators/indicatorsmodel.h 2013-10-03 12:35:19 +0000
@@ -34,7 +34,6 @@
34 Q_OBJECT34 Q_OBJECT
35 Q_ENUMS(Roles)35 Q_ENUMS(Roles)
36 Q_PROPERTY(int count READ count NOTIFY countChanged)36 Q_PROPERTY(int count READ count NOTIFY countChanged)
37 Q_PROPERTY(QVariant indicatorData READ indicatorData WRITE setIndicatorData NOTIFY indicatorDataChanged)
3837
39public:38public:
4039
@@ -53,9 +52,6 @@
53 QModelIndex parent (const QModelIndex &index) const;52 QModelIndex parent (const QModelIndex &index) const;
54 int rowCount(const QModelIndex &parent = QModelIndex()) const;53 int rowCount(const QModelIndex &parent = QModelIndex()) const;
5554
56 void setIndicatorData(const QVariant& data);
57 QVariant indicatorData() const;
58
5955
60Q_SIGNALS:56Q_SIGNALS:
61 void countChanged();57 void countChanged();
@@ -71,13 +67,9 @@
71 IndicatorsManager *m_manager;67 IndicatorsManager *m_manager;
7268
73 QList<Indicator::Ptr> m_indicators;69 QList<Indicator::Ptr> m_indicators;
74 QVariant m_indicator_data;
75 QMap<QString, QVariantMap> m_parsed_indicator_data;
7670
77 void notifyDataChanged(QObject *sender, int role);71 void notifyDataChanged(QObject *sender, int role);
78 int count() const;72 int count() const;
79 QVariant indicatorData(const Indicator::Ptr& indicator, int role) const;
80 static QVariant defaultData(Indicator::Ptr indicator, int role);
81};73};
8274
83#endif // INDICATORSMODEL_H75#endif // INDICATORSMODEL_H

Subscribers

People subscribed via source and target branches