00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00030 #include "config.h"
00031
00032 #include <string.h>
00033
00034 #include <glib.h>
00035
00036 #include "duifield.h"
00037 #include "perr.h"
00038 #include "duiresolver.h"
00039
00040
00041
00042 void
00043 dui_field_clear (DuiField *f)
00044 {
00045 if (DUI_FIELD_IS_TYPE(f,DUI_FIELD_NONE)) return;
00046 if (f->clear_field) { f->clear_field (f); }
00047 f->clear_field = NULL;
00048 f->type = DUI_FIELD_NONE;
00049 }
00050
00051 const char *
00052 dui_field_get_fieldname (DuiField *f)
00053 {
00054 if (!f) return NULL;
00055 return f->fieldname;
00056 }
00057
00058
00059
00060 static void
00061 val_clear (DuiField *f)
00062 {
00063 g_free (f->u.value);
00064 }
00065
00066 static const char *
00067 get_const_value (DuiField *fs)
00068 {
00069 return fs->u.value;
00070 }
00071
00072 void
00073 dui_field_set_const (DuiField *fs, const gchar *value)
00074 {
00075 if (!fs) return;
00076 if (!value) value = "";
00077 fs->type = DUI_FIELD_CONST;
00078 fs->fieldname = "const";
00079 fs->u.value = g_strdup (value);
00080 fs->get_field_value = get_const_value;
00081 fs->set_field_value = NULL;
00082 fs->clear_field = val_clear;
00083 }
00084
00085
00086
00087 void
00088 dui_field_iter_pre (DuiField *matcher, gboolean do_clear)
00089 {
00090 if (NULL == matcher) return;
00091 if (NULL == matcher->iter_pre) return;
00092 (matcher->iter_pre) (matcher, do_clear);
00093 }
00094
00095 gboolean
00096 dui_field_iter_next (DuiField *matcher)
00097 {
00098 if (NULL == matcher) return TRUE;
00099 if (NULL == matcher->iter_next) return TRUE;
00100 return (matcher->iter_next) (matcher);
00101 }
00102
00103 void
00104 dui_field_iter_column (DuiField *target, DuiField *matcher)
00105 {
00106 if (NULL == target) return;
00107 if (NULL == target->iter_column) return;
00108 (target->iter_column) (target, matcher);
00109 }
00110
00111 void
00112 dui_field_iter_post (DuiField *matcher)
00113 {
00114 if (NULL == matcher) return;
00115 if (NULL == matcher->iter_post) return;
00116 (matcher->iter_post) (matcher);
00117 }
00118
00119 gpointer get_gobj_field (DuiField *f)
00120 {
00121 return f->u.priv;
00122 }
00123
00124