Commit 49ded958 authored by Dan Williams's avatar Dan Williams
Browse files

2005-08-17 Dan Williams <dcbw@redhat.com>

	Patch from Bill Moss <bmoss@clemson.edu>

	* gnome/applet/applet-dbus-info.[ch]
		- (nmi_save_network_info): save timestamp for network if it
			was a change requested by the user
		- (nmi_dbus_update_network_info): get user_requested from dbus
			message and pass to nmi_save_network_info()

	* gnome/applet/applet.c
		- (nmwa_update_network_timestamp): remove
		- (nmwa_menu_item_activate): don't set timestamp on networks
			here, only after a successful connect in nmi_save_network_info()

	* src/NetworkManagerDbus.[ch]
		- (nm_dbus_update_network_info): pass user_requested into the
			dbus message

	* src/NetworkManagerPolicy.c
		- (nm_policy_activation_finish): pass user_requested to
			nm_dbus_update_network_info()


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@857 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 412a25bf
2005-08-17 Dan Williams <dcbw@redhat.com>
Patch from Bill Moss <bmoss@clemson.edu>
* gnome/applet/applet-dbus-info.[ch]
- (nmi_save_network_info): save timestamp for network if it
was a change requested by the user
- (nmi_dbus_update_network_info): get user_requested from dbus
message and pass to nmi_save_network_info()
* gnome/applet/applet.c
- (nmwa_update_network_timestamp): remove
- (nmwa_menu_item_activate): don't set timestamp on networks
here, only after a successful connect in nmi_save_network_info()
* src/NetworkManagerDbus.[ch]
- (nm_dbus_update_network_info): pass user_requested into the
dbus message
* src/NetworkManagerPolicy.c
- (nm_policy_activation_finish): pass user_requested to
nm_dbus_update_network_info()
2005-08-16 Robert Love <rml@novell.com>
* gnome/applet/applet.c: Better "Dial Up" menu item.
......
......@@ -809,8 +809,9 @@ static DBusMessage *nmi_dbus_get_vpn_connection_routes (NMWirelessApplet *applet
* Save information about a wireless network in gconf and the gnome keyring.
*
*/
void nmi_save_network_info (NMWirelessApplet *applet, const char *essid, const char *enc_key_source,
const NMEncKeyType enc_key_type, const NMDeviceAuthMethod auth_method)
static void nmi_save_network_info (NMWirelessApplet *applet, const char *essid, const char *enc_key_source,
const NMEncKeyType enc_key_type, const NMDeviceAuthMethod auth_method,
gboolean user_requested)
{
char * key;
GConfEntry * gconf_entry;
......@@ -866,9 +867,15 @@ void nmi_save_network_info (NMWirelessApplet *applet, const char *essid, const c
gconf_client_set_int (applet->gconf_client, key, (int)enc_key_type, NULL);
g_free (key);
key = g_strdup_printf ("%s/%s/timestamp", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
gconf_client_set_int (applet->gconf_client, key, time (NULL), NULL);
g_free (key);
/* We only update the timestamp if the user requested a particular network, not if
* NetworkManager decided to switch access points by itself.
*/
if (user_requested)
{
key = g_strdup_printf ("%s/%s/timestamp", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
gconf_client_set_int (applet->gconf_client, key, time (NULL), NULL);
g_free (key);
}
if (auth_method != NM_DEVICE_AUTH_METHOD_UNKNOWN)
{
......@@ -896,6 +903,7 @@ static void nmi_dbus_update_network_info (NMWirelessApplet *applet, DBusMessage
char * enc_key_source = NULL;
int enc_key_type = -1;
char * key;
gboolean user_requested;
GConfValue * value;
DBusError error;
char * escaped_network;
......@@ -909,13 +917,14 @@ static void nmi_dbus_update_network_info (NMWirelessApplet *applet, DBusMessage
DBUS_TYPE_STRING, &enc_key_source,
DBUS_TYPE_INT32, &enc_key_type,
DBUS_TYPE_INT32, &auth_method,
DBUS_TYPE_BOOLEAN, &user_requested,
DBUS_TYPE_INVALID);
if (!args_good || (strlen (network) <= 0) || (auth_method == NM_DEVICE_AUTH_METHOD_UNKNOWN))
return;
if (enc_key_source && strlen (enc_key_source) && ((enc_key_type == NM_ENC_TYPE_UNKNOWN) || (enc_key_type == NM_ENC_TYPE_NONE)))
return;
nmi_save_network_info (applet, network, enc_key_source, (NMEncKeyType) enc_key_type, auth_method);
nmi_save_network_info (applet, network, enc_key_source, (NMEncKeyType) enc_key_type, auth_method, user_requested);
}
......
......@@ -38,8 +38,4 @@ void nmi_dbus_signal_update_network (DBusConnection *connection, const char
void nmi_dbus_signal_update_vpn_connection (DBusConnection *connection, const char *name);
void nmi_save_network_info (NMWirelessApplet *applet, const char *essid, const char *enc_key_source,
const NMEncKeyType enc_key_type, const NMDeviceAuthMethod auth_method);
#endif
......@@ -1196,41 +1196,6 @@ void nmwa_schedule_warning_dialog (NMWirelessApplet *applet, const char *msg)
}
/*
* nmwa_update_network_timestamp
*
* Update the timestamp of a network in GConf.
*
*/
static void nmwa_update_network_timestamp (NMWirelessApplet *applet, WirelessNetwork *network)
{
char * key;
char * escaped_network;
const char * net_essid;
g_return_if_fail (applet != NULL);
g_return_if_fail (network != NULL);
net_essid = wireless_network_get_essid (network);
/* Update GConf to set timestamp for this network, or add it if
* it doesn't already exist.
*/
/* Update timestamp on network */
escaped_network = gconf_escape_key (net_essid, strlen (net_essid));
key = g_strdup_printf ("%s/%s/timestamp", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
gconf_client_set_int (applet->gconf_client, key, time (NULL), NULL);
g_free (key);
/* Force-set the essid too so that we have a semi-complete network entry */
key = g_strdup_printf ("%s/%s/essid", GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
gconf_client_set_string (applet->gconf_client, key, net_essid, NULL);
g_free (key);
g_free (escaped_network);
}
/*
* nmwa_get_device_for_nm_device
*
......@@ -1288,10 +1253,7 @@ static void nmwa_menu_item_activate (GtkMenuItem *item, gpointer user_data)
return;
if ((tag = g_object_get_data (G_OBJECT (item), "network")))
{
if ((net = network_device_get_wireless_network_by_essid (dev, tag)))
nmwa_update_network_timestamp (applet, net);
}
net = network_device_get_wireless_network_by_essid (dev, tag);
nmwa_dbus_set_device (applet->connection, dev, net ? wireless_network_get_essid (net) : NULL, -1, NULL);
network_device_unref (dev);
......
......@@ -631,7 +631,7 @@ void nm_dbus_update_wireless_scan_method (DBusConnection *connection, NMData *da
* Tell NetworkManagerInfo the updated info of the AP
*
*/
gboolean nm_dbus_update_network_info (DBusConnection *connection, NMAccessPoint *ap)
gboolean nm_dbus_update_network_info (DBusConnection *connection, NMAccessPoint *ap, gboolean user_requested)
{
DBusMessage * message;
gboolean success = FALSE;
......@@ -662,6 +662,7 @@ gboolean nm_dbus_update_network_info (DBusConnection *connection, NMAccessPoint
DBUS_TYPE_STRING, &enc_key_source,
DBUS_TYPE_INT32, &enc_key_type,
DBUS_TYPE_INT32, &auth_method,
DBUS_TYPE_BOOLEAN, &user_requested,
DBUS_TYPE_INVALID);
if (!dbus_connection_send (connection, message, NULL))
nm_warning ("nm_dbus_update_network_info(): failed to send dbus message.");
......
......@@ -76,7 +76,7 @@ NMAccessPoint *nm_dbus_get_network_object (DBusConnection *connection, NMNetwo
gboolean nm_dbus_add_network_address (DBusConnection *connection, NMNetworkType type, const char *network, struct ether_addr *addr);
gboolean nm_dbus_update_network_info (DBusConnection *connection, NMAccessPoint *ap);
gboolean nm_dbus_update_network_info (DBusConnection *connection, NMAccessPoint *ap, gboolean user_requested);
void nm_dbus_update_allowed_networks (DBusConnection *connection, NMAccessPointList *list, NMData *data);
......
......@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* (C) Copyright 2004 Red Hat, Inc.
* (C) Copyright 2005 Red Hat, Inc.
*/
#include <stdio.h>
......@@ -63,10 +63,10 @@ static gboolean nm_policy_activation_finish (NMActRequest *req)
{
struct ether_addr addr;
NMAccessPoint * ap = nm_act_request_get_ap (req);
NMAccessPoint *tmp_ap;
NMAccessPoint * tmp_ap;
/* Cache details in the info-daemon since the connect was successful */
nm_dbus_update_network_info (data->dbus_connection, ap);
nm_dbus_update_network_info (data->dbus_connection, ap, nm_act_request_get_user_requested (req));
/* Cache the correct auth method in our AP list too */
if ((tmp_ap = nm_ap_list_get_ap_by_essid (data->allowed_ap_list, nm_ap_get_essid (ap))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment