void gedit_multi_notebook_add_new_notebook (GeditMultiNotebook *mnb) { GtkWidget *notebook; GeditTab *tab; g_return_if_fail (GEDIT_IS_MULTI_NOTEBOOK (mnb)); notebook = gedit_notebook_new (); add_notebook (mnb, notebook, FALSE); tab = GEDIT_TAB (_gedit_tab_new ()); gtk_widget_show (GTK_WIDGET (tab)); /* When gtk_notebook_insert_page is called the focus is set in the notebook, we don't want this to happen until the page is added. Also we don't want to call switch_page when we add the tab but when we switch the notebook. */ g_signal_handlers_block_by_func (notebook, notebook_set_focus, mnb); g_signal_handlers_block_by_func (notebook, notebook_switch_page, mnb); gedit_notebook_add_tab (GEDIT_NOTEBOOK (notebook), tab, -1, TRUE); g_signal_handlers_unblock_by_func (notebook, notebook_switch_page, mnb); g_signal_handlers_unblock_by_func (notebook, notebook_set_focus, mnb); notebook_set_focus (GTK_CONTAINER (notebook), NULL, mnb); }
/** * gedit_notebook_move_tab: * @src: a #GeditNotebook * @dest: a #GeditNotebook * @tab: a #GeditTab * @dest_position: the position for @tab * * Moves @tab from @src to @dest. * If dest_position is greater than or equal to the number of tabs * of the destination nootebook or negative, tab will be moved to the * end of the tabs. */ void gedit_notebook_move_tab (GeditNotebook *src, GeditNotebook *dest, GeditTab *tab, gint dest_position) { g_return_if_fail (GEDIT_IS_NOTEBOOK (src)); g_return_if_fail (GEDIT_IS_NOTEBOOK (dest)); g_return_if_fail (src != dest); g_return_if_fail (GEDIT_IS_TAB (tab)); /* make sure the tab isn't destroyed while we move it */ g_object_ref (tab); gtk_container_remove (GTK_CONTAINER (src), GTK_WIDGET (tab)); gedit_notebook_add_tab (dest, tab, dest_position, TRUE); g_object_unref (tab); }