NMVpnPluginUiInterface * vpn_get_plugin_by_service (const char *service) { g_return_val_if_fail (service != NULL, NULL); if (!plugins) { vpn_get_plugins (NULL); if (!plugins) return NULL; } return g_hash_table_lookup (plugins, service); }
NMConnectionList * nm_connection_list_new (void) { NMConnectionList *list; DBusGConnection *bus; GError *error = NULL; const char *objects[] = { "NMConnectionList", NULL }; list = g_object_new (NM_TYPE_CONNECTION_LIST, NULL); if (!list) return NULL; /* load GUI */ list->gui = gtk_builder_new (); if (!gtk_builder_add_objects_from_file (list->gui, UIDIR "/nm-connection-editor.ui", (char **) objects, &error)) { g_warning ("Couldn't load builder file: %s", error->message); g_error_free (error); goto error; } gtk_window_set_default_icon_name ("preferences-system-network"); list->nm_client = nm_client_new (); if (!list->nm_client) goto error; bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (error) { g_warning ("Could not connect to the system bus: %s", error->message); g_error_free (error); goto error; } list->settings = nm_remote_settings_new (bus); dbus_g_connection_unref (bus); g_signal_connect (list->settings, NM_REMOTE_SETTINGS_NEW_CONNECTION, 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); /* Connect to the main dialog's response handler */ list->dialog = GTK_WIDGET (gtk_builder_get_object (list->gui, "NMConnectionList")); if (!list->dialog) goto error; g_signal_connect (G_OBJECT (list->dialog), "response", G_CALLBACK (dialog_response_cb), list); if (!vpn_get_plugins (&error)) { g_warning ("%s: failed to load VPN plugins: %s", __func__, error->message); g_error_free (error); } return list; error: g_object_unref (list); return NULL; }