aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2000-12-22 08:29:14 +0800
committerIain Holmes <iain@src.gnome.org>2000-12-22 08:29:14 +0800
commitf803abb65fa8a0d0f5fa82ee95d20d3c0371a627 (patch)
tree459a5c7ce4d45a1d1936e19d3a5b64327edf08b1 /mail
parent6ab7d29c180e2f15da9a0ae1778a29db3715aa4b (diff)
downloadgsoc2013-evolution-f803abb65fa8a0d0f5fa82ee95d20d3c0371a627.tar
gsoc2013-evolution-f803abb65fa8a0d0f5fa82ee95d20d3c0371a627.tar.gz
gsoc2013-evolution-f803abb65fa8a0d0f5fa82ee95d20d3c0371a627.tar.bz2
gsoc2013-evolution-f803abb65fa8a0d0f5fa82ee95d20d3c0371a627.tar.lz
gsoc2013-evolution-f803abb65fa8a0d0f5fa82ee95d20d3c0371a627.tar.xz
gsoc2013-evolution-f803abb65fa8a0d0f5fa82ee95d20d3c0371a627.tar.zst
gsoc2013-evolution-f803abb65fa8a0d0f5fa82ee95d20d3c0371a627.zip
Detect created and deleted vfolders.
svn path=/trunk/; revision=7126
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog14
-rw-r--r--mail/component-factory.c2
-rw-r--r--mail/mail-summary.c87
-rw-r--r--mail/mail-vfolder.c4
4 files changed, 97 insertions, 10 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 4f0bab6887..48570506a0 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,16 @@
+2000-12-21 Iain Holmes <iain@helixcode.com>
+
+ * mail-summary.c: Added code to detect and regenerate the summary
+ when a new vfolder is created or removed.
+
+ * mail-vfolder.c: Export the vfolder_storage variable, so that
+ the summary can add a listener to it.
+
+2000-12-05 Iain Holmes <iain@helixcode.com>
+
+ * component-factory.c (factory_destroy): Wait till all views have
+ gone and then destroy both factories.
+
2000-12-21 Dan Winship <danw@helixcode.com>
* mail-display.c (pixbuf_for_mime_type): Deal with the possibility
@@ -119,7 +132,6 @@
(mail_crypto_openpgp_verify): New openpgp function to verify a
signature.
->>>>>>> 1.789
2000-12-14 Christopher James Lahey <clahey@helixcode.com>
* mail-threads.c (update_active_views): Unref the iterator when
diff --git a/mail/component-factory.c b/mail/component-factory.c
index e67537bb9f..c4abc1ca74 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -169,6 +169,8 @@ idle_quit (gpointer user_data)
if (e_list_length (folder_browser_factory_get_control_list ()))
return TRUE;
+ bonobo_object_unref (BONOBO_OBJECT (summary_factory));
+ bonobo_object_unref (BONOBO_OBJECT (component_factory));
g_hash_table_foreach (storages_hash, free_storage, NULL);
g_hash_table_destroy (storages_hash);
diff --git a/mail/mail-summary.c b/mail/mail-summary.c
index 308a1aa271..89497bccc3 100644
--- a/mail/mail-summary.c
+++ b/mail/mail-summary.c
@@ -38,6 +38,7 @@
#include "Evolution.h"
#include "evolution-storage.h"
+#include "evolution-storage-listener.h"
#include "filter/vfolder-context.h"
@@ -55,6 +56,7 @@ typedef struct {
typedef struct {
BonoboObject *component;
BonoboObject *view;
+ EvolutionStorageListener *listener;
GHashTable *folder_to_summary;
FolderSummary **folders;
@@ -62,6 +64,8 @@ typedef struct {
char *title;
char *icon;
+
+ guint idle;
} MailSummary;
#define SUMMARY_IN() g_print ("IN: %s: %d\n", __FUNCTION__, __LINE__);
@@ -70,6 +74,7 @@ typedef struct {
static int queue_len = 0;
extern char *evolution_dir;
+extern EvolutionStorage *vfolder_storage;
#define MAIN_READER main_compipe[0]
#define MAIN_WRITER main_compipe[1]
@@ -81,7 +86,7 @@ static int dispatch_compipe[2] = {-1, -1};
GIOChannel *summary_chan_reader = NULL;
-static void do_changed (MailSummary *summary);
+static gboolean do_changed (MailSummary *summary);
enum {
PROPERTY_TITLE,
@@ -134,7 +139,6 @@ check_compipes (void)
}
}
-#if 0
static void
folder_free (FolderSummary *folder)
{
@@ -156,8 +160,6 @@ summary_free (MailSummary *summary)
g_free (summary->icon);
g_hash_table_destroy (summary->folder_to_summary);
- bonobo_object_unref (summary->view);
- bonobo_object_unref (summary->component);
}
static void
@@ -167,7 +169,6 @@ view_destroy_cb (GtkObject *object,
summary_free (summary);
g_free (summary);
}
-#endif
static char *
generate_html_summary (MailSummary *summary)
@@ -205,7 +206,7 @@ generate_html_summary (MailSummary *summary)
return ret_html;
}
-static void
+static gboolean
do_changed (MailSummary *summary)
{
char *ret_html;
@@ -213,6 +214,9 @@ do_changed (MailSummary *summary)
ret_html = generate_html_summary (summary);
executive_summary_html_view_set_html(EXECUTIVE_SUMMARY_HTML_VIEW(summary->view), (const char *) ret_html);
g_free (ret_html);
+
+ summary->idle = 0;
+ return TRUE;
}
/* These two callbacks are called from the Camel thread,
@@ -301,6 +305,16 @@ generate_folder_summaries (MailSummary *summary)
numfolders++;
}
+ if (summary->folders != NULL) {
+ int i;
+
+ for (i = 0; i < summary->numfolders; i++){
+ folder_free (summary->folders[i]);
+ }
+
+ g_free (summary->folders);
+ }
+
summary->folders = g_new (FolderSummary *, numfolders);
/* Inbox */
@@ -335,7 +349,7 @@ generate_folder_summaries (MailSummary *summary)
fs->name = g_strdup (rule->name);
uri = g_strconcat ("vfolder:", rule->name, NULL);
- mail_tool_camel_lock_up ();
+/* mail_tool_camel_lock_up (); */
fs->folder = vfolder_uri_to_folder (uri, ex);
fs->uri = g_strconcat ("evolution:/VFolders/", rule->name, NULL);
g_free (uri);
@@ -356,7 +370,7 @@ generate_folder_summaries (MailSummary *summary)
summary->numfolders++;
camel_exception_free (ex);
- mail_tool_camel_lock_down ();
+/* mail_tool_camel_lock_down (); */
}
gtk_object_destroy (GTK_OBJECT (context));
@@ -384,16 +398,51 @@ get_property (BonoboPropertyBag *bag,
}
}
+/* This code may play with the threads wrongly...
+ if the mail component locks when you use the summary
+ remove this define */
+#define DETECT_NEW_VFOLDERS
+#ifdef DETECT_NEW_VFOLDERS
+static void
+new_folder_cb (EvolutionStorageListener *listener,
+ const char *path,
+ const GNOME_Evolution_Folder *folder,
+ MailSummary *summary)
+{
+ generate_folder_summaries (summary);
+ write (MAIN_WRITER, summary, sizeof (MailSummary));
+ queue_len++;
+
+ g_print ("New folder: %s\n", path);
+}
+
+static void
+removed_folder_cb (EvolutionStorageListener *listener,
+ const char *path,
+ MailSummary *summary)
+{
+ generate_folder_summaries (summary);
+ write (MAIN_WRITER, summary, sizeof (MailSummary));
+ queue_len++;
+
+ g_print ("Removed folder: %s\n", path);
+}
+#endif
+
BonoboObject *
create_summary_view (ExecutiveSummaryComponentFactory *_factory,
void *closure)
{
+ GNOME_Evolution_Storage *corba_local_objref;
+ GNOME_Evolution_StorageListener *corba_object;
+ CORBA_Environment ev;
BonoboObject *component, *view;
BonoboPropertyBag *bag;
char *html;
MailSummary *summary;
summary = g_new (MailSummary, 1);
+ summary->folders = 0;
summary->folder_to_summary = g_hash_table_new (NULL, NULL);
summary->title = g_strdup ("Mail Summary");
summary->icon = g_strdup ("envelope.png");
@@ -412,6 +461,8 @@ create_summary_view (ExecutiveSummaryComponentFactory *_factory,
html);
bonobo_object_add_interface (component, view);
summary->view = view;
+ gtk_signal_connect (GTK_OBJECT (view), "destroy",
+ GTK_SIGNAL_FUNC (view_destroy_cb), summary);
bag = bonobo_property_bag_new (get_property, NULL, summary);
bonobo_property_bag_add (bag,
@@ -427,5 +478,25 @@ create_summary_view (ExecutiveSummaryComponentFactory *_factory,
bonobo_object_add_interface (component, BONOBO_OBJECT(bag));
g_free (html);
+#ifdef DETECT_NEW_VFOLDERS
+ summary->listener = evolution_storage_listener_new ();
+ gtk_signal_connect (GTK_OBJECT (summary->listener), "new_folder",
+ GTK_SIGNAL_FUNC (new_folder_cb), summary);
+ gtk_signal_connect (GTK_OBJECT (summary->listener), "removed_folder",
+ GTK_SIGNAL_FUNC (removed_folder_cb), summary);
+
+ corba_object = evolution_storage_listener_corba_objref (summary->listener);
+
+ CORBA_exception_init (&ev);
+ corba_local_objref = bonobo_object_corba_objref (BONOBO_OBJECT (vfolder_storage));
+
+ GNOME_Evolution_Storage_addListener (corba_local_objref,
+ corba_object, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning ("Cannot add a listener to the vfolder storage.");
+ }
+ CORBA_exception_free (&ev);
+#endif
+
return component;
}
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 08bdc6771a..64e92cd072 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -37,7 +37,9 @@ struct _vfolder_info {
/* list of vfolders available */
static GList *available_vfolders = NULL;
static VfolderContext *context;
-static EvolutionStorage *vfolder_storage;
+
+/* Ditto below */
+EvolutionStorage *vfolder_storage;
/* GROSS HACK: for passing to other parts of the program */
EvolutionShellClient *global_shell_client = NULL;