From cdb641800827669bdde0ade2e3efd08fd3a2b405 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 11 Feb 2003 21:20:43 +0000 Subject: Register a destroy virtual method. (mail_accounts_tab_destroy): Set 2003-02-11 Jeffrey Stedfast * mail-accounts.c (mail_accounts_tab_class_init): Register a destroy virtual method. (mail_accounts_tab_destroy): Set mail_display->destroyed = TRUE. * message-list.c (message_list_destroy): Set mail_display->destroyed = TRUE. This is a workaround for the GTK_OBJECT_DESTROYED() macro that we used to use before. svn path=/trunk/; revision=19884 --- mail/ChangeLog | 8 ++++++++ mail/mail-accounts.c | 27 +++++++++++++++++---------- mail/mail-accounts.h | 2 ++ mail/message-list.c | 25 +++++++++++++------------ mail/message-list.h | 18 +++++++++++------- 5 files changed, 51 insertions(+), 29 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 8d44e9c486..4494dc42d2 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,13 @@ 2003-02-11 Jeffrey Stedfast + * mail-accounts.c (mail_accounts_tab_class_init): Register a + destroy virtual method. + (mail_accounts_tab_destroy): Set mail_display->destroyed = TRUE. + + * message-list.c (message_list_destroy): Set + mail_display->destroyed = TRUE. This is a workaround for the + GTK_OBJECT_DESTROYED() macro that we used to use before. + * mail-display.c (mail_display_destroy): Set mail_display->destroyed = TRUE. This is a workaround for the GTK_OBJECT_DESTROYED() macro that we used to use before. diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index ddd92a1bbc..ac6f6d1fd2 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -44,6 +44,7 @@ static void mail_accounts_tab_class_init (MailAccountsTabClass *class); static void mail_accounts_tab_init (MailAccountsTab *prefs); static void mail_accounts_tab_finalise (GObject *obj); +static void mail_accounts_tab_destroy (GtkObject *object); static void mail_accounts_load (MailAccountsTab *tab); @@ -81,11 +82,13 @@ mail_accounts_tab_get_type (void) static void mail_accounts_tab_class_init (MailAccountsTabClass *klass) { - GObjectClass *object_class; + GtkObjectClass *gtk_object_class = (GtkObjectClass *) klass; + GObjectClass *object_class = (GObjectClass *) klass; - object_class = (GObjectClass *) klass; parent_class = g_type_class_ref (gtk_vbox_get_type ()); + gtk_object_class->destroy = mail_accounts_tab_destroy; + object_class->finalize = mail_accounts_tab_finalise; /* setup static data */ @@ -102,6 +105,16 @@ mail_accounts_tab_init (MailAccountsTab *prefs) gdk_pixbuf_render_pixmap_and_mask (enabled_pixbuf, &prefs->mark_pixmap, &prefs->mark_bitmap, 128); } +static void +mail_accounts_tab_destroy (GtkObject *obj) +{ + MailAccountsTab *prefs = (MailAccountsTab *) obj; + + prefs->destroyed = TRUE; + + parent_class->destroy (obj); +} + static void mail_accounts_tab_finalise (GObject *obj) { @@ -120,10 +133,7 @@ account_add_finished (MailAccountsTab *prefs, GObject *deadbeef) /* Either Cancel or Finished was clicked in the druid so reload the accounts */ prefs->druid = NULL; -#warning "GTK_OBJECT_DESTROYED" -#if 0 - if (!GTK_OBJECT_DESTROYED (prefs)) -#endif + if (!prefs->destroyed) mail_accounts_load (prefs); g_object_unref (prefs); @@ -151,10 +161,7 @@ account_edit_finished (MailAccountsTab *prefs, GObject *deadbeef) { prefs->editor = NULL; -#warning "GTK_OBJECT_DESTROYED" -#if 0 - if (!GTK_OBJECT_DESTROYED (prefs)) -#endif + if (!prefs->destroyed) mail_accounts_load (prefs); g_object_unref (prefs); diff --git a/mail/mail-accounts.h b/mail/mail-accounts.h index b69b12c349..0c046fa428 100644 --- a/mail/mail-accounts.h +++ b/mail/mail-accounts.h @@ -71,6 +71,8 @@ struct _MailAccountsTab { GtkButton *mail_delete; GtkButton *mail_default; GtkButton *mail_able; + + guint destroyed : 1; }; struct _MailAccountsTabClass { diff --git a/mail/message-list.c b/mail/message-list.c index 09645debe4..d5c61ff554 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1270,19 +1270,19 @@ static void message_list_destroy(GtkObject *object) { MessageList *message_list = MESSAGE_LIST (object); - + if (message_list->async_event) { mail_async_event_destroy(message_list->async_event); message_list->async_event = NULL; } - + if (message_list->folder) { /* need to do this before removing folder, folderinfo's might not exist after */ if (message_list->uid_nodemap) { g_hash_table_foreach(message_list->uid_nodemap, (GHFunc)clear_info, message_list); g_hash_table_destroy (message_list->uid_nodemap); } - + save_tree_state(message_list); hide_save_state(message_list); camel_object_unhook_event(message_list->folder, "folder_changed", folder_changed, message_list); @@ -1290,27 +1290,29 @@ message_list_destroy(GtkObject *object) camel_object_unref (message_list->folder); message_list->folder = NULL; } - + if (message_list->extras) { g_object_unref((message_list->extras)); message_list->extras = NULL; } - + if (message_list->model) { g_object_unref((message_list->model)); message_list->model = NULL; } - + if (message_list->idle_id != 0) { g_source_remove (message_list->idle_id); message_list->idle_id = 0; } - + if (message_list->seen_id) { g_source_remove (message_list->seen_id); message_list->seen_id = 0; } - + + message_list->destroyed = TRUE; + GTK_OBJECT_CLASS (message_list_parent_class)->destroy(object); } @@ -2741,10 +2743,9 @@ regen_list_regened (struct _mail_msg *mm) { struct _regen_list_msg *m = (struct _regen_list_msg *)mm; -#warning "GTK_OBJECT_DESTROYED replacement" - /*if (GTK_OBJECT_DESTROYED(m->ml)) - return;*/ - + if (m->ml->destroyed) + return; + if (!m->complete) return; diff --git a/mail/message-list.h b/mail/message-list.h index de152cec2e..78af58644d 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -72,17 +72,21 @@ struct _MessageList { /* IMPORTANT: You MUST have obtained the hide lock, to operate on this data */ GHashTable *hidden; struct _EMemPool *hidden_pool; - int hide_unhidden, /* total length, before hiding */ - hide_before, hide_after; /* hide ranges of messages */ - + int hide_unhidden; /* total length, before hiding */ + int hide_before, hide_after; /* hide ranges of messages */ + /* Current search string, or %NULL */ char *search; - + /* Are we displaying threaded view? */ - gboolean threaded; + guint threaded : 1; + /* do we automatically hide deleted messages? */ - gboolean hidedeleted; - + guint hidedeleted : 1; + + /* is the message-list object in a destroyed state? */ + guint destroyed : 1; + /* Where the ETree cursor is. */ int cursor_row; char *cursor_uid; -- cgit v1.2.3