static void ephy_notebook_remove (GtkContainer *container, GtkWidget *tab_widget) { GtkNotebook *gnotebook = GTK_NOTEBOOK (container); EphyNotebook *notebook = EPHY_NOTEBOOK (container); int position, curr; if (!EPHY_IS_EMBED (tab_widget)) return; /* Remove the page from the focused pages list */ notebook->focused_pages = g_list_remove (notebook->focused_pages, tab_widget); position = gtk_notebook_page_num (gnotebook, tab_widget); curr = gtk_notebook_get_current_page (gnotebook); if (position == curr) { smart_tab_switching_on_closure (notebook, tab_widget); } GTK_CONTAINER_CLASS (ephy_notebook_parent_class)->remove (container, tab_widget); update_tabs_visibility (notebook, FALSE); }
/** * ephy_embed_container_remove_child: * @container: an #EphyEmbedContainer * @child: an #EphyEmbed * * Removes @child from @container. **/ void ephy_embed_container_remove_child (EphyEmbedContainer *container, EphyEmbed *child) { EphyEmbedContainerInterface *iface; g_return_if_fail (EPHY_IS_EMBED_CONTAINER (container)); g_return_if_fail (EPHY_IS_EMBED (child)); iface = EPHY_EMBED_CONTAINER_GET_IFACE (container); iface->remove_child (container, child); }
/** * ephy_embed_container_add_child: * @container: an #EphyEmbedContainer * @child: an #EphyEmbed * @position: the position in @container's * @set_active: whether to set @embed as the active child of @container * after insertion * * Inserts @child into @container. * * Return value: @child's new position inside @container. **/ gint ephy_embed_container_add_child (EphyEmbedContainer *container, EphyEmbed *child, gint position, gboolean set_active) { EphyEmbedContainerInterface *iface; g_return_val_if_fail (EPHY_IS_EMBED_CONTAINER (container), -1); g_return_val_if_fail (EPHY_IS_EMBED (child), -1); iface = EPHY_EMBED_CONTAINER_GET_IFACE (container); return iface->add_child (container, child, position, set_active); }
static void impl_detach_tab (EphyExtension *ext, EphyWindow *window, EphyEmbed *embed) { WebKitWebView *web_view; LOG ("impl_detach_tab"); g_return_if_fail (EPHY_IS_EMBED (embed)); web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); g_signal_handlers_disconnect_by_func (web_view, G_CALLBACK (button_press_event_cb), ext); g_signal_handlers_disconnect_by_func (web_view, G_CALLBACK (hovering_over_link_cb), ext); g_signal_handlers_disconnect_by_func (web_view, G_CALLBACK (load_status_notify_cb), ext); }
static void impl_attach_tab (EphyExtension *ext, EphyWindow *window, EphyEmbed *embed) { WebKitWebView *web_view; LOG ("impl_attach_tab"); g_return_if_fail (EPHY_IS_EMBED (embed)); web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); g_signal_connect (web_view, "button-press-event", G_CALLBACK (button_press_event_cb), ext); g_signal_connect (web_view, "hovering-over-link", G_CALLBACK (hovering_over_link_cb), ext); g_signal_connect (web_view, "notify::load-status", G_CALLBACK (load_status_notify_cb), ext); }
static int ephy_notebook_insert_page (GtkNotebook *gnotebook, GtkWidget *tab_widget, GtkWidget *tab_label, GtkWidget *menu_label, int position) { EphyNotebook *notebook = EPHY_NOTEBOOK (gnotebook); /* Destroy passed-in tab label */ if (tab_label != NULL) { g_object_ref_sink (tab_label); g_object_unref (tab_label); } g_assert (EPHY_IS_EMBED (tab_widget)); tab_label = build_tab_label (notebook, EPHY_EMBED (tab_widget)); update_tabs_visibility (notebook, TRUE); position = GTK_NOTEBOOK_CLASS (ephy_notebook_parent_class)->insert_page (gnotebook, tab_widget, tab_label, menu_label, position); gtk_notebook_set_tab_reorderable (gnotebook, tab_widget, TRUE); gtk_notebook_set_tab_detachable (gnotebook, tab_widget, TRUE); gtk_container_child_set (GTK_CONTAINER (gnotebook), GTK_WIDGET (tab_widget), "tab-expand", g_settings_get_boolean (EPHY_SETTINGS_UI, EPHY_PREFS_UI_EXPAND_TABS_BAR), NULL); return position; }