[gnome-builder] libide/gui: only remove page from MRU if previously added
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/gui: only remove page from MRU if previously added
- Date: Fri, 16 Sep 2022 18:35:56 +0000 (UTC)
commit a1725934727c958ca39236326f07d6338adafa8b
Author: Christian Hergert <chergert redhat com>
Date: Fri Sep 16 11:35:06 2022 -0700
libide/gui: only remove page from MRU if previously added
We want symmetry here so track if we added to the MRU so we only
call the removal API in the case it was added.
src/libide/gui/ide-page.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/gui/ide-page.c b/src/libide/gui/ide-page.c
index a1e54cece..c9a45e3ba 100644
--- a/src/libide/gui/ide-page.c
+++ b/src/libide/gui/ide-page.c
@@ -43,6 +43,7 @@ typedef struct
GtkOverlay *overlay;
GtkProgressBar *progress_bar;
+ guint in_mru : 1;
guint failed : 1;
guint modified : 1;
guint can_split : 1;
@@ -128,6 +129,8 @@ ide_page_root (GtkWidget *widget)
return;
_ide_workspace_add_page_mru (IDE_WORKSPACE (toplevel), &priv->mru_link);
+
+ priv->in_mru = TRUE;
}
static void
@@ -139,10 +142,13 @@ ide_page_unroot (GtkWidget *widget)
g_assert (IDE_IS_PAGE (self));
- toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
-
- if (IDE_IS_WORKSPACE (toplevel))
- _ide_workspace_remove_page_mru (IDE_WORKSPACE (toplevel), &priv->mru_link);
+ if (priv->in_mru &&
+ (toplevel = GTK_WIDGET (gtk_widget_get_root (widget))) &&
+ IDE_IS_WORKSPACE (toplevel))
+ {
+ _ide_workspace_remove_page_mru (IDE_WORKSPACE (toplevel), &priv->mru_link);
+ priv->in_mru = FALSE;
+ }
GTK_WIDGET_CLASS (ide_page_parent_class)->unroot (widget);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]