Changeset 9a2dd0c


Ignore:
Timestamp:
Jan 23, 2012, 5:28:46 PM (13 years ago)
Author:
GitHub Merge Button <merge-button@github.com>
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.
Message:
Merge d126a19eb5f8a883b722fb26d21fb7b62b2aedeb into 813573732b0f3417b980267c0277caba41fb2cb3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • global.c

    r9078f69 r219f52c  
    7575  g_free(cd);
    7676
    77   owl_messagelist_create(&(g->msglist));
     77  g->msglist = owl_messagelist_new();
    7878
    7979  _owl_global_init_windows(g);
     
    109109
    110110  /* Create the widgets */
    111   owl_mainwin_init(&(g->mw), g->mainpanel.recwin);
     111  g->mw = owl_mainwin_new(g->mainpanel.recwin);
    112112  owl_msgwin_init(&(g->msgwin), g->mainpanel.msgwin);
    113113  owl_sepbar_init(g->mainpanel.sepwin);
     
    241241/* windows */
    242242
    243 owl_mainwin *owl_global_get_mainwin(owl_global *g) {
    244   return(&(g->mw));
     243owl_mainwin *owl_global_get_mainwin(owl_global *g)
     244{
     245  return g->mw;
    245246}
    246247
     
    256257
    257258owl_messagelist *owl_global_get_msglist(owl_global *g) {
    258   return(&(g->msglist));
     259  return g->msglist;
    259260}
    260261
  • mainwin.c

    r099597c rab88b05  
    44static void owl_mainwin_resized(owl_window *w, void *user_data);
    55
    6 void owl_mainwin_init(owl_mainwin *mw, owl_window *window)
     6CALLER_OWN owl_mainwin *owl_mainwin_new(owl_window *window)
    77{
     8  owl_mainwin *mw = g_new(owl_mainwin, 1);
    89  mw->curtruncated=0;
    910  mw->lastdisplayed=-1;
     
    1617  /* For now, we do not bother with connecting up dependencies; that'll be a
    1718   * future refactor of the mainwin */
     19
     20  return mw;
    1821}
    1922
  • messagelist.c

    rf271129 r219f52c  
    11#include "owl.h"
    22
    3 void owl_messagelist_create(owl_messagelist *ml)
     3CALLER_OWN owl_messagelist *owl_messagelist_new(void)
    44{
     5  owl_messagelist *ml = g_new(owl_messagelist, 1);
    56  ml->list = g_ptr_array_new();
     7  return ml;
    68}
    79
    8 void owl_messagelist_cleanup(owl_messagelist *ml, bool free_messages)
     10void owl_messagelist_delete(owl_messagelist *ml, bool free_messages)
    911{
    1012  if (free_messages)
    1113    g_ptr_array_foreach(ml->list, (GFunc)owl_message_delete, NULL);
    1214  g_ptr_array_free(ml->list, true);
     15  g_free(ml);
    1316}
    1417
  • owl.h

    rb9517cf r219f52c  
    452452  char *name;
    453453  owl_filter *filter;
    454   owl_messagelist ml;
     454  owl_messagelist *ml;
    455455  const owl_style *style;
    456456  int cachedmsgid;
     
    533533
    534534typedef struct _owl_global {
    535   owl_mainwin mw;
     535  owl_mainwin *mw;
    536536  owl_popwin *pw;
    537537  owl_msgwin msgwin;
     
    551551  int curmsg_vert_offset;
    552552  owl_view current_view;
    553   owl_messagelist msglist;
     553  owl_messagelist *msglist;
    554554  WINDOW *input_pad;
    555555  owl_mainpanel mainpanel;
  • variable.c

    rf271129 rd126a19  
    116116               "both,in,out"),
    117117
    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),
    122121
    123122  OWLVAR_BOOL( "fancylines" /* %OwlVarStub */, 1,
     
    496495  }
    497496  return owl_variable_bool_set_default(v, newval);
     497}
     498
     499int 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;
    498510}
    499511
  • view.c

    rf271129 r219f52c  
    66  v->filter=f;
    77  v->style=s;
    8   owl_messagelist_create(&(v->ml));
     8  v->ml = owl_messagelist_new();
    99  owl_view_recalculate(v);
    1010}
     
    1919{
    2020  if (owl_filter_message_match(v->filter, m)) {
    21     owl_messagelist_append_element(&(v->ml), m);
     21    owl_messagelist_append_element(v->ml, m);
    2222  }
    2323}
     
    3030  int i, j;
    3131  const owl_messagelist *gml;
    32   owl_messagelist *ml;
    3332  owl_message *m;
    3433
    3534  gml=owl_global_get_msglist(&g);
    36   ml=&(v->ml);
    3735
    3836  /* 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();
    4139
    4240  /* find all the messages we want */
     
    4543    m=owl_messagelist_get_element(gml, i);
    4644    if (owl_filter_message_match(v->filter, m)) {
    47       owl_messagelist_append_element(ml, m);
     45      owl_messagelist_append_element(v->ml, m);
    4846    }
    4947  }
     
    7270owl_message *owl_view_get_element(const owl_view *v, int index)
    7371{
    74   return(owl_messagelist_get_element(&(v->ml), index));
     72  return owl_messagelist_get_element(v->ml, index);
    7573}
    7674
    7775void owl_view_delete_element(owl_view *v, int index)
    7876{
    79   owl_messagelist_delete_element(&(v->ml), index);
     77  owl_messagelist_delete_element(v->ml, index);
    8078}
    8179
    8280void owl_view_undelete_element(owl_view *v, int index)
    8381{
    84   owl_messagelist_undelete_element(&(v->ml), index);
     82  owl_messagelist_undelete_element(v->ml, index);
    8583}
    8684
    8785int owl_view_get_size(const owl_view *v)
    8886{
    89   return(owl_messagelist_get_size(&(v->ml)));
     87  return owl_messagelist_get_size(v->ml);
    9088}
    9189
     
    158156void owl_view_cleanup(owl_view *v)
    159157{
    160   owl_messagelist_cleanup(&v->ml, false);
     158  owl_messagelist_delete(v->ml, false);
    161159  g_free(v->name);
    162160}
Note: See TracChangeset for help on using the changeset viewer.