Mercurial > pidgin.yaz
comparison gtk/gtkscrollbook.c @ 15182:fbe2187bceec
[gaim-migrate @ 17968]
incomplete. Working on this from home. You may see where it's going.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Tue, 12 Dec 2006 04:45:02 +0000 |
parents | 9b2a65069744 |
children | a505577b6f4b |
comparison
equal
deleted
inserted
replaced
15181:4b500bd49d38 | 15182:fbe2187bceec |
---|---|
90 | 90 |
91 static void | 91 static void |
92 refresh_scroll_box(GtkGaimScrollBook *scroll_book, int index, int count) | 92 refresh_scroll_box(GtkGaimScrollBook *scroll_book, int index, int count) |
93 { | 93 { |
94 char *label; | 94 char *label; |
95 | |
96 gtk_widget_show_all(GTK_WIDGET(scroll_book)); | 95 gtk_widget_show_all(GTK_WIDGET(scroll_book)); |
97 if (count <= 1) | 96 if (count <= 1) |
98 gtk_widget_hide(GTK_WIDGET(scroll_book->hbox)); | 97 gtk_widget_hide(GTK_WIDGET(scroll_book->hbox)); |
99 else | 98 else |
100 gtk_widget_show_all(GTK_WIDGET(scroll_book->hbox)); | 99 gtk_widget_show_all(GTK_WIDGET(scroll_book->hbox)); |
118 | 117 |
119 | 118 |
120 static void | 119 static void |
121 page_count_change_cb(GtkGaimScrollBook *scroll_book) | 120 page_count_change_cb(GtkGaimScrollBook *scroll_book) |
122 { | 121 { |
122 int count; | |
123 int index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook)); | 123 int index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook)); |
124 #if GTK_CHECK_VERSION(2,2,0) | 124 #if GTK_CHECK_VERSION(2,2,0) |
125 int count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook)); | 125 count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook)); |
126 #else | 126 #else |
127 count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children); | 127 count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children); |
128 #endif | 128 #endif |
129 refresh_scroll_box(scroll_book, index, count); | 129 refresh_scroll_box(scroll_book, index, count); |
130 | 130 |
144 static void | 144 static void |
145 gtk_gaim_scroll_book_add(GtkContainer *container, GtkWidget *widget) | 145 gtk_gaim_scroll_book_add(GtkContainer *container, GtkWidget *widget) |
146 { | 146 { |
147 gtk_widget_show(widget); | 147 gtk_widget_show(widget); |
148 gtk_notebook_append_page(GTK_NOTEBOOK(GTK_GAIM_SCROLL_BOOK(container)->notebook), widget, NULL); | 148 gtk_notebook_append_page(GTK_NOTEBOOK(GTK_GAIM_SCROLL_BOOK(container)->notebook), widget, NULL); |
149 page_count_change_cb(GTK_GAIM_SCROLL_BOOK(container)); | |
149 } | 150 } |
150 | 151 |
151 static void | 152 static void |
152 gtk_gaim_scroll_book_forall(GtkContainer *container, | 153 gtk_gaim_scroll_book_forall(GtkContainer *container, |
153 gboolean include_internals, | 154 gboolean include_internals, |
154 GtkCallback callback, | 155 GtkCallback callback, |
155 gpointer callback_data) | 156 gpointer callback_data) |
156 { | 157 { |
157 GtkGaimScrollBook *scroll_book = GTK_GAIM_SCROLL_BOOK(container); | 158 GtkGaimScrollBook *scroll_book = GTK_GAIM_SCROLL_BOOK(container); |
158 if (include_internals) { | 159 if (include_internals) |
159 (*callback)(scroll_book->hbox, callback_data); | 160 (*callback)(scroll_book->hbox, callback_data); |
160 } | |
161 (*callback)(scroll_book->notebook, callback_data); | 161 (*callback)(scroll_book->notebook, callback_data); |
162 } | 162 } |
163 | 163 |
164 static void | 164 static void |
165 gtk_gaim_scroll_book_class_init (GtkGaimScrollBookClass *klass) | 165 gtk_gaim_scroll_book_class_init (GtkGaimScrollBookClass *klass) |
199 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(scroll_book->notebook), FALSE); | 199 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(scroll_book->notebook), FALSE); |
200 gtk_notebook_set_show_border(GTK_NOTEBOOK(scroll_book->notebook), FALSE); | 200 gtk_notebook_set_show_border(GTK_NOTEBOOK(scroll_book->notebook), FALSE); |
201 | 201 |
202 gtk_box_pack_start(GTK_BOX(scroll_book), scroll_book->notebook, TRUE, TRUE, 0); | 202 gtk_box_pack_start(GTK_BOX(scroll_book), scroll_book->notebook, TRUE, TRUE, 0); |
203 | 203 |
204 g_signal_connect_swapped(G_OBJECT(scroll_book->notebook), "add", G_CALLBACK(page_count_change_cb), scroll_book); | |
205 g_signal_connect_swapped(G_OBJECT(scroll_book->notebook), "remove", G_CALLBACK(page_count_change_cb), scroll_book); | 204 g_signal_connect_swapped(G_OBJECT(scroll_book->notebook), "remove", G_CALLBACK(page_count_change_cb), scroll_book); |
206 g_signal_connect(G_OBJECT(scroll_book->notebook), "switch-page", G_CALLBACK(switch_page_cb), scroll_book); | 205 g_signal_connect(G_OBJECT(scroll_book->notebook), "switch-page", G_CALLBACK(switch_page_cb), scroll_book); |
206 gtk_widget_show_all(scroll_book->hbox); | |
207 gtk_widget_show_all(scroll_book->notebook); | |
207 } | 208 } |
208 | 209 |
209 | 210 |
210 | 211 |
211 GtkWidget * | 212 GtkWidget * |