Hiroyuki Ikezoe
ikezo****@users*****
Thu Jan 4 22:45:54 JST 2007
Index: kazehakase/src/kz-notebook.c diff -u kazehakase/src/kz-notebook.c:1.12 kazehakase/src/kz-notebook.c:1.13 --- kazehakase/src/kz-notebook.c:1.12 Thu Jan 4 22:33:33 2007 +++ kazehakase/src/kz-notebook.c Thu Jan 4 22:45:54 2007 @@ -228,9 +228,7 @@ static gboolean scroll_event (GtkWidget *widget, GdkEventScroll *event) { - KzWindow *kz = KZ_NOTEBOOK(widget)->kz; - - return kz_window_scroll_tab(kz, event->direction); + return kz_notebook_scroll_tab(KZ_NOTEBOOK(widget), event->direction); } static void @@ -595,3 +593,73 @@ return sibtab; } +void +kz_notebook_next_tab (KzNotebook *notebook) +{ + gboolean circulation = FALSE; + GtkNotebook *gtk_notebook; + + g_return_if_fail(KZ_IS_NOTEBOOK(notebook)); + + gtk_notebook = GTK_NOTEBOOK(notebook); + KZ_CONF_GET("Tab", "wheel_circulation", circulation, BOOL); + + if (circulation && + gtk_notebook_get_current_page(gtk_notebook) == + gtk_notebook_get_n_pages(gtk_notebook) - 1) + { + gtk_notebook_set_current_page(gtk_notebook, 0); + } + else + { + gtk_notebook_next_page(gtk_notebook); + } +} + +void +kz_notebook_prev_tab (KzNotebook *notebook) +{ + gboolean circulation = FALSE; + GtkNotebook *gtk_notebook; + + g_return_if_fail(KZ_IS_NOTEBOOK(notebook)); + + gtk_notebook = GTK_NOTEBOOK(notebook); + KZ_CONF_GET("Tab", "wheel_circulation", circulation, BOOL); + + if (circulation && + gtk_notebook_get_current_page(gtk_notebook) == 0) + { + gtk_notebook_set_current_page + (gtk_notebook, gtk_notebook_get_n_pages(gtk_notebook) - 1); + } + else + { + gtk_notebook_prev_page(gtk_notebook); + } +} + +gboolean +kz_notebook_scroll_tab (KzNotebook *notebook, GdkScrollDirection direction) +{ + g_return_val_if_fail(KZ_IS_NOTEBOOK(notebook), FALSE); + + switch (direction) { + case GDK_SCROLL_UP: + case GDK_SCROLL_LEFT: + kz_notebook_prev_tab(notebook); + return TRUE; + break; + case GDK_SCROLL_DOWN: + case GDK_SCROLL_RIGHT: + kz_notebook_next_tab(notebook); + return TRUE; + break; + default: + g_warning ("Invalid scroll direction!"); + break; + } + + return FALSE; +} + Index: kazehakase/src/kz-notebook.h diff -u kazehakase/src/kz-notebook.h:1.5 kazehakase/src/kz-notebook.h:1.6 --- kazehakase/src/kz-notebook.h:1.5 Thu Jan 4 22:22:39 2007 +++ kazehakase/src/kz-notebook.h Thu Jan 4 22:45:54 2007 @@ -37,7 +37,10 @@ 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); +void kz_notebook_next_tab (KzNotebook *notebook); +void kz_notebook_prev_tab (KzNotebook *notebook); GtkWidget *kz_notebook_reorder_tab (KzNotebook *notebook, GtkWidget *widget, gint pos); +gboolean kz_notebook_scroll_tab (KzNotebook *notebook, GdkScrollDirection direction); G_END_DECLS Index: kazehakase/src/kz-tab-label.c diff -u kazehakase/src/kz-tab-label.c:1.88 kazehakase/src/kz-tab-label.c:1.89 --- kazehakase/src/kz-tab-label.c:1.88 Thu Jan 4 22:33:33 2007 +++ kazehakase/src/kz-tab-label.c Thu Jan 4 22:45:54 2007 @@ -688,7 +688,7 @@ kz = KZ_TAB_LABEL(widget)->kz; - retval = kz_window_scroll_tab(kz, event->direction); + retval = kz_notebook_scroll_tab(KZ_NOTEBOOK(kz->notebook), event->direction); if (GTK_WIDGET_CLASS(kz_tab_label_parent_class)->scroll_event) return GTK_WIDGET_CLASS(kz_tab_label_parent_class)->scroll_event(widget, event) Index: kazehakase/src/kz-window.c diff -u kazehakase/src/kz-window.c:1.301 kazehakase/src/kz-window.c:1.302 --- kazehakase/src/kz-window.c:1.301 Thu Jan 4 22:33:34 2007 +++ kazehakase/src/kz-window.c Thu Jan 4 22:45:54 2007 @@ -2041,30 +2041,6 @@ } -gboolean -kz_window_scroll_tab (KzWindow *kz, GdkScrollDirection direction) -{ - g_return_val_if_fail(KZ_IS_WINDOW(kz), FALSE); - - switch (direction) { - case GDK_SCROLL_UP: - case GDK_SCROLL_LEFT: - kz_window_activate_action(kz, "PrevTab"); - return TRUE; - break; - case GDK_SCROLL_DOWN: - case GDK_SCROLL_RIGHT: - kz_window_activate_action(kz, "NextTab"); - return TRUE; - break; - default: - g_warning ("Invalid scroll direction!"); - break; - } - - return FALSE; -} - static void cb_sidebar_map (GtkWidget *widget, GtkToggleAction *action) { @@ -2608,7 +2584,7 @@ if (priv->is_button3_pressed) { - retval = kz_window_scroll_tab(kz, event->direction); + retval = kz_notebook_scroll_tab(KZ_NOTEBOOK(kz->notebook), event->direction); priv->is_button3_scrolled = retval; } Index: kazehakase/src/kz-window.h diff -u kazehakase/src/kz-window.h:1.78 kazehakase/src/kz-window.h:1.79 --- kazehakase/src/kz-window.h:1.78 Thu Jan 4 22:33:34 2007 +++ kazehakase/src/kz-window.h Thu Jan 4 22:45:54 2007 @@ -112,8 +112,6 @@ gint position); void kz_window_move_tab (KzWindow *kz, GtkWidget *widget); -gboolean kz_window_scroll_tab (KzWindow *kz, - GdkScrollDirection direction); void kz_window_load_url (KzWindow *kz, const gchar *url); void kz_window_store_state (KzWindow *kz);