[1007] in BarnOwl Developers
[D-O-H] r991 - branches/barnowl_sqlite/owl
daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:12:04 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@nelhage.com
To: dirty-owl-hackers@MIT.EDU
From: nelhage@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Wed, 26 Mar 2008 22:07:20 -0400 (EDT)
Author: nelhage
Date: 2008-03-26 22:07:20 -0400 (Wed, 26 Mar 2008)
New Revision: 991
Modified:
branches/barnowl_sqlite/owl/commands.c
branches/barnowl_sqlite/owl/functions.c
branches/barnowl_sqlite/owl/global.c
branches/barnowl_sqlite/owl/message.c
branches/barnowl_sqlite/owl/owl.c
branches/barnowl_sqlite/owl/owl.h
branches/barnowl_sqlite/owl/view.c
Log:
Move the current style out of the view into owl_global for now at
least.
Modified: branches/barnowl_sqlite/owl/commands.c
===================================================================
--- branches/barnowl_sqlite/owl/commands.c 2008-03-26 06:24:26 UTC (rev 990)
+++ branches/barnowl_sqlite/owl/commands.c 2008-03-27 02:07:20 UTC (rev 991)
@@ -2560,7 +2560,7 @@
owl_function_makemsg("Wrong number of arguments for %s", argv[0]);
return NULL;
}
- stylename = owl_view_get_style_name(owl_global_get_current_view(&g));
+ stylename = owl_style_get_name(owl_global_get_current_style(&g));
if (stylename) stylename = owl_strdup(stylename);
return stylename;
}
Modified: branches/barnowl_sqlite/owl/functions.c
===================================================================
--- branches/barnowl_sqlite/owl/functions.c 2008-03-26 06:24:26 UTC (rev 990)
+++ branches/barnowl_sqlite/owl/functions.c 2008-03-27 02:07:20 UTC (rev 991)
@@ -3512,7 +3512,7 @@
owl_function_error("No style named %s", stylename);
return;
}
- owl_view_set_style(v, s);
+ owl_global_set_current_style(&g, s);
owl_messagelist_invalidate_formats(owl_global_get_msglist(&g));
owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS);
owl_mainwin_redisplay(owl_global_get_mainwin(&g));
@@ -3524,7 +3524,7 @@
owl_style *s;
v=owl_global_get_current_view(&g);
- s=owl_view_get_style(v);
+ s=owl_global_get_current_style(&g);
if (!owl_style_matches_name(s, "oneline")) {
owl_function_change_style(v, "oneline");
Modified: branches/barnowl_sqlite/owl/global.c
===================================================================
--- branches/barnowl_sqlite/owl/global.c 2008-03-26 06:24:26 UTC (rev 990)
+++ branches/barnowl_sqlite/owl/global.c 2008-03-27 02:07:20 UTC (rev 991)
@@ -640,6 +640,14 @@
return(&(g->current_view));
}
+void owl_global_set_current_style(owl_global *g, owl_style *s) {
+ g->current_style = s;
+}
+
+owl_style *owl_global_get_current_style(owl_global *g) {
+ return g->current_style;
+}
+
owl_message *owl_global_get_current_message(owl_global *g) {
owl_view *cur = owl_global_get_current_view(g);
if(owl_view_is_empty(cur)) return NULL;
@@ -868,10 +876,10 @@
* If we're redefining the current style, make sure to update
* pointers to it.
*/
- if(g->current_view.style
- && !strcmp(owl_style_get_name(g->current_view.style),
+ if(g->current_style
+ && !strcmp(owl_style_get_name(g->current_style),
owl_style_get_name(s)))
- g->current_view.style = s;
+ g->current_style = s;
owl_dict_insert_element(&(g->styledict), owl_style_get_name(s),
s, (void(*)(void*))owl_style_free);
}
Modified: branches/barnowl_sqlite/owl/message.c
===================================================================
--- branches/barnowl_sqlite/owl/message.c 2008-03-26 06:24:26 UTC (rev 990)
+++ branches/barnowl_sqlite/owl/message.c 2008-03-27 02:07:20 UTC (rev 991)
@@ -1015,7 +1015,7 @@
fm->message_id = owl_message_get_id(m);
/* for now we assume there's just the one view and use that style */
v=owl_global_get_current_view(&g);
- s=owl_view_get_style(v);
+ s=owl_global_get_current_style(&g);
owl_style_get_formattext(s, &(fm->fmtext), m);
}
Modified: branches/barnowl_sqlite/owl/owl.c
===================================================================
--- branches/barnowl_sqlite/owl/owl.c 2008-03-26 06:24:26 UTC (rev 990)
+++ branches/barnowl_sqlite/owl/owl.c 2008-03-27 02:07:20 UTC (rev 991)
@@ -330,7 +330,8 @@
/* set the current view */
owl_function_debugmsg("startup: setting the current view");
- owl_view_create(owl_global_get_current_view(&g), "main", f, owl_global_get_style_by_name(&g, "default"));
+ owl_view_create(owl_global_get_current_view(&g), "main", f);
+ owl_global_set_current_style(&g, owl_global_get_style_by_name(&g, "default"));
owl_function_firstmsg();
/* AIM init */
@@ -423,7 +424,7 @@
owl_function_debugmsg("startup: set style for the view: %s", owl_global_get_default_style(&g));
s = owl_global_get_style_by_name(&g, owl_global_get_default_style(&g));
if(s)
- owl_view_set_style(owl_global_get_current_view(&g), s);
+ owl_global_set_current_style(&g, s);
else
owl_function_error("No such style: %s", owl_global_get_default_style(&g));
Modified: branches/barnowl_sqlite/owl/owl.h
===================================================================
--- branches/barnowl_sqlite/owl/owl.h 2008-03-26 06:24:26 UTC (rev 990)
+++ branches/barnowl_sqlite/owl/owl.h 2008-03-27 02:07:20 UTC (rev 991)
@@ -422,7 +422,6 @@
char *name;
owl_filter *filter;
owl_list messages;
- owl_style *style;
} owl_view;
typedef struct _owl_view_iterator {
@@ -556,6 +555,7 @@
owl_view_iterator curmsg, topmsg;
int curmsg_vert_offset;
owl_view current_view;
+ owl_style * current_style;
owl_messagelist *msglist;
WINDOW *recwin, *sepwin, *msgwin, *typwin;
int needrefresh;
Modified: branches/barnowl_sqlite/owl/view.c
===================================================================
--- branches/barnowl_sqlite/owl/view.c 2008-03-26 06:24:26 UTC (rev 990)
+++ branches/barnowl_sqlite/owl/view.c 2008-03-27 02:07:20 UTC (rev 991)
@@ -3,11 +3,10 @@
static const char fileIdent[] = "$Id$";
-void owl_view_create(owl_view *v, char *name, owl_filter *f, owl_style *s)
+void owl_view_create(owl_view *v, char *name, owl_filter *f)
{
v->name=owl_strdup(name);
v->filter=f;
- v->style=s;
owl_list_create(&(v->messages));
owl_view_recalculate(v);
}
@@ -57,20 +56,6 @@
owl_view_recalculate(v);
}
-void owl_view_set_style(owl_view *v, owl_style *s)
-{
- v->style=s;
-}
-
-owl_style *owl_view_get_style(owl_view *v)
-{
- return(v->style);
-}
-
-char *owl_view_get_style_name(owl_view *v) {
- return(owl_style_get_name(v->style));
-}
-
owl_message *_owl_view_get_element(owl_view *v, int index)
{
if(index < 0 || index >= _owl_view_get_size(v))
@@ -138,9 +123,9 @@
owl_fmtext_append_normal(fm, owl_filter_get_name(v->filter));
owl_fmtext_append_normal(fm, "\n");
- owl_fmtext_append_normal(fm, "Style: ");
+ /* owl_fmtext_append_normal(fm, "Style: ");
owl_fmtext_append_normal(fm, owl_style_get_name(v->style));
- owl_fmtext_append_normal(fm, "\n");
+ owl_fmtext_append_normal(fm, "\n"); */
}
char *owl_view_get_filtname(owl_view *v)