Changeset 9a2dd0c
- Timestamp:
- Jan 23, 2012, 5:28:46 PM (13 years ago)
- Parents:
- 8135737 (diff), d126a19 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
global.c
r9078f69 r219f52c 75 75 g_free(cd); 76 76 77 owl_messagelist_create(&(g->msglist));77 g->msglist = owl_messagelist_new(); 78 78 79 79 _owl_global_init_windows(g); … … 109 109 110 110 /* Create the widgets */ 111 owl_mainwin_init(&(g->mw),g->mainpanel.recwin);111 g->mw = owl_mainwin_new(g->mainpanel.recwin); 112 112 owl_msgwin_init(&(g->msgwin), g->mainpanel.msgwin); 113 113 owl_sepbar_init(g->mainpanel.sepwin); … … 241 241 /* windows */ 242 242 243 owl_mainwin *owl_global_get_mainwin(owl_global *g) { 244 return(&(g->mw)); 243 owl_mainwin *owl_global_get_mainwin(owl_global *g) 244 { 245 return g->mw; 245 246 } 246 247 … … 256 257 257 258 owl_messagelist *owl_global_get_msglist(owl_global *g) { 258 return (&(g->msglist));259 return g->msglist; 259 260 } 260 261 -
mainwin.c
r099597c rab88b05 4 4 static void owl_mainwin_resized(owl_window *w, void *user_data); 5 5 6 void owl_mainwin_init(owl_mainwin *mw,owl_window *window)6 CALLER_OWN owl_mainwin *owl_mainwin_new(owl_window *window) 7 7 { 8 owl_mainwin *mw = g_new(owl_mainwin, 1); 8 9 mw->curtruncated=0; 9 10 mw->lastdisplayed=-1; … … 16 17 /* For now, we do not bother with connecting up dependencies; that'll be a 17 18 * future refactor of the mainwin */ 19 20 return mw; 18 21 } 19 22 -
messagelist.c
rf271129 r219f52c 1 1 #include "owl.h" 2 2 3 void owl_messagelist_create(owl_messagelist *ml)3 CALLER_OWN owl_messagelist *owl_messagelist_new(void) 4 4 { 5 owl_messagelist *ml = g_new(owl_messagelist, 1); 5 6 ml->list = g_ptr_array_new(); 7 return ml; 6 8 } 7 9 8 void owl_messagelist_ cleanup(owl_messagelist *ml, bool free_messages)10 void owl_messagelist_delete(owl_messagelist *ml, bool free_messages) 9 11 { 10 12 if (free_messages) 11 13 g_ptr_array_foreach(ml->list, (GFunc)owl_message_delete, NULL); 12 14 g_ptr_array_free(ml->list, true); 15 g_free(ml); 13 16 } 14 17 -
owl.h
rb9517cf r219f52c 452 452 char *name; 453 453 owl_filter *filter; 454 owl_messagelist ml;454 owl_messagelist *ml; 455 455 const owl_style *style; 456 456 int cachedmsgid; … … 533 533 534 534 typedef struct _owl_global { 535 owl_mainwin mw;535 owl_mainwin *mw; 536 536 owl_popwin *pw; 537 537 owl_msgwin msgwin; … … 551 551 int curmsg_vert_offset; 552 552 owl_view current_view; 553 owl_messagelist msglist;553 owl_messagelist *msglist; 554 554 WINDOW *input_pad; 555 555 owl_mainpanel mainpanel; -
variable.c
rf271129 rd126a19 116 116 "both,in,out"), 117 117 118 OWLVAR_BOOL( "colorztext" /* %OwlVarStub */, 1, 119 "allow @color() in zephyrs to change color", 120 "Note that only messages received after this variable\n" 121 "is set will be affected." ), 118 OWLVAR_BOOL_FULL( "colorztext" /* %OwlVarStub */, 1, 119 "allow @color() in zephyrs to change color", 120 NULL, NULL, owl_variable_colorztext_set, NULL), 122 121 123 122 OWLVAR_BOOL( "fancylines" /* %OwlVarStub */, 1, … … 496 495 } 497 496 return owl_variable_bool_set_default(v, newval); 497 } 498 499 int owl_variable_colorztext_set(owl_variable *v, const void *newval) 500 { 501 int ret = owl_variable_bool_set_default(v, newval); 502 /* flush the format cache so that we see the update, but only if we're done initializing BarnOwl */ 503 if (owl_global_get_msglist(&g) != NULL) 504 owl_messagelist_invalidate_formats(owl_global_get_msglist(&g)); 505 if (owl_global_get_mainwin(&g) != NULL) { 506 owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS); 507 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 508 } 509 return ret; 498 510 } 499 511 -
view.c
rf271129 r219f52c 6 6 v->filter=f; 7 7 v->style=s; 8 owl_messagelist_create(&(v->ml));8 v->ml = owl_messagelist_new(); 9 9 owl_view_recalculate(v); 10 10 } … … 19 19 { 20 20 if (owl_filter_message_match(v->filter, m)) { 21 owl_messagelist_append_element( &(v->ml), m);21 owl_messagelist_append_element(v->ml, m); 22 22 } 23 23 } … … 30 30 int i, j; 31 31 const owl_messagelist *gml; 32 owl_messagelist *ml;33 32 owl_message *m; 34 33 35 34 gml=owl_global_get_msglist(&g); 36 ml=&(v->ml);37 35 38 36 /* nuke the old list, don't free the messages */ 39 owl_messagelist_ cleanup(ml, false);40 owl_messagelist_create(&(v->ml));37 owl_messagelist_delete(v->ml, false); 38 v->ml = owl_messagelist_new(); 41 39 42 40 /* find all the messages we want */ … … 45 43 m=owl_messagelist_get_element(gml, i); 46 44 if (owl_filter_message_match(v->filter, m)) { 47 owl_messagelist_append_element( ml, m);45 owl_messagelist_append_element(v->ml, m); 48 46 } 49 47 } … … 72 70 owl_message *owl_view_get_element(const owl_view *v, int index) 73 71 { 74 return (owl_messagelist_get_element(&(v->ml), index));72 return owl_messagelist_get_element(v->ml, index); 75 73 } 76 74 77 75 void owl_view_delete_element(owl_view *v, int index) 78 76 { 79 owl_messagelist_delete_element( &(v->ml), index);77 owl_messagelist_delete_element(v->ml, index); 80 78 } 81 79 82 80 void owl_view_undelete_element(owl_view *v, int index) 83 81 { 84 owl_messagelist_undelete_element( &(v->ml), index);82 owl_messagelist_undelete_element(v->ml, index); 85 83 } 86 84 87 85 int owl_view_get_size(const owl_view *v) 88 86 { 89 return (owl_messagelist_get_size(&(v->ml)));87 return owl_messagelist_get_size(v->ml); 90 88 } 91 89 … … 158 156 void owl_view_cleanup(owl_view *v) 159 157 { 160 owl_messagelist_ cleanup(&v->ml, false);158 owl_messagelist_delete(v->ml, false); 161 159 g_free(v->name); 162 160 }
Note: See TracChangeset
for help on using the changeset viewer.