about summary refs log tree commit diff
path: root/examples/C
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2018-08-24 11:00:09 +0200
committerSebastien Bacher <seb128@ubuntu.com>2018-08-24 11:06:47 +0200
commitb7db94545968c37886b7111d8c85f62eb063fbb4 (patch)
tree7c2aedd497b1fdcb26bf9d49f98cc63a530baf2e /examples/C
parent9d5cdc3adde9e7e57bf5a0e754e563b6a9e8e513 (diff)
parentcaf1db9d6fbc056cc6c76a24574890f6c7895f3d (diff)
Import Debian changes 1.12.2-0ubuntu3
network-manager (1.12.2-0ubuntu3) cosmic; urgency=medium

  * debian/rules:
    - use --with-libnm-glib, the default reversed since that's a legacy
      library but we still need it for unity-control-center

network-manager (1.12.2-0ubuntu2) cosmic; urgency=medium

  * debian/patches/git-newglib-test.patch:
    - backport upstream commit to fix the tests with the new glib 

network-manager (1.12.2-0ubuntu1) cosmic; urgency=medium

  * New upstream version
  * d/p/libnm-register-empty-NMClient-and-NetworkManager-when-loa.patch,
    d/p/e91f1a7d2a6b8400b6b331d5b72287dcb5164a39.patch,
    d/p/git_thunderbolt_connect.patch:
    - removed, those changes are in the new version
  * Backport Debian changes
  * Update symbols file for libnm0
  * Enable iwd support
  * Drop version requirements when oldstable ships a newer version
  * Drop dh_strip override, the dbgsym migration is done
  * Rebase patches
  * Make sure the example server.conf is actually installed
  * Update install path for plugins, it now includes a version number
  * Drop libnl3 build dependency.
    Upstream has copied the code directly from libnl3 for the few functions it
    needs with a few small modifications.
  * Drop libiw build dependency.
    Hasn't been needed for a long time and was simply a left over from older
    releases.
  * Bump Standards-Version to 4.1.5
  * Fix compile error due to NM_AVAILABLE_IN_1_12_2 macro (Closes: #905372)
Diffstat (limited to 'examples/C')
-rw-r--r--examples/C/glib/add-connection-gdbus.c5
-rw-r--r--examples/C/glib/add-connection-libnm.c6
-rw-r--r--examples/C/glib/get-active-connections-gdbus.c6
-rw-r--r--examples/C/glib/get-ap-info-libnm.c11
-rw-r--r--examples/C/glib/list-connections-gdbus.c5
-rw-r--r--examples/C/glib/list-connections-libnm.c5
-rw-r--r--examples/C/glib/meson.build19
-rw-r--r--examples/C/glib/monitor-nm-running-gdbus.c6
-rw-r--r--examples/C/glib/monitor-nm-state-gdbus.c6
-rw-r--r--examples/C/qt/meson.build46
10 files changed, 68 insertions, 47 deletions
diff --git a/examples/C/glib/add-connection-gdbus.c b/examples/C/glib/add-connection-gdbus.c
index 7c8edf68..1045db38 100644
--- a/examples/C/glib/add-connection-gdbus.c
+++ b/examples/C/glib/add-connection-gdbus.c
@@ -124,11 +124,6 @@ main (int argc, char *argv[])
 	GDBusProxy *proxy;
 	GError *error = NULL;
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-	/* Initialize GType system */
-	g_type_init ();
-#endif
-
 	/* Create a D-Bus proxy; NM_DBUS_* defined in nm-dbus-interface.h */
 	proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
 	                                       G_DBUS_PROXY_FLAGS_NONE,
diff --git a/examples/C/glib/add-connection-libnm.c b/examples/C/glib/add-connection-libnm.c
index 86915ea2..e6075352 100644
--- a/examples/C/glib/add-connection-libnm.c
+++ b/examples/C/glib/add-connection-libnm.c
@@ -97,7 +97,6 @@ add_connection (NMClient *client, GMainLoop *loop, const char *con_name)
 	g_object_unref (connection);
 }
 
