diff options
author | JP Rosevear <jpr@ximian.com> | 2003-05-15 02:40:01 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2003-05-15 02:40:01 +0800 |
commit | bd1f703edbe882894fb5901d5f8d206dec5e3079 (patch) | |
tree | ef1fc1380774325909182405b1a5e43639d8b6f7 /my-evolution/e-summary.c | |
parent | 74ee7fe6ae45bd9b498bb926aa0be181f68c48f2 (diff) | |
download | gsoc2013-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/e-summary.c')
-rw-r--r-- | my-evolution/e-summary.c | 79 |
1 files changed, 66 insertions, 13 deletions
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 |