about summary refs log tree commit diff
path: root/examples/C
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-07-31 10:51:42 +0200
committerMichael Biebl <biebl@debian.org>2019-07-31 10:51:42 +0200
commit2e5fa45ddfbb5cffa1e78221f1cea706e2f298af (patch)
tree86f69d36c56de3074280456eddc854a780b8e04b /examples/C
parent85563b7fc7ec2cd21e38debb9b28db342e2e8e7c (diff)
New upstream version 1.19.90 upstream/1.19.90
Diffstat (limited to 'examples/C')
-rw-r--r--examples/C/glib/add-connection-gdbus.c1
-rw-r--r--examples/C/glib/add-connection-libnm.c1
-rw-r--r--examples/C/glib/get-active-connections-gdbus.c1
-rw-r--r--examples/C/glib/get-ap-info-libnm.c1
-rw-r--r--examples/C/glib/list-connections-gdbus.c1
-rw-r--r--examples/C/glib/list-connections-libnm.c1
-rw-r--r--examples/C/glib/monitor-nm-running-gdbus.c1
-rw-r--r--examples/C/glib/monitor-nm-state-gdbus.c1
-rw-r--r--examples/C/qt/add-connection-wired.cpp151
-rw-r--r--examples/C/qt/change-ipv4-addresses.cpp1
-rw-r--r--examples/C/qt/list-connections.cpp1
-rw-r--r--examples/C/qt/monitor-nm-running.cpp2
12 files changed, 75 insertions, 88 deletions
diff --git a/examples/C/glib/add-connection-gdbus.c b/examples/C/glib/add-connection-gdbus.c
index 1045db38..7f779f81 100644
--- a/examples/C/glib/add-connection-gdbus.c
+++ b/examples/C/glib/add-connection-gdbus.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/examples/C/glib/add-connection-libnm.c b/examples/C/glib/add-connection-libnm.c
index e6075352..e8188f6b 100644
--- a/examples/C/glib/add-connection-libnm.c
+++ b/examples/C/glib/add-connection-libnm.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/examples/C/glib/get-active-connections-gdbus.c b/examples/C/glib/get-active-connections-gdbus.c
index 1f3858c9..3045ab73 100644
--- a/examples/C/glib/get-active-connections-gdbus.c
+++ b/examples/C/glib/get-active-connections-gdbus.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/examples/C/glib/get-ap-info-libnm.c b/examples/C/glib/get-ap-info-libnm.c
index c11d4146..2f31d7db 100644
--- a/examples/C/glib/get-ap-info-libnm.c
+++ b/examples/C/glib/get-ap-info-libnm.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/examples/C/glib/list-connections-gdbus.c b/examples/C/glib/list-connections-gdbus.c
index b8e77dc9..86a4cc19 100644
--- a/examples/C/glib/list-connections-gdbus.c
+++ b/examples/C/glib/list-connections-gdbus.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/examples/C/glib/list-connections-libnm.c b/examples/C/glib/list-connections-libnm.c
index 1b3ed8d1..1c7fafe7 100644
--- a/examples/C/glib/list-connections-libnm.c
+++ b/examples/C/glib/list-connections-libnm.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/examples/C/glib/monitor-nm-running-gdbus.c b/examples/C/glib/monitor-nm-running-gdbus.c
index ad05a9e4..e2ea38db 100644
--- a/examples/C/glib/monitor-nm-running-gdbus.c
+++ b/examples/C/glib/monitor-nm-running-gdbus.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/examples/C/glib/monitor-nm-state-gdbus.c b/examples/C/glib/monitor-nm-state-gdbus.c
index 4593f1a6..bca4d572 100644
--- a/examples/C/glib/monitor-nm-state-gdbus.c
+++ b/examples/C/glib/monitor-nm-state-gdbus.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/examples/C/qt/add-connection-wired.cpp b/examples/C/qt/add-connection-wired.cpp
index c06ed71f..fade1e4f 100644
--- a/examples/C/qt/add-connection-wired.cpp
+++ b/examples/C/qt/add-connection-wired.cpp
@@ -1,76 +1,75 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */

-/*

- * This program is free software; you can redistribute it and/or modify

- * it under the terms of the GNU General Public License as published by

- * the Free Software Foundation; either version 2 of the License, or

- * (at your option) any later version.

- *

- * This program is distributed in the hope that it will be useful,

- * but WITHOUT ANY WARRANTY; without even the implied warranty of

- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

- * GNU General Public License for more details.

- *

- * You should have received a copy of the GNU General Public License along

- * with this program; if not, write to the Free Software Foundation, Inc.,

- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

- *

- * (C) Copyright 2011 Eckhart Wörner

- */

-

-/*

- * The example shows how to call AddConnection() D-Bus method to add

- * a connection to settings service using Qt and D-Bus.

- */

-

-#include <QtCore/QUuid>

-#include <QtDBus/QDBusArgument>

