From a2cbab16242fa52006de13ca53d2219548ca4a07 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 9 Sep 2008 20:25:01 +0000 Subject: [PATCH] 2008-09-09 Dan Williams * libnm-glib/nm-vpn-plugin-ui-interface.c libnm-glib/nm-vpn-plugin-ui-interface.h libnm-glib/libnm_glib_vpn.ver - (nm_vpn_plugin_ui_interface_delete_connection): called when the plugin should clean up resources related to the connection (like keyring secrets) - (nm_vpn_plugin_ui_widget_interface_save_secrets): called when the plugin should save user-scope secrets (like to the keyring) git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4052 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 11 +++++++++++ libnm-glib/libnm_glib_vpn.ver | 2 ++ libnm-glib/nm-vpn-plugin-ui-interface.c | 22 ++++++++++++++++++++++ libnm-glib/nm-vpn-plugin-ui-interface.h | 24 ++++++++++++++++++++++++ 4 files changed, 59 insertions(+) diff --git a/ChangeLog b/ChangeLog index d9eb3d11d9..0971224e7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-09-09 Dan Williams + + * libnm-glib/nm-vpn-plugin-ui-interface.c + libnm-glib/nm-vpn-plugin-ui-interface.h + libnm-glib/libnm_glib_vpn.ver + - (nm_vpn_plugin_ui_interface_delete_connection): called when the plugin + should clean up resources related to the connection (like keyring + secrets) + - (nm_vpn_plugin_ui_widget_interface_save_secrets): called when the plugin + should save user-scope secrets (like to the keyring) + 2008-09-08 Dan Williams Patch from Alexander Sack diff --git a/libnm-glib/libnm_glib_vpn.ver b/libnm-glib/libnm_glib_vpn.ver index 99a7ffb11c..16643d2ea1 100644 --- a/libnm-glib/libnm_glib_vpn.ver +++ b/libnm-glib/libnm_glib_vpn.ver @@ -10,6 +10,7 @@ global: nm_vpn_plugin_set_ip4_config; nm_vpn_plugin_set_login_banner; nm_vpn_plugin_set_state; + nm_vpn_plugin_ui_interface_delete_connection; nm_vpn_plugin_ui_interface_export; nm_vpn_plugin_ui_interface_get_capabilities; nm_vpn_plugin_ui_interface_get_suggested_name; @@ -18,6 +19,7 @@ global: nm_vpn_plugin_ui_interface_ui_factory; nm_vpn_plugin_ui_widget_interface_get_type; nm_vpn_plugin_ui_widget_interface_get_widget; + nm_vpn_plugin_ui_widget_interface_save_secrets; nm_vpn_plugin_ui_widget_interface_update_connection; local: *; diff --git a/libnm-glib/nm-vpn-plugin-ui-interface.c b/libnm-glib/nm-vpn-plugin-ui-interface.c index 5996fe9046..00a0fa93cc 100644 --- a/libnm-glib/nm-vpn-plugin-ui-interface.c +++ b/libnm-glib/nm-vpn-plugin-ui-interface.c @@ -134,6 +134,17 @@ nm_vpn_plugin_ui_interface_get_suggested_name (NMVpnPluginUiInterface *iface, return NULL; } +gboolean +nm_vpn_plugin_ui_interface_delete_connection (NMVpnPluginUiInterface *iface, + NMConnection *connection, + GError **error) +{ + if (error) + g_return_val_if_fail (*error == NULL, FALSE); + + return NM_VPN_PLUGIN_UI_INTERFACE_GET_INTERFACE (iface)->delete_connection (iface, connection, error); +} + static void widget_interface_init (gpointer g_iface) @@ -202,3 +213,14 @@ nm_vpn_plugin_ui_widget_interface_update_connection (NMVpnPluginUiWidgetInterfac return NM_VPN_PLUGIN_UI_WIDGET_INTERFACE_GET_INTERFACE (iface)->update_connection (iface, connection, error); } +gboolean +nm_vpn_plugin_ui_widget_interface_save_secrets (NMVpnPluginUiWidgetInterface *iface, + NMConnection *connection, + GError **error) +{ + if (error) + g_return_val_if_fail (*error == NULL, FALSE); + + return NM_VPN_PLUGIN_UI_WIDGET_INTERFACE_GET_INTERFACE (iface)->save_secrets (iface, connection, error); +} + diff --git a/libnm-glib/nm-vpn-plugin-ui-interface.h b/libnm-glib/nm-vpn-plugin-ui-interface.h index 510abfc6ed..c028b833d6 100644 --- a/libnm-glib/nm-vpn-plugin-ui-interface.h +++ b/libnm-glib/nm-vpn-plugin-ui-interface.h @@ -103,6 +103,13 @@ struct _NMVpnPluginUiInterface { * by the caller. */ char * (*get_suggested_name) (NMVpnPluginUiInterface *iface, NMConnection *connection); + + /* Called when the user has chosen to remove the connection (for user + * connections only; system connections are handled by the system + * settings service). Should clear out any VPN-specific secrets or data + * related to the connection. + */ + gboolean (*delete_connection) (NMVpnPluginUiInterface *iface, NMConnection *connection, GError **error); }; GType nm_vpn_plugin_ui_interface_get_type (void); @@ -125,6 +132,10 @@ gboolean nm_vpn_plugin_ui_interface_export (NMVpnPluginUiInterface *iface, char *nm_vpn_plugin_ui_interface_get_suggested_name (NMVpnPluginUiInterface *iface, NMConnection *connection); +gboolean nm_vpn_plugin_ui_interface_delete_connection (NMVpnPluginUiInterface *iface, + NMConnection *connection, + GError **error); + /**************************************************/ /* UI widget interface */ @@ -152,6 +163,15 @@ struct _NMVpnPluginUiWidgetInterface { NMConnection *connection, GError **error); + /* Called when the user has chosen to save the connection (for user + * connections only; system connections are handled by the system + * settings service). Should save VPN-specific connection secrets in + * a way that the auth-dialog can read them. + */ + gboolean (*save_secrets) (NMVpnPluginUiWidgetInterface *iface, + NMConnection *connection, + GError **error); + /* Emitted when the value of a UI widget changes. May trigger a validity * check via update_connection() to write values to the connection */ void (*changed) (NMVpnPluginUiWidgetInterface *iface); @@ -165,6 +185,10 @@ gboolean nm_vpn_plugin_ui_widget_interface_update_connection (NMVpnPluginUiWidge NMConnection *connection, GError **error); +gboolean nm_vpn_plugin_ui_widget_interface_save_secrets (NMVpnPluginUiWidgetInterface *iface, + NMConnection *connection, + GError **error); + G_END_DECLS #endif /* NM_VPN_PLUGIN_UI_INTERFACE_H */