Hey,

The patch fixes a couple of issues related to Offline mode ( providers
which use Camel Offline Store ) and also removes the "Going Offline"
dialog as that blocks other operations while connections are being
dropped. The state change is being effectively handled by the offline/
online toggle icon which listens to the state change progress.  

Cheers,
Shreyas
--- ChangeLog	2005-05-03 16:08:35.000000000 +0530
+++ ChangeLog	2005-05-06 15:51:48.000000000 +0530
@@ -1,4 +1,11 @@
+2005-05-06  Shreyas Srinivasan	<[EMAIL PROTECTED]>
+
+	* Fixes bug #273868, #300113, #302831.
+	
+	* mail-offline-handler.c : Add check for Camel Offline
+	store check to is_service_relevant.
+
 2005-05-03  Radek Doulik  <[EMAIL PROTECTED]>
 
 	* em-format-html-display.c: removed include of htmlinterval.h as
--- mail-offline-handler.c	2004-03-17 15:33:58.000000000 +0530
+++ mail-offline-handler.c	2005-05-06 15:19:53.000000000 +0530
@@ -33,6 +33,7 @@
 #include "em-folder-tree.h"
 
 #include <camel/camel-disco-store.h>
+#include <camel/camel-offline-store.h>
 #include "mail-session.h"
 
 #include <gtk/gtkmain.h>
@@ -56,8 +57,10 @@ service_is_relevant (CamelService *servi
 	if (CAMEL_IS_DISCO_STORE (service) &&
 	    camel_disco_store_status (CAMEL_DISCO_STORE (service)) == CAMEL_DISCO_STORE_OFFLINE)
 			return !going_offline;
-
+	else if ( CAMEL_IS_OFFLINE_STORE (service) && 
+		  CAMEL_OFFLINE_STORE ( service )->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL )
+				return !going_offline;
 	return service->status != CAMEL_SERVICE_DISCONNECTED;
 }
 
--- ChangeLog	2005-05-02 15:33:29.000000000 +0530
+++ ChangeLog	2005-05-06 15:56:25.000000000 +0530
@@ -1,4 +1,8 @@
+2005-05-06  Shreyas Srinivasan	<[EMAIL PROTECTED]>
+
+	* e-shell-offline-handler.c: Remove the go->offline dialog.
+	
 2005-05-02  JP Rosevear  <[EMAIL PROTECTED]>
 
 	* Evolution.idl: remove Evolution-common.idl
