aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-12-15 12:51:33 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-12-15 12:51:33 +0800
commit04531b1c0f924fc78e2754f539889070818343fb (patch)
tree5c371fcb1a5126505b35476233d82fe8c5e5f291
parent2730e83cf85d90a2546046e78e91d9f4da549bec (diff)
downloadgsoc2013-evolution-04531b1c0f924fc78e2754f539889070818343fb.tar.gz
gsoc2013-evolution-04531b1c0f924fc78e2754f539889070818343fb.tar.zst
gsoc2013-evolution-04531b1c0f924fc78e2754f539889070818343fb.zip
** Fixes bug #564416
2008-12-14 Matthew Barnes <mbarnes@redhat.com> ** Fixes bug #564416 * shell/e-shell-nm.c: We've been listening for obsolete D-Bus signals. Update to NetworkManager's current D-Bus API. svn path=/trunk/; revision=36878
-rw-r--r--shell/ChangeLog8
-rw-r--r--shell/e-shell-nm.c27
2 files changed, 20 insertions, 15 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 05f0b2399c..ade04fca4e 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,11 @@
+2008-12-14 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes bug #564416
+
+ * e-shell-nm.c:
+ We've been listening for obsolete D-Bus signals.
+ Update to NetworkManager's current D-Bus API.
+
2008-12-10 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #563250
diff --git a/shell/e-shell-nm.c b/shell/e-shell-nm.c
index ef3c10eb9d..e1d962fe89 100644
--- a/shell/e-shell-nm.c
+++ b/shell/e-shell-nm.c
@@ -36,11 +36,6 @@
#include <dbus/dbus-glib.h>
#include <NetworkManager/NetworkManager.h>
-typedef enum _ShellLineStatus {
- E_SHELL_LINE_DOWN,
- E_SHELL_LINE_UP
-} ShellLineStatus;
-
gboolean e_shell_dbus_initialise (EShell *shell);
static DBusConnection *dbus_connection = NULL;
@@ -63,11 +58,11 @@ e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED,
DBusMessage *message, void *user_data)
{
const char *object;
- ShellLineStatus status;
EShell *shell = user_data;
GNOME_Evolution_ShellState shell_state;
EShellLineStatus line_status;
DBusError error = DBUS_ERROR_INIT;
+ guint32 state;
object = dbus_message_get_path (message);
@@ -81,23 +76,25 @@ e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED,
return DBUS_HANDLER_RESULT_HANDLED;
}
- if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive"))
- status = E_SHELL_LINE_DOWN;
- else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive"))
- status = E_SHELL_LINE_UP;
- else
+ if (!dbus_message_is_signal (message, NM_DBUS_INTERFACE, "StateChanged"))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (!dbus_message_get_args (message, &error, DBUS_TYPE_OBJECT_PATH,
- &object, DBUS_TYPE_INVALID))
+ dbus_message_get_args (
+ message, &error,
+ DBUS_TYPE_UINT32, &state,
+ DBUS_TYPE_INVALID);
+
+ if (dbus_error_is_set (&error)) {
+ g_warning ("%s", error.message);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
line_status = e_shell_get_line_status (shell);
- if (line_status == E_SHELL_LINE_STATUS_ONLINE && status == E_SHELL_LINE_DOWN) {
+ if (line_status == E_SHELL_LINE_STATUS_ONLINE && state == NM_STATE_DISCONNECTED) {
shell_state = GNOME_Evolution_FORCED_OFFLINE;
e_shell_set_line_status (shell, shell_state);
- } else if (line_status == E_SHELL_LINE_STATUS_FORCED_OFFLINE && status == E_SHELL_LINE_UP) {
+ } else if (line_status == E_SHELL_LINE_STATUS_FORCED_OFFLINE && state == NM_STATE_CONNECTED) {
shell_state = GNOME_Evolution_USER_ONLINE;
e_shell_set_line_status (shell, shell_state);
}