* some cleanup in modest-ui-wizard and modest-ui
[modest] / src / modest-tny-store-actions.c
1 /* modest-tny-store-actions.c */
2
3 /* insert (c)/licensing information) */
4
5 #include <tny-msg.h>
6 #include <tny-msg-iface.h>                      
7 #include <tny-msg-header.h>
8 #include <tny-msg-header-iface.h>
9 #include <tny-account-iface.h>  
10 #include <tny-account-store-iface.h>
11 #include <tny-store-account-iface.h>    
12 #include <tny-store-account.h>
13 #include <tny-stream-camel.h>
14 #include <string.h>
15 #include <camel/camel-folder.h>
16 #include <camel/camel.h>
17 #include <camel/camel-folder-summary.h>
18
19
20 #include <glib.h>
21 #include "modest-tny-store-actions.h"
22
23
24 /* 'private'/'protected' functions */
25 static void    modest_tny_store_actions_class_init   (ModestTnyStoreActionsClass *klass);
26 static void    modest_tny_store_actions_init         (ModestTnyStoreActions *obj);
27 static void    modest_tny_store_actions_finalize     (GObject *obj);
28
29 /* list my signals */
30 enum {
31         /* MY_SIGNAL_1, */
32         /* MY_SIGNAL_2, */
33         LAST_SIGNAL
34 };
35
36 typedef struct _ModestTnyStoreActionsPrivate ModestTnyStoreActionsPrivate;
37
38 struct _ModestTnyStoreActionsPrivate {
39         gboolean active;
40 };
41
42 #define MODEST_TNY_STORE_ACTIONS_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
43                                                           MODEST_TYPE_TNY_STORE_ACTIONS, \
44                                                           ModestTnyStoreActionsPrivate))
45 /* globals */
46 static GObjectClass *parent_class = NULL;
47
48 /* uncomment the following if you have defined any signals */
49 /* static guint signals[LAST_SIGNAL] = {0}; */
50
51 void
52 modest_tny_store_actions_update_folders (ModestTnyStoreActions *self,
53                                            TnyStoreAccountIface *storage_account)
54 {
55         const TnyListIface* folders;
56         TnyIteratorIface* ifolders;
57         gpointer *cur_folder;
58 #if 0   
59         folders = tny_store_account_iface_get_folders (storage_account, 
60                                                                                                   TNY_STORE_ACCOUNT_FOLDER_TYPE_SUBSCRIBED);
61         
62         ifolders = tny_list_iface_create_iterator (folders);
63         
64         for (cur_folder = tny_iterator_iface_first (ifolders); 
65                               tny_iterator_iface_has_next (ifolders); 
66                           tny_iterator_iface_next (ifolders))
67         {
68                 cur_folder = tny_iterator_iface_current (ifolders);
69 //              tny_msg_folder_iface_refresh (cur_folder);
70         }
71 #endif
72 }
73
74
75 GType
76 modest_tny_store_actions_get_type (void)
77 {
78         static GType my_type = 0;
79         if (!my_type) {
80                 static const GTypeInfo my_info = {
81                         sizeof(ModestTnyStoreActionsClass),
82                         NULL,           /* base init */
83                         NULL,           /* base finalize */
84                         (GClassInitFunc) modest_tny_store_actions_class_init,
85                         NULL,           /* class finalize */
86                         NULL,           /* class data */
87                         sizeof(ModestTnyStoreActions),
88                         1,              /* n_preallocs */
89                         (GInstanceInitFunc) modest_tny_store_actions_init,
90                 };
91                 my_type = g_type_register_static (G_TYPE_OBJECT,
92                                                   "ModestTnyStoreActions",
93                                                   &my_info, 0);
94         }
95         return my_type;
96 }
97
98 static void
99 modest_tny_store_actions_class_init (ModestTnyStoreActionsClass *klass)
100 {
101         GObjectClass *gobject_class;
102         gobject_class = (GObjectClass*) klass;
103
104         parent_class            = g_type_class_peek_parent (klass);
105         gobject_class->finalize = modest_tny_store_actions_finalize;
106
107         g_type_class_add_private (gobject_class, sizeof(ModestTnyStoreActionsPrivate));
108         
109         klass->update_folders = modest_tny_store_actions_update_folders;
110         /* signal definitions go here, e.g.: */
111 /*      signals[MY_SIGNAL_1] = */
112 /*              g_signal_new ("my_signal_1",....); */
113 /*      signals[MY_SIGNAL_2] = */
114 /*              g_signal_new ("my_signal_2",....); */
115 /*      etc. */
116 }
117
118 static void
119 modest_tny_store_actions_init (ModestTnyStoreActions *obj)
120 {
121 /* uncomment the following if you init any of the private data */
122 /*      ModestTnyStoreActionsPrivate *priv = MODEST_TNY_STORE_ACTIONS_GET_PRIVATE(obj); */
123
124 /*      initialize this object, eg.: */
125 /*      priv->frobnicate_mode = FALSE; */
126 }
127
128 static void
129 modest_tny_store_actions_finalize (GObject *obj)
130 {
131 /*      free/unref instance resources here */
132 }
133
134 GObject*
135 modest_tny_store_actions_new (void)
136 {
137         return G_OBJECT(g_object_new(MODEST_TYPE_TNY_STORE_ACTIONS, NULL));
138 }
139