From 459706710945ea711d80311308916d77c3cb0cf3 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Thu, 23 Mar 2006 16:43:28 +0000 Subject: Port notebook DND to gtk+ 2.9. 2006-03-23 Christian Persch * configure.ac: * data/ui/epiphany-ui.xml: * src/ephy-lockdown.c: (update_window): * src/ephy-notebook.c: (ephy_notebook_class_init), (button_press_cb), (ephy_notebook_init), (tab_label_weak_notify_cb), (build_tab_label): * src/ephy-notebook.h: * src/ephy-session.c: (notebook_page_added_cb), (notebook_page_removed_cb), (notebook_page_reordered_cb), (impl_attach_window): * src/ephy-tabs-menu.c: (notebook_page_added_cb), (notebook_page_removed_cb), (notebook_page_reordered_cb), (ephy_tabs_menu_set_window): * src/ephy-window.c: (update_tabs_menu_sensitivity), (idle_tab_remove_cb), (notebook_page_added_cb), (notebook_page_removed_cb), (notebook_page_reordered_cb), (notebook_page_close_request_cb), (setup_notebook), (ephy_window_remove_tab), (notebook_switch_page_cb): * src/epiphany.defs: * src/window-commands.c: (window_cmd_tabs_move_left), (window_cmd_tabs_move_right): Port notebook DND to gtk+ 2.9. --- src/window-commands.c | 61 ++++++++++++++------------------------------------- 1 file changed, 16 insertions(+), 45 deletions(-) (limited to 'src/window-commands.c') diff --git a/src/window-commands.c b/src/window-commands.c index f0f6b04e8..fa36cfc9b 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -833,61 +833,32 @@ void window_cmd_tabs_move_left (GtkAction *action, EphyWindow *window) { - GtkWidget *notebook; + GtkWidget *child; + GtkNotebook *notebook; int page; - notebook = ephy_window_get_notebook (window); - page = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)); - - if (page > 0) - { - GtkWidget *child; + notebook = GTK_NOTEBOOK (ephy_window_get_notebook (window)); + page = gtk_notebook_get_current_page (notebook); + if (page < 1) return; - child = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page); - ephy_notebook_move_tab (EPHY_NOTEBOOK (notebook), NULL, - EPHY_TAB (child), page - 1); - } + child = gtk_notebook_get_nth_page (notebook, page); + gtk_notebook_reorder_child (notebook, child, page - 1); } void window_cmd_tabs_move_right (GtkAction *action, EphyWindow *window) { - GtkWidget *notebook; - int page; - int last_page; - - notebook = ephy_window_get_notebook (window); - page = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)); - last_page = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) - 1; - - if (page != last_page) - { - GtkWidget *child; - - child = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page); - ephy_notebook_move_tab (EPHY_NOTEBOOK (notebook), NULL, - EPHY_TAB (child), page + 1); - } -} - -void -window_cmd_tabs_detach (GtkAction *action, - EphyWindow *window) -{ - EphyTab *tab; - GtkWidget *nb; - EphyWindow *new_win; + GtkWidget *child; + GtkNotebook *notebook; + int page, n_pages; - nb = ephy_window_get_notebook (window); - if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb)) <= 1) return; - - tab = ephy_window_get_active_tab (window); + notebook = GTK_NOTEBOOK (ephy_window_get_notebook (window)); + page = gtk_notebook_get_current_page (notebook); + n_pages = gtk_notebook_get_n_pages (notebook) - 1; + if (page > n_pages - 1) return; - new_win = ephy_window_new (); - ephy_notebook_move_tab (EPHY_NOTEBOOK (ephy_window_get_notebook (window)), - EPHY_NOTEBOOK (ephy_window_get_notebook (new_win)), - tab, 0); - gtk_widget_show (GTK_WIDGET (new_win)); + child = gtk_notebook_get_nth_page (notebook, page); + gtk_notebook_reorder_child (notebook, child, page + 1); } void -- cgit