From 57975a3760911acf0e7153d2955ad1640f110df6 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Fri, 24 Dec 2004 13:49:33 +0000 Subject: Remove obsolete ephy_window_load_in_tabs() and use generic link opening 2004-12-24 Christian Persch * src/ephy-notebook.c: (ephy_notebook_get_type), (notebook_drag_data_received_cb): * src/ephy-window.c: (open_link_cb), (ephy_window_init), (ephy_window_set_zoom): * src/ephy-window.h: Remove obsolete ephy_window_load_in_tabs() and use generic link opening framework instead. --- src/ephy-window.c | 64 +++++++++++++++---------------------------------------- 1 file changed, 17 insertions(+), 47 deletions(-) (limited to 'src/ephy-window.c') diff --git a/src/ephy-window.c b/src/ephy-window.c index 6d624ab54..58c1b4326 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -343,7 +343,6 @@ static guint ephy_popups_n_entries = G_N_ELEMENTS (ephy_popups_entries); #define CONF_LOCKDOWN_HIDE_MENUBAR "/apps/epiphany/lockdown/hide_menubar" #define CONF_DESKTOP_BG_PICTURE "/desktop/gnome/background/picture_filename" -#define INSANE_NUMBER_OF_URLS 20 #define BOOKMARKS_MENU_PATH "/menubar/BookmarksMenu" @@ -2418,6 +2417,11 @@ open_link_cb (EphyLink *link, g_return_val_if_fail (address != NULL, NULL); + if (tab == NULL) + { + tab = ephy_window_get_active_tab (window); + } + if (flags != 0) { EphyNewTabFlags ntflags = EPHY_NEW_TAB_OPEN_PAGE; @@ -2437,15 +2441,19 @@ open_link_cb (EphyLink *link, new_tab = ephy_shell_new_tab (ephy_shell, - tab ? EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))) - : window, - tab ? tab : ephy_window_get_active_tab (window), - address, ntflags); + EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab))), + tab, address, ntflags); } else { - ephy_window_load_url (window, address); - new_tab = ephy_window_get_active_tab (window); + EphyEmbed *embed; + + embed = ephy_tab_get_embed (tab); + + ephy_embed_load_url (embed, address); + ephy_embed_activate (embed); + + new_tab = tab; } return new_tab; @@ -2473,6 +2481,8 @@ ephy_window_init (EphyWindow *window) setup_ui_manager (window); window->priv->notebook = setup_notebook (window); + g_signal_connect (window->priv->notebook, "open-link", + G_CALLBACK (open_link_cb), window); gtk_box_pack_start (GTK_BOX (window->priv->main_vbox), GTK_WIDGET (window->priv->notebook), TRUE, TRUE, 0); @@ -3132,46 +3142,6 @@ ephy_window_set_zoom (EphyWindow *window, } } -void -ephy_window_load_in_tabs (EphyWindow *window, - EphyTab *tab, - char **uris) -{ - EphyEmbed *embed = NULL; - guint num; - - g_return_if_fail (uris != NULL); - - if (tab != NULL) - { - embed = ephy_tab_get_embed (tab); - g_return_if_fail (EPHY_IS_EMBED (embed)); - } - - for (num = 0; uris[num] != NULL && num < INSANE_NUMBER_OF_URLS; num++) - { - const char *url = uris[num]; - - if (num == 0 && embed != NULL) - { - /** - * The first url is special: if the drag was to an - * existing tab, load it there - */ - ephy_embed_load_url (embed, url); - } - else - { - tab = ephy_shell_new_tab (ephy_shell, window, - tab, url, - EPHY_NEW_TAB_OPEN_PAGE | - EPHY_NEW_TAB_IN_EXISTING_WINDOW | - (tab ? EPHY_NEW_TAB_APPEND_AFTER : - EPHY_NEW_TAB_APPEND_LAST)); - } - } -} - static void sync_prefs_with_chrome (EphyWindow *window) { -- cgit v1.2.3