diff options
author | Dan Williams <dcbw@redhat.com> | 2014-09-11 14:33:03 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-09-11 15:03:38 -0500 |
commit | 312bd38557a94a39b60b81e89c974e69fdfdb5c5 (patch) | |
tree | d1bf90423fe18f6e11181d759db3686101968661 | |
parent | 1a1606b82cf7250aef41d4124e116a27cad75a5d (diff) | |
download | network-manager-applet-dcbw/applet-libnm.tar.gz |
start porting to libnmdcbw/applet-libnm
36 files changed, 139 insertions, 209 deletions
diff --git a/configure.ac b/configure.ac index d6ca9e6f..406faecb 100644 --- a/configure.ac +++ b/configure.ac @@ -72,12 +72,9 @@ fi PKG_CHECK_MODULES(GOBJECT, gobject-2.0) 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 + [gio-2.0 >= 2.32 + NetworkManager >= 0.9.11 + libnm >= 0.9.11 gmodule-export-2.0]) NMA_CFLAGS="$NMA_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32" @@ -140,7 +137,6 @@ 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, have_gbt=yes, have_gbt=no) ;; esac diff --git a/src/Makefile.am b/src/Makefile.am index d8c12380..39c58101 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = marshallers utils wireless-security libnm-gtk connection-editor gnome-bluetooth +SUBDIRS = marshallers utils wireless-security libnm-gtk # connection-editor gnome-bluetooth bin_PROGRAMS = nm-applet diff --git a/src/applet-agent.h b/src/applet-agent.h index 2e1be3e9..e42a24fb 100644 --- a/src/applet-agent.h +++ b/src/applet-agent.h @@ -39,7 +39,7 @@ typedef struct { } AppletAgent; typedef void (*AppletAgentSecretsCallback) (AppletAgent *self, - GHashTable *secrets, + GVariant *dict, GError *error, gpointer user_data); diff --git a/src/applet.c b/src/applet.c index 81e2ac52..7020283a 100644 --- a/src/applet.c +++ b/src/applet.c @@ -41,33 +41,8 @@ #include <stdlib.h> #include <gio/gio.h> -#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 <NetworkManager.h> #include <libnotify/notify.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"); @@ -2655,10 +2630,14 @@ static void foo_client_setup (NMApplet *applet) { NMClientPermission perm; + GError *error = NULL; - applet->nm_client = nm_client_new (); - if (!applet->nm_client) + applet->nm_client = nm_client_new (NULL, &error); + if (!applet->nm_client) { + g_warning ("Failed to connect to NetworkManager: %s", error->message); + g_clear_error (&error); return; + } g_signal_connect (applet->nm_client, "notify::state", G_CALLBACK (foo_client_state_changed_cb), @@ -2682,7 +2661,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 +2850,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 +2903,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 */ @@ -3067,10 +3046,10 @@ applet_secrets_request_set_free_func (SecretsRequest *req, void applet_secrets_request_complete (SecretsRequest *req, - GHashTable *settings, + GVariant *secrets, GError *error) { - req->callback (req->applet->agent, error ? NULL : settings, error, req->callback_data); + req->callback (req->applet->agent, error ? NULL : secrets, error, req->callback_data); } void @@ -3079,38 +3058,39 @@ applet_secrets_request_complete_setting (SecretsRequest *req, GError *error) { NMSetting *setting; - GHashTable *settings = NULL, *secrets; - - 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 { - 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__, setting_name); - } - } else { - g_set_error (&error, - NM_SECRET_AGENT_ERROR, - NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, - "%s.%d (%s): unhandled setting '%s'", - __FILE__, __LINE__, __func__, setting_name); - } + GVariant *dict = NULL; + GError *local = NULL; + + if (!setting_name || error) + goto done; + + setting = nm_connection_get_setting_by_name (req->connection, setting_name); + if (!setting) { + g_set_error (&error, + NM_SECRET_AGENT_ERROR, + NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, + "%s.%d (%s): unhandled setting '%s'", + __FILE__, __LINE__, __func__, setting_name); + goto done; + } + + dict = nm_connection_to_dbus (req->connection, NM_CONNECTION_SERIALIZE_ONLY_SECRETS); + if (!g_variant_lookup_value (dict, setting_name, NM_VARIANT_TYPE_SETTING)) { + 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__, setting_name); + goto done; } - req->callback (req->applet->agent, settings, error, req->callback_data); +done: + req->callback (req->applet->agent, + (error || local) ? NULL : dict, + error ? error : local, + req->callback_data); + g_clear_pointer (&dict, g_variant_unref); + g_clear_error (&local); } void @@ -3133,7 +3113,7 @@ applet_secrets_request_free (SecretsRequest *req) static void get_existing_secrets_cb (NMSecretAgent *agent, NMConnection *connection, - GHashTable *secrets, + GVariant *secrets, GError *secrets_error, gpointer user_data) { @@ -3142,7 +3122,7 @@ get_existing_secrets_cb (NMSecretAgent *agent, GError *error = NULL; /* Merge existing secrets into connection; ignore errors */ - nm_connection_update_secrets (connection, req->setting_name, secrets, NULL); + (void) nm_connection_update_secrets (connection, req->setting_name, secrets, NULL); dclass = get_device_class_from_connection (connection, req->applet); g_assert (dclass); @@ -3560,7 +3540,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); } @@ -3583,7 +3563,7 @@ dbus_setup (NMApplet *applet, GError **error) guint result; gboolean success; - applet->session_bus = dbus_g_bus_get (DBUS_BUS_SESSION, error); + applet->session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error); if (!applet->session_bus) return FALSE; diff --git a/src/applet.h b/src/applet.h index cd5ac97c..ca518f83 100644 --- a/src/applet.h +++ b/src/applet.h @@ -31,18 +31,11 @@ #include <gtk/gtk.h> #include <gdk/gdkx.h> -#include <dbus/dbus-glib.h> #include <net/ethernet.h> #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" @@ -85,7 +78,7 @@ typedef struct GObject parent_instance; GMainLoop *loop; - DBusGConnection *session_bus; + GDBusConnection *session_bus; NMShellWatcher *shell_watcher; guint agent_start_id; @@ -220,7 +213,7 @@ struct _SecretsRequest { void applet_secrets_request_set_free_func (SecretsRequest *req, SecretsRequestFreeFunc free_func); void applet_secrets_request_complete (SecretsRequest *req, - GHashTable *settings, + GVariant *secrets, GError *error); void applet_secrets_request_complete_setting (SecretsRequest *req, const char *setting_name, diff --git a/src/libnm-gtk/nm-mobile-wizard.c b/src/libnm-gtk/nm-mobile-wizard.c index d552ff1e..6b525943 100644 --- a/src/libnm-gtk/nm-mobile-wizard.c +++ b/src/libnm-gtk/nm-mobile-wizard.c @@ -30,10 +30,6 @@ #include <gtk/gtk.h> #include <NetworkManager.h> -#include <nm-setting-gsm.h> -#include <nm-setting-cdma.h> -#include <nm-client.h> -#include <nm-device-modem.h> #include "nm-mobile-wizard.h" #include "nm-mobile-providers.h" @@ -1304,7 +1300,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); @@ -1395,8 +1391,9 @@ intro_setup (NMAMobileWizard *self) /* Device combo; only built if the wizard's caller didn't pass one in */ if (!self->initial_family) { GtkTreeIter iter; + GError *error = NULL; - self->client = nm_client_new (); + self->client = nm_client_new (NULL, &error); if (self->client) { g_signal_connect (self->client, "device-added", G_CALLBACK (intro_device_added_cb), self); @@ -1404,6 +1401,9 @@ intro_setup (NMAMobileWizard *self) G_CALLBACK (intro_device_removed_cb), self); g_signal_connect (self->client, "notify::manager-running", G_CALLBACK (intro_manager_running_cb), self); + } else { + g_warning ("Failed to connect to NetworkManager: %s", error->message); + g_clear_error (&error); } self->dev_store = gtk_tree_store_new (3, G_TYPE_STRING, NM_TYPE_DEVICE, G_TYPE_BOOLEAN); diff --git a/src/libnm-gtk/nm-mobile-wizard.h b/src/libnm-gtk/nm-mobile-wizard.h index 5f626f67..ba39ec8f 100644 --- a/src/libnm-gtk/nm-mobile-wizard.h +++ b/src/libnm-gtk/nm-mobile-wizard.h @@ -29,7 +29,6 @@ #include <glib.h> #include <NetworkManager.h> -#include <nm-device.h> typedef struct NMAMobileWizard NMAMobileWizard; diff --git a/src/libnm-gtk/nm-ui-utils.c b/src/libnm-gtk/nm-ui-utils.c index 69ede41e..d81cda91 100644 --- a/src/libnm-gtk/nm-ui-utils.c +++ b/src/libnm-gtk/nm-ui-utils.c @@ -27,7 +27,7 @@ #include <glib/gi18n.h> #include <gudev/gudev.h> -#include <nm-device.h> +#include <NetworkManager.h> #include "nm-ui-utils.h" @@ -551,7 +551,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..4ef98aab 100644 --- a/src/libnm-gtk/nm-ui-utils.h +++ b/src/libnm-gtk/nm-ui-utils.h @@ -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..a91486b8 100644 --- a/src/libnm-gtk/nm-wifi-dialog.c +++ b/src/libnm-gtk/nm-wifi-dialog.c @@ -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" @@ -49,6 +44,7 @@ G_DEFINE_TYPE (NMAWifiDialog, nma_wifi_dialog, GTK_TYPE_DIALOG) typedef struct { NMAWifiDialog *self; NMConnection *connection; + char *setting_name; gboolean canceled; } GetSecretsInfo; @@ -356,11 +352,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 +446,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; s_con = nm_connection_get_setting_connection (candidate); connection_type = s_con ? nm_setting_connection_get_connection_type (s_con) : NULL; @@ -489,10 +485,7 @@ connection_combo_init (NMAWifiDialog *self, NMConnection *connection) 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)) + if (!nm_utils_hwaddr_matches (setting_mac, -1, hw_addr, -1)) continue; } } @@ -730,15 +723,22 @@ add_security_item (NMAWifiDialog *self, } static void +free_get_secrets_info (GetSecretsInfo *info) +{ + g_object_unref (info->connection); + g_free (info->setting_name); + g_free (info); +} + +static void get_secrets_cb (NMRemoteConnection *connection, - GHashTable *secrets, + GVariant *secrets, GError *error, gpointer user_data) { GetSecretsInfo *info = user_data; NMAWifiDialogPrivate *priv; - GHashTableIter hash_iter; - gpointer key, value; + GError *update_error = NULL; GtkTreeModel *model; GtkTreeIter iter; @@ -768,28 +768,19 @@ get_secrets_cb (NMRemoteConnection *connection, * progress, so don't try to update the wrong connection with the secrets * we just received. */ - if ( (priv->connection != info->connection) - || !secrets - || !g_hash_table_size (secrets)) + if ((priv->connection != info->connection) || !secrets) goto out; /* Try to update the connection's secrets; log errors but we don't care */ - g_hash_table_iter_init (&hash_iter, secrets); - while (g_hash_table_iter_next (&hash_iter, &key, &value)) { - GError *update_error = NULL; - const char *setting_name = key; - GHashTable *setting_hash = value; - - if (!nm_connection_update_secrets (priv->connection, - setting_name, - setting_hash, - &update_error)) { - g_warning ("%s: error updating connection secrets: (%d) %s", - __func__, - update_error ? update_error->code : -1, - update_error && update_error->message ? update_error->message : "(unknown)"); - g_clear_error (&update_error); - } + if (!nm_connection_update_secrets (priv->connection, + info->setting_name, + secrets, + &update_error)) { + g_warning ("%s: error updating connection secrets: (%d) %s", + __func__, + update_error ? update_error->code : -1, + update_error && update_error->message ? update_error->message : "(unknown)"); + g_clear_error (&update_error); } /* Update each security method's UI elements with the new secrets */ @@ -807,8 +798,7 @@ get_secrets_cb (NMRemoteConnection *connection, } out: - g_object_unref (info->connection); - g_free (info); + free_get_secrets_info (info); } static gboolean @@ -990,6 +980,7 @@ security_combo_init (NMAWifiDialog *self, gboolean secrets_only) info = g_malloc0 (sizeof (GetSecretsInfo)); info->self = self; info->connection = g_object_ref (priv->connection); + info->setting_name = g_strdup (setting_name); priv->secrets_info = info; nm_remote_connection_get_secrets (NM_REMOTE_CONNECTION (priv->connection), @@ -1125,12 +1116,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 +1185,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..4dce8945 100644 --- a/src/libnm-gtk/nm-wifi-dialog.h +++ b/src/libnm-gtk/nm-wifi-dialog.h @@ -31,11 +31,8 @@ #include <glib.h> #include <glib-object.h> -#include <nm-client.h> +#include <NetworkManager.h> #include <nm-connection.h> -#include <nm-device.h> -#include <nm-access-point.h> -#include <nm-remote-settings.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..669d3615 100644 --- a/src/libnm-gtk/nm-wireless-dialog.c +++ b/src/libnm-gtk/nm-wireless-dialog.c @@ -22,8 +22,6 @@ #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..84775b9e 100644 --- a/src/libnm-gtk/nm-wireless-dialog.h +++ b/src/libnm-gtk/nm-wireless-dialog.h @@ -31,11 +31,8 @@ #include <glib.h> #include <glib-object.h> +#include <NetworkManager.h> #include <nm-connection.h> -#include <nm-device.h> -#include <nm-access-point.h> -#include <nm-remote-settings.h> -#include <nm-wireless-dialog.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/utils/utils.c b/src/utils/utils.c index 269abe37..abfcee87 100644 --- a/src/utils/utils.c +++ b/src/utils/utils.c @@ -27,9 +27,6 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <nm-setting-connection.h> -#include <nm-utils.h> - #include "utils.h" /* diff --git a/src/utils/utils.h b/src/utils/utils.h index 3cd04087..56c62a3e 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -25,10 +25,8 @@ #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); diff --git a/src/wireless-security/eap-method-fast.c b/src/wireless-security/eap-method-fast.c index 47f3d70b..caebe13e 100644 --- a/src/wireless-security/eap-method-fast.c +++ b/src/wireless-security/eap-method-fast.c @@ -26,9 +26,7 @@ #include <ctype.h> #include <string.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> - +#include <NetworkManager.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..5902d690 100644 --- a/src/wireless-security/eap-method-leap.c +++ b/src/wireless-security/eap-method-leap.c @@ -22,8 +22,8 @@ #include <ctype.h> #include <string.h> -#include <nm-setting-8021x.h> +#include <NetworkManager.h> #include "eap-method.h" #include "wireless-security.h" #include "helpers.h" diff --git a/src/wireless-security/eap-method-peap.c b/src/wireless-security/eap-method-peap.c index d4fa7dbb..b13b8000 100644 --- a/src/wireless-security/eap-method-peap.c +++ b/src/wireless-security/eap-method-peap.c @@ -26,9 +26,7 @@ #include <ctype.h> #include <string.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> - +#include <NetworkManager.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..1542923b 100644 --- a/src/wireless-security/eap-method-simple.c +++ b/src/wireless-security/eap-method-simple.c @@ -22,9 +22,8 @@ #include <ctype.h> #include <string.h> -#include <nm-setting-8021x.h> -#include <nm-setting-connection.h> +#include <NetworkManager.h> #include "eap-method.h" #include "wireless-security.h" #include "helpers.h" diff --git a/src/wireless-security/eap-method-tls.c b/src/wireless-security/eap-method-tls.c index 6daa8f8b..287d21d6 100644 --- a/src/wireless-security/eap-method-tls.c +++ b/src/wireless-security/eap-method-tls.c @@ -26,9 +26,7 @@ #include <ctype.h> #include <string.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> - +#include <NetworkManager.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..8b4571d9 100644 --- a/src/wireless-security/eap-method-ttls.c +++ b/src/wireless-security/eap-method-ttls.c @@ -26,9 +26,7 @@ #include <ctype.h> #include <string.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> - +#include <NetworkManager.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..391e159d 100644 --- a/src/wireless-security/eap-method.c +++ b/src/wireless-security/eap-method.c @@ -32,8 +32,7 @@ #include <fcntl.h> #include <unistd.h> -#include <nm-setting-connection.h> -#include <nm-setting-8021x.h> +#include <NetworkManager.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..da8850bf 100644 --- a/src/wireless-security/eap-method.h +++ b/src/wireless-security/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.h b/src/wireless-security/helpers.h index 75c01ea5..9ce8e1d6 100644 --- a/src/wireless-security/helpers.h +++ b/src/wireless-security/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..34e260fd 100644 --- a/src/wireless-security/wireless-security.c +++ b/src/wireless-security/wireless-security.c @@ -28,12 +28,7 @@ #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 <NetworkManager.h> #include "wireless-security.h" #include "eap-method.h" diff --git a/src/wireless-security/wireless-security.h b/src/wireless-security/wireless-security.h index 4a1a4fe8..be1b7d6a 100644 --- a/src/wireless-security/wireless-security.h +++ b/src/wireless-security/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; diff --git a/src/wireless-security/ws-dynamic-wep.c b/src/wireless-security/ws-dynamic-wep.c index e7c85fa7..b14de46e 100644 --- a/src/wireless-security/ws-dynamic-wep.c +++ b/src/wireless-security/ws-dynamic-wep.c @@ -23,8 +23,8 @@ #include <glib/gi18n.h> #include <ctype.h> #include <string.h> -#include <nm-setting-wireless.h> +#include <NetworkManager.h> #include "wireless-security.h" #include "eap-method.h" diff --git a/src/wireless-security/ws-dynamic-wep.h b/src/wireless-security/ws-dynamic-wep.h index 54979f47..03b2d681 100644 --- a/src/wireless-security/ws-dynamic-wep.h +++ b/src/wireless-security/ws-dynamic-wep.h @@ -23,7 +23,7 @@ #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..22b1b0bd 100644 --- a/src/wireless-security/ws-leap.c +++ b/src/wireless-security/ws-leap.c @@ -21,8 +21,8 @@ */ #include <string.h> -#include <nm-setting-wireless.h> +#include <NetworkManager.h> #include "wireless-security.h" #include "helpers.h" #include "utils.h" diff --git a/src/wireless-security/ws-leap.h b/src/wireless-security/ws-leap.h index 6f1d7050..d6319fe3 100644 --- a/src/wireless-security/ws-leap.h +++ b/src/wireless-security/ws-leap.h @@ -23,7 +23,7 @@ #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..e130beeb 100644 --- a/src/wireless-security/ws-wep-key.c +++ b/src/wireless-security/ws-wep-key.c @@ -23,9 +23,7 @@ #include <string.h> #include <glib.h> -#include <nm-setting-wireless.h> -#include <nm-setting-wireless-security.h> - +#include <NetworkManager.h> #include "wireless-security.h" #include "utils.h" diff --git a/src/wireless-security/ws-wep-key.h b/src/wireless-security/ws-wep-key.h index fdd70da0..097f7a16 100644 --- a/src/wireless-security/ws-wep-key.h +++ b/src/wireless-security/ws-wep-key.h @@ -23,7 +23,7 @@ #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..a60e1973 100644 --- a/src/wireless-security/ws-wpa-eap.c +++ b/src/wireless-security/ws-wpa-eap.c @@ -23,8 +23,8 @@ #include <glib/gi18n.h> #include <ctype.h> #include <string.h> -#include <nm-setting-wireless.h> +#include <NetworkManager.h> #include "wireless-security.h" #include "eap-method.h" diff --git a/src/wireless-security/ws-wpa-eap.h b/src/wireless-security/ws-wpa-eap.h index 5c8faeab..095772cc 100644 --- a/src/wireless-security/ws-wpa-eap.h +++ b/src/wireless-security/ws-wpa-eap.h @@ -23,7 +23,7 @@ #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..34473227 100644 --- a/src/wireless-security/ws-wpa-psk.c +++ b/src/wireless-security/ws-wpa-psk.c @@ -22,8 +22,8 @@ #include <ctype.h> #include <string.h> -#include <nm-setting-wireless.h> +#include <NetworkManager.h> #include "wireless-security.h" #include "helpers.h" #include "utils.h" diff --git a/src/wireless-security/ws-wpa-psk.h b/src/wireless-security/ws-wpa-psk.h index a89552fb..672223c4 100644 --- a/src/wireless-security/ws-wpa-psk.h +++ b/src/wireless-security/ws-wpa-psk.h @@ -23,6 +23,8 @@ #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); |