NetworkManager r3761 - in trunk: . libnm-glib



Author: dcbw
Date: Fri Jun 20 19:46:46 2008
New Revision: 3761
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3761&view=rev

Log:
2008-06-20  Dan Williams  <dcbw redhat com>

	* libnm-glib/nm-vpn-plugin-ui-interface.c
	  libnm-glib/nm-vpn-plugin-ui-interface.h
		- 'validity-changed' -> 'changed' to work better with the connection
			editor.  Plugin UI widgets should emit 'changed' whenever their
			UI values change in a meaningful way.
		- (nm_vpn_plugin_ui_widget_interface_update_connection): the
			update_connection member now returns validity of the UI widget



Modified:
   trunk/ChangeLog
   trunk/libnm-glib/nm-vpn-plugin-ui-interface.c
   trunk/libnm-glib/nm-vpn-plugin-ui-interface.h

Modified: trunk/libnm-glib/nm-vpn-plugin-ui-interface.c
==============================================================================
--- trunk/libnm-glib/nm-vpn-plugin-ui-interface.c	(original)
+++ trunk/libnm-glib/nm-vpn-plugin-ui-interface.c	Fri Jun 20 19:46:46 2008
@@ -145,13 +145,13 @@
 		return;
 
 	/* Signals */
-	g_signal_new ("validity-changed",
+	g_signal_new ("changed",
 				  iface_type,
 				  G_SIGNAL_RUN_FIRST,
-				  G_STRUCT_OFFSET (NMVpnPluginUiWidgetInterface, validity_changed),
+				  G_STRUCT_OFFSET (NMVpnPluginUiWidgetInterface, changed),
 				  NULL, NULL,
-				  g_cclosure_marshal_VOID__BOOLEAN,
-				  G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+				  g_cclosure_marshal_VOID__VOID,
+				  G_TYPE_NONE, 0);
 
 	initialized = TRUE;
 }
@@ -191,10 +191,14 @@
 	return NM_VPN_PLUGIN_UI_WIDGET_INTERFACE_GET_INTERFACE (iface)->get_widget (iface);
 }
 
-void
+gboolean
 nm_vpn_plugin_ui_widget_interface_update_connection (NMVpnPluginUiWidgetInterface *iface,
-                                                     NMConnection *connection)
+                                                     NMConnection *connection,
+                                                     GError **error)
 {
-	return NM_VPN_PLUGIN_UI_WIDGET_INTERFACE_GET_INTERFACE (iface)->update_connection (iface, connection);
+	if (error)
+		g_return_val_if_fail (*error == NULL, FALSE);
+
+	return NM_VPN_PLUGIN_UI_WIDGET_INTERFACE_GET_INTERFACE (iface)->update_connection (iface, connection, error);
 }
 

Modified: trunk/libnm-glib/nm-vpn-plugin-ui-interface.h
==============================================================================
--- trunk/libnm-glib/nm-vpn-plugin-ui-interface.h	(original)
+++ trunk/libnm-glib/nm-vpn-plugin-ui-interface.h	Fri Jun 20 19:46:46 2008
@@ -141,20 +141,29 @@
 	/* Return the GtkWidget for the VPN's UI */
 	GObject * (*get_widget) (NMVpnPluginUiWidgetInterface *iface);
 
-	/* Called to save the user-entered options to the connection object */
-	void (*update_connection) (NMVpnPluginUiWidgetInterface *iface,
-	                           NMConnection *connection);
-
-	/* Emitted when the validity of the user-entered options changes */
-	void (*validity_changed) (NMVpnPluginUiWidgetInterface *iface, gboolean valid);
+	/* Called to save the user-entered options to the connection object.  Should
+	 * return FALSE and set 'error' if the current options are invalid.  'error'
+	 * should contain enough information for the plugin to determine which UI
+	 * widget is invalid at a later point in time.  For example, creating unique
+	 * error codes for what error occurred and populating the message field
+	 * of 'error' with the name of the invalid property.
+	 */
+	gboolean (*update_connection) (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);
 };
 
 GType nm_vpn_plugin_ui_widget_interface_get_type (void);
 
 GObject * nm_vpn_plugin_ui_widget_interface_get_widget (NMVpnPluginUiWidgetInterface *iface);
 
-void nm_vpn_plugin_ui_widget_interface_update_connection (NMVpnPluginUiWidgetInterface *iface,
-                                                          NMConnection *connection);
+gboolean nm_vpn_plugin_ui_widget_interface_update_connection (NMVpnPluginUiWidgetInterface *iface,
+                                                              NMConnection *connection,
+                                                              GError **error);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]