diff options
Diffstat (limited to 'libsylph/prefs.h')
| -rw-r--r-- | libsylph/prefs.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/libsylph/prefs.h b/libsylph/prefs.h new file mode 100644 index 0000000..48b1df2 --- /dev/null +++ b/libsylph/prefs.h | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | /* | ||
| 2 | * LibSylph -- E-Mail client library | ||
| 3 | * Copyright (C) 1999-2008 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 | #ifndef __PREFS_H__ | ||
| 21 | #define __PREFS_H__ | ||
| 22 | |||
| 23 | #include <glib.h> | ||
| 24 | #include <stdio.h> | ||
| 25 | |||
| 26 | typedef struct _PrefParam PrefParam; | ||
| 27 | typedef struct _PrefFile PrefFile; | ||
| 28 | |||
| 29 | #define PREFSBUFSIZE 8192 | ||
| 30 | |||
| 31 | typedef enum | ||
| 32 | { | ||
| 33 | P_STRING, | ||
| 34 | P_INT, | ||
| 35 | P_BOOL, | ||
| 36 | P_ENUM, | ||
| 37 | P_USHORT, | ||
| 38 | P_OTHER | ||
| 39 | } PrefType; | ||
| 40 | |||
| 41 | typedef void (*DataSetFunc) (PrefParam *pparam); | ||
| 42 | typedef void (*WidgetSetFunc) (PrefParam *pparam); | ||
| 43 | |||
| 44 | struct _PrefParam { | ||
| 45 | gchar *name; | ||
| 46 | gchar *defval; | ||
| 47 | gpointer data; | ||
| 48 | PrefType type; | ||
| 49 | gpointer ui_data; | ||
| 50 | }; | ||
| 51 | |||
| 52 | struct _PrefFile { | ||
| 53 | FILE *fp; | ||
| 54 | gchar *path; | ||
| 55 | }; | ||
| 56 | |||
| 57 | GHashTable *prefs_param_table_get (PrefParam *param); | ||
| 58 | void prefs_param_table_destroy (GHashTable *param_table); | ||
| 59 | |||
| 60 | void prefs_read_config (PrefParam *param, | ||
| 61 | const gchar *label, | ||
| 62 | const gchar *rcfile, | ||
| 63 | const gchar *encoding); | ||
| 64 | void prefs_write_config (PrefParam *param, | ||
| 65 | const gchar *label, | ||
| 66 | const gchar *rcfile); | ||
| 67 | |||
| 68 | PrefFile *prefs_file_open (const gchar *path); | ||
| 69 | gint prefs_file_write_param (PrefFile *pfile, | ||
| 70 | PrefParam *param); | ||
| 71 | void prefs_file_set_backup_generation (PrefFile *pfile, | ||
| 72 | gint generation); | ||
| 73 | gint prefs_file_get_backup_generation (PrefFile *pfile); | ||
| 74 | gint prefs_file_close (PrefFile *pfile); | ||
| 75 | gint prefs_file_close_revert (PrefFile *pfile); | ||
| 76 | |||
| 77 | void prefs_set_default (PrefParam *param); | ||
| 78 | void prefs_free (PrefParam *param); | ||
| 79 | |||
| 80 | #endif /* __PREFS_H__ */ | ||
