diff options
author | Javier Jardón <jjardon@gnome.org> | 2010-07-02 22:39:02 +0200 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2010-07-13 17:50:48 +0200 |
commit | d562611660dcbff3bbe2873071effce96dfafbc4 (patch) | |
tree | 6571b2c0576998ca9d5560b5f306eb810bad86d4 /modules/other | |
parent | c6b6ab05995fa4b923b8704ed9bc97e7745e6198 (diff) | |
download | gtk+-d562611660dcbff3bbe2873071effce96dfafbc4.tar.gz |
Use accessor functions to access GtkNotebook
Diffstat (limited to 'modules/other')
-rw-r--r-- | modules/other/gail/gail.c | 12 | ||||
-rw-r--r-- | modules/other/gail/gailnotebook.c | 29 | ||||
-rw-r--r-- | modules/other/gail/gailnotebookpage.c | 8 |
3 files changed, 18 insertions, 31 deletions
diff --git a/modules/other/gail/gail.c b/modules/other/gail/gail.c index bea1e00357..e72b564f39 100644 --- a/modules/other/gail/gail.c +++ b/modules/other/gail/gail.c @@ -132,13 +132,7 @@ gail_get_accessible_for_widget (GtkWidget *widget, gint page_num = -1; notebook = GTK_NOTEBOOK (widget); - /* - * Report the currently focused tab rather than the currently selected tab - */ - if (notebook->focus_tab) - { - page_num = g_list_index (notebook->children, notebook->focus_tab->data); - } + page_num = gtk_notebook_get_current_page (notebook); if (page_num != -1) { obj = gtk_widget_get_accessible (widget); @@ -488,7 +482,6 @@ gail_switch_page_watcher (GSignalInvocationHint *ihint, { GObject *object; GtkWidget *widget; - GtkNotebook *notebook; object = g_value_get_object (param_values + 0); g_return_val_if_fail (GTK_IS_WIDGET(object), FALSE); @@ -498,8 +491,7 @@ gail_switch_page_watcher (GSignalInvocationHint *ihint, if (!GTK_IS_NOTEBOOK (widget)) return TRUE; - notebook = GTK_NOTEBOOK (widget); - if (!notebook->focus_tab) + if (gtk_notebook_get_current_page (GTK_NOTEBOOK (widget)) == -1) return TRUE; gail_focus_notify_when_idle (widget); diff --git a/modules/other/gail/gailnotebook.c b/modules/other/gail/gailnotebook.c index 8206f6689d..7620e998b8 100644 --- a/modules/other/gail/gailnotebook.c +++ b/modules/other/gail/gailnotebook.c @@ -124,8 +124,8 @@ gail_notebook_ref_child (AtkObject *obj, gail_notebook = GAIL_NOTEBOOK (obj); gtk_notebook = GTK_NOTEBOOK (widget); - - if (gail_notebook->page_count < g_list_length (gtk_notebook->children)) + + if (gail_notebook->page_count < gtk_notebook_get_n_pages (gtk_notebook)) check_cache (gail_notebook, gtk_notebook); accessible = find_child_in_list (gail_notebook->page_cache, i); @@ -163,16 +163,13 @@ gail_notebook_real_initialize (AtkObject *obj, notebook = GAIL_NOTEBOOK (obj); gtk_notebook = GTK_NOTEBOOK (data); - for (i = 0; i < g_list_length (gtk_notebook->children); i++) + for (i = 0; i < gtk_notebook_get_n_pages (gtk_notebook); i++) { create_notebook_page_accessible (notebook, gtk_notebook, i, FALSE, NULL); } notebook->page_count = i; notebook->selected_page = gtk_notebook_get_current_page (gtk_notebook); - if (gtk_notebook->focus_tab && gtk_notebook->focus_tab->data) - { - notebook->focus_tab_page = g_list_index (gtk_notebook->children, gtk_notebook->focus_tab->data); - } + g_signal_connect (gtk_notebook, "focus", G_CALLBACK (gail_notebook_focus_cb), @@ -209,7 +206,7 @@ gail_notebook_real_notify_gtk (GObject *obj, gail_notebook = GAIL_NOTEBOOK (atk_obj); gtk_notebook = GTK_NOTEBOOK (widget); - if (gail_notebook->page_count < g_list_length (gtk_notebook->children)) + if (gail_notebook->page_count < gtk_notebook_get_n_pages (gtk_notebook)) check_cache (gail_notebook, gtk_notebook); /* * Notify SELECTED state change for old and new page @@ -217,13 +214,9 @@ gail_notebook_real_notify_gtk (GObject *obj, old_page_num = gail_notebook->selected_page; page_num = gtk_notebook_get_current_page (gtk_notebook); gail_notebook->selected_page = page_num; + gail_notebook->focus_tab_page = page_num; old_focus_page_num = gail_notebook->focus_tab_page; - if (gtk_notebook->focus_tab && gtk_notebook->focus_tab->data) - { - focus_page_num = g_list_index (gtk_notebook->children, gtk_notebook->focus_tab->data); - gail_notebook->focus_tab_page = focus_page_num; - } - + if (page_num != old_page_num) { AtkObject *obj; @@ -438,7 +431,7 @@ check_cache (GailNotebook *gail_notebook, GList *gail_list; gint i; - gtk_list = notebook->children; + gtk_list = gtk_container_get_children (GTK_CONTAINER (notebook)); gail_list = gail_notebook->page_cache; i = 0; @@ -459,6 +452,8 @@ check_cache (GailNotebook *gail_notebook, i++; gtk_list = gtk_list->next; } + g_list_free (gtk_list); + gail_notebook->page_count = i; } @@ -572,11 +567,11 @@ gail_notebook_check_focus_tab (gpointer data) gail_notebook->idle_focus_id = 0; - if (!gtk_notebook->focus_tab) + focus_page_num = gtk_notebook_get_current_page (gtk_notebook); + if (focus_page_num == -1) return FALSE; old_focus_page_num = gail_notebook->focus_tab_page; - focus_page_num = g_list_index (gtk_notebook->children, gtk_notebook->focus_tab->data); gail_notebook->focus_tab_page = focus_page_num; if (old_focus_page_num != focus_page_num) { diff --git a/modules/other/gail/gailnotebookpage.c b/modules/other/gail/gailnotebookpage.c index a258d35a20..6263941c5a 100644 --- a/modules/other/gail/gailnotebookpage.c +++ b/modules/other/gail/gailnotebookpage.c @@ -172,8 +172,8 @@ gail_notebook_page_new (GtkNotebook *notebook, GailNotebookPage *page; GtkWidget *child; GtkWidget *label; - GList *list; - + GtkWidget *widget_page; + g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL); child = gtk_notebook_get_nth_page (notebook, pagenum); @@ -188,8 +188,8 @@ gail_notebook_page_new (GtkNotebook *notebook, page->notebook = notebook; g_object_add_weak_pointer (G_OBJECT (page->notebook), (gpointer *)&page->notebook); page->index = pagenum; - list = g_list_nth (notebook->children, pagenum); - page->page = list->data; + widget_page = gtk_notebook_get_nth_page (notebook, pagenum); + page->page = widget_page; page->textutil = NULL; atk_object = ATK_OBJECT (page); |