X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=list.c;h=b3e12de92a914460b3a391913e0909cf07737b75;hb=e2826ae894d12e69674d1b624e87c05e6bbb2afd;hp=ce0f9efa6eb3f8304ff8897ae4b65b8ffe19dcb4;hpb=0d3c17d9ab127e5596c8fb97d65122b3b90f6b11;p=pkg%2Fabook.git diff --git a/list.c b/list.c index ce0f9ef..b3e12de 100644 --- a/list.c +++ b/list.c @@ -1,15 +1,16 @@ /* - * list.c - * by JH + * $Id$ + * + * by JH * * Copyright (C) Jaakko Heinonen */ #include #include -#include "abook_curses.h" #include "abook.h" +#include "ui.h" #include "database.h" #include "edit.h" #include "list.h" @@ -47,7 +48,7 @@ refresh_list() werase(list); - print_number_of_items(); + ui_print_number_of_items(); if( items < 1 ) { refresh(); @@ -86,7 +87,7 @@ print_list_line(int i, int line) char tmp[MAX_EMAILSTR_LEN]; int extra_column = options_get_int("extra_column"); int real_emaillen = (extra_column > 2 && extra_column < ITEM_FIELDS) ? - EMAILLEN : EMAILPOS - COLS; + EMAILLEN : COLS - EMAILPOS; scrollok(list, FALSE); @@ -269,13 +270,13 @@ highlight_line(WINDOW *win, int line) int selected_items() { - int i, a=0; + int i, n = 0; for(i = 0; i < items; i++) if(selected[i]) - a++; + n++; - return a; + return n; } void @@ -290,3 +291,16 @@ invert_selection() selected[i] = !selected[i]; } +int +list_current_item() +{ + return curitem; +} + +int +list_is_empty() +{ + return items < 1; +} + +