- Timestamp:
- Jun 17, 2003, 9:46:10 PM (20 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- b1299da
- Parents:
- 65e3901
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
view.c
r3a2daac rc3ab155 4 4 static const char fileIdent[] = "$Id$"; 5 5 6 void owl_view_create(owl_view *v, owl_filter *f) { 6 void owl_view_create(owl_view *v, char *name, owl_filter *f, owl_style *s) 7 { 8 v->name=owl_strdup(name); 7 9 v->filter=f; 10 v->style=s; 8 11 owl_messagelist_create(&(v->ml)); 9 12 owl_view_recalculate(v); 10 13 } 11 14 12 void owl_view_consider_message(owl_view *v, owl_message *m) { 13 /* if the message matches the filter then add to view */ 15 16 /* if the message matches the filter then add to view */ 17 void owl_view_consider_message(owl_view *v, owl_message *m) 18 { 14 19 if (owl_filter_message_match(v->filter, m)) { 15 20 owl_messagelist_append_element(&(v->ml), m); … … 17 22 } 18 23 19 void owl_view_recalculate(owl_view *v) { 20 /* add all the global messages that match the filter */ 24 /* remove all messages, add all the global messages that match the 25 * filter. 26 */ 27 void owl_view_recalculate(owl_view *v) 28 { 21 29 int i, j; 22 30 owl_messagelist *gml; … … 41 49 } 42 50 43 owl_message *owl_view_get_element(owl_view *v, int index) { 51 void owl_view_new_filter(owl_view *v, owl_filter *f) 52 { 53 v->filter=f; 54 owl_view_recalculate(v); 55 } 56 57 void owl_view_set_style(owl_view *v, owl_style *s) 58 { 59 v->style=s; 60 } 61 62 owl_message *owl_view_get_element(owl_view *v, int index) 63 { 44 64 return(owl_messagelist_get_element(&(v->ml), index)); 45 65 } 46 66 47 void owl_view_delete_element(owl_view *v, int index) { 67 void owl_view_delete_element(owl_view *v, int index) 68 { 48 69 owl_messagelist_delete_element(&(v->ml), index); 49 70 } 50 71 51 void owl_view_undelete_element(owl_view *v, int index) { 72 void owl_view_undelete_element(owl_view *v, int index) 73 { 52 74 owl_messagelist_undelete_element(&(v->ml), index); 53 75 } 54 76 55 int owl_view_get_size(owl_view *v) { 77 int owl_view_get_size(owl_view *v) 78 { 56 79 return(owl_messagelist_get_size(&(v->ml))); 57 80 } … … 59 82 /* Returns the position in the view with a message closest 60 83 * to the passed msgid. */ 61 int owl_view_get_nearest_to_msgid(owl_view *v, int targetid) { 84 int owl_view_get_nearest_to_msgid(owl_view *v, int targetid) 85 { 62 86 int i, bestdist=-1, bestpos=0, curid, curdist; 63 87 … … 73 97 } 74 98 75 int owl_view_get_nearest_to_saved(owl_view *v) { 99 int owl_view_get_nearest_to_saved(owl_view *v) 100 { 76 101 int cachedid; 77 102 … … 83 108 /* saves the current message position in the filter so it can 84 109 * be restored later if we switch back to this filter. */ 85 void owl_view_save_curmsgid(owl_view *v, int curid) { 110 void owl_view_save_curmsgid(owl_view *v, int curid) 111 { 86 112 owl_filter_set_cachedmsgid(v->filter, curid); 87 113 } 88 114 89 char *owl_view_get_filtname(owl_view *v) { 115 char *owl_view_get_filtname(owl_view *v) 116 { 90 117 return(owl_filter_get_name(v->filter)); 91 118 } 92 119 93 void owl_view_free(owl_view *v) { 120 void owl_view_free(owl_view *v) 121 { 94 122 owl_list_free_simple((owl_list *) &(v->ml)); 123 if (v->name) owl_free(v->name); 95 124 }
Note: See TracChangeset
for help on using the changeset viewer.