diff options
Diffstat (limited to 'shell/e-shell-nm-glib.c')
-rw-r--r-- | shell/e-shell-nm-glib.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/shell/e-shell-nm-glib.c b/shell/e-shell-nm-glib.c index 8ebb0b7eff..9c6a8fd67d 100644 --- a/shell/e-shell-nm-glib.c +++ b/shell/e-shell-nm-glib.c @@ -30,6 +30,7 @@ #include <NetworkManager/libnm_glib.h> #include <e-shell-window.h> +static libnm_glib_ctx *nm_ctx = NULL; static void e_shell_glib_network_monitor (libnm_glib_ctx *ctx, gpointer user_data) { @@ -59,17 +60,18 @@ static void e_shell_glib_network_monitor (libnm_glib_ctx *ctx, gpointer user_dat int e_shell_nm_glib_initialise (EShellWindow *window ) { - libnm_glib_ctx *ctx; guint id; - ctx = libnm_glib_init (); - if (!ctx) + if (!nm_ctx) { - fprintf (stderr, "Could not initialize libnm.\n"); - return FALSE; + nm_ctx = libnm_glib_init (); + if (!nm_ctx) { + fprintf (stderr, "Could not initialize libnm.\n"); + return FALSE; + } } - id = libnm_glib_register_callback (ctx, e_shell_glib_network_monitor, window, NULL); + id = libnm_glib_register_callback (nm_ctx, e_shell_glib_network_monitor, window, NULL); return TRUE; } |