diff options
| author | Michael Biebl <biebl@debian.org> | 2014-07-06 02:16:10 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2014-07-06 02:16:10 +0200 |
| commit | 33491bc4279481db8ae47213e34a6d695a0e8830 (patch) | |
| tree | 097d2b0fdff3fae6885381ae5e57a182cd8cbbba /examples/C | |
| parent | 59c3714a494c3b3765657c0551ad82842d98a7d2 (diff) | |
Imported Upstream version 0.9.10.0 upstream/0.9.10.0
Diffstat (limited to 'examples/C')
| -rw-r--r-- | examples/C/Makefile.in | 21 | ||||
| -rw-r--r-- | examples/C/glib/Makefile.in | 21 | ||||
| -rw-r--r-- | examples/C/glib/add-connection-dbus-glib.c | 2 | ||||
| -rw-r--r-- | examples/C/glib/add-connection-libnm-glib.c | 2 | ||||
| -rw-r--r-- | examples/C/glib/get-active-connections-dbus-glib.c | 69 | ||||
| -rw-r--r-- | examples/C/glib/get-ap-info-libnm-glib.c | 8 | ||||
| -rw-r--r-- | examples/C/glib/list-connections-dbus-glib.c | 18 | ||||
| -rw-r--r-- | examples/C/glib/list-connections-libnm-glib.c | 6 | ||||
| -rw-r--r-- | examples/C/glib/monitor-nm-running-GDBus.c | 8 | ||||
| -rw-r--r-- | examples/C/glib/monitor-nm-running-dbus-glib.c | 2 | ||||
| -rw-r--r-- | examples/C/glib/monitor-nm-state-GDBus.c | 8 | ||||
| -rw-r--r-- | examples/C/qt/Makefile.in | 21 | ||||
| -rw-r--r-- | examples/C/qt/monitor-nm-running.cpp | 4 |
13 files changed, 113 insertions, 77 deletions
diff --git a/examples/C/Makefile.in b/examples/C/Makefile.in index 724e1e09..95754494 100644 --- a/examples/C/Makefile.in +++ b/examples/C/Makefile.in @@ -81,7 +81,8 @@ host_triplet = @host@ subdir = examples/C DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ + $(top_srcdir)/m4/compiler_warnings.m4 \ $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gnome-code-coverage.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ @@ -205,12 +206,15 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_GLIB_100_CFLAGS = @DBUS_GLIB_100_CFLAGS@ +DBUS_GLIB_100_LIBS = @DBUS_GLIB_100_LIBS@ DBUS_LIBS = @DBUS_LIBS@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ DHCPCD_PATH = @DHCPCD_PATH@ +DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@ DLLTOOL = @DLLTOOL@ DNSMASQ_PATH = @DNSMASQ_PATH@ DSYMUTIL = @DSYMUTIL@ @@ -235,7 +239,6 @@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ @@ -280,12 +283,16 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBM = @LIBM@ +LIBNDP_CFLAGS = @LIBNDP_CFLAGS@ +LIBNDP_LIBS = @LIBNDP_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ LIBSOUP_LIBS = @LIBSOUP_LIBS@ +LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@ +LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ @@ -302,6 +309,8 @@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ +NEWT_CFLAGS = @NEWT_CFLAGS@ +NEWT_LIBS = @NEWT_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ @@ -329,11 +338,16 @@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLKIT_CFLAGS = @POLKIT_CFLAGS@ POLKIT_LIBS = @POLKIT_LIBS@ POSUB = @POSUB@ +PPPD_PATH = @PPPD_PATH@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ +PPPOE_PATH = @PPPOE_PATH@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ +READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -348,6 +362,7 @@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ +VALGRIND_RULES = @VALGRIND_RULES@ VAPIGEN = @VAPIGEN@ VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ @@ -410,6 +425,7 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ systemdsystemunitdir = @systemdsystemunitdir@ target_alias = @target_alias@ @@ -420,6 +436,7 @@ with_dhclient = @with_dhclient@ with_dhcpcd = @with_dhcpcd@ with_netconfig = @with_netconfig@ with_resolvconf = @with_resolvconf@ +with_valgrind = @with_valgrind@ SUBDIRS = glib $(am__append_1) all: all-recursive diff --git a/examples/C/glib/Makefile.in b/examples/C/glib/Makefile.in index ff7d65a4..e58e66d0 100644 --- a/examples/C/glib/Makefile.in +++ b/examples/C/glib/Makefile.in @@ -91,7 +91,8 @@ subdir = examples/C/glib DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/build-aux/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ + $(top_srcdir)/m4/compiler_warnings.m4 \ $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gnome-code-coverage.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ @@ -274,12 +275,15 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_GLIB_100_CFLAGS = @DBUS_GLIB_100_CFLAGS@ +DBUS_GLIB_100_LIBS = @DBUS_GLIB_100_LIBS@ DBUS_LIBS = @DBUS_LIBS@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ DHCPCD_PATH = @DHCPCD_PATH@ +DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@ DLLTOOL = @DLLTOOL@ DNSMASQ_PATH = @DNSMASQ_PATH@ DSYMUTIL = @DSYMUTIL@ @@ -304,7 +308,6 @@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ @@ -349,12 +352,16 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBM = @LIBM@ +LIBNDP_CFLAGS = @LIBNDP_CFLAGS@ +LIBNDP_LIBS = @LIBNDP_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ LIBSOUP_LIBS = @LIBSOUP_LIBS@ +LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@ +LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ @@ -371,6 +378,8 @@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ +NEWT_CFLAGS = @NEWT_CFLAGS@ +NEWT_LIBS = @NEWT_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ @@ -398,11 +407,16 @@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLKIT_CFLAGS = @POLKIT_CFLAGS@ POLKIT_LIBS = @POLKIT_LIBS@ POSUB = @POSUB@ +PPPD_PATH = @PPPD_PATH@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ +PPPOE_PATH = @PPPOE_PATH@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ +READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -417,6 +431,7 @@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ +VALGRIND_RULES = @VALGRIND_RULES@ VAPIGEN = @VAPIGEN@ VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ @@ -479,6 +494,7 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ systemdsystemunitdir = @systemdsystemunitdir@ target_alias = @target_alias@ @@ -489,6 +505,7 @@ with_dhclient = @with_dhclient@ with_dhcpcd = @with_dhcpcd@ with_netconfig = @with_netconfig@ with_resolvconf = @with_resolvconf@ +with_valgrind = @with_valgrind@ AM_CPPFLAGS = \ -I${top_srcdir}/libnm-util \ -I${top_builddir}/libnm-util \ diff --git a/examples/C/glib/add-connection-dbus-glib.c b/examples/C/glib/add-connection-dbus-glib.c index c7c1a3f1..354dcb75 100644 --- a/examples/C/glib/add-connection-dbus-glib.c +++ b/examples/C/glib/add-connection-dbus-glib.c @@ -102,8 +102,10 @@ int main (int argc, char *argv[]) DBusGConnection *bus; DBusGProxy *proxy; +#if !GLIB_CHECK_VERSION (2, 35, 0) /* Initialize GType system */ g_type_init (); +#endif /* Get system bus */ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL); diff --git a/examples/C/glib/add-connection-libnm-glib.c b/examples/C/glib/add-connection-libnm-glib.c index 510e06ee..28eadf8d 100644 --- a/examples/C/glib/add-connection-libnm-glib.c +++ b/examples/C/glib/add-connection-libnm-glib.c @@ -110,8 +110,10 @@ int main (int argc, char *argv[]) NMRemoteSettings *settings; GMainLoop *loop; +#if !GLIB_CHECK_VERSION (2, 35, 0) /* Initialize GType system */ g_type_init (); +#endif loop = g_main_loop_new (NULL, FALSE); diff --git a/examples/C/glib/get-active-connections-dbus-glib.c b/examples/C/glib/get-active-connections-dbus-glib.c index f27c44fb..186feae2 100644 --- a/examples/C/glib/get-active-connections-dbus-glib.c +++ b/examples/C/glib/get-active-connections-dbus-glib.c @@ -14,7 +14,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2010 Red Hat, Inc. + * (C) Copyright 2010 -2014 Red Hat, Inc. */ /* @@ -26,6 +26,7 @@ * gcc -Wall `pkg-config --libs --cflags glib-2.0 dbus-glib-1 libnm-util` get-active-connections-dbus-glib.c -o get-active-connections-dbus-glib */ +#include <stdio.h> #include <glib.h> #include <dbus/dbus-glib.h> @@ -41,22 +42,18 @@ #define DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH (dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH)) static void -print_connection (DBusGConnection *bus, const char *service, const char *path) +print_connection (DBusGConnection *bus, const char *path) { DBusGProxy *proxy; GError *error = NULL; GHashTable *hash = NULL; NMConnection *connection = NULL; - /* This function asks the Settings Service that provides this network - * configuration for the details of that configuration. - */ + /* This function asks NetworkManager for the details of the connection */ - /* Create the D-Bus proxy for the Settings Service so we can ask it for the - * connection configuration details. - */ + /* Create the D-Bus proxy so we can ask it for the connection configuration details. */ proxy = dbus_g_proxy_new_for_name (bus, - service, + NM_DBUS_SERVICE, path, NM_DBUS_IFACE_SETTINGS_CONNECTION); g_assert (proxy); @@ -72,9 +69,8 @@ print_connection (DBusGConnection *bus, const char *service, const char *path) goto out; } - /* Using the raw configuration, create an NMConnection object for it. This - * step also verifies that the data we got from the settings service is - * valid. */ + /* Using the raw configuration, create an NMConnection object for it. This + * step also verifies that the data we got from NetworkManager are valid. */ connection = nm_connection_new_from_hash (hash, &error); if (!connection) { g_warning ("Received invalid connection data: %s", error->message); @@ -83,7 +79,7 @@ print_connection (DBusGConnection *bus, const char *service, const char *path) } /* And finally dump all the configuration to stdout */ - g_message ("%s => %s", service, path); + printf ("%s <=> %s\n", nm_connection_get_id (connection), path); nm_connection_dump (connection); out: @@ -98,10 +94,9 @@ static void get_active_connection_details (DBusGConnection *bus, const char *obj_path) { DBusGProxy *props_proxy; - GValue path_value = { 0 }; - GValue serv_value = { 0 }; + GValue path_value = G_VALUE_INIT; GError *error = NULL; - const char *path = NULL, *service = NULL; + const char *path = NULL; /* This function gets the backing Connection object that describes the * network configuration that the ActiveConnection object is actually using. @@ -141,37 +136,11 @@ get_active_connection_details (DBusGConnection *bus, const char *obj_path) goto out; } - /* Get the service name of the D-Bus service that provides the Connection */ - if (!dbus_g_proxy_call (props_proxy, "Get", &error, - G_TYPE_STRING, NM_DBUS_INTERFACE_ACTIVE_CONNECTION, - G_TYPE_STRING, "ServiceName", - G_TYPE_INVALID, - G_TYPE_VALUE, &serv_value, - G_TYPE_INVALID)) { - g_warning ("Failed to get active connection ServiceName property: %s", - error->message); - g_error_free (error); - goto out; - } - - if (!G_VALUE_HOLDS (&serv_value, G_TYPE_STRING)) { - g_warning ("Unexpected type returned getting Connection property: %s", - G_VALUE_TYPE_NAME (&serv_value)); - goto out; - } - - service = g_value_get_string (&serv_value); - if (!service) { - g_warning ("Missing connection service name!"); - goto out; - } - /* Print out the actual connection details */ - print_connection (bus, service, path); + print_connection (bus, path); out: g_value_unset (&path_value); - g_value_unset (&serv_value); g_object_unref (props_proxy); } @@ -179,8 +148,9 @@ static void get_active_connections (DBusGConnection *bus, DBusGProxy *proxy) { GError *error = NULL; - GValue value = { 0 }; + GValue value = G_VALUE_INIT; GPtrArray *paths = NULL; + const char *a_path; int i; /* Get the ActiveConnections property from the NM Manager object */ @@ -209,9 +179,12 @@ get_active_connections (DBusGConnection *bus, DBusGProxy *proxy) goto out; } - /* And print out the details of each active connection */ - for (i = 0; i < paths->len; i++) - get_active_connection_details (bus, g_ptr_array_index (paths, i)); + /* And print out the details for each active connection */ + for (i = 0; i < paths->len; i++) { + a_path = g_ptr_array_index (paths, i); + printf ("Active connection path: %s\n", a_path); + get_active_connection_details (bus, a_path); + } out: g_value_unset (&value); @@ -223,8 +196,10 @@ int main (int argc, char *argv[]) DBusGConnection *bus; DBusGProxy *props_proxy; +#if !GLIB_CHECK_VERSION (2, 35, 0) /* Initialize GType system */ g_type_init (); +#endif /* Get system bus */ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL); diff --git a/examples/C/glib/get-ap-info-libnm-glib.c b/examples/C/glib/get-ap-info-libnm-glib.c index e72ce54f..1ad58124 100644 --- a/examples/C/glib/get-ap-info-libnm-glib.c +++ b/examples/C/glib/get-ap-info-libnm-glib.c @@ -96,7 +96,7 @@ show_access_point_info (NMAccessPoint *ap) wpa_flags = nm_access_point_get_wpa_flags (ap); rsn_flags = nm_access_point_get_rsn_flags (ap); ssid = nm_access_point_get_ssid (ap); - hwaddr = nm_access_point_get_hw_address (ap); + hwaddr = nm_access_point_get_bssid (ap); freq = nm_access_point_get_frequency (ap); mode = nm_access_point_get_mode (ap); bitrate = nm_access_point_get_max_bitrate (ap); @@ -105,7 +105,7 @@ show_access_point_info (NMAccessPoint *ap) /* Convert to strings */ ssid_str = nm_utils_ssid_to_utf8 (ssid); freq_str = g_strdup_printf ("%u MHz", freq); - bitrate_str = g_strdup_printf ("%u MB/s", bitrate/1000); + bitrate_str = g_strdup_printf ("%u Mbit/s", bitrate/1000); strength_str = g_strdup_printf ("%u", strength); wpa_flags_str = ap_wpa_rsn_flags_to_string (wpa_flags); rsn_flags_str = ap_wpa_rsn_flags_to_string (rsn_flags); @@ -178,7 +178,7 @@ show_wifi_device_info (NMDevice *device) speed = nm_device_wifi_get_bitrate (NM_DEVICE_WIFI (device)); speed /= 1000; - printf ("Device: %s ---- Driver: %s ---- Speed: %d MB/s ---- Active AP: %s\n", + printf ("Device: %s ---- Driver: %s ---- Speed: %d Mbit/s ---- Active AP: %s\n", iface, driver, speed, active_ssid_str ? active_ssid_str : "none"); printf ("=================================================================================\n"); g_free (active_ssid_str); @@ -200,8 +200,10 @@ int main (int argc, char *argv[]) const GPtrArray *devices; int i; +#if !GLIB_CHECK_VERSION (2, 35, 0) /* Initialize GType system */ g_type_init (); +#endif /* Get system bus */ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL); diff --git a/examples/C/glib/list-connections-dbus-glib.c b/examples/C/glib/list-connections-dbus-glib.c index 2cb584b5..e17b8dc7 100644 --- a/examples/C/glib/list-connections-dbus-glib.c +++ b/examples/C/glib/list-connections-dbus-glib.c @@ -40,13 +40,19 @@ list_connections (DBusGProxy *proxy) int i; GError *error = NULL; GPtrArray *con_array; + gboolean success; /* Call ListConnections D-Bus method */ - dbus_g_proxy_call (proxy, "ListConnections", &error, - /* No input arguments */ - G_TYPE_INVALID, - DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, &con_array, /* Return values */ - G_TYPE_INVALID); + success = dbus_g_proxy_call (proxy, "ListConnections", &error, + /* No input arguments */ + G_TYPE_INVALID, + DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, &con_array, /* Return values */ + G_TYPE_INVALID); + if (!success) { + printf ("ListConnections failed: %s", error->message); + g_error_free (error); + return; + } for (i = 0; con_array && i < con_array->len; i++) { char *connection_path = g_ptr_array_index (con_array, i); @@ -61,8 +67,10 @@ int main (int argc, char *argv[]) DBusGConnection *bus; DBusGProxy *proxy; +#if !GLIB_CHECK_VERSION (2, 35, 0) /* Initialize GType system */ g_type_init (); +#endif /* Get system bus */ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL); diff --git a/examples/C/glib/list-connections-libnm-glib.c b/examples/C/glib/list-connections-libnm-glib.c index 01a9f254..29f105c6 100644 --- a/examples/C/glib/list-connections-libnm-glib.c +++ b/examples/C/glib/list-connections-libnm-glib.c @@ -67,7 +67,7 @@ setup_signals (void) /* Print details of connection */ static void -show_connection (NMConnection *data, gpointer user_data) +show_connection (gpointer data, gpointer user_data) { NMConnection *connection = (NMConnection *) data; NMSettingConnection *s_con; @@ -107,7 +107,7 @@ get_connections_cb (NMRemoteSettings *settings, gpointer user_data) printf ("Connections:\n===================\n"); - g_slist_foreach (connections, (GFunc) show_connection, NULL); + g_slist_foreach (connections, show_connection, NULL); g_slist_free (connections); g_object_unref (settings); @@ -153,8 +153,10 @@ int main (int argc, char *argv[]) { DBusGConnection *bus; +#if !GLIB_CHECK_VERSION (2, 35, 0) /* Initialize GType system */ g_type_init (); +#endif /* Get system bus */ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL); diff --git a/examples/C/glib/monitor-nm-running-GDBus.c b/examples/C/glib/monitor-nm-running-GDBus.c index 42f9b758..9e38d4c7 100644 --- a/examples/C/glib/monitor-nm-running-GDBus.c +++ b/examples/C/glib/monitor-nm-running-GDBus.c @@ -31,7 +31,6 @@ #include <gio/gio.h> -#if GLIB_CHECK_VERSION(2,26,0) static void on_name_appeared (GDBusConnection *connection, const gchar *name, @@ -49,19 +48,19 @@ on_name_vanished (GDBusConnection *connection, { g_print ("Name '%s' does not exist on the system bus => NM is not running\n", name); } -#endif int main (int argc, char *argv[]) { -#if GLIB_CHECK_VERSION(2,26,0) guint watcher_id; 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"); @@ -83,9 +82,6 @@ main (int argc, char *argv[]) /* Stop watching the name */ g_bus_unwatch_name (watcher_id); -#else - g_print ("Sorry, you need at least GLib 2.26 for GDBus.\n"); -#endif return 0; } diff --git a/examples/C/glib/monitor-nm-running-dbus-glib.c b/examples/C/glib/monitor-nm-running-dbus-glib.c index 3290fb1a..0b01a57f 100644 --- a/examples/C/glib/monitor-nm-running-dbus-glib.c +++ b/examples/C/glib/monitor-nm-running-dbus-glib.c @@ -71,8 +71,10 @@ main (int argc, char *argv[]) GError *err = NULL; gboolean nm_running; +#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 22ff65b7..f4019725 100644 --- a/examples/C/glib/monitor-nm-state-GDBus.c +++ b/examples/C/glib/monitor-nm-state-GDBus.c @@ -34,7 +34,6 @@ #include <string.h> #include <NetworkManager.h> -#if GLIB_CHECK_VERSION(2,26,0) static const char * nm_state_to_string (NMState state) { @@ -82,20 +81,20 @@ on_signal (GDBusProxy *proxy, g_print ("NetworkManager state is: (%d) %s\n", new_state, nm_state_to_string ((NMState) new_state)); } } -#endif int main (int argc, char *argv[]) { -#if GLIB_CHECK_VERSION(2,26,0) GMainLoop *loop; GError *error = NULL; 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"); @@ -129,9 +128,6 @@ main (int argc, char *argv[]) g_main_loop_run (loop); g_object_unref (proxy); -#else - g_print ("Sorry, you need at least GLib 2.26 for GDBus.\n"); -#endif return 0; } diff --git a/examples/C/qt/Makefile.in b/examples/C/qt/Makefile.in index 9ef5fea6..6cce9883 100644 --- a/examples/C/qt/Makefile.in +++ b/examples/C/qt/Makefile.in @@ -85,7 +85,8 @@ subdir = examples/C/qt DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/build-aux/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ + $(top_srcdir)/m4/compiler_warnings.m4 \ $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gnome-code-coverage.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ @@ -215,12 +216,15 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_GLIB_100_CFLAGS = @DBUS_GLIB_100_CFLAGS@ +DBUS_GLIB_100_LIBS = @DBUS_GLIB_100_LIBS@ DBUS_LIBS = @DBUS_LIBS@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DHCLIENT_PATH = @DHCLIENT_PATH@ DHCPCD_PATH = @DHCPCD_PATH@ +DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@ DLLTOOL = @DLLTOOL@ DNSMASQ_PATH = @DNSMASQ_PATH@ DSYMUTIL = @DSYMUTIL@ @@ -245,7 +249,6 @@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ @@ -290,12 +293,16 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBM = @LIBM@ +LIBNDP_CFLAGS = @LIBNDP_CFLAGS@ +LIBNDP_LIBS = @LIBNDP_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ LIBSOUP_LIBS = @LIBSOUP_LIBS@ +LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@ +LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ @@ -312,6 +319,8 @@ MOC = @MOC@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ +NEWT_CFLAGS = @NEWT_CFLAGS@ +NEWT_LIBS = @NEWT_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ @@ -339,11 +348,16 @@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLKIT_CFLAGS = @POLKIT_CFLAGS@ POLKIT_LIBS = @POLKIT_LIBS@ POSUB = @POSUB@ +PPPD_PATH = @PPPD_PATH@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ +PPPOE_PATH = @PPPOE_PATH@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ +READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -358,6 +372,7 @@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ +VALGRIND_RULES = @VALGRIND_RULES@ VAPIGEN = @VAPIGEN@ VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ @@ -420,6 +435,7 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ systemdsystemunitdir = @systemdsystemunitdir@ target_alias = @target_alias@ @@ -430,6 +446,7 @@ with_dhclient = @with_dhclient@ with_dhcpcd = @with_dhcpcd@ with_netconfig = @with_netconfig@ with_resolvconf = @with_resolvconf@ +with_valgrind = @with_valgrind@ AM_CPPFLAGS = \ -I${top_srcdir}/include \ -I${top_builddir}/include \ diff --git a/examples/C/qt/monitor-nm-running.cpp b/examples/C/qt/monitor-nm-running.cpp index 861f251e..cf597b54 100644 --- a/examples/C/qt/monitor-nm-running.cpp +++ b/examples/C/qt/monitor-nm-running.cpp @@ -51,13 +51,13 @@ class NMWatcher: public QObject { void NMWatcher::serviceRegistered(const QString& name) { - std::cout << "Name '" << name.toStdString() << "' registered" + std::cout << "Name '" << name.toUtf8().constData() << "' registered" << " => NM is running" << std::endl; } void NMWatcher::serviceUnregistered(const QString& name) { - std::cout << "Name '" << name.toStdString() << "' unregistered" + std::cout << "Name '" << name.toUtf8().constData() << "' unregistered" << " => NM is not running" << std::endl; } |