diff options
| author | Simeon Simeonov | 2018-02-26 11:23:00 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2018-02-26 11:23:00 +0100 |
| commit | 0b3cbf57875fd692e4ba0b336fefa4bee1ed00dc (patch) | |
| tree | af916a30553c78ce9d4f2d8658656a175c5b6921 /libsylph/displayheader.c | |
Initial commit for sylpheed 3.7.0
Diffstat (limited to 'libsylph/displayheader.c')
| -rw-r--r-- | libsylph/displayheader.c | 59 |
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 | |||
| 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 | } | ||
