[epiphany/pgriffis/web-extension/tabs: 3/11] ephy_shell_new_tab_full: Support NULL window




commit a8ff5a2b32ee56532ce0f50284cd101be36e01da
Author: Patrick Griffis <pgriffis igalia com>
Date:   Thu Jun 2 16:05:06 2022 -0500

    ephy_shell_new_tab_full: Support NULL window
    
    It is documented supporting NULL but it didn't. Just default to active window.
    
    Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1125>

 src/ephy-shell.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index c8d95a31c..f319e49b5 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -1026,7 +1026,7 @@ ephy_shell_new_tab_full (EphyShell       *shell,
   EphyEmbed *parent = NULL;
 
   g_assert (EPHY_IS_SHELL (shell));
-  g_assert (EPHY_IS_WINDOW (window));
+  g_assert (EPHY_IS_WINDOW (window) || !window);
   g_assert (EPHY_IS_EMBED (previous_embed) || !previous_embed);
 
   embed_shell = EPHY_EMBED_SHELL (shell);
@@ -1034,6 +1034,9 @@ ephy_shell_new_tab_full (EphyShell       *shell,
   if (flags & EPHY_NEW_TAB_JUMP)
     jump_to = TRUE;
 
+  if (!window)
+    window = EPHY_WINDOW (gtk_application_get_active_window (GTK_APPLICATION (shell)));
+
   LOG ("Opening new tab window %p parent-embed %p jump-to:%s",
        window, previous_embed, jump_to ? "t" : "f");
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]