diff options
| author | Michael Biebl <biebl@debian.org> | 2018-04-23 18:00:21 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-04-23 18:00:21 +0200 |
| commit | f60117b41d5433be1b4a96d82cd11d0c3dce9b63 (patch) | |
| tree | 2dd55c4ab0fdcbe9cddb26adb4a554b1a45c73c8 /examples/C | |
| parent | 7e9ff09fcb2366b383b7ebbec80d2f6fff117290 (diff) | |
New upstream version 1.11.3 upstream/1.11.3
Diffstat (limited to 'examples/C')
| -rw-r--r-- | examples/C/glib/add-connection-gdbus.c | 5 | ||||
| -rw-r--r-- | examples/C/glib/add-connection-libnm.c | 5 | ||||
| -rw-r--r-- | examples/C/glib/get-active-connections-gdbus.c | 5 | ||||
| -rw-r--r-- | examples/C/glib/get-ap-info-libnm.c | 9 | ||||
| -rw-r--r-- | examples/C/glib/list-connections-gdbus.c | 5 | ||||
| -rw-r--r-- | examples/C/glib/list-connections-libnm.c | 5 | ||||
| -rw-r--r-- | examples/C/glib/meson.build | 19 | ||||
| -rw-r--r-- | examples/C/glib/monitor-nm-running-gdbus.c | 5 | ||||
| -rw-r--r-- | examples/C/glib/monitor-nm-state-gdbus.c | 5 | ||||
| -rw-r--r-- | examples/C/qt/meson.build | 47 |
10 files changed, 68 insertions, 42 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..18b3d680 100644 --- a/examples/C/glib/add-connection-libnm.c +++ b/examples/C/glib/add-connection-libnm.c @@ -105,11 +105,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..033582fb 100644 --- a/examples/C/glib/get-active-connections-gdbus.c +++ b/examples/C/glib/get-active-connections-gdbus.c @@ -251,11 +251,6 @@ 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..b312356c 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; @@ -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..68617884 100644 --- a/examples/C/glib/monitor-nm-running-gdbus.c +++ b/examples/C/glib/monitor-nm-running-gdbus.c @@ -56,11 +56,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..204ff570 100644 --- a/examples/C/glib/monitor-nm-state-gdbus.c +++ b/examples/C/glib/monitor-nm-state-gdbus.c @@ -90,11 +90,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..d92205b1 --- /dev/null +++ b/examples/C/qt/meson.build @@ -0,0 +1,47 @@ +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, + dbus_glib_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 |