+ if (MODEST_IS_MSG_VIEW_WINDOW (window)) {
+ gchar *uid;
+ TnyHeader *header;
+ header = modest_msg_view_window_get_header (MODEST_MSG_VIEW_WINDOW (window));
+
+ if (header) {
+ uid = modest_tny_folder_get_header_unique_id (header);
+
+ /* Embedded messages do not have uid */
+ if (uid) {
+ if (g_list_find_custom (priv->window_list, uid, (GCompareFunc) compare_msguids)) {
+ g_debug ("%s found another view window showing the same header", __FUNCTION__);
+ g_free (uid);
+ g_object_unref (header);
+ return FALSE;
+ }
+ g_free (uid);
+ } else {
+ if (g_list_find_custom (priv->window_list, header, (GCompareFunc) compare_headers)) {
+ g_debug ("%s found another view window showing the same header", __FUNCTION__);
+ g_object_unref (header);
+ return FALSE;
+ }
+ }
+ g_object_unref (header);
+ }
+ }
+