[Kazehakase-cvs] CVS update: kazehakase/src/actions

Zurück zum Archiv-Index

Hiroyuki Ikezoe ikezo****@users*****
Sun Jan 7 06:06:20 JST 2007


Index: kazehakase/src/actions/kz-actions-tab.c
diff -u kazehakase/src/actions/kz-actions-tab.c:1.39 kazehakase/src/actions/kz-actions-tab.c:1.40
--- kazehakase/src/actions/kz-actions-tab.c:1.39	Fri Aug 25 13:05:20 2006
+++ kazehakase/src/actions/kz-actions-tab.c	Sun Jan  7 06:06:20 2007
@@ -25,6 +25,7 @@
 #include "gtk-utils.h"
 #include "kazehakase.h"
 #include "kz-icons.h"
+#include "kz-notebook.h"
 #include "kz-actions-dynamic.h"
 
 static GQuark kztab_quark = 0;
@@ -100,18 +101,11 @@
 };
 
 static void
-close_all_tab (GtkAction *action, KzWindow *kz, gint mode)
+close_tabs (KzWindow *kz, KzNotebookCloseCondition condition)
 {
 	KzTabLabel *kztab;
 	GtkNotebook *notebook;
-	gint num, pos;
-	gint i;
-
-	if(mode == KZ_TAB_CLOSE_ALL_TABS)
-	{
-		kz_window_close_all_tab(kz);
-		return;
-	}
+	gint pos;
 
 	g_return_if_fail(KZ_IS_WINDOW(kz));
 
@@ -119,45 +113,34 @@
 	g_return_if_fail(KZ_IS_TAB_LABEL(kztab));
 	notebook = GTK_NOTEBOOK(kztab->kz->notebook);
 
-	num = gtk_notebook_get_n_pages(notebook);
 	pos = gtk_notebook_page_num(notebook, GTK_WIDGET(kztab->kzembed));
 
-	if (num < 2 || pos < 0) return;
-
-	for (i = num - 1; i >= 0; i--)
-	{
-		GtkWidget *widget = KZ_WINDOW_NTH_PAGE(kztab->kz, i);
-
-		if (i == pos) continue;
-		if (i > pos && mode == KZ_TAB_CLOSE_BACKWARD) continue;
-		if (i < pos && mode == KZ_TAB_CLOSE_FORWARD) continue;
-
-		kz_window_close_tab(kztab->kz, widget);
-	}
+	kz_notebook_close_tabs(KZ_NOTEBOOK(notebook), condition, pos);
 }
 
 static void
 act_tab_close_left (GtkAction *action, KzWindow *kz)
 {
-	close_all_tab(action, kz, KZ_TAB_CLOSE_BACKWARD);
+	close_tabs(kz, KZ_NOTEBOOK_CLOSE_BACKWARD);
 }
 
 static void
 act_tab_close_right (GtkAction *action, KzWindow *kz)
 {
-	close_all_tab(action, kz, KZ_TAB_CLOSE_FORWARD);
+	close_tabs(kz, KZ_NOTEBOOK_CLOSE_FORWARD);
 }
 
 static void
-act_tab_close_all_inactive_active (GtkAction *action, KzWindow *kz)
+act_tab_close_all_inactive (GtkAction *action, KzWindow *kz)
 {
-	close_all_tab(action, kz, KZ_TAB_CLOSE_INACTIVE);
+	close_tabs(kz, KZ_NOTEBOOK_CLOSE_INACTIVE);
 }
 
 static void
 act_tab_close_all_tabs (GtkAction *action, KzWindow *kz)
 {
-	close_all_tab(action, kz, KZ_TAB_CLOSE_ALL_TABS);
+	g_return_if_fail(KZ_IS_WINDOW(kz));
+	kz_window_close_all_tab(kz);
 }
 
 static gboolean
@@ -393,7 +376,7 @@
 	 NULL, NULL, G_CALLBACK(act_tab_close_right)},
 
 	{"TabCloseAllInactiveTabs", GTK_STOCK_CLOSE, N_("Close all _inactive tabs"),
-	 NULL, NULL, G_CALLBACK(act_tab_close_all_inactive_active)},
+	 NULL, NULL, G_CALLBACK(act_tab_close_all_inactive)},
 
 	{"TabCloseAllTabs", GTK_STOCK_CLOSE, N_("Clos_e all tabs"),
 	 NULL, NULL, G_CALLBACK(act_tab_close_all_tabs)},
Index: kazehakase/src/actions/kz-actions.c
diff -u kazehakase/src/actions/kz-actions.c:1.240 kazehakase/src/actions/kz-actions.c:1.241
--- kazehakase/src/actions/kz-actions.c:1.240	Sat Jan  6 13:54:53 2007
+++ kazehakase/src/actions/kz-actions.c	Sun Jan  7 06:06:20 2007
@@ -901,60 +901,39 @@
 
 
 static void
-act_tab_close_backward_all (GtkAction *action, KzWindow *kz)
+close_tabs (KzNotebook *notebook, KzNotebookCloseCondition condition)
 {
-	gint i, pos, num;
+	gint pos;
 
-	g_return_if_fail(KZ_IS_WINDOW (kz));
+	pos = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
 
-	pos = gtk_notebook_get_current_page(GTK_NOTEBOOK(kz->notebook));
-	num = gtk_notebook_get_n_pages(GTK_NOTEBOOK(kz->notebook));
+	kz_notebook_close_tabs(notebook, condition, pos);
+}
 
-	for (i = pos - 1; i >= 0; i--)
-	{
-		GtkWidget *widget = KZ_WINDOW_NTH_PAGE(kz, i);
+static void
+act_tab_close_backward_all (GtkAction *action, KzWindow *kz)
+{
+	g_return_if_fail(KZ_IS_WINDOW (kz));
 
-		kz_window_close_tab(kz, widget);
-	}
+	close_tabs(KZ_NOTEBOOK(kz->notebook), KZ_NOTEBOOK_CLOSE_BACKWARD);
 }
 
 
 static void
 act_tab_close_forward_all (GtkAction *action, KzWindow *kz)
 {
-	gint i, pos, num;
-
 	g_return_if_fail(KZ_IS_WINDOW (kz));
 
-	pos = gtk_notebook_get_current_page(GTK_NOTEBOOK(kz->notebook));
-	num = gtk_notebook_get_n_pages(GTK_NOTEBOOK(kz->notebook));
-
-	for (i = num - 1; i > pos; i--)
-	{
-		GtkWidget *widget = KZ_WINDOW_NTH_PAGE(kz, i);
-
-		kz_window_close_tab(kz, widget);
-	}
+	close_tabs(KZ_NOTEBOOK(kz->notebook), KZ_NOTEBOOK_CLOSE_FORWARD);
 }
 
 
 static void
 act_tab_close_all_inactive_active (GtkAction *action, KzWindow *kz)
 {
-	gint i, pos, num;
-
 	g_return_if_fail(KZ_IS_WINDOW (kz));
 
-	pos = gtk_notebook_get_current_page(GTK_NOTEBOOK(kz->notebook));
-	num = gtk_notebook_get_n_pages(GTK_NOTEBOOK(kz->notebook));
-
-	for (i = num - 1; i >= 0; i--)
-	{
-		GtkWidget *widget = KZ_WINDOW_NTH_PAGE(kz, i);
-
-		if (i == pos) continue;
-		kz_window_close_tab(kz, widget);
-	}
+	close_tabs(KZ_NOTEBOOK(kz->notebook), KZ_NOTEBOOK_CLOSE_INACTIVE);
 }
 
 static void


More information about the Kazehakase-cvs mailing list
Zurück zum Archiv-Index