--- e-shell-offline-handler.c	2005-01-21 21:31:54.000000000 +0530
+++ e-shell-offline-handler.c	2005-05-06 15:37:58.000000000 +0530
@@ -86,10 +86,6 @@ typedef struct _ComponentInfo ComponentI
 struct _EShellOfflineHandlerPrivate {
 	EShell *shell;
 
-	GtkWindow *parent_window;
-
-	GladeXML *dialog_gui;
-
 	int num_total_connections;
 	GHashTable *id_to_component_info;
 
@@ -209,8 +205,6 @@ impl_OfflineProgressListener_updateProgr
 	CORBA_free (component_info->active_connection_list);
 	component_info->active_connection_list = duplicate_connection_list (current_active_connections);
 
-	update_dialog_clist (offline_handler);
-
 	if (priv->num_total_connections == 0 && ! priv->finished) {
 		priv->finished = TRUE;
 		g_signal_emit (offline_handler, signals[OFFLINE_PROCEDURE_FINISHED], 0, TRUE);
@@ -543,128 +537,6 @@ update_dialog_tree_view_hash_foreach (vo
 	}
 }
 
-static void
-update_dialog_clist (EShellOfflineHandler *offline_handler)
-{
-	EShellOfflineHandlerPrivate *priv;
-	GtkWidget *tree_view;
-	GtkListStore *model;
-	GtkCellRenderer *renderer;
-	GtkTreeViewColumn *column;
-
-	priv = offline_handler->priv;
-	if (priv->dialog_gui == NULL)
-		return;
-
-        tree_view = glade_xml_get_widget (priv->dialog_gui, "active_connection_treeview");
-	g_assert (GTK_IS_TREE_VIEW (tree_view));
-
-	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
-
-	renderer = gtk_cell_renderer_text_new ();
-	column = gtk_tree_view_column_new_with_attributes ("Host", renderer, "text", 0, NULL);
-	gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
-
-	model = gtk_list_store_new (1, G_TYPE_STRING);
-	g_hash_table_foreach (priv->id_to_component_info, update_dialog_tree_view_hash_foreach, model);
-
-	gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL(model));
-}
-
-static void
-dialog_handle_ok (GtkDialog *dialog,
-		  EShellOfflineHandler *offline_handler)
-{
-	EShellOfflineHandlerPrivate *priv;
-	GtkWidget *instruction_label;
-
-	priv = offline_handler->priv;
-
-	gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, FALSE);
-
-	instruction_label = glade_xml_get_widget (priv->dialog_gui, "instruction_label");
-	g_assert (instruction_label != NULL);
-	g_assert (GTK_IS_LABEL (instruction_label));
-
-	gtk_label_set_text (GTK_LABEL (instruction_label), _("Closing connections..."));
-
-	finalize_offline (offline_handler);
-}
-
-static void
-dialog_handle_cancel (GtkDialog *dialog,
-		      EShellOfflineHandler *offline_handler)
-{
-	EShellOfflineHandlerPrivate *priv;
-
-	priv = offline_handler->priv;
-
-	gtk_widget_destroy (GTK_WIDGET (dialog));
-
-	g_object_unref (priv->dialog_gui);
-	priv->dialog_gui = NULL;
-
-	cancel_offline (offline_handler);
-}
-
-static void
-dialog_response_cb (GtkDialog *dialog,
-		    int response_id,
-		    void *data)
-{
-	EShellOfflineHandler *offline_handler;
-
-	offline_handler = E_SHELL_OFFLINE_HANDLER (data);
-
-	switch (response_id) {
-	case GTK_RESPONSE_OK:
-		dialog_handle_ok (dialog, offline_handler);
-		break;
-
-	case GTK_RESPONSE_CANCEL:
-	case GTK_RESPONSE_DELETE_EVENT:
-		dialog_handle_cancel (dialog, offline_handler);
-		break;
-
-	default:
-		g_assert_not_reached ();
-	}
-}
-
-static void
-pop_up_confirmation_dialog (EShellOfflineHandler *offline_handler)
-{
-	EShellOfflineHandlerPrivate *priv;
-	GtkWidget *dialog;
-
-	priv = offline_handler->priv;
-
-	if (priv->dialog_gui == NULL) {
-		priv->dialog_gui = glade_xml_new (GLADE_DIALOG_FILE_NAME, NULL, NULL);
-		if (priv->dialog_gui == NULL) {
-			g_warning ("Cannot load the active connection dialog (installation problem?) -- %s",
-				   GLADE_DIALOG_FILE_NAME);
-			finalize_offline (offline_handler);
-			return;
-		}
-	}
-
-	dialog = glade_xml_get_widget (priv->dialog_gui, "active_connection_dialog");
-	gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
-	gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
-
-	/* FIXME: do we really want this?  */
-	/* gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (priv->parent_shell_view)); */
-	/* gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); */
-
-	update_dialog_clist (offline_handler);
-
-	g_signal_connect (dialog, "response", G_CALLBACK (dialog_response_cb), offline_handler);
-
-	gtk_widget_show (dialog);
-}
-
-
 /* GObject methods.  */
 
 static void
@@ -684,16 +556,6 @@ impl_dispose (GObject *object)
 		priv->id_to_component_info = NULL;
 	}
 
-	if (priv->dialog_gui != NULL) {
-		GtkWidget *dialog;
-
-		dialog = glade_xml_get_widget (priv->dialog_gui, "active_connection_dialog");
-		gtk_widget_destroy (dialog);
-
-		g_object_unref (priv->dialog_gui);
-		priv->dialog_gui = NULL;
-	}
-
 	(* G_OBJECT_CLASS (e_shell_offline_handler_parent_class)->dispose) (object);
 }
 
@@ -752,9 +614,6 @@ e_shell_offline_handler_init (EShellOffl
 	priv = g_new (EShellOfflineHandlerPrivate, 1);
 
 	priv->shell                 = NULL;
-	priv->parent_window         = NULL;
-
-	priv->dialog_gui            = NULL;
 
 	priv->num_total_connections = 0;
 	priv->id_to_component_info  = g_hash_table_new (g_str_hash, g_str_equal);
@@ -827,12 +686,10 @@ e_shell_offline_handler_put_components_o
 
 	g_return_if_fail (offline_handler != NULL);
 	g_return_if_fail (E_IS_SHELL_OFFLINE_HANDLER (offline_handler));
-	g_return_if_fail (parent_window == NULL || GTK_IS_WINDOW (parent_window));
 
 	priv = offline_handler->priv;
 
 	priv->procedure_in_progress = TRUE;
-	priv->parent_window = parent_window;
 
 	/* Add an extra ref here as the signal handlers might want to unref
 	   us.  */
@@ -852,9 +709,6 @@ e_shell_offline_handler_put_components_o
 		return;
 	}
 
-	if (priv->num_total_connections > 0 && priv->parent_window != NULL)
-		pop_up_confirmation_dialog (offline_handler);
-	else
 		finalize_offline (offline_handler);
 
 	g_object_unref (offline_handler);

Reply via email to