aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@novell.com>2006-04-18 23:51:43 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2006-04-18 23:51:43 +0800
commitab7c700749f00c81fb6ceb56ec2ea2f79be1734a (patch)
tree3adbb9d2b4fcaaf94583ab6cc3142ce33b5efea0
parent9e929ed567809d60a9eabf29289d72ccd2325e11 (diff)
downloadgsoc2013-evolution-ab7c700749f00c81fb6ceb56ec2ea2f79be1734a.tar
gsoc2013-evolution-ab7c700749f00c81fb6ceb56ec2ea2f79be1734a.tar.gz
gsoc2013-evolution-ab7c700749f00c81fb6ceb56ec2ea2f79be1734a.tar.bz2
gsoc2013-evolution-ab7c700749f00c81fb6ceb56ec2ea2f79be1734a.tar.lz
gsoc2013-evolution-ab7c700749f00c81fb6ceb56ec2ea2f79be1734a.tar.xz
gsoc2013-evolution-ab7c700749f00c81fb6ceb56ec2ea2f79be1734a.tar.zst
gsoc2013-evolution-ab7c700749f00c81fb6ceb56ec2ea2f79be1734a.zip
Intercept the Disconnected signal and setup a timeout to try and reconnect
2006-04-18 Jeffrey Stedfast <fejj@novell.com> * e-shell-nm.c (e_shell_network_monitor): Intercept the Disconnected signal and setup a timeout to try and reconnect when the dbus daemon comes back up. svn path=/trunk/; revision=31828
-rw-r--r--shell/ChangeLog94
-rw-r--r--shell/e-shell-nm.c105
2 files changed, 121 insertions, 78 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 3b79d33599..4a87fb5467 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,9 @@
+2006-04-18 Jeffrey Stedfast <fejj@novell.com>
+
+ * e-shell-nm.c (e_shell_network_monitor): Intercept the
+ Disconnected signal and setup a timeout to try and reconnect when
+ the dbus daemon comes back up.
+
2006-02-21 Tor Lillqvist <tml@novell.com>
* main.c (main): On Win32, finally call link_shutdown() (from
@@ -74,10 +80,9 @@
2006-01-02 Harish Krishnaswamy <kharish@novell.com>
- * e-shell-nm-glib.c: (e_shell_nm_glib_initialise):
- Remove suspicious and possibly redundant
- register/unregister calls. Fixes #325364 (critical
- warning crasher).
+ * e-shell-nm-glib.c (e_shell_nm_glib_initialise): Remove
+ suspicious and possibly redundant register/unregister calls. Fixes
+ #325364 (critical warning crasher).
2005-12-30 Andre Klapper <a9016009@gmx.de>
@@ -104,7 +109,6 @@
* shell.error.xml: fixed two dead links to "support.ximian.com" now to
the (yet to come) FAQ at go-evolution.org. (#315866)
-
2005-12-22 Parthasarathi Susarla <sparthasarathi@novell.com>
* Evolution-Component.idl
@@ -148,44 +152,44 @@
e_shell_go_online.
2005-12-21 Not Zed <NotZed@Ximian.com>
-
- * e-shell-view.c (impl_ShellView_setTitle): take a component id
- argument.
-
- * e-shell-window.c (component_view_free): release the corba object
- properly.
- (e_shell_window_set_title): new helper to set the title for the
- component.
- (switch_view): use the component specific title if available or
- fallback to the component name.
-
+
+ * e-shell-view.c (impl_ShellView_setTitle): take a component id
+ argument.
+
+ * e-shell-window.c (component_view_free): release the corba object
+ properly.
+ (e_shell_window_set_title): new helper to set the title for the
+ component.
+ (switch_view): use the component specific title if available or
+ fallback to the component name.
+
2004-12-21 Not Zed <NotZed@Ximian.com>
-
- ** See bug #60354.
-
- * Evolution-Component.idl: createControls -> createView and
- ComponentView to keep track of things.
-
- * Evolution-Shell.idl: return a new type ShellView from
- createNewWindow so other parts of the system can access it later.
- ShellView so far just lets you set title or switch component, but
- could be subclassed later.
-
- * e-shell.c (impl_Shell_createNewWindow): return a shell view.
-
- * e-shell-window.c (init_view): create the view from the compnent
- first, then get the controls from it separately.
- (init): setup the e-shell-view object for the create view
- thing.
-
- * e-shell-view.c (e_shell_view_new): simple bonobo object for
- Evolution_ShellView, keep track of the EShellWindow.
-
- * e-component-view.[ch]: simple bonobo object for
- Evolution_ComponentView. Just keep track of the controls.
+
+ ** See bug #60354.
+
+ * Evolution-Component.idl: createControls -> createView and
+ ComponentView to keep track of things.
+
+ * Evolution-Shell.idl: return a new type ShellView from
+ createNewWindow so other parts of the system can access it later.
+ ShellView so far just lets you set title or switch component, but
+ could be subclassed later.
+
+ * e-shell.c (impl_Shell_createNewWindow): return a shell view.
+
+ * e-shell-window.c (init_view): create the view from the compnent
+ first, then get the controls from it separately.
+ (init): setup the e-shell-view object for the create view
+ thing.
+
+ * e-shell-view.c (e_shell_view_new): simple bonobo object for
+ Evolution_ShellView, keep track of the EShellWindow.
+
+ * e-component-view.[ch]: simple bonobo object for
+ Evolution_ComponentView. Just keep track of the controls.
Committed on behalf of NotZed - partha
-
+
2005-12-17 Tor Lillqvist <tml@novell.com>
* e-config-upgrade.c: Use libedataserver's e_xml_parse_file()
@@ -233,16 +237,16 @@
solves bug # 307780
- * e-shell-window.h : added the prototype for the function
+ * e-shell-window.h: added the prototype for the function
e_shell_window_peek_statusbar(..);
-
- * e-shell-window.c : show/hide the status bar widget based on the saved
+
+ * e-shell-window.c: show/hide the status bar widget based on the saved
property.
retreive the status bar's previous status and set in UI.
define the function e_shell_window_peek_statusbar() which retrieves
the status bar widget for e-shell-window-commands.c
-
- * e-shell-window-commands.c : view_statusbar_item_toggled_handler()
+
+ * e-shell-window-commands.c: view_statusbar_item_toggled_handler()
is the component listener for the "View Status Bar" menu item.it
handles the click event in the menu item "View status Bar".The
state of the status bar is also saved every time an event occurs
diff --git a/shell/e-shell-nm.c b/shell/e-shell-nm.c
index 1ce00eb594..8ec467ebf7 100644
--- a/shell/e-shell-nm.c
+++ b/shell/e-shell-nm.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Shreyas Srinivasan <sshreyas@novell.com>
*
@@ -33,19 +34,31 @@
#include <dbus/dbus-glib.h>
#include <NetworkManager/NetworkManager.h>
-int shell_dbus_initialize (EShellWindow *window);
+typedef enum _ShellLineStatus {
+ E_SHELL_LINE_DOWN,
+ E_SHELL_LINE_UP
+} ShellLineStatus;
-enum _ShellLineStatus {
- E_SHELL_LINE_DOWN,
- E_SHELL_LINE_UP
-};
+static gboolean init_dbus (EShellWindow *window);
-typedef enum _ShellLineStatus ShellLineStatus;
+static DBusConnection *dbus_connection = NULL;
-static DBusHandlerResult e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED,
- DBusMessage *message,
- void* user_data)
+
+static gboolean
+reinit_dbus (gpointer user_data)
+{
+ if (init_dbus (user_data))
+ return FALSE;
+
+ /* keep trying to re-establish dbus connection */
+
+ return TRUE;
+}
+
+static DBusHandlerResult
+e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED,
+ DBusMessage *message, void *user_data)
{
DBusError error;
const char *object;
@@ -57,21 +70,30 @@ static DBusHandlerResult e_shell_network_monitor (DBusConnection *connection G_G
dbus_error_init (&error);
object = dbus_message_get_path (message);
-
+
+ if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected") &&
+ strcmp (dbus_message_get_path (message), DBUS_PATH_LOCAL) == 0) {
+ dbus_connection_unref (dbus_connection);
+ dbus_connection = NULL;
+
+ g_timeout_add (3000, reinit_dbus, window);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive"))
- status = E_SHELL_LINE_DOWN;
+ status = E_SHELL_LINE_DOWN;
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive"))
- status = E_SHELL_LINE_UP;
- else
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ status = E_SHELL_LINE_UP;
+ else
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
if (!dbus_message_get_args (message, &error, DBUS_TYPE_OBJECT_PATH,
- &object, DBUS_TYPE_INVALID))
+ &object, DBUS_TYPE_INVALID))
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) {
shell_state = GNOME_Evolution_FORCED_OFFLINE;
e_shell_go_offline (shell, window, shell_state);
@@ -79,38 +101,55 @@ static DBusHandlerResult e_shell_network_monitor (DBusConnection *connection G_G
shell_state = GNOME_Evolution_USER_ONLINE;
e_shell_go_online (shell, window, shell_state);
}
-
+
return DBUS_HANDLER_RESULT_HANDLED;
}
-int e_shell_dbus_initialise (EShellWindow *window)
+static gboolean
+init_dbus (EShellWindow *window)
{
- DBusConnection *connection;
DBusError error;
- g_type_init ();
-
+ if (dbus_connection != NULL)
+ return TRUE;
+
dbus_error_init (&error);
- connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
- if (connection == NULL) {
+ if (!(dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error))) {
+ g_warning ("could not get system bus: %s\n", error.message);
dbus_error_free (&error);
return FALSE;
}
-
- dbus_connection_setup_with_g_main (connection, NULL);
-
- if (!dbus_connection_add_filter (connection, e_shell_network_monitor, window, NULL))
- return FALSE;
-
- dbus_bus_add_match (connection,
+
+ 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))
+ goto exception;
+
+ dbus_bus_add_match (dbus_connection,
"type='signal',"
"interface='" NM_DBUS_INTERFACE "',"
"sender='" NM_DBUS_SERVICE "',"
"path='" NM_DBUS_PATH "'", &error);
if (dbus_error_is_set (&error)) {
dbus_error_free (&error);
- return FALSE;
+ goto exception;
}
-
+
return TRUE;
+
+ exception:
+
+ dbus_connection_unref (dbus_connection);
+ dbus_connection = NULL;
+
+ return FALSE;
+}
+
+
+int e_shell_dbus_initialise (EShellWindow *window)
+{
+ g_type_init ();
+
+ return init_dbus (window);
}