[epiphany] Remove flag EPHY_NEW_TAB_PRESENT_WINDOW



commit 49e09e366b4bad8df2ca0e2368f5e1ad82f45ac4
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Thu Feb 13 15:10:03 2014 +0100

    Remove flag EPHY_NEW_TAB_PRESENT_WINDOW
    
    It's simpler to call gtk_window_present by the callers.

 src/ephy-session.c |   13 +++++++------
 src/ephy-shell.c   |    9 ++++-----
 src/ephy-shell.h   |   10 ++++------
 3 files changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 44b1768..a77ed82 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -231,7 +231,8 @@ ephy_session_undo_close_tab (EphySession *session)
        EphySessionPrivate *priv;
        EphyEmbed *embed, *new_tab;
        ClosedTab *tab;
-       EphyNewTabFlags flags = EPHY_NEW_TAB_PRESENT_WINDOW | EPHY_NEW_TAB_JUMP;
+       EphyWindow *window;
+       EphyNewTabFlags flags = EPHY_NEW_TAB_JUMP;
 
        g_return_if_fail (EPHY_IS_SESSION (session));
 
@@ -244,8 +245,6 @@ ephy_session_undo_close_tab (EphySession *session)
        LOG ("UNDO CLOSE TAB: %s", tab->url);
        if (*tab->parent_location != NULL)
        {
-               GtkWidget *window;
-
                if (tab->position > 0)
                {
                        /* Append in the n-th position. */
@@ -260,17 +259,17 @@ ephy_session_undo_close_tab (EphySession *session)
                        flags |= EPHY_NEW_TAB_FIRST;
                }
 
-               window = gtk_widget_get_toplevel (GTK_WIDGET (*tab->parent_location));
+               window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (*tab->parent_location)));
                new_tab = ephy_shell_new_tab (ephy_shell_get_default (),
-                                             EPHY_WINDOW (window), embed,
+                                             window, embed,
                                              flags);
                post_restore_cleanup (priv->closed_tabs, tab, FALSE);
        }
        else
        {
                EphyNotebook *notebook;
-               EphyWindow *window = ephy_window_new ();
 
+               window = ephy_window_new ();
                new_tab = ephy_shell_new_tab (ephy_shell_get_default (),
                                              window, NULL, flags);
 
@@ -283,6 +282,8 @@ ephy_session_undo_close_tab (EphySession *session)
 
        ephy_web_view_load_url (ephy_embed_get_web_view (new_tab), tab->url);
        gtk_widget_grab_focus (GTK_WIDGET (new_tab));
+       gtk_window_present (GTK_WINDOW (window));
+
        closed_tab_free (tab);
 
        if (g_queue_is_empty (priv->closed_tabs))
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 7bc94d7..2cd4506 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -709,10 +709,6 @@ ephy_shell_new_tab_full (EphyShell *shell,
     gtk_widget_show (GTK_WIDGET (window));
   }
 
-  if (flags & EPHY_NEW_TAB_PRESENT_WINDOW &&
-      ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (embed_shell)) != EPHY_EMBED_SHELL_MODE_TEST)
-    gtk_window_present_with_time (GTK_WINDOW (window), user_time);
-
   return embed;
 }
 
@@ -1007,7 +1003,7 @@ open_uris_data_new (EphyShell *shell,
   if (startup_flags & EPHY_STARTUP_NEW_WINDOW && !fullscreen_lockdown) {
     data->window = ephy_window_new ();
   } else if (startup_flags & EPHY_STARTUP_NEW_TAB || (new_windows_in_tabs && have_uris)) {
-    data->flags |= EPHY_NEW_TAB_JUMP | EPHY_NEW_TAB_PRESENT_WINDOW;
+    data->flags |= EPHY_NEW_TAB_JUMP;
     data->window = ephy_shell_get_main_window (shell);
     data->reuse_empty_tab = TRUE;
   } else if (!have_uris) {
@@ -1062,6 +1058,9 @@ ephy_shell_open_uris_idle (OpenURIsData *data)
     /* When reusing an empty tab, the focus is in the location entry */
     if (reusing_empty_tab || data->flags & EPHY_NEW_TAB_JUMP)
       gtk_widget_grab_focus (GTK_WIDGET (embed));
+
+    if (data->flags & EPHY_NEW_TAB_JUMP && ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (data->shell)) != 
EPHY_EMBED_SHELL_MODE_TEST)
+      gtk_window_present_with_time (GTK_WINDOW (data->window), data->user_time);
   } else {
     ephy_web_view_load_homepage (ephy_embed_get_web_view (embed));
     ephy_window_activate_location (data->window);
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 0ab78f3..f11c666 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -61,20 +61,18 @@ typedef struct _EphyShellPrivate  EphyShellPrivate;
  * @EPHY_NEW_TAB_FROM_EXTERNAL: tries to open the new tab in the current
  *        active tab if it is currently not loading anything and is
  *        blank.
- * @EPHY_NEW_TAB_PRESENT_WINDOW: present the active window.
  *
  * Controls how new tabs/windows are created and handled.
  */
 typedef enum {
   /* Page mode */
   EPHY_NEW_TAB_DONT_SHOW_WINDOW = 1 << 0,
-  EPHY_NEW_TAB_PRESENT_WINDOW     = 1 << 1,
 
   /* Tabs */
-  EPHY_NEW_TAB_FIRST        = 1 << 2,
-  EPHY_NEW_TAB_APPEND_LAST  = 1 << 3,
-  EPHY_NEW_TAB_APPEND_AFTER = 1 << 4,
-  EPHY_NEW_TAB_JUMP   = 1 << 5,
+  EPHY_NEW_TAB_FIRST        = 1 << 1,
+  EPHY_NEW_TAB_APPEND_LAST  = 1 << 2,
+  EPHY_NEW_TAB_APPEND_AFTER = 1 << 3,
+  EPHY_NEW_TAB_JUMP   = 1 << 4,
 } EphyNewTabFlags;
 
 typedef enum {


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