Re: [evolution-patches] Network Manager support for Evolution
- From: Shreyas Srinivasan <sshreyas novell com>
- To: evolution-patches gnome org
- Subject: Re: [evolution-patches] Network Manager support for Evolution
- Date: Mon, 12 Dec 2005 13:53:20 +0530
On Tue, 2005-11-15 at 16:00 +0530, Shreyas Sriniavasan wrote:
> Hey,
>
> Attaching the first few patches which dwell into Network Manager
> support for Evolution. Things which work in these patches
Attaching significantly modified patches for Network Manager support.
I added the configure check to use nm_glib api's if they are present.
If not it will use Network Managers dbus interface with the service etc
defined in
the NetworkManager.h file, ofcourse only if they are present.
Let me know if i can commit,
--
Shreyas
--
What can i do? I am just being me
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ChangeLog,v
retrieving revision 1.1540
diff -u -p -r1.1540 ChangeLog
--- ChangeLog 2 Dec 2005 00:53:16 -0000 1.1540
+++ ChangeLog 12 Dec 2005 07:46:19 -0000
@@ -1,3 +1,8 @@
+2005-12-12 Shreyas Srinivasan <sshreyas novell com>
+
+ * configure.in: Compile network manager support if
+ dbus-glib is present. Also switch to nm_glib if present.
+
2005-12-02 Tor Lillqvist <tml novell com>
* evolution-zip.in: New file, a script used to build a
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.860
diff -u -p -r1.860 configure.in
--- configure.in 2 Dec 2005 00:53:16 -0000 1.860
+++ configure.in 12 Dec 2005 07:46:20 -0000
@@ -1143,7 +1143,7 @@ else
HAL_REQUIREMENT=""
IPOD_SYNC=""
fi
-
+
dnl --- Flags for the various libraries we build
EVO_SET_COMPILE_FLAGS(CAMEL, camel-provider-$EDS_PACKAGE)
@@ -1195,7 +1195,27 @@ AC_SUBST(LIBFILTER_LIBS)
dnl --- evolution (shell) flags
-EVO_SET_COMPILE_FLAGS(SHELL, libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 >= $BONOBOUI_REQUIRED libglade-2.0 gnome-vfs-2.0 libgtkhtml-$GTKHTML_PACKAGE >= $GTKHTML_REQUIRED)
+NM_SUPPORT_PACKAGES=""
+
+PKG_CHECK_MODULES(NM, dbus-glib-1 nm_glib, NM_SUPPORT_GLIB="yes", NM_SUPPORT_GLIB="no")
+if test "x$NM_SUPPORT_GLIB" = "xyes"; then
+ AC_DEFINE(NM_SUPPORT_GLIB, 1, [network manager available])
+ NM_SUPPORT_PACKAGES="dbus-glib-1 nm_glib"
+else
+ PKG_CHECK_MODULES(NM, dbus-glib-1, NM_SUPPORT="yes", NM_SUPPORT="no")
+ AC_CHECK_HEADER(NetworkManager/NetworkManager.h, nm_header="yes")
+ if test "x$NM_SUPPORT" = "xyes" -a nm_header = yes; then
+ AC_DEFINE(NM_SUPPORT, 1, [network manager available])
+ NM_SUPPORT_PACKAGES="dbus-glib-1"
+ fi
+fi
+
+AM_CONDITIONAL(NM_SUPPORT_GLIB, test x$NM_SUPPORT_GLIB = xyes)
+AM_CONDITIONAL(NM_SUPPORT, test x$NM_SUPPORT = xyes)
+
+
+EVO_SET_COMPILE_FLAGS(SHELL, libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 >= $BONOBOUI_REQUIRED libglade-2.0 gnome-vfs-2.0 libgtkhtml-$GTKHTML_PACKAGE >= $GTKHTML_REQUIRED $NM_SUPPORT_PACKAGES)
+
AC_SUBST(SHELL_CFLAGS)
AC_SUBST(SHELL_LIBS)
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3730
diff -u -p -r1.3730 ChangeLog
--- mail/ChangeLog 6 Dec 2005 08:37:26 -0000 1.3730
+++ mail/ChangeLog 12 Dec 2005 07:46:25 -0000
@@ -1,3 +1,8 @@
+2005-12-12 Shreyas Srinivasan <sshreyas novell com>
+
+ * mail-component.c (impl_setLineStatus): Handle network
+ disconnect by going offline.
+
2005-12-05 Shi Pu <shi pu sun com>
See bug ** 323253
Index: mail/mail-component.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-component.c,v
retrieving revision 1.125
diff -u -p -r1.125 mail-component.c
--- mail/mail-component.c 22 Aug 2005 02:54:51 -0000 1.125
+++ mail/mail-component.c 12 Dec 2005 07:46:26 -0000
@@ -71,6 +71,7 @@
#include <gtk/gtklabel.h>
#include <e-util/e-mktemp.h>
+#include <Evolution.h>
#include <table/e-tree.h>
#include <table/e-tree-memory.h>
@@ -93,6 +94,9 @@ static void create_local_item_cb(EUserCr
#define PARENT_TYPE evolution_component_get_type ()
static BonoboObjectClass *parent_class = NULL;
+#define OFFLINE 0
+#define ONLINE 1
+
struct _store_info {
CamelStore *store;
char *name;
@@ -964,10 +968,36 @@ setline_check(void *key, void *value, vo
}
}
+int
+status_check (GNOME_Evolution_ShellState shell_state)
+{
+ int status;
+
+ switch (shell_state)
+ {
+ case GNOME_Evolution_USER_OFFLINE:
+ status = OFFLINE;
+ break;
+ case GNOME_Evolution_FORCED_OFFLINE:
+ /*Network is down so change network state on the camel session*/
+ status = OFFLINE;
+ /* Cancel all operations as they wont happen anyway cos Network is down*/
+ mail_cancel_all ();
+ camel_session_set_network_state (session, FALSE);
+ break;
+ case GNOME_Evolution_USER_ONLINE:
+ camel_session_set_network_state (session, TRUE);
+ status = ONLINE;
+ }
+
+ return status;
+}
+
static void
-impl_setLineStatus(PortableServer_Servant servant, CORBA_boolean status, GNOME_Evolution_Listener listener, CORBA_Environment *ev)
+impl_setLineStatus(PortableServer_Servant servant, GNOME_Evolution_ShellState shell_state, GNOME_Evolution_Listener listener, CORBA_Environment *ev)
{
struct _setline_data *sd;
+ int status = status_check(shell_state);
/* This will dis/enable further auto-mail-check action. */
/* FIXME: If send/receive active, wait for it to finish? */
Index: mail/mail-component.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-component.h,v
retrieving revision 1.15
diff -u -p -r1.15 mail-component.h
--- mail/mail-component.h 2 Jun 2005 04:30:16 -0000 1.15
+++ mail/mail-component.h 12 Dec 2005 07:46:26 -0000
@@ -98,4 +98,5 @@ struct _CamelStore *mail_component_peek_
struct _CamelFolder *mail_component_get_folder(MailComponent *mc, enum _mail_component_folder_t id);
const char *mail_component_get_folder_uri(MailComponent *mc, enum _mail_component_folder_t id);
+int status_check (GNOME_Evolution_ShellState shell_state);
#endif /* _MAIL_COMPONENT_H_ */
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1544
diff -u -p -r1.1544 ChangeLog
--- shell/ChangeLog 14 Nov 2005 18:50:44 -0000 1.1544
+++ shell/ChangeLog 12 Dec 2005 07:46:27 -0000
@@ -1,3 +1,22 @@
+2005-12-12 Shreyas Srinivasan <sshreyas novell com>
+
+ * Network Manager Support for shell
+ * Evolution-Component.idl (setLineStatus): Handle enum ShellState
+ which can represent network down rather than just a boolean.
+ * e-shell-dbus.c: Add new file which adds a dbus_filter to handle
+ service "org.freedesktop.NetworkManager".
+ * Makefile.am: Add e-shell-dbus.c to the list of files built into
+ evolution_sources.
+ * e-shell-window_commands.c: Use new changed signature of
+ e_shell_go_offline.
+ * e-shell-window.c (setup_status_bar): Initialise the dbus
+ connection.
+ * e-shell.c (set_line_status): Handle network down triggered
+ Force_offline. New signatures for e_shell_go_offline and
+ e_shell_go_online.
+ * e-shell.h: New function signatures for e_shell_go_offline and
+ e_shell_go_online.
+
2005-11-14 Harish Krishnaswamy <kharish novell com>
* e-shell-settings-dialog.c: (set_dialog_size),
Index: shell/Evolution-Component.idl
===================================================================
RCS file: /cvs/gnome/evolution/shell/Evolution-Component.idl,v
retrieving revision 1.18
diff -u -p -r1.18 Evolution-Component.idl
--- shell/Evolution-Component.idl 18 Aug 2005 04:35:30 -0000 1.18
+++ shell/Evolution-Component.idl 12 Dec 2005 07:46:27 -0000
@@ -28,6 +28,11 @@ module Evolution {
CREATABLE_OBJECT,
CREATABLE_FOLDER
};
+ enum ShellState {
+ USER_OFFLINE,
+ FORCED_OFFLINE,
+ USER_ONLINE
+ };
/* A type of item that the component can create when asked by the user,
e.g. a mail message or an appointment. */
@@ -114,7 +119,7 @@ module Evolution {
/* Set the online status of the component asynchronously */
- void setLineStatus(in boolean online, in Listener listener);
+ void setLineStatus(in ShellState shell_state, in Listener listener);
};
};
Index: shell/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/shell/Makefile.am,v
retrieving revision 1.212
diff -u -p -r1.212 Makefile.am
--- shell/Makefile.am 18 Aug 2005 04:35:30 -0000 1.212
+++ shell/Makefile.am 12 Dec 2005 07:46:28 -0000
@@ -90,6 +90,7 @@ eshellinclude_HEADERS = \
libeshell_la_SOURCES = \
$(IDL_GENERATED) \
+
$(MARSHAL_GENERATED) \
evolution-component.c \
evolution-listener.c \
@@ -108,6 +109,14 @@ libeshell_la_LIBADD = \
# Evolution executable
+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
+
evolution_SOURCES = \
$(DATASERVER_IDL_GENERATED) \
e-component-registry.c \
@@ -135,7 +144,8 @@ evolution_SOURCES = \
e-sidebar.h \
es-event.c \
es-menu.c \
- main.c
+ main.c \
+ $(NM_SUPPORT_FILES)
evolution_LDADD = \
libeshell.la \
Index: shell/e-shell-window-commands.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window-commands.c,v
retrieving revision 1.43
diff -u -p -r1.43 e-shell-window-commands.c
--- shell/e-shell-window-commands.c 23 Sep 2005 09:44:58 -0000 1.43
+++ shell/e-shell-window-commands.c 12 Dec 2005 07:46:28 -0000
@@ -637,7 +637,7 @@ command_work_offline (BonoboUIComponent
EShellWindow *window,
const char *path)
{
- e_shell_go_offline (e_shell_window_peek_shell (window), window);
+ e_shell_go_offline (e_shell_window_peek_shell (window), window, GNOME_Evolution_USER_OFFLINE);
}
static void
@@ -645,7 +645,7 @@ command_work_online (BonoboUIComponent *
EShellWindow *window,
const char *path)
{
- e_shell_go_online (e_shell_window_peek_shell (window), window);
+ e_shell_go_online (e_shell_window_peek_shell (window), window, GNOME_Evolution_USER_ONLINE);
}
static void
Index: shell/e-shell-window.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.c,v
retrieving revision 1.39
diff -u -p -r1.39 e-shell-window.c
--- shell/e-shell-window.c 23 Sep 2005 09:44:58 -0000 1.39
+++ shell/e-shell-window.c 12 Dec 2005 07:46:28 -0000
@@ -422,10 +422,10 @@ offline_toggle_clicked_callback (GtkButt
switch (e_shell_get_line_status (priv->shell)) {
case E_SHELL_LINE_STATUS_ONLINE:
- e_shell_go_offline (priv->shell, window);
+ e_shell_go_offline (priv->shell, window, GNOME_Evolution_USER_OFFLINE);
break;
case E_SHELL_LINE_STATUS_OFFLINE:
- e_shell_go_online (priv->shell, window);
+ e_shell_go_online (priv->shell, window, GNOME_Evolution_USER_ONLINE);
break;
default:
g_assert_not_reached ();
@@ -556,6 +556,16 @@ setup_statusbar_notebook (EShellWindow *
}
static void
+setup_nm_support (EShellWindow *window)
+{
+ #ifdef NM_SUPPORT_GLIB
+ e_shell_nm_glib_initialise (window);
+ #elif NM_SUPPORT
+ e_shell_dbus_initialise (window);
+ #endif
+}
+
+static void
setup_status_bar (EShellWindow *window)
{
EShellWindowPrivate *priv;
@@ -566,6 +576,9 @@ setup_status_bar (EShellWindow *window)
priv->status_bar = gtk_hbox_new (FALSE, 2);
if(gconf_client_get_bool (gconf_client_get_default(),"/apps/evolution/shell/view_defaults/statusbar_visible",NULL))
gtk_widget_show (priv->status_bar);
+
+ /* setup dbus interface here*/
+ setup_nm_support (window);
setup_offline_toggle (window);
setup_menu_hint_label (window);
Index: shell/e-shell.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.c,v
retrieving revision 1.267
diff -u -p -r1.267 e-shell.c
--- shell/e-shell.c 18 Aug 2005 04:35:31 -0000 1.267
+++ shell/e-shell.c 12 Dec 2005 07:46:28 -0000
@@ -298,9 +298,9 @@ impl_Shell_setLineStatus (PortableServer
e_passwords_set_online(online);
if (online)
- e_shell_go_online (shell, NULL);
+ e_shell_go_online (shell, NULL, GNOME_Evolution_USER_ONLINE);
else
- e_shell_go_offline (shell, NULL);
+ e_shell_go_offline (shell, NULL, GNOME_Evolution_USER_OFFLINE);
}
static GNOME_Evolution_Component
@@ -697,7 +697,7 @@ e_shell_construct (EShell *shell,
e_passwords_set_online(start_online);
if (start_online)
- e_shell_go_online (shell, NULL);
+ e_shell_go_online (shell, NULL, GNOME_Evolution_USER_ONLINE);
return E_SHELL_CONSTRUCT_RESULT_OK;
}
@@ -1111,7 +1111,7 @@ set_line_status_complete(EvolutionListen
}
static void
-set_line_status(EShell *shell, gboolean status)
+set_line_status(EShell *shell, gboolean status, GNOME_Evolution_ShellState shell_state)
{
EShellPrivate *priv;
GSList *component_infos;
@@ -1144,7 +1144,7 @@ set_line_status(EShell *shell, gboolean
CORBA_exception_init (&ev);
- GNOME_Evolution_Component_setLineStatus(info->iface, status, bonobo_object_corba_objref((BonoboObject *)priv->line_status_listener), &ev);
+ GNOME_Evolution_Component_setLineStatus(info->iface, shell_state, bonobo_object_corba_objref((BonoboObject *)priv->line_status_listener), &ev);
if (ev._major == CORBA_NO_EXCEPTION)
priv->line_status_pending++;
@@ -1165,14 +1165,14 @@ set_line_status(EShell *shell, gboolean
**/
void
e_shell_go_offline (EShell *shell,
- EShellWindow *action_window)
+ 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, FALSE);
+ set_line_status(shell, FALSE, shell_state);
}
/**
@@ -1184,13 +1184,13 @@ e_shell_go_offline (EShell *shell,
**/
void
e_shell_go_online (EShell *shell,
- EShellWindow *action_window)
+ 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, TRUE);
+ set_line_status(shell, TRUE, shell_state);
}
void
Index: shell/e-shell.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.h,v
retrieving revision 1.69
diff -u -p -r1.69 e-shell.h
--- shell/e-shell.h 18 Aug 2005 04:35:31 -0000 1.69
+++ shell/e-shell.h 12 Dec 2005 07:46:28 -0000
@@ -119,9 +119,9 @@ void e_shell_close_all_wi
EShellLineStatus e_shell_get_line_status (EShell *shell);
void e_shell_go_offline (EShell *shell,
- EShellWindow *action_window);
+ EShellWindow *action_window, GNOME_Evolution_ShellState shell_state);
void e_shell_go_online (EShell *shell,
- EShellWindow *action_window);
+ EShellWindow *action_window, GNOME_Evolution_ShellState shell_state);
void e_shell_send_receive (EShell *shell);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]