• R/O
  • SSH
  • HTTPS

bchan: 提交


Commit MetaInfo

修訂461 (tree)
時間2012-05-02 18:51:22
作者ornse01

Log Message

add function for checking changed.
fix changed flag bug.

Change Summary

差異

--- bchanl/trunk/src/extbbslist.c (revision 460)
+++ bchanl/trunk/src/extbbslist.c (revision 461)
@@ -389,7 +389,7 @@
389389 return NULL;
390390 }
391391
392-EXPORT W extbbslist_editcontext_append(extbbslist_editcontext_t *ctx, CONST TC *title, W title_len, CONST TC *url, W url_len)
392+LOCAL W extbbslist_editcontext_append_common(extbbslist_editcontext_t *ctx, CONST TC *title, W title_len, CONST TC *url, W url_len)
393393 {
394394 extbbslist_item_t *item, *senti;
395395 W err;
@@ -414,11 +414,22 @@
414414 senti = extbbslist_editcontext_sentinelnode(ctx);
415415 extbbslist_item_QueInsert(item, senti);
416416 ctx->num++;
417- ctx->changed = True;
418417
419418 return 0;
420419 }
421420
421+EXPORT W extbbslist_editcontext_append(extbbslist_editcontext_t *ctx, CONST TC *title, W title_len, CONST TC *url, W url_len)
422+{
423+ W err;
424+
425+ err = extbbslist_editcontext_append_common(ctx, title, title_len, url, url_len);
426+ if (err < 0) {
427+ return err;
428+ }
429+ ctx->changed = True;
430+ return 0;
431+}
432+
422433 EXPORT W extbbslist_editcontext_update(extbbslist_editcontext_t *ctx, W i, CONST TC *title, W title_len, CONST TC *url, W url_len)
423434 {
424435 extbbslist_item_t *item;
@@ -636,11 +647,16 @@
636647 ctx->selected.index = i;
637648 }
638649
639-IMPORT W extbbslist_editcontext_getselect(extbbslist_editcontext_t *ctx)
650+EXPORT W extbbslist_editcontext_getselect(extbbslist_editcontext_t *ctx)
640651 {
641652 return ctx->selected.index;
642653 }
643654
655+EXPORT Bool extbbslist_editcontext_ischanged(extbbslist_editcontext_t *ctx)
656+{
657+ return ctx->changed;
658+}
659+
644660 EXPORT VOID extbbslist_editcontext_setviewrect(extbbslist_editcontext_t *ctx, W l, W t, W r, W b)
645661 {
646662 ctx->view_l = l;
@@ -731,7 +747,7 @@
731747 senti = extbbslist_sentinelnode(list);
732748 item = extbbslist_item_nextnode(senti);
733749 for (; item != senti;) {
734- err = extbbslist_editcontext_append(ctx, item->title, item->title_len, item->url.tc, item->url.tc_len);
750+ err = extbbslist_editcontext_append_common(ctx, item->title, item->title_len, item->url.tc, item->url.tc_len);
735751 if (err < 0) {
736752 extbbslist_editcontext_delete(ctx);
737753 return NULL;
--- bchanl/trunk/src/extbbslist.h (revision 460)
+++ bchanl/trunk/src/extbbslist.h (revision 461)
@@ -56,6 +56,7 @@
5656 IMPORT W extbbslist_editcontext_deleteitem(extbbslist_editcontext_t *ctx, W i);
5757 IMPORT VOID extbbslist_editcontext_setselect(extbbslist_editcontext_t *ctx, W i);
5858 IMPORT W extbbslist_editcontext_getselect(extbbslist_editcontext_t *ctx);
59+IMPORT Bool extbbslist_editcontext_ischanged(extbbslist_editcontext_t *ctx);
5960 IMPORT VOID extbbslist_editcontext_setviewrect(extbbslist_editcontext_t *ctx, W l, W t, W r, W b);
6061 IMPORT VOID extbbslist_editcontext_getviewrect(extbbslist_editcontext_t *ctx, W *l, W *t, W *r, W *b);
6162 IMPORT VOID extbbslist_editcontext_scrollviewrect(extbbslist_editcontext_t *ctx, W dh, W dv);
Show on old repository browser