[Kazehakase-cvs] kazehakase-svn [3075] * src/kz-notebook.[ch]: New APIs.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
Wed Mar 28 11:13:33 JST 2007


Revision: 3075
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3075
Author:   ikezoe
Date:     2007-03-28 11:13:32 +0900 (Wed, 28 Mar 2007)

Log Message:
-----------
* src/kz-notebook.[ch]: New APIs.
kz_notebook_get_nth_page(), kz_notebook_page_num(),
kz_notebook_get_current_page(), kz_notebook_set_current_page(),
kz_notebook_get_n_pages().
* src/kz-tab-label.c, src/kz-window.c, src/sidebar/kz-tabtree.c,
src/actions/kz-actions.c src/actions/kz-actions-popup.c,
src/actions/kz-actions-tab.c: Use new APIs.

Modified Paths:
--------------
    kazehakase/trunk/ChangeLog
    kazehakase/trunk/src/actions/kz-actions-popup.c
    kazehakase/trunk/src/actions/kz-actions-tab.c
    kazehakase/trunk/src/actions/kz-actions.c
    kazehakase/trunk/src/kz-notebook.c
    kazehakase/trunk/src/kz-notebook.h
    kazehakase/trunk/src/kz-window.c
    kazehakase/trunk/src/sidebar/kz-tabtree.c

Modified: kazehakase/trunk/ChangeLog
===================================================================
--- kazehakase/trunk/ChangeLog	2007-03-28 02:10:55 UTC (rev 3074)
+++ kazehakase/trunk/ChangeLog	2007-03-28 02:13:32 UTC (rev 3075)
@@ -1,3 +1,13 @@
+2007-03-28  Hiroyuki Ikezoe  <poinc****@ikezo*****>
+
+	* src/kz-notebook.[ch]: New APIs.
+	kz_notebook_get_nth_page(), kz_notebook_page_num(),
+	kz_notebook_get_current_page(), kz_notebook_set_current_page(),
+	kz_notebook_get_n_pages().
+	* src/kz-tab-label.c, src/kz-window.c, src/sidebar/kz-tabtree.c,
+	src/actions/kz-actions.c src/actions/kz-actions-popup.c,
+	src/actions/kz-actions-tab.c: Use new APIs.
+
 2007-03-28  Kouhei Sutou  <kou****@cozmi*****>
 
 	* module/search/kz-hyper-estraier-search.c:

Modified: kazehakase/trunk/src/actions/kz-actions-popup.c
===================================================================
--- kazehakase/trunk/src/actions/kz-actions-popup.c	2007-03-28 02:10:55 UTC (rev 3074)
+++ kazehakase/trunk/src/actions/kz-actions-popup.c	2007-03-28 02:13:32 UTC (rev 3075)
@@ -41,6 +41,7 @@
 #include "kz-xml.h"
 #include "kz-actions-dynamic.h"
 #include "kz-icons.h"
+#include "kz-notebook.h"
 
 #define KZ_ACTIONS_POPUP_LANGUAGE_KEY "KzActionsPopup::Language"
 #define KZ_ACTIONS_POPUP_TAB_KEY "KzActionsPopup::Tab"
@@ -381,10 +382,10 @@
 	GtkWidget *widget = g_object_get_data(G_OBJECT(menuitem),
 					      KZ_ACTIONS_POPUP_TAB_KEY);
 
-	page_num = gtk_notebook_page_num(GTK_NOTEBOOK(kz->notebook),
-					 GTK_WIDGET(widget));
+	page_num = kz_notebook_page_num(KZ_NOTEBOOK(kz->notebook),
+					GTK_WIDGET(widget));
 
-	gtk_notebook_set_current_page(GTK_NOTEBOOK(kz->notebook), page_num);
+	kz_notebook_set_current_page(KZ_NOTEBOOK(kz->notebook), page_num);
 }
 
 
@@ -752,8 +753,8 @@
 	}
 
 	page = KZ_WINDOW_CURRENT_PAGE(kz);
