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
This commit is contained in:
@ -1,3 +1,13 @@
|
|||||||
|
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>
|
2001-10-05 Ettore Perazzoli <ettore@ximian.com>
|
||||||
|
|
||||||
* main.c: #include "e-util/e-gtk-utils.h".
|
* main.c: #include "e-util/e-gtk-utils.h".
|
||||||
|
@ -38,6 +38,9 @@
|
|||||||
|
|
||||||
#include "Evolution.h"
|
#include "Evolution.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define PING_DELAY 10000
|
||||||
|
|
||||||
|
|
||||||
#define PARENT_TYPE BONOBO_X_OBJECT_TYPE
|
#define PARENT_TYPE BONOBO_X_OBJECT_TYPE
|
||||||
|
|
||||||
@ -66,6 +69,8 @@ struct _EvolutionShellComponentPrivate {
|
|||||||
|
|
||||||
GSList *user_creatable_item_types; /* UserCreatableItemType */
|
GSList *user_creatable_item_types; /* UserCreatableItemType */
|
||||||
|
|
||||||
|
int ping_timeout_id;
|
||||||
|
|
||||||
void *closure;
|
void *closure;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -166,6 +171,54 @@ fill_corba_sequence_from_null_terminated_string_array (CORBA_sequence_CORBA_stri
|
|||||||
corba_sequence->_buffer[i] = CORBA_string_dup (array[i]);
|
corba_sequence->_buffer[i] = CORBA_string_dup (array[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 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. */
|
/* CORBA interface implementation. */
|
||||||
|
|
||||||
@ -320,9 +373,6 @@ impl_setOwner (PortableServer_Servant servant,
|
|||||||
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
|
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
|
||||||
ex_GNOME_Evolution_ShellComponent_OldOwnerHasDied, NULL);
|
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]);
|
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) {
|
if (ev->_major == CORBA_NO_EXCEPTION) {
|
||||||
priv->owner_client = evolution_shell_client_new (shell_duplicate);
|
priv->owner_client = evolution_shell_client_new (shell_duplicate);
|
||||||
gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_SET], priv->owner_client, evolution_homedir);
|
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;
|
priv = shell_component->priv;
|
||||||
|
|
||||||
|
if (priv->ping_timeout_id != -1)
|
||||||
|
g_source_remove (priv->ping_timeout_id);
|
||||||
|
|
||||||
CORBA_exception_init (&ev);
|
CORBA_exception_init (&ev);
|
||||||
|
|
||||||
if (priv->owner_client != NULL)
|
if (priv->owner_client != NULL)
|
||||||
@ -622,6 +677,13 @@ destroy (GtkObject *object)
|
|||||||
static void
|
static void
|
||||||
impl_owner_died (EvolutionShellComponent *shell_component)
|
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
|
/* The default implementation for ::owner_died emits ::owner_unset, so
|
||||||
that we make the behavior for old components kind of correct without
|
that we make the behavior for old components kind of correct without
|
||||||
even if they don't handle the new ::owner_died signal correctly
|
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->user_creatable_item_types = NULL;
|
||||||
priv->closure = NULL;
|
priv->closure = NULL;
|
||||||
|
|
||||||
|
priv->ping_timeout_id = -1;
|
||||||
|
|
||||||
shell_component->priv = priv;
|
shell_component->priv = priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user