diff options
author | Bastien Nocera <hadess@hadess.net> | 2006-07-27 17:42:18 +0800 |
---|---|---|
committer | Bastien Nocera <hadess@src.gnome.org> | 2006-07-27 17:42:18 +0800 |
commit | c6612c8d03bc4c1a45d92b5d94dce57fbb8d49a8 (patch) | |
tree | 936c9443326dbe91a0f9d65581da57e1eacc98e5 /shell/e-shell-nm-glib.c | |
parent | 03f84f573a83c4faa2c326b46dd2a28759b470d6 (diff) | |
download | gsoc2013-evolution-c6612c8d03bc4c1a45d92b5d94dce57fbb8d49a8.tar.gz gsoc2013-evolution-c6612c8d03bc4c1a45d92b5d94dce57fbb8d49a8.tar.zst gsoc2013-evolution-c6612c8d03bc4c1a45d92b5d94dce57fbb8d49a8.zip |
Fix warnings at build-time, and clean up the connections to the D-Bus on
2006-07-27 Bastien Nocera <hadess@hadess.net>
* e-shell-nm-glib.c: (e_shell_glib_network_monitor),
(e_shell_nm_glib_initialise), (e_shell_nm_glib_dispose):
* e-shell-nm.c: (e_shell_dbus_dispose):
* e-shell-window.c: (impl_dispose): Fix warnings at build-time, and
clean up the connections to the D-Bus on exit (Closes: #332387)
svn path=/trunk/; revision=32425
Diffstat (limited to 'shell/e-shell-nm-glib.c')
-rw-r--r-- | shell/e-shell-nm-glib.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/shell/e-shell-nm-glib.c b/shell/e-shell-nm-glib.c index 9c6a8fd67d..994f3af755 100644 --- a/shell/e-shell-nm-glib.c +++ b/shell/e-shell-nm-glib.c @@ -31,6 +31,7 @@ #include <e-shell-window.h> static libnm_glib_ctx *nm_ctx = NULL; +static guint id = 0; static void e_shell_glib_network_monitor (libnm_glib_ctx *ctx, gpointer user_data) { @@ -44,24 +45,19 @@ static void e_shell_glib_network_monitor (libnm_glib_ctx *ctx, gpointer user_dat state = libnm_glib_get_network_state (ctx); line_status = e_shell_get_line_status (shell); - + if (line_status == E_SHELL_LINE_STATUS_ONLINE && state == LIBNM_NO_NETWORK_CONNECTION) { shell_state = GNOME_Evolution_FORCED_OFFLINE; e_shell_go_offline (shell, window, shell_state); } else if (line_status == E_SHELL_LINE_STATUS_OFFLINE && state == LIBNM_ACTIVE_NETWORK_CONNECTION) { shell_state = GNOME_Evolution_USER_ONLINE; e_shell_go_online (shell, window, shell_state); - } else - return LIBNM_INVALID_CONTEXT; - - return FALSE; + } } int e_shell_nm_glib_initialise (EShellWindow *window ) { - guint id; - if (!nm_ctx) { nm_ctx = libnm_glib_init (); @@ -75,3 +71,14 @@ int e_shell_nm_glib_initialise (EShellWindow *window ) return TRUE; } + +void e_shell_nm_glib_dispose (EShellWindow *window ) +{ + if (id != 0 && nm_ctx != NULL) { + libnm_glib_unregister_callback (nm_ctx, id); + libnm_glib_shutdown (nm_ctx); + nm_ctx = NULL; + id = 0; + } +} + |