network-manager-applet r920 - in trunk: . src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-applet r920 - in trunk: . src
- Date: Thu, 2 Oct 2008 13:23:01 +0000 (UTC)
Author: dcbw
Date: Thu Oct 2 13:23:01 2008
New Revision: 920
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=920&view=rev
Log:
2008-10-02 Dan Williams <dcbw redhat com>
* src/applet.c
src/applet.h
- (foo_device_added_cb, foo_device_state_changed_cb): use the state-changed
signal rather than property notification so that old state and the
reason for the state change can be used as well
* src/applet-device-gsm.c
src/applet-device-wifi.c
src/applet-device-cdma.c
src/applet-device-wired.c
- Update device state changed handler functions for these changes
Modified:
trunk/ChangeLog
trunk/src/applet-device-cdma.c
trunk/src/applet-device-gsm.c
trunk/src/applet-device-wifi.c
trunk/src/applet-device-wired.c
trunk/src/applet.c
trunk/src/applet.h
Modified: trunk/src/applet-device-cdma.c
==============================================================================
--- trunk/src/applet-device-cdma.c (original)
+++ trunk/src/applet-device-cdma.c Thu Oct 2 13:23:01 2008
@@ -277,10 +277,12 @@
static void
cdma_device_state_changed (NMDevice *device,
- NMDeviceState state,
+ NMDeviceState new_state,
+ NMDeviceState old_state,
+ NMDeviceStateReason reason,
NMApplet *applet)
{
- if (state == NM_DEVICE_STATE_ACTIVATED) {
+ if (new_state == NM_DEVICE_STATE_ACTIVATED) {
applet_do_notify (applet, NOTIFY_URGENCY_LOW,
_("Connection Established"),
_("You are now connected to the CDMA network."),
Modified: trunk/src/applet-device-gsm.c
==============================================================================
--- trunk/src/applet-device-gsm.c (original)
+++ trunk/src/applet-device-gsm.c Thu Oct 2 13:23:01 2008
@@ -278,10 +278,12 @@
static void
gsm_device_state_changed (NMDevice *device,
- NMDeviceState state,
+ NMDeviceState new_state,
+ NMDeviceState old_state,
+ NMDeviceStateReason reason,
NMApplet *applet)
{
- if (state == NM_DEVICE_STATE_ACTIVATED) {
+ if (new_state == NM_DEVICE_STATE_ACTIVATED) {
applet_do_notify (applet, NOTIFY_URGENCY_LOW,
_("Connection Established"),
_("You are now connected to the GSM network."),
Modified: trunk/src/applet-device-wifi.c
==============================================================================
--- trunk/src/applet-device-wifi.c (original)
+++ trunk/src/applet-device-wifi.c Thu Oct 2 13:23:01 2008
@@ -1155,7 +1155,9 @@
static void
wireless_device_state_changed (NMDevice *device,
- NMDeviceState state,
+ NMDeviceState new_state,
+ NMDeviceState old_state,
+ NMDeviceStateReason reason,
NMApplet *applet)
{
NMAGConfConnection *gconf_connection;
@@ -1163,12 +1165,12 @@
char *msg;
char *esc_ssid = NULL;
- new = update_active_ap (device, state, applet);
+ new = update_active_ap (device, new_state, applet);
- if (state == NM_DEVICE_STATE_DISCONNECTED)
+ if (new_state == NM_DEVICE_STATE_DISCONNECTED)
queue_avail_access_point_notification (device);
- if (state != NM_DEVICE_STATE_ACTIVATED)
+ if (new_state != NM_DEVICE_STATE_ACTIVATED)
return;
if (new) {
Modified: trunk/src/applet-device-wired.c
==============================================================================
--- trunk/src/applet-device-wired.c (original)
+++ trunk/src/applet-device-wired.c Thu Oct 2 13:23:01 2008
@@ -239,10 +239,12 @@
static void
wired_device_state_changed (NMDevice *device,
- NMDeviceState state,
+ NMDeviceState new_state,
+ NMDeviceState old_state,
+ NMDeviceStateReason reason,
NMApplet *applet)
{
- if (state == NM_DEVICE_STATE_ACTIVATED) {
+ if (new_state == NM_DEVICE_STATE_ACTIVATED) {
applet_do_notify (applet, NOTIFY_URGENCY_LOW,
_("Connection Established"),
_("You are now connected to the wired network."),
Modified: trunk/src/applet.c
==============================================================================
--- trunk/src/applet.c (original)
+++ trunk/src/applet.c Thu Oct 2 13:23:01 2008
@@ -1460,13 +1460,15 @@
static void
applet_common_device_state_changed (NMDevice *device,
- NMDeviceState state,
+ NMDeviceState new_state,
+ NMDeviceState old_state,
+ NMDeviceStateReason reason,
NMApplet *applet)
{
NMConnection *connection;
NMActiveConnection *active = NULL;
- switch (state) {
+ switch (new_state) {
case NM_DEVICE_STATE_PREPARE:
case NM_DEVICE_STATE_CONFIG:
case NM_DEVICE_STATE_NEED_AUTH:
@@ -1488,18 +1490,20 @@
}
static void
-foo_device_state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data)
+foo_device_state_changed_cb (NMDevice *device,
+ NMDeviceState new_state,
+ NMDeviceState old_state,
+ NMDeviceStateReason reason,
+ gpointer user_data)
{
NMApplet *applet = NM_APPLET (user_data);
NMADeviceClass *dclass;
- NMDeviceState state;
dclass = get_device_class (device, applet);
g_assert (dclass);
- state = nm_device_get_state (device);
- dclass->device_state_changed (device, state, applet);
- applet_common_device_state_changed (device, state, applet);
+ dclass->device_state_changed (device, new_state, old_state, reason, applet);
+ applet_common_device_state_changed (device, new_state, old_state, reason, applet);
applet_schedule_update_icon (applet);
}
@@ -1516,11 +1520,15 @@
if (dclass->device_added)
dclass->device_added (device, applet);
- g_signal_connect (device, "notify::state",
+ g_signal_connect (device, "state-changed",
G_CALLBACK (foo_device_state_changed_cb),
user_data);
- foo_device_state_changed_cb (device, NULL, applet);
+ foo_device_state_changed_cb (device,
+ nm_device_get_state (device),
+ NM_DEVICE_STATE_UNKNOWN,
+ NM_DEVICE_STATE_REASON_NONE,
+ applet);
}
static void
Modified: trunk/src/applet.h
==============================================================================
--- trunk/src/applet.h (original)
+++ trunk/src/applet.h Thu Oct 2 13:23:01 2008
@@ -144,20 +144,42 @@
struct NMADeviceClass {
- NMConnection * (*new_auto_connection) (NMDevice *device, NMApplet *applet, gpointer user_data);
- void (*add_menu_item) (NMDevice *device, guint32 num_devices, NMConnection *active, GtkWidget *menu, NMApplet *applet);
- void (*device_added) (NMDevice *device, NMApplet *applet);
- void (*device_state_changed) (NMDevice *device, NMDeviceState state, NMApplet *applet);
- GdkPixbuf * (*get_icon) (NMDevice *device, NMDeviceState state, char **tip, NMApplet *applet);
- void (*get_more_info) (NMDevice *device, NMConnection *connection, NMApplet *applet, gpointer user_data);
- gboolean (*get_secrets) (NMDevice *device,
- NMConnection *connection,
- const char *specific_object,
- const char *setting_name,
- const char **hints,
- DBusGMethodInvocation *context,
- NMApplet *applet,
- GError **error);
+ NMConnection * (*new_auto_connection) (NMDevice *device,
+ NMApplet *applet,
+ gpointer user_data);
+
+ void (*add_menu_item) (NMDevice *device,
+ guint32 num_devices,
+ NMConnection *active,
+ GtkWidget *menu,
+ NMApplet *applet);
+
+ void (*device_added) (NMDevice *device, NMApplet *applet);
+
+ void (*device_state_changed) (NMDevice *device,
+ NMDeviceState new_state,
+ NMDeviceState old_state,
+ NMDeviceStateReason reason,
+ NMApplet *applet);
+
+ GdkPixbuf * (*get_icon) (NMDevice *device,
+ NMDeviceState state,
+ char **tip,
+ NMApplet *applet);
+
+ void (*get_more_info) (NMDevice *device,
+ NMConnection *connection,
+ NMApplet *applet,
+ gpointer user_data);
+
+ gboolean (*get_secrets) (NMDevice *device,
+ NMConnection *connection,
+ const char *specific_object,
+ const char *setting_name,
+ const char **hints,
+ DBusGMethodInvocation *context,
+ NMApplet *applet,
+ GError **error);
};
GType nma_get_type (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]