1 /* modest-tny-store-actions.c */
3 /* insert (c)/licensing information) */
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>
15 #include <camel/camel-folder.h>
16 #include <camel/camel.h>
17 #include <camel/camel-folder-summary.h>
21 #include "modest-tny-store-actions.h"
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);
36 typedef struct _ModestTnyStoreActionsPrivate ModestTnyStoreActionsPrivate;
38 struct _ModestTnyStoreActionsPrivate {
42 #define MODEST_TNY_STORE_ACTIONS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
43 MODEST_TYPE_TNY_STORE_ACTIONS, \
44 ModestTnyStoreActionsPrivate))
46 static GObjectClass *parent_class = NULL;
48 /* uncomment the following if you have defined any signals */
49 /* static guint signals[LAST_SIGNAL] = {0}; */
52 modest_tny_store_actions_update_folders (ModestTnyStoreActions *self,
53 TnyStoreAccountIface *storage_account)
56 const TnyListIface* folders;
57 TnyIteratorIface* ifolders;
60 folders = tny_store_account_iface_get_folders (storage_account,
61 TNY_STORE_ACCOUNT_FOLDER_TYPE_SUBSCRIBED);
63 ifolders = tny_list_iface_create_iterator (folders);
65 for (cur_folder = tny_iterator_iface_first (ifolders);
66 tny_iterator_iface_has_next (ifolders);
67 tny_iterator_iface_next (ifolders))
69 cur_folder = tny_iterator_iface_current (ifolders);
70 tny_msg_folder_iface_refresh (cur_folder);
72 g_object_unref (ifolders);
77 modest_tny_store_actions_get_type (void)
79 static GType my_type = 0;
81 static const GTypeInfo my_info = {
82 sizeof(ModestTnyStoreActionsClass),
84 NULL, /* base finalize */
85 (GClassInitFunc) modest_tny_store_actions_class_init,
86 NULL, /* class finalize */
87 NULL, /* class data */
88 sizeof(ModestTnyStoreActions),
90 (GInstanceInitFunc) modest_tny_store_actions_init,
92 my_type = g_type_register_static (G_TYPE_OBJECT,
93 "ModestTnyStoreActions",
100 modest_tny_store_actions_class_init (ModestTnyStoreActionsClass *klass)
102 GObjectClass *gobject_class;
103 gobject_class = (GObjectClass*) klass;
105 parent_class = g_type_class_peek_parent (klass);
106 gobject_class->finalize = modest_tny_store_actions_finalize;
108 g_type_class_add_private (gobject_class, sizeof(ModestTnyStoreActionsPrivate));
110 klass->update_folders = modest_tny_store_actions_update_folders;
111 /* signal definitions go here, e.g.: */
112 /* signals[MY_SIGNAL_1] = */
113 /* g_signal_new ("my_signal_1",....); */
114 /* signals[MY_SIGNAL_2] = */
115 /* g_signal_new ("my_signal_2",....); */
120 modest_tny_store_actions_init (ModestTnyStoreActions *obj)
122 /* uncomment the following if you init any of the private data */
123 /* ModestTnyStoreActionsPrivate *priv = MODEST_TNY_STORE_ACTIONS_GET_PRIVATE(obj); */
125 /* initialize this object, eg.: */
126 /* priv->frobnicate_mode = FALSE; */
130 modest_tny_store_actions_finalize (GObject *obj)
132 /* free/unref instance resources here */
136 modest_tny_store_actions_new (void)
138 return G_OBJECT(g_object_new(MODEST_TYPE_TNY_STORE_ACTIONS, NULL));