-	current_page_num = gtk_notebook_page_num(GTK_NOTEBOOK(kz->notebook),
-						 GTK_WIDGET(page));
+	current_page_num = kz_notebook_page_num(KZ_NOTEBOOK(kz->notebook),
+						GTK_WIDGET(page));
 
 	for (i = 0; i < num; i++)
 	{

Modified: kazehakase/trunk/src/actions/kz-actions-tab.c
===================================================================
--- kazehakase/trunk/src/actions/kz-actions-tab.c	2007-03-28 02:10:55 UTC (rev 3074)
+++ kazehakase/trunk/src/actions/kz-actions-tab.c	2007-03-28 02:13:32 UTC (rev 3075)
@@ -104,18 +104,18 @@
 close_tabs (KzWindow *kz, KzNotebookCloseCondition condition)
 {
 	KzTabLabel *kztab;
-	GtkNotebook *notebook;
+	KzNotebook *notebook;
 	gint pos;
 
 	g_return_if_fail(KZ_IS_WINDOW(kz));
 
 	kztab = g_object_get_qdata(G_OBJECT(kz), kztab_quark);
 	g_return_if_fail(KZ_IS_TAB_LABEL(kztab));
-	notebook = GTK_NOTEBOOK(kztab->kz->notebook);
+	notebook = KZ_NOTEBOOK(kztab->kz->notebook);
 
-	pos = gtk_notebook_page_num(notebook, GTK_WIDGET(kztab->kzembed));
+	pos = kz_notebook_page_num(notebook, GTK_WIDGET(kztab->kzembed));
 
-	kz_notebook_close_tabs(KZ_NOTEBOOK(notebook), condition, pos);
+	kz_notebook_close_tabs(notebook, condition, pos);
 }
 
 static void
@@ -459,8 +459,8 @@
 	kz = kztab->kz;
 	g_return_if_fail(KZ_IS_WINDOW(kz));
 
-	pos = gtk_notebook_page_num(GTK_NOTEBOOK(kztab->kz->notebook),
-				    GTK_WIDGET(kztab->kzembed));
+	pos = kz_notebook_page_num(KZ_NOTEBOOK(kztab->kz->notebook),
+				   GTK_WIDGET(kztab->kzembed));
 	num = gtk_notebook_get_n_pages(GTK_NOTEBOOK(kztab->kz->notebook));
 
 	action = gtk_action_group_get_action(kz->tabpop_actions, "TabStop");

Modified: kazehakase/trunk/src/actions/kz-actions.c
===================================================================
--- kazehakase/trunk/src/actions/kz-actions.c	2007-03-28 02:10:55 UTC (rev 3074)
+++ kazehakase/trunk/src/actions/kz-actions.c	2007-03-28 02:13:32 UTC (rev 3075)
@@ -168,11 +168,11 @@
    	KZ_CONF_GET("Tab", "focus_open_new", focus, BOOL);
 	if(focus && widget)
 	{
-		int num = gtk_notebook_page_num(GTK_NOTEBOOK(kz->notebook),
-						widget);
+		int num = kz_notebook_page_num(KZ_NOTEBOOK(kz->notebook),
+					       widget);
 		if(num != -1)
-			gtk_notebook_set_current_page(GTK_NOTEBOOK(kz->notebook),
-						      num);
+			kz_notebook_set_current_page(KZ_NOTEBOOK(kz->notebook),
+						     num);
 
 		KZ_CONF_GET("Tab","focus_loc_ent_new", focus, BOOL);
 		if(focus)
@@ -512,7 +512,7 @@
 
 	g_return_if_fail(KZ_IS_WINDOW (kz));
 
-	num = gtk_notebook_get_n_pages(GTK_NOTEBOOK(kz->notebook));
+	num = kz_notebook_get_n_pages(KZ_NOTEBOOK(kz->notebook));
 
 	for (i = num - 1; i >= 0; i--)
 	{
@@ -534,7 +534,7 @@
 
 	gdk_window_get_pointer(NULL, &x, &y, &state);
 
-	num = gtk_notebook_get_n_pages(GTK_NOTEBOOK(kz->notebook));
+	num = kz_notebook_get_n_pages(KZ_NOTEBOOK(kz->notebook));
 
 	for (i = num - 1; i >= 0; i--)
 	{
@@ -666,8 +666,8 @@
 	g_return_if_fail(KZ_IS_WINDOW(kz));
 
 	widget = kz_window_open_new_tab(kz, "about:config");
-	num = gtk_notebook_page_num(GTK_NOTEBOOK(kz->notebook), widget);
-	gtk_notebook_set_current_page(GTK_NOTEBOOK(kz->notebook), num);
+	num = kz_notebook_page_num(KZ_NOTEBOOK(kz->notebook), widget);
+	kz_notebook_set_current_page(KZ_NOTEBOOK(kz->notebook), num);
 }
 
 
@@ -906,7 +906,7 @@
 {
 	gint pos;
 
-	pos = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
+	pos = kz_notebook_get_current_page(notebook);
 
 	kz_notebook_close_tabs(notebook, condition, pos);
 }
@@ -1380,8 +1380,8 @@
 	g_return_if_fail(KZ_IS_WINDOW(kz));
 
 	widget = kz_window_open_new_tab(kz, KAZEHAKASE_URI);
-	num = gtk_notebook_page_num(GTK_NOTEBOOK(kz->notebook), widget);
-	gtk_notebook_set_current_page(GTK_NOTEBOOK(kz->notebook), num);
+	num = kz_notebook_page_num(KZ_NOTEBOOK(kz->notebook), widget);
+	kz_notebook_set_current_page(KZ_NOTEBOOK(kz->notebook), num);
 }
 
 static void
@@ -1643,7 +1643,7 @@
 			       KzBookmark* tab, gint index,
 			       KzWindow* kz)
 {
-	gtk_notebook_set_current_page(GTK_NOTEBOOK(kz->notebook), index);
+	kz_notebook_set_current_page(KZ_NOTEBOOK(kz->notebook), index);
 
 	gtk_widget_destroy(GTK_WIDGET(popup));
 	kz->popup_tablist = NULL;
@@ -2106,12 +2106,12 @@
 	GtkAction *action;
 	g_return_if_fail (KZ_IS_WINDOW(kz));
 
-	num = gtk_notebook_get_n_pages(GTK_NOTEBOOK(kz->notebook));
+	num = kz_notebook_get_n_pages(KZ_NOTEBOOK(kz->notebook));
 	
 	if (!num) return;
 
-	pos = gtk_notebook_page_num(GTK_NOTEBOOK(kz->notebook),
-				    GTK_WIDGET(kzembed));
+	pos = kz_notebook_page_num(KZ_NOTEBOOK(kz->notebook),
+				   GTK_WIDGET(kzembed));
 	if (num > 1)
 	{
 		action = gtk_action_group_get_action(kz->actions,
@@ -2186,7 +2186,7 @@
 	g_return_if_fail (KZ_IS_WINDOW(kz));
 	/* g_return_if_fail (KZ_IS_EMBED (kzembed)); */
 
-	num = gtk_notebook_get_n_pages(GTK_NOTEBOOK(kz->notebook));
+	num = kz_notebook_get_n_pages(KZ_NOTEBOOK(kz->notebook));
 
 	if (kzembed)
 	{
@@ -2205,8 +2205,8 @@
 		
 		can_close_tab = !kz_tab_label_get_lock(kztab);
 
-		pos = gtk_notebook_page_num(GTK_NOTEBOOK(kz->notebook),
-					    GTK_WIDGET(kzembed));
+		pos = kz_notebook_page_num(KZ_NOTEBOOK(kz->notebook),
+					   GTK_WIDGET(kzembed));
 		for (i = 0; i< num; i++)
 		{
 			GtkWidget *widget;

Modified: kazehakase/trunk/src/kz-notebook.c
===================================================================
--- kazehakase/trunk/src/kz-notebook.c	2007-03-28 02:10:55 UTC (rev 3074)
+++ kazehakase/trunk/src/kz-notebook.c	2007-03-28 02:13:32 UTC (rev 3075)
@@ -676,3 +676,42 @@
 	return FALSE;
 }
 
+GtkWidget *
+kz_notebook_get_nth_page (KzNotebook *notebook, gint page_num)
+{
+	g_return_val_if_fail(KZ_IS_NOTEBOOK(notebook), NULL);
+
+	return gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_num);
+}
+
+gint
+kz_notebook_page_num (KzNotebook *notebook, GtkWidget *child)
+{
+	g_return_val_if_fail(KZ_IS_NOTEBOOK(notebook), -1);
+
+	return gtk_notebook_page_num(GTK_NOTEBOOK(notebook), child);
+}
+
+gint
+kz_notebook_get_current_page (KzNotebook *notebook)
+{
+	g_return_val_if_fail(KZ_IS_NOTEBOOK(notebook), -1);
+
+	return gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
+}
+
+void
+kz_notebook_set_current_page (KzNotebook *notebook, gint page_num)
+{
+	g_return_if_fail(KZ_IS_NOTEBOOK(notebook));
+
+	gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), page_num);
+}
+
+gint
+kz_notebook_get_n_pages (KzNotebook *notebook)
+{
+	g_return_val_if_fail(KZ_IS_NOTEBOOK(notebook), 0);
+
+	return gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook));
+}

