Mercurial > pidgin.yaz
comparison pidgin/gtkscrollbook.c @ 21583:21cbdaf265f6
This fixes the problem where all accounts are disabled due to connection
errors, which leaves you with no enabled accounts, and therefore the
buddy list flips into "Welcome to Pidgin!" mode, thereby hiding all the
connection error mini dialogs. I'm amazed I haven't heard any noise about
this problem.
I attempted to fix up PidginScrollBook, and got part way there, but
gtk_container_get_children now doesn't return any kids. I suspect this is
due to the child widgets we care about already being children of the
notebook. I don't know nearly enough gtk to be sure if this is good or not.
There are still some buglets in how/when the buddy list notebook page is
selected, and I have a feeling some of the gtkblist.c changes could be
improved, but I believe this is more usable than before.
This took far too much time.
References #3989
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 18 Nov 2007 21:03:29 +0000 |
parents | 6bf32c9e15a7 |
children | fa5d1f426332 |
comparison
equal
deleted
inserted
replaced
21582:b00659aa0acf | 21583:21cbdaf265f6 |
---|---|
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; | |
151 | |
152 g_return_if_fail(GTK_IS_WIDGET (widget)); | |
153 g_return_if_fail (widget->parent == NULL); | |
154 | |
155 scroll_book = PIDGIN_SCROLL_BOOK(container); | |
156 children = scroll_book->children; | |
157 children = g_list_append(children, widget); | |
149 gtk_widget_show(widget); | 158 gtk_widget_show(widget); |
150 gtk_notebook_append_page(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), widget, NULL); | 159 gtk_notebook_append_page(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), widget, NULL); |
151 page_count_change_cb(PIDGIN_SCROLL_BOOK(container)); | 160 page_count_change_cb(PIDGIN_SCROLL_BOOK(container)); |
161 } | |
162 | |
163 static void | |
164 pidgin_scroll_book_remove(GtkContainer *container, GtkWidget *widget) | |
165 { | |
166 int page; | |
167 GList *children; | |
168 GtkWidget *child; | |
169 PidginScrollBook *scroll_book; | |
170 g_return_if_fail(GTK_IS_WIDGET(widget)); | |
171 | |
172 scroll_book = PIDGIN_SCROLL_BOOK(container); | |
173 children = scroll_book->children; | |
174 | |
175 while (children) { | |
176 child = children->data; | |
177 if (child == widget) { | |
178 gtk_widget_unparent (widget); | |
179 children = g_list_remove_link (scroll_book->children, children); | |
180 g_list_free(children); | |
181 break; | |
182 } | |
183 } | |
184 | |
185 page = gtk_notebook_page_num(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), widget); | |
186 if (page >= 0) { | |
187 gtk_notebook_remove_page(GTK_NOTEBOOK(PIDGIN_SCROLL_BOOK(container)->notebook), page); | |
188 } | |
152 } | 189 } |
153 | 190 |
154 static void | 191 static void |
155 pidgin_scroll_book_forall(GtkContainer *container, | 192 pidgin_scroll_book_forall(GtkContainer *container, |
156 gboolean include_internals, | 193 gboolean include_internals, |
157 GtkCallback callback, | 194 GtkCallback callback, |
158 gpointer callback_data) | 195 gpointer callback_data) |
159 { | 196 { |
160 PidginScrollBook *scroll_book = PIDGIN_SCROLL_BOOK(container); | 197 GList *children; |
161 if (include_internals) | 198 PidginScrollBook *scroll_book; |
199 | |
200 g_return_if_fail(GTK_IS_CONTAINER(container)); | |
201 | |
202 scroll_book = PIDGIN_SCROLL_BOOK(container); | |
203 | |
204 if (include_internals) { | |
162 (*callback)(scroll_book->hbox, callback_data); | 205 (*callback)(scroll_book->hbox, callback_data); |
163 (*callback)(scroll_book->notebook, callback_data); | 206 (*callback)(scroll_book->notebook, callback_data); |
207 } | |
208 | |
209 children = scroll_book->children; | |
210 | |
211 while (children) { | |
212 GtkWidget *child; | |
213 child = children->data; | |
214 children = children->next; | |
215 (*callback)(child, callback_data); | |
216 } | |
164 } | 217 } |
165 | 218 |
166 static void | 219 static void |
167 pidgin_scroll_book_class_init (PidginScrollBookClass *klass) | 220 pidgin_scroll_book_class_init (PidginScrollBookClass *klass) |
168 { | 221 { |
169 GtkContainerClass *container_class = (GtkContainerClass*)klass; | 222 GtkContainerClass *container_class = (GtkContainerClass*)klass; |
170 | 223 |
171 container_class->add = pidgin_scroll_book_add; | 224 container_class->add = pidgin_scroll_book_add; |
225 container_class->remove = pidgin_scroll_book_remove; | |
172 container_class->forall = pidgin_scroll_book_forall; | 226 container_class->forall = pidgin_scroll_book_forall; |
173 | 227 |
174 } | 228 } |
175 | 229 |
176 static void | 230 static void |