comparison pidgin/gtkscrollbook.c @ 21639:fa5d1f426332

I'm pretty sure this is what was intended.
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 26 Nov 2007 05:30:36 +0000
parents 21cbdaf265f6
children ee7638c696f1
comparison
equal deleted inserted replaced
21638:dc9d0141a35f 21639:fa5d1f426332
144 } 144 }
145 145
146 static void 146 static void
147 pidgin_scroll_book_add(GtkContainer *container, GtkWidget *widget) 147 pidgin_scroll_book_add(GtkContainer *container, GtkWidget *widget)
148 { 148 {
149 GList *children;
150 PidginScrollBook *scroll_book; 149 PidginScrollBook *scroll_book;
151 150
152 g_return_if_fail(GTK_IS_WIDGET (widget)); 151 g_return_if_fail(GTK_IS_WIDGET (widget));
153 g_return_if_fail (widget->parent == NULL); 152 g_return_if_fail (widget->parent == NULL);
154 153
155 scroll_book = PIDGIN_SCROLL_BOOK(container); 154 scroll_book = PIDGIN_SCROLL_BOOK(container);
156 children = scroll_book->children; 155 scroll_book->children = g_list_append(scroll_book->children, widget);
157 children = g_list_append(children, widget);
158 gtk_widget_show(widget); 156 gtk_widget_show(widget);
159 gtk_notebook_append_page(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), widget, NULL); 157 gtk_notebook_append_page(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), widget, NULL);
160 page_count_change_cb(PIDGIN_SCROLL_BOOK(container)); 158 page_count_change_cb(PIDGIN_SCROLL_BOOK(container));
161 } 159 }
162 160
174 172
175 while (children) { 173 while (children) {
176 child = children->data; 174 child = children->data;
177 if (child == widget) { 175 if (child == widget) {
178 gtk_widget_unparent (widget); 176 gtk_widget_unparent (widget);
179 children = g_list_remove_link (scroll_book->children, children); 177 scroll_book->children = g_list_delete_link(scroll_book->children, children);
180 g_list_free(children);
181 break; 178 break;
182 } 179 }
180 children = children->next;
183 } 181 }
184 182
185 page = gtk_notebook_page_num(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), widget); 183 page = gtk_notebook_page_num(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), widget);
186 if (page >= 0) { 184 if (page >= 0) {
187 gtk_notebook_remove_page(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), page); 185 gtk_notebook_remove_page(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), page);