diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2014-09-17 18:15:41 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2014-09-29 19:46:49 +0200 |
commit | cf02d71f4a85bdc1527616d5c5852d98d5b5be64 (patch) | |
tree | 79182526488ab5cd489e80bb8899c5f2d07f385e | |
parent | 9fae902c00f39379f22335187ca3f62ccb855df3 (diff) | |
download | network-manager-applet-cf02d71f4a85bdc1527616d5c5852d98d5b5be64.tar.gz |
all: port code to new libnm library
The changes include:
* using only NetworkManager.h header instead of particular headers
* settings renames (capitalization fixes)
like NMSettingPPPOE -> NMSettingPppoe
* function prototype changes:
nm_connection_new() -> nm_simple_connection_new()
nm_connection_duplicate() -> nm_simple_connection_new_clone()
nm_connection_lookup_setting_type() -> nm_setting_lookup_type()
nm_utils_ssid_to_utf8()
...
* property type changes and their getter functions
SSID, MAC, DNS, IP, addresses, ...
* secrets handling
nm_setting_to_hash() -> nm_connection_to_dbus()
* and others.
123 files changed, 578 insertions, 1270 deletions
diff --git a/configure.ac b/configure.ac index d6ca9e6f..9bc05c6f 100644 --- a/configure.ac +++ b/configure.ac @@ -75,9 +75,7 @@ PKG_CHECK_MODULES(NMA, [dbus-glib-1 >= 0.74 gio-2.0 >= 2.32 NetworkManager >= 0.9.9.95 - libnm-glib >= 0.9.9.95 - libnm-util >= 0.9.9.95 - libnm-glib-vpn >= 0.9.9.95 + libnm >= 0.9.9.95 gmodule-export-2.0]) NMA_CFLAGS="$NMA_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32" @@ -140,7 +138,7 @@ case "${with_bluetooth}" in PKG_CHECK_MODULES(GNOME_BLUETOOTH, gnome-bluetooth-1.0 >= 2.27.6 gnome-bluetooth-1.0 < 3.11.0 - libnm-util libnm-glib, + libnm, have_gbt=yes, have_gbt=no) ;; esac diff --git a/src/ap-menu-item.c b/src/ap-menu-item.c index ad60d6b6..1dd105fe 100644 --- a/src/ap-menu-item.c +++ b/src/ap-menu-item.c @@ -18,7 +18,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2005 - 2008 Red Hat, Inc. + * Copyright 2005 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -29,7 +29,8 @@ #include <glib/gi18n.h> #include <string.h> -#include <nm-utils.h> +#include <NetworkManager.h> + #include "ap-menu-item.h" #include "nm-access-point.h" @@ -107,7 +108,7 @@ nm_network_menu_item_class_init (NMNetworkMenuItemClass * klass) } void -nm_network_menu_item_set_ssid (NMNetworkMenuItem *item, GByteArray *ssid) +nm_network_menu_item_set_ssid (NMNetworkMenuItem *item, GBytes *ssid) { g_return_if_fail (item != NULL); g_return_if_fail (NM_IS_NETWORK_MENU_ITEM (item)); @@ -115,7 +116,7 @@ nm_network_menu_item_set_ssid (NMNetworkMenuItem *item, GByteArray *ssid) g_free (item->ssid_string); - item->ssid_string = nm_utils_ssid_to_utf8 (ssid); + item->ssid_string = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid)); if (!item->ssid_string) { // FIXME: shouldn't happen; always coerce the SSID to _something_ item->ssid_string = g_strdup ("<unknown>"); diff --git a/src/ap-menu-item.h b/src/ap-menu-item.h index d1b478ba..5e0a0aef 100644 --- a/src/ap-menu-item.h +++ b/src/ap-menu-item.h @@ -68,7 +68,7 @@ GType nm_network_menu_item_get_type (void) G_GNUC_CONST; GtkWidget* nm_network_menu_item_new (const char *hash, gboolean has_connections); void nm_network_menu_item_set_ssid (NMNetworkMenuItem *item, - GByteArray *ssid); + GBytes *ssid); const char *nm_network_menu_item_get_ssid (NMNetworkMenuItem *item); gboolean nm_network_menu_item_get_is_adhoc (NMNetworkMenuItem *item); diff --git a/src/applet-agent.c b/src/applet-agent.c index 5ea0d3a8..665c4aed 100644 --- a/src/applet-agent.c +++ b/src/applet-agent.c @@ -16,7 +16,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2011 Red Hat, Inc. + * Copyright 2011 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -26,13 +26,6 @@ #include <glib/gi18n.h> #include <string.h> #include <dbus/dbus-glib.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> -#include <nm-setting-vpn.h> -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> -#include <nm-setting-wired.h> -#include <nm-setting-pppoe.h> #define SECRET_API_SUBJECT_TO_CHANGE #include <libsecret/secret.h> @@ -183,7 +176,7 @@ get_secrets_cb (AppletAgent *self, const char *setting_name; /* Copy the existing connection and update its secrets */ - dupl = nm_connection_duplicate (r->connection); + dupl = nm_simple_connection_new_clone (r->connection); g_hash_table_iter_init (&iter, secrets); while (g_hash_table_iter_next (&iter, (gpointer) &setting_name, NULL)) nm_connection_update_secrets (dupl, setting_name, secrets, NULL); @@ -808,18 +801,22 @@ applet_agent_handle_vpn_only (AppletAgent *agent, gboolean vpn_only) AppletAgent * applet_agent_new (void) { - return (AppletAgent *) g_object_new (APPLET_TYPE_AGENT, - NM_SECRET_AGENT_IDENTIFIER, "org.freedesktop.nm-applet", - NM_SECRET_AGENT_CAPABILITIES, NM_SECRET_AGENT_CAPABILITY_VPN_HINTS, - NULL); + //return g_initable_new (APPLET_TYPE_AGENT, NULL, NULL, + return g_object_new (APPLET_TYPE_AGENT, + NM_SECRET_AGENT_IDENTIFIER, "org.freedesktop.nm-applet", + NM_SECRET_AGENT_CAPABILITIES, NM_SECRET_AGENT_CAPABILITY_VPN_HINTS, + NULL); } +#if 0 +FIXME static void agent_registration_result_cb (NMSecretAgent *agent, GError *error, gpointer user_data) { if (error) g_warning ("Failed to register as an agent: (%d) %s", error->code, error->message); } +#endif static void applet_agent_init (AppletAgent *self) @@ -828,8 +825,8 @@ applet_agent_init (AppletAgent *self) priv->requests = g_hash_table_new (g_direct_hash, g_direct_equal); - g_signal_connect (self, NM_SECRET_AGENT_REGISTRATION_RESULT, - G_CALLBACK (agent_registration_result_cb), NULL); +//// g_signal_connect (self, NM_SECRET_AGENT_REGISTRATION_RESULT, +//// G_CALLBACK (agent_registration_result_cb), NULL); } static void diff --git a/src/applet-agent.h b/src/applet-agent.h index 2e1be3e9..b5f6b7e7 100644 --- a/src/applet-agent.h +++ b/src/applet-agent.h @@ -16,13 +16,13 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2011 Red Hat, Inc. + * Copyright 2011 - 2014 Red Hat, Inc. */ #ifndef _APPLET_AGENT_H_ #define _APPLET_AGENT_H_ -#include <nm-secret-agent.h> +#include <NetworkManager.h> #define APPLET_TYPE_AGENT (applet_agent_get_type ()) #define APPLET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLET_TYPE_AGENT, AppletAgent)) diff --git a/src/applet-device-bond.c b/src/applet-device-bond.c index 36e22f71..cbc40d57 100644 --- a/src/applet-device-bond.c +++ b/src/applet-device-bond.c @@ -17,8 +17,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 Red Hat, Inc. - * (C) Copyright 2008 Novell, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. + * Copyright 2008 Novell, Inc. */ #ifdef HAVE_CONFIG_H @@ -28,13 +28,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-device.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-bond.h> -#include <nm-device-bond.h> -#include <nm-utils.h> - #include "applet.h" #include "applet-device-bond.h" #include "utils.h" diff --git a/src/applet-device-bridge.c b/src/applet-device-bridge.c index 4352411b..c018a4de 100644 --- a/src/applet-device-bridge.c +++ b/src/applet-device-bridge.c @@ -17,8 +17,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 Red Hat, Inc. - * (C) Copyright 2008 Novell, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. + * Copyright 2008 Novell, Inc. */ #ifdef HAVE_CONFIG_H @@ -28,13 +28,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-device.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-bridge.h> -#include <nm-device-bridge.h> -#include <nm-utils.h> - #include "applet.h" #include "applet-device-bridge.h" #include "utils.h" diff --git a/src/applet-device-bt.c b/src/applet-device-bt.c index 580268df..a641478a 100644 --- a/src/applet-device-bt.c +++ b/src/applet-device-bt.c @@ -17,8 +17,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. - * (C) Copyright 2008 Novell, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. + * Copyright 2008 Novell, Inc. */ #ifdef HAVE_CONFIG_H @@ -28,15 +28,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-device.h> -#include <nm-setting-connection.h> -#include <nm-setting-bluetooth.h> -#include <nm-setting-cdma.h> -#include <nm-setting-gsm.h> -#include <nm-device-bt.h> -#include <nm-utils.h> -#include <nm-secret-agent.h> - #include "applet.h" #include "applet-device-bt.h" #include "applet-dialogs.h" diff --git a/src/applet-device-cdma.c b/src/applet-device-cdma.c index 1640d479..419e3b9d 100644 --- a/src/applet-device-cdma.c +++ b/src/applet-device-cdma.c @@ -17,7 +17,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 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -27,15 +27,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-device.h> -#include <nm-setting-connection.h> -#include <nm-setting-cdma.h> -#include <nm-setting-serial.h> -#include <nm-setting-ppp.h> -#include <nm-device-modem.h> -#include <nm-utils.h> -#include <nm-secret-agent.h> - #include "applet.h" #include "applet-device-cdma.h" #include "utils.h" diff --git a/src/applet-device-ethernet.c b/src/applet-device-ethernet.c index 6e1c5a37..146c6c82 100644 --- a/src/applet-device-ethernet.c +++ b/src/applet-device-ethernet.c @@ -17,8 +17,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. - * (C) Copyright 2008 Novell, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. + * Copyright 2008 Novell, Inc. */ #ifdef HAVE_CONFIG_H @@ -28,14 +28,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-device.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-8021x.h> -#include <nm-setting-pppoe.h> -#include <nm-device-ethernet.h> -#include <nm-utils.h> - #include "applet.h" #include "applet-device-ethernet.h" #include "ethernet-dialog.h" @@ -54,7 +46,7 @@ ethernet_new_auto_connection (NMDevice *device, NMSettingConnection *s_con; char *uuid; - connection = nm_connection_new (); + connection = nm_simple_connection_new (); s_wired = NM_SETTING_WIRED (nm_setting_wired_new ()); nm_connection_add_setting (connection, NM_SETTING (s_wired)); @@ -223,7 +215,7 @@ pppoe_verify (GtkEditable *editable, gpointer user_data) } static void -pppoe_update_setting (NMSettingPPPOE *pppoe, NMPppoeInfo *info) +pppoe_update_setting (NMSettingPppoe *pppoe, NMPppoeInfo *info) { const char *s; @@ -232,16 +224,16 @@ pppoe_update_setting (NMSettingPPPOE *pppoe, NMPppoeInfo *info) s = NULL; g_object_set (pppoe, - NM_SETTING_PPPOE_USERNAME, gtk_entry_get_text (info->username_entry), - NM_SETTING_PPPOE_PASSWORD, gtk_entry_get_text (info->password_entry), - NM_SETTING_PPPOE_SERVICE, s, - NULL); + NM_SETTING_PPPOE_USERNAME, gtk_entry_get_text (info->username_entry), + NM_SETTING_PPPOE_PASSWORD, gtk_entry_get_text (info->password_entry), + NM_SETTING_PPPOE_SERVICE, s, + NULL); } static void pppoe_update_ui (NMConnection *connection, NMPppoeInfo *info) { - NMSettingPPPOE *s_pppoe; + NMSettingPppoe *s_pppoe; const char *s; g_return_if_fail (NM_IS_CONNECTION (connection)); @@ -279,9 +271,8 @@ get_pppoe_secrets_cb (GtkDialog *dialog, gint response, gpointer user_data) { SecretsRequest *req = user_data; NMPppoeInfo *info = (NMPppoeInfo *) req; - NMSettingPPPOE *setting; - GHashTable *settings = NULL; - GHashTable *secrets; + NMSettingPppoe *setting; + GHashTable *secrets = NULL; GError *error = NULL; if (response != GTK_RESPONSE_OK) { @@ -296,27 +287,21 @@ get_pppoe_secrets_cb (GtkDialog *dialog, gint response, gpointer user_data) setting = nm_connection_get_setting_pppoe (req->connection); pppoe_update_setting (setting, info); - secrets = nm_setting_to_hash (NM_SETTING (setting), NM_SETTING_HASH_FLAG_ONLY_SECRETS); + secrets = nm_connection_to_dbus (req->connection, NM_CONNECTION_SERIALIZE_ONLY_SECRETS); if (!secrets) { g_set_error (&error, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, "%s.%d (%s): failed to hash setting " NM_SETTING_PPPOE_SETTING_NAME, __FILE__, __LINE__, __func__); - } else { - /* Returned secrets are a{sa{sv}}; this is the outer a{s...} hash that - * will contain all the individual settings hashes. - */ - settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) g_hash_table_destroy); - g_hash_table_insert (settings, NM_SETTING_PPPOE_SETTING_NAME, secrets); } done: - applet_secrets_request_complete (req, settings, error); + applet_secrets_request_complete (req, secrets, error); applet_secrets_request_free (req); - if (settings) - g_hash_table_destroy (settings); + if (secrets) + g_hash_table_destroy (secrets); } static void diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c index ca5ad530..9829c908 100644 --- a/src/applet-device-gsm.c +++ b/src/applet-device-gsm.c @@ -17,8 +17,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. - * (C) Copyright 2008 Novell, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. + * Copyright 2008 Novell, Inc. */ #ifdef HAVE_CONFIG_H @@ -32,15 +32,6 @@ #define SECRET_API_SUBJECT_TO_CHANGE #include <libsecret/secret.h> -#include <nm-device.h> -#include <nm-setting-connection.h> -#include <nm-setting-gsm.h> -#include <nm-setting-serial.h> -#include <nm-setting-ppp.h> -#include <nm-device-modem.h> -#include <nm-utils.h> -#include <nm-secret-agent.h> - #include "applet.h" #include "applet-device-gsm.h" #include "utils.h" diff --git a/src/applet-device-infiniband.c b/src/applet-device-infiniband.c index d72cb090..65bfafd4 100644 --- a/src/applet-device-infiniband.c +++ b/src/applet-device-infiniband.c @@ -17,7 +17,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 2013 Red Hat, Inc. + * Copyright 2013 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -27,12 +27,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-device.h> -#include <nm-setting-connection.h> -#include <nm-setting-infiniband.h> -#include <nm-device-infiniband.h> -#include <nm-utils.h> - #include "applet.h" #include "applet-device-infiniband.h" #include "nm-ui-utils.h" @@ -50,7 +44,7 @@ infiniband_new_auto_connection (NMDevice *device, NMSettingConnection *s_con; char *uuid; - connection = nm_connection_new (); + connection = nm_simple_connection_new (); s_infiniband = NM_SETTING_INFINIBAND (nm_setting_infiniband_new ()); nm_connection_add_setting (connection, NM_SETTING (s_infiniband)); diff --git a/src/applet-device-team.c b/src/applet-device-team.c index 9c037847..61107725 100644 --- a/src/applet-device-team.c +++ b/src/applet-device-team.c @@ -1,7 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Copyright (C) 2013 Jiri Pirko <jiri@resnulli.us> - * * 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 @@ -15,6 +13,9 @@ * 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. + * + * Copyright 2013 Jiri Pirko <jiri@resnulli.us> + * Copyright 2013 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -24,13 +25,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-device.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-team.h> -#include <nm-device-team.h> -#include <nm-utils.h> - #include "applet.h" #include "applet-device-team.h" #include "utils.h" diff --git a/src/applet-device-vlan.c b/src/applet-device-vlan.c index 204230cf..e4d0e2f0 100644 --- a/src/applet-device-vlan.c +++ b/src/applet-device-vlan.c @@ -17,8 +17,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 Red Hat, Inc. - * (C) Copyright 2008 Novell, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. + * Copyright 2008 Novell, Inc. */ #ifdef HAVE_CONFIG_H @@ -28,14 +28,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-device.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-vlan.h> -#include <nm-device-ethernet.h> -#include <nm-device-vlan.h> -#include <nm-utils.h> - #include "applet.h" #include "applet-device-vlan.h" #include "nm-ui-utils.h" @@ -62,7 +54,7 @@ find_device_by_mac (const GByteArray *mac, const GPtrArray *devices) char *vlan_hw_address, *candidate_hw_address; int i; - vlan_hw_address = nm_utils_hwaddr_ntoa_len (mac->data, mac->len); + vlan_hw_address = nm_utils_hwaddr_ntoa (mac->data, mac->len); for (i = 0; i < devices->len && device == NULL; i++) { candidate = devices->pdata[i]; diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c index e8ff46f5..0ac92ded 100644 --- a/src/applet-device-wifi.c +++ b/src/applet-device-wifi.c @@ -17,7 +17,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 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -32,15 +32,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-device.h> -#include <nm-access-point.h> -#include <nm-setting-connection.h> -#include <nm-setting-wireless.h> -#include <nm-device-wifi.h> -#include <nm-setting-8021x.h> -#include <nm-utils.h> -#include <nm-secret-agent.h> - #include "applet.h" #include "applet-device-wifi.h" #include "ap-menu-item.h" @@ -258,11 +249,11 @@ static const char *manf_default_ssids[] = { }; static gboolean -is_ssid_in_list (const GByteArray *ssid, const char **list) +is_ssid_in_list (GBytes *ssid, const char **list) { while (*list) { - if (ssid->len == strlen (*list)) { - if (!memcmp (*list, ssid->data, ssid->len)) + if (g_bytes_get_size (ssid) == strlen (*list)) { + if (!memcmp (*list, g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid))) return TRUE; } list++; @@ -271,7 +262,7 @@ is_ssid_in_list (const GByteArray *ssid, const char **list) } static gboolean -is_manufacturer_default_ssid (const GByteArray *ssid) +is_manufacturer_default_ssid (GBytes *ssid) { return is_ssid_in_list (ssid, manf_default_ssids); } @@ -280,12 +271,12 @@ static char * get_ssid_utf8 (NMAccessPoint *ap) { char *ssid_utf8 = NULL; - const GByteArray *ssid; + GBytes *ssid; if (ap) { ssid = nm_access_point_get_ssid (ap); if (ssid) - ssid_utf8 = nm_utils_ssid_to_utf8 (ssid); + ssid_utf8 = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid)); } if (!ssid_utf8) ssid_utf8 = g_strdup (_("(none)")); @@ -301,7 +292,7 @@ static const char *blacklisted_ssids[] = { }; static gboolean -is_blacklisted_ssid (const GByteArray *ssid) +is_blacklisted_ssid (GBytes *ssid) { return is_ssid_in_list (ssid, blacklisted_ssids); } @@ -385,7 +376,7 @@ _do_new_auto_connection (NMApplet *applet, NMSettingWireless *s_wifi = NULL; NMSettingWirelessSecurity *s_wsec = NULL; NMSetting8021x *s_8021x = NULL; - const GByteArray *ssid; + GBytes *ssid; NM80211ApSecurityFlags wpa_flags, rsn_flags; GtkWidget *dialog; MoreInfo *more_info; @@ -395,7 +386,7 @@ _do_new_auto_connection (NMApplet *applet, g_assert (device); g_assert (ap); - connection = nm_connection_new (); + connection = nm_simple_connection_new (); ssid = nm_access_point_get_ssid (ap); if ( (nm_access_point_get_mode (ap) == NM_802_11_MODE_INFRA) @@ -537,7 +528,7 @@ create_new_ap_item (NMDeviceWifi *device, NMNetworkMenuItem *item = NULL; GSList *dev_connections = NULL; GSList *ap_connections = NULL; - const GByteArray *ssid; + GBytes *ssid; guint32 dev_caps; dev_connections = nm_device_filter_connections (NM_DEVICE (device), connections); @@ -550,7 +541,7 @@ create_new_ap_item (NMDeviceWifi *device, gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE); ssid = nm_access_point_get_ssid (ap); - nm_network_menu_item_set_ssid (item, (GByteArray *) ssid); + nm_network_menu_item_set_ssid (item, ssid); dev_caps = nm_device_wifi_get_capabilities (device); nma_icon_check_and_load ("nm-adhoc", &applet->adhoc_icon, applet); @@ -621,13 +612,13 @@ get_menu_item_for_ap (NMDeviceWifi *device, GSList *menu_list, NMApplet *applet) { - const GByteArray *ssid; + GBytes *ssid; struct dup_data dup_data = { NULL, NULL }; /* Don't add BSSs that hide their SSID or are blacklisted */ ssid = nm_access_point_get_ssid (ap); if ( !ssid - || nm_utils_is_empty_ssid (ssid->data, ssid->len) + || nm_utils_is_empty_ssid (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid)) || is_blacklisted_ssid (ssid)) return NULL; @@ -891,7 +882,7 @@ notify_active_ap_changed_cb (NMDeviceWifi *device, NMRemoteConnection *connection; NMSettingWireless *s_wireless; NMAccessPoint *new; - const GByteArray *ssid; + GBytes *ssid_ap, *ssid; NMDeviceState state; state = nm_device_get_state (NM_DEVICE (device)); @@ -908,8 +899,13 @@ notify_active_ap_changed_cb (NMDeviceWifi *device, if (!s_wireless) return; - ssid = nm_access_point_get_ssid (new); - if (!ssid || !nm_utils_same_ssid (nm_setting_wireless_get_ssid (s_wireless), ssid, TRUE)) + ssid_ap = nm_access_point_get_ssid (new); + ssid = nm_setting_wireless_get_ssid (s_wireless); + if ( !ssid_ap + || !ssid + || !nm_utils_same_ssid (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid), + g_bytes_get_data (ssid_ap, NULL), g_bytes_get_size (ssid_ap), + TRUE)) return; applet_schedule_update_icon (applet); @@ -1158,7 +1154,7 @@ wifi_device_added (NMDevice *device, NMApplet *applet) * when the device is destroyed. */ id = g_signal_connect (applet_get_settings (applet), - NM_REMOTE_SETTINGS_NEW_CONNECTION, + NM_REMOTE_SETTINGS_CONNECTION_ADDED, G_CALLBACK (on_new_connection), data); data->new_con_id = id; @@ -1431,31 +1427,15 @@ done: } static gboolean -add_one_setting (GHashTable *settings, - NMConnection *connection, - NMSetting *setting, - GError **error) +remove_unwanted_secrets (gpointer key, gpointer value, gpointer user_data) { - GHashTable *secrets; - - g_return_val_if_fail (settings != NULL, FALSE); - g_return_val_if_fail (connection != NULL, FALSE); - g_return_val_if_fail (setting != NULL, FALSE); - g_return_val_if_fail (error != NULL, FALSE); - g_return_val_if_fail (*error == NULL, FALSE); + gboolean keep_8021X = (gboolean) GPOINTER_TO_UINT (user_data); - secrets = nm_setting_to_hash (setting, NM_SETTING_HASH_FLAG_ALL); - if (secrets) { - g_hash_table_insert (settings, g_strdup (nm_setting_get_name (setting)), secrets); - } else { - g_set_error (error, - NM_SECRET_AGENT_ERROR, - NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, - "%s.%d (%s): failed to hash setting '%s'.", - __FILE__, __LINE__, __func__, nm_setting_get_name (setting)); - } + if ( strcmp ((char *) key, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) + && (strcmp ((char *)key, NM_SETTING_802_1X_SETTING_NAME) || !keep_8021X)) + return TRUE; - return secrets ? TRUE : FALSE; + return FALSE; } typedef struct { @@ -1485,8 +1465,9 @@ get_secrets_dialog_response_cb (GtkDialog *foo, NMAWifiDialog *dialog = NMA_WIFI_DIALOG (info->dialog); NMConnection *connection = NULL; NMSettingWirelessSecurity *s_wireless_sec; - GHashTable *settings = NULL; + GHashTable *hash = NULL; const char *key_mgmt, *auth_alg; + gboolean keep_8021X = FALSE; GError *error = NULL; if (response != GTK_RESPONSE_OK) { @@ -1520,20 +1501,14 @@ get_secrets_dialog_response_cb (GtkDialog *foo, goto done; /* Unencrypted */ } - /* Returned secrets are a{sa{sv}}; this is the outer a{s...} hash that - * will contain all the individual settings hashes. - */ - settings = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, (GDestroyNotify) g_hash_table_destroy); - if (!settings) { + hash = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ONLY_SECRETS); + if (!hash) { g_set_error (&error, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, - "%s.%d (%s): not enough memory to return secrets.", - __FILE__, __LINE__, __func__); - goto done; + "%s.%d (%s): failed to hash connection '%s'.", + __FILE__, __LINE__, __func__, nm_connection_get_id (connection)); } - /* If the user chose an 802.1x-based auth method, return 802.1x secrets, * not wireless secrets. Can happen with Dynamic WEP, because NM doesn't * know the capabilities of the AP (since Dynamic WEP APs don't broadcast @@ -1557,22 +1532,20 @@ get_secrets_dialog_response_cb (GtkDialog *foo, __FILE__, __LINE__, __func__); goto done; } - - /* Add the 802.1x setting */ - if (!add_one_setting (settings, connection, NM_SETTING (s_8021x), &error)) - goto done; + keep_8021X = TRUE; } } - /* Add the 802-11-wireless-security setting no matter what */ - add_one_setting (settings, connection, NM_SETTING (s_wireless_sec), &error); + /* Remove all not-relevant secrets (inner hashes) */ + if (g_hash_table_size (hash) > 0) + g_hash_table_foreach_remove (hash, remove_unwanted_secrets, GUINT_TO_POINTER (keep_8021X)); done: - applet_secrets_request_complete (req, settings, error); + applet_secrets_request_complete (req, hash, error); applet_secrets_request_free (req); - if (settings) - g_hash_table_destroy (settings); + if (hash) + g_hash_table_destroy (hash); if (connection) nm_connection_clear_secrets (connection); } diff --git a/src/applet-device-wimax.c b/src/applet-device-wimax.c index 8780011f..195588a6 100644 --- a/src/applet-device-wimax.c +++ b/src/applet-device-wimax.c @@ -17,7 +17,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 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -27,12 +27,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-device.h> -#include <nm-setting-connection.h> -#include <nm-setting-wimax.h> -#include <nm-device-wimax.h> -#include <nm-utils.h> - #include "applet.h" #include "applet-device-wimax.h" #include "applet-dialogs.h" @@ -77,7 +71,7 @@ wimax_new_auto_connection (NMDevice *device, nsp_name = nm_wimax_nsp_get_name (info->nsp); - connection = nm_connection_new (); + connection = nm_simple_connection_new (); s_wimax = NM_SETTING_WIMAX (nm_setting_wimax_new ()); g_object_set (s_wimax, diff --git a/src/applet-dialogs.c b/src/applet-dialogs.c index e671a0ff..c6d228e2 100644 --- a/src/applet-dialogs.c +++ b/src/applet-dialogs.c @@ -17,7 +17,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 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -26,20 +26,7 @@ #include <sys/socket.h> #include <arpa/inet.h> -#include <nm-device-ethernet.h> -#include <nm-device-wifi.h> -#include <nm-device-modem.h> -#include <nm-device-wimax.h> - -#include <nm-setting-connection.h> -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> -#include <nm-setting-wired.h> -#include <nm-setting-8021x.h> -#include <nm-setting-ip4-config.h> -#include <nm-setting-ip6-config.h> -#include <nm-vpn-connection.h> -#include <nm-utils.h> +#include <NetworkManager.h> #include <gtk/gtk.h> #include <glib/gi18n.h> @@ -462,37 +449,16 @@ display_ip6_info (NMIP6Address *def6_addr, const char *method, GtkGrid *grid, in } static void -display_dns4_info (const GArray *dns, GtkGrid *grid, int *row) +display_dns_info (const char * const *dns, GtkGrid *grid, int *row) { char *label[] = { "Primary DNS:", "Secondary DNS:", "Ternary DNS:" }; - char *str; - int i; - - for (i = 0; dns && i < dns->len && i < 3; i++) { - gtk_grid_attach (grid, create_info_label (_(label[i]), FALSE), - 0, *row, 1, 1); - str = ip4_address_as_string (g_array_index (dns, guint32, i)); - gtk_grid_attach (grid, create_info_label (str, TRUE), - 1, *row, 1, 1); - g_free (str); - (*row)++; - } -} - -static void -display_dns6_info (const GSList *dns6, GtkGrid *grid, int *row) -{ - char *label[] = { "Primary DNS:", "Secondary DNS:", "Ternary DNS:" }; - char *str; int i; - for (i = 0; dns6 && i < 3 ; dns6 = g_slist_next (dns6), i++) { + for (i = 0; dns && dns[i] && i < 3; i++) { gtk_grid_attach (grid, create_info_label (_(label[i]), FALSE), 0, *row, 1, 1); - str = ip6_address_as_string (dns6->data); - gtk_grid_attach (grid, create_info_label (str, TRUE), + gtk_grid_attach (grid, create_info_label (dns[i], TRUE), 1, *row, 1, 1); - g_free (str); (*row)++; } } @@ -509,8 +475,8 @@ info_dialog_add_page (GtkNotebook *notebook, const char *iface, *method = NULL; NMIP4Config *ip4_config; NMIP6Config *ip6_config; - const GArray *dns; - const GSList *dns6; + const char * const *dns; + const char * const *dns6; NMIP4Address *def_addr = NULL; NMIP6Address *def6_addr = NULL; NMSettingIP6Config *s_ip6; @@ -672,7 +638,7 @@ info_dialog_add_page (GtkNotebook *notebook, /* DNS */ dns = def_addr ? nm_ip4_config_get_nameservers (ip4_config) : NULL; - display_dns4_info (dns, grid, &row); + display_dns_info (dns, grid, &row); /* Empty line */ gtk_grid_attach (grid, gtk_label_new (""), 0, row, 2, 1); @@ -703,7 +669,7 @@ info_dialog_add_page (GtkNotebook *notebook, /* DNS */ dns6 = def6_addr ? nm_ip6_config_get_nameservers (ip6_config) : NULL; - display_dns6_info (dns6, grid, &row); + display_dns_info (dns6, grid, &row); gtk_notebook_append_page (notebook, GTK_WIDGET (grid), create_info_notebook_label (connection, is_default)); @@ -791,8 +757,8 @@ info_dialog_add_page_for_vpn (GtkNotebook *notebook, int row = 0; NMIP4Config *ip4_config; NMIP6Config *ip6_config; - const GArray *dns; - const GSList *dns6; + const char * const *dns; + const char * const *dns6; NMIP4Address *def_addr = NULL; NMIP6Address *def6_addr = NULL; const GSList *addresses; @@ -860,7 +826,7 @@ info_dialog_add_page_for_vpn (GtkNotebook *notebook, /* DNS */ dns = def_addr ? nm_ip4_config_get_nameservers (ip4_config) : NULL; - display_dns4_info (dns, grid, &row); + display_dns_info (dns, grid, &row); /* Empty line */ gtk_grid_attach (grid, gtk_label_new (""), 0, row, 2, 1); @@ -892,7 +858,7 @@ info_dialog_add_page_for_vpn (GtkNotebook *notebook, /* DNS */ dns6 = def6_addr ? nm_ip6_config_get_nameservers (ip6_config) : NULL; - display_dns6_info (dns6, grid, &row); + display_dns_info (dns6, grid, &row); } gtk_notebook_append_page (notebook, GTK_WIDGET (grid), @@ -981,7 +947,7 @@ applet_about_dialog_show (NMApplet *applet) { gtk_show_about_dialog (NULL, "version", VERSION, - "copyright", _("Copyright \xc2\xa9 2004-2011 Red Hat, Inc.\n" + "copyright", _("Copyright \xc2\xa9 2004-2014 Red Hat, Inc.\n" "Copyright \xc2\xa9 2005-2008 Novell, Inc.\n" "and many other community contributors and translators"), "comments", _("Notification area applet for managing your network devices and connections."), diff --git a/src/applet-vpn-request.c b/src/applet-vpn-request.c index 09b94c06..2fed5bb8 100644 --- a/src/applet-vpn-request.c +++ b/src/applet-vpn-request.c @@ -17,7 +17,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 2004 - 2012 Red Hat, Inc. + * Copyright 2004 - 2014 Red Hat, Inc. */ #include <config.h> @@ -32,12 +32,10 @@ #include <glib-object.h> +#include <NetworkManager.h> + #include "applet-vpn-request.h" #include "nma-marshal.h" -#include <nm-connection.h> -#include <nm-setting-connection.h> -#include <nm-setting-vpn.h> -#include <nm-secret-agent.h> #define APPLET_TYPE_VPN_REQUEST (applet_vpn_request_get_type ()) #define APPLET_VPN_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLET_TYPE_VPN_REQUEST, AppletVpnRequest)) @@ -310,7 +308,7 @@ write_one_key_val (const char *key, const char *value, gpointer user_data) static gboolean write_connection_to_child (int fd, NMConnection *connection, GError **error) { - NMSettingVPN *s_vpn; + NMSettingVpn *s_vpn; WriteItemInfo info = { .fd = fd, .secret = FALSE, .error = error }; s_vpn = nm_connection_get_setting_vpn (connection); @@ -351,7 +349,7 @@ applet_vpn_request_get_secrets (SecretsRequest *req, GError **error) VpnSecretsInfo *info = (VpnSecretsInfo *) req; AppletVpnRequestPrivate *priv; NMSettingConnection *s_con; - NMSettingVPN *s_vpn; + NMSettingVpn *s_vpn; const char *connection_type; const char *service_type; char *bin_path; diff --git a/src/applet.c b/src/applet.c index 81e2ac52..ab0f8885 100644 --- a/src/applet.c +++ b/src/applet.c @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2004 - 2012 Red Hat, Inc. - * Copyright (C) 2005 - 2008 Novell, Inc. + * Copyright 2004 - 2014 Red Hat, Inc. + * Copyright 2005 - 2008 Novell, Inc. * * This applet used the GNOME Wireless Applet as a skeleton to build from. * @@ -24,7 +24,7 @@ * Eskil Heyn Olsen <eskil@eskil.dk> * Bastien Nocera <hadess@hadess.net> (Gnome2 port) * - * (C) Copyright 2001, 2002 Free Software Foundation + * Copyright 2001, 2002 Free Software Foundation */ #ifdef HAVE_CONFIG_H @@ -44,31 +44,6 @@ #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> -#include <NetworkManagerVPN.h> -#include <nm-device-bond.h> -#include <nm-device-team.h> -#include <nm-device-bridge.h> -#include <nm-device-bt.h> -#include <nm-device-ethernet.h> -#include <nm-device-infiniband.h> -#include <nm-device-modem.h> -#include <nm-device-vlan.h> -#include <nm-device-wifi.h> -#include <nm-device-wimax.h> -#include <nm-utils.h> -#include <nm-connection.h> -#include <nm-vpn-connection.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-wireless.h> -#include <nm-setting-pppoe.h> -#include <nm-setting-gsm.h> -#include <nm-setting-cdma.h> -#include <nm-setting-bluetooth.h> -#include <nm-setting-vpn.h> -#include <nm-active-connection.h> -#include <nm-secret-agent.h> - #include <libnotify/notify.h> #include "applet.h" @@ -1013,7 +988,7 @@ applet_is_any_vpn_activating (NMApplet *applet) connections = nm_client_get_active_connections (applet->nm_client); for (i = 0; connections && (i < connections->len); i++) { NMActiveConnection *candidate = NM_ACTIVE_CONNECTION (g_ptr_array_index (connections, i)); - NMVPNConnectionState vpn_state; + NMVpnConnectionState vpn_state; if (NM_IS_VPN_CONNECTION (candidate)) { vpn_state = nm_vpn_connection_get_vpn_state (NM_VPN_CONNECTION (candidate)); @@ -1029,8 +1004,8 @@ applet_is_any_vpn_activating (NMApplet *applet) } static char * -make_vpn_failure_message (NMVPNConnection *vpn, - NMVPNConnectionStateReason reason, +make_vpn_failure_message (NMVpnConnection *vpn, + NMVpnConnectionStateReason reason, NMApplet *applet) { NMConnection *connection; @@ -1075,8 +1050,8 @@ make_vpn_failure_message (NMVPNConnection *vpn, } static char * -make_vpn_disconnection_message (NMVPNConnection *vpn, - NMVPNConnectionStateReason reason, +make_vpn_disconnection_message (NMVpnConnection *vpn, + NMVpnConnectionStateReason reason, NMApplet *applet) { NMConnection *connection; @@ -1102,9 +1077,9 @@ make_vpn_disconnection_message (NMVPNConnection *vpn, } static void -vpn_connection_state_changed (NMVPNConnection *vpn, - NMVPNConnectionState state, - NMVPNConnectionStateReason reason, +vpn_connection_state_changed (NMVpnConnection *vpn, + NMVpnConnectionState state, + NMVpnConnectionStateReason reason, gpointer user_data) { NMApplet *applet = NM_APPLET (user_data); @@ -1284,7 +1259,7 @@ nma_menu_configure_vpn_item_activate (GtkMenuItem *item, gpointer user_data) static NMActiveConnection * applet_get_first_active_vpn_connection (NMApplet *applet, - NMVPNConnectionState *out_state) + NMVpnConnectionState *out_state) { const GPtrArray *active_list; int i; @@ -1325,7 +1300,7 @@ nma_menu_disconnect_vpn_item_activate (GtkMenuItem *item, gpointer user_data) { NMApplet *applet = NM_APPLET (user_data); NMActiveConnection *active_vpn = NULL; - NMVPNConnectionState state = NM_VPN_CONNECTION_STATE_UNKNOWN; + NMVpnConnectionState state = NM_VPN_CONNECTION_STATE_UNKNOWN; active_vpn = applet_get_first_active_vpn_connection (applet, &state); if (active_vpn) @@ -1469,7 +1444,7 @@ applet_find_active_connection_for_virtual_device (const char *iface, if (!tmp) continue; - if (!g_strcmp0 (nm_connection_get_virtual_iface_name (NM_CONNECTION (tmp)), iface)) { + if (!g_strcmp0 (nm_connection_get_interface_name (NM_CONNECTION (tmp)), iface)) { connection = NM_CONNECTION (tmp); if (out_active) *out_active = active; @@ -1623,8 +1598,8 @@ sort_connections_by_ifname (gconstpointer a, gconstpointer b) NMConnection *aa = NM_CONNECTION (a); NMConnection *bb = NM_CONNECTION (b); - return strcmp (nm_connection_get_virtual_iface_name (aa), - nm_connection_get_virtual_iface_name (bb)); + return strcmp (nm_connection_get_interface_name (aa), + nm_connection_get_interface_name (bb)); } static int @@ -1637,7 +1612,7 @@ add_virtual_items (const char *type, const GPtrArray *all_devices, for (iter = all_connections; iter; iter = iter->next) { NMConnection *connection = iter->data; - if (!nm_connection_get_virtual_iface_name (connection)) + if (!nm_connection_get_interface_name (connection)) continue; if (nm_connection_is_type (connection, type)) @@ -1667,7 +1642,7 @@ add_virtual_items (const char *type, const GPtrArray *all_devices, while (iter) { NMConnection *connection = iter->data; NMDevice *device = NULL; - const char *iface = nm_connection_get_virtual_iface_name (connection); + const char *iface = nm_connection_get_interface_name (connection); GSList *iface_connections = NULL; NMADeviceClass *dclass; NMConnection *active; @@ -1961,7 +1936,7 @@ static void nma_menu_show_cb (GtkWidget *menu, NMApplet *applet) gtk_status_icon_set_tooltip_text (applet->status_icon, NULL); - if (!nm_client_get_manager_running (applet->nm_client)) { + if (!nm_client_get_nm_running (applet->nm_client)) { nma_menu_add_text_item (menu, _("NetworkManager is not running...")); return; } @@ -2582,7 +2557,7 @@ foo_manager_running_cb (NMClient *client, { NMApplet *applet = NM_APPLET (user_data); - if (nm_client_get_manager_running (client)) { + if (nm_client_get_nm_running (client)) { g_debug ("NM appeared"); } else { g_debug ("NM disappeared"); @@ -2656,7 +2631,7 @@ foo_client_setup (NMApplet *applet) { NMClientPermission perm; - applet->nm_client = nm_client_new (); + applet->nm_client = nm_client_new (NULL, NULL); if (!applet->nm_client) return; @@ -2682,7 +2657,7 @@ foo_client_setup (NMApplet *applet) applet->permissions[perm] = nm_client_get_permission_result (applet->nm_client, perm); } - if (nm_client_get_manager_running (applet->nm_client)) + if (nm_client_get_nm_running (applet->nm_client)) g_idle_add (foo_set_initial_state, applet); applet_schedule_update_icon (applet); @@ -2871,7 +2846,7 @@ out: } static char * -get_tip_for_vpn (NMActiveConnection *active, NMVPNConnectionState state, NMApplet *applet) +get_tip_for_vpn (NMActiveConnection *active, NMVpnConnectionState state, NMApplet *applet) { char *tip = NULL; const char *path, *id = NULL; @@ -2924,13 +2899,13 @@ applet_update_icon (gpointer user_data) GdkPixbuf *pixbuf = NULL; NMState state; char *dev_tip = NULL, *vpn_tip = NULL; - NMVPNConnectionState vpn_state = NM_VPN_SERVICE_STATE_UNKNOWN; + NMVpnConnectionState vpn_state = NM_VPN_SERVICE_STATE_UNKNOWN; gboolean nm_running; NMActiveConnection *active_vpn = NULL; applet->update_icon_id = 0; - nm_running = nm_client_get_manager_running (applet->nm_client); + nm_running = nm_client_get_nm_running (applet->nm_client); /* Handle device state first */ @@ -3079,22 +3054,13 @@ applet_secrets_request_complete_setting (SecretsRequest *req, GError *error) { NMSetting *setting; - GHashTable *settings = NULL, *secrets; + GHashTable *secrets_hash = NULL; if (setting_name && !error) { setting = nm_connection_get_setting_by_name (req->connection, setting_name); if (setting) { - secrets = nm_setting_to_hash (NM_SETTING (setting), NM_SETTING_HASH_FLAG_ALL); - if (secrets) { - /* Returned secrets are a{sa{sv}}; this is the outer a{s...} hash that - * will contain all the individual settings hashes. - */ - settings = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, - (GDestroyNotify) g_hash_table_destroy); - g_hash_table_insert (settings, g_strdup (setting_name), secrets); - } else { + secrets_hash = nm_connection_to_dbus (req->connection, NM_CONNECTION_SERIALIZE_ALL); + if (!secrets_hash) { g_set_error (&error, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, @@ -3110,7 +3076,7 @@ applet_secrets_request_complete_setting (SecretsRequest *req, } } - req->callback (req->applet->agent, settings, error, req->callback_data); + req->callback (req->applet->agent, secrets_hash, error, req->callback_data); } void @@ -3560,7 +3526,7 @@ shell_version_changed_cb (NMShellWatcher *watcher, GParamSpec *pspec, gpointer u g_signal_handlers_disconnect_by_func (applet->agent, G_CALLBACK (applet_agent_cancel_secrets_cb), applet); - nm_secret_agent_unregister (NM_SECRET_AGENT (applet->agent)); + nm_secret_agent_unregister (NM_SECRET_AGENT (applet->agent), NULL, NULL); g_clear_object (&applet->agent); } @@ -3656,7 +3622,7 @@ initable_init (GInitable *initable, GCancellable *cancellable, GError **error) g_prefix_error (error, "Failed to initialize D-Bus: "); return FALSE; } - applet->settings = nm_remote_settings_new (NULL); + applet->settings = nm_remote_settings_new (NULL, NULL); #ifdef BUILD_MIGRATION_TOOL { diff --git a/src/applet.h b/src/applet.h index cd5ac97c..61334978 100644 --- a/src/applet.h +++ b/src/applet.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2004 - 2011 Red Hat, Inc. - * Copyright (C) 2005 - 2008 Novell, Inc. + * Copyright 2004 - 2014 Red Hat, Inc. + * Copyright 2005 - 2008 Novell, Inc. */ #ifndef APPLET_H @@ -36,13 +36,8 @@ #include <libnotify/notify.h> -#include <nm-connection.h> -#include <nm-client.h> -#include <nm-access-point.h> -#include <nm-device.h> #include <NetworkManager.h> -#include <nm-active-connection.h> -#include <nm-remote-settings.h> + #include "applet-agent.h" #include "shell-watcher.h" diff --git a/src/connection-editor/ce-page-mobile.ui b/src/connection-editor/ce-page-mobile.ui index 272941a2..733e47dd 100644 --- a/src/connection-editor/ce-page-mobile.ui +++ b/src/connection-editor/ce-page-mobile.ui @@ -1,35 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> - <object class="GtkListStore" id="model1"> - <columns> - <!-- column-name gchararray --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">Any</col> - </row> - <row> - <col id="0" translatable="yes">3G (UMTS/HSPA)</col> - </row> - <row> - <col id="0" translatable="yes">2G (GPRS/EDGE)</col> - </row> - <row> - <col id="0" translatable="yes">Prefer 3G (UMTS/HSPA)</col> - </row> - <row> - <col id="0" translatable="yes">Prefer 2G (GPRS/EDGE)</col> - </row> - <row> - <col id="0" translatable="yes">Prefer 4G (LTE)</col> - </row> - <row> - <col id="0" translatable="yes">Use only 4G (LTE)</col> - </row> - </data> - </object> <object class="GtkVBox" id="MobilePage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -256,42 +227,6 @@ </packing> </child> <child> - <object class="GtkLabel" id="type_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">_Type:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">mobile_network_type</property> - </object> - <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"/> - </packing> - </child> - <child> - <object class="GtkComboBox" id="mobile_network_type"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="model">model1</property> - <child> - <object class="GtkCellRendererText" id="renderer1"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options">GTK_EXPAND</property> - </packing> - </child> - <child> <object class="GtkHBox" id="hbox2"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -338,8 +273,8 @@ <property name="mnemonic_widget">mobile_pin</property> </object> <packing> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="x_options">GTK_FILL</property> <property name="y_options"/> </packing> @@ -354,8 +289,8 @@ <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="y_options"/> </packing> </child> @@ -373,8 +308,8 @@ <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> </packing> </child> </object> diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c index c63a7523..a00b492e 100644 --- a/src/connection-editor/ce-page.c +++ b/src/connection-editor/ce-page.c @@ -17,7 +17,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 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include <config.h> @@ -29,9 +29,6 @@ #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-utils.h> - #include "ce-page.h" #include "nma-marshal.h" @@ -208,31 +205,11 @@ ce_page_setup_mac_combo (CEPage *self, GtkComboBox *combo, } } -void -ce_page_mac_to_entry (const GByteArray *mac, int type, GtkEntry *entry) -{ - char *str_addr; - - g_return_if_fail (entry != NULL); - g_return_if_fail (GTK_IS_ENTRY (entry)); - - if (!mac || !mac->len) - return; - - if (mac->len != nm_utils_hwaddr_len (type)) - return; - - str_addr = nm_utils_hwaddr_ntoa (mac->data, type); - gtk_entry_set_text (entry, str_addr); - g_free (str_addr); -} - -GByteArray * +char * ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid) { - const char *temp, *sp; - char *buf = NULL; - GByteArray *mac; + const char *sp, *temp; + char *mac; g_return_val_if_fail (entry != NULL, NULL); g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL); @@ -241,28 +218,21 @@ ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid) g_return_val_if_fail (*invalid == FALSE, NULL); temp = gtk_entry_get_text (entry); - if (!temp || !strlen (temp)) + if (!temp || !*temp) return NULL; sp = strchr (temp, ' '); if (sp) - temp = buf = g_strndup (temp, sp - temp); - - mac = nm_utils_hwaddr_atoba (temp, type); - g_free (buf); - if (!mac) { - if (invalid) - *invalid = TRUE; - return NULL; - } + mac = g_strndup (temp, sp - temp); + else + mac = g_strdup (temp); - if (type == ARPHRD_ETHER && !utils_ether_addr_valid ((struct ether_addr *)mac->data)) { - g_byte_array_free (mac, TRUE); + if (!nm_utils_hwaddr_valid (mac, nm_utils_hwaddr_len (type))) { + g_free (mac); if (invalid) *invalid = TRUE; return NULL; } - return mac; } @@ -544,7 +514,7 @@ ce_page_new_connection (const char *format, char *uuid, *id; GSList *connections; - connection = nm_connection_new (); + connection = nm_simple_connection_new (); s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ()); nm_connection_add_setting (connection, NM_SETTING (s_con)); diff --git a/src/connection-editor/ce-page.h b/src/connection-editor/ce-page.h index 9d533203..7450ca13 100644 --- a/src/connection-editor/ce-page.h +++ b/src/connection-editor/ce-page.h @@ -17,7 +17,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 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __CE_PAGE_H__ @@ -29,9 +29,8 @@ #include <gtk/gtk.h> #include <dbus/dbus-glib.h> -#include <nm-connection.h> -#include <nm-client.h> -#include <nm-remote-settings.h> +#include <NetworkManager.h> + #include "utils.h" /* for ARPHRD_ETHER / ARPHRD_INFINIBAND for MAC utilies */ @@ -114,9 +113,7 @@ void ce_page_setup_mac_combo (CEPage *self, GtkComboBox *combo, void ce_page_changed (CEPage *self); -void ce_page_mac_to_entry (const GByteArray *mac, int type, GtkEntry *entry); - -GByteArray *ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid); +char *ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid); gboolean ce_spin_output_with_automatic (GtkSpinButton *spin, gpointer user_data); diff --git a/src/connection-editor/ce-polkit-button.c b/src/connection-editor/ce-polkit-button.c index e2701f3e..e2ea7f07 100644 --- a/src/connection-editor/ce-polkit-button.c +++ b/src/connection-editor/ce-polkit-button.c @@ -17,7 +17,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 2009 Red Hat, Inc. + * Copyright 2009 - 2014 Red Hat, Inc. */ #include <string.h> diff --git a/src/connection-editor/ce-polkit-button.h b/src/connection-editor/ce-polkit-button.h index 86496fd6..da2f3e37 100644 --- a/src/connection-editor/ce-polkit-button.h +++ b/src/connection-editor/ce-polkit-button.h @@ -17,7 +17,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 2009 - 2012 Red Hat, Inc. + * Copyright 2009 - 2014444 Red Hat, Inc. */ #ifndef __CE_POLKIT_BUTTON_H__ @@ -25,7 +25,7 @@ #include <gtk/gtk.h> -#include <nm-client.h> +#include <NetworkManager.h> #define CE_TYPE_POLKIT_BUTTON (ce_polkit_button_get_type ()) #define CE_POLKIT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CE_TYPE_POLKIT_BUTTON, CEPolkitButton)) diff --git a/src/connection-editor/connection-helpers.h b/src/connection-editor/connection-helpers.h index ae60ec0e..f50f93f6 100644 --- a/src/connection-editor/connection-helpers.h +++ b/src/connection-editor/connection-helpers.h @@ -15,14 +15,15 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #ifndef __CONNECTION_HELPERS_H__ #define __CONNECTION_HELPERS_H__ +#include <NetworkManager.h> + #include "ce-page.h" -#include <nm-remote-settings.h> typedef struct { const char *name; diff --git a/src/connection-editor/ip4-routes-dialog.c b/src/connection-editor/ip4-routes-dialog.c index 494a357f..36df32f1 100644 --- a/src/connection-editor/ip4-routes-dialog.c +++ b/src/connection-editor/ip4-routes-dialog.c @@ -17,7 +17,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 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -33,8 +33,6 @@ #include <glib/gi18n.h> #include <gdk/gdkkeysyms.h> -#include <nm-utils.h> - #include "ip4-routes-dialog.h" #include "utils.h" diff --git a/src/connection-editor/ip4-routes-dialog.h b/src/connection-editor/ip4-routes-dialog.h index 4f5ef779..1f6c6651 100644 --- a/src/connection-editor/ip4-routes-dialog.h +++ b/src/connection-editor/ip4-routes-dialog.h @@ -17,7 +17,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 2008 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef IP4_ROUTES_DIALOG_H @@ -26,6 +26,8 @@ #include <glib.h> #include <gtk/gtk.h> +#include <NetworkManager.h> + #include "nm-setting-ip4-config.h" GtkWidget *ip4_routes_dialog_new (NMSettingIP4Config *s_ip4, gboolean automatic); diff --git a/src/connection-editor/ip6-routes-dialog.c b/src/connection-editor/ip6-routes-dialog.c index 74a71293..d524318a 100644 --- a/src/connection-editor/ip6-routes-dialog.c +++ b/src/connection-editor/ip6-routes-dialog.c @@ -17,7 +17,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 2008 - 2013 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -33,7 +33,7 @@ #include <glib/gi18n.h> #include <gdk/gdkkeysyms.h> -#include <nm-utils.h> +#include <NetworkManager.h> #include "ip6-routes-dialog.h" #include "utils.h" diff --git a/src/connection-editor/ip6-routes-dialog.h b/src/connection-editor/ip6-routes-dialog.h index e7d5d093..2312c496 100644 --- a/src/connection-editor/ip6-routes-dialog.h +++ b/src/connection-editor/ip6-routes-dialog.h @@ -17,7 +17,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 2008 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef IP6_ROUTES_DIALOG_H @@ -26,6 +26,8 @@ #include <glib.h> #include <gtk/gtk.h> +#include <NetworkManager.h> + #include "nm-setting-ip6-config.h" GtkWidget *ip6_routes_dialog_new (NMSettingIP6Config *s_ip6, gboolean automatic); diff --git a/src/connection-editor/main.c b/src/connection-editor/main.c index cb5d4b5e..d3fd05a0 100644 --- a/src/connection-editor/main.c +++ b/src/connection-editor/main.c @@ -17,7 +17,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright (C) 2004 - 2013 Red Hat, Inc. + * Copyright 2004 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -36,9 +36,6 @@ #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> -#include <nm-setting-wired.h> -#include <nm-setting-gsm.h> -#include <nm-setting-cdma.h> #include "nm-connection-list.h" #include "nm-connection-editor.h" @@ -169,7 +166,7 @@ handle_arguments (NMConnectionList *list, type = NM_SETTING_WIRED_SETTING_NAME; /* Grab type to create or show */ - ctype = nm_connection_lookup_setting_type (type); + ctype = nm_setting_lookup_type (type); if (ctype == 0) { g_warning ("Unknown connection type '%s'", type); g_free (type_tmp); diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c index bdc63a78..0b55e17d 100644 --- a/src/connection-editor/nm-connection-editor.c +++ b/src/connection-editor/nm-connection-editor.c @@ -19,8 +19,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. - * (C) Copyright 2007 - 2008 Novell, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. + * Copyright 2007 - 2008 Novell, Inc. */ #include "config.h" @@ -33,27 +33,6 @@ #include <gdk/gdkx.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-ip4-config.h> -#include <nm-setting-ip6-config.h> -#include <nm-setting-wired.h> -#include <nm-setting-8021x.h> -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> -#include <nm-setting-vpn.h> -#include <nm-setting-pppoe.h> -#include <nm-setting-ppp.h> -#include <nm-setting-gsm.h> -#include <nm-setting-cdma.h> -#include <nm-setting-wimax.h> -#include <nm-setting-infiniband.h> -#include <nm-setting-bond.h> -#include <nm-setting-team.h> -#include <nm-setting-bridge.h> -#include <nm-utils.h> - -#include <nm-remote-connection.h> - #include "nm-connection-editor.h" #include "nma-marshal.h" @@ -478,7 +457,7 @@ nm_connection_editor_get_master (NMConnection *slave) while (g_hash_table_iter_next (&iter, &connection, &editor)) { if (!g_strcmp0 (master, nm_connection_get_uuid (connection))) return editor; - if (!g_strcmp0 (master, nm_connection_get_virtual_iface_name (connection))) + if (!g_strcmp0 (master, nm_connection_get_interface_name (connection))) return editor; } @@ -736,7 +715,7 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor, if (editor->connection) g_object_unref (editor->connection); - editor->connection = nm_connection_duplicate (orig_connection); + editor->connection = nm_simple_connection_new_clone (orig_connection); editor->orig_connection = g_object_ref (orig_connection); nm_connection_editor_update_title (editor); @@ -928,21 +907,9 @@ updated_connection_cb (NMRemoteConnection *connection, GError *error, gpointer u static void ok_button_clicked_save_connection (NMConnectionEditor *self) { - GError *error = NULL; - /* Copy the modified connection to the original connection */ - if (!nm_connection_replace_settings_from_connection (self->orig_connection, - self->connection, - &error)) { - nm_connection_editor_error (GTK_WINDOW (self->window), - _("Error saving connection"), - _("The property '%s' / '%s' is invalid: %d"), - g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)), - error->message, error->code); - g_error_free (error); - return; - } - + nm_connection_replace_settings_from_connection (self->orig_connection, + self->connection); nm_connection_editor_set_busy (self, TRUE); /* Save new CA cert ignore values to GSettings */ @@ -989,7 +956,7 @@ vpn_export_get_secrets_cb (NMRemoteConnection *connection, * connection so that we don't let secrets sit around in the original * one. */ - tmp = nm_connection_duplicate (NM_CONNECTION (connection)); + tmp = nm_simple_connection_new_clone (NM_CONNECTION (connection)); g_assert (tmp); if (secrets) nm_connection_update_secrets (tmp, NM_SETTING_VPN_SETTING_NAME, secrets, NULL); diff --git a/src/connection-editor/nm-connection-editor.h b/src/connection-editor/nm-connection-editor.h index 0a13afda..b815a196 100644 --- a/src/connection-editor/nm-connection-editor.h +++ b/src/connection-editor/nm-connection-editor.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 Rodrigo Moya <rodrigo@gnome-db.org> - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 Rodrigo Moya <rodrigo@gnome-db.org> + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifndef NM_CONNECTION_EDITOR_H @@ -24,8 +24,8 @@ #include <glib-object.h> -#include <nm-client.h> -#include <nm-remote-settings.h> +#include <NetworkManager.h> + #include "utils.h" #define NM_TYPE_CONNECTION_EDITOR (nm_connection_editor_get_type ()) diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c index 1e6846a7..850db4af 100644 --- a/src/connection-editor/nm-connection-list.c +++ b/src/connection-editor/nm-connection-list.c @@ -18,7 +18,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 2007 - 2012 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include <config.h> @@ -30,23 +30,6 @@ #include <gdk/gdkx.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-connection.h> -#include <nm-setting.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-wireless.h> -#include <nm-setting-vpn.h> -#include <nm-setting-gsm.h> -#include <nm-setting-cdma.h> -#include <nm-setting-pppoe.h> -#include <nm-setting-ppp.h> -#include <nm-setting-serial.h> -#include <nm-setting-wimax.h> -#include <nm-setting-infiniband.h> -#include <nm-utils.h> -#include <nm-remote-settings.h> - #include "ce-page.h" #include "nm-connection-editor.h" #include "nm-connection-list.h" @@ -239,7 +222,7 @@ delete_slaves_of_connection (NMConnectionList *list, NMConnection *connection) return; uuid = nm_connection_get_uuid (connection); - iface = nm_connection_get_virtual_iface_name (connection); + iface = nm_connection_get_interface_name (connection); do { if (!gtk_tree_model_iter_children (list->model, &iter, &types_iter)) @@ -717,7 +700,9 @@ add_connection_buttons (NMConnectionList *self) } static void -connection_removed (NMRemoteConnection *connection, gpointer user_data) +connection_removed (NMRemoteSettings *settings, + NMRemoteConnection *connection, + gpointer user_data) { NMConnectionList *self = NM_CONNECTION_LIST (user_data); GtkTreeIter iter, parent_iter; @@ -730,7 +715,7 @@ connection_removed (NMRemoteConnection *connection, gpointer user_data) } static void -connection_updated (NMRemoteConnection *connection, gpointer user_data) +connection_changed (NMRemoteConnection *connection, gpointer user_data) { NMConnectionList *self = NM_CONNECTION_LIST (user_data); GtkTreeIter iter; @@ -758,7 +743,7 @@ get_parent_iter_for_connection (NMConnectionList *list, if (!strcmp (str_type, NM_SETTING_CDMA_SETTING_NAME)) str_type = NM_SETTING_GSM_SETTING_NAME; - type = nm_connection_lookup_setting_type (str_type); + type = nm_setting_lookup_type (str_type); if (gtk_tree_model_get_iter_first (list->model, iter)) { do { @@ -822,33 +807,18 @@ connection_added (NMRemoteSettings *settings, gtk_tree_path_free (path); } - g_signal_connect (connection, NM_REMOTE_CONNECTION_REMOVED, G_CALLBACK (connection_removed), self); - g_signal_connect (connection, NM_REMOTE_CONNECTION_UPDATED, G_CALLBACK (connection_updated), self); + g_signal_connect (settings, NM_REMOTE_SETTINGS_CONNECTION_REMOVED, G_CALLBACK (connection_removed), self); + g_signal_connect (connection, NM_CONNECTION_CHANGED, G_CALLBACK (connection_changed), self); gtk_tree_model_filter_refilter (self->filter); } -static void -initial_connections_read (NMRemoteSettings *settings, gpointer user_data) -{ - NMConnectionList *list = user_data; - GtkTreePath *path; - GtkTreeIter iter; - - g_signal_handlers_disconnect_by_func (settings, G_CALLBACK (initial_connections_read), list); - - if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list->sortable), &iter)) { - path = gtk_tree_model_get_path (GTK_TREE_MODEL (list->sortable), &iter); - gtk_tree_view_scroll_to_cell (list->connection_list, - path, NULL, - FALSE, 0, 0); - gtk_tree_path_free (path); - } -} - NMConnectionList * nm_connection_list_new (void) { NMConnectionList *list; + GtkTreePath *path; + GtkTreeIter iter; + GSList *all_cons, *it; GError *error = NULL; const char *objects[] = { "NMConnectionList", NULL }; @@ -870,24 +840,36 @@ nm_connection_list_new (void) gtk_window_set_default_icon_name ("preferences-system-network"); - list->nm_client = nm_client_new (); + list->nm_client = nm_client_new (NULL, NULL); if (!list->nm_client) goto error; - list->settings = nm_remote_settings_new (NULL); + list->settings = nm_remote_settings_new (NULL, NULL); + if (!list->settings) + goto error; g_signal_connect (list->settings, - NM_REMOTE_SETTINGS_NEW_CONNECTION, + NM_REMOTE_SETTINGS_CONNECTION_ADDED, G_CALLBACK (connection_added), list); - g_signal_connect (list->settings, - NM_REMOTE_SETTINGS_CONNECTIONS_READ, - G_CALLBACK (initial_connections_read), - list); list->connection_list = GTK_TREE_VIEW (gtk_builder_get_object (list->gui, "connection_list")); initialize_treeview (list); add_connection_buttons (list); + + /* Fill the treeview initially */ + all_cons = nm_remote_settings_list_connections (list->settings); + for (it = all_cons; it; it = it->next) + connection_added (list->settings, it->data, list); + + if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list->sortable), &iter)) { + path = gtk_tree_model_get_path (GTK_TREE_MODEL (list->sortable), &iter); + gtk_tree_view_scroll_to_cell (list->connection_list, + path, NULL, + FALSE, 0, 0); + gtk_tree_path_free (path); + } + /* Connect to the main dialog's response handler */ list->dialog = GTK_WIDGET (gtk_builder_get_object (list->gui, "NMConnectionList")); if (!list->dialog) diff --git a/src/connection-editor/nm-connection-list.h b/src/connection-editor/nm-connection-list.h index e77c58ac..ee9cf1cb 100644 --- a/src/connection-editor/nm-connection-list.h +++ b/src/connection-editor/nm-connection-list.h @@ -17,7 +17,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 2004-2009 Red Hat, Inc. + * Copyright 2004 - 2014 Red Hat, Inc. */ #ifndef NM_CONNECTION_LIST_H @@ -26,8 +26,8 @@ #include <glib-object.h> #include <gdk/gdk.h> #include <gtk/gtk.h> -#include <nm-client.h> -#include <nm-remote-settings.h> + +#include <NetworkManager.h> #define NM_TYPE_CONNECTION_LIST (nm_connection_list_get_type ()) #define NM_IS_CONNECTION_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION_LIST)) diff --git a/src/connection-editor/page-8021x-security.c b/src/connection-editor/page-8021x-security.c index 62a8e84c..ebbdb622 100644 --- a/src/connection-editor/page-8021x-security.c +++ b/src/connection-editor/page-8021x-security.c @@ -17,7 +17,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 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -27,13 +27,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <NetworkManager.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-8021x.h> -#include <nm-setting-wireless.h> -#include <nm-utils.h> - #include "wireless-security.h" #include "page-ethernet.h" #include "page-8021x-security.h" @@ -160,7 +153,7 @@ validate (CEPage *page, NMConnection *connection, GError **error) NMSetting *s_con; /* Here's a nice hack to work around the fact that ws_802_1x_fill_connection needs wireless setting. */ - tmp_connection = nm_connection_new (); + tmp_connection = nm_simple_connection_new (); nm_connection_add_setting (tmp_connection, nm_setting_wireless_new ()); /* temp connection needs a 'connection' setting too, since most of diff --git a/src/connection-editor/page-8021x-security.h b/src/connection-editor/page-8021x-security.h index fc749e3b..3e969773 100644 --- a/src/connection-editor/page-8021x-security.h +++ b/src/connection-editor/page-8021x-security.h @@ -17,16 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_8021X_SECURITY_H__ #define __PAGE_8021X_SECURITY_H__ -#include "nm-connection-editor.h" - -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-bond.c b/src/connection-editor/page-bond.c index d05b0b70..efb511a8 100644 --- a/src/connection-editor/page-bond.c +++ b/src/connection-editor/page-bond.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #include "config.h" @@ -24,10 +24,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-bond.h> -#include <nm-utils.h> - #include "page-bond.h" #include "page-infiniband.h" #include "nm-connection-editor.h" @@ -583,7 +579,6 @@ bond_connection_new (GtkWindow *parent, int bond_num = 0, num; GSList *connections, *iter; NMConnection *conn2; - NMSettingBond *s_bond; const char *iface; char *my_iface; @@ -601,10 +596,7 @@ bond_connection_new (GtkWindow *parent, if (!nm_connection_is_type (conn2, NM_SETTING_BOND_SETTING_NAME)) continue; - s_bond = nm_connection_get_setting_bond (conn2); - if (!s_bond) - continue; - iface = nm_setting_bond_get_interface_name (s_bond); + iface = nm_connection_get_interface_name (conn2); if (!iface || strncmp (iface, "bond", 4) != 0 || !g_ascii_isdigit (iface[4])) continue; @@ -615,9 +607,8 @@ bond_connection_new (GtkWindow *parent, g_slist_free (connections); my_iface = g_strdup_printf ("bond%d", bond_num); - s_bond = nm_connection_get_setting_bond (connection); - g_object_set (G_OBJECT (s_bond), - NM_SETTING_BOND_INTERFACE_NAME, my_iface, + g_object_set (G_OBJECT (connection), + NM_SETTING_CONNECTION_INTERFACE_NAME, my_iface, NULL); g_free (my_iface); diff --git a/src/connection-editor/page-bond.h b/src/connection-editor/page-bond.h index dcc8e1f5..c987b15e 100644 --- a/src/connection-editor/page-bond.h +++ b/src/connection-editor/page-bond.h @@ -15,14 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #ifndef __PAGE_BOND_H__ #define __PAGE_BOND_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-bridge-port.c b/src/connection-editor/page-bridge-port.c index 6383d155..60eb9c41 100644 --- a/src/connection-editor/page-bridge-port.c +++ b/src/connection-editor/page-bridge-port.c @@ -17,7 +17,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 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -27,10 +27,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-bridge-port.h> -#include <nm-utils.h> - #include "page-bridge-port.h" G_DEFINE_TYPE (CEPageBridgePort, ce_page_bridge_port, CE_TYPE_PAGE) diff --git a/src/connection-editor/page-bridge-port.h b/src/connection-editor/page-bridge-port.h index 2a352409..de5307ab 100644 --- a/src/connection-editor/page-bridge-port.h +++ b/src/connection-editor/page-bridge-port.h @@ -17,14 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_BRIDGE_PORT_H__ #define __PAGE_BRIDGE_PORT_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-bridge.c b/src/connection-editor/page-bridge.c index 2221e070..e84e387e 100644 --- a/src/connection-editor/page-bridge.c +++ b/src/connection-editor/page-bridge.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #include "config.h" @@ -24,10 +24,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-bridge.h> -#include <nm-utils.h> - #include "page-bridge.h" #include "nm-connection-editor.h" #include "connection-helpers.h" @@ -299,7 +295,6 @@ bridge_connection_new (GtkWindow *parent, int bridge_num = 0, num; GSList *connections, *iter; NMConnection *conn2; - NMSettingBridge *s_bridge; const char *iface; char *my_iface; @@ -317,10 +312,7 @@ bridge_connection_new (GtkWindow *parent, if (!nm_connection_is_type (conn2, NM_SETTING_BRIDGE_SETTING_NAME)) continue; - s_bridge = nm_connection_get_setting_bridge (conn2); - if (!s_bridge) - continue; - iface = nm_setting_bridge_get_interface_name (s_bridge); + iface = nm_connection_get_interface_name (connection); if (!iface || strncmp (iface, "bridge", 6) != 0 || !g_ascii_isdigit (iface[6])) continue; @@ -331,9 +323,8 @@ bridge_connection_new (GtkWindow *parent, g_slist_free (connections); my_iface = g_strdup_printf ("bridge%d", bridge_num); - s_bridge = nm_connection_get_setting_bridge (connection); - g_object_set (G_OBJECT (s_bridge), - NM_SETTING_BRIDGE_INTERFACE_NAME, my_iface, + g_object_set (G_OBJECT (connection), + NM_SETTING_CONNECTION_INTERFACE_NAME, my_iface, NULL); g_free (my_iface); diff --git a/src/connection-editor/page-bridge.h b/src/connection-editor/page-bridge.h index fa6d9271..f149dd26 100644 --- a/src/connection-editor/page-bridge.h +++ b/src/connection-editor/page-bridge.h @@ -15,14 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #ifndef __PAGE_BRIDGE_H__ #define __PAGE_BRIDGE_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-dcb.c b/src/connection-editor/page-dcb.c index d50e95d0..6433f6ce 100644 --- a/src/connection-editor/page-dcb.c +++ b/src/connection-editor/page-dcb.c @@ -17,7 +17,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 2013 Red Hat, Inc. + * Copyright 2013 - 2014 Red Hat, Inc. */ #include "config.h" @@ -29,11 +29,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <NetworkManager.h> -#include <nm-setting-connection.h> -#include <nm-setting-dcb.h> -#include <nm-utils.h> - #include "page-dcb.h" G_DEFINE_TYPE (CEPageDcb, ce_page_dcb, CE_TYPE_PAGE) diff --git a/src/connection-editor/page-dcb.h b/src/connection-editor/page-dcb.h index 2420b265..2b5f3935 100644 --- a/src/connection-editor/page-dcb.h +++ b/src/connection-editor/page-dcb.h @@ -17,16 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2013 Red Hat, Inc. + * Copyright 2013 - 2014 Red Hat, Inc. */ #ifndef __PAGE_DCB_H__ #define __PAGE_DCB_H__ -#include "nm-connection-editor.h" - -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-dsl.c b/src/connection-editor/page-dsl.c index ea35b276..30230979 100644 --- a/src/connection-editor/page-dsl.c +++ b/src/connection-editor/page-dsl.c @@ -17,7 +17,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 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -27,11 +27,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-pppoe.h> -#include <nm-setting-ppp.h> -#include <nm-setting-wired.h> - #include "page-dsl.h" #include "nm-connection-editor.h" @@ -40,7 +35,7 @@ G_DEFINE_TYPE (CEPageDsl, ce_page_dsl, CE_TYPE_PAGE) #define CE_PAGE_DSL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CE_TYPE_PAGE_DSL, CEPageDslPrivate)) typedef struct { - NMSettingPPPOE *setting; + NMSettingPppoe *setting; GtkEntry *username; GtkEntry *password; @@ -66,7 +61,7 @@ static void populate_ui (CEPageDsl *self, NMConnection *connection) { CEPageDslPrivate *priv = CE_PAGE_DSL_GET_PRIVATE (self); - NMSettingPPPOE *setting = priv->setting; + NMSettingPppoe *setting = priv->setting; const char *str; str = nm_setting_pppoe_get_username (setting); diff --git a/src/connection-editor/page-dsl.h b/src/connection-editor/page-dsl.h index 514699a2..68c6f7d4 100644 --- a/src/connection-editor/page-dsl.h +++ b/src/connection-editor/page-dsl.h @@ -17,14 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_DSL_H__ #define __PAGE_DSL_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-ethernet.c b/src/connection-editor/page-ethernet.c index d24a10f3..c42e49a7 100644 --- a/src/connection-editor/page-ethernet.c +++ b/src/connection-editor/page-ethernet.c @@ -17,7 +17,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 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -28,11 +28,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-device-ethernet.h> -#include <nm-utils.h> - #include "page-ethernet.h" G_DEFINE_TYPE (CEPageEthernet, ce_page_ethernet, CE_TYPE_PAGE) @@ -113,8 +108,7 @@ populate_ui (CEPageEthernet *self) int speed_idx; int mtu_def; char **mac_list; - const GByteArray *s_mac; - char *s_mac_str; + const char *s_mac_str; /* Port */ port = nm_setting_wired_get_port (setting); @@ -164,17 +158,16 @@ populate_ui (CEPageEthernet *self) /* Device MAC address */ mac_list = ce_page_get_mac_list (CE_PAGE (self), NM_TYPE_DEVICE_ETHERNET, NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS); - s_mac = nm_setting_wired_get_mac_address (setting); - s_mac_str = s_mac ? nm_utils_hwaddr_ntoa (s_mac->data, ARPHRD_ETHER) : NULL; + s_mac_str = nm_setting_wired_get_mac_address (setting); ce_page_setup_mac_combo (CE_PAGE (self), GTK_COMBO_BOX (priv->device_mac), s_mac_str, mac_list); - g_free (s_mac_str); g_strfreev (mac_list); g_signal_connect (priv->device_mac, "changed", G_CALLBACK (stuff_changed), self); /* Cloned MAC address */ - ce_page_mac_to_entry (nm_setting_wired_get_cloned_mac_address (setting), - ARPHRD_ETHER, priv->cloned_mac); + s_mac_str = nm_setting_wired_get_cloned_mac_address (setting); + if (s_mac_str) + gtk_entry_set_text (priv->cloned_mac, s_mac_str); g_signal_connect (priv->cloned_mac, "changed", G_CALLBACK (stuff_changed), self); /* MTU */ @@ -265,8 +258,8 @@ ui_to_setting (CEPageEthernet *self) CEPageEthernetPrivate *priv = CE_PAGE_ETHERNET_GET_PRIVATE (self); const char *port; guint32 speed; - GByteArray *device_mac = NULL; - GByteArray *cloned_mac = NULL; + char *device_mac = NULL; + char *cloned_mac = NULL; GtkWidget *entry; /* Port */ @@ -322,11 +315,8 @@ ui_to_setting (CEPageEthernet *self) NM_SETTING_WIRED_MTU, (guint32) gtk_spin_button_get_value_as_int (priv->mtu), NULL); - if (device_mac) - g_byte_array_free (device_mac, TRUE); - if (cloned_mac) - g_byte_array_free (cloned_mac, TRUE); - + g_free (device_mac); + g_free (cloned_mac); } static gboolean @@ -335,7 +325,7 @@ validate (CEPage *page, NMConnection *connection, GError **error) CEPageEthernet *self = CE_PAGE_ETHERNET (page); CEPageEthernetPrivate *priv = CE_PAGE_ETHERNET_GET_PRIVATE (self); gboolean invalid = FALSE; - GByteArray *ignore; + char *ignore; GtkWidget *entry; entry = gtk_bin_get_child (GTK_BIN (priv->device_mac)); @@ -343,15 +333,13 @@ validate (CEPage *page, NMConnection *connection, GError **error) ignore = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, &invalid); if (invalid) return FALSE; - if (ignore) - g_byte_array_free (ignore, TRUE); + g_free (ignore); } ignore = ce_page_entry_to_mac (priv->cloned_mac, ARPHRD_ETHER, &invalid); if (invalid) return FALSE; - if (ignore) - g_byte_array_free (ignore, TRUE); + g_free (ignore); ui_to_setting (self); return nm_setting_verify (NM_SETTING (priv->setting), NULL, error); diff --git a/src/connection-editor/page-ethernet.h b/src/connection-editor/page-ethernet.h index 4dd4a5cd..623f5e6a 100644 --- a/src/connection-editor/page-ethernet.h +++ b/src/connection-editor/page-ethernet.h @@ -17,14 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_ETHERNET_H__ #define __PAGE_ETHERNET_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-general.c b/src/connection-editor/page-general.c index 462e5464..99029cf9 100644 --- a/src/connection-editor/page-general.c +++ b/src/connection-editor/page-general.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #include "config.h" @@ -23,8 +23,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> - #include "page-general.h" G_DEFINE_TYPE (CEPageGeneral, ce_page_general, CE_TYPE_PAGE) diff --git a/src/connection-editor/page-general.h b/src/connection-editor/page-general.h index d8a2a2f9..6e68e3ba 100644 --- a/src/connection-editor/page-general.h +++ b/src/connection-editor/page-general.h @@ -15,14 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #ifndef __PAGE_GENERAL_H__ #define __PAGE_GENERAL_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-infiniband.c b/src/connection-editor/page-infiniband.c index 937da397..8a8464fb 100644 --- a/src/connection-editor/page-infiniband.c +++ b/src/connection-editor/page-infiniband.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #include "config.h" @@ -23,11 +23,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-infiniband.h> -#include <nm-device-infiniband.h> -#include <nm-utils.h> - #include <net/if_arp.h> #include <linux/if_infiniband.h> @@ -91,8 +86,7 @@ populate_ui (CEPageInfiniband *self) int mode_idx = TRANSPORT_MODE_DATAGRAM; int mtu_def; char **mac_list; - const GByteArray *s_mac; - char *s_mac_str; + const char *s_mac_str; /* Port */ mode = nm_setting_infiniband_get_transport_mode (setting); @@ -107,11 +101,9 @@ populate_ui (CEPageInfiniband *self) /* Device MAC address */ mac_list = ce_page_get_mac_list (CE_PAGE (self), NM_TYPE_DEVICE_INFINIBAND, NM_DEVICE_INFINIBAND_HW_ADDRESS); - s_mac = nm_setting_infiniband_get_mac_address (setting); - s_mac_str = s_mac ? nm_utils_hwaddr_ntoa (s_mac->data, ARPHRD_INFINIBAND) : NULL; + s_mac_str = nm_setting_infiniband_get_mac_address (setting); ce_page_setup_mac_combo (CE_PAGE (self), GTK_COMBO_BOX (priv->device_mac), s_mac_str, mac_list); - g_free (s_mac_str); g_strfreev (mac_list); g_signal_connect (priv->device_mac, "changed", G_CALLBACK (stuff_changed), self); @@ -212,12 +204,11 @@ validate (CEPage *page, NMConnection *connection, GError **error) CEPageInfiniband *self = CE_PAGE_INFINIBAND (page); CEPageInfinibandPrivate *priv = CE_PAGE_INFINIBAND_GET_PRIVATE (self); GtkWidget *entry; - char buf[INFINIBAND_ALEN]; const char *hwaddr; entry = gtk_bin_get_child (GTK_BIN (priv->device_mac)); hwaddr = gtk_entry_get_text (GTK_ENTRY (entry)); - if (hwaddr && *hwaddr && !nm_utils_hwaddr_aton (hwaddr, ARPHRD_INFINIBAND, buf)) + if (hwaddr && !nm_utils_hwaddr_valid (hwaddr, INFINIBAND_ALEN)) return FALSE; ui_to_setting (self); diff --git a/src/connection-editor/page-infiniband.h b/src/connection-editor/page-infiniband.h index e895a987..55c741ec 100644 --- a/src/connection-editor/page-infiniband.h +++ b/src/connection-editor/page-infiniband.h @@ -15,14 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #ifndef __PAGE_INFINIBAND_H__ #define __PAGE_INFINIBAND_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-ip4.c b/src/connection-editor/page-ip4.c index fe1a5759..0e0b76c6 100644 --- a/src/connection-editor/page-ip4.c +++ b/src/connection-editor/page-ip4.c @@ -17,7 +17,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 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -33,16 +33,6 @@ #include <netinet/in.h> #include <arpa/inet.h> -#include <nm-setting-connection.h> -#include <nm-setting-ip4-config.h> -#include <nm-setting-wired.h> -#include <nm-setting-wireless.h> -#include <nm-setting-gsm.h> -#include <nm-setting-cdma.h> -#include <nm-setting-pppoe.h> -#include <nm-setting-vpn.h> -#include <nm-utils.h> - #include "page-ip4.h" #include "ip4-routes-dialog.h" #include "connection-helpers.h" @@ -128,7 +118,7 @@ ip4_private_init (CEPageIP4 *self, NMConnection *connection) connection_type = nm_setting_connection_get_connection_type (s_con); g_assert (connection_type); - priv->connection_type = nm_connection_lookup_setting_type (connection_type); + priv->connection_type = nm_setting_lookup_type (connection_type); if (priv->connection_type == NM_TYPE_SETTING_VPN) { str_auto = _("Automatic (VPN)"); @@ -410,17 +400,15 @@ populate_ui (CEPageIP4 *self) /* DNS servers */ string = g_string_new (""); for (i = 0; i < nm_setting_ip4_config_get_num_dns (setting); i++) { - struct in_addr tmp_addr; - char buf[INET_ADDRSTRLEN + 1]; + const char *dns; - tmp_addr.s_addr = nm_setting_ip4_config_get_dns (setting, i); - if (!tmp_addr.s_addr) + dns = nm_setting_ip4_config_get_dns (setting, i); + if (!dns) continue; - (void) inet_ntop (AF_INET, &tmp_addr, &buf[0], sizeof (buf)); if (string->len) g_string_append (string, ", "); - g_string_append (string, buf); + g_string_append (string, dns); } gtk_entry_set_text (priv->dns_servers, string->str); g_string_free (string, TRUE); @@ -1034,7 +1022,7 @@ ce_page_ip4_new (NMConnection *connection, static void free_one_addr (gpointer data) { - g_array_free ((GArray *) data, TRUE); + nm_ip4_address_unref ((NMIP4Address *) data); } static gboolean @@ -1045,8 +1033,9 @@ ui_to_setting (CEPageIP4 *self) GtkTreeIter tree_iter; int int_method = IP4_METHOD_AUTO; const char *method; - GArray *dns_servers = NULL; - GSList *search_domains = NULL; + GPtrArray *tmp_array = NULL; + char **dns_servers = NULL; + char **search_domains = NULL; GPtrArray *addresses = NULL; gboolean valid = FALSE, iter_valid; const char *text; @@ -1090,8 +1079,8 @@ ui_to_setting (CEPageIP4 *self) while (iter_valid) { char *item = NULL; struct in_addr tmp_addr, tmp_gateway = { 0 }; - GArray *addr; - guint32 empty_val = 0, prefix; + NMIP4Address *nm_addr; + guint32 prefix; gtk_tree_model_get (model, &tree_iter, COL_ADDRESS, &item, -1); if (!item || inet_pton (AF_INET, item, &tmp_addr) <= 0) { @@ -1127,14 +1116,12 @@ ui_to_setting (CEPageIP4 *self) } g_free (item); - addr = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3); - g_array_append_val (addr, tmp_addr.s_addr); - g_array_append_val (addr, prefix); - if (tmp_gateway.s_addr) - g_array_append_val (addr, tmp_gateway.s_addr); - else - g_array_append_val (addr, empty_val); - g_ptr_array_add (addresses, addr); + nm_addr = nm_ip4_address_new (); + nm_ip4_address_set_address (nm_addr, tmp_addr.s_addr); + nm_ip4_address_set_prefix (nm_addr, (guint32) prefix); + nm_ip4_address_set_gateway (nm_addr, tmp_gateway.s_addr); + + g_ptr_array_add (addresses, nm_addr); iter_valid = gtk_tree_model_iter_next (model, &tree_iter); } @@ -1146,8 +1133,7 @@ ui_to_setting (CEPageIP4 *self) } /* DNS servers */ - dns_servers = g_array_new (FALSE, FALSE, sizeof (guint)); - + tmp_array = g_ptr_array_new (); text = gtk_entry_get_text (GTK_ENTRY (priv->dns_servers)); if (text && strlen (text)) { items = g_strsplit_set (text, ", ;:", 0); @@ -1155,20 +1141,24 @@ ui_to_setting (CEPageIP4 *self) struct in_addr tmp_addr; char *stripped = g_strstrip (*iter); - if (!strlen (stripped)) + if (!*stripped) continue; if (inet_pton (AF_INET, stripped, &tmp_addr)) - g_array_append_val (dns_servers, tmp_addr.s_addr); + g_ptr_array_add (tmp_array, g_strdup (stripped)); else { g_strfreev (items); + g_ptr_array_free (tmp_array, TRUE); goto out; } } g_strfreev (items); } + g_ptr_array_add (tmp_array, NULL); + dns_servers = (char **) g_ptr_array_free (tmp_array, FALSE); /* Search domains */ + tmp_array = g_ptr_array_new (); text = gtk_entry_get_text (GTK_ENTRY (priv->dns_searches)); if (text && strlen (text)) { items = g_strsplit_set (text, ", ;:", 0); @@ -1176,12 +1166,12 @@ ui_to_setting (CEPageIP4 *self) char *stripped = g_strstrip (*iter); if (strlen (stripped)) - search_domains = g_slist_prepend (search_domains, g_strdup (stripped)); + g_ptr_array_add (tmp_array, g_strdup (stripped)); } g_strfreev (items); } - - search_domains = g_slist_reverse (search_domains); + g_ptr_array_add (tmp_array, NULL); + search_domains = (char **) g_ptr_array_free (tmp_array, FALSE); /* DHCP client ID */ if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { @@ -1210,11 +1200,8 @@ out: g_ptr_array_free (addresses, TRUE); } - if (dns_servers) - g_array_free (dns_servers, TRUE); - - g_slist_foreach (search_domains, (GFunc) g_free, NULL); - g_slist_free (search_domains); + g_strfreev (dns_servers); + g_strfreev (search_domains); return valid; } diff --git a/src/connection-editor/page-ip4.h b/src/connection-editor/page-ip4.h index 4fcad4c8..2b2bf1f7 100644 --- a/src/connection-editor/page-ip4.h +++ b/src/connection-editor/page-ip4.h @@ -17,14 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_IP4_H__ #define __PAGE_IP4_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c index 57964417..5bcba42b 100644 --- a/src/connection-editor/page-ip6.c +++ b/src/connection-editor/page-ip6.c @@ -17,7 +17,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 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -33,16 +33,6 @@ #include <netinet/in.h> #include <arpa/inet.h> -#include <nm-setting-connection.h> -#include <nm-setting-ip6-config.h> -#include <nm-setting-wired.h> -#include <nm-setting-wireless.h> -#include <nm-setting-gsm.h> -#include <nm-setting-cdma.h> -#include <nm-setting-pppoe.h> -#include <nm-setting-vpn.h> -#include <nm-utils.h> - #include "page-ip6.h" #include "ip6-routes-dialog.h" @@ -134,7 +124,7 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection) connection_type = nm_setting_connection_get_connection_type (s_con); g_assert (connection_type); - priv->connection_type = nm_connection_lookup_setting_type (connection_type); + priv->connection_type = nm_setting_lookup_type (connection_type); if (priv->connection_type == NM_TYPE_SETTING_VPN) { str_auto = _("Automatic (VPN)"); @@ -427,17 +417,15 @@ populate_ui (CEPageIP6 *self) /* DNS servers */ string = g_string_new (""); for (i = 0; i < nm_setting_ip6_config_get_num_dns (setting); i++) { - const struct in6_addr *tmp_addr; - char buf[INET6_ADDRSTRLEN + 1]; + const char *dns; - tmp_addr = nm_setting_ip6_config_get_dns (setting, i); - if (!tmp_addr) + dns = nm_setting_ip6_config_get_dns (setting, i); + if (!dns) continue; - (void) inet_ntop (AF_INET6, tmp_addr, &buf[0], sizeof (buf)); if (string->len) g_string_append (string, ", "); - g_string_append (string, buf); + g_string_append (string, dns); } gtk_entry_set_text (priv->dns_servers, string->str); g_string_free (string, TRUE); @@ -1153,7 +1141,7 @@ ui_to_setting (CEPageIP6 *self) continue; if (inet_pton (AF_INET6, stripped, &tmp_addr)) { - nm_setting_ip6_config_add_dns (priv->setting, &tmp_addr); + nm_setting_ip6_config_add_dns (priv->setting, stripped); } else { g_strfreev (items); goto out; diff --git a/src/connection-editor/page-ip6.h b/src/connection-editor/page-ip6.h index 433fa14b..16d222e9 100644 --- a/src/connection-editor/page-ip6.h +++ b/src/connection-editor/page-ip6.h @@ -17,14 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_IP6_H__ #define __PAGE_IP6_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-master.c b/src/connection-editor/page-master.c index 1b89003d..22999444 100644 --- a/src/connection-editor/page-master.c +++ b/src/connection-editor/page-master.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #include "config.h" @@ -24,7 +24,7 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> +#include <NetworkManager.h> #include "page-master.h" #include "nm-connection-editor.h" @@ -143,7 +143,9 @@ find_connection (CEPageMaster *self, NMRemoteConnection *connection, GtkTreeIter } static void -connection_removed (NMRemoteConnection *connection, gpointer user_data) +connection_removed (NMRemoteSettings *settings, + NMRemoteConnection *connection, + gpointer user_data) { CEPageMaster *self = CE_PAGE_MASTER (user_data); CEPageMasterPrivate *priv = CE_PAGE_MASTER_GET_PRIVATE (self); @@ -159,7 +161,7 @@ connection_removed (NMRemoteConnection *connection, gpointer user_data) } static void -connection_updated (NMRemoteConnection *connection, gpointer user_data) +connection_changed (NMRemoteConnection *connection, gpointer user_data) { CEPageMaster *self = CE_PAGE_MASTER (user_data); CEPageMasterPrivate *priv = CE_PAGE_MASTER_GET_PRIVATE (self); @@ -190,7 +192,7 @@ get_device_for_connection (NMClient *client, NMConnection *conn) /* Make sure the connection is actually locked to a specific device */ s_con = nm_connection_get_setting_connection (conn); if ( !nm_setting_connection_get_interface_name (s_con) - && !nm_connection_get_virtual_iface_name (conn)) { + && !nm_connection_get_interface_name (conn)) { NMSetting *s_hw; GByteArray *mac_address; @@ -292,7 +294,7 @@ connection_added (NMRemoteSettings *settings, if (!master) return; - interface_name = nm_connection_get_virtual_iface_name (CE_PAGE (self)->connection); + interface_name = nm_connection_get_interface_name (CE_PAGE (self)->connection); if (strcmp (master, interface_name) != 0 && strcmp (master, priv->uuid) != 0) return; @@ -305,10 +307,10 @@ connection_added (NMRemoteSettings *settings, -1); ce_page_changed (CE_PAGE (self)); - g_signal_connect (connection, NM_REMOTE_CONNECTION_REMOVED, + g_signal_connect (settings, NM_REMOTE_SETTINGS_CONNECTION_REMOVED, G_CALLBACK (connection_removed), self); - g_signal_connect (connection, NM_REMOTE_CONNECTION_UPDATED, - G_CALLBACK (connection_updated), self); + g_signal_connect (connection, NM_CONNECTION_CHANGED, + G_CALLBACK (connection_changed), self); g_signal_emit (self, signals[CONNECTION_ADDED], 0, connection); } @@ -367,7 +369,7 @@ add_connection (NMConnection *connection, iface_name = gtk_entry_get_text (priv->interface_name); if (!*iface_name) - iface_name = nm_connection_get_virtual_iface_name (connection); + iface_name = nm_connection_get_interface_name (connection); if (!*iface_name) iface_name = nm_connection_get_id (connection); name = g_strdup_printf (_("%s slave %d"), iface_name, @@ -499,7 +501,7 @@ populate_ui (CEPageMaster *self) g_return_if_fail (s_con != NULL); /* Interface name */ - iface = nm_connection_get_virtual_iface_name (CE_PAGE (self)->connection); + iface = nm_connection_get_interface_name (CE_PAGE (self)->connection); gtk_entry_set_text (priv->interface_name, iface ? iface : ""); /* Slave connections */ @@ -543,7 +545,7 @@ finish_setup (CEPageMaster *self, gpointer unused, GError *error, gpointer user_ populate_ui (self); - g_signal_connect (CE_PAGE (self)->settings, NM_REMOTE_SETTINGS_NEW_CONNECTION, + g_signal_connect (CE_PAGE (self)->settings, NM_REMOTE_SETTINGS_CONNECTION_ADDED, G_CALLBACK (connection_added), self); g_signal_connect (priv->interface_name, "changed", G_CALLBACK (stuff_changed), self); diff --git a/src/connection-editor/page-master.h b/src/connection-editor/page-master.h index 380d8964..7e45281c 100644 --- a/src/connection-editor/page-master.h +++ b/src/connection-editor/page-master.h @@ -15,14 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #ifndef __PAGE_MASTER_H__ #define __PAGE_MASTER_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c index 57424260..6da78ebe 100644 --- a/src/connection-editor/page-mobile.c +++ b/src/connection-editor/page-mobile.c @@ -17,7 +17,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 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -27,12 +27,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-gsm.h> -#include <nm-setting-cdma.h> -#include <nm-setting-serial.h> -#include <nm-setting-ppp.h> - #include "page-mobile.h" #include "nm-connection-editor.h" #include "nm-mobile-wizard.h" @@ -53,7 +47,6 @@ typedef struct { GtkEntry *apn; GtkButton *apn_button; GtkEntry *network_id; - GtkComboBox *network_type; GtkToggleButton *roaming_allowed; GtkEntry *pin; @@ -86,7 +79,6 @@ mobile_private_init (CEPageMobile *self) priv->apn = GTK_ENTRY (gtk_builder_get_object (builder, "mobile_apn")); priv->apn_button = GTK_BUTTON (gtk_builder_get_object (builder, "mobile_apn_button")); priv->network_id = GTK_ENTRY (gtk_builder_get_object (builder, "mobile_network_id")); - priv->network_type = GTK_COMBO_BOX (gtk_builder_get_object (builder, "mobile_network_type")); priv->roaming_allowed = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "mobile_roaming_allowed")); priv->pin = GTK_ENTRY (gtk_builder_get_object (builder, "mobile_pin")); @@ -99,7 +91,6 @@ populate_gsm_ui (CEPageMobile *self, NMConnection *connection) { CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self); NMSettingGsm *setting = NM_SETTING_GSM (priv->setting); - int type_idx; const char *s; s = nm_setting_gsm_get_number (setting); @@ -118,34 +109,6 @@ populate_gsm_ui (CEPageMobile *self, NMConnection *connection) if (s) gtk_entry_set_text (priv->network_id, s); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - switch (nm_setting_gsm_get_network_type (setting)) { - case NM_SETTING_GSM_NETWORK_TYPE_UMTS_HSPA: - type_idx = NET_TYPE_3G; - break; - case NM_SETTING_GSM_NETWORK_TYPE_GPRS_EDGE: - type_idx = NET_TYPE_2G; - break; - case NM_SETTING_GSM_NETWORK_TYPE_PREFER_UMTS_HSPA: - type_idx = NET_TYPE_PREFER_3G; - break; - case NM_SETTING_GSM_NETWORK_TYPE_PREFER_GPRS_EDGE: - type_idx = NET_TYPE_PREFER_2G; - break; - case NM_SETTING_GSM_NETWORK_TYPE_PREFER_4G: - type_idx = NET_TYPE_PREFER_4G; - break; - case NM_SETTING_GSM_NETWORK_TYPE_4G: - type_idx = NET_TYPE_4G; - break; - case NM_SETTING_GSM_NETWORK_TYPE_ANY: - default: - type_idx = NET_TYPE_ANY; - break; - } - gtk_combo_box_set_active (priv->network_type, type_idx); -G_GNUC_END_IGNORE_DEPRECATIONS - gtk_toggle_button_set_active (priv->roaming_allowed, !nm_setting_gsm_get_home_only (setting)); @@ -320,7 +283,6 @@ finish_setup (CEPageMobile *self, gpointer unused, GError *error, gpointer user_ gtk_entry_set_max_length (priv->network_id, 6); /* MCC/MNCs are max 6 chars */ g_signal_connect (priv->network_id, "insert-text", G_CALLBACK (network_id_filter_cb), self); - g_signal_connect (priv->network_type, "changed", G_CALLBACK (stuff_changed), self); g_signal_connect (priv->pin, "changed", G_CALLBACK (stuff_changed), self); g_signal_connect (priv->roaming_allowed, "toggled", G_CALLBACK (stuff_changed), self); @@ -393,34 +355,8 @@ static void gsm_ui_to_setting (CEPageMobile *self) { CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self); - int net_type; gboolean roaming_allowed; - switch (gtk_combo_box_get_active (priv->network_type)) { - case NET_TYPE_3G: - net_type = NM_SETTING_GSM_NETWORK_TYPE_UMTS_HSPA; - break; - case NET_TYPE_2G: - net_type = NM_SETTING_GSM_NETWORK_TYPE_GPRS_EDGE; - break; - case NET_TYPE_PREFER_3G: - net_type = NM_SETTING_GSM_NETWORK_TYPE_PREFER_UMTS_HSPA; - break; - case NET_TYPE_PREFER_2G: - net_type = NM_SETTING_GSM_NETWORK_TYPE_PREFER_GPRS_EDGE; - break; - case NET_TYPE_PREFER_4G: - net_type = NM_SETTING_GSM_NETWORK_TYPE_PREFER_4G; - break; - case NET_TYPE_4G: - net_type = NM_SETTING_GSM_NETWORK_TYPE_4G; - break; - case NET_TYPE_ANY: - default: - net_type = NM_SETTING_GSM_NETWORK_TYPE_ANY; - break; - } - roaming_allowed = gtk_toggle_button_get_active (priv->roaming_allowed); g_object_set (priv->setting, @@ -429,7 +365,6 @@ gsm_ui_to_setting (CEPageMobile *self) NM_SETTING_GSM_PASSWORD, nm_entry_get_text (priv->password), NM_SETTING_GSM_APN, nm_entry_get_text (priv->apn), NM_SETTING_GSM_NETWORK_ID, nm_entry_get_text (priv->network_id), - NM_SETTING_GSM_NETWORK_TYPE, net_type, NM_SETTING_GSM_PIN, nm_entry_get_text (priv->pin), NM_SETTING_GSM_HOME_ONLY, !roaming_allowed, NULL); diff --git a/src/connection-editor/page-mobile.h b/src/connection-editor/page-mobile.h index ab2903cc..f2c0cdcd 100644 --- a/src/connection-editor/page-mobile.h +++ b/src/connection-editor/page-mobile.h @@ -17,14 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_MOBILE_H__ #define __PAGE_MOBILE_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-ppp.c b/src/connection-editor/page-ppp.c index 2f9f8d60..2ff0dc04 100644 --- a/src/connection-editor/page-ppp.c +++ b/src/connection-editor/page-ppp.c @@ -17,7 +17,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 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -27,9 +27,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-ppp.h> - #include "page-ppp.h" #include "ppp-auth-methods-dialog.h" #include "nm-connection-editor.h" @@ -49,7 +46,7 @@ G_DEFINE_TYPE (CEPagePpp, ce_page_ppp, CE_TYPE_PAGE) #define TAG_MSCHAPV2 4 typedef struct { - NMSettingPPP *setting; + NMSettingPpp *setting; GtkLabel *auth_methods_label; GtkButton *auth_methods_button; @@ -214,7 +211,7 @@ static void populate_ui (CEPagePpp *self, NMConnection *connection) { CEPagePppPrivate *priv = CE_PAGE_PPP_GET_PRIVATE (self); - NMSettingPPP *setting = priv->setting; + NMSettingPpp *setting = priv->setting; gboolean require_mppe, require_mppe_128, mppe_stateful, nobsdcomp, nodeflate, no_vj_comp; g_object_get (setting, diff --git a/src/connection-editor/page-ppp.h b/src/connection-editor/page-ppp.h index 9b53575f..fffc9217 100644 --- a/src/connection-editor/page-ppp.h +++ b/src/connection-editor/page-ppp.h @@ -17,14 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_PPP_H__ #define __PAGE_PPP_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-team-port.c b/src/connection-editor/page-team-port.c index 149e00e9..80c4d84b 100644 --- a/src/connection-editor/page-team-port.c +++ b/src/connection-editor/page-team-port.c @@ -1,7 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Copyright (C) 2013 Jiri Pirko <jiri@resnulli.us> - * * 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 @@ -15,6 +13,9 @@ * 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. + * + * Copyright 2013 Jiri Pirko <jiri@resnulli.us> + * Copyright 2013 - 2014 Red Hat, Inc. */ #include "config.h" @@ -24,10 +25,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-team-port.h> -#include <nm-utils.h> - #include "page-team-port.h" G_DEFINE_TYPE (CEPageTeamPort, ce_page_team_port, CE_TYPE_PAGE) diff --git a/src/connection-editor/page-team-port.h b/src/connection-editor/page-team-port.h index 6eccb15e..8e079ef1 100644 --- a/src/connection-editor/page-team-port.h +++ b/src/connection-editor/page-team-port.h @@ -1,7 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Copyright (C) 2013 Jiri Pirko <jiri@resnulli.us> - * * 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 @@ -15,13 +13,14 @@ * 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. + * + * Copyright 2013 Jiri Pirko <jiri@resnulli.us> + * Copyright 2013 - 2014 Red Hat, Inc. */ #ifndef __PAGE_TEAM_PORT_H__ #define __PAGE_TEAM_PORT_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-team.c b/src/connection-editor/page-team.c index 26e3432f..cb8145d3 100644 --- a/src/connection-editor/page-team.c +++ b/src/connection-editor/page-team.c @@ -15,6 +15,9 @@ * 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. + * + * Copyright 2013 Jiri Pirko <jiri@resnulli.us> + * Copyright 2013 - 2014 Red Hat, Inc. */ #include "config.h" @@ -23,10 +26,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-team.h> -#include <nm-utils.h> - #include "page-team.h" #include "page-infiniband.h" #include "nm-connection-editor.h" @@ -335,7 +334,6 @@ team_connection_new (GtkWindow *parent, int team_num, num; GSList *connections, *iter; NMConnection *conn2; - NMSettingTeam *s_team; const char *iface; char *my_iface; @@ -354,10 +352,7 @@ team_connection_new (GtkWindow *parent, if (!nm_connection_is_type (conn2, NM_SETTING_TEAM_SETTING_NAME)) continue; - s_team = nm_connection_get_setting_team (conn2); - if (!s_team) - continue; - iface = nm_setting_team_get_interface_name (s_team); + iface = nm_connection_get_interface_name (conn2); if (!iface || strncmp (iface, "team", 4) != 0 || !g_ascii_isdigit (iface[4])) continue; @@ -368,9 +363,8 @@ team_connection_new (GtkWindow *parent, g_slist_free (connections); my_iface = g_strdup_printf ("team%d", team_num); - s_team = nm_connection_get_setting_team (connection); - g_object_set (G_OBJECT (s_team), - NM_SETTING_TEAM_INTERFACE_NAME, my_iface, + g_object_set (G_OBJECT (connection), + NM_SETTING_CONNECTION_INTERFACE_NAME, my_iface, NULL); g_free (my_iface); diff --git a/src/connection-editor/page-team.h b/src/connection-editor/page-team.h index d1936b32..b94acb42 100644 --- a/src/connection-editor/page-team.h +++ b/src/connection-editor/page-team.h @@ -1,7 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* - * Copyright (C) 2013 Jiri Pirko <jiri@resnulli.us> - * * 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 @@ -15,13 +13,14 @@ * 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. + * + * Copyright 2013 Jiri Pirko <jiri@resnulli.us> + * Copyright 2013 - 2014 Red Hat, Inc. */ #ifndef __PAGE_TEAM_H__ #define __PAGE_TEAM_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c index 6fa6cc51..061bfbb7 100644 --- a/src/connection-editor/page-vlan.c +++ b/src/connection-editor/page-vlan.c @@ -15,7 +15,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 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -27,11 +27,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-vlan.h> -#include <nm-device-ethernet.h> -#include <nm-utils.h> - #include "page-vlan.h" G_DEFINE_TYPE (CEPageVlan, ce_page_vlan, CE_TYPE_PAGE) @@ -302,7 +297,7 @@ build_vlan_parent_list (CEPageVlan *self, GSList *devices) if (nm_setting_connection_get_master (s_con)) continue; - connection_gtype = nm_connection_lookup_setting_type (nm_setting_connection_get_connection_type (s_con)); + connection_gtype = nm_setting_lookup_type (nm_setting_connection_get_connection_type (s_con)); if (!nm_utils_check_virtual_device_compatibility (NM_TYPE_SETTING_VLAN, connection_gtype)) continue; @@ -376,9 +371,8 @@ populate_ui (CEPageVlan *self) * wired setting, figure out the device from that. */ if (priv->s_hw && !parent_device) { - const GByteArray *mac; - const char *device_mac_str; - char *mac_str; + const char *device_mac; + const char *mac; if (NM_IS_SETTING_WIRED (priv->s_hw)) mac = nm_setting_wired_get_mac_address (NM_SETTING_WIRED (priv->s_hw)); @@ -386,17 +380,15 @@ populate_ui (CEPageVlan *self) mac = NULL; if (mac) { - mac_str = nm_utils_hwaddr_ntoa (mac->data, ARPHRD_ETHER); - for (d_iter = devices; d_iter; d_iter = d_iter->next) { device = d_iter->data; if (NM_IS_DEVICE_ETHERNET (device)) - device_mac_str = nm_device_ethernet_get_permanent_hw_address (NM_DEVICE_ETHERNET (device)); + device_mac = nm_device_ethernet_get_permanent_hw_address (NM_DEVICE_ETHERNET (device)); else - device_mac_str = NULL; + device_mac = NULL; - if (!g_strcmp0 (mac_str, device_mac_str)) { + if (device_mac && nm_utils_hwaddr_matches (mac, -1, device_mac, -1)) { parent_device = device; break; } @@ -423,7 +415,7 @@ populate_ui (CEPageVlan *self) priv->last_parent = g_strndup (current_parent, strcspn (current_parent, " ")); /* Name */ - iface = nm_setting_vlan_get_interface_name (priv->setting); + iface = nm_connection_get_interface_name (CE_PAGE (self)->connection); if (iface) gtk_entry_set_text (priv->name_entry, iface); g_signal_connect (priv->name_entry, "changed", G_CALLBACK (name_changed), self); @@ -434,10 +426,8 @@ populate_ui (CEPageVlan *self) g_signal_connect (priv->id_entry, "value-changed", G_CALLBACK (id_changed), self); /* Cloned MAC address */ - if (NM_IS_SETTING_WIRED (priv->s_hw)) { - ce_page_mac_to_entry (nm_setting_wired_get_cloned_mac_address (NM_SETTING_WIRED (priv->s_hw)), - ARPHRD_ETHER, priv->cloned_mac); - } + if (NM_IS_SETTING_WIRED (priv->s_hw)) + gtk_entry_set_text (priv->cloned_mac, nm_setting_wired_get_cloned_mac_address (NM_SETTING_WIRED (priv->s_hw))); g_signal_connect (priv->cloned_mac, "changed", G_CALLBACK (stuff_changed), self); /* MTU */ @@ -511,7 +501,7 @@ ui_to_setting (CEPageVlan *self) CEPageVlanPrivate *priv = CE_PAGE_VLAN_GET_PRIVATE (self); NMConnection *connection = CE_PAGE (self)->connection; NMSettingConnection *s_con = nm_connection_get_setting_connection (connection); - GByteArray *cloned_mac = NULL; + char *cloned_mac = NULL; VlanParent *parent = NULL; int parent_id, vid; const char *parent_iface = NULL, *parent_uuid = NULL; @@ -567,9 +557,9 @@ ui_to_setting (CEPageVlan *self) iface = gtk_entry_get_text (priv->name_entry); vid = gtk_spin_button_get_value_as_int (priv->id_entry); + g_object_set (s_con, NM_SETTING_CONNECTION_INTERFACE_NAME, iface, NULL); g_object_set (priv->setting, NM_SETTING_VLAN_PARENT, parent_uuid ? parent_uuid : parent_iface, - NM_SETTING_VLAN_INTERFACE_NAME, iface, NM_SETTING_VLAN_ID, vid, NULL); @@ -589,8 +579,7 @@ ui_to_setting (CEPageVlan *self) NM_SETTING_WIRED_MTU, (guint32) mtu, NULL); - if (cloned_mac) - g_byte_array_free (cloned_mac, TRUE); + g_free(cloned_mac); } else if (priv->s_hw) { nm_connection_remove_setting (connection, G_OBJECT_TYPE (priv->s_hw)); priv->s_hw = NULL; @@ -606,7 +595,7 @@ validate (CEPage *page, NMConnection *connection, GError **error) CEPageVlan *self = CE_PAGE_VLAN (page); CEPageVlanPrivate *priv = CE_PAGE_VLAN_GET_PRIVATE (self); gboolean invalid = FALSE; - GByteArray *ignore; + char *ignore; int parent_id; const char *parent; char *parent_iface; @@ -626,8 +615,7 @@ validate (CEPage *page, NMConnection *connection, GError **error) ignore = ce_page_entry_to_mac (priv->cloned_mac, ARPHRD_ETHER, &invalid); if (invalid) return FALSE; - if (ignore) - g_byte_array_free (ignore, TRUE); + g_free (ignore); ui_to_setting (self); diff --git a/src/connection-editor/page-vlan.h b/src/connection-editor/page-vlan.h index 0e66a067..abacac75 100644 --- a/src/connection-editor/page-vlan.h +++ b/src/connection-editor/page-vlan.h @@ -15,14 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_VLAN_H__ #define __PAGE_VLAN_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-vpn.c b/src/connection-editor/page-vpn.c index 81592c8d..a2893d68 100644 --- a/src/connection-editor/page-vpn.c +++ b/src/connection-editor/page-vpn.c @@ -17,7 +17,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 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -27,13 +27,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-vpn.h> -#include <nm-utils.h> - -#define NM_VPN_API_SUBJECT_TO_CHANGE -#include <nm-vpn-plugin-ui-interface.h> - #include "page-vpn.h" #include "connection-helpers.h" #include "nm-connection-editor.h" @@ -44,7 +37,7 @@ G_DEFINE_TYPE (CEPageVpn, ce_page_vpn, CE_TYPE_PAGE) #define CE_PAGE_VPN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CE_TYPE_PAGE_VPN, CEPageVpnPrivate)) typedef struct { - NMSettingVPN *setting; + NMSettingVpn *setting; char *service_type; @@ -204,7 +197,7 @@ import_cb (NMConnection *connection, gpointer user_data) { NewVpnInfo *info = (NewVpnInfo *) user_data; NMSettingConnection *s_con; - NMSettingVPN *s_vpn; + NMSettingVpn *s_vpn; const char *service_type; char *s; GError *error = NULL; diff --git a/src/connection-editor/page-vpn.h b/src/connection-editor/page-vpn.h index 2339732f..4a618ce4 100644 --- a/src/connection-editor/page-vpn.h +++ b/src/connection-editor/page-vpn.h @@ -17,14 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_VPN_H__ #define __PAGE_VPN_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/page-wifi-security.c b/src/connection-editor/page-wifi-security.c index 488898c0..73af50b9 100644 --- a/src/connection-editor/page-wifi-security.c +++ b/src/connection-editor/page-wifi-security.c @@ -17,7 +17,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 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -27,13 +27,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <NetworkManager.h> -#include <nm-setting-connection.h> -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> -#include <nm-setting-8021x.h> -#include <nm-utils.h> - #include "wireless-security.h" #include "page-wifi.h" #include "page-wifi-security.h" @@ -478,7 +471,7 @@ validate (CEPage *page, NMConnection *connection, GError **error) sec = wireless_security_combo_get_active (self); if (sec) { - const GByteArray *ssid = nm_setting_wireless_get_ssid (s_wireless); + GBytes *ssid = nm_setting_wireless_get_ssid (s_wireless); if (ssid) { /* FIXME: get failed property and error out of wifi security objects */ diff --git a/src/connection-editor/page-wifi-security.h b/src/connection-editor/page-wifi-security.h index a0dd0ed1..b1c3a165 100644 --- a/src/connection-editor/page-wifi-security.h +++ b/src/connection-editor/page-wifi-security.h @@ -17,16 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_WIFI_SECURITY_H__ #define __PAGE_WIFI_SECURITY_H__ -#include "nm-connection-editor.h" - -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> #include <gtk/gtk.h> diff --git a/src/connection-editor/page-wifi.c b/src/connection-editor/page-wifi.c index d0a56173..eee33dfa 100644 --- a/src/connection-editor/page-wifi.c +++ b/src/connection-editor/page-wifi.c @@ -17,7 +17,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 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -28,11 +28,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-wireless.h> -#include <nm-device-wifi.h> -#include <nm-utils.h> - #include "page-wifi.h" G_DEFINE_TYPE (CEPageWifi, ce_page_wifi, CE_TYPE_PAGE) @@ -298,17 +293,16 @@ populate_ui (CEPageWifi *self) { CEPageWifiPrivate *priv = CE_PAGE_WIFI_GET_PRIVATE (self); NMSettingWireless *setting = priv->setting; - GByteArray *ssid = NULL; - char *mode = NULL; - char *band = NULL; + GBytes *ssid; + const char *mode; + const char *band; int band_idx = 0; int rate_def; int tx_power_def; int mtu_def; char *utf8_ssid; char **mac_list; - const GByteArray *s_mac, *s_bssid; - char *s_mac_str, *s_bssid_str; + const char *s_mac_str, *s_bssid_str; GPtrArray *bssid_array; char **bssid_list; guint32 idx; @@ -331,21 +325,18 @@ populate_ui (CEPageWifi *self) GINT_TO_POINTER (mtu_def)); g_signal_connect_swapped (priv->mtu, "value-changed", G_CALLBACK (ce_page_changed), self); - g_object_get (setting, - NM_SETTING_WIRELESS_SSID, &ssid, - NM_SETTING_WIRELESS_MODE, &mode, - NM_SETTING_WIRELESS_BAND, &band, - NULL); + ssid = nm_setting_wireless_get_ssid (setting); + mode = nm_setting_wireless_get_mode (setting); + band = nm_setting_wireless_get_band (setting); if (ssid) - utf8_ssid = nm_utils_ssid_to_utf8 (ssid); + utf8_ssid = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), + g_bytes_get_size (ssid)); else utf8_ssid = g_strdup (""); gtk_entry_set_text (priv->ssid, utf8_ssid); g_signal_connect_swapped (priv->ssid, "changed", G_CALLBACK (ce_page_changed), self); g_free (utf8_ssid); - if (ssid) - g_byte_array_free (ssid, TRUE); /* Default to Infrastructure */ gtk_combo_box_set_active (priv->mode, 0); @@ -353,7 +344,6 @@ populate_ui (CEPageWifi *self) gtk_combo_box_set_active (priv->mode, 1); mode_combo_changed_cb (priv->mode, self); g_signal_connect (priv->mode, "changed", G_CALLBACK (mode_combo_changed_cb), self); - g_free (mode); g_signal_connect (priv->channel, "output", G_CALLBACK (channel_spin_output_cb), @@ -371,7 +361,6 @@ populate_ui (CEPageWifi *self) band_idx = 2; gtk_widget_set_sensitive (GTK_WIDGET (priv->channel), TRUE); } - g_free (band); } gtk_combo_box_set_active (priv->band, band_idx); @@ -391,28 +380,25 @@ populate_ui (CEPageWifi *self) g_ptr_array_add (bssid_array, g_strdup (nm_setting_wireless_get_seen_bssid (setting, idx))); g_ptr_array_add (bssid_array, NULL); bssid_list = (char **) g_ptr_array_free (bssid_array, FALSE); - s_bssid = nm_setting_wireless_get_bssid (setting); - s_bssid_str = s_bssid ? nm_utils_hwaddr_ntoa (s_bssid->data, ARPHRD_ETHER) : NULL; + s_bssid_str = nm_setting_wireless_get_bssid (setting); ce_page_setup_mac_combo (CE_PAGE (self), GTK_COMBO_BOX (priv->bssid), s_bssid_str, bssid_list); - g_free (s_bssid_str); g_strfreev (bssid_list); g_signal_connect_swapped (priv->bssid, "changed", G_CALLBACK (ce_page_changed), self); /* Device MAC address */ mac_list = ce_page_get_mac_list (CE_PAGE (self), NM_TYPE_DEVICE_WIFI, NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS); - s_mac = nm_setting_wireless_get_mac_address (setting); - s_mac_str = s_mac ? nm_utils_hwaddr_ntoa (s_mac->data, ARPHRD_ETHER) : NULL; + s_mac_str = nm_setting_wireless_get_mac_address (setting); ce_page_setup_mac_combo (CE_PAGE (self), GTK_COMBO_BOX (priv->device_mac), s_mac_str, mac_list); - g_free (s_mac_str); g_strfreev (mac_list); g_signal_connect_swapped (priv->device_mac, "changed", G_CALLBACK (ce_page_changed), self); /* Cloned MAC address */ - ce_page_mac_to_entry (nm_setting_wireless_get_cloned_mac_address (setting), - ARPHRD_ETHER, priv->cloned_mac); + s_mac_str = nm_setting_wireless_get_cloned_mac_address (setting); + if (s_mac_str) + gtk_entry_set_text (priv->cloned_mac, s_mac_str); g_signal_connect_swapped (priv->cloned_mac, "changed", G_CALLBACK (ce_page_changed), self); gtk_spin_button_set_value (priv->rate, (gdouble) nm_setting_wireless_get_rate (setting)); @@ -482,12 +468,12 @@ ce_page_wifi_new (NMConnection *connection, return CE_PAGE (self); } -GByteArray * +GBytes * ce_page_wifi_get_ssid (CEPageWifi *self) { CEPageWifiPrivate *priv; const char *txt_ssid; - GByteArray *ssid; + GBytes *ssid; g_return_val_if_fail (CE_IS_PAGE_WIFI (self), NULL); @@ -496,8 +482,7 @@ ce_page_wifi_get_ssid (CEPageWifi *self) if (!txt_ssid || !strlen (txt_ssid)) return NULL; - ssid = g_byte_array_sized_new (strlen (txt_ssid)); - g_byte_array_append (ssid, (const guint8 *) txt_ssid, strlen (txt_ssid)); + ssid = g_bytes_new (txt_ssid, strlen (txt_ssid)); return ssid; } @@ -506,10 +491,10 @@ static void ui_to_setting (CEPageWifi *self) { CEPageWifiPrivate *priv = CE_PAGE_WIFI_GET_PRIVATE (self); - GByteArray *ssid; - GByteArray *bssid = NULL; - GByteArray *device_mac = NULL; - GByteArray *cloned_mac = NULL; + GBytes *ssid; + char *bssid = NULL; + char *device_mac = NULL; + char *cloned_mac = NULL; const char *mode; const char *band; GtkWidget *entry; @@ -556,14 +541,10 @@ ui_to_setting (CEPageWifi *self) NM_SETTING_WIRELESS_MTU, gtk_spin_button_get_value_as_int (priv->mtu), NULL); - if (ssid) - g_byte_array_free (ssid, TRUE); - if (device_mac) - g_byte_array_free (device_mac, TRUE); - if (cloned_mac) - g_byte_array_free (cloned_mac, TRUE); - if (bssid) - g_byte_array_free (bssid, TRUE); + g_bytes_unref (ssid); + g_free (device_mac); + g_free (cloned_mac); + g_free (bssid); } static gboolean @@ -573,7 +554,7 @@ validate (CEPage *page, NMConnection *connection, GError **error) CEPageWifiPrivate *priv = CE_PAGE_WIFI_GET_PRIVATE (self); gboolean success; gboolean invalid = FALSE; - GByteArray *ignore; + char *ignore; GtkWidget *entry; entry = gtk_bin_get_child (GTK_BIN (priv->bssid)); @@ -581,8 +562,7 @@ validate (CEPage *page, NMConnection *connection, GError **error) ignore = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, &invalid); if (invalid) return FALSE; - if (ignore) - g_byte_array_free (ignore, TRUE); + g_free (ignore); } entry = gtk_bin_get_child (GTK_BIN (priv->device_mac)); @@ -590,15 +570,13 @@ validate (CEPage *page, NMConnection *connection, GError **error) ignore = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, &invalid); if (invalid) return FALSE; - if (ignore) - g_byte_array_free (ignore, TRUE); + g_free (ignore); } ignore = ce_page_entry_to_mac (priv->cloned_mac, ARPHRD_ETHER, &invalid); if (invalid) return FALSE; - if (ignore) - g_byte_array_free (ignore, TRUE); + g_free (ignore); ui_to_setting (self); diff --git a/src/connection-editor/page-wifi.h b/src/connection-editor/page-wifi.h index c039b00a..9bb1dd23 100644 --- a/src/connection-editor/page-wifi.h +++ b/src/connection-editor/page-wifi.h @@ -17,14 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 - 2012 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef __PAGE_WIFI_H__ #define __PAGE_WIFI_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> @@ -54,8 +52,8 @@ CEPage *ce_page_wifi_new (NMConnection *connection, const char **out_secrets_setting_name, GError **error); -/* Caller must free returned array */ -GByteArray *ce_page_wifi_get_ssid (CEPageWifi *self); +/* Caller must free returned value with g_bytes_unref() */ +GBytes *ce_page_wifi_get_ssid (CEPageWifi *self); void wifi_connection_new (GtkWindow *parent, diff --git a/src/connection-editor/page-wimax.c b/src/connection-editor/page-wimax.c index ef5cd619..b0f2eac3 100644 --- a/src/connection-editor/page-wimax.c +++ b/src/connection-editor/page-wimax.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #include "config.h" @@ -23,11 +23,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-wimax.h> -#include <nm-device-wimax.h> -#include <nm-utils.h> - #include "page-wimax.h" G_DEFINE_TYPE (CEPageWimax, ce_page_wimax, CE_TYPE_PAGE) @@ -75,8 +70,7 @@ populate_ui (CEPageWimax *self) CEPageWimaxPrivate *priv = CE_PAGE_WIMAX_GET_PRIVATE (self); NMSettingWimax *setting = priv->setting; char **mac_list; - const GByteArray *s_mac; - char *s_mac_str; + const char *s_mac_str; gtk_entry_set_text (priv->name, nm_setting_wimax_get_network_name (setting)); g_signal_connect_swapped (priv->name, "changed", G_CALLBACK (ce_page_changed), self); @@ -84,11 +78,9 @@ populate_ui (CEPageWimax *self) /* Device MAC address */ mac_list = ce_page_get_mac_list (CE_PAGE (self), NM_TYPE_DEVICE_WIMAX, NM_DEVICE_WIMAX_HW_ADDRESS); - s_mac = nm_setting_wimax_get_mac_address (setting); - s_mac_str = s_mac ? nm_utils_hwaddr_ntoa (s_mac->data, ARPHRD_ETHER) : NULL; + s_mac_str = nm_setting_wimax_get_mac_address (setting); ce_page_setup_mac_combo (CE_PAGE (self), GTK_COMBO_BOX (priv->device_mac), s_mac_str, mac_list); - g_free (s_mac_str); g_strfreev (mac_list); g_signal_connect_swapped (priv->device_mac, "changed", G_CALLBACK (ce_page_changed), self); } @@ -148,7 +140,7 @@ ui_to_setting (CEPageWimax *self) { CEPageWimaxPrivate *priv = CE_PAGE_WIMAX_GET_PRIVATE (self); const char *name; - GByteArray *device_mac = NULL; + char *device_mac = NULL; GtkWidget *entry; name = gtk_entry_get_text (priv->name); @@ -162,8 +154,7 @@ ui_to_setting (CEPageWimax *self) NM_SETTING_WIMAX_MAC_ADDRESS, device_mac, NULL); - if (device_mac) - g_byte_array_free (device_mac, TRUE); + g_free (device_mac); } static gboolean @@ -173,7 +164,7 @@ validate (CEPage *page, NMConnection *connection, GError **error) CEPageWimaxPrivate *priv = CE_PAGE_WIMAX_GET_PRIVATE (self); const char *name; gboolean invalid = FALSE; - GByteArray *ignore; + char *ignore; GtkWidget *entry; name = gtk_entry_get_text (priv->name); @@ -185,8 +176,7 @@ validate (CEPage *page, NMConnection *connection, GError **error) ignore = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, &invalid); if (invalid) return FALSE; - if (ignore) - g_byte_array_free (ignore, TRUE); + g_free (ignore); } ui_to_setting (self); diff --git a/src/connection-editor/page-wimax.h b/src/connection-editor/page-wimax.h index 69382848..47ea554c 100644 --- a/src/connection-editor/page-wimax.h +++ b/src/connection-editor/page-wimax.h @@ -15,14 +15,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #ifndef __PAGE_WIMAX_H__ #define __PAGE_WIMAX_H__ -#include <nm-connection.h> - #include <glib.h> #include <glib-object.h> diff --git a/src/connection-editor/ppp-auth-methods-dialog.c b/src/connection-editor/ppp-auth-methods-dialog.c index 7e6207bb..873ceef5 100644 --- a/src/connection-editor/ppp-auth-methods-dialog.c +++ b/src/connection-editor/ppp-auth-methods-dialog.c @@ -17,7 +17,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 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include <netinet/in.h> @@ -30,7 +30,7 @@ #include <glib/gi18n.h> -#include <nm-utils.h> +#include <NetworkManager.h> #include "ppp-auth-methods-dialog.h" diff --git a/src/connection-editor/vpn-helpers.c b/src/connection-editor/vpn-helpers.c index c8a3f11c..bc3d065a 100644 --- a/src/connection-editor/vpn-helpers.c +++ b/src/connection-editor/vpn-helpers.c @@ -17,7 +17,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 2008 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #include "config.h" @@ -28,16 +28,9 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-connection.h> -#include <nm-setting-connection.h> -#include <nm-setting-vpn.h> - #include "vpn-helpers.h" #include "utils.h" -#define NM_VPN_API_SUBJECT_TO_CHANGE -#include "nm-vpn-plugin-ui-interface.h" - #define VPN_NAME_FILES_DIR SYSCONFDIR"/NetworkManager/VPN" static GHashTable *plugins = NULL; @@ -262,7 +255,7 @@ export_vpn_to_file_cb (GtkWidget *dialog, gint response, gpointer user_data) GError *error = NULL; NMVpnPluginUiInterface *plugin; NMSettingConnection *s_con = NULL; - NMSettingVPN *s_vpn = NULL; + NMSettingVpn *s_vpn = NULL; const char *service_type; const char *id = NULL; gboolean success = FALSE; @@ -351,7 +344,7 @@ vpn_export (NMConnection *connection) { GtkWidget *dialog; NMVpnPluginUiInterface *plugin; - NMSettingVPN *s_vpn = NULL; + NMSettingVpn *s_vpn = NULL; const char *service_type; const char *home_folder; @@ -391,7 +384,7 @@ vpn_export (NMConnection *connection) gboolean vpn_supports_ipv6 (NMConnection *connection) { - NMSettingVPN *s_vpn; + NMSettingVpn *s_vpn; const char *service_type; NMVpnPluginUiInterface *plugin; guint32 capabilities; diff --git a/src/connection-editor/vpn-helpers.h b/src/connection-editor/vpn-helpers.h index d14fc8fe..8043308e 100644 --- a/src/connection-editor/vpn-helpers.h +++ b/src/connection-editor/vpn-helpers.h @@ -17,7 +17,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 2008 Red Hat, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef _VPN_HELPERS_H_ @@ -25,10 +25,8 @@ #include <glib.h> #include <gtk/gtk.h> -#include <nm-connection.h> -#define NM_VPN_API_SUBJECT_TO_CHANGE -#include <nm-vpn-plugin-ui-interface.h> +#include <NetworkManager.h> GHashTable *vpn_get_plugins (GError **error); diff --git a/src/ethernet-dialog.c b/src/ethernet-dialog.c index 26d0053b..64a6c2f8 100644 --- a/src/ethernet-dialog.c +++ b/src/ethernet-dialog.c @@ -17,8 +17,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 Novell, Inc. - * (C) Copyright 2008 - 2011 Red Hat, Inc. + * Copyright 2008 Novell, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -26,10 +26,7 @@ #endif #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> -#include <nm-setting-wireless.h> -#include <nm-utils.h> + #include "ethernet-dialog.h" #include "wireless-security.h" #include "applet-dialogs.h" @@ -142,7 +139,7 @@ nma_ethernet_dialog_get_connection (GtkWidget *dialog) /* Here's a nice hack to work around the fact that ws_802_1x_fill_connection() * needs a wireless setting and a connection setting for various things. */ - tmp_connection = nm_connection_new (); + tmp_connection = nm_simple_connection_new (); /* Add the fake connection setting (mainly for the UUID for cert ignore checking) */ s_con = nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION); diff --git a/src/ethernet-dialog.h b/src/ethernet-dialog.h index 8e2f1981..b2a685f3 100644 --- a/src/ethernet-dialog.h +++ b/src/ethernet-dialog.h @@ -17,15 +17,16 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2008 Novell, Inc. - * (C) Copyright 2008 - 2011 Red Hat, Inc. + * Copyright 2008 Novell, Inc. + * Copyright 2008 - 2014 Red Hat, Inc. */ #ifndef ETHERNET_DIALOG_H #define ETHERNET_DIALOG_H #include <gtk/gtk.h> -#include <nm-connection.h> + +#include <NetworkManager.h> GtkWidget *nma_ethernet_dialog_new (NMConnection *connection); diff --git a/src/gconf-helpers/gconf-helpers.c b/src/gconf-helpers/gconf-helpers.c index 53014be6..dbe85318 100644 --- a/src/gconf-helpers/gconf-helpers.c +++ b/src/gconf-helpers/gconf-helpers.c @@ -17,7 +17,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 2005 - 2010 Red Hat, Inc. + * Copyright 2005 - 2014 Red Hat, Inc. */ #include <string.h> @@ -37,19 +37,7 @@ #include <gnome-keyring.h> #include <dbus/dbus-glib.h> -#include <nm-setting-bluetooth.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> -#include <nm-setting-8021x.h> -#include <nm-setting-vpn.h> -#include <nm-setting-ip4-config.h> -#include <nm-setting-cdma.h> -#include <nm-setting-gsm.h> -#include <nm-setting-ppp.h> -#include <nm-setting-pppoe.h> -#include <nm-utils.h> +#include <NetworkManager.h> #include "gconf-helpers.h" #include "gconf-upgrade.h" @@ -2036,16 +2024,20 @@ read_one_setting (gpointer data, gpointer user_data) { char *name; ReadFromGConfInfo *info = (ReadFromGConfInfo *) user_data; - NMSetting *setting; + GType type; + NMSetting *setting = NULL; /* Setting name is the gconf directory name. Since "data" here contains full gconf path plus separator ('/'), omit that. */ name = (char *) data + info->dir_len + 1; - setting = nm_connection_create_setting (name); + type = nm_setting_lookup_type (name); + if (type) + setting = g_object_new (type, NULL); + if (setting) { nm_setting_enumerate_values (setting, - read_one_setting_value_from_gconf, - info); + read_one_setting_value_from_gconf, + info); nm_connection_add_setting (info->connection, setting); } @@ -2072,7 +2064,7 @@ nm_gconf_read_connection (GConfClient *client, return NULL; } - info.connection = nm_connection_new (); + info.connection = nm_simple_connection_new (); info.client = client; info.dir = dir; info.dir_len = strlen (dir); @@ -2280,7 +2272,7 @@ out: typedef NMSetting8021xCKScheme (*SchemeFunc) (NMSetting8021x *setting); typedef const char * (*PathFunc) (NMSetting8021x *setting); -typedef const GByteArray * (*BlobFunc) (NMSetting8021x *setting); +typedef GBytes * (*BlobFunc) (NMSetting8021x *setting); typedef NMSetting8021xCKFormat (*FormatFunc) (NMSetting8021x *setting); typedef const char * (*PasswordFunc)(NMSetting8021x *setting); @@ -2403,13 +2395,13 @@ write_object (GConfClient *client, const char *dir, const char *id, NMSetting8021x *s_8021x, - const GByteArray *override_data, + GBytes *override_data, const ObjectType *objtype, GError **error) { NMSetting8021xCKScheme scheme; const char *path = NULL; - const GByteArray *blob = NULL; + GBytes *blob = NULL; const char *setting_name = nm_setting_get_name (NM_SETTING (s_8021x)); g_return_val_if_fail (objtype != NULL, FALSE); @@ -2483,7 +2475,8 @@ write_object (GConfClient *client, * can use paths from now on instead of pushing around the certificate * data itself. */ - success = write_secret_file (new_file, (const char *) blob->data, blob->len, &write_error); + success = write_secret_file (new_file, (const char *) g_bytes_get_data (blob, NULL), + g_bytes_get_size (blob), &write_error); if (success) { nm_gconf_set_string_helper (client, dir, objtype->setting_key, setting_name, new_file); return TRUE; @@ -2530,8 +2523,9 @@ write_one_certificate (GConfClient *client, g_assert (id); while (*obj && !handled) { - const GByteArray *blob = NULL; + GBytes *blob = NULL; GByteArray *enc_key = NULL; + GBytes *enc_key_bytes; if (strcmp (key, (*obj)->setting_key)) { obj++; @@ -2566,7 +2560,8 @@ write_one_certificate (GConfClient *client, password = (*obj)->password_func (s_8021x); /* Encrypt the unencrypted private key */ - enc_key = nm_utils_rsa_key_encrypt (blob, password, &generated_pw, error); + enc_key = nm_utils_rsa_key_encrypt (g_bytes_get_data (blob, NULL), g_bytes_get_size (blob), + password, &generated_pw, error); if (!enc_key) goto out; @@ -2580,9 +2575,10 @@ write_one_certificate (GConfClient *client, } } - success = write_object (client, dir, id, s_8021x, enc_key ? enc_key : blob, *obj, error); - if (enc_key) - g_byte_array_free (enc_key, TRUE); + enc_key_bytes = g_bytes_new (enc_key->data, enc_key->len); + success = write_object (client, dir, id, s_8021x, enc_key_bytes, *obj, error); + g_byte_array_free (enc_key, TRUE); + g_bytes_unref (enc_key_bytes); handled = TRUE; } diff --git a/src/gconf-helpers/gconf-helpers.h b/src/gconf-helpers/gconf-helpers.h index 2a1aca0c..7e6369e5 100644 --- a/src/gconf-helpers/gconf-helpers.h +++ b/src/gconf-helpers/gconf-helpers.h @@ -17,7 +17,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 2005 - 2010 Red Hat, Inc. + * Copyright 2005 - 2014 Red Hat, Inc. */ #ifndef GCONF_HELPERS_H @@ -25,7 +25,8 @@ #include <gconf/gconf-client.h> #include <glib.h> -#include <nm-connection.h> + +#include <NetworkManager.h> #include "utils.h" diff --git a/src/gconf-helpers/gconf-upgrade.c b/src/gconf-helpers/gconf-upgrade.c index f332bdbf..3ff680ef 100644 --- a/src/gconf-helpers/gconf-upgrade.c +++ b/src/gconf-helpers/gconf-upgrade.c @@ -17,7 +17,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 2005 - 2008 Red Hat, Inc. + * Copyright 2005 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -31,19 +31,11 @@ #include <arpa/inet.h> #include <gnome-keyring.h> -#include <nm-setting-connection.h> -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> -#include <nm-setting-8021x.h> -#include <nm-setting-vpn.h> -#include <nm-setting-ip4-config.h> -#include <nm-utils.h> +#include <NetworkManager.h> #include "gconf-upgrade.h" #include "gconf-helpers.h" -#include <nm-connection.h> - #define APPLET_PREFS_PATH "/apps/nm-applet" /* Old wireless.h defs */ @@ -569,7 +561,7 @@ nm_gconf_read_0_6_wireless_connection (GConfClient *client, } else s_wireless_sec = NULL; - connection = nm_connection_new (); + connection = nm_simple_connection_new (); nm_connection_add_setting (connection, (NMSetting *)s_con); nm_connection_add_setting (connection, (NMSetting *)s_wireless); if (s_wireless_sec) @@ -634,7 +626,7 @@ vpn_helpers_save_secret (const char *vpn_uuid, #define VPNC_OLD_GROUP_PASSWORD "group_password" static void -nm_gconf_0_6_vpnc_settings (NMSettingVPN *s_vpn, +nm_gconf_0_6_vpnc_settings (NMSettingVpn *s_vpn, GSList *vpn_data, const char *uuid, const char *id) @@ -695,7 +687,7 @@ nm_gconf_0_6_vpnc_settings (NMSettingVPN *s_vpn, } static void -nm_gconf_0_6_openvpn_settings (NMSettingVPN *s_vpn, GSList *vpn_data) +nm_gconf_0_6_openvpn_settings (NMSettingVpn *s_vpn, GSList *vpn_data) { GSList *iter; @@ -772,7 +764,7 @@ nm_gconf_read_0_6_vpn_connection (GConfClient *client, { NMConnection *connection; NMSettingConnection *s_con; - NMSettingVPN *s_vpn; + NMSettingVpn *s_vpn; NMSettingIP4Config *s_ip4 = NULL; char *path, *network, *id = NULL, *uuid = NULL, *service_name = NULL; GSList *str_routes = NULL, *vpn_data = NULL; @@ -806,7 +798,7 @@ nm_gconf_read_0_6_vpn_connection (GConfClient *client, uuid = nm_utils_uuid_generate (); g_object_set (s_con, NM_SETTING_CONNECTION_UUID, uuid, NULL); - s_vpn = (NMSettingVPN *)nm_setting_vpn_new (); + s_vpn = (NMSettingVpn *)nm_setting_vpn_new (); g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, service_name, NULL); if (!strcmp (service_name, NM_VPNC_SERVICE)) @@ -827,7 +819,7 @@ nm_gconf_read_0_6_vpn_connection (GConfClient *client, add_routes (s_ip4, str_routes); } - connection = nm_connection_new (); + connection = nm_simple_connection_new (); nm_connection_add_setting (connection, NM_SETTING (s_con)); nm_connection_add_setting (connection, NM_SETTING (s_vpn)); if (s_ip4) @@ -2024,7 +2016,7 @@ nm_gconf_migrate_0_7_certs (GConfClient *client) #define NM_VPNC_PW_TYPE_UNUSED "unused" static NMSettingSecretFlags -vpnc_type_to_flag (NMSettingVPN *s_vpn, const char *type_key) +vpnc_type_to_flag (NMSettingVpn *s_vpn, const char *type_key) { const char *tmp; @@ -2045,7 +2037,7 @@ vpnc_type_to_flag (NMSettingVPN *s_vpn, const char *type_key) #define NM_VPNC_KEY_XAUTH_PASSWORD_TYPE "xauth-password-type" static void -migrate_vpnc (NMConnection *connection, NMSettingVPN *s_vpn) +migrate_vpnc (NMConnection *connection, NMSettingVpn *s_vpn) { NMSettingSecretFlags flags; @@ -2095,7 +2087,7 @@ openvpn_get_secret_flags (const char *uuid, const char *secret_name) } static void -migrate_openvpn (NMConnection *connection, NMSettingVPN *s_vpn) +migrate_openvpn (NMConnection *connection, NMSettingVpn *s_vpn) { NMSettingSecretFlags flags; const char *tmp; @@ -2142,7 +2134,7 @@ migrate_openvpn (NMConnection *connection, NMSettingVPN *s_vpn) #define NM_OPENSWAN_PW_TYPE_UNUSED "unused" static NMSettingSecretFlags -openswan_type_to_flag (NMSettingVPN *s_vpn, const char *flags_key) +openswan_type_to_flag (NMSettingVpn *s_vpn, const char *flags_key) { const char *tmp; @@ -2163,7 +2155,7 @@ openswan_type_to_flag (NMSettingVPN *s_vpn, const char *flags_key) #define NM_OPENSWAN_XAUTH_PASSWORD_INPUT_MODES "xauthpasswordinputmodes" static void -migrate_openswan (NMConnection *connection, NMSettingVPN *s_vpn) +migrate_openswan (NMConnection *connection, NMSettingVpn *s_vpn) { NMSettingSecretFlags flags; @@ -2188,7 +2180,7 @@ migrate_openswan (NMConnection *connection, NMSettingVPN *s_vpn) static void migrate_datum_to_secret (const char *key, const char *value, gpointer user_data) { - NMSettingVPN *s_vpn = user_data; + NMSettingVpn *s_vpn = user_data; /* The xmlconfig "secret" is base64-encoded to escape it, although we were just storing it "raw" in GConf before. */ @@ -2207,13 +2199,13 @@ migrate_datum_to_secret (const char *key, const char *value, gpointer user_data) static void remove_old_data (const char *key, const char *value, gpointer user_data) { - NMSettingVPN *s_vpn = user_data; + NMSettingVpn *s_vpn = user_data; nm_setting_vpn_remove_data_item (s_vpn, key); } static void -migrate_openconnect (NMConnection *connection, NMSettingVPN *s_vpn) +migrate_openconnect (NMConnection *connection, NMSettingVpn *s_vpn) { NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NOT_SAVED; @@ -2264,7 +2256,7 @@ nm_gconf_migrate_09_secret_flags (GConfClient *client, /* Migrate various VPN secret flags */ if (NM_IS_SETTING_VPN (setting)) { - NMSettingVPN *s_vpn = NM_SETTING_VPN (setting); + NMSettingVpn *s_vpn = NM_SETTING_VPN (setting); const char *service; service = nm_setting_vpn_get_service_type (s_vpn); diff --git a/src/gconf-helpers/gconf-upgrade.h b/src/gconf-helpers/gconf-upgrade.h index e5710586..3b7b9bf1 100644 --- a/src/gconf-helpers/gconf-upgrade.h +++ b/src/gconf-helpers/gconf-upgrade.h @@ -16,7 +16,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 2005 Red Hat, Inc. + * Copyright 2005 Red Hat, Inc. */ #ifndef GCONF_UPGRADE_H @@ -24,6 +24,8 @@ #include <gconf/gconf-client.h> +#include <NetworkManager.h> + void nm_gconf_migrate_0_6_connections (GConfClient *client); void nm_gconf_migrate_0_7_wireless_security (GConfClient *client); diff --git a/src/gconf-helpers/tests/test-upgrade.c b/src/gconf-helpers/tests/test-upgrade.c index 67d9cefc..9f36519e 100644 --- a/src/gconf-helpers/tests/test-upgrade.c +++ b/src/gconf-helpers/tests/test-upgrade.c @@ -17,15 +17,14 @@ * 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 Red Hat, Inc. + * Copyright 2011 - 2014 Red Hat, Inc. */ #include <glib.h> #include <string.h> #include <gnome-keyring.h> -#include <nm-setting-wireless-security.h> -#include <nm-setting-vpn.h> +#include <NetworkManager.h> #include "gconf-helpers.h" #include "fake-gconf.h" @@ -313,7 +312,7 @@ test_upgrade_08_wifi (void) static void upgrade_08_vpnc_cb (NMConnection *connection, gpointer user_data) { - NMSettingVPN *s_vpn; + NMSettingVpn *s_vpn; NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE; gboolean success; @@ -383,7 +382,7 @@ test_upgrade_08_vpnc (void) static void upgrade_08_openvpn_saved_cb (NMConnection *connection, gpointer user_data) { - NMSettingVPN *s_vpn; + NMSettingVpn *s_vpn; NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE; gboolean success; @@ -455,7 +454,7 @@ test_upgrade_08_openvpn_saved (void) static void upgrade_08_openvpn_not_saved_cb (NMConnection *connection, gpointer user_data) { - NMSettingVPN *s_vpn; + NMSettingVpn *s_vpn; NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE; gboolean success; diff --git a/src/gnome-bluetooth/nma-bt-device.c b/src/gnome-bluetooth/nma-bt-device.c index 3a33dcef..a2f4cd6b 100644 --- a/src/gnome-bluetooth/nma-bt-device.c +++ b/src/gnome-bluetooth/nma-bt-device.c @@ -19,7 +19,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * (C) Copyright 2009 - 2012 Red Hat, Inc. + * Copyright 2009 - 2014 Red Hat, Inc. * */ @@ -34,8 +34,7 @@ #include <glib.h> #include <glib/gi18n-lib.h> -#include <nm-remote-settings.h> -#include <nm-remote-connection.h> +#include <NetworkManager.h> #include "nma-bt-device.h" #include "nma-marshal.h" diff --git a/src/libnm-gtk/libnm-gtk.pc.in b/src/libnm-gtk/libnm-gtk.pc.in index 88a222fd..d6664d71 100644 --- a/src/libnm-gtk/libnm-gtk.pc.in +++ b/src/libnm-gtk/libnm-gtk.pc.in @@ -7,7 +7,7 @@ nmversion=0.8.998 Name: libnm-gtk Description: NetworkManager Gtk+ dialogs Version: @PACKAGE_VERSION@ -Requires: NetworkManager >= ${nmversion} libnm-util >= ${nmversion} libnm-glib >= ${nmversion} gtk+-3.0 >= 2.91.4 +Requires: NetworkManager >= ${nmversion} libnm >= ${nmversion} gtk+-3.0 >= 2.91.4 Requires.private: dbus-glib-1 Cflags: -I${includedir}/libnm-gtk -Libs: -L${libdir} -lnm-gtk
\ No newline at end of file +Libs: -L${libdir} -lnm-gtk diff --git a/src/libnm-gtk/nm-mobile-wizard.c b/src/libnm-gtk/nm-mobile-wizard.c index d552ff1e..562fe536 100644 --- a/src/libnm-gtk/nm-mobile-wizard.c +++ b/src/libnm-gtk/nm-mobile-wizard.c @@ -1304,7 +1304,7 @@ intro_remove_all_devices (NMAMobileWizard *self) static void intro_manager_running_cb (NMClient *client, GParamSpec *pspec, NMAMobileWizard *self) { - if (nm_client_get_manager_running (client)) + if (nm_client_get_nm_running (client)) intro_add_initial_devices (self); else intro_remove_all_devices (self); @@ -1396,7 +1396,7 @@ intro_setup (NMAMobileWizard *self) if (!self->initial_family) { GtkTreeIter iter; - self->client = nm_client_new (); + self->client = nm_client_new (NULL, NULL); if (self->client) { g_signal_connect (self->client, "device-added", G_CALLBACK (intro_device_added_cb), self); diff --git a/src/libnm-gtk/nm-ui-utils.c b/src/libnm-gtk/nm-ui-utils.c index 69ede41e..dbc99a0e 100644 --- a/src/libnm-gtk/nm-ui-utils.c +++ b/src/libnm-gtk/nm-ui-utils.c @@ -15,7 +15,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 2007 - 2012 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -27,8 +27,6 @@ #include <glib/gi18n.h> #include <gudev/gudev.h> -#include <nm-device.h> - #include "nm-ui-utils.h" static char *ignored_words[] = { @@ -551,7 +549,7 @@ nma_utils_get_connection_device_name (NMConnection *connection) const char *iface, *type, *display_type; NMSettingConnection *s_con; - iface = nm_connection_get_virtual_iface_name (connection); + iface = nm_connection_get_interface_name (connection); g_return_val_if_fail (iface != NULL, NULL); s_con = nm_connection_get_setting_connection (connection); diff --git a/src/libnm-gtk/nm-ui-utils.h b/src/libnm-gtk/nm-ui-utils.h index 693df441..73519a22 100644 --- a/src/libnm-gtk/nm-ui-utils.h +++ b/src/libnm-gtk/nm-ui-utils.h @@ -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 2007 - 2012 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ @@ -25,7 +25,7 @@ #ifndef NMA_UI_UTILS_H #define NMA_UI_UTILS_H -#include <nm-device.h> +#include <NetworkManager.h> const char *nma_utils_get_device_vendor (NMDevice *device); const char *nma_utils_get_device_product (NMDevice *device); diff --git a/src/libnm-gtk/nm-wifi-dialog.c b/src/libnm-gtk/nm-wifi-dialog.c index ace323bc..03f7d2f1 100644 --- a/src/libnm-gtk/nm-wifi-dialog.c +++ b/src/libnm-gtk/nm-wifi-dialog.c @@ -17,7 +17,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 2007 - 2012 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include <config.h> @@ -28,12 +28,7 @@ #include <gtk/gtk.h> #include <netinet/ether.h> -#include <nm-client.h> -#include <nm-utils.h> -#include <nm-device-wifi.h> -#include <nm-setting-connection.h> -#include <nm-setting-wireless.h> -#include <nm-setting-ip4-config.h> +#include <NetworkManager.h> #include "nm-wifi-dialog.h" #include "wireless-security.h" @@ -219,14 +214,13 @@ security_combo_changed_manually (GtkWidget *combo, security_combo_changed (combo, user_data); } -static GByteArray * +static GBytes * validate_dialog_ssid (NMAWifiDialog *self) { NMAWifiDialogPrivate *priv = NMA_WIFI_DIALOG_GET_PRIVATE (self); GtkWidget *widget; const char *ssid; - guint32 ssid_len; - GByteArray *ssid_ba; + GBytes *ssid_bytes; widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "network_name_entry")); @@ -235,10 +229,8 @@ validate_dialog_ssid (NMAWifiDialog *self) if (!ssid || strlen (ssid) == 0 || strlen (ssid) > 32) return NULL; - ssid_len = strlen (ssid); - ssid_ba = g_byte_array_sized_new (ssid_len); - g_byte_array_append (ssid_ba, (unsigned char *) ssid, ssid_len); - return ssid_ba; + ssid_bytes = g_bytes_new (ssid, strlen (ssid)); + return ssid_bytes; } static void @@ -246,7 +238,7 @@ stuff_changed_cb (WirelessSecurity *sec, gpointer user_data) { NMAWifiDialog *self = NMA_WIFI_DIALOG (user_data); NMAWifiDialogPrivate *priv = NMA_WIFI_DIALOG_GET_PRIVATE (self); - GByteArray *ssid = NULL; + GBytes *ssid = NULL; gboolean free_ssid = TRUE; gboolean valid = FALSE; @@ -254,7 +246,7 @@ stuff_changed_cb (WirelessSecurity *sec, gpointer user_data) NMSettingWireless *s_wireless; s_wireless = nm_connection_get_setting_wireless (priv->connection); g_assert (s_wireless); - ssid = (GByteArray *) nm_setting_wireless_get_ssid (s_wireless); + ssid = nm_setting_wireless_get_ssid (s_wireless); free_ssid = FALSE; } else { ssid = validate_dialog_ssid (self); @@ -263,7 +255,7 @@ stuff_changed_cb (WirelessSecurity *sec, gpointer user_data) if (ssid) { valid = wireless_security_validate (sec, ssid); if (free_ssid) - g_byte_array_free (ssid, TRUE); + g_bytes_unref (ssid); } /* But if there's an in-progress secrets call (which might require authorization) @@ -285,7 +277,7 @@ ssid_entry_changed (GtkWidget *entry, gpointer user_data) WirelessSecurity *sec = NULL; GtkTreeModel *model; gboolean valid = FALSE; - GByteArray *ssid; + GBytes *ssid; /* If the network name entry was touched at all, allow focus to go to * the default widget of the security method now. @@ -356,11 +348,11 @@ connection_combo_changed (GtkWidget *combo, widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "network_name_entry")); if (priv->connection) { - const GByteArray *ssid; + GBytes *ssid; s_wireless = nm_connection_get_setting_wireless (priv->connection); ssid = nm_setting_wireless_get_ssid (s_wireless); - utf8_ssid = nm_utils_ssid_to_utf8 (ssid); + utf8_ssid = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid)); gtk_entry_set_text (GTK_ENTRY (widget), utf8_ssid); g_free (utf8_ssid); } else { @@ -450,7 +442,7 @@ connection_combo_init (NMAWifiDialog *self, NMConnection *connection) NMSettingWireless *s_wireless; const char *connection_type; const char *mode; - const GByteArray *setting_mac; + const char *setting_mac, *hw_addr; s_con = nm_connection_get_setting_connection (candidate); connection_type = s_con ? nm_setting_connection_get_connection_type (s_con) : NULL; @@ -484,18 +476,11 @@ connection_combo_init (NMAWifiDialog *self, NMConnection *connection) /* Ignore connections that don't apply to the selected device */ setting_mac = nm_setting_wireless_get_mac_address (s_wireless); - if (setting_mac) { - const char *hw_addr; - - hw_addr = nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (priv->device)); - if (hw_addr) { - struct ether_addr *ether; - - ether = ether_aton (hw_addr); - if (ether && memcmp (setting_mac->data, ether->ether_addr_octet, ETH_ALEN)) - continue; - } - } + hw_addr = nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (priv->device)); + if ( setting_mac + && hw_addr + && !nm_utils_hwaddr_matches (setting_mac, -1, hw_addr, -1)) + continue; to_add = g_slist_append (to_add, candidate); } @@ -1125,12 +1110,12 @@ internal_init (NMAWifiDialog *self, char *tmp; char *esc_ssid = NULL; NMSettingWireless *s_wireless; - const GByteArray *ssid; + GBytes *ssid; s_wireless = nm_connection_get_setting_wireless (priv->connection); ssid = s_wireless ? nm_setting_wireless_get_ssid (s_wireless) : NULL; if (ssid) - esc_ssid = nm_utils_ssid_to_utf8 (ssid); + esc_ssid = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid)); tmp = g_strdup_printf (_("Passwords or encryption keys are required to access the Wi-Fi network '%s'."), esc_ssid ? esc_ssid : "<unknown>"); @@ -1194,7 +1179,7 @@ nma_wifi_dialog_get_connection (NMAWifiDialog *self, NMSettingConnection *s_con; char *uuid; - connection = nm_connection_new (); + connection = nm_simple_connection_new (); s_con = (NMSettingConnection *) nm_setting_connection_new (); uuid = nm_utils_uuid_generate (); diff --git a/src/libnm-gtk/nm-wifi-dialog.h b/src/libnm-gtk/nm-wifi-dialog.h index eb837c20..8a96ca2a 100644 --- a/src/libnm-gtk/nm-wifi-dialog.h +++ b/src/libnm-gtk/nm-wifi-dialog.h @@ -16,7 +16,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 2007 - 2012 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ @@ -31,11 +31,7 @@ #include <glib.h> #include <glib-object.h> -#include <nm-client.h> -#include <nm-connection.h> -#include <nm-device.h> -#include <nm-access-point.h> -#include <nm-remote-settings.h> +#include <NetworkManager.h> #define NMA_TYPE_WIFI_DIALOG (nma_wifi_dialog_get_type ()) #define NMA_WIFI_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_WIFI_DIALOG, NMAWifiDialog)) diff --git a/src/libnm-gtk/nm-wireless-dialog.c b/src/libnm-gtk/nm-wireless-dialog.c index efa2a3ab..05a5aafe 100644 --- a/src/libnm-gtk/nm-wireless-dialog.c +++ b/src/libnm-gtk/nm-wireless-dialog.c @@ -17,13 +17,11 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2012 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include <config.h> -#include <nm-client.h> - #include "nm-wireless-dialog.h" #include "nm-wifi-dialog.h" diff --git a/src/libnm-gtk/nm-wireless-dialog.h b/src/libnm-gtk/nm-wireless-dialog.h index 7c481663..9c6c2d94 100644 --- a/src/libnm-gtk/nm-wireless-dialog.h +++ b/src/libnm-gtk/nm-wireless-dialog.h @@ -16,7 +16,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 2007 - 2012 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ @@ -31,11 +31,7 @@ #include <glib.h> #include <glib-object.h> -#include <nm-connection.h> -#include <nm-device.h> -#include <nm-access-point.h> -#include <nm-remote-settings.h> -#include <nm-wireless-dialog.h> +#include <NetworkManager.h> #define NMA_TYPE_WIRELESS_DIALOG (nma_wireless_dialog_get_type ()) #define NMA_WIRELESS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_WIRELESS_DIALOG, NMAWirelessDialog)) diff --git a/src/migration-tool.c b/src/migration-tool.c index f7e44ad6..22644bd6 100644 --- a/src/migration-tool.c +++ b/src/migration-tool.c @@ -15,7 +15,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2005-2012 Red Hat, Inc. + * Copyright 2005 - 2014 Red Hat, Inc. */ #ifdef HAVE_CONFIG_H @@ -25,9 +25,6 @@ #include <libintl.h> #include <stdlib.h> -#include <nm-remote-connection.h> -#include <nm-remote-settings.h> - #include "gconf-helpers.h" gboolean success = TRUE; @@ -65,7 +62,6 @@ import_cb (NMConnection *connection, gpointer user_data) int main (int argc, char **argv) { - DBusGConnection *bus; NMRemoteSettings *settings; GError *error = NULL; @@ -80,18 +76,16 @@ main (int argc, char **argv) exit (1); } - bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); - if (!bus) { - g_printerr ("Could not get system bus: %s\n", error->message); + settings = nm_remote_settings_new (NULL, &error); + if (!settings) { + g_printerr ("Failed to create remote settings: %s", error->message); g_error_free (error); exit (1); } - settings = nm_remote_settings_new (bus); nm_gconf_move_connections_to_system (import_cb, settings); g_object_unref (settings); - dbus_g_connection_unref (bus); return success ? 0 : 1; } diff --git a/src/mobile-helpers.c b/src/mobile-helpers.c index b8f8d5cc..4f003e3f 100644 --- a/src/mobile-helpers.c +++ b/src/mobile-helpers.c @@ -17,12 +17,11 @@ * 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. + * Copyright 2010 - 2014 Red Hat, Inc. */ #include <ctype.h> #include <glib/gi18n.h> -#include <nm-utils.h> #define SECRET_API_SUBJECT_TO_CHANGE #include <libsecret/secret.h> @@ -163,7 +162,7 @@ mobile_wizard_done (NMAMobileWizard *wizard, goto done; } - connection = nm_connection_new (); + connection = nm_simple_connection_new (); if (method->devtype == NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO) { setting_name = NM_SETTING_CDMA_SETTING_NAME; diff --git a/src/utils/tests/test-utils.c b/src/utils/tests/test-utils.c index 68d64726..dd21ea1d 100644 --- a/src/utils/tests/test-utils.c +++ b/src/utils/tests/test-utils.c @@ -49,16 +49,15 @@ typedef struct { char *asdf11_adhoc_wpa_rsn; } TestData; -static GByteArray * +static GBytes * string_to_ssid (const char *str) { - GByteArray *ssid; + GBytes *ssid; g_assert (str != NULL); - ssid = g_byte_array_sized_new (strlen (str)); + ssid = g_bytes_new (str, strlen (str)); g_assert (ssid != NULL); - g_byte_array_append (ssid, (const guint8 *) str, strlen (str)); return ssid; } @@ -69,7 +68,7 @@ make_hash (const char *str, guint32 wpa_flags, guint32 rsn_flags) { - GByteArray *ssid; + GBytes *ssid; char *hash, *hash2; ssid = string_to_ssid (str); @@ -83,7 +82,7 @@ make_hash (const char *str, /* Make sure they are the same each time */ g_assert (!strcmp (hash, hash2)); - g_byte_array_free (ssid, TRUE); + g_bytes_unref (ssid); return hash; } diff --git a/src/utils/utils.c b/src/utils/utils.c index 269abe37..665a3820 100644 --- a/src/utils/utils.c +++ b/src/utils/utils.c @@ -17,7 +17,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 2007 - 2011 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include <config.h> @@ -27,9 +27,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-setting-connection.h> -#include <nm-utils.h> - #include "utils.h" /* @@ -68,7 +65,7 @@ utils_ether_addr_valid (const struct ether_addr *test_addr) } char * -utils_hash_ap (const GByteArray *ssid, +utils_hash_ap (GBytes *ssid, NM80211Mode mode, guint32 flags, guint32 wpa_flags, @@ -79,7 +76,7 @@ utils_hash_ap (const GByteArray *ssid, memset (&input[0], 0, sizeof (input)); if (ssid) - memcpy (input, ssid->data, ssid->len); + memcpy (input, g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid)); if (mode == NM_802_11_MODE_INFRA) input[32] |= (1 << 0); diff --git a/src/utils/utils.h b/src/utils/utils.h index 3cd04087..d77a6de8 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -17,7 +17,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 2007 - 2012 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifndef UTILS_H @@ -25,10 +25,10 @@ #include <glib.h> #include <gtk/gtk.h> -#include <nm-connection.h> -#include <nm-device.h> + #include <net/ethernet.h> -#include <nm-access-point.h> + +#include <NetworkManager.h> guint32 utils_freq_to_channel (guint32 freq); guint32 utils_channel_to_freq (guint32 channel, char *band); @@ -36,7 +36,7 @@ guint32 utils_find_next_channel (guint32 channel, int direction, char *band); gboolean utils_ether_addr_valid (const struct ether_addr *test_addr); -char *utils_hash_ap (const GByteArray *ssid, +char *utils_hash_ap (GBytes *ssid, NM80211Mode mode, guint32 flags, guint32 wpa_flags, diff --git a/src/wireless-security/eap-method-fast.c b/src/wireless-security/eap-method-fast.c index 47f3d70b..1071e767 100644 --- a/src/wireless-security/eap-method-fast.c +++ b/src/wireless-security/eap-method-fast.c @@ -17,7 +17,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 2012 Red Hat, Inc. + * Copyright 2012 - 2014 Red Hat, Inc. */ #include "config.h" @@ -26,9 +26,6 @@ #include <ctype.h> #include <string.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> - #include "eap-method.h" #include "wireless-security.h" diff --git a/src/wireless-security/eap-method-leap.c b/src/wireless-security/eap-method-leap.c index 3f0b4462..e446409f 100644 --- a/src/wireless-security/eap-method-leap.c +++ b/src/wireless-security/eap-method-leap.c @@ -17,12 +17,11 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include <ctype.h> #include <string.h> -#include <nm-setting-8021x.h> #include "eap-method.h" #include "wireless-security.h" diff --git a/src/wireless-security/eap-method-peap.c b/src/wireless-security/eap-method-peap.c index d4fa7dbb..623f854b 100644 --- a/src/wireless-security/eap-method-peap.c +++ b/src/wireless-security/eap-method-peap.c @@ -17,7 +17,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 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include "config.h" @@ -26,9 +26,6 @@ #include <ctype.h> #include <string.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> - #include "eap-method.h" #include "wireless-security.h" diff --git a/src/wireless-security/eap-method-simple.c b/src/wireless-security/eap-method-simple.c index 427bb9ff..6cd37651 100644 --- a/src/wireless-security/eap-method-simple.c +++ b/src/wireless-security/eap-method-simple.c @@ -17,13 +17,11 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include <ctype.h> #include <string.h> -#include <nm-setting-8021x.h> -#include <nm-setting-connection.h> #include "eap-method.h" #include "wireless-security.h" diff --git a/src/wireless-security/eap-method-tls.c b/src/wireless-security/eap-method-tls.c index 6daa8f8b..5e843582 100644 --- a/src/wireless-security/eap-method-tls.c +++ b/src/wireless-security/eap-method-tls.c @@ -17,7 +17,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 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include "config.h" @@ -26,9 +26,6 @@ #include <ctype.h> #include <string.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> - #include "eap-method.h" #include "wireless-security.h" #include "helpers.h" diff --git a/src/wireless-security/eap-method-ttls.c b/src/wireless-security/eap-method-ttls.c index 294734d6..d0043730 100644 --- a/src/wireless-security/eap-method-ttls.c +++ b/src/wireless-security/eap-method-ttls.c @@ -17,7 +17,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 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include "config.h" @@ -26,9 +26,6 @@ #include <ctype.h> #include <string.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> - #include "eap-method.h" #include "wireless-security.h" diff --git a/src/wireless-security/eap-method.c b/src/wireless-security/eap-method.c index 1adc2b5e..2449031b 100644 --- a/src/wireless-security/eap-method.c +++ b/src/wireless-security/eap-method.c @@ -18,7 +18,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 2007 - 2012 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include "config.h" @@ -32,8 +32,6 @@ #include <fcntl.h> #include <unistd.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> #include "eap-method.h" #include "nm-utils.h" diff --git a/src/wireless-security/eap-method.h b/src/wireless-security/eap-method.h index cf02081e..f1c3ba3b 100644 --- a/src/wireless-security/eap-method.h +++ b/src/wireless-security/eap-method.h @@ -17,7 +17,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 2007 - 2012 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifndef EAP_METHOD_H @@ -26,8 +26,7 @@ #include <glib.h> #include <gtk/gtk.h> -#include <nm-connection.h> -#include <nm-setting-8021x.h> +#include <NetworkManager.h> typedef struct _EAPMethod EAPMethod; diff --git a/src/wireless-security/helpers.c b/src/wireless-security/helpers.c index 5d7941d1..b972dc01 100644 --- a/src/wireless-security/helpers.c +++ b/src/wireless-security/helpers.c @@ -17,7 +17,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 2009 Red Hat, Inc. + * Copyright 2009 - 2014 Red Hat, Inc. */ #include "helpers.h" diff --git a/src/wireless-security/helpers.h b/src/wireless-security/helpers.h index 75c01ea5..c13beee7 100644 --- a/src/wireless-security/helpers.h +++ b/src/wireless-security/helpers.h @@ -17,7 +17,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 2009 Red Hat, Inc. + * Copyright 2009 - 2014 Red Hat, Inc. */ #ifndef _HELPERS_H_ @@ -25,8 +25,8 @@ #include <glib.h> #include <gtk/gtk.h> -#include <nm-connection.h> -#include <nm-setting.h> + +#include <NetworkManager.h> typedef const char * (*HelperSecretFunc)(NMSetting *); diff --git a/src/wireless-security/wireless-security.c b/src/wireless-security/wireless-security.c index 7e009d54..406590e7 100644 --- a/src/wireless-security/wireless-security.c +++ b/src/wireless-security/wireless-security.c @@ -17,7 +17,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 2007 - 2012 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include "config.h" @@ -28,12 +28,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <nm-setting-connection.h> -#include <nm-setting-wired.h> -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> -#include <nm-setting-8021x.h> - #include "wireless-security.h" #include "eap-method.h" @@ -68,7 +62,7 @@ wireless_security_changed_cb (GtkWidget *ignored, gpointer user_data) } gboolean -wireless_security_validate (WirelessSecurity *sec, const GByteArray *ssid) +wireless_security_validate (WirelessSecurity *sec, GBytes *ssid) { g_return_val_if_fail (sec != NULL, FALSE); diff --git a/src/wireless-security/wireless-security.h b/src/wireless-security/wireless-security.h index 4a1a4fe8..3575934e 100644 --- a/src/wireless-security/wireless-security.h +++ b/src/wireless-security/wireless-security.h @@ -17,7 +17,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 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifndef WIRELESS_SECURITY_H @@ -26,7 +26,7 @@ #include <glib.h> #include <gtk/gtk.h> -#include <nm-connection.h> +#include <NetworkManager.h> typedef struct _WirelessSecurity WirelessSecurity; @@ -36,7 +36,7 @@ typedef void (*WSAddToSizeGroupFunc) (WirelessSecurity *sec, GtkSizeGroup *group typedef void (*WSFillConnectionFunc) (WirelessSecurity *sec, NMConnection *connection); typedef void (*WSUpdateSecretsFunc) (WirelessSecurity *sec, NMConnection *connection); typedef void (*WSDestroyFunc) (WirelessSecurity *sec); -typedef gboolean (*WSValidateFunc) (WirelessSecurity *sec, const GByteArray *ssid); +typedef gboolean (*WSValidateFunc) (WirelessSecurity *sec, GBytes *ssid); typedef GtkWidget * (*WSNagUserFunc) (WirelessSecurity *sec); struct _WirelessSecurity { @@ -68,7 +68,7 @@ void wireless_security_set_changed_notify (WirelessSecurity *sec, WSChangedFunc func, gpointer user_data); -gboolean wireless_security_validate (WirelessSecurity *sec, const GByteArray *ssid); +gboolean wireless_security_validate (WirelessSecurity *sec, GBytes *ssid); void wireless_security_add_to_size_group (WirelessSecurity *sec, GtkSizeGroup *group); diff --git a/src/wireless-security/ws-dynamic-wep.c b/src/wireless-security/ws-dynamic-wep.c index e7c85fa7..c9fce3a4 100644 --- a/src/wireless-security/ws-dynamic-wep.c +++ b/src/wireless-security/ws-dynamic-wep.c @@ -17,13 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include <glib/gi18n.h> #include <ctype.h> #include <string.h> -#include <nm-setting-wireless.h> #include "wireless-security.h" #include "eap-method.h" @@ -44,7 +43,7 @@ destroy (WirelessSecurity *parent) } static gboolean -validate (WirelessSecurity *parent, const GByteArray *ssid) +validate (WirelessSecurity *parent, GBytes *ssid) { return ws_802_1x_validate (parent, "dynamic_wep_auth_combo"); } diff --git a/src/wireless-security/ws-dynamic-wep.h b/src/wireless-security/ws-dynamic-wep.h index 54979f47..2b6722fe 100644 --- a/src/wireless-security/ws-dynamic-wep.h +++ b/src/wireless-security/ws-dynamic-wep.h @@ -17,13 +17,13 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifndef WS_DYNAMIC_WEP_H #define WS_DYNAMIC_WEP_H -#include <nm-connection.h> +#include <NetworkManager.h> typedef struct _WirelessSecurityDynamicWEP WirelessSecurityDynamicWEP; diff --git a/src/wireless-security/ws-leap.c b/src/wireless-security/ws-leap.c index bfb913f0..c338b3dd 100644 --- a/src/wireless-security/ws-leap.c +++ b/src/wireless-security/ws-leap.c @@ -17,11 +17,10 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include <string.h> -#include <nm-setting-wireless.h> #include "wireless-security.h" #include "helpers.h" @@ -47,7 +46,7 @@ show_toggled_cb (GtkCheckButton *button, WirelessSecurity *sec) } static gboolean -validate (WirelessSecurity *parent, const GByteArray *ssid) +validate (WirelessSecurity *parent, GBytes *ssid) { GtkWidget *entry; const char *text; diff --git a/src/wireless-security/ws-leap.h b/src/wireless-security/ws-leap.h index 6f1d7050..6aa3c460 100644 --- a/src/wireless-security/ws-leap.h +++ b/src/wireless-security/ws-leap.h @@ -17,13 +17,13 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifndef WS_LEAP_H #define WS_LEAP_H -#include <nm-connection.h> +#include <NetworkManager.h> typedef struct _WirelessSecurityLEAP WirelessSecurityLEAP; diff --git a/src/wireless-security/ws-wep-key.c b/src/wireless-security/ws-wep-key.c index f2ac042e..64d302f4 100644 --- a/src/wireless-security/ws-wep-key.c +++ b/src/wireless-security/ws-wep-key.c @@ -17,15 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include <string.h> #include <glib.h> -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> - #include "wireless-security.h" #include "utils.h" @@ -91,7 +88,7 @@ destroy (WirelessSecurity *parent) } static gboolean -validate (WirelessSecurity *parent, const GByteArray *ssid) +validate (WirelessSecurity *parent, GBytes *ssid) { WirelessSecurityWEPKey *sec = (WirelessSecurityWEPKey *) parent; GtkWidget *entry; diff --git a/src/wireless-security/ws-wep-key.h b/src/wireless-security/ws-wep-key.h index fdd70da0..9bd151d4 100644 --- a/src/wireless-security/ws-wep-key.h +++ b/src/wireless-security/ws-wep-key.h @@ -17,13 +17,13 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifndef WS_WEP_KEY_H #define WS_WEP_KEY_H -#include <nm-setting-wireless-security.h> +#include <NetworkManager.h> typedef struct _WirelessSecurityWEPKey WirelessSecurityWEPKey; diff --git a/src/wireless-security/ws-wpa-eap.c b/src/wireless-security/ws-wpa-eap.c index 6b911c16..9b2bdd20 100644 --- a/src/wireless-security/ws-wpa-eap.c +++ b/src/wireless-security/ws-wpa-eap.c @@ -17,13 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include <glib/gi18n.h> #include <ctype.h> #include <string.h> -#include <nm-setting-wireless.h> #include "wireless-security.h" #include "eap-method.h" @@ -45,7 +44,7 @@ destroy (WirelessSecurity *parent) } static gboolean -validate (WirelessSecurity *parent, const GByteArray *ssid) +validate (WirelessSecurity *parent, GBytes *ssid) { return ws_802_1x_validate (parent, "wpa_eap_auth_combo"); } diff --git a/src/wireless-security/ws-wpa-eap.h b/src/wireless-security/ws-wpa-eap.h index 5c8faeab..be490451 100644 --- a/src/wireless-security/ws-wpa-eap.h +++ b/src/wireless-security/ws-wpa-eap.h @@ -17,13 +17,13 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifndef WS_WPA_EAP_H #define WS_WPA_EAP_H -#include <nm-connection.h> +#include <NetworkManager.h> typedef struct _WirelessSecurityWPAEAP WirelessSecurityWPAEAP; diff --git a/src/wireless-security/ws-wpa-psk.c b/src/wireless-security/ws-wpa-psk.c index aa50c9cf..dadab037 100644 --- a/src/wireless-security/ws-wpa-psk.c +++ b/src/wireless-security/ws-wpa-psk.c @@ -17,12 +17,11 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #include <ctype.h> #include <string.h> -#include <nm-setting-wireless.h> #include "wireless-security.h" #include "helpers.h" @@ -51,7 +50,7 @@ show_toggled_cb (GtkCheckButton *button, WirelessSecurity *sec) } static gboolean -validate (WirelessSecurity *parent, const GByteArray *ssid) +validate (WirelessSecurity *parent, GBytes *ssid) { GtkWidget *entry; const char *key; diff --git a/src/wireless-security/ws-wpa-psk.h b/src/wireless-security/ws-wpa-psk.h index a89552fb..28e64e28 100644 --- a/src/wireless-security/ws-wpa-psk.h +++ b/src/wireless-security/ws-wpa-psk.h @@ -17,12 +17,14 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2010 Red Hat, Inc. + * Copyright 2007 - 2014 Red Hat, Inc. */ #ifndef WS_WPA_PSK_H #define WS_WPA_PSK_H +#include <NetworkManager.h> + typedef struct _WirelessSecurityWPAPSK WirelessSecurityWPAPSK; WirelessSecurityWPAPSK * ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only); |