From 881bfd24e673370efefc8f5ceb3cec3afa9e44bc Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Tue, 24 Feb 2004 17:43:48 +0000 Subject: Make EphyTab inherit from GtkBin, and contain the EphyEmbed as its child. 2004-02-24 Christian Persch * 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. --- src/ephy-tabs-menu.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'src/ephy-tabs-menu.c') diff --git a/src/ephy-tabs-menu.c b/src/ephy-tabs-menu.c index ffa4a7058..df6984627 100644 --- a/src/ephy-tabs-menu.c +++ b/src/ephy-tabs-menu.c @@ -38,10 +38,6 @@ #define MAX_LABEL_LENGTH 30 -/** - * Private data - */ - #define EPHY_TABS_MENU_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TABS_MENU, EphyTabsMenuPrivate)) struct _EphyTabsMenuPrivate @@ -51,9 +47,6 @@ struct _EphyTabsMenuPrivate guint ui_id; }; -/** - * Private functions, only availble from this file - */ static void ephy_tabs_menu_class_init (EphyTabsMenuClass *klass); static void ephy_tabs_menu_init (EphyTabsMenu *menu); @@ -63,10 +56,6 @@ enum PROP_WINDOW }; -/** - * EphyTabsMenu object - */ - GType ephy_tabs_menu_get_type (void) { @@ -96,13 +85,11 @@ ephy_tabs_menu_get_type (void) } static void -tab_added_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyTabsMenu *menu) +tab_added_cb (EphyNotebook *notebook, EphyTab *tab, EphyTabsMenu *menu) { - EphyTab *tab; GtkAction *action; - g_return_if_fail (EPHY_IS_EMBED (embed)); - tab = ephy_tab_for_embed (embed); + g_return_if_fail (EPHY_IS_TAB (tab)); action = GTK_ACTION (ephy_tab_get_action (tab)); gtk_action_group_add_action (menu->priv->action_group, action); @@ -111,13 +98,11 @@ tab_added_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyTabsMenu *menu) } static void -tab_removed_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyTabsMenu *menu) +tab_removed_cb (EphyNotebook *notebook, EphyTab *tab, EphyTabsMenu *menu) { - EphyTab *tab; GtkAction *action; - g_return_if_fail (EPHY_IS_EMBED (embed)); - tab = ephy_tab_for_embed (embed); + g_return_if_fail (EPHY_IS_TAB (tab)); action = GTK_ACTION (ephy_tab_get_action (tab)); gtk_action_group_remove_action (menu->priv->action_group, action); @@ -125,6 +110,12 @@ tab_removed_cb (EphyNotebook *notebook, EphyEmbed *embed, EphyTabsMenu *menu) ephy_tabs_menu_update (menu); } +static void +tabs_reordered_cb (EphyNotebook *notebook, EphyTabsMenu *menu) +{ + ephy_tabs_menu_update (menu); +} + static void ephy_tabs_menu_set_window (EphyTabsMenu *menu, EphyWindow *window) { @@ -143,6 +134,8 @@ ephy_tabs_menu_set_window (EphyTabsMenu *menu, EphyWindow *window) G_CALLBACK (tab_added_cb), menu, 0); g_signal_connect_object (notebook, "tab_removed", G_CALLBACK (tab_removed_cb), menu, 0); + g_signal_connect_object (notebook, "tabs_reordered", + G_CALLBACK (tabs_reordered_cb), menu, 0); } static void @@ -281,7 +274,6 @@ ephy_tabs_menu_update (EphyTabsMenu *menu) EphyTab *tab; GtkAction *action; guint i = 0; - guint num = 0; GList *tabs = NULL, *l; g_return_if_fail (EPHY_IS_TABS_MENU (menu)); @@ -296,8 +288,7 @@ ephy_tabs_menu_update (EphyTabsMenu *menu) tabs = ephy_window_get_tabs (p->window); - num = g_list_length (tabs); - if (num == 0) return; + if (g_list_length (tabs) == 0) return; p->ui_id = gtk_ui_manager_new_merge_id (merge); @@ -306,7 +297,6 @@ ephy_tabs_menu_update (EphyTabsMenu *menu) const char *action_name; char *name; - tab = (EphyTab *) l->data; action = GTK_ACTION (ephy_tab_get_action (tab)); action_name = gtk_action_get_name (action); -- cgit v1.2.3