aboutsummaryrefslogtreecommitdiffstats
path: root/my-evolution
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2003-05-15 02:40:01 +0800
committerJP Rosevear <jpr@src.gnome.org>2003-05-15 02:40:01 +0800
commitbd1f703edbe882894fb5901d5f8d206dec5e3079 (patch)
treeef1fc1380774325909182405b1a5e43639d8b6f7 /my-evolution
parent74ee7fe6ae45bd9b498bb926aa0be181f68c48f2 (diff)
downloadgsoc2013-evolution-bd1f703edbe882894fb5901d5f8d206dec5e3079.tar
gsoc2013-evolution-bd1f703edbe882894fb5901d5f8d206dec5e3079.tar.gz
gsoc2013-evolution-bd1f703edbe882894fb5901d5f8d206dec5e3079.tar.bz2
gsoc2013-evolution-bd1f703edbe882894fb5901d5f8d206dec5e3079.tar.lz
gsoc2013-evolution-bd1f703edbe882894fb5901d5f8d206dec5e3079.tar.xz
gsoc2013-evolution-bd1f703edbe882894fb5901d5f8d206dec5e3079.tar.zst
gsoc2013-evolution-bd1f703edbe882894fb5901d5f8d206dec5e3079.zip
fix up protos
2003-05-14 JP Rosevear <jpr@ximian.com> * e-summary.h: fix up protos * e-summary.c (e_summary_get_control): accessor (e_summary_set_control): ditto (retrieve_shell_view_interface): util to get the shell view (e_summary_change_current_view): use it (e_summary_set_message): ditto (e_summary_unset_message): ditto * e-summary-mail.h: add proto * e-summary-mail.c (e_summary_mail_get_info): use the objref of the listener (e_summary_folder_unregister_storage): clean up a registered storage (e_summary_folder_register_storages): store the listener directly (folder_info_pb_changed): unref the listener once we are notified (lazy_register_storages): release and unref the property bag, event and listener (e_summary_folder_init_folder_store): track the listener (e_summary_folder_clear_folder_store): cleanup the folder store * e-summary-factory.c (control_activate_cb): we don't get the shell view here any more (e_summary_factory_new_control): don't pass in the shell, set the control on the summary * component-factory.c (owner_unset_cb): clear the folder store on destruction svn path=/trunk/; revision=21177
Diffstat (limited to 'my-evolution')
-rw-r--r--my-evolution/ChangeLog32
-rw-r--r--my-evolution/component-factory.c5
-rw-r--r--my-evolution/e-summary-factory.c23
-rw-r--r--my-evolution/e-summary-mail.c91
-rw-r--r--my-evolution/e-summary-mail.h1
-rw-r--r--my-evolution/e-summary.c79
-rw-r--r--my-evolution/e-summary.h11
7 files changed, 188 insertions, 54 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog
index d512e6c376..ad37211d60 100644
--- a/my-evolution/ChangeLog
+++ b/my-evolution/ChangeLog
@@ -1,3 +1,35 @@
+2003-05-14 JP Rosevear <jpr@ximian.com>
+
+ * e-summary.h: fix up protos
+
+ * e-summary.c (e_summary_get_control): accessor
+ (e_summary_set_control): ditto
+ (retrieve_shell_view_interface): util to get the shell view
+ (e_summary_change_current_view): use it
+ (e_summary_set_message): ditto
+ (e_summary_unset_message): ditto
+
+ * e-summary-mail.h: add proto
+
+ * e-summary-mail.c (e_summary_mail_get_info): use the objref of
+ the listener
+ (e_summary_folder_unregister_storage): clean up a registered
+ storage
+ (e_summary_folder_register_storages): store the listener directly
+ (folder_info_pb_changed): unref the listener once we are notified
+ (lazy_register_storages): release and unref the property bag,
+ event and listener
+ (e_summary_folder_init_folder_store): track the listener
+ (e_summary_folder_clear_folder_store): cleanup the folder store
+
+ * e-summary-factory.c (control_activate_cb): we don't get the
+ shell view here any more
+ (e_summary_factory_new_control): don't pass in the shell, set the
+ control on the summary
+
+ * component-factory.c (owner_unset_cb): clear the folder store on
+ destruction
+
2003-05-02 Not Zed <NotZed@Ximian.com>
[#41849]
diff --git a/my-evolution/component-factory.c b/my-evolution/component-factory.c
index a3b0a384ed..5e93d7f3f8 100644
--- a/my-evolution/component-factory.c
+++ b/my-evolution/component-factory.c
@@ -113,7 +113,10 @@ static void
owner_unset_cb (EvolutionShellComponent *shell_component,
gpointer user_data)
{
- /* noop */
+ g_free (evolution_dir);
+ evolution_dir = NULL;
+
+ e_summary_folder_clear_folder_store ();
}
static BonoboObject *
diff --git a/my-evolution/e-summary-factory.c b/my-evolution/e-summary-factory.c
index 43f7fe5467..6ebaf06e4f 100644
--- a/my-evolution/e-summary-factory.c
+++ b/my-evolution/e-summary-factory.c
@@ -87,25 +87,6 @@ control_activate_cb (BonoboControl *control,
BonoboUIComponent *ui_component;
ui_component = bonobo_control_get_ui_component (control);
-
- if (summary->shell_view_interface == NULL) {
- Bonobo_ControlFrame control_frame;
- CORBA_Environment ev;
-
- control_frame = bonobo_control_get_control_frame (control, NULL);
- if (control_frame == NULL)
- goto out;
-
- CORBA_exception_init (&ev);
- summary->shell_view_interface = Bonobo_Unknown_queryInterface (control_frame, "IDL:GNOME/Evolution/ShellView:1.0", &ev);
-
- if (BONOBO_EX (&ev)) {
- g_warning ("Error getting ShellView. %s", CORBA_exception_id (&ev));
- summary->shell_view_interface = CORBA_OBJECT_NIL;
- }
- CORBA_exception_free (&ev);
- }
- out:
if (activate)
control_activate (control, ui_component, summary);
@@ -129,7 +110,7 @@ e_summary_factory_new_control (const char *uri,
BonoboControl *control;
GtkWidget *summary;
- summary = e_summary_new (shell, global_preferences);
+ summary = e_summary_new (global_preferences);
if (summary == NULL) {
return NULL;
}
@@ -144,6 +125,8 @@ e_summary_factory_new_control (const char *uri,
return NULL;
}
+ e_summary_set_control (summary, control);
+
g_signal_connect (control, "activate", G_CALLBACK (control_activate_cb), summary);
g_signal_connect (control, "destroy", G_CALLBACK (control_destroy_cb), summary);
diff --git a/my-evolution/e-summary-mail.c b/my-evolution/e-summary-mail.c
index 51513f23b1..6d429e0df1 100644
--- a/my-evolution/e-summary-mail.c
+++ b/my-evolution/e-summary-mail.c
@@ -54,7 +54,8 @@ typedef struct _FolderStore {
GNOME_Evolution_Shell shell;
GNOME_Evolution_FolderInfo folder_info;
GNOME_Evolution_StorageRegistry registry;
- Bonobo_Listener corba_listener;
+ BonoboListener *registry_listener;
+ BonoboListener *listener;
EvolutionStorageListener *storage_listener;
GSList *storage_list;
@@ -226,7 +227,7 @@ e_summary_mail_get_info (const char *uri)
CORBA_exception_init (&ev);
GNOME_Evolution_FolderInfo_getInfo (folder_store->folder_info, uri ? uri : "",
- folder_store->corba_listener, &ev);
+ BONOBO_OBJREF (folder_store->listener), &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Error getting info for %s:\n%s", uri,
CORBA_exception_id (&ev));
@@ -425,6 +426,41 @@ e_summary_folder_register_storage (const char *name,
return TRUE;
}
+static gboolean
+e_summary_folder_unregister_storage (StorageInfo *si, gboolean remove)
+{
+ GNOME_Evolution_StorageListener corba_listener;
+ CORBA_Environment ev;
+
+ g_free (si->name);
+ bonobo_object_release_unref (si->storage, NULL);
+
+ corba_listener = evolution_storage_listener_corba_objref (si->listener);
+
+ CORBA_exception_init (&ev);
+ GNOME_Evolution_Storage_removeListener (si->storage, corba_listener, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Exception removing listener: %s",
+ CORBA_exception_id (&ev));
+ CORBA_exception_free (&ev);
+
+ return FALSE;
+ }
+ CORBA_exception_free (&ev);
+
+ g_signal_handlers_disconnect_matched (si->listener, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, si);
+ g_object_unref (si->listener);
+
+ /* FIXME Folders */
+
+ if (remove)
+ folder_store->storage_list = g_slist_remove (folder_store->storage_list, si);
+
+ g_free (si);
+
+ return TRUE;
+}
+
static void
e_summary_folder_register_local_storage (void)
{
@@ -496,7 +532,6 @@ static gboolean
e_summary_folder_register_storages (GNOME_Evolution_Shell corba_shell)
{
Bonobo_Listener corba_listener;
- BonoboListener *listener;
CORBA_Environment ev;
CORBA_exception_init (&ev);
@@ -510,9 +545,9 @@ e_summary_folder_register_storages (GNOME_Evolution_Shell corba_shell)
return FALSE;
}
- listener = bonobo_listener_new (NULL, NULL);
- g_signal_connect (listener, "event-notify", G_CALLBACK (storage_notify), NULL);
- corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener));
+ folder_store->registry_listener = bonobo_listener_new (NULL, NULL);
+ g_signal_connect (folder_store->registry_listener, "event-notify", G_CALLBACK (storage_notify), NULL);
+ corba_listener = BONOBO_OBJREF (folder_store->registry_listener);
/* Storages will be added whenever the listener gets an event. */
GNOME_Evolution_StorageRegistry_addListener (folder_store->registry, corba_listener, &ev);
@@ -621,7 +656,8 @@ folder_info_pb_changed (BonoboListener *listener,
CORBA_Environment *ev,
gpointer data)
{
- e_summary_folder_register_storages (folder_store->shell);
+ e_summary_folder_register_storages (folder_store->shell);
+ bonobo_object_unref (listener);
}
static void
@@ -630,7 +666,6 @@ lazy_register_storages (void)
Bonobo_PropertyBag pb;
Bonobo_EventSource event;
BonoboListener *listener;
- Bonobo_Listener corba_listener;
CORBA_Environment ev;
gboolean ready;
@@ -652,6 +687,7 @@ lazy_register_storages (void)
if (ready == TRUE) {
/* Register storages */
e_summary_folder_register_storages (folder_store->shell);
+ bonobo_object_release_unref (pb, NULL);
return;
}
@@ -662,6 +698,7 @@ lazy_register_storages (void)
g_warning ("Error getting event source interface: %s",
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
+ bonobo_object_release_unref (pb, NULL);
return;
}
@@ -669,22 +706,22 @@ lazy_register_storages (void)
listener = bonobo_listener_new (NULL, NULL);
g_signal_connect (listener, "event-notify", G_CALLBACK (folder_info_pb_changed), NULL);
- corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener));
- Bonobo_EventSource_addListener (event, corba_listener, &ev);
+ Bonobo_EventSource_addListener (event, BONOBO_OBJREF (listener), &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Error adding listener: %s\n",
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
bonobo_object_unref (BONOBO_OBJECT (listener));
- return;
}
+
+ bonobo_object_release_unref (pb, NULL);
+ bonobo_object_release_unref (event, NULL);
}
gboolean
e_summary_folder_init_folder_store (GNOME_Evolution_Shell shell)
{
CORBA_Environment ev;
- BonoboListener *listener;
if (folder_store != NULL) {
return TRUE;
@@ -704,9 +741,8 @@ e_summary_folder_init_folder_store (GNOME_Evolution_Shell shell)
CORBA_exception_free (&ev);
- listener = bonobo_listener_new (NULL, NULL);
- g_signal_connect (listener, "event-notify", G_CALLBACK (mail_change_notify), NULL);
- folder_store->corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener));
+ folder_store->listener = bonobo_listener_new (NULL, NULL);
+ g_signal_connect (folder_store->listener, "event-notify", G_CALLBACK (mail_change_notify), NULL);
/* Create a hash table for the folders */
folder_store->path_to_folder = g_hash_table_new (g_str_hash, g_str_equal);
@@ -716,3 +752,28 @@ e_summary_folder_init_folder_store (GNOME_Evolution_Shell shell)
lazy_register_storages ();
return TRUE;
}
+
+
+gboolean
+e_summary_folder_clear_folder_store (void)
+{
+ GSList *l;
+
+ if (folder_store == NULL) {
+ return TRUE;
+ }
+
+ bonobo_object_release_unref (folder_store->folder_info, NULL);
+ bonobo_object_release_unref (folder_store->registry, NULL);
+ bonobo_object_unref (folder_store->registry_listener);
+ bonobo_object_unref (folder_store->listener);
+
+ for (l = folder_store->storage_list; l != NULL; l = l->next)
+ e_summary_folder_unregister_storage (l->data, FALSE);
+ g_slist_free (folder_store->storage_list);
+
+ g_free (folder_store);
+ folder_store = NULL;
+
+ return TRUE;
+}
diff --git a/my-evolution/e-summary-mail.h b/my-evolution/e-summary-mail.h
index e6b84a16f3..acf9321692 100644
--- a/my-evolution/e-summary-mail.h
+++ b/my-evolution/e-summary-mail.h
@@ -51,4 +51,5 @@ void e_summary_mail_fill_list (ESummaryTable *est);
/* Folder stuff */
gboolean e_summary_folder_init_folder_store (GNOME_Evolution_Shell shell);
+gboolean e_summary_folder_clear_folder_store (void);
#endif
diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c
index 5c821605a4..958be90c8c 100644
--- a/my-evolution/e-summary.c
+++ b/my-evolution/e-summary.c
@@ -94,7 +94,7 @@ struct _ESummaryMailFolderInfo {
};
struct _ESummaryPrivate {
- GNOME_Evolution_ShellView shell_view_interface;
+ BonoboControl *control;
GtkWidget *html_scroller;
GtkWidget *html;
@@ -508,6 +508,8 @@ e_summary_init (ESummary *summary)
priv = summary->priv;
+ priv->control = NULL;
+
priv->frozen = TRUE;
priv->pending_reload_tag = 0;
@@ -554,13 +556,12 @@ E_MAKE_TYPE (e_summary, "ESummary", ESummary, e_summary_class_init,
e_summary_init, PARENT_TYPE);
GtkWidget *
-e_summary_new (const GNOME_Evolution_Shell shell,
- ESummaryPrefs *prefs)
+e_summary_new (ESummaryPrefs *prefs)
{
ESummary *summary;
summary = gtk_type_new (e_summary_get_type ());
- summary->shell = shell;
+
/* Just get a pointer to the global preferences */
summary->preferences = prefs;
@@ -576,6 +577,30 @@ e_summary_new (const GNOME_Evolution_Shell shell,
return GTK_WIDGET (summary);
}
+BonoboControl *
+e_summary_get_control (ESummary *summary)
+{
+ g_return_val_if_fail (summary != NULL, CORBA_OBJECT_NIL);
+ g_return_val_if_fail (IS_E_SUMMARY (summary), CORBA_OBJECT_NIL);
+
+ return summary->priv->control;
+}
+
+void
+e_summary_set_control (ESummary *summary, BonoboControl *control)
+{
+ g_return_if_fail (summary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (summary));
+
+ if (summary->priv->control)
+ g_object_remove_weak_pointer (G_OBJECT (summary->priv->control), &summary->priv->control);
+
+ summary->priv->control = control;
+
+ if (summary->priv->control)
+ g_object_add_weak_pointer (G_OBJECT (summary->priv->control), &summary->priv->control);
+}
+
static void
do_summary_print (ESummary *summary,
gboolean preview)
@@ -669,6 +694,31 @@ e_summary_add_protocol_listener (ESummary *summary,
g_hash_table_insert (summary->priv->protocol_hash, g_strdup (protocol), old);
}
+static GNOME_Evolution_ShellView
+retrieve_shell_view_interface (BonoboControl *control)
+{
+ Bonobo_ControlFrame control_frame;
+ GNOME_Evolution_ShellView shell_view_interface;
+ CORBA_Environment ev;
+
+ control_frame = bonobo_control_get_control_frame (control, NULL);
+
+ if (control_frame == NULL)
+ return CORBA_OBJECT_NIL;
+
+ CORBA_exception_init (&ev);
+ shell_view_interface = Bonobo_Unknown_queryInterface (control_frame,
+ "IDL:GNOME/Evolution/ShellView:1.0",
+ &ev);
+
+ if (BONOBO_EX (&ev))
+ shell_view_interface = CORBA_OBJECT_NIL;
+
+ CORBA_exception_free (&ev);
+
+ return shell_view_interface;
+}
+
void
e_summary_change_current_view (ESummary *summary,
const char *uri)
@@ -679,14 +729,15 @@ e_summary_change_current_view (ESummary *summary,
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
- svi = summary->shell_view_interface;
- if (svi == NULL) {
+ svi = retrieve_shell_view_interface (summary->priv->control);
+ if (svi == CORBA_OBJECT_NIL)
return;
- }
CORBA_exception_init (&ev);
GNOME_Evolution_ShellView_changeCurrentView (svi, uri, &ev);
CORBA_exception_free (&ev);
+
+ bonobo_object_release_unref (svi, NULL);
}
void
@@ -700,14 +751,15 @@ e_summary_set_message (ESummary *summary,
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
- svi = summary->shell_view_interface;
- if (svi == NULL) {
+ svi = retrieve_shell_view_interface (summary->priv->control);
+ if (svi == CORBA_OBJECT_NIL)
return;
- }
CORBA_exception_init (&ev);
GNOME_Evolution_ShellView_setMessage (svi, message ? message : "", busy, &ev);
CORBA_exception_free (&ev);
+
+ bonobo_object_release_unref (svi, NULL);
}
void
@@ -719,14 +771,15 @@ e_summary_unset_message (ESummary *summary)
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
- svi = summary->shell_view_interface;
- if (svi == NULL) {
+ svi = retrieve_shell_view_interface (summary->priv->control);
+ if (svi == CORBA_OBJECT_NIL)
return;
- }
CORBA_exception_init (&ev);
GNOME_Evolution_ShellView_unsetMessage (svi, &ev);
CORBA_exception_free (&ev);
+
+ bonobo_object_release_unref (svi, NULL);
}
void
diff --git a/my-evolution/e-summary.h b/my-evolution/e-summary.h
index 09aea33114..5700284776 100644
--- a/my-evolution/e-summary.h
+++ b/my-evolution/e-summary.h
@@ -25,6 +25,7 @@
#include <gtk/gtkvbox.h>
#include <bonobo/bonobo-ui-component.h>
+#include <bonobo/bonobo-control.h>
#include "e-summary-type.h"
#include "e-summary-mail.h"
#include "e-summary-calendar.h"
@@ -117,9 +118,6 @@ struct _ESummary {
ESummaryPrivate *priv;
- GNOME_Evolution_Shell shell;
- GNOME_Evolution_ShellView shell_view_interface;
-
gboolean online;
char *timezone;
@@ -132,8 +130,11 @@ struct _ESummaryClass {
GtkType e_summary_get_type (void);
-GtkWidget *e_summary_new (const GNOME_Evolution_Shell shell,
- ESummaryPrefs *prefs);
+GtkWidget *e_summary_new (ESummaryPrefs *prefs);
+
+BonoboControl *e_summary_get_control (ESummary *summary);
+void e_summary_set_control (ESummary *summary,
+ BonoboControl *control);
void e_summary_print (BonoboUIComponent *component,
gpointer user_data,