summaryrefslogtreecommitdiff
path: root/libsylph/displayheader.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsylph/displayheader.c')
-rw-r--r--libsylph/displayheader.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/libsylph/displayheader.c b/libsylph/displayheader.c
new file mode 100644
index 0000000..edafc5a
--- /dev/null
+++ b/libsylph/displayheader.c
@@ -0,0 +1,59 @@
1/*
2 * LibSylph -- E-Mail client library
3 * Copyright (C) 1999-2005 Hiroyuki Yamamoto
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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
28gchar *display_header_prop_get_str(DisplayHeaderProp *dp)
29{
30 return g_strconcat(dp->hidden ? "-" : "", dp->name, NULL);
31}
32
33DisplayHeaderProp *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
53void display_header_prop_free(DisplayHeaderProp *dp)
54{
55 if (!dp) return;
56
57 g_free(dp->name);
58 g_free(dp);
59}