From: <sa...@us...> - 2006-07-24 09:25:54
|
Revision: 16561 Author: sadrul Date: 2006-07-24 02:25:48 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16561&view=rev Log Message: ----------- Appropriately handle the notify dialogs when they close to prevent crashes. Modified Paths: -------------- trunk/console/gntconv.c trunk/console/gntnotify.c Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-07-24 05:12:57 UTC (rev 16560) +++ trunk/console/gntconv.c 2006-07-24 09:25:48 UTC (rev 16561) @@ -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; Modified: trunk/console/gntnotify.c =================================================================== --- trunk/console/gntnotify.c 2006-07-24 05:12:57 UTC (rev 16560) +++ trunk/console/gntnotify.c 2006-07-24 09:25:48 UTC (rev 16561) @@ -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; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |