diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-02-25 01:43:48 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-02-25 01:43:48 +0800 |
commit | 881bfd24e673370efefc8f5ceb3cec3afa9e44bc (patch) | |
tree | 49ade73b432ced4cc693e48ab9710999dc622286 /src/ephy-window.c | |
parent | cb176ab1f40f443c4051fb430c8b6ccb79290f67 (diff) | |
download | gsoc2013-epiphany-881bfd24e673370efefc8f5ceb3cec3afa9e44bc.tar gsoc2013-epiphany-881bfd24e673370efefc8f5ceb3cec3afa9e44bc.tar.gz gsoc2013-epiphany-881bfd24e673370efefc8f5ceb3cec3afa9e44bc.tar.bz2 gsoc2013-epiphany-881bfd24e673370efefc8f5ceb3cec3afa9e44bc.tar.lz gsoc2013-epiphany-881bfd24e673370efefc8f5ceb3cec3afa9e44bc.tar.xz gsoc2013-epiphany-881bfd24e673370efefc8f5ceb3cec3afa9e44bc.tar.zst gsoc2013-epiphany-881bfd24e673370efefc8f5ceb3cec3afa9e44bc.zip |
Make EphyTab inherit from GtkBin, and contain the EphyEmbed as its child.
2004-02-24 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-nautilus-view.c: (gnv_embed_new_window_cb):
* src/ephy-notebook.c: (ephy_notebook_class_init),
(tab_label_size_request_cb), (ephy_notebook_move_tab), (move_tab),
(motion_notify_cb), (move_tab_to_another_notebook),
(button_release_cb), (ephy_notebook_switch_page_cb),
(ephy_notebook_init), (close_button_clicked_cb), (build_tab_label),
(ephy_notebook_insert_tab), (smart_tab_switching_on_closure),
(ephy_notebook_remove_tab):
* src/ephy-notebook.h:
* src/ephy-session.c: (tab_added_cb), (tab_removed_cb):
* src/ephy-shell.c: (ephy_shell_new_tab):
* src/ephy-tab.c: (ephy_tab_get_type), (ephy_tab_size_allocate),
(ephy_tab_parent_set), (ephy_tab_class_init), (ephy_tab_finalize),
(ephy_tab_new), (ephy_tab_get_embed), (ephy_tab_for_embed),
(ephy_tab_new_window_cb), (let_me_resize_hack),
(ephy_tab_visibility_cb), (ephy_tab_size_to_cb),
(ephy_tab_dom_mouse_click_cb), (ephy_tab_init),
(ephy_tab_update_navigation_flags), (ephy_tab_set_title):
* src/ephy-tab.h:
* src/ephy-tabs-menu.c: (tab_added_cb), (tab_removed_cb),
(tabs_reordered_cb), (ephy_tabs_menu_set_window),
(ephy_tabs_menu_update):
* src/ephy-window.c: (tab_added_cb), (tab_removed_cb),
(tab_detached_cb), (tabs_reordered_cb), (tab_delete_cb),
(setup_notebook), (ephy_window_add_tab), (ephy_window_jump_to_tab),
(real_get_active_tab), (ephy_window_remove_tab),
(ephy_window_get_active_tab), (ephy_window_get_active_embed),
(ephy_window_get_tabs):
* src/ephy-window.h:
* src/window-commands.c: (window_cmd_tabs_move_left),
(window_cmd_tabs_move_right), (window_cmd_tabs_detach):
Make EphyTab inherit from GtkBin, and contain the EphyEmbed as its child.
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r-- | src/ephy-window.c | 103 |
1 files changed, 45 insertions, 58 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index 193858355..0b3a4fa5e 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1563,12 +1563,11 @@ update_tabs_menu_sensitivity (EphyWindow *window) } static void -tab_added_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyWindow *window) +tab_added_cb (EphyNotebook *notebook, + EphyTab *tab, + EphyWindow *window) { - EphyTab *tab; - - g_return_if_fail (EPHY_IS_EMBED (embed)); - tab = ephy_tab_for_embed (embed); + g_return_if_fail (EPHY_IS_TAB (tab)); window->priv->num_tabs++; @@ -1579,12 +1578,11 @@ tab_added_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyWindow *window) } static void -tab_removed_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyWindow *window) +tab_removed_cb (EphyNotebook *notebook, + EphyTab *tab, + EphyWindow *window) { - EphyTab *tab; - - g_return_if_fail (EPHY_IS_EMBED (embed)); - tab = ephy_tab_for_embed (embed); + g_return_if_fail (EPHY_IS_TAB (tab)); g_signal_handlers_disconnect_by_func (G_OBJECT (tab), G_CALLBACK (sync_tab_visibility), @@ -1604,18 +1602,18 @@ tab_removed_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyWindow *window) } static void -tab_detached_cb (EphyNotebook *notebook, GtkWidget *child, +tab_detached_cb (EphyNotebook *notebook, + EphyTab *tab, gpointer data) { EphyWindow *window; - g_return_if_fail (EPHY_IS_NOTEBOOK (notebook)); - g_return_if_fail (EPHY_IS_EMBED (child)); + g_return_if_fail (EPHY_IS_TAB (tab)); window = ephy_window_new (); - ephy_notebook_move_page (notebook, - EPHY_NOTEBOOK (ephy_window_get_notebook (window)), - child, 0); + ephy_notebook_move_tab (notebook, + EPHY_NOTEBOOK (ephy_window_get_notebook (window)), + tab, 0); gtk_widget_show (GTK_WIDGET (window)); } @@ -1623,15 +1621,16 @@ static void tabs_reordered_cb (EphyNotebook *notebook, EphyWindow *window) { update_tabs_menu_sensitivity (window); - ephy_tabs_menu_update (window->priv->tabs_menu); } static gboolean -tab_delete_cb (EphyNotebook *notebook, GtkWidget *child, EphyWindow *window) +tab_delete_cb (EphyNotebook *notebook, + EphyTab *tab, + EphyWindow *window) { - g_return_val_if_fail (EPHY_IS_EMBED (child), FALSE); + g_return_val_if_fail (EPHY_IS_TAB (tab), FALSE); - if (ephy_embed_has_modified_forms (EPHY_EMBED (child))) + if (ephy_embed_has_modified_forms (ephy_tab_get_embed (tab))) { return !confirm_close_with_modified_forms (window); } @@ -1645,9 +1644,6 @@ setup_notebook (EphyWindow *window) GtkNotebook *notebook; notebook = GTK_NOTEBOOK (ephy_notebook_new ()); - gtk_notebook_set_scrollable (notebook, TRUE); - gtk_notebook_set_show_border (notebook, FALSE); - gtk_notebook_set_show_tabs (notebook, FALSE); g_signal_connect_after (G_OBJECT (notebook), "switch_page", G_CALLBACK ( @@ -2126,21 +2122,18 @@ ephy_window_add_tab (EphyWindow *window, widget = GTK_WIDGET(ephy_tab_get_embed (tab)); - ephy_notebook_insert_page (EPHY_NOTEBOOK (window->priv->notebook), - widget, position, jump_to); + ephy_notebook_insert_tab (EPHY_NOTEBOOK (window->priv->notebook), + tab, position, jump_to); } void ephy_window_jump_to_tab (EphyWindow *window, - EphyTab *tab) + EphyTab *tab) { - GtkWidget *widget; int page; - widget = GTK_WIDGET(ephy_tab_get_embed (tab)); - page = gtk_notebook_page_num - (window->priv->notebook, widget); + (window->priv->notebook, GTK_WIDGET (tab)); gtk_notebook_set_current_page (window->priv->notebook, page); } @@ -2148,21 +2141,17 @@ ephy_window_jump_to_tab (EphyWindow *window, static EphyTab * real_get_active_tab (EphyWindow *window, int page_num) { - EphyTab *tab; - GtkWidget *embed_widget; + GtkWidget *tab; if (page_num == -1) { page_num = gtk_notebook_get_current_page (window->priv->notebook); } - embed_widget = gtk_notebook_get_nth_page (window->priv->notebook, - page_num); + tab = gtk_notebook_get_nth_page (window->priv->notebook, page_num); - g_return_val_if_fail (GTK_IS_WIDGET (embed_widget), NULL); - tab = ephy_tab_for_embed (EPHY_EMBED (embed_widget)); g_return_val_if_fail (EPHY_IS_TAB (tab), NULL); - return tab; + return EPHY_TAB (tab); } void @@ -2186,8 +2175,7 @@ ephy_window_remove_tab (EphyWindow *window, return; } - ephy_notebook_remove_page (EPHY_NOTEBOOK (window->priv->notebook), - GTK_WIDGET (embed)); + ephy_notebook_remove_tab (EPHY_NOTEBOOK (window->priv->notebook), tab); } /** @@ -2264,6 +2252,7 @@ EphyTab * ephy_window_get_active_tab (EphyWindow *window) { g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL); + g_return_val_if_fail (EPHY_IS_TAB (window->priv->active_tab), NULL); return window->priv->active_tab; } @@ -2276,35 +2265,33 @@ ephy_window_get_active_embed (EphyWindow *window) g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL); tab = ephy_window_get_active_tab (window); + g_return_val_if_fail (EPHY_IS_TAB (tab), NULL); - if (tab) - { - return ephy_tab_get_embed (tab); - } - - return NULL; + return ephy_tab_get_embed (tab); } +/** + * ephy_window_get_tabs: + * @window: a #EphyWindow + * + * Returns the list of #EphyTab:s in the window. + * + */ GList * ephy_window_get_tabs (EphyWindow *window) { - GList *tabs = NULL; - GtkWidget *w; - int i = 0; + GtkNotebook *notebook; + GList *list = NULL; + int i, num; - while ((w = gtk_notebook_get_nth_page (window->priv->notebook, i)) != NULL) + notebook = GTK_NOTEBOOK (window->priv->notebook); + num = gtk_notebook_get_n_pages (notebook); + for (i = 0; i < num; i++) { - EphyTab *tab; - - g_return_val_if_fail (EPHY_IS_EMBED (w), NULL); - tab = ephy_tab_for_embed (EPHY_EMBED (w)); - g_return_val_if_fail (EPHY_IS_TAB (tab), NULL); - - tabs = g_list_prepend (tabs, tab); - i++; + list = g_list_prepend (list, gtk_notebook_get_nth_page (notebook, i)); } - return g_list_reverse (tabs); + return g_list_reverse (list); } static void |