diff options
author | Suman Manjunath <msuman@src.gnome.org> | 2008-10-17 13:18:16 +0800 |
---|---|---|
committer | Suman Manjunath <msuman@src.gnome.org> | 2008-10-17 13:18:16 +0800 |
commit | 5ce1bbbbc83a42532b43788839321f2fac831dd1 (patch) | |
tree | 6ce21ed58818c88c5a99f1ac8a76a5b6166035ce /shell | |
parent | 0803e3551c2d5ee774addba722d5d287bf2c689d (diff) | |
download | gsoc2013-evolution-5ce1bbbbc83a42532b43788839321f2fac831dd1.tar.gz gsoc2013-evolution-5ce1bbbbc83a42532b43788839321f2fac831dd1.tar.zst gsoc2013-evolution-5ce1bbbbc83a42532b43788839321f2fac831dd1.zip |
Matthew Barnes <mbarnes@redhat.com> ** Fix for bug #548469 (Drop support for deprecated libnm-glib).
svn path=/trunk/; revision=36631
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 16 | ||||
-rw-r--r-- | shell/Makefile.am | 4 | ||||
-rw-r--r-- | shell/e-shell-nm-glib.c | 89 | ||||
-rw-r--r-- | shell/e-shell-nm.c | 56 | ||||
-rw-r--r-- | shell/e-shell-window-commands.c | 10 | ||||
-rw-r--r-- | shell/e-shell-window.c | 25 | ||||
-rw-r--r-- | shell/e-shell.c | 50 | ||||
-rw-r--r-- | shell/e-shell.h | 6 |
8 files changed, 61 insertions, 195 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index a090d3d1d2..8180185fa5 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,19 @@ +2008-10-17 Matthew Barnes <mbarnes@redhat.com> + + ** Fix for bug #548469 + + * Makefile.am: + * e-shell-nm-glib.c: + * e-shell-nm.c (reinit_dbus), (e_shell_network_monitor), + (e_shell_dbus_initialise): + * e-shell-window-commands.c (command_work_offline), + (command_work_online): + * e-shell-window.c (offline_toggle_clicked_cb), (impl_dispose): + * e-shell.c (impl_Shell_setLineStatus), (e_shell_construct), + (e_shell_set_line_status): + * e-shell.h: + Drop support for deprecated libnm-glib. + 2008-10-03 Sankar P <psankar@novell.com> License Changes diff --git a/shell/Makefile.am b/shell/Makefile.am index 9654dbf814..7ffdc303f5 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -51,13 +51,9 @@ $(IDL_GENERATED_H): $(IDLS) $(IDL_GENERATED_C): $(IDL_GENERATED_H) -if NM_SUPPORT_GLIB -NM_SUPPORT_FILES = e-shell-nm-glib.c -else if NM_SUPPORT NM_SUPPORT_FILES = e-shell-nm.c endif -endif # Data Server CORBA stuff DATASERVER_IDL_GENERATED_H = \ diff --git a/shell/e-shell-nm-glib.c b/shell/e-shell-nm-glib.c deleted file mode 100644 index 458d87af8e..0000000000 --- a/shell/e-shell-nm-glib.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Shreyas Srinivasan <sshreyas@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <Evolution.h> -#include <libnm_glib.h> -#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) -{ - libnm_glib_state state; - EShellLineStatus line_status; - EShellWindow *window = E_SHELL_WINDOW (user_data); - EShell *shell = e_shell_window_peek_shell (window); - GNOME_Evolution_ShellState shell_state; - - g_return_if_fail (ctx != NULL); - - 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_FORCED_OFFLINE && state == LIBNM_ACTIVE_NETWORK_CONNECTION) { - shell_state = GNOME_Evolution_USER_ONLINE; - e_shell_go_online (shell, window, shell_state); - } -} - -gboolean e_shell_nm_glib_initialise (EShellWindow *window); -void e_shell_nm_glib_dispose (EShellWindow *window); - -gboolean -e_shell_nm_glib_initialise (EShellWindow *window) -{ - if (!nm_ctx) { - nm_ctx = libnm_glib_init (); - if (!nm_ctx) { - fprintf (stderr, "Could not initialize libnm.\n"); - return FALSE; - } - } - - id = libnm_glib_register_callback (nm_ctx, e_shell_glib_network_monitor, window, NULL); - - 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; - } -} diff --git a/shell/e-shell-nm.c b/shell/e-shell-nm.c index 58923831e4..ef3c10eb9d 100644 --- a/shell/e-shell-nm.c +++ b/shell/e-shell-nm.c @@ -29,7 +29,7 @@ #include <stdio.h> #include <string.h> #include <glib.h> -#include <e-shell-window.h> +#include <e-shell.h> #include <Evolution.h> #include <dbus/dbus.h> #include <dbus/dbus-glib-lowlevel.h> @@ -41,14 +41,16 @@ typedef enum _ShellLineStatus { E_SHELL_LINE_UP } ShellLineStatus; -static gboolean init_dbus (EShellWindow *window); +gboolean e_shell_dbus_initialise (EShell *shell); static DBusConnection *dbus_connection = NULL; static gboolean reinit_dbus (gpointer user_data) { - if (init_dbus (user_data)) + EShell *shell = user_data; + + if (e_shell_dbus_initialise (shell)) return FALSE; /* keep trying to re-establish dbus connection */ @@ -60,21 +62,13 @@ static DBusHandlerResult e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED, DBusMessage *message, void *user_data) { - DBusError error; const char *object; ShellLineStatus status; - EShellWindow *window = NULL; - EShell *shell = NULL; + EShell *shell = user_data; GNOME_Evolution_ShellState shell_state; EShellLineStatus line_status; + DBusError error = DBUS_ERROR_INIT; - if (!user_data || !E_IS_SHELL_WINDOW (user_data)) - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - - window = E_SHELL_WINDOW (user_data); - shell = e_shell_window_peek_shell (window); - - dbus_error_init (&error); object = dbus_message_get_path (message); if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected") && @@ -82,7 +76,7 @@ e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED, dbus_connection_unref (dbus_connection); dbus_connection = NULL; - g_timeout_add (3000, reinit_dbus, window); + g_timeout_add (3000, reinit_dbus, shell); return DBUS_HANDLER_RESULT_HANDLED; } @@ -102,26 +96,26 @@ e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED, if (line_status == E_SHELL_LINE_STATUS_ONLINE && status == E_SHELL_LINE_DOWN) { shell_state = GNOME_Evolution_FORCED_OFFLINE; - e_shell_go_offline (shell, window, shell_state); + e_shell_set_line_status (shell, shell_state); } else if (line_status == E_SHELL_LINE_STATUS_FORCED_OFFLINE && status == E_SHELL_LINE_UP) { shell_state = GNOME_Evolution_USER_ONLINE; - e_shell_go_online (shell, window, shell_state); + e_shell_set_line_status (shell, shell_state); } return DBUS_HANDLER_RESULT_HANDLED; } -static gboolean -init_dbus (EShellWindow *window) +gboolean +e_shell_dbus_initialise (EShell *shell) { - DBusError error; + DBusError error = DBUS_ERROR_INIT; if (dbus_connection != NULL) return TRUE; - dbus_error_init (&error); - if (!(dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error))) { - g_warning ("could not get system bus: %s\n", error.message); + dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error); + if (dbus_connection == NULL) { + g_warning ("%s", error.message); dbus_error_free (&error); return FALSE; } @@ -129,7 +123,7 @@ init_dbus (EShellWindow *window) dbus_connection_setup_with_g_main (dbus_connection, NULL); dbus_connection_set_exit_on_disconnect (dbus_connection, FALSE); - if (!dbus_connection_add_filter (dbus_connection, e_shell_network_monitor, window, NULL)) + if (!dbus_connection_add_filter (dbus_connection, e_shell_network_monitor, shell, NULL)) goto exception; dbus_bus_add_match (dbus_connection, @@ -138,6 +132,7 @@ init_dbus (EShellWindow *window) "sender='" NM_DBUS_SERVICE "'," "path='" NM_DBUS_PATH "'", &error); if (dbus_error_is_set (&error)) { + g_warning ("%s", error.message); dbus_error_free (&error); goto exception; } @@ -151,18 +146,3 @@ exception: return FALSE; } - -gboolean -e_shell_dbus_initialise (EShellWindow *window) -{ - g_type_init (); - - return init_dbus (window); -} - -void -e_shell_dbus_dispose (EShellWindow *window) -{ - //FIXME - return; -} diff --git a/shell/e-shell-window-commands.c b/shell/e-shell-window-commands.c index a6901d0865..0e4b9940ee 100644 --- a/shell/e-shell-window-commands.c +++ b/shell/e-shell-window-commands.c @@ -1024,7 +1024,10 @@ command_work_offline (BonoboUIComponent *uih, EShellWindow *window, const char *path) { - e_shell_go_offline (e_shell_window_peek_shell (window), window, GNOME_Evolution_USER_OFFLINE); + EShell *shell; + + shell = e_shell_window_peek_shell (window); + e_shell_set_line_status (shell, GNOME_Evolution_USER_OFFLINE); } static void @@ -1032,7 +1035,10 @@ command_work_online (BonoboUIComponent *uih, EShellWindow *window, const char *path) { - e_shell_go_online (e_shell_window_peek_shell (window), window, GNOME_Evolution_USER_ONLINE); + EShell *shell; + + shell = e_shell_window_peek_shell (window); + e_shell_set_line_status (shell, GNOME_Evolution_USER_ONLINE); } static void diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index f857390070..f2eb6bf86d 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -53,12 +53,8 @@ #include <string.h> -#ifdef NM_SUPPORT_GLIB -gboolean e_shell_nm_glib_initialise (EShellWindow *window); -void e_shell_nm_glib_dispose (EShellWindow *window); -#elif NM_SUPPORT +#if NM_SUPPORT gboolean e_shell_dbus_initialise (EShellWindow *window); -void e_shell_dbus_dispose (EShellWindow *window); #endif /* A view for each component. These are all created when EShellWindow is @@ -477,19 +473,24 @@ sidebar_button_pressed_callback (ESidebar *sidebar, static void offline_toggle_clicked_cb (EShellWindow *window) { - EShellWindowPrivate *priv = window->priv; + EShell *shell; + GNOME_Evolution_ShellState shell_state; - switch (e_shell_get_line_status (priv->shell.eshell)) { + shell = window->priv->shell.eshell; + + switch (e_shell_get_line_status (shell)) { case E_SHELL_LINE_STATUS_ONLINE: - e_shell_go_offline (priv->shell.eshell, window, GNOME_Evolution_USER_OFFLINE); + shell_state = GNOME_Evolution_USER_OFFLINE; break; case E_SHELL_LINE_STATUS_OFFLINE: case E_SHELL_LINE_STATUS_FORCED_OFFLINE: - e_shell_go_online (priv->shell.eshell, window, GNOME_Evolution_USER_ONLINE); + shell_state = GNOME_Evolution_USER_ONLINE; break; default: g_return_if_reached(); } + + e_shell_set_line_status (shell, shell_state); } static void @@ -853,12 +854,6 @@ impl_dispose (GObject *object) store_window_size (GTK_WIDGET (self)); } - #ifdef NM_SUPPORT_GLIB - e_shell_nm_glib_dispose (E_SHELL_WINDOW (object)); - #elif NM_SUPPORT - e_shell_dbus_dispose (E_SHELL_WINDOW (object)); - #endif - (* G_OBJECT_CLASS (e_shell_window_parent_class)->dispose) (object); } diff --git a/shell/e-shell.c b/shell/e-shell.c index df1aeaece7..aeb6b79112 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -316,9 +316,9 @@ impl_Shell_setLineStatus (PortableServer_Servant servant, e_passwords_set_online(online); if (online) - e_shell_go_online (shell, NULL, GNOME_Evolution_USER_ONLINE); + e_shell_set_line_status (shell, GNOME_Evolution_USER_ONLINE); else - e_shell_go_offline (shell, NULL, GNOME_Evolution_USER_OFFLINE); + e_shell_set_line_status (shell, GNOME_Evolution_USER_OFFLINE); } /* static GNOME_Evolution_Component @@ -716,9 +716,9 @@ e_shell_construct (EShell *shell, e_passwords_set_online(start_online); if (start_online) - e_shell_go_online (shell, NULL, GNOME_Evolution_USER_ONLINE); + e_shell_set_line_status (shell, GNOME_Evolution_USER_ONLINE); else - e_shell_go_online (shell, NULL, GNOME_Evolution_USER_OFFLINE); + e_shell_set_line_status (shell, GNOME_Evolution_USER_OFFLINE); return E_SHELL_CONSTRUCT_RESULT_OK; } @@ -1125,8 +1125,9 @@ set_line_status_complete(EvolutionListener *el, void *data) } } -static void -set_line_status(EShell *shell, GNOME_Evolution_ShellState shell_state) +void +e_shell_set_line_status (EShell *shell, + GNOME_Evolution_ShellState shell_state) { EShellPrivate *priv; GSList *component_infos; @@ -1180,43 +1181,6 @@ set_line_status(EShell *shell, GNOME_Evolution_ShellState shell_state) set_line_status_finished(shell); } -/** - * e_shell_go_offline: - * @shell: - * @action_window: Obsolete/unused. - * - * Make the shell go into off-line mode. - **/ -void -e_shell_go_offline (EShell *shell, - EShellWindow *action_window, GNOME_Evolution_ShellState shell_state) -{ - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (action_window != NULL); - g_return_if_fail (action_window == NULL || E_IS_SHELL_WINDOW (action_window)); - - set_line_status(shell, shell_state); -} - -/** - * e_shell_go_online: - * @shell: - * @action_window: Obsolete/unused. - * - * Make the shell go into on-line mode. - **/ -void -e_shell_go_online (EShell *shell, - EShellWindow *action_window, GNOME_Evolution_ShellState shell_state) -{ - g_return_if_fail (shell != NULL); - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (action_window == NULL || E_IS_SHELL_WINDOW (action_window)); - - set_line_status(shell, shell_state); -} - gboolean e_shell_get_crash_recovery (EShell *shell) { diff --git a/shell/e-shell.h b/shell/e-shell.h index 9a36594042..ab16ea819e 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -119,10 +119,8 @@ gboolean e_shell_save_settings (EShell *shell); void e_shell_close_all_windows (EShell *shell); EShellLineStatus e_shell_get_line_status (EShell *shell); -void e_shell_go_offline (EShell *shell, - EShellWindow *action_window, GNOME_Evolution_ShellState shell_state); -void e_shell_go_online (EShell *shell, - EShellWindow *action_window, GNOME_Evolution_ShellState shell_state); +void e_shell_set_line_status (EShell *shell, + GNOME_Evolution_ShellState shell_state); gboolean e_shell_get_crash_recovery (EShell *shell); void e_shell_set_crash_recovery (EShell *shell, |