Statistics
| Revision:

root / src / displayheader.c @ 1

History | View | Annotate | Download (1.43 KB)

1
/*
2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2001 Hiroyuki Yamamoto
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
 */
19

    
20
#ifdef HAVE_CONFIG_H
21
#  include "config.h"
22
#endif
23

    
24
#include <glib.h>
25

    
26
#include "displayheader.h"
27

    
28
gchar *display_header_prop_get_str(DisplayHeaderProp *dp)
29
{
30
        return g_strconcat(dp->hidden ? "-" : "", dp->name, NULL);
31
}
32
 
33
DisplayHeaderProp *display_header_prop_read_str(gchar *buf)
34
{
35
        DisplayHeaderProp *dp;
36

    
37
        dp = g_new0(DisplayHeaderProp, 1);
38

    
39
        dp->hidden = FALSE;
40
        if (*buf == '-') {
41
                dp->hidden = TRUE;
42
                buf++;
43
        }
44
        if (*buf == '\0') {
45
                g_free(dp);
46
                return NULL;
47
        }
48
        dp->name = g_strdup(buf);
49

    
50
        return dp;
51
}
52
 
53
void display_header_prop_free(DisplayHeaderProp *dp)
54
{
55
        if (!dp) return;
56

    
57
        g_free(dp->name);
58
        g_free(dp);
59
}