diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-12-24 21:49:33 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-12-24 21:49:33 +0800 |
commit | 57975a3760911acf0e7153d2955ad1640f110df6 (patch) | |
tree | c4f84ace48187f4fab55382a9328cd5ce30c7bea /src/ephy-notebook.c | |
parent | acfb18598072007d69bf4eaca299737542904dfe (diff) | |
download | gsoc2013-epiphany-57975a3760911acf0e7153d2955ad1640f110df6.tar gsoc2013-epiphany-57975a3760911acf0e7153d2955ad1640f110df6.tar.gz gsoc2013-epiphany-57975a3760911acf0e7153d2955ad1640f110df6.tar.bz2 gsoc2013-epiphany-57975a3760911acf0e7153d2955ad1640f110df6.tar.lz gsoc2013-epiphany-57975a3760911acf0e7153d2955ad1640f110df6.tar.xz gsoc2013-epiphany-57975a3760911acf0e7153d2955ad1640f110df6.tar.zst gsoc2013-epiphany-57975a3760911acf0e7153d2955ad1640f110df6.zip |
Remove obsolete ephy_window_load_in_tabs() and use generic link opening
2004-12-24 Christian Persch <chpe@cvs.gnome.org>
* 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.
Diffstat (limited to 'src/ephy-notebook.c')
-rw-r--r-- | src/ephy-notebook.c | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c index e37e3cb7f..fe10ca09b 100644 --- a/src/ephy-notebook.c +++ b/src/ephy-notebook.c @@ -32,9 +32,10 @@ #include "ephy-embed.h" #include "ephy-window.h" #include "ephy-shell.h" -#include "ephy-debug.h" #include "ephy-favicon-cache.h" #include "ephy-spinner.h" +#include "ephy-link.h" +#include "ephy-debug.h" #include <glib-object.h> #include <gtk/gtkeventbox.h> @@ -56,6 +57,8 @@ #define AFTER_ALL_TABS -1 #define NOT_IN_APP_WINDOWS -2 +#define INSANE_NUMBER_OF_URLS 20 + #define EPHY_NOTEBOOK_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NOTEBOOK, EphyNotebookPrivate)) struct EphyNotebookPrivate @@ -103,11 +106,11 @@ static GObjectClass *parent_class = NULL; GType ephy_notebook_get_type (void) { - static GType type = 0; + static GType type = 0; - if (G_UNLIKELY (type == 0)) - { - static const GTypeInfo our_info = + if (G_UNLIKELY (type == 0)) + { + static const GTypeInfo our_info = { sizeof (EphyNotebookClass), NULL, /* base_init */ @@ -120,12 +123,22 @@ ephy_notebook_get_type (void) (GInstanceInitFunc) ephy_notebook_init }; - type = g_type_register_static (GTK_TYPE_NOTEBOOK, - "EphyNotebook", - &our_info, 0); - } + static const GInterfaceInfo link_info = + { + NULL, + NULL, + NULL + }; + + type = g_type_register_static (GTK_TYPE_NOTEBOOK, + "EphyNotebook", + &our_info, 0); + g_type_add_interface_static (type, + EPHY_TYPE_LINK, + &link_info); + } - return type; + return type; } static void @@ -575,6 +588,7 @@ notebook_drag_data_received_cb (GtkWidget* widget, GdkDragContext *context, guint info, guint time, EphyTab *tab) { EphyWindow *window; + GtkWidget *notebook; g_signal_stop_emission_by_name (widget, "drag_data_received"); @@ -583,33 +597,36 @@ notebook_drag_data_received_cb (GtkWidget* widget, GdkDragContext *context, if (selection_data->length <= 0 || selection_data->data == NULL) return; window = EPHY_WINDOW (gtk_widget_get_toplevel (widget)); + notebook = ephy_window_get_notebook (window); if (selection_data->target == gdk_atom_intern (EPHY_DND_URL_TYPE, FALSE)) { - char *uris[2] = { NULL, NULL }; char **split; /* URL_TYPE has format: url \n title */ split = g_strsplit (selection_data->data, "\n", 2); - if (split != NULL && split[0] != NULL) + if (split != NULL && split[0] != NULL && split[0][0] != '\0') { - uris[0] = split[0]; - ephy_window_load_in_tabs (window, tab, uris); + ephy_link_open (EPHY_LINK (notebook), split[0], tab, + tab ? 0 : EPHY_LINK_NEW_TAB); } g_strfreev (split); } else if (selection_data->target == gdk_atom_intern (EPHY_DND_URI_LIST_TYPE, FALSE)) { char **uris; + int i; uris = gtk_selection_data_get_uris (selection_data); + if (uris == NULL) return; - if (uris != NULL) + for (i = 0; uris[i] != NULL && i < INSANE_NUMBER_OF_URLS; i++) { - ephy_window_load_in_tabs (window, tab, uris); - - g_strfreev (uris); + tab = ephy_link_open (EPHY_LINK (notebook), uris[i], + tab, i == 0 ? 0 : EPHY_LINK_NEW_TAB); } + + g_strfreev (uris); } else { |