[evolution-patches] (Mail) Modified patch for 73341



http://bugzilla.ximian.com/show_bug.cgi?id=73341

A slighly modified patch attached.
Thanks
Madhan Raj
Index: em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.111
diff -u -p -r1.111 em-folder-view.c
--- em-folder-view.c	17 Mar 2005 02:18:01 -0000	1.111
+++ em-folder-view.c	23 Mar 2005 02:58:40 -0000
@@ -135,6 +135,7 @@ struct _EMFolderViewPrivate {
 	guint selected_id;
 	int nomarkseen:1;
 	int destroyed:1;
+	int event_hooked:1;
 
 	GtkWidget *invisible;
 	char *selection_uri;
@@ -158,6 +159,7 @@ static guint signals[LAST_SIGNAL];
 
 static void emfv_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, EMFolderView *emfv);
 static void emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolderView *emfv);
+static void emfv_change_signal_emit_cb (CamelObject *o, void *event_data, void *data);
 
 static void
 emfv_init(GObject *o)
@@ -170,6 +172,7 @@ emfv_init(GObject *o)
 
 	p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate));
 
+	p->event_hooked = FALSE;
 	emfv->statusbar_active = TRUE;
 	emfv->list_active = FALSE;
 	
@@ -242,6 +245,13 @@ emfv_destroy (GtkObject *o)
 	}
 
 	if (emfv->folder) {
+		if (p->event_hooked) {
+			camel_object_unhook_event (emfv->folder->parent_store, "folder_deleted",
+							(CamelObjectEventHookFunc) emfv_change_signal_emit_cb, emfv);
+			camel_object_unhook_event (emfv->folder->parent_store, "folder_renamed",
+							(CamelObjectEventHookFunc) emfv_change_signal_emit_cb, emfv);
+			p->event_hooked = FALSE;
+		}
 		camel_object_unref(emfv->folder);
 		g_free(emfv->folder_uri);
 		emfv->folder = NULL;
@@ -582,6 +592,15 @@ emfv_set_folder(EMFolderView *emfv, Came
 		emfv->hide_deleted = emfv->list->hidedeleted; /* <- a bit nasty but makes it track the display better */
 		mail_sync_folder (emfv->folder, NULL, NULL);
 		camel_object_unref(emfv->folder);
+
+		if (!emfv->priv->event_hooked) {
+			camel_object_hook_event (emfv->folder->parent_store, "folder_deleted",
+                        				(CamelObjectEventHookFunc) emfv_change_signal_emit_cb, emfv);
+			camel_object_hook_event (emfv->folder->parent_store, "folder_renamed",
+                        				(CamelObjectEventHookFunc) emfv_change_signal_emit_cb, emfv);
+			emfv->priv->event_hooked = TRUE;
+               }
+
 	}
 
 	emfv->folder = folder;
@@ -646,6 +665,13 @@ emfv_selection_clear_event(GtkWidget *wi
 #endif
 }
 
+static void
+emfv_change_signal_emit_cb (CamelObject *o, void *event_data, void *data)
+{
+       EMFolderView *emfv = data;
+       g_signal_emit (emfv, signals[EMFV_CHANGED], 0);
+}
+ 
 /* ********************************************************************** */
 
 /* Popup menu
Index: mail-component.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-component.c,v
retrieving revision 1.110
diff -u -p -r1.110 mail-component.c
--- mail-component.c	17 Mar 2005 01:51:12 -0000	1.110
+++ mail-component.c	23 Mar 2005 02:59:55 -0000
@@ -549,8 +549,16 @@ view_changed_cb(EMFolderView *emfv, EInf
 		    && (!strcmp (name, "Drafts") || !strcmp (name, "Inbox")
 			|| !strcmp (name, "Outbox") || !strcmp (name, "Sent")))
 			e_info_label_set_info(el, _(name), tmp->str);
-		else
-			e_info_label_set_info(el, name, tmp->str);
+		else {
+			if (!camel_store_get_folder_info (emfv->folder->parent_store, emfv->folder->full_name,
+                                        CAMEL_STORE_FOLDER_INFO_FAST, NULL) && !CAMEL_IS_VTRASH_FOLDER(emfv->folder)) {
+                        	/* Folder has been deleted */
+                       		e_info_label_set_info(el, _("Mail"), "");
+                	} else {
+				e_info_label_set_info(el, name, tmp->str);
+			}
+		}
+		
 		g_string_free(tmp, TRUE);
 		camel_object_free(emfv->folder, CAMEL_FOLDER_NAME, name);
 	} else {
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3610
diff -u -p -r1.3610 ChangeLog
--- ChangeLog	17 Mar 2005 19:00:00 -0000	1.3610
+++ ChangeLog	23 Mar 2005 03:01:23 -0000
@@ -1,3 +1,14 @@
+2005-03-23  Madhan Raj	<madanraj gmail com>
+
+	* em-folder-view.c (_EMFolderViewPrivate): event_hooked to
+	keep track of the events that was hooked.
+	(emfv_change_signal_emit_cb): New function to 
+	emit change signal when a folder is renamed or deleted.
+	(emfv_set_folder): Hooked the event
+	(emfv_destroy): Unhooked the event
+	* mail-component.c (view_changed_cb): If the folder is deleted
+	display the default label in the top pane.
+
 2005-03-16  Jeffrey Stedfast  <fejj novell com>
 
 	* em-format-html.c (efh_format_headers): Don't show multiple


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]