void caja_notebook_reorder_current_child_relative (CajaNotebook *notebook, int offset) { GtkNotebook *gnotebook; GtkWidget *child; int page; g_return_if_fail (CAJA_IS_NOTEBOOK (notebook)); if (!caja_notebook_can_reorder_current_child_relative (notebook, offset)) { return; } gnotebook = GTK_NOTEBOOK (notebook); page = gtk_notebook_get_current_page (gnotebook); child = gtk_notebook_get_nth_page (gnotebook, page); gtk_notebook_reorder_child (gnotebook, child, page + offset); }
static void notebook_popup_menu_show (CajaNavigationWindowPane *pane, GdkEventButton *event) { GtkWidget *popup; GtkWidget *item; GtkWidget *image; int button, event_time; gboolean can_move_left, can_move_right; CajaNotebook *notebook; notebook = CAJA_NOTEBOOK (pane->notebook); can_move_left = caja_notebook_can_reorder_current_child_relative (notebook, -1); can_move_right = caja_notebook_can_reorder_current_child_relative (notebook, 1); popup = gtk_menu_new(); item = gtk_menu_item_new_with_mnemonic (_("_New Tab")); g_signal_connect (item, "activate", G_CALLBACK (notebook_popup_menu_new_tab_cb), pane); gtk_menu_shell_append (GTK_MENU_SHELL (popup), item); gtk_menu_shell_append (GTK_MENU_SHELL (popup), gtk_separator_menu_item_new ()); item = gtk_menu_item_new_with_mnemonic (_("Move Tab _Left")); g_signal_connect (item, "activate", G_CALLBACK (notebook_popup_menu_move_left_cb), pane); gtk_menu_shell_append (GTK_MENU_SHELL (popup), item); gtk_widget_set_sensitive (item, can_move_left); item = gtk_menu_item_new_with_mnemonic (_("Move Tab _Right")); g_signal_connect (item, "activate", G_CALLBACK (notebook_popup_menu_move_right_cb), pane); gtk_menu_shell_append (GTK_MENU_SHELL (popup), item); gtk_widget_set_sensitive (item, can_move_right); gtk_menu_shell_append (GTK_MENU_SHELL (popup), gtk_separator_menu_item_new ()); item = gtk_image_menu_item_new_with_mnemonic (_("_Close Tab")); image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); g_signal_connect (item, "activate", G_CALLBACK (notebook_popup_menu_close_cb), pane); gtk_menu_shell_append (GTK_MENU_SHELL (popup), item); gtk_widget_show_all (popup); if (event) { button = event->button; event_time = event->time; } else { button = 0; event_time = gtk_get_current_event_time (); } /* TODO is this correct? */ gtk_menu_attach_to_widget (GTK_MENU (popup), pane->notebook, NULL); gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL, button, event_time); }