NMListItem * nm_wifi_item_new (NMClient *client, NMDeviceWifi *device, NMAccessPoint *ap, NMSettingsConnectionInterface *connection) { g_return_val_if_fail (NM_IS_CLIENT (client), NULL); g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL); g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NULL); return (NMListItem *) g_object_new (NM_TYPE_WIFI_ITEM, NM_LIST_ITEM_TYPE_NAME, _("WiFi"), NM_CONNECTION_ITEM_CLIENT, client, NM_CONNECTION_ITEM_CONNECTION, connection, NM_DEVICE_ITEM_DEVICE, device, NM_WIFI_ITEM_AP, ap, NULL); }
GtkWidget * nma_wireless_dialog_new (NMClient *client, NMConnection *connection, NMDevice *device, NMAccessPoint *ap) { NMAWirelessDialog *self; NMAWirelessDialogPrivate *priv; guint32 dev_caps; g_return_val_if_fail (NM_IS_CLIENT (client), NULL); g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); g_return_val_if_fail (NM_IS_DEVICE (device), NULL); g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NULL); /* Ensure device validity */ dev_caps = nm_device_get_capabilities (device); g_return_val_if_fail (dev_caps & NM_DEVICE_CAP_NM_SUPPORTED, NULL); g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL); self = NMA_WIRELESS_DIALOG (g_object_new (NMA_TYPE_WIRELESS_DIALOG, NULL)); if (!self) return NULL; priv = NMA_WIRELESS_DIALOG_GET_PRIVATE (self); priv->client = g_object_ref (client); priv->ap = g_object_ref (ap); if (!internal_init (self, connection, device, TRUE, FALSE)) { nm_warning ("Couldn't create wireless security dialog."); g_object_unref (self); return NULL; } return GTK_WIDGET (self); }
GtkWidget * nma_wireless_dialog_hidden_new (NMClient *client) { NMAWirelessDialog *self; NMAWirelessDialogPrivate *priv; g_return_val_if_fail (NM_IS_CLIENT (client), NULL); self = NMA_WIRELESS_DIALOG (g_object_new (NMA_TYPE_WIRELESS_DIALOG, NULL)); if (!self) return NULL; priv = NMA_WIRELESS_DIALOG_GET_PRIVATE (self); priv->client = g_object_ref (client); if (!internal_init (self, NULL, NULL, FALSE, FALSE)) { nm_warning ("Couldn't create wireless security dialog."); g_object_unref (self); return NULL; } return GTK_WIDGET (self); }
/** * nm_client_get_active_connection_by_path: * @client: a #NMClient * @object_path: the object path to search for * * Gets a #NMActiveConnection from a #NMClient. * * Returns: the #NMActiveConnection for the given @object_path or %NULL if none is found. **/ static NMActiveConnection * nm_client_get_active_connection_by_path (NMClient *client, const char *object_path) { const GPtrArray *actives; int i; NMActiveConnection *active = NULL; g_return_val_if_fail (NM_IS_CLIENT (client), NULL); g_return_val_if_fail (object_path, NULL); actives = nm_client_get_active_connections (client); if (!actives) return NULL; for (i = 0; i < actives->len; i++) { NMActiveConnection *candidate = g_ptr_array_index (actives, i); if (!strcmp (nm_object_get_path (NM_OBJECT (candidate)), object_path)) { active = candidate; break; } } return active; }