From 98498e55b66e2118009fe5095dc329424befba6d Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 7 Dec 2005 04:22:10 +0000 Subject: [PATCH] 2005-12-06 Dan Williams * gnome/applet/applet-dbus.c - (set_vpn_last_attempt_status): remove, now in applet-dbus-vpn.c * gnome/applet/applet-dbus-vpn.c - (nmwa_dbus_vpn_set_last_attempt_status): new, from applet-dbus.c - (nmwa_dbus_vpn_update_vpn_connection_stage): set last_attempt_success to TRUE here if stage was ACTIVATED git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1139 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 10 ++++++++++ gnome/applet/applet-dbus-vpn.c | 27 +++++++++++++++++++++++++++ gnome/applet/applet-dbus-vpn.h | 2 ++ gnome/applet/applet-dbus.c | 20 ++------------------ 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index b730afbd66..14600cb2cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-12-06 Dan Williams + + * gnome/applet/applet-dbus.c + - (set_vpn_last_attempt_status): remove, now in applet-dbus-vpn.c + + * gnome/applet/applet-dbus-vpn.c + - (nmwa_dbus_vpn_set_last_attempt_status): new, from applet-dbus.c + - (nmwa_dbus_vpn_update_vpn_connection_stage): set last_attempt_success + to TRUE here if stage was ACTIVATED + 2005-12-06 Dan Williams * Change nm_device_is_* functions to better names: diff --git a/gnome/applet/applet-dbus-vpn.c b/gnome/applet/applet-dbus-vpn.c index 54b88ee7a3..85e367c5be 100644 --- a/gnome/applet/applet-dbus-vpn.c +++ b/gnome/applet/applet-dbus-vpn.c @@ -37,6 +37,26 @@ static void nmwa_free_vpn_connections (NMWirelessApplet *applet); +void +nmwa_dbus_vpn_set_last_attempt_status (NMWirelessApplet *applet, const char *vpn_name, gboolean last_attempt_success) +{ + char *gconf_key; + char *escaped_name; + VPNConnection *vpn; + + if ((vpn = nmwa_vpn_connection_find_by_name (applet->vpn_connections, vpn_name))) + { + escaped_name = gconf_escape_key (vpn_name, strlen (vpn_name)); + + gconf_key = g_strdup_printf ("%s/%s/last_attempt_success", GCONF_PATH_VPN_CONNECTIONS, escaped_name); + gconf_client_set_bool (applet->gconf_client, gconf_key, last_attempt_success, NULL); + + g_free (gconf_key); + g_free (escaped_name); + } +} + + /* * nmwa_dbus_vpn_update_vpn_connection_stage * @@ -49,7 +69,14 @@ void nmwa_dbus_vpn_update_vpn_connection_stage (NMWirelessApplet *applet, const g_return_if_fail (applet != NULL); if ((vpn = nmwa_vpn_connection_find_by_name (applet->vpn_connections, vpn_name))) + { nmwa_vpn_connection_set_stage (vpn, vpn_stage); + if (vpn_stage == NM_VPN_ACT_STAGE_ACTIVATED) + { + /* set the 'last_attempt_success' key in gconf so we DON'T prompt for password next time */ + nmwa_dbus_vpn_set_last_attempt_status (applet, vpn_name, TRUE); + } + } } typedef struct VpnPropsCBData diff --git a/gnome/applet/applet-dbus-vpn.h b/gnome/applet/applet-dbus-vpn.h index d45fa12d1c..c673eeff9f 100644 --- a/gnome/applet/applet-dbus-vpn.h +++ b/gnome/applet/applet-dbus-vpn.h @@ -27,6 +27,8 @@ #include #include "vpn-connection.h" +void nmwa_dbus_vpn_set_last_attempt_status (NMWirelessApplet *applet, const char *vpn_name, gboolean last_attempt_success); + void nmwa_dbus_vpn_update_one_vpn_connection (NMWirelessApplet *applet, const char *vpn_name); void nmwa_dbus_vpn_update_vpn_connections (NMWirelessApplet *applet); void nmwa_dbus_vpn_remove_one_vpn_connection (NMWirelessApplet *applet, const char *vpn_name); diff --git a/gnome/applet/applet-dbus.c b/gnome/applet/applet-dbus.c index 9964241568..423c08a165 100644 --- a/gnome/applet/applet-dbus.c +++ b/gnome/applet/applet-dbus.c @@ -98,22 +98,6 @@ static int deal_with_dbus_error (const char *function, const char *method, DBusE } - -static void -set_vpn_last_attempt_status (NMWirelessApplet *applet, const char *vpn_name, gboolean last_attempt_success) -{ - char *gconf_key; - char *escaped_name; - - escaped_name = gconf_escape_key (vpn_name, strlen (vpn_name)); - - gconf_key = g_strdup_printf ("%s/%s/last_attempt_success", GCONF_PATH_VPN_CONNECTIONS, escaped_name); - gconf_client_set_bool (applet->gconf_client, gconf_key, last_attempt_success, NULL); - - g_free (gconf_key); - g_free (escaped_name); -} - /* * nmwa_dbus_filter * @@ -286,7 +270,7 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &vpn_name, DBUS_TYPE_STRING, &error_msg, DBUS_TYPE_INVALID)) { nmwa_schedule_vpn_failure_dialog (applet, member, vpn_name, error_msg); /* clear the 'last_attempt_success' key in gconf so we prompt for password next time */ - set_vpn_last_attempt_status (applet, vpn_name, FALSE); + nmwa_dbus_vpn_set_last_attempt_status (applet, vpn_name, FALSE); } } else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_LOGIN_BANNER)) @@ -302,7 +286,7 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa g_free (stripped); /* set the 'last_attempt_success' key in gconf so we DON'T prompt for password next time */ - set_vpn_last_attempt_status (applet, vpn_name, TRUE); + nmwa_dbus_vpn_set_last_attempt_status (applet, vpn_name, TRUE); } } else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivationFailed"))