aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@igalia.com>2012-02-09 17:21:38 +0800
committerDiego Escalante Urrelo <diegoe@igalia.com>2012-02-22 23:55:19 +0800
commitf1fd22a86d2ff32d78494e68ae7ab865c454b88c (patch)
tree78f086a3ef8f14a4ee1e0e1dde91f1f650170cbf
parent75e3424275e8d45268bdf8c48e9be9dc23b4f713 (diff)
downloadgsoc2013-epiphany-f1fd22a86d2ff32d78494e68ae7ab865c454b88c.tar
gsoc2013-epiphany-f1fd22a86d2ff32d78494e68ae7ab865c454b88c.tar.gz
gsoc2013-epiphany-f1fd22a86d2ff32d78494e68ae7ab865c454b88c.tar.bz2
gsoc2013-epiphany-f1fd22a86d2ff32d78494e68ae7ab865c454b88c.tar.lz
gsoc2013-epiphany-f1fd22a86d2ff32d78494e68ae7ab865c454b88c.tar.xz
gsoc2013-epiphany-f1fd22a86d2ff32d78494e68ae7ab865c454b88c.tar.zst
gsoc2013-epiphany-f1fd22a86d2ff32d78494e68ae7ab865c454b88c.zip
ephy-web-view: remove close-requested signal
WebKitWebView has a ::close-web-view signal for the same thing. The only user of this was ephy-window, for exactly the same thing that we are already doing in ephy-web-view, when handling ::close-web-view. https://bugzilla.gnome.org/show_bug.cgi?id=669737
-rw-r--r--embed/ephy-web-view.c16
-rw-r--r--embed/ephy-web-view.h1
-rw-r--r--src/ephy-window.c94
3 files changed, 0 insertions, 111 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 5ce89b793..2b5272e68 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1452,22 +1452,6 @@ ephy_web_view_class_init (EphyWebViewClass *klass)
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
- * EphyWebView::close-request
- * @view: the #EphyWebView that received the signal
- *
- * The ::close signal is emitted when the embed requests closing.
- * Return %TRUE to prevent closing. You HAVE to process removal of the embed
- * as soon as possible after that.
- **/
- g_signal_new ("close-request",
- EPHY_TYPE_WEB_VIEW,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EphyWebViewClass, close_request),
- g_signal_accumulator_true_handled, NULL,
- g_cclosure_marshal_generic,
- G_TYPE_BOOLEAN,
- 0);
-/**
* EphyWebView::content-blocked:
* @view: the #EphyWebView that received the signal
* @uri: blocked URI
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index c05461eeb..789d6cfa5 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -121,7 +121,6 @@ struct _EphyWebViewClass
EphyWebView *new_view);
gboolean (* search_key_press) (EphyWebView *view,
GdkEventKey *event);
- gboolean (* close_request) (EphyWebView *view);
void (* new_document_now) (EphyWebView *view,
const char *uri);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index da5defbb8..99234258a 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -338,9 +338,7 @@ struct _EphyWindowPrivate
GtkNotebook *notebook;
EphyEmbed *active_embed;
EphyFindToolbar *find_toolbar;
- guint num_tabs;
EphyWebViewChrome chrome;
- GHashTable *tabs_to_remove;
EphyEmbedEvent *context_event;
guint idle_worker;
GtkWidget *downloads_box;
@@ -2419,75 +2417,6 @@ embed_modal_alert_cb (EphyEmbed *embed,
return FALSE;
}
-static gboolean
-idle_tab_remove_cb (GtkWidget *tab)
-{
- GtkWidget *toplevel;
- EphyWindow *window;
- EphyWindowPrivate *priv;
- GtkNotebook *notebook;
- int position;
-
- toplevel = gtk_widget_get_toplevel (tab);
- if (!EPHY_IS_WINDOW (toplevel)) return FALSE; /* FIXME should this ever occur? */
-
- window = EPHY_WINDOW (toplevel);
- priv = window->priv;
-
- if (priv->closing) return FALSE;
-
- g_hash_table_remove (priv->tabs_to_remove, tab);
-
- notebook = GTK_NOTEBOOK (ephy_window_get_notebook (window));
-
- position = gtk_notebook_page_num (notebook, tab);
- gtk_notebook_remove_page (notebook, position);
-
- /* don't run again */
- return FALSE;
-}
-
-static void
-schedule_tab_close (EphyWindow *window,
- EphyEmbed *embed)
-{
- EphyWindowPrivate *priv = window->priv;
- guint id;
-
- LOG ("scheduling close of embed %p in window %p", embed, window);
-
- if (priv->closing) return;
-
- if (g_hash_table_lookup (priv->tabs_to_remove, embed) != NULL) return;
-
- /* do this on idle, because otherwise we'll crash in certain circumstances
- * (see galeon bug #116256)
- */
- id = g_idle_add_full (G_PRIORITY_HIGH_IDLE,
- (GSourceFunc) idle_tab_remove_cb,
- embed, NULL);
-
- g_hash_table_insert (priv->tabs_to_remove, embed, GUINT_TO_POINTER (id));
-
- /* don't wait until idle to hide the window */
- if (g_hash_table_size (priv->tabs_to_remove) == priv->num_tabs)
- {
- gtk_widget_hide (GTK_WIDGET (window));
- }
-}
-
-static gboolean
-embed_close_request_cb (EphyEmbed *embed,
- EphyWindow *window)
-{
- LOG ("embed_close_request_cb embed %p window %p", embed, window);
-
- schedule_tab_close (window, embed);
-
- /* handled */
- return TRUE;
-}
-
static void
tab_accels_item_activate (GtkAction *action,
EphyWindow *window)
@@ -2642,16 +2571,12 @@ notebook_page_added_cb (EphyNotebook *notebook,
g_return_if_fail (EPHY_IS_EMBED (embed));
- priv->num_tabs++;
#if 0
g_signal_connect_object (embed, "open-link",
G_CALLBACK (ephy_link_open), window,
G_CONNECT_SWAPPED);
#endif
- g_signal_connect_object (ephy_embed_get_web_view (embed), "close-request",
- G_CALLBACK (embed_close_request_cb),
- window, 0);
g_signal_connect_object (ephy_embed_get_web_view (embed), "ge-modal-alert",
G_CALLBACK (embed_modal_alert_cb), window, G_CONNECT_AFTER);
@@ -2693,12 +2618,8 @@ notebook_page_removed_cb (EphyNotebook *notebook,
window);
#endif
- priv->num_tabs--;
-
g_signal_handlers_disconnect_by_func
(ephy_embed_get_web_view (embed), G_CALLBACK (embed_modal_alert_cb), window);
- g_signal_handlers_disconnect_by_func
- (ephy_embed_get_web_view (embed), G_CALLBACK (embed_close_request_cb), window);
tab_accels_update (window);
}
@@ -2975,8 +2896,6 @@ ephy_window_dispose (GObject *object)
single = ephy_embed_shell_get_embed_single (embed_shell);
g_signal_handlers_disconnect_by_func
(single, G_CALLBACK (sync_network_status), window);
-
- g_hash_table_remove_all (priv->tabs_to_remove);
g_object_unref (priv->enc_menu);
priv->enc_menu = NULL;
@@ -3127,8 +3046,6 @@ ephy_window_finalize (GObject *object)
EphyWindow *window = EPHY_WINDOW (object);
EphyWindowPrivate *priv = window->priv;
- g_hash_table_destroy (priv->tabs_to_remove);
-
if (priv->set_focus_handler != 0)
g_signal_handler_disconnect (window,
priv->set_focus_handler);
@@ -3139,14 +3056,6 @@ ephy_window_finalize (GObject *object)
}
static void
-cancel_handler (gpointer idptr)
-{
- guint id = GPOINTER_TO_UINT (idptr);
-
- g_source_remove (id);
-}
-
-static void
find_toolbar_close_cb (EphyFindToolbar *toolbar,
EphyWindow *window)
{
@@ -3283,9 +3192,6 @@ ephy_window_constructor (GType type,
priv = window->priv;
- priv->tabs_to_remove = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- NULL, cancel_handler);
-
ephy_gui_ensure_window_group (GTK_WINDOW (window));
/* initialize the listener for the key theme