aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-offline-handler.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-10-27 07:14:46 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-10-27 07:14:46 +0800
commitc944779866017804bbeb94f9c81af4ffa0eef3ba (patch)
tree60afd9a6a15df7367ede23bb27bdbd48549d913c /shell/e-shell-offline-handler.c
parent4d55b72adae439372f1d939937e9976c7221ca87 (diff)
downloadgsoc2013-evolution-c944779866017804bbeb94f9c81af4ffa0eef3ba.tar
gsoc2013-evolution-c944779866017804bbeb94f9c81af4ffa0eef3ba.tar.gz
gsoc2013-evolution-c944779866017804bbeb94f9c81af4ffa0eef3ba.tar.bz2
gsoc2013-evolution-c944779866017804bbeb94f9c81af4ffa0eef3ba.tar.lz
gsoc2013-evolution-c944779866017804bbeb94f9c81af4ffa0eef3ba.tar.xz
gsoc2013-evolution-c944779866017804bbeb94f9c81af4ffa0eef3ba.tar.zst
gsoc2013-evolution-c944779866017804bbeb94f9c81af4ffa0eef3ba.zip
New member `finished' in `EShellOfflineHandlerPrivate'.
* e-shell-offline-handler.c: New member `finished' in `EShellOfflineHandlerPrivate'. (finalize_offline): Ref the handler as we might get destroyed while putting every component offline. (impl_OfflineProgressListener_updateProgress): Don't emit ::offline_procedure_finished if ->finished is %TRUE. Also, set it to %TRUE after emitting the signal. (cancel_offline): Likewise. (finalize_offline): Likewise. (update_dialog_clist): Guard against NULL ->dialog_gui. svn path=/trunk/; revision=14182
Diffstat (limited to 'shell/e-shell-offline-handler.c')
-rw-r--r--shell/e-shell-offline-handler.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/shell/e-shell-offline-handler.c b/shell/e-shell-offline-handler.c
index bd7f450780..6e02bc2104 100644
--- a/shell/e-shell-offline-handler.c
+++ b/shell/e-shell-offline-handler.c
@@ -90,7 +90,8 @@ struct _EShellOfflineHandlerPrivate {
int num_total_connections;
GHashTable *id_to_component_info;
- gboolean procedure_in_progress : 1;
+ int procedure_in_progress : 1;
+ int finished : 1;
};
@@ -206,8 +207,10 @@ impl_OfflineProgressListener_updateProgress (PortableServer_Servant servant,
update_dialog_clist (offline_handler);
- if (priv->num_total_connections == 0)
+ if (priv->num_total_connections == 0 && ! priv->finished) {
gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_FINISHED], TRUE);
+ priv->finished = TRUE;
+ }
}
static gboolean
@@ -362,7 +365,10 @@ cancel_offline (EShellOfflineHandler *offline_handler)
priv->num_total_connections = 0;
- gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_FINISHED], FALSE);
+ if (! priv->finished) {
+ gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_FINISHED], FALSE);
+ priv->finished = TRUE;
+ }
}
@@ -432,6 +438,8 @@ prepare_for_offline (EShellOfflineHandler *offline_handler)
g_assert (g_hash_table_lookup (priv->id_to_component_info, component_info->id) == NULL);
g_hash_table_insert (priv->id_to_component_info, component_info->id, component_info);
+
+ g_print ("Inserting -- %p %s\n", component_info, component_info->id);
}
/* If an error occurred while preparing, just put all the components
@@ -464,6 +472,8 @@ finalize_offline_hash_foreach (void *key,
CORBA_exception_init (&ev);
+ g_print ("Offline -- %p\n", component_info);
+
GNOME_Evolution_Offline_goOffline (component_info->offline_interface,
component_info->progress_listener_interface,
&ev);
@@ -484,12 +494,17 @@ finalize_offline (EShellOfflineHandler *offline_handler)
priv = offline_handler->priv;
+ gtk_object_ref (GTK_OBJECT (offline_handler));
+
g_hash_table_foreach (priv->id_to_component_info, finalize_offline_hash_foreach, offline_handler);
- if (priv->num_total_connections == 0) {
+ if (priv->num_total_connections == 0 && ! priv->finished) {
/* Nothing else to do, we are all set. */
gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_FINISHED], TRUE);
+ priv->finished = TRUE;
}
+
+ gtk_object_unref (GTK_OBJECT (offline_handler));
}
@@ -528,6 +543,8 @@ update_dialog_clist (EShellOfflineHandler *offline_handler)
GtkWidget *clist;
priv = offline_handler->priv;
+ if (priv->dialog_gui == NULL)
+ return;
clist = glade_xml_get_widget (priv->dialog_gui, "active_connection_clist");
@@ -719,6 +736,7 @@ init (EShellOfflineHandler *shell_offline_handler)
priv->id_to_component_info = g_hash_table_new (g_str_hash, g_str_equal);
priv->procedure_in_progress = FALSE;
+ priv->finished = FALSE;
shell_offline_handler->priv = priv;
}
@@ -805,10 +823,13 @@ e_shell_offline_handler_put_components_offline (EShellOfflineHandler *offline_ha
gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_STARTED]);
+ priv->finished = FALSE;
+
if (! prepare_for_offline (offline_handler)) {
/* FIXME: Maybe do something smarter here. */
g_warning ("Couldn't put components off-line");
gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_FINISHED], FALSE);
+ priv->finished = TRUE;
gtk_object_unref (GTK_OBJECT (offline_handler));
return;
}