aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-10-06 02:44:56 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-10-06 02:44:56 +0800
commit081bd4e3228f99ae3149fa5631fab41038b5d56c (patch)
treeec76bd71ac6cb5b8e933b0bbfcaaed7bdded1ec0
parente95a0b6c8bac715a505f4ebfa15450fe98a15326 (diff)
downloadgsoc2013-evolution-081bd4e3228f99ae3149fa5631fab41038b5d56c.tar
gsoc2013-evolution-081bd4e3228f99ae3149fa5631fab41038b5d56c.tar.gz
gsoc2013-evolution-081bd4e3228f99ae3149fa5631fab41038b5d56c.tar.bz2
gsoc2013-evolution-081bd4e3228f99ae3149fa5631fab41038b5d56c.tar.lz
gsoc2013-evolution-081bd4e3228f99ae3149fa5631fab41038b5d56c.tar.xz
gsoc2013-evolution-081bd4e3228f99ae3149fa5631fab41038b5d56c.tar.zst
gsoc2013-evolution-081bd4e3228f99ae3149fa5631fab41038b5d56c.zip
New member `ping_timeout_id' in `EvolutionShellComponentPrivate'.
* evolution-shell-component.c: New member `ping_timeout_id' in `EvolutionShellComponentPrivate'. (setup_owner_pinging): New helper function. (impl_owner_died): Unref the owner and set ->owner_client to %NULL. (impl_setOwner): Don't unref here. (destroy): Remove the source for ->ping_timeout_id if not -1. svn path=/trunk/; revision=13451
-rw-r--r--shell/ChangeLog10
-rw-r--r--shell/evolution-shell-component.c70
2 files changed, 77 insertions, 3 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 8ecf5a92f6..fb3a22e426 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,15 @@
2001-10-05 Ettore Perazzoli <ettore@ximian.com>
+ * evolution-shell-component.c: New member `ping_timeout_id' in
+ `EvolutionShellComponentPrivate'.
+ (setup_owner_pinging): New helper function.
+ (impl_owner_died): Unref the owner and set ->owner_client to
+ %NULL.
+ (impl_setOwner): Don't unref here.
+ (destroy): Remove the source for ->ping_timeout_id if not -1.
+
+2001-10-05 Ettore Perazzoli <ettore@ximian.com>
+
* main.c: #include "e-util/e-gtk-utils.h".
(quit_box_new): Queue a draw on the window; otherwise it seems to
fail to redraw in some cases for some reason [see #11412].
diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c
index 72ea36143b..793e579732 100644
--- a/shell/evolution-shell-component.c
+++ b/shell/evolution-shell-component.c
@@ -39,6 +39,9 @@
#include "Evolution.h"
+#define PING_DELAY 10000
+
+
#define PARENT_TYPE BONOBO_X_OBJECT_TYPE
static GtkObjectClass *parent_class = NULL;
@@ -66,6 +69,8 @@ struct _EvolutionShellComponentPrivate {
GSList *user_creatable_item_types; /* UserCreatableItemType */
+ int ping_timeout_id;
+
void *closure;
};
@@ -167,6 +172,54 @@ fill_corba_sequence_from_null_terminated_string_array (CORBA_sequence_CORBA_stri
}
+/* Owner pinging. */
+
+static gboolean
+owner_ping_callback (void *data)
+{
+ EvolutionShellComponent *shell_component;
+ EvolutionShellComponentPrivate *priv;
+ Bonobo_Unknown owner_objref;
+ gboolean alive;
+
+ shell_component = EVOLUTION_SHELL_COMPONENT (data);
+ priv = shell_component->priv;
+
+ owner_objref = bonobo_object_corba_objref (BONOBO_OBJECT (priv->owner_client));
+
+ if (owner_objref == CORBA_OBJECT_NIL)
+ return FALSE;
+
+ g_print ("Pinging shell...\n");
+
+ alive = bonobo_unknown_ping (owner_objref);
+ if (alive) {
+ g_print ("\tSuccess\n");
+ return TRUE;
+ }
+
+ g_print ("\t*** Shell is dead\n");
+ gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_DIED]);
+
+ priv->ping_timeout_id = -1;
+
+ return FALSE;
+}
+
+static void
+setup_owner_pinging (EvolutionShellComponent *shell_component)
+{
+ EvolutionShellComponentPrivate *priv;
+
+ priv = shell_component->priv;
+
+ if (priv->ping_timeout_id != -1)
+ g_source_remove (priv->ping_timeout_id);
+
+ priv->ping_timeout_id = g_timeout_add (PING_DELAY, owner_ping_callback, shell_component);
+}
+
+
/* CORBA interface implementation. */
static GNOME_Evolution_FolderTypeList *
@@ -320,9 +373,6 @@ impl_setOwner (PortableServer_Servant servant,
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_ShellComponent_OldOwnerHasDied, NULL);
- bonobo_object_unref (BONOBO_OBJECT (priv->owner_client));
- priv->owner_client = NULL;
-
gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_DIED]);
}
@@ -334,6 +384,8 @@ impl_setOwner (PortableServer_Servant servant,
if (ev->_major == CORBA_NO_EXCEPTION) {
priv->owner_client = evolution_shell_client_new (shell_duplicate);
gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_SET], priv->owner_client, evolution_homedir);
+
+ setup_owner_pinging (shell_component);
}
}
@@ -584,6 +636,9 @@ destroy (GtkObject *object)
priv = shell_component->priv;
+ if (priv->ping_timeout_id != -1)
+ g_source_remove (priv->ping_timeout_id);
+
CORBA_exception_init (&ev);
if (priv->owner_client != NULL)
@@ -622,6 +677,13 @@ destroy (GtkObject *object)
static void
impl_owner_died (EvolutionShellComponent *shell_component)
{
+ EvolutionShellComponentPrivate *priv;
+
+ priv = shell_component->priv;
+
+ bonobo_object_unref (BONOBO_OBJECT (priv->owner_client));
+ priv->owner_client = NULL;
+
/* The default implementation for ::owner_died emits ::owner_unset, so
that we make the behavior for old components kind of correct without
even if they don't handle the new ::owner_died signal correctly
@@ -738,6 +800,8 @@ init (EvolutionShellComponent *shell_component)
priv->user_creatable_item_types = NULL;
priv->closure = NULL;
+ priv->ping_timeout_id = -1;
+
shell_component->priv = priv;
}