From: <sa...@us...> - 2006-07-23 02:03:26
|
Revision: 16542 Author: sadrul Date: 2006-07-22 19:03:19 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16542&view=rev Log Message: ----------- Show the mail-notification checkbox in the account-dialog only if the prpl has support for it. Modified Paths: -------------- trunk/console/gntaccount.c trunk/console/libgnt/gntbox.c trunk/console/libgnt/gntwidget.c trunk/console/libgnt/gntwidget.h Modified: trunk/console/gntaccount.c =================================================================== --- trunk/console/gntaccount.c 2006-07-23 01:40:43 UTC (rev 16541) +++ trunk/console/gntaccount.c 2006-07-23 02:03:19 UTC (rev 16542) @@ -396,6 +396,10 @@ if (dialog->account) gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->newmail), gaim_account_get_check_mail(dialog->account)); + if (!prplinfo || !(prplinfo->options & OPT_PROTO_MAIL_CHECK)) + gnt_widget_set_visible(dialog->newmail, FALSE); + else + gnt_widget_set_visible(dialog->newmail, TRUE); if (dialog->remember == NULL) dialog->remember = gnt_check_box_new(_("Remember password")); Modified: trunk/console/libgnt/gntbox.c =================================================================== --- trunk/console/libgnt/gntbox.c 2006-07-23 01:40:43 UTC (rev 16541) +++ trunk/console/libgnt/gntbox.c 2006-07-23 02:03:19 UTC (rev 16542) @@ -89,6 +89,8 @@ for (iter = box->list; iter; iter = iter->next) { + if (GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(iter->data), GNT_WIDGET_INVISIBLE)) + continue; gnt_widget_set_position(GNT_WIDGET(iter->data), curx, cury); gnt_widget_get_size(GNT_WIDGET(iter->data), &w, &h); if (box->vertical) @@ -217,6 +219,7 @@ static GntWidget * find_focusable_widget(GntBox *box) { + /* XXX: Make sure the widget is visible? */ if (box->focus == NULL && GNT_WIDGET(box)->parent == NULL) g_list_foreach(box->list, add_to_focus, box); @@ -229,11 +232,17 @@ static void find_next_focus(GntBox *box) { - GList *iter = g_list_find(box->focus, box->active); - if (iter && iter->next) - box->active = iter->next->data; - else if (box->focus) - box->active = box->focus->data; + gpointer last = box->active; + do + { + GList *iter = g_list_find(box->focus, box->active); + if (iter && iter->next) + box->active = iter->next->data; + else if (box->focus) + box->active = box->focus->data; + if (!GNT_WIDGET_IS_FLAG_SET(box->active, GNT_WIDGET_INVISIBLE)) + break; + } while (box->active != last); } static gboolean @@ -564,6 +573,9 @@ int height, width; int x, y; + if (GNT_WIDGET_IS_FLAG_SET(w, GNT_WIDGET_INVISIBLE)) + continue; + if (GNT_IS_BOX(w)) gnt_box_sync_children(GNT_BOX(w)); Modified: trunk/console/libgnt/gntwidget.c =================================================================== --- trunk/console/libgnt/gntwidget.c 2006-07-23 01:40:43 UTC (rev 16541) +++ trunk/console/libgnt/gntwidget.c 2006-07-23 02:03:19 UTC (rev 16542) @@ -329,6 +329,7 @@ mvwvline(widget->window, 1, widget->priv.width, ' ', widget->priv.height); #endif gnt_screen_release(widget); + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_INVISIBLE); GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_MAPPED); } @@ -509,3 +510,11 @@ return ret; } +void gnt_widget_set_visible(GntWidget *widget, gboolean set) +{ + if (set) + GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_INVISIBLE); + else + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_INVISIBLE); +} + Modified: trunk/console/libgnt/gntwidget.h =================================================================== --- trunk/console/libgnt/gntwidget.h 2006-07-23 01:40:43 UTC (rev 16541) +++ trunk/console/libgnt/gntwidget.h 2006-07-23 02:03:19 UTC (rev 16542) @@ -39,6 +39,7 @@ GNT_WIDGET_URGENT = 1 << 7, GNT_WIDGET_GROW_X = 1 << 8, GNT_WIDGET_GROW_Y = 1 << 9, + GNT_WIDGET_INVISIBLE = 1 << 10, } GntWidgetFlags; /* XXX: I'll have to ask grim what he's using this for in guifications. */ @@ -125,6 +126,9 @@ void gnt_widget_queue_update(GntWidget *widget); void gnt_widget_set_take_focus(GntWidget *widget, gboolean set); + +void gnt_widget_set_visible(GntWidget *widget, gboolean set); + G_END_DECLS #endif /* GNT_WIDGET_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |