Mercurial > pidgin
changeset 13988:4d5cc9e4cb12
[gaim-migrate @ 16561]
Appropriately handle the notify dialogs when they close to prevent crashes.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Mon, 24 Jul 2006 09:25:48 +0000 |
parents | f94309c7c480 |
children | 16102b9c5c4a |
files | console/gntconv.c console/gntnotify.c |
diffstat | 2 files changed, 22 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/console/gntconv.c Mon Jul 24 05:08:30 2006 +0000 +++ b/console/gntconv.c Mon Jul 24 09:25:48 2006 +0000 @@ -200,7 +200,7 @@ gg_write_common(GaimConversation *conv, const char *who, const char *message, GaimMessageFlags flags, time_t mtime) { - GGConv *ggconv = g_hash_table_lookup(ggconvs, conv); + GGConv *ggconv = g_hash_table_lookup(ggconvs, conv); /* XXX: ggconv = conv->ui_data; should do */ char *strip; GntTextFormatFlags fl = 0;
--- a/console/gntnotify.c Mon Jul 24 05:08:30 2006 +0000 +++ b/console/gntnotify.c Mon Jul 24 09:25:48 2006 +0000 @@ -15,6 +15,12 @@ GntWidget *tree; } emaildialog; +static void +notify_msg_window_destroy_cb(GntWidget *window, GaimNotifyMsgType type) +{ + gaim_notify_close(type, window); +} + static void * gg_notify_message(GaimNotifyMsgType type, const char *title, const char *primary, const char *secondary) @@ -48,7 +54,10 @@ button = gnt_button_new(_("OK")); gnt_box_add_widget(GNT_BOX(window), button); - g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), window); + g_signal_connect_swapped(G_OBJECT(button), "activate", + G_CALLBACK(gnt_widget_destroy), window); + g_signal_connect(G_OBJECT(window), "destroy", + G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(type)); gnt_widget_show(window); return window; @@ -58,11 +67,20 @@ static void gg_close_notify(GaimNotifyType type, void *handle) { GntWidget *widget = handle; + + if (!widget) + return; + while (widget->parent) widget = widget->parent; if (type == GAIM_NOTIFY_SEARCHRESULTS) gaim_notify_searchresults_free(g_object_get_data(handle, "notify-results")); +#if 0 + /* This does not seem to be necessary */ + g_signal_handlers_disconnect_by_func(G_OBJECT(widget), + G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(type)); +#endif gnt_widget_destroy(widget); } @@ -77,7 +95,7 @@ secondary ? "\n" : "", unformat ? unformat : ""); - void *ret = gg_notify_message(GAIM_NOTIFY_MSG_INFO, title, primary, t); + void *ret = gg_notify_message(GAIM_NOTIFY_FORMATTED, title, primary, t); g_free(t); g_free(unformat); @@ -157,7 +175,7 @@ return NULL; } - ret = gg_notify_message(GAIM_NOTIFY_MSG_INFO, _("New Mail"), _("You have mail!"), message->str); + ret = gg_notify_message(GAIM_NOTIFY_EMAIL, _("New Mail"), _("You have mail!"), message->str); g_string_free(message, TRUE); return ret; }