Add account preset object draft.
[modest] / experimental / accountpresets / modest-account-presets.c
1 /* modest-account-presets.c */
2
3 /* insert (c)/licensing information) */
4
5 #include "modest-account-presets.h"
6 /* include other impl specific header files */
7
8 /* 'private'/'protected' functions */
9 static void                        modest_account_presets_class_init    (ModestAccountPresetsClass *klass);
10 static void                        modest_account_presets_init          (ModestAccountPresets *obj);
11 static void                        modest_account_presets_finalize      (GObject *obj);
12
13 /* list my signals */
14 enum {
15         /* MY_SIGNAL_1, */
16         /* MY_SIGNAL_2, */
17         LAST_SIGNAL
18 };
19
20 typedef struct _ModestAccountPresetsPrivate ModestAccountPresetsPrivate;
21 struct _ModestAccountPresetsPrivate {
22         /* my private members go here, eg. */
23         GKeyFile *preset_file;
24         GList *preset_list;
25 };
26 #define MODEST_ACCOUNT_PRESETS_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
27                                                     MODEST_TYPE_ACCOUNT_PRESETS, \
28                                                     ModestAccountPresetsPrivate))
29 /* globals */
30 static GObjectClass *parent_class = NULL;
31
32 /* uncomment the following if you have defined any signals */
33 /* static guint signals[LAST_SIGNAL] = {0}; */
34
35 GType
36 modest_account_presets_get_type (void)
37 {
38         static GType my_type = 0;
39         if (!my_type) {
40                 static const GTypeInfo my_info = {
41                         sizeof(ModestAccountPresetsClass),
42                         NULL,           /* base init */
43                         NULL,           /* base finalize */
44                         (GClassInitFunc) modest_account_presets_class_init,
45                         NULL,           /* class finalize */
46                         NULL,           /* class data */
47                         sizeof(ModestAccountPresets),
48                         1,              /* n_preallocs */
49                         (GInstanceInitFunc) modest_account_presets_init,
50                 };
51                 my_type = g_type_register_static (G_TYPE_OBJECT,
52                                                   "ModestAccountPresets",
53                                                   &my_info, 0);
54         }
55         return my_type;
56 }
57
58 static void
59 modest_account_presets_class_init (ModestAccountPresetsClass *klass)
60 {
61         GObjectClass *gobject_class;
62         gobject_class = (GObjectClass*) klass;
63
64         parent_class            = g_type_class_peek_parent (klass);
65         gobject_class->finalize = modest_account_presets_finalize;
66
67         g_type_class_add_private (gobject_class, sizeof(ModestAccountPresetsPrivate));
68
69         klass->get_list = modest_account_presets_get_list;
70         klass->get_names = modest_account_presets_get_names;
71         klass->get_by_name = modest_account_presets_get_by_name;
72         klass->load_file = modest_account_presets_load_file;
73         /* signal definitions go here, e.g.: */
74 /*      signals[MY_SIGNAL_1] = */
75 /*              g_signal_new ("my_signal_1",....); */
76 /*      signals[MY_SIGNAL_2] = */
77 /*              g_signal_new ("my_signal_2",....); */
78 /*      etc. */
79 }
80
81 static void
82 modest_account_presets_init (ModestAccountPresets *obj)
83 {
84         ModestAccountPresetsPrivate *priv = MODEST_ACCOUNT_PRESETS_GET_PRIVATE(obj);
85
86         priv->preset_file = g_key_file_new ();
87         priv->preset_list = NULL;
88         obj->count = 0; 
89 }
90
91 static void
92 modest_account_presets_finalize (GObject *obj)
93 {
94         ModestAccountPresetsPrivate *priv = MODEST_ACCOUNT_PRESETS_GET_PRIVATE(obj);
95
96         g_object_unref (priv->preset_file);
97 }
98
99 GObject*
100 modest_account_presets_new (void)
101 {
102         return G_OBJECT(g_object_new(MODEST_TYPE_ACCOUNT_PRESETS, NULL));
103 }
104
105 /* method implementations */
106
107 GList *
108 modest_account_presets_get_list (ModestAccountPresets *self)
109 {
110         
111 }
112
113 GList *
114 modest_account_presets_get_names (ModestAccountPresets *self)
115 {
116 }
117
118 ModestPreset *
119 modest_account_presets_get_by_name (ModestAccountPresets *self, const gchar *name)
120 {
121         
122 }
123
124 gboolean 
125 modest_account_presets_load_file (ModestAccountPresets *self, const gchar *filename)
126 {
127         
128         return TRUE;
129 }