-#include <QtDBus/QDBusConnection>

-#include <QtDBus/QDBusInterface>

-#include <QtDBus/QDBusMetaType>

-#include <QtDBus/QDBusReply>

-#include <QtCore/QDebug>

-

-#include <nm-dbus-interface.h>

-

-typedef QMap<QString, QMap<QString, QVariant> > Connection;

-Q_DECLARE_METATYPE(Connection)

-

-

-void addConnection(QDBusInterface& interface, const QString& connectionName) {

-    qDBusRegisterMetaType<Connection>();

-

-    // Create a new connection object

-    Connection connection;

-

-    // Build up the 'connection' Setting

-    connection["connection"]["uuid"] = QUuid::createUuid().toString().remove('{').remove('}');

-    connection["connection"]["id"] = connectionName;

-    connection["connection"]["type"] = "802-3-ethernet";

-

-    // Build up the '802-3-ethernet' Setting

-    connection["802-3-ethernet"];

-

-    // Build up the 'ipv4' Setting

-    connection["ipv4"]["method"] = "auto";

-

-    // Call AddConnection

-    QDBusReply<QDBusObjectPath> result = interface.call("AddConnection", QVariant::fromValue(connection));

-    if (!result.isValid()) {

-        qDebug() << QString("Error adding connection: %1 %2").arg(result.error().name()).arg(result.error().message());

-    } else {

-        qDebug() << QString("Added: %1").arg(result.value().path());

-    }

-}

-

-int main() {

-    // Create a D-Bus proxy; NM_DBUS_* defined in NetworkManager.h

-    QDBusInterface interface(

-        NM_DBUS_SERVICE,

-        NM_DBUS_PATH_SETTINGS,

-        NM_DBUS_INTERFACE_SETTINGS,

-        QDBusConnection::systemBus());

-

-    addConnection(interface, "__Test connection__");

-

-    return 0;

-}

+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * (C) Copyright 2011 Eckhart Wörner
+ */
+
+/*
+ * The example shows how to call AddConnection() D-Bus method to add
+ * a connection to settings service using Qt and D-Bus.
+ */
+
+#include <QtCore/QUuid>
+#include <QtDBus/QDBusArgument>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusMetaType>
+#include <QtDBus/QDBusReply>
+#include <QtCore/QDebug>
+
+#include <nm-dbus-interface.h>
+
+typedef QMap<QString, QMap<QString, QVariant> > Connection;
+Q_DECLARE_METATYPE(Connection)
+
+
+void addConnection(QDBusInterface& interface, const QString& connectionName) {
+    qDBusRegisterMetaType<Connection>();
+
+    // Create a new connection object
+    Connection connection;
+
+    // Build up the 'connection' Setting
+    connection["connection"]["uuid"] = QUuid::createUuid().toString().remove('{').remove('}');
+    connection["connection"]["id"] = connectionName;
+    connection["connection"]["type"] = "802-3-ethernet";
+
+    // Build up the '802-3-ethernet' Setting
+    connection["802-3-ethernet"];
+
+    // Build up the 'ipv4' Setting
+    connection["ipv4"]["method"] = "auto";
+
+    // Call AddConnection
+    QDBusReply<QDBusObjectPath> result = interface.call("AddConnection", QVariant::fromValue(connection));
+    if (!result.isValid()) {
+        qDebug() << QString("Error adding connection: %1 %2").arg(result.error().name()).arg(result.error().message());
+    } else {
+        qDebug() << QString("Added: %1").arg(result.value().path());
+    }
+}
+
+int main() {
+    // Create a D-Bus proxy; NM_DBUS_* defined in NetworkManager.h
+    QDBusInterface interface(
+        NM_DBUS_SERVICE,
+        NM_DBUS_PATH_SETTINGS,
+        NM_DBUS_INTERFACE_SETTINGS,
+        QDBusConnection::systemBus());
+
+    addConnection(interface, "__Test connection__");
+
+    return 0;
+}
diff --git a/examples/C/qt/change-ipv4-addresses.cpp b/examples/C/qt/change-ipv4-addresses.cpp
index d403900a..ce9b1ab4 100644
--- a/examples/C/qt/change-ipv4-addresses.cpp
+++ b/examples/C/qt/change-ipv4-addresses.cpp
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/examples/C/qt/list-connections.cpp b/examples/C/qt/list-connections.cpp
index 48dd685e..0ade61a8 100644
--- a/examples/C/qt/list-connections.cpp
+++ b/examples/C/qt/list-connections.cpp
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/examples/C/qt/monitor-nm-running.cpp b/examples/C/qt/monitor-nm-running.cpp
index cf597b54..2d318031 100644
--- a/examples/C/qt/monitor-nm-running.cpp
+++ b/examples/C/qt/monitor-nm-running.cpp
@@ -1,5 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* vim: set ft=c ts=4 sts=4 sw=4 expandtab smartindent: */
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by