aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-05-21 19:15:52 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-05-21 19:15:52 +0800
commit8c7107742c5058841b22e52535a5ab316e44ad6e (patch)
tree22bd63369a6fda486d4da3bf9c52e7b3e048ad75
parent811b8c4ba8f54cfa747db421adc07a35b0b30d43 (diff)
downloadgsoc2013-epiphany-8c7107742c5058841b22e52535a5ab316e44ad6e.tar
gsoc2013-epiphany-8c7107742c5058841b22e52535a5ab316e44ad6e.tar.gz
gsoc2013-epiphany-8c7107742c5058841b22e52535a5ab316e44ad6e.tar.bz2
gsoc2013-epiphany-8c7107742c5058841b22e52535a5ab316e44ad6e.tar.lz
gsoc2013-epiphany-8c7107742c5058841b22e52535a5ab316e44ad6e.tar.xz
gsoc2013-epiphany-8c7107742c5058841b22e52535a5ab316e44ad6e.tar.zst
gsoc2013-epiphany-8c7107742c5058841b22e52535a5ab316e44ad6e.zip
Cleanup new tab logic, and ever use window for new instances.
2003-05-21 Marco Pesenti Gritti <marco@it.gnome.org> * src/bookmarks/ephy-bookmarks-editor.c: (cmd_open_bookmarks_in_tabs), (ephy_bookmarks_editor_node_activated_cb): * src/ephy-automation.c: (impl_ephy_automation_loadurl): * src/ephy-history-window.c: (cmd_open_bookmarks_in_tabs), (cmd_open_bookmarks_in_browser): * src/ephy-notebook.c: (notebook_drag_data_received_cb): * src/ephy-shell.c: (ephy_shell_new_tab): * src/ephy-shell.h: * src/popup-commands.c: (popup_cmd_link_in_new_window), (popup_cmd_link_in_new_tab), (popup_cmd_image_in_new_tab), (popup_cmd_image_in_new_window), (popup_cmd_frame_in_new_tab), (popup_cmd_frame_in_new_window): * src/window-commands.c: (window_cmd_file_new_window), (window_cmd_file_new_tab), (window_cmd_view_page_source): Cleanup new tab logic, and ever use window for new instances.
-rw-r--r--ChangeLog20
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c3
-rw-r--r--src/ephy-automation.c22
-rw-r--r--src/ephy-history-window.c3
-rw-r--r--src/ephy-notebook.c2
-rw-r--r--src/ephy-shell.c66
-rw-r--r--src/ephy-shell.h31
-rw-r--r--src/popup-commands.c6
-rw-r--r--src/window-commands.c10
9 files changed, 95 insertions, 68 deletions
diff --git a/ChangeLog b/ChangeLog
index e178b8ae3..14b65dcc4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
2003-05-21 Marco Pesenti Gritti <marco@it.gnome.org>
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (cmd_open_bookmarks_in_tabs),
+ (ephy_bookmarks_editor_node_activated_cb):
+ * src/ephy-automation.c: (impl_ephy_automation_loadurl):
+ * src/ephy-history-window.c: (cmd_open_bookmarks_in_tabs),
+ (cmd_open_bookmarks_in_browser):
+ * src/ephy-notebook.c: (notebook_drag_data_received_cb):
+ * src/ephy-shell.c: (ephy_shell_new_tab):
+ * src/ephy-shell.h:
+ * src/popup-commands.c: (popup_cmd_link_in_new_window),
+ (popup_cmd_link_in_new_tab), (popup_cmd_image_in_new_tab),
+ (popup_cmd_image_in_new_window), (popup_cmd_frame_in_new_tab),
+ (popup_cmd_frame_in_new_window):
+ * src/window-commands.c: (window_cmd_file_new_window),
+ (window_cmd_file_new_tab), (window_cmd_view_page_source):
+
+ Cleanup new tab logic, and ever use window for new instances.
+
+2003-05-21 Marco Pesenti Gritti <marco@it.gnome.org>
+
* embed/ephy-favicon-cache.c: (ephy_favicon_cache_save):
Do not free memory is not a good idea
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 4a09e768e..7b9c2deb1 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -353,7 +353,7 @@ cmd_open_bookmarks_in_tabs (EggAction *action,
EPHY_NODE_BMK_PROP_LOCATION);
ephy_shell_new_tab (ephy_shell, window, NULL, location,
- EPHY_NEW_TAB_APPEND_GROUPED | EPHY_NEW_TAB_IN_EXISTING_WINDOW);
+ EPHY_NEW_TAB_OPEN_PAGE | EPHY_NEW_TAB_IN_EXISTING_WINDOW);
}
g_list_free (selection);
@@ -646,6 +646,7 @@ ephy_bookmarks_editor_node_activated_cb (GtkWidget *view,
{
/* We have to create a browser window */
ephy_shell_new_tab (ephy_shell, NULL, NULL, location,
+ EPHY_NEW_TAB_OPEN_PAGE |
EPHY_NEW_TAB_IN_NEW_WINDOW);
}
}
diff --git a/src/ephy-automation.c b/src/ephy-automation.c
index 93573e924..96ed5f2d3 100644
--- a/src/ephy-automation.c
+++ b/src/ephy-automation.c
@@ -90,8 +90,7 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant,
const CORBA_boolean raise,
CORBA_Environment * ev)
{
- EphyNewTabFlags flags;
- const char *load_page = NULL;
+ EphyNewTabFlags flags = 0;
EphyWindow *window;
Session *session;
@@ -115,33 +114,30 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant,
return;
}
- flags = EPHY_NEW_TAB_RAISE_WINDOW;
-
if (*url == '\0')
{
- flags |= EPHY_NEW_TAB_HOMEPAGE;
+ flags |= EPHY_NEW_TAB_HOME_PAGE;
}
else
{
- load_page = url;
- }
-
- if (open_in_new_window)
- {
- flags |= EPHY_NEW_TAB_IN_NEW_WINDOW;
+ flags |= EPHY_NEW_TAB_NEW_PAGE;
}
if (open_in_new_tab)
{
flags |= EPHY_NEW_TAB_IN_EXISTING_WINDOW;
}
+ else
+ {
+ flags |= EPHY_NEW_TAB_IN_NEW_WINDOW;
+ }
if (fullscreen)
{
- flags |= EPHY_NEW_TAB_FULLSCREEN;
+ flags |= EPHY_NEW_TAB_FULLSCREEN_MODE;
}
- ephy_shell_new_tab (ephy_shell, window, NULL, load_page,
+ ephy_shell_new_tab (ephy_shell, window, NULL, url,
flags);
}
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index e1605335c..aaefb7b66 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -329,7 +329,7 @@ cmd_open_bookmarks_in_tabs (EggAction *action,
EPHY_NODE_PAGE_PROP_LOCATION);
ephy_shell_new_tab (ephy_shell, window, NULL, location,
- EPHY_NEW_TAB_APPEND_GROUPED | EPHY_NEW_TAB_IN_EXISTING_WINDOW);
+ EPHY_NEW_TAB_OPEN_PAGE | EPHY_NEW_TAB_IN_EXISTING_WINDOW);
}
g_list_free (selection);
@@ -355,6 +355,7 @@ cmd_open_bookmarks_in_browser (EggAction *action,
EPHY_NODE_PAGE_PROP_LOCATION);
ephy_shell_new_tab (ephy_shell, window, NULL, location,
+ EPHY_NEW_TAB_OPEN_PAGE |
EPHY_NEW_TAB_IN_NEW_WINDOW);
}
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 4d0989a61..2e8766683 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -675,9 +675,9 @@ notebook_drag_data_received_cb (GtkWidget* widget, GdkDragContext *context,
{
tab = ephy_shell_new_tab (ephy_shell, window,
tab, url,
+ EPHY_NEW_TAB_OPEN_PAGE |
EPHY_NEW_TAB_IN_EXISTING_WINDOW |
EPHY_NEW_TAB_APPEND_LAST |
- EPHY_NEW_TAB_APPEND_AFTER |
EPHY_NEW_TAB_DONT_JUMP_TO);
}
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 6322a04ef..4fcbcdf28 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -473,7 +473,7 @@ ephy_shell_new_tab (EphyShell *shell,
EphyTab *tab;
EphyEmbed *embed;
gboolean in_new_window;
- gboolean grouped = FALSE;
+ gboolean grouped;
gboolean jump_to;
EphyEmbed *previous_embed = NULL;
GtkWidget *nb;
@@ -503,25 +503,19 @@ ephy_shell_new_tab (EphyShell *shell,
previous_embed = ephy_tab_get_embed (previous_tab);
}
- if (url != NULL || flags & EPHY_NEW_TAB_IS_A_COPY ||
- flags & EPHY_NEW_TAB_VIEW_SOURCE)
- {
- grouped = TRUE;
- }
-
- if (flags & EPHY_NEW_TAB_APPEND_GROUPED) grouped = TRUE;
- if (flags & EPHY_NEW_TAB_APPEND_LAST) grouped = FALSE;
+ grouped = (flags & EPHY_NEW_TAB_OPEN_PAGE ||
+ flags & EPHY_NEW_TAB_APPEND_GROUPED ||
+ flags & EPHY_NEW_TAB_CLONE_PAGE);
- if ((flags & EPHY_NEW_TAB_APPEND_AFTER) && previous_embed != NULL)
+ if (flags & EPHY_NEW_TAB_APPEND_AFTER)
{
+ g_assert (previous_embed != NULL);
nb = ephy_window_get_notebook (window);
- position = gtk_notebook_page_num (GTK_NOTEBOOK (nb),
+ position = gtk_notebook_page_num (GTK_NOTEBOOK (nb),
GTK_WIDGET (previous_embed)) + 1;
}
- else
- {
- position = grouped ? EPHY_NOTEBOOK_INSERT_GROUPED : EPHY_NOTEBOOK_INSERT_LAST;
- }
+
+ position = grouped ? EPHY_NOTEBOOK_INSERT_GROUPED : EPHY_NOTEBOOK_INSERT_LAST;
tab = ephy_tab_new ();
embed = ephy_tab_get_embed (tab);
@@ -529,46 +523,50 @@ ephy_shell_new_tab (EphyShell *shell,
ephy_window_add_tab (window, tab,
position,
jump_to);
+ gtk_widget_show (GTK_WIDGET(window));
- if (flags & EPHY_NEW_TAB_RAISE_WINDOW)
+ if (flags & EPHY_NEW_TAB_HOME_PAGE ||
+ flags & EPHY_NEW_TAB_NEW_PAGE)
{
- gtk_window_present (GTK_WINDOW(window));
- }
- else
- {
- gtk_widget_show (GTK_WIDGET(window));
+ Toolbar *toolbar;
+
+ toolbar = ephy_window_get_toolbar (window);
+ toolbar_edit_location (toolbar);
}
- if (flags & EPHY_NEW_TAB_HOMEPAGE)
+ if (flags & EPHY_NEW_TAB_HOME_PAGE)
{
- Toolbar *toolbar;
char *homepage;
homepage = build_homepage_url (shell, previous_embed);
g_assert (homepage != NULL);
- toolbar = ephy_window_get_toolbar (window);
- toolbar_edit_location (toolbar);
-
ephy_embed_load_url (embed, homepage);
g_free (homepage);
}
- else if ((flags & EPHY_NEW_TAB_IS_A_COPY) ||
- (flags & EPHY_NEW_TAB_VIEW_SOURCE))
+ else if (flags & EPHY_NEW_TAB_NEW_PAGE)
{
- EmbedDisplayType display_type =
- (flags & EPHY_NEW_TAB_VIEW_SOURCE) ?
- DISPLAY_AS_SOURCE : DISPLAY_NORMAL;
ephy_embed_load_url (embed, "about:blank");
- ephy_embed_copy_page (embed, previous_embed, display_type);
+ ephy_embed_copy_page (embed, previous_embed, DISPLAY_NORMAL);
}
- else if (url)
+ else if (flags & EPHY_NEW_TAB_OPEN_PAGE)
{
+ g_assert (url != NULL);
ephy_embed_load_url (embed, url);
}
+ else if (flags & EPHY_NEW_TAB_CLONE_PAGE)
+ {
+ EmbedDisplayType display_type;
+
+ display_type = (flags & EPHY_NEW_TAB_SOURCE_MODE) ?
+ DISPLAY_AS_SOURCE : DISPLAY_NORMAL;
+
+ ephy_embed_load_url (embed, "about:blank");
+ ephy_embed_copy_page (embed, previous_embed, display_type);
+ }
- if (flags & EPHY_NEW_TAB_FULLSCREEN)
+ if (flags & EPHY_NEW_TAB_FULLSCREEN_MODE)
{
ephy_window_set_chrome (window, EMBED_CHROME_OPENASFULLSCREEN |
EMBED_CHROME_DEFAULT);
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 08fd7658a..e45be6dd8 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -51,19 +51,24 @@ extern EphyShell *ephy_shell;
typedef enum
{
- EPHY_NEW_TAB_HOMEPAGE = 1 << 0,
- EPHY_NEW_TAB_FULLSCREEN = 1 << 1,
- EPHY_NEW_TAB_APPEND_GROUPED = 1 << 2,
- EPHY_NEW_TAB_APPEND_LAST = 1 << 3,
- EPHY_NEW_TAB_JUMP = 1 << 4,
- EPHY_NEW_TAB_DONT_JUMP_TO = 1 << 5,
- EPHY_NEW_TAB_RAISE_WINDOW = 1 << 6,
- EPHY_NEW_TAB_DONT_RAISE_WINDOW = 1 << 7,
- EPHY_NEW_TAB_IN_NEW_WINDOW = 1 << 8,
- EPHY_NEW_TAB_IN_EXISTING_WINDOW = 1 << 9,
- EPHY_NEW_TAB_IS_A_COPY = 1 << 10,
- EPHY_NEW_TAB_VIEW_SOURCE = 1 << 11,
- EPHY_NEW_TAB_APPEND_AFTER = 1 << 12
+ /* Page types */
+ EPHY_NEW_TAB_HOME_PAGE = 1 << 0,
+ EPHY_NEW_TAB_NEW_PAGE = 1 << 1,
+ EPHY_NEW_TAB_OPEN_PAGE = 1 << 2,
+ EPHY_NEW_TAB_CLONE_PAGE = 1 << 3,
+
+ /* Page mode */
+ EPHY_NEW_TAB_FULLSCREEN_MODE = 1 << 4,
+ EPHY_NEW_TAB_SOURCE_MODE = 1 << 5,
+
+ /* Tabs */
+ EPHY_NEW_TAB_APPEND_GROUPED = 1 << 6,
+ EPHY_NEW_TAB_APPEND_LAST = 1 << 7,
+ EPHY_NEW_TAB_APPEND_AFTER = 1 << 8,
+ EPHY_NEW_TAB_JUMP = 1 << 9,
+ EPHY_NEW_TAB_DONT_JUMP_TO = 1 << 10,
+ EPHY_NEW_TAB_IN_NEW_WINDOW = 1 << 11,
+ EPHY_NEW_TAB_IN_EXISTING_WINDOW = 1 << 12
} EphyNewTabFlags;
struct EphyShell
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 3b5c76f1a..de002689f 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -58,6 +58,7 @@ popup_cmd_link_in_new_window (EggAction *action,
ephy_shell_new_tab (ephy_shell, NULL, tab,
g_value_get_string (value),
+ EPHY_NEW_TAB_OPEN_PAGE |
EPHY_NEW_TAB_IN_NEW_WINDOW);
}
@@ -77,6 +78,7 @@ popup_cmd_link_in_new_tab (EggAction *action,
ephy_shell_new_tab (ephy_shell, window, tab,
g_value_get_string (value),
+ EPHY_NEW_TAB_OPEN_PAGE |
EPHY_NEW_TAB_IN_EXISTING_WINDOW);
}
@@ -96,6 +98,7 @@ popup_cmd_image_in_new_tab (EggAction *action,
ephy_shell_new_tab (ephy_shell, window, tab,
g_value_get_string (value),
+ EPHY_NEW_TAB_OPEN_PAGE |
EPHY_NEW_TAB_IN_EXISTING_WINDOW);
}
@@ -115,6 +118,7 @@ popup_cmd_image_in_new_window (EggAction *action,
ephy_shell_new_tab (ephy_shell, NULL, tab,
g_value_get_string (value),
+ EPHY_NEW_TAB_OPEN_PAGE |
EPHY_NEW_TAB_IN_NEW_WINDOW);
}
@@ -185,6 +189,7 @@ popup_cmd_frame_in_new_tab (EggAction *action,
ephy_shell_new_tab (ephy_shell, window, tab,
location,
+ EPHY_NEW_TAB_OPEN_PAGE |
EPHY_NEW_TAB_IN_EXISTING_WINDOW);
g_free (location);
@@ -206,6 +211,7 @@ popup_cmd_frame_in_new_window (EggAction *action,
ephy_shell_new_tab (ephy_shell, NULL, tab,
location,
+ EPHY_NEW_TAB_OPEN_PAGE |
EPHY_NEW_TAB_IN_NEW_WINDOW);
g_free (location);
diff --git a/src/window-commands.c b/src/window-commands.c
index 652b8c23e..9c6147043 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -224,9 +224,8 @@ window_cmd_file_new_window (EggAction *action,
tab = ephy_window_get_active_tab (window);
ephy_shell_new_tab (ephy_shell, NULL, tab, NULL,
- EPHY_NEW_TAB_HOMEPAGE |
- EPHY_NEW_TAB_IN_NEW_WINDOW |
- EPHY_NEW_TAB_JUMP);
+ EPHY_NEW_TAB_NEW_PAGE |
+ EPHY_NEW_TAB_IN_NEW_WINDOW);
}
void
@@ -238,7 +237,7 @@ window_cmd_file_new_tab (EggAction *action,
tab = ephy_window_get_active_tab (window);
ephy_shell_new_tab (ephy_shell, window, tab, NULL,
- EPHY_NEW_TAB_HOMEPAGE |
+ EPHY_NEW_TAB_NEW_PAGE |
EPHY_NEW_TAB_IN_EXISTING_WINDOW |
EPHY_NEW_TAB_JUMP);
}
@@ -593,7 +592,8 @@ window_cmd_view_page_source (EggAction *action,
g_return_if_fail (tab != NULL);
ephy_shell_new_tab (ephy_shell, window, tab, NULL,
- EPHY_NEW_TAB_VIEW_SOURCE);
+ EPHY_NEW_TAB_CLONE_PAGE |
+ EPHY_NEW_TAB_SOURCE_MODE);
}
void