2006-01-11 Robert Love <rml@novell.com>

* gnome/applet/applet-dbus-devices.c, gnome/applet/applet-dbus.c,
	  gnome/applet/applet.c, gnome/applet/applet.h: Consolidating
	  assignments to applet->nm_state into a new nmwa_set_state() function
	  for both cleanliness and to help debugging.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1314 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Robert Love 2006-01-11 17:08:38 +00:00 committed by Robert Love
parent e9091da2a3
commit 913ee23313
5 changed files with 33 additions and 15 deletions

View file

@ -1,3 +1,10 @@
2006-01-11 Robert Love <rml@novell.com>
* gnome/applet/applet-dbus-devices.c, gnome/applet/applet-dbus.c,
gnome/applet/applet.c, gnome/applet/applet.h: Consolidating
assignments to applet->nm_state into a new nmwa_set_state() function
for both cleanliness and to help debugging.
2006-01-10 Robert Love <rml@novell.com>
* src/autoip.c: Fix FIXME. In performing the link-local zeroconf IP

View file

@ -66,10 +66,8 @@ static void nmwa_dbus_nm_state_cb (DBusPendingCall *pcall, void *user_data)
goto out;
}
if (dbus_message_get_args (reply, NULL, DBUS_TYPE_UINT32, &nm_state, DBUS_TYPE_INVALID)) {
applet->nm_state = nm_state;
nmwa_enable_networking_set_active (applet);
}
if (dbus_message_get_args (reply, NULL, DBUS_TYPE_UINT32, &nm_state, DBUS_TYPE_INVALID))
nmwa_set_state (applet, nm_state);
dbus_message_unref (reply);

View file

@ -119,7 +119,7 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa
{
/* NetworkManager started up */
applet->nm_running = TRUE;
applet->nm_state = NM_STATE_DISCONNECTED;
nmwa_set_state (applet, NM_STATE_DISCONNECTED);
nmwa_dbus_update_nm_state (applet);
nmwa_dbus_update_devices (applet);
nmwa_dbus_update_dialup (applet);
@ -128,7 +128,7 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa
else if (old_owner_good && !new_owner_good)
{
applet->nm_running = FALSE;
applet->nm_state = NM_STATE_DISCONNECTED;
nmwa_set_state (applet, NM_STATE_DISCONNECTED);
nmi_passphrase_dialog_destroy (applet);
}
}
@ -145,13 +145,11 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa
/* If we've switched to connecting, update the active device to ensure that we have
* valid wireless network information for it.
*/
if ( (state == NM_STATE_CONNECTING)
&& act_dev
&& network_device_is_wireless (act_dev))
if (state == NM_STATE_CONNECTING && act_dev && network_device_is_wireless (act_dev))
{
nmwa_dbus_device_update_one_device (applet, network_device_get_nm_path (act_dev));
}
applet->nm_state = state;
nmwa_set_state (applet, state);
}
}
else if ( dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceAdded")
@ -415,7 +413,7 @@ static gboolean nmwa_dbus_connection_watcher (gpointer user_data)
if ((applet->connection = nmwa_dbus_init (applet)))
{
applet->nm_running = nmwa_dbus_nm_is_running (applet->connection);
applet->nm_state = NM_STATE_DISCONNECTED;
nmwa_set_state (applet, NM_STATE_DISCONNECTED);
nmwa_dbus_update_nm_state (applet);
nmwa_dbus_update_devices (applet);
nmwa_dbus_update_dialup (applet);

View file

@ -1098,7 +1098,7 @@ static void nmwa_update_state (NMWirelessApplet *applet)
#if 0
if (!act_dev)
applet->nm_state = NM_STATE_DISCONNECTED;
nmwa_set_state (applet, NM_STATE_DISCONNECTED);
#endif
switch (applet->nm_state)
@ -1828,7 +1828,7 @@ static void nmwa_menu_add_devices (GtkWidget *menu, NMWirelessApplet *applet)
g_return_if_fail (menu != NULL);
g_return_if_fail (applet != NULL);
if (! applet->device_list)
if (!applet->device_list)
{
nmwa_menu_add_text_item (menu, _("No network devices have been found"));
return;
@ -2140,12 +2140,27 @@ void nmwa_enable_wireless_set_active (NMWirelessApplet *applet)
* message might not have been sent yet or in case the daemon state changes
* out from under us.
*/
void nmwa_enable_networking_set_active (NMWirelessApplet *applet)
static inline void nmwa_enable_networking_set_active (NMWirelessApplet *applet)
{
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (applet->enable_networking_item), applet->nm_state != NM_STATE_ASLEEP);
}
/*
* nmwa_set_state
*
* Set the applet's state to one of the NMState enumerations.
*
*/
void nmwa_set_state (NMWirelessApplet *applet, enum NMState state)
{
g_return_if_fail (applet != NULL);
g_return_if_fail (state >= NM_STATE_UNKNOWN && state <= NM_STATE_DISCONNECTED);
applet->nm_state = state;
nmwa_enable_networking_set_active (applet);
}
/*
* nmwa_context_menu_create
*

View file

@ -149,7 +149,7 @@ VPNConnection * nmwa_get_first_active_vpn_connection (NMWirelessApplet *applet);
void nmwa_enable_wireless_set_active (NMWirelessApplet *applet);
void nmwa_enable_networking_set_active (NMWirelessApplet *applet);
void nmwa_set_state (NMWirelessApplet *applet, NMState state);
int nm_null_safe_strcmp (const char *s1, const char *s2);