Modified: kazehakase/trunk/src/kz-notebook.h
===================================================================
--- kazehakase/trunk/src/kz-notebook.h	2007-03-28 02:10:55 UTC (rev 3074)
+++ kazehakase/trunk/src/kz-notebook.h	2007-03-28 02:13:32 UTC (rev 3075)
@@ -46,6 +46,11 @@
 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);
+GtkWidget  *kz_notebook_get_nth_page      (KzNotebook *notebook, gint page_num);
+gint        kz_notebook_page_num          (KzNotebook *notebook, GtkWidget *child);
+gint	    kz_notebook_get_current_page  (KzNotebook *notebook);
+void	    kz_notebook_set_current_page  (KzNotebook *notebook, gint page_num);
+gint        kz_notebook_get_n_pages       (KzNotebook *notebook);
 
 G_END_DECLS
 

Modified: kazehakase/trunk/src/kz-window.c
===================================================================
--- kazehakase/trunk/src/kz-window.c	2007-03-28 02:10:55 UTC (rev 3074)
+++ kazehakase/trunk/src/kz-window.c	2007-03-28 02:13:32 UTC (rev 3075)
@@ -922,7 +922,7 @@
 	g_list_free(childtabs);
 
 	pos = kz_bookmark_get_current(tabs);
-	gtk_notebook_set_current_page(GTK_NOTEBOOK(kz->notebook), pos);
+	kz_notebook_set_current_page(KZ_NOTEBOOK(kz->notebook), pos);
 	curembed = KZ_EMBED(KZ_WINDOW_NTH_PAGE(kz, pos));
 	if (curembed)
 	{
@@ -2288,8 +2288,8 @@
 
 			if(((event->modifier & KZ_SHIFT_KEY) != 0) ^ focus_mid_click_link)
 			{
-				gtk_notebook_set_current_page(GTK_NOTEBOOK(kz->notebook),
-							      gtk_notebook_page_num(GTK_NOTEBOOK(kz->notebook), widget));
+				kz_notebook_set_current_page(KZ_NOTEBOOK(kz->notebook),
+							     kz_notebook_page_num(KZ_NOTEBOOK(kz->notebook), widget));
 			}
 		}
 		else if (!(type & KZ_CONTEXT_INPUT))

