aboutsummaryrefslogtreecommitdiffstats
path: root/my-evolution
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2001-07-24 03:14:02 +0800
committerIain Holmes <iain@src.gnome.org>2001-07-24 03:14:02 +0800
commit05ec4697c84a948310556b88e451c9dfc663967e (patch)
tree7044e5cf1517512e9824d46f6b2e5e1190ac54c1 /my-evolution
parent3db12716555637561318416dc76c32bc6439d7a8 (diff)
downloadgsoc2013-evolution-05ec4697c84a948310556b88e451c9dfc663967e.tar.gz
gsoc2013-evolution-05ec4697c84a948310556b88e451c9dfc663967e.tar.zst
gsoc2013-evolution-05ec4697c84a948310556b88e451c9dfc663967e.zip
Make the storage registar(?) generic
svn path=/trunk/; revision=11315
Diffstat (limited to 'my-evolution')
-rw-r--r--my-evolution/ChangeLog7
-rw-r--r--my-evolution/e-summary-mail.c104
2 files changed, 76 insertions, 35 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog
index 60bd187146..ecc2c44d22 100644
--- a/my-evolution/ChangeLog
+++ b/my-evolution/ChangeLog
@@ -1,5 +1,12 @@
2001-07-23 Iain Holmes <iain@ximian.com>
+ * e-summary-mail.c (e_summary_mail_init): Move the storage register out
+ of here into a seperate function.
+ (e_summary_mail_register_storages): Register the local storage.
+ (e_summary_mail_register_storage): Register a single storage.
+
+2001-07-23 Iain Holmes <iain@ximian.com>
+
* e-summary-preferences.c: Fix the KDE and Newsforge things. Change the
KDE rdf to the one that the KDE person told me :)
diff --git a/my-evolution/e-summary-mail.c b/my-evolution/e-summary-mail.c
index 923724c773..dda2fa6ed4 100644
--- a/my-evolution/e-summary-mail.c
+++ b/my-evolution/e-summary-mail.c
@@ -30,6 +30,7 @@
struct _ESummaryMail {
GNOME_Evolution_FolderInfo folder_info;
BonoboListener *listener;
+ EvolutionStorageListener *storage_listener;
GHashTable *folders;
GList *shown;
@@ -246,42 +247,55 @@ e_summary_mail_protocol (ESummary *summary,
{
}
-void
-e_summary_mail_init (ESummary *summary,
- GNOME_Evolution_Shell corba_shell)
+static gboolean
+e_summary_mail_register_storage (ESummary *summary,
+ GNOME_Evolution_Storage corba_storage)
{
ESummaryMail *mail;
- CORBA_Environment ev;
- GNOME_Evolution_Storage local_storage;
EvolutionStorageListener *listener;
GNOME_Evolution_StorageListener corba_listener;
+ CORBA_Environment ev;
- g_return_if_fail (summary != NULL);
- g_return_if_fail (IS_E_SUMMARY (summary));
+ mail = summary->mail;
- mail = g_new (ESummaryMail, 1);
- summary->mail = mail;
+ if (mail->storage_listener == NULL) {
+ mail->storage_listener = evolution_storage_listener_new ();
+ gtk_signal_connect (GTK_OBJECT (mail->storage_listener), "new-folder",
+ GTK_SIGNAL_FUNC (new_folder_cb), summary);
+ gtk_signal_connect (GTK_OBJECT (mail->storage_listener), "removed-folder",
+ GTK_SIGNAL_FUNC (remove_folder_cb), summary);
+ }
+ listener = mail->storage_listener;
+
+ corba_listener = evolution_storage_listener_corba_objref (listener);
CORBA_exception_init (&ev);
- mail->folder_info = oaf_activate_from_id (MAIL_IID, 0, NULL, &ev);
+ GNOME_Evolution_Storage_addListener (corba_storage, corba_listener, &ev);
if (BONOBO_EX (&ev)) {
- g_warning ("Exception creating FolderInfo: %s",
+ g_warning ("Exception adding listener: %s",
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
-
+
g_free (mail);
- return;
+ return TRUE;
}
- /* Create a hash table for the folders */
- mail->folders = g_hash_table_new (g_str_hash, g_str_equal);
- mail->shown = NULL;
-
- /* Create a BonoboListener for all the notifies. */
- mail->listener = bonobo_listener_new (NULL, NULL);
- gtk_signal_connect (GTK_OBJECT (mail->listener), "event-notify",
- GTK_SIGNAL_FUNC (mail_change_notify), summary);
+ CORBA_exception_free (&ev);
+ return TRUE;
+}
+
+static gboolean
+e_summary_mail_register_storages (ESummary *summary,
+ GNOME_Evolution_Shell corba_shell)
+{
+ GNOME_Evolution_LocalStorage local_storage;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (summary != NULL, FALSE);
+ g_return_val_if_fail (IS_E_SUMMARY (summary), FALSE);
+
+ CORBA_exception_init (&ev);
local_storage = GNOME_Evolution_Shell_getLocalStorage (corba_shell, &ev);
if (BONOBO_EX (&ev)) {
@@ -289,29 +303,49 @@ e_summary_mail_init (ESummary *summary,
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
- g_free (mail);
- return;
+ return FALSE;
}
- listener = evolution_storage_listener_new ();
- gtk_signal_connect (GTK_OBJECT (listener), "new-folder",
- GTK_SIGNAL_FUNC (new_folder_cb), summary);
- gtk_signal_connect (GTK_OBJECT (listener), "removed-folder",
- GTK_SIGNAL_FUNC (remove_folder_cb), summary);
- corba_listener = evolution_storage_listener_corba_objref (listener);
+ e_summary_mail_register_storage (summary, local_storage);
- GNOME_Evolution_Storage_addListener (local_storage, corba_listener, &ev);
+ CORBA_exception_free (&ev);
+ return TRUE;
+}
+
+void
+e_summary_mail_init (ESummary *summary,
+ GNOME_Evolution_Shell corba_shell)
+{
+ ESummaryMail *mail;
+ CORBA_Environment ev;
+
+ g_return_if_fail (summary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (summary));
+
+ mail = g_new0 (ESummaryMail, 1);
+ summary->mail = mail;
+
+ CORBA_exception_init (&ev);
+ mail->folder_info = oaf_activate_from_id (MAIL_IID, 0, NULL, &ev);
if (BONOBO_EX (&ev)) {
- g_warning ("Exception adding listener: %s",
+ g_warning ("Exception creating FolderInfo: %s",
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
-
+
g_free (mail);
return;
}
- CORBA_exception_free (&ev);
+ /* Create a BonoboListener for all the notifies. */
+ mail->listener = bonobo_listener_new (NULL, NULL);
+ gtk_signal_connect (GTK_OBJECT (mail->listener), "event-notify",
+ GTK_SIGNAL_FUNC (mail_change_notify), summary);
+
+ /* Create a hash table for the folders */
+ mail->folders = g_hash_table_new (g_str_hash, g_str_equal);
+ mail->shown = NULL;
+ e_summary_mail_register_storages (summary, corba_shell);
e_summary_add_protocol_listener (summary, "mail", e_summary_mail_protocol, mail);
return;
}
@@ -395,8 +429,8 @@ str_compare (gconstpointer a,
{
ESummaryMailRowData *rda, *rdb;
- rda = a;
- rdb = b;
+ rda = (ESummaryMailRowData *) a;
+ rdb = (ESummaryMailRowData *) b;
return strcmp (rda->name, rdb->name);
}