Hiroyuki Ikezoe
ikezo****@users*****
Thu Jan 4 18:59:20 JST 2007
Index: kazehakase/src/kz-notebook.c diff -u kazehakase/src/kz-notebook.c:1.8 kazehakase/src/kz-notebook.c:1.9 --- kazehakase/src/kz-notebook.c:1.8 Thu Jan 4 11:47:51 2007 +++ kazehakase/src/kz-notebook.c Thu Jan 4 18:59:20 2007 @@ -585,3 +585,31 @@ return TRUE; } +GtkWidget * +kz_notebook_reorder_tab (KzNotebook *notebook, GtkWidget *widget, gint pos) +{ + gint n_pages, cur_pos, sib_pos = pos; + GtkWidget *sibtab = NULL; + + n_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); + g_return_val_if_fail(pos >= 0 && pos < n_pages, NULL); + + cur_pos = gtk_notebook_page_num(GTK_NOTEBOOK(notebook), widget); + if (cur_pos == pos) + return NULL; + + if (cur_pos < pos) + sib_pos = sib_pos + 1; + + if (sib_pos < n_pages) + { + sibtab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), + gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), sib_pos)); + } + + gtk_notebook_reorder_child (GTK_NOTEBOOK(notebook), + widget, pos); + + return sibtab; +} + Index: kazehakase/src/kz-notebook.h diff -u kazehakase/src/kz-notebook.h:1.3 kazehakase/src/kz-notebook.h:1.4 --- kazehakase/src/kz-notebook.h:1.3 Thu Jan 4 09:24:43 2007 +++ kazehakase/src/kz-notebook.h Thu Jan 4 18:59:20 2007 @@ -37,6 +37,7 @@ gboolean kz_notebook_close_tab (KzNotebook *notebook, GtkWidget *widget); gboolean kz_notebook_close_all_tab (KzNotebook *notebook); gboolean kz_notebook_move_tab (KzNotebook *src_notebook, KzNotebook *dest_notebook, GtkWidget *widget); +GtkWidget *kz_notebook_reorder_tab (KzNotebook *notebook, GtkWidget *widget, gint pos); G_END_DECLS Index: kazehakase/src/kz-window.c diff -u kazehakase/src/kz-window.c:1.298 kazehakase/src/kz-window.c:1.299 --- kazehakase/src/kz-window.c:1.298 Thu Jan 4 11:47:51 2007 +++ kazehakase/src/kz-window.c Thu Jan 4 18:59:20 2007 @@ -936,36 +936,18 @@ void kz_window_reorder_tab (KzWindow *kz, GtkWidget *widget, gint pos) { - gint n_pages, cur_pos, sib_pos = pos; KzTabLabel *kztab, *sibtab; KzBookmark *sib_bookmark = NULL; g_return_if_fail(KZ_IS_WINDOW(kz)); g_return_if_fail(GTK_IS_WIDGET(widget)); - n_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(kz->notebook)); - g_return_if_fail(pos >= 0 && pos < n_pages); + sibtab = KZ_TAB_LABEL(kz_notebook_reorder_tab(KZ_NOTEBOOK(kz->notebook), widget, pos)); - cur_pos = gtk_notebook_page_num(GTK_NOTEBOOK(kz->notebook), widget); - if (cur_pos == pos) - return; - - if (cur_pos < pos) - sib_pos = sib_pos + 1; - - kztab = KZ_TAB_LABEL(gtk_notebook_get_tab_label(GTK_NOTEBOOK(kz->notebook), - widget)); - if (sib_pos < n_pages) - { - sibtab = KZ_TAB_LABEL(gtk_notebook_get_tab_label( - GTK_NOTEBOOK(kz->notebook), - KZ_WINDOW_NTH_PAGE(kz, sib_pos))); + if (sibtab) sib_bookmark = sibtab->history; - } - gtk_notebook_reorder_child (GTK_NOTEBOOK(kz->notebook), - widget, pos); - + kztab = KZ_TAB_LABEL(gtk_notebook_get_tab_label(GTK_NOTEBOOK(kz->notebook), widget)); g_object_ref(kztab->history); kz_session_freeze(KZ_SESSION(KZ_GET_CURRENT_SESSION)); kz_bookmark_remove(kz->tabs, kztab->history);