Fix removing summary items

Unset this._expandedSummaryItem if it is the summary item that is being removed.
This avoids "this._sourceTitle.clutter_text is null" error.

Destroy the summary item actor only after calling _unsetClickedSummaryItem()
that disconnects from one of its signals.

https://bugzilla.gnome.org/show_bug.cgi?id=644043
This commit is contained in:
Marina Zhurakhinskaya 2011-03-06 16:29:11 -05:00
parent 7790a07c08
commit 4282748483

View File

@ -1157,7 +1157,7 @@ MessageTray.prototype = {
if (index == -1) if (index == -1)
return; return;
this._summaryItems[index].actor.destroy(); let summaryItemToRemove = this._summaryItems[index];
let newSummaryItemsIndex = this._newSummaryItems.indexOf(this._summaryItems[index]); let newSummaryItemsIndex = this._newSummaryItems.indexOf(this._summaryItems[index]);
if (newSummaryItemsIndex != -1) if (newSummaryItemsIndex != -1)
@ -1168,6 +1168,9 @@ MessageTray.prototype = {
if (source.isChat) if (source.isChat)
this._chatSummaryItemsCount--; this._chatSummaryItemsCount--;
if (this._expandedSummaryItem == summaryItemToRemove)
this._expandedSummaryItem = null;
if (this._longestSummaryItem.source == source) { if (this._longestSummaryItem.source == source) {
let newTitleWidth = 0; let newTitleWidth = 0;
this._longestSummaryItem = null; this._longestSummaryItem = null;
@ -1192,11 +1195,13 @@ MessageTray.prototype = {
this._notificationRemoved = true; this._notificationRemoved = true;
needUpdate = true; needUpdate = true;
} }
if (this._clickedSummaryItem && this._clickedSummaryItem.source == source) { if (this._clickedSummaryItem == summaryItemToRemove) {
this._unsetClickedSummaryItem(); this._unsetClickedSummaryItem();
needUpdate = true; needUpdate = true;
} }
summaryItemToRemove.actor.destroy();
if (needUpdate); if (needUpdate);
this._updateState(); this._updateState();