diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index c031a54..39ee128 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -1262,6 +1262,19 @@ notify_dialog_cb (AlarmNotifyResult result, gint snooze_mins, gpointer data)
 	return;
 }
 
+static void
+remove_tray_icon (void)
+{
+	if (tray_blink_id > -1)
+		g_source_remove (tray_blink_id);
+	tray_blink_id = -1;
+
+	if (tray_icon) {
+		g_object_unref (tray_icon);
+		tray_icon = NULL;
+	}
+}
+
 /* Callbacks.  */
 static gboolean
 open_alarm_dialog (TrayIconData *tray_data)
@@ -1271,13 +1284,7 @@ open_alarm_dialog (TrayIconData *tray_data)
 	d(printf("%s:%d (open_alarm_dialog) \n",__FILE__, __LINE__));
 	qa = lookup_queued_alarm (tray_data->cqa, tray_data->alarm_id);
 	if (qa) {
-
-		if (tray_blink_id > -1)
-			g_source_remove (tray_blink_id);
-		tray_blink_id = -1;
-
-		g_object_unref (tray_icon);
-		tray_icon = NULL;
+		remove_tray_icon ();
 
 		if (!alarm_notifications_dialog)
 			alarm_notifications_dialog = notified_alarms_dialog_new ();
@@ -1304,6 +1311,8 @@ open_alarm_dialog (TrayIconData *tray_data)
 
 		}
 
+	} else {
+		remove_tray_icon ();
 	}
 
 	return TRUE;
@@ -1323,13 +1332,8 @@ tray_icon_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_da
 			return TRUE;
 		} else if (event->button == 3) {
 			d(printf("%s:%d (tray_icon_clicked_cb) - right click\n",__FILE__, __LINE__));
-			if (tray_blink_id > -1)
-				g_source_remove (tray_blink_id);
-			tray_blink_id = -1;
 
-			gtk_status_icon_set_visible (tray_icon, FALSE);
-			g_object_unref (tray_icon);
-			tray_icon = NULL;
+			remove_tray_icon ();
 			return TRUE;
 		}
 	}