-
 int
 main (int argc, char *argv[])
 {
@@ -105,11 +104,6 @@ main (int argc, char *argv[])
 	GMainLoop *loop;
 	GError *error = NULL;
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-	/* Initialize GType system */
-	g_type_init ();
-#endif
-
 	loop = g_main_loop_new (NULL, FALSE);
 
 	/* Connect to NetworkManager */
diff --git a/examples/C/glib/get-active-connections-gdbus.c b/examples/C/glib/get-active-connections-gdbus.c
index 217fd7ac..1f3858c9 100644
--- a/examples/C/glib/get-active-connections-gdbus.c
+++ b/examples/C/glib/get-active-connections-gdbus.c
@@ -245,17 +245,11 @@ out:
 		g_variant_unref (ret);
 }
 
-
 int
 main (int argc, char *argv[])
 {
 	GDBusProxy *props_proxy;
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-	/* Initialize GType system */
-	g_type_init ();
-#endif
-
 	/* Create a D-Bus proxy to get the object properties from the NM Manager
 	 * object.  NM_DBUS_* defines are from nm-dbus-interface.h.
 	 */
diff --git a/examples/C/glib/get-ap-info-libnm.c b/examples/C/glib/get-ap-info-libnm.c
index a548d12d..c11d4146 100644
--- a/examples/C/glib/get-ap-info-libnm.c
+++ b/examples/C/glib/get-ap-info-libnm.c
@@ -79,7 +79,7 @@ show_access_point_info (NMAccessPoint *ap)
 {
 	guint32 flags, wpa_flags, rsn_flags, freq, bitrate;
 	guint8 strength;
-	GBytes *ssid; 
+	GBytes *ssid;
 	const char *hwaddr;
 	NM80211Mode mode;
 	char *freq_str, *ssid_str, *bitrate_str, *strength_str, *wpa_flags_str, *rsn_flags_str;
@@ -158,7 +158,7 @@ show_wifi_device_info (NMDevice *device)
 	const char *iface;
 	const char *driver;
 	guint32 speed;
-	GBytes *active_ssid; 
+	GBytes *active_ssid;
 	char *active_ssid_str = NULL;
 	int i;
 
@@ -180,7 +180,7 @@ show_wifi_device_info (NMDevice *device)
 	speed /= 1000;
 
 	printf ("Device: %s  ----  Driver: %s  ----  Speed: %d Mbit/s  ----  Active AP: %s\n",
-	         iface, driver, speed, active_ssid_str ? active_ssid_str : "none");
+	         iface, driver, speed, active_ssid_str ?: "none");
 	printf ("=================================================================================\n");
 	g_free (active_ssid_str);
 
@@ -202,11 +202,6 @@ main (int argc, char *argv[])
 	int i;
 	GError *error = NULL;
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-	/* Initialize GType system */
-	g_type_init ();
-#endif
-
 	/* Get NMClient object */
 	client = nm_client_new (NULL, &error);
 	if (!client) {
diff --git a/examples/C/glib/list-connections-gdbus.c b/examples/C/glib/list-connections-gdbus.c
index 088df1d8..b8e77dc9 100644
--- a/examples/C/glib/list-connections-gdbus.c
+++ b/examples/C/glib/list-connections-gdbus.c
@@ -65,11 +65,6 @@ main (int argc, char *argv[])
 {
 	GDBusProxy *proxy;
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-	/* Initialize GType system */
-	g_type_init ();
-#endif
-
 	/* Create a D-Bus proxy; NM_DBUS_* defined in nm-dbus-interface.h */
 	proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
 	                                       G_DBUS_PROXY_FLAGS_NONE,
diff --git a/examples/C/glib/list-connections-libnm.c b/examples/C/glib/list-connections-libnm.c
index 5dc38201..1b3ed8d1 100644
--- a/examples/C/glib/list-connections-libnm.c
+++ b/examples/C/glib/list-connections-libnm.c
@@ -69,11 +69,6 @@ main (int argc, char *argv[])
 	const GPtrArray *connections;
 	int i;
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-	/* Initialize GType system */
-	g_type_init ();
-#endif
-
 	if (!(client = nm_client_new (NULL, &error))) {
 		g_message ("Error: Could not connect to NetworkManager: %s.", error->message);
 		g_error_free (error);
diff --git a/examples/C/glib/meson.build b/examples/C/glib/meson.build
new file mode 100644
index 00000000..edc4dbb1
--- /dev/null
+++ b/examples/C/glib/meson.build
@@ -0,0 +1,19 @@
+examples = [
+  ['add-connection-gdbus', [libnm_enum[1]], [libnm_inc], [uuid_dep]],
+  ['add-connection-libnm', [], [], [libnm_dep]],
+  ['get-active-connections-gdbus', [libnm_enum[1]], [libnm_inc], []],
+  ['get-ap-info-libnm', [], [], [libnm_dep]],
+  ['list-connections-gdbus', [], [], []],
+  ['list-connections-libnm', [], [], [libnm_dep]],
+  ['monitor-nm-running-gdbus', [], [], []],
+  ['monitor-nm-state-gdbus', [], [], []]
+]
+
+foreach example: examples
+  executable(
+    example[0],
+    [example[0] + '.c'] + example[1],
+    include_directories: example[2],
+    dependencies: [nm_core_dep] + example[3],
+  )
+endforeach
diff --git a/examples/C/glib/monitor-nm-running-gdbus.c b/examples/C/glib/monitor-nm-running-gdbus.c
index c19569b5..16e1cfad 100644
--- a/examples/C/glib/monitor-nm-running-gdbus.c
+++ b/examples/C/glib/monitor-nm-running-gdbus.c
@@ -48,7 +48,6 @@ on_name_vanished (GDBusConnection *connection,
 	g_print ("Name '%s' does not exist on the system bus => NM is not running\n", name);
 }
 
-
 int
 main (int argc, char *argv[])
 {
@@ -56,11 +55,6 @@ main (int argc, char *argv[])
 	GMainLoop *loop;
 	GBusNameWatcherFlags flags;
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-	/* Initialize GType system */
-	g_type_init ();
-#endif
-
 	g_print ("Monitor 'org.freedesktop.NetworkManager' D-Bus name\n");
 	g_print ("===================================================\n");
 
diff --git a/examples/C/glib/monitor-nm-state-gdbus.c b/examples/C/glib/monitor-nm-state-gdbus.c
index 913644d2..fdb4d95d 100644
--- a/examples/C/glib/monitor-nm-state-gdbus.c
+++ b/examples/C/glib/monitor-nm-state-gdbus.c
@@ -81,7 +81,6 @@ on_signal (GDBusProxy *proxy,
 	}
 }
 
-
 int
 main (int argc, char *argv[])
 {
@@ -90,11 +89,6 @@ main (int argc, char *argv[])
 	GDBusProxyFlags flags;
 	GDBusProxy *proxy;
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-	/* Initialize GType system */
-	g_type_init ();
-#endif
-
 	/* Monitor 'StateChanged' signal on 'org.freedesktop.NetworkManager' interface */
 	g_print ("Monitor NetworkManager's state\n");
 	g_print ("==============================\n");
diff --git a/examples/C/qt/meson.build b/examples/C/qt/meson.build
new file mode 100644
index 00000000..5349faa7
--- /dev/null
+++ b/examples/C/qt/meson.build
@@ -0,0 +1,46 @@
+examples = [
+  ['add-connection-wired', []],
+  ['list-connections', []],
+  ['change-ipv4-addresses', []]
+]
+
+incs = [
+  top_inc,
+  libnm_core_inc
+]
+
+qt_core_dep = dependency('QtCore', version: '>= 4')
+
+deps = [
+  dbus_dep,
+  qt_core_dep,
+  dependency('QtDBus'),
+  dependency('QtNetwork')
+]
+
+moc = find_program('moc-qt4', required: false)
+if not moc.found()
+  moc = qt_core_dep.get_pkgconfig_variable('moc_location')
+endif
+
+example = 'monitor-nm-running'
+output = example + '.moc'
+
+example_moc = custom_target(
+  output,
+  input: example + '.cpp',
+  output: output,
+  command: [moc, '-i', '@INPUT@', '-o', '@OUTPUT@']
+)
+
+examples += [[example, [example_moc]]]
+
+foreach example: examples
+  executable(
+    example[0],
+    example[0] + '.cpp',
+    include_directories: incs,
+    dependencies: deps,
+    link_depends: example[1]
+  )
+endforeach