2005-04-27 Dan Williams <dcbw@redhat.com>

* gnome/applet/applet-dbus-vpn.c
	  gnome/applet/applet.c
	  gnome/applet/applet.h
		- Fix up active VPN handling so that we reliably know when a VPN
			connection has been deactivated

	* src/vpn-manager/nm-vpn-manager.c
		- Remove duplicate VPNConnectionChange signal


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@593 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2005-04-28 12:09:15 +00:00
parent aac770c185
commit b3f87f16ab
5 changed files with 34 additions and 25 deletions

View File

@@ -1,3 +1,14 @@
2005-04-27 Dan Williams <dcbw@redhat.com>
* gnome/applet/applet-dbus-vpn.c
gnome/applet/applet.c
gnome/applet/applet.h
- Fix up active VPN handling so that we reliably know when a VPN
connection has been deactivated
* src/vpn-manager/nm-vpn-manager.c
- Remove duplicate VPNConnectionChange signal
2005-04-27 Dan Williams <dcbw@redhat.com> 2005-04-27 Dan Williams <dcbw@redhat.com>
Patch from Peter Jones: Patch from Peter Jones:

View File

@@ -64,6 +64,13 @@ void nmwa_dbus_vpn_get_active_vpn_connection_cb (DBusPendingCall *pcall, void *u
if ( dbus_message_is_error (reply, NM_DBUS_NO_ACTIVE_VPN_CONNECTION) if ( dbus_message_is_error (reply, NM_DBUS_NO_ACTIVE_VPN_CONNECTION)
|| dbus_message_is_error (reply, NM_DBUS_NO_VPN_CONNECTIONS)) || dbus_message_is_error (reply, NM_DBUS_NO_VPN_CONNECTIONS))
{ {
/* Remove the active VPN connection if one exists */
if (applet->dbus_active_vpn_name)
{
g_free (applet->dbus_active_vpn_name);
applet->dbus_active_vpn_name = NULL;
}
dbus_message_unref (reply); dbus_message_unref (reply);
goto out; goto out;
} }
@@ -71,7 +78,10 @@ void nmwa_dbus_vpn_get_active_vpn_connection_cb (DBusPendingCall *pcall, void *u
if (dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &act_vpn, DBUS_TYPE_INVALID)) if (dbus_message_get_args (reply, NULL, DBUS_TYPE_STRING, &act_vpn, DBUS_TYPE_INVALID))
{ {
g_free (applet->dbus_active_vpn_name); g_free (applet->dbus_active_vpn_name);
if (strlen (act_vpn))
applet->dbus_active_vpn_name = g_strdup (act_vpn); applet->dbus_active_vpn_name = g_strdup (act_vpn);
else
applet->dbus_active_vpn_name = NULL;
} }
dbus_message_unref (reply); dbus_message_unref (reply);
@@ -160,15 +170,10 @@ void nmwa_dbus_vpn_properties_cb (DBusPendingCall *pcall, void *user_data)
{ {
VPNConnection * vpn; VPNConnection * vpn;
if ((vpn = nmwa_vpn_connection_find_by_name (applet->dbus_vpn_connections, cb_data->name))) if (applet->dbus_active_vpn_name && cb_data->name && !strcmp (applet->dbus_active_vpn_name, cb_data->name))
{ {
applet->dbus_vpn_connections = g_slist_remove (applet->dbus_vpn_connections, vpn); g_free (applet->dbus_active_vpn_name);
nmwa_vpn_connection_unref (vpn); applet->dbus_active_vpn_name = NULL;
if (applet->dbus_active_vpn == vpn);
{
nmwa_vpn_connection_unref (vpn);
applet->dbus_active_vpn = NULL;
}
} }
} }
@@ -328,12 +333,12 @@ void nmwa_dbus_vpn_remove_one_vpn_connection (NMWirelessApplet *applet, const ch
if ((vpn = nmwa_vpn_connection_find_by_name (applet->dbus_vpn_connections, vpn_name))) if ((vpn = nmwa_vpn_connection_find_by_name (applet->dbus_vpn_connections, vpn_name)))
{ {
applet->dbus_vpn_connections = g_slist_remove (applet->dbus_vpn_connections, vpn); applet->dbus_vpn_connections = g_slist_remove (applet->dbus_vpn_connections, vpn);
nmwa_vpn_connection_unref (vpn); if (!strcmp (applet->dbus_active_vpn_name, nmwa_vpn_connection_get_name (vpn)))
if (applet->dbus_active_vpn == vpn)
{ {
nmwa_vpn_connection_unref (vpn); g_free (applet->dbus_active_vpn_name);
applet->dbus_active_vpn = NULL; applet->dbus_active_vpn_name = NULL;
} }
nmwa_vpn_connection_unref (vpn);
nmwa_dbus_vpn_schedule_copy (applet); nmwa_dbus_vpn_schedule_copy (applet);
} }
} }
@@ -356,12 +361,12 @@ static gboolean nmwa_dbus_vpn_connections_lock_and_copy (NMWirelessApplet *apple
/* Only copy over if we have a complete data model */ /* Only copy over if we have a complete data model */
if (g_slist_length (applet->vpn_pending_call_list) == 0) if (g_slist_length (applet->vpn_pending_call_list) == 0)
{ {
VPNConnection * act_vpn = NULL;
GSList * elt; GSList * elt;
/* Match up the active vpn with a device in the list */ /* Match up the active vpn with a device in the list */
if (applet->dbus_active_vpn_name && if (applet->dbus_active_vpn_name)
(applet->dbus_active_vpn = nmwa_vpn_connection_find_by_name (applet->dbus_vpn_connections, applet->dbus_active_vpn_name))) act_vpn = nmwa_vpn_connection_find_by_name (applet->dbus_vpn_connections, applet->dbus_active_vpn_name);
nmwa_vpn_connection_ref (applet->dbus_active_vpn);
/* Now copy the data over to the GUI side */ /* Now copy the data over to the GUI side */
g_mutex_lock (applet->data_mutex); g_mutex_lock (applet->data_mutex);
@@ -378,7 +383,7 @@ static gboolean nmwa_dbus_vpn_connections_lock_and_copy (NMWirelessApplet *apple
if (new_vpn) if (new_vpn)
{ {
applet->gui_vpn_connections = g_slist_append (applet->gui_vpn_connections, new_vpn); applet->gui_vpn_connections = g_slist_append (applet->gui_vpn_connections, new_vpn);
if (applet->dbus_active_vpn == src_vpn) if (src_vpn == act_vpn)
{ {
nmwa_vpn_connection_ref (new_vpn); nmwa_vpn_connection_ref (new_vpn);
applet->gui_active_vpn = new_vpn; applet->gui_active_vpn = new_vpn;
@@ -438,10 +443,6 @@ static void nmwa_free_dbus_vpn_connections (NMWirelessApplet *applet)
g_return_if_fail (applet != NULL); g_return_if_fail (applet != NULL);
if (applet->dbus_active_vpn)
nmwa_vpn_connection_unref (applet->dbus_active_vpn);
applet->dbus_active_vpn = NULL;
g_free (applet->dbus_active_vpn_name); g_free (applet->dbus_active_vpn_name);
applet->dbus_active_vpn_name = NULL; applet->dbus_active_vpn_name = NULL;

View File

@@ -1798,7 +1798,6 @@ static GtkWidget * nmwa_get_instance (NMWirelessApplet *applet)
applet->dbus_active_device = NULL; applet->dbus_active_device = NULL;
applet->dbus_active_device_path = NULL; applet->dbus_active_device_path = NULL;
applet->dbus_active_vpn_name = NULL; applet->dbus_active_vpn_name = NULL;
applet->dbus_active_vpn = NULL;
applet->dbus_vpn_connections = NULL; applet->dbus_vpn_connections = NULL;
applet->dbus_nm_state = NM_STATE_DISCONNECTED; applet->dbus_nm_state = NM_STATE_DISCONNECTED;
applet->vpn_pending_call_list = NULL; applet->vpn_pending_call_list = NULL;

View File

@@ -100,7 +100,6 @@ typedef struct
GSList * vpn_pending_call_list; GSList * vpn_pending_call_list;
char * dbus_active_vpn_name; char * dbus_active_vpn_name;
GSList * dbus_vpn_connections; GSList * dbus_vpn_connections;
VPNConnection * dbus_active_vpn;
GdkPixbuf * no_connection_icon; GdkPixbuf * no_connection_icon;
GdkPixbuf * wired_icon; GdkPixbuf * wired_icon;

View File

@@ -751,7 +751,6 @@ void nm_vpn_manager_deactivate_vpn_connection (NMVPNManager *manager)
out: out:
nm_vpn_manager_set_active_vpn_connection (manager, NULL); nm_vpn_manager_set_active_vpn_connection (manager, NULL);
nm_dbus_vpn_signal_vpn_connection_change (manager->app_data->dbus_connection, NULL);
nm_vpn_connection_unref (active); nm_vpn_connection_unref (active);
if (manager->app_data->active_device) if (manager->app_data->active_device)