Modified: kazehakase/trunk/src/sidebar/kz-tabtree.c
===================================================================
--- kazehakase/trunk/src/sidebar/kz-tabtree.c	2007-03-28 02:10:55 UTC (rev 3074)
+++ kazehakase/trunk/src/sidebar/kz-tabtree.c	2007-03-28 02:13:32 UTC (rev 3075)
@@ -23,6 +23,7 @@
 #include <glib/gi18n.h>
 #include "gtk-utils.h"
 #include "kz-tab-label.h"
+#include "kz-notebook.h"
 #include "kz-actions-tab.h"
 
 static gchar *label_color[KZ_TAB_LABEL_N_STATE];
@@ -523,7 +524,7 @@
 	kz = tabtree->sidebar->kz;
 	if (!kz) return;
 
-	num = gtk_notebook_get_n_pages(GTK_NOTEBOOK(kz->notebook));
+	num = kz_notebook_get_n_pages(KZ_NOTEBOOK(kz->notebook));
 
 	for (i = 0; i < num; i++)
 	{
@@ -659,12 +660,12 @@
 			   COLUMN_TERMINATOR);
 	if (!kzembed) return;
 
-	num = gtk_notebook_page_num(GTK_NOTEBOOK(kz->notebook),
-				    GTK_WIDGET(kzembed));
+	num = kz_notebook_page_num(KZ_NOTEBOOK(kz->notebook),
+				   GTK_WIDGET(kzembed));
 	g_return_if_fail(num >= 0);
 
 	tabtree->switching = TRUE;
-	gtk_notebook_set_current_page(GTK_NOTEBOOK(kz->notebook), num);
+	kz_notebook_set_current_page(KZ_NOTEBOOK(kz->notebook), num);
 	tabtree->switching = FALSE;
 }
 
@@ -751,7 +752,7 @@
 
 	if (tabtree->switching) return;
 
-	widget = gtk_notebook_get_nth_page(notebook, page_num);
+	widget = kz_notebook_get_nth_page(KZ_NOTEBOOK(notebook), page_num);
 	iter = find_node(tabtree->store, KZ_EMBED(widget));
 	/* g_return_if_fail(iter); */
 	if (!iter) return;




More information about the Kazehakase-cvs mailing list
Back to archive index