Mercurial > pidgin
comparison console/libgnt/gntbox.c @ 14041:27182f83b79b
[gaim-migrate @ 16647]
Statusbox comes in. It's now possible to change the account status. There's
nothing yet for creating custom statuses.
It's also possible now to delete accounts.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 05 Aug 2006 11:31:54 +0000 |
parents | 7573bd40a190 |
children | 1a500db56415 |
comparison
equal
deleted
inserted
replaced
14040:80891029f5dd | 14041:27182f83b79b |
---|---|
243 if (!GNT_WIDGET_IS_FLAG_SET(box->active, GNT_WIDGET_INVISIBLE)) | 243 if (!GNT_WIDGET_IS_FLAG_SET(box->active, GNT_WIDGET_INVISIBLE)) |
244 break; | 244 break; |
245 } while (box->active != last); | 245 } while (box->active != last); |
246 } | 246 } |
247 | 247 |
248 static void | |
249 find_prev_focus(GntBox *box) | |
250 { | |
251 gpointer last = box->active; | |
252 | |
253 if (!box->focus) | |
254 return; | |
255 | |
256 do | |
257 { | |
258 GList *iter = g_list_find(box->focus, box->active); | |
259 if (!iter) | |
260 box->active = box->focus->data; | |
261 else if (!iter->prev) | |
262 box->active = g_list_last(box->focus)->data; | |
263 else | |
264 box->active = iter->prev->data; | |
265 if (!GNT_WIDGET_IS_FLAG_SET(box->active, GNT_WIDGET_INVISIBLE)) | |
266 break; | |
267 } while (box->active != last); | |
268 } | |
269 | |
248 static gboolean | 270 static gboolean |
249 gnt_box_key_pressed(GntWidget *widget, const char *text) | 271 gnt_box_key_pressed(GntWidget *widget, const char *text) |
250 { | 272 { |
251 GntBox *box = GNT_BOX(widget); | 273 GntBox *box = GNT_BOX(widget); |
252 GntWidget *now; | 274 GntWidget *now; |
261 | 283 |
262 if (text[0] == 27) | 284 if (text[0] == 27) |
263 { | 285 { |
264 if (strcmp(text+1, GNT_KEY_LEFT) == 0) | 286 if (strcmp(text+1, GNT_KEY_LEFT) == 0) |
265 { | 287 { |
266 GList *iter = g_list_find(box->focus, box->active); | 288 find_prev_focus(box); |
267 if ((!iter || !iter->prev) && box->focus) | |
268 { | |
269 box->active = box->focus->data; | |
270 } | |
271 else | |
272 { | |
273 box->active = iter->prev->data; | |
274 } | |
275 } | 289 } |
276 else if (strcmp(text+1, GNT_KEY_RIGHT) == 0) | 290 else if (strcmp(text+1, GNT_KEY_RIGHT) == 0) |
277 { | 291 { |
278 find_next_focus(box); | 292 find_next_focus(box); |
279 } | 293 } |
687 void gnt_box_set_fill(GntBox *box, gboolean fill) | 701 void gnt_box_set_fill(GntBox *box, gboolean fill) |
688 { | 702 { |
689 box->fill = fill; | 703 box->fill = fill; |
690 } | 704 } |
691 | 705 |
706 void gnt_box_move_focus(GntBox *box, int dir) | |
707 { | |
708 GntWidget *now; | |
709 | |
710 if (box->active == NULL) | |
711 { | |
712 find_focusable_widget(box); | |
713 return; | |
714 } | |
715 | |
716 now = box->active; | |
717 | |
718 if (dir == 1) | |
719 find_next_focus(box); | |
720 else if (dir == -1) | |
721 find_prev_focus(box); | |
722 | |
723 if (now && now != box->active) | |
724 { | |
725 gnt_widget_set_focus(now, FALSE); | |
726 gnt_widget_set_focus(box->active, TRUE); | |
727 } | |
728 | |
729 if (GNT_WIDGET(box)->window) | |
730 gnt_widget_draw(GNT_WIDGET(box)); | |
731 } | |
732 | |
733 void gnt_box_give_focus_to_child(GntBox *box, GntWidget *widget) | |
734 { | |
735 GList *find = g_list_find(box->focus, widget); | |
736 gpointer now = box->active; | |
737 if (find) | |
738 box->active = widget; | |
739 if (now && now != box->active) | |
740 { | |
741 gnt_widget_set_focus(now, FALSE); | |
742 gnt_widget_set_focus(box->active, TRUE); | |
743 } | |
744 | |
745 if (GNT_WIDGET(box)->window) | |
746 gnt_widget_draw(GNT_WIDGET(box)); | |
747 } | |
748 |