~ubuntu-branches/ubuntu/maverick/cairo-dock-plug-ins/maverick

« back to all changes in this revision

Viewing changes to mail/src/cd-mail-applet-accounts.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-10 00:05:57 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810000557-pfxoz5w7hbyclcqh
Tags: 2.2.0~0beta4-0ubuntu1
* New Upstream Version (LP: #614625)
* Fixed a few bugs on LP:
 - LP: #483963: Dustbin applet does not display trashes on all volumes
 - LP: #485159: Some apps have problem with Systray
 - LP: #500677: ~/.xsession-errors is too much used by CD
 - LP: #500979: Shortcuts: the order gets messed up
 - LP: #521531: Mail: crashes on Maildir
 - LP: #519915: GTG: create a new applet to control GTG
 - LP: #526138: GMenu doesn't handle desktop file exec strings properly
 - LP: #531317: CMake: Added an error if the prefix of 'cairo-dock-plugins'
                 is not the same 'cairo-dock-core'
 - LP: #531319: CMake: check the version of 'cairo-dock' when building
                 'cairo-dock-plugins'
 - LP: #537115: Click at the position where icon lavel was, the icon
                 and dock still receive the event
 - LP: #537943: Terminal applet shortkey behaviour
 - LP: #538637: Trash applet doesn't create .trashinfo files on XFCE
 - More details on the 'ChangeLog' file
* debian/rules:
 - Autotools has been replaced by CMake
 - cdbs is now used.
* debian/copyright:
 - Updated with the new applets
* debian/control:
 - Autotools has been replaced by CMake
 - Added libcurl4-gnutls-dev, libindicator-dev, libdbusmenu-glib-dev
   libido-0.1-dev, libical-dev, libdbusmenu-gtk-dev as Build-deps
 - Bump Standard-Version to 3.9.1
 - Wget is required for dnd2share applet
 - Added the exact realease for 'cairo-dock-dev' in order to prevent any
    build error if this package is not already available (thx to didrocks)
* debian/cairo-dock-plug-ins*.install:
 - All sonames are now installed into lib32 or lib64 (lib*)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "cd-mail-applet-accounts.h"
27
27
 
28
28
#define _add_icon(pMailAccount)\
29
 
                pIcon = g_new0 (Icon, 1);\
30
 
                pIcon->cName = g_strdup (pMailAccount->name);\
31
 
                pIcon->cFileName = g_strdup (myConfig.cNoMailUserImage);\
32
 
                pIcon->cQuickInfo = g_strdup ("...");\
33
 
                pIcon->fOrder = i;\
34
 
                pIcon->fScale = 1.;\
35
 
                pIcon->fAlpha = 1.;\
36
 
                pIcon->fWidthFactor = 1.;\
37
 
                pIcon->fHeightFactor = 1.;\
38
 
                pIcon->cCommand = g_strdup (pMailAccount->cMailApp);\
39
 
                pIcon->cParentDockName = g_strdup (myIcon->cName);\
40
 
                cd_debug (" + %s (%s)\n", pIcon->cName, pIcon->cFileName);\
41
 
                pIconList = g_list_append (pIconList, pIcon);\
42
 
                pMailAccount->icon = pIcon;
43
 
 
44
 
void cd_mail_create_pop3_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
 
29
        pIcon = cairo_dock_create_dummy_launcher (g_strdup (pMailAccount->name),\
 
30
                g_strdup (myConfig.cNoMailUserImage),\
 
31
                g_strdup (pMailAccount->cMailApp),\
 
32
                g_strdup ("..."),\
 
33
                i);\
 
34
        pIcon->cParentDockName = g_strdup (myIcon->cName);\
 
35
        pIconList = g_list_append (pIconList, pIcon);\
 
36
        pMailAccount->icon = pIcon;
 
37
 
 
38
// Translation Hack:
 
39
const char *strings_to_translate[16] = {N_("Server address:"), N_("myHost"), N_("Username:"), N_("Password:"), N_("The password will be crypted."), N_("Port:"), N_("Enter 0 to use the default port. Default ports are 110 for POP3 or APOP and 995 for POP3S."), N_("Use a secure connection (SSL)"), N_("Timeout"), N_("In minutes."), N_("Specific mail application"), N_("Leave empty to use the default mail application."), N_("Directory on server:"), N_("Path of mbox file:"), N_("Path to Mail directory:"), N_("Address of feed:")};
 
40
 
 
41
void cd_mail_create_pop3_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
45
42
{
46
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "type", "pop3");
47
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);  // on lui met un widget pour ne pas que la cle se fasse bazarder lors d'une mise a jour du fichier de conf.
48
 
        
49
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "host", "pop3.myhost.org");
50
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "host", "s0 server address:", NULL);
51
 
 
52
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "username", "myLogin");
53
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 username:", NULL);
54
 
 
55
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
56
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 password:\n{The password will be crypted.}", NULL);
57
 
 
58
 
        g_key_file_set_integer (pKeyFile, pMailAccountName, "port", 0);
59
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "port", "i0 port:\n{Enter 0 to use the default port. Default ports are 110 for POP3 or APOP and 995 for POP3S.}", NULL);
60
 
 
61
 
        g_key_file_set_boolean (pKeyFile, pMailAccountName, "use secure connection", FALSE);
62
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "use secure connection", "b0 use secure connection (SSL)", NULL);
63
 
 
64
 
        g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
65
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
66
 
 
67
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
68
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
 
43
  g_key_file_set_string (pKeyFile, pMailAccountName, "type", "pop3");
 
44
  g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);  // on lui met un widget pour ne pas que la cle se fasse bazarder lors d'une mise a jour du fichier de conf.
 
45
  
 
46
  g_key_file_set_string (pKeyFile, pMailAccountName, "host", "pop3.myHost.org");
 
47
  g_key_file_set_comment (pKeyFile, pMailAccountName, "host", "s0 Server address:", NULL);
 
48
 
 
49
  g_key_file_set_string (pKeyFile, pMailAccountName, "username", N_("myLogin"));
 
50
  g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 Username:", NULL);
 
51
 
 
52
  g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
 
53
  g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 Password:\n{The password will be crypted.}", NULL);
 
54
 
 
55
  g_key_file_set_integer (pKeyFile, pMailAccountName, "port", 0);
 
56
  g_key_file_set_comment (pKeyFile, pMailAccountName, "port", "i0 Port:\n{Enter 0 to use the default port. Default ports are 110 for POP3 or APOP and 995 for POP3S.}", NULL);
 
57
 
 
58
  g_key_file_set_boolean (pKeyFile, pMailAccountName, "use secure connection", FALSE);
 
59
  g_key_file_set_comment (pKeyFile, pMailAccountName, "use secure connection", "b0 Use a secure connection (SSL)", NULL);
 
60
 
 
61
  g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
 
62
  g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
 
63
 
 
64
  g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
 
65
  g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
69
66
}
70
67
 
71
 
void cd_mail_retrieve_pop3_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
 
68
void cd_mail_retrieve_pop3_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
72
69
{
73
70
  if( !mailaccount || !pKeyFile || !mailbox_name ) return;
74
71
 
84
81
  mailaccount->password = NULL;
85
82
  mailaccount->auth_type = POP3_AUTH_TYPE_TRY_APOP;
86
83
  mailaccount->path = NULL;
87
 
  mailaccount->timeout = 0;
88
84
  
89
85
  if (g_key_file_has_key (pKeyFile, mailbox_name, "host", NULL))
90
86
  {
103
99
  }
104
100
  mailaccount->connection_type = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT (mailbox_name, "use secure connection", FALSE)?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN;
105
101
  mailaccount->port = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "port", 0);
106
 
 
107
 
  mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
108
102
}
109
103
 
110
 
void cd_mail_create_imap_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
 
104
void cd_mail_create_imap_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
111
105
{
112
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "type", "imap");
113
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
114
 
 
115
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "host", "imap.myhost.org");
116
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "host", "s0 server address:", NULL);
117
 
 
118
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "username", "myLogin");
119
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 username:", NULL);
120
 
 
121
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
122
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 password:", NULL);
123
 
 
124
 
        g_key_file_set_integer (pKeyFile, pMailAccountName, "port", 0);
125
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "port", "i0 port:\n{Enter 0 to use the default port. Default ports are 143 for IMAP4 and 993 for IMAP4 over SSL.}", NULL);
126
 
 
127
 
        g_key_file_set_boolean (pKeyFile, pMailAccountName, "use secure connection", FALSE);
128
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "use secure connection", "b0 use secure connection (SSL)", NULL);
129
 
 
130
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "server_directory", "Inbox");
131
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "server_directory", "s0 directory on server:", NULL);
132
 
 
133
 
        g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
134
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
135
 
 
136
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
137
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
 
106
  g_key_file_set_string (pKeyFile, pMailAccountName, "type", "imap");
 
107
  g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
 
108
 
 
109
  g_key_file_set_string (pKeyFile, pMailAccountName, "host", "imap.myHost.org");
 
110
  g_key_file_set_comment (pKeyFile, pMailAccountName, "host", "s0 Server address:", NULL);
 
111
 
 
112
  g_key_file_set_string (pKeyFile, pMailAccountName, "username", N_("myLogin"));
 
113
  g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 Username:", NULL);
 
114
 
 
115
  g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
 
116
  g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 Password:", NULL);
 
117
 
 
118
  g_key_file_set_integer (pKeyFile, pMailAccountName, "port", 0);
 
119
  g_key_file_set_comment (pKeyFile, pMailAccountName, "port", "i0 port:\n{Enter 0 to use the default port. Default ports are 143 for IMAP4 and 993 for IMAP4 over SSL.}", NULL);
 
120
 
 
121
  g_key_file_set_boolean (pKeyFile, pMailAccountName, "use secure connection", FALSE);
 
122
  g_key_file_set_comment (pKeyFile, pMailAccountName, "use secure connection", "b0 use secure connection (SSL)", NULL);
 
123
 
 
124
  g_key_file_set_string (pKeyFile, pMailAccountName, "server_directory", "Inbox");
 
125
  g_key_file_set_comment (pKeyFile, pMailAccountName, "server_directory", "s0 Directory on server:", NULL);
 
126
 
 
127
  g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
 
128
  g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
 
129
 
 
130
  g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
 
131
  g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
138
132
}
139
133
 
140
 
void cd_mail_retrieve_imap_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
 
134
void cd_mail_retrieve_imap_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
141
135
{
142
136
  if( !mailaccount || !pKeyFile || !mailbox_name ) return;
143
137
 
153
147
  mailaccount->password = NULL;
154
148
  mailaccount->auth_type = IMAP_AUTH_TYPE_PLAIN;
155
149
  mailaccount->path = g_strdup("/");
156
 
  mailaccount->timeout = 0;
157
150
  
158
151
  if (g_key_file_has_key (pKeyFile, mailbox_name, "host", NULL))
159
152
  {
170
163
 
171
164
    if( encryptedPassword ) g_free(encryptedPassword);
172
165
  }
173
 
  mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
174
166
  mailaccount->port = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "port", 0);
175
167
 
176
168
  mailaccount->connection_type = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT (mailbox_name, "use secure connection", FALSE)?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN;
183
175
  }
184
176
}
185
177
 
186
 
void cd_mail_create_mbox_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
187
 
{
188
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "type", "mbox");
189
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
190
 
 
191
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "filename", "");
192
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "filename", "s0 path of mbox file:", NULL);
193
 
 
194
 
        g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
195
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
196
 
 
197
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
198
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
199
 
}
200
 
 
201
 
void cd_mail_retrieve_mbox_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
202
 
{
203
 
        if( !mailaccount || !pKeyFile || !mailbox_name ) return;
204
 
 
205
 
        gboolean bFlushConfFileNeeded = FALSE;
206
 
 
207
 
        mailaccount->driver = MBOX_STORAGE;
208
 
        mailaccount->storage = mailstorage_new(NULL);
209
 
        mailaccount->folder = NULL;
210
 
        mailaccount->server = NULL;
211
 
        mailaccount->port = 0;
212
 
        mailaccount->connection_type = CONNECTION_TYPE_PLAIN;
213
 
        mailaccount->user = NULL;
214
 
        mailaccount->password = NULL;
215
 
        mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN;
216
 
        mailaccount->timeout = 0;
217
 
        if (g_key_file_has_key (pKeyFile, mailbox_name, "filename", NULL))
218
 
                mailaccount->path = CD_CONFIG_GET_STRING_WITH_DEFAULT (mailbox_name, "filename", "/");
219
 
        if (mailaccount->path == NULL)
220
 
                mailaccount->path = g_strdup("/");
221
 
        mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
222
 
 
223
 
        //{"filename", "ctime", "size", "interval", NULL, NULL}
224
 
}
225
 
 
226
 
void cd_mail_create_mh_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
227
 
{
228
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "type", "mh");
229
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
230
 
 
231
 
        g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
232
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
233
 
 
234
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
235
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
236
 
}
237
 
 
238
 
void cd_mail_retrieve_mh_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
 
178
void cd_mail_create_mbox_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
 
179
{
 
180
  g_key_file_set_string (pKeyFile, pMailAccountName, "type", "mbox");
 
181
  g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
 
182
 
 
183
  g_key_file_set_string (pKeyFile, pMailAccountName, "filename", "");
 
184
  g_key_file_set_comment (pKeyFile, pMailAccountName, "filename", "s0 Path of mbox file:", NULL);
 
185
 
 
186
  g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
 
187
  g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
 
188
 
 
189
  g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
 
190
  g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
 
191
}
 
192
 
 
193
void cd_mail_retrieve_mbox_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
239
194
{
240
195
  if( !mailaccount || !pKeyFile || !mailbox_name ) return;
241
196
 
242
197
  gboolean bFlushConfFileNeeded = FALSE;
243
198
 
 
199
  mailaccount->driver = MBOX_STORAGE;
 
200
  mailaccount->storage = mailstorage_new(NULL);
 
201
  mailaccount->folder = NULL;
 
202
  mailaccount->server = NULL;
 
203
  mailaccount->port = 0;
 
204
  mailaccount->connection_type = CONNECTION_TYPE_PLAIN;
 
205
  mailaccount->user = NULL;
 
206
  mailaccount->password = NULL;
 
207
  mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN;
 
208
 
 
209
  if (g_key_file_has_key (pKeyFile, mailbox_name, "filename", NULL))
 
210
          mailaccount->path = CD_CONFIG_GET_STRING_WITH_DEFAULT (mailbox_name, "filename", "/");
 
211
  if (mailaccount->path == NULL)
 
212
          mailaccount->path = g_strdup("/");
 
213
 
 
214
  //{"filename", "ctime", "size", "interval", NULL, NULL}
 
215
}
 
216
 
 
217
void cd_mail_create_mh_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
 
218
{
 
219
  g_key_file_set_string (pKeyFile, pMailAccountName, "type", "mh");
 
220
  g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
 
221
 
 
222
  g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
 
223
  g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
 
224
 
 
225
  g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
 
226
  g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
 
227
}
 
228
 
 
229
void cd_mail_retrieve_mh_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
 
230
{
 
231
  if( !mailaccount || !pKeyFile || !mailbox_name ) return;
 
232
 
244
233
  mailaccount->driver = MH_STORAGE;
245
234
  mailaccount->storage = mailstorage_new(NULL);
246
235
  mailaccount->folder = NULL;
251
240
  mailaccount->password = NULL;
252
241
  mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN;
253
242
  mailaccount->path = g_strdup("/");
254
 
  mailaccount->timeout = 0;
255
 
 
256
 
  mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
257
243
}
258
244
 
259
 
void cd_mail_create_maildir_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
 
245
void cd_mail_create_maildir_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
260
246
{
261
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "type", "maildir");
262
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
263
 
 
264
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "path", "");
265
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "path", "s0 path to mail directory:", NULL);
266
 
 
267
 
        g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
268
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
269
 
 
270
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
271
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
 
247
  g_key_file_set_string (pKeyFile, pMailAccountName, "type", "maildir");
 
248
  g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
 
249
 
 
250
  g_key_file_set_string (pKeyFile, pMailAccountName, "path", "");
 
251
  g_key_file_set_comment (pKeyFile, pMailAccountName, "path", "s0 Path to Mail directory:", NULL);
 
252
 
 
253
  g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
 
254
  g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
 
255
 
 
256
  g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
 
257
  g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
272
258
}
273
259
 
274
 
void cd_mail_retrieve_maildir_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
 
260
void cd_mail_retrieve_maildir_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
275
261
{
276
262
  if( !mailaccount || !pKeyFile || !mailbox_name ) return;
277
263
 
287
273
  mailaccount->password = NULL;
288
274
  mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN;
289
275
  mailaccount->path = g_strdup("/");
290
 
  mailaccount->timeout = 0;
291
276
 
292
277
  if (g_key_file_has_key (pKeyFile, mailbox_name, "path", NULL))
293
278
  {
294
 
    mailaccount->path = CD_CONFIG_GET_STRING (mailbox_name, "path");
 
279
  mailaccount->path = CD_CONFIG_GET_STRING (mailbox_name, "path");
295
280
  }
296
 
  mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
297
 
 
298
281
  //{"path", "mtime", "interval", NULL, NULL, NULL, NULL}
299
282
}
300
283
 
301
 
void cd_mail_create_gmail_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
 
284
void cd_mail_create_gmail_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
302
285
{
303
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "type", "gmail");
304
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
305
 
 
306
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "username", "myLogin");
307
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 username:", NULL);
308
 
 
309
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
310
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 password:", NULL);
311
 
 
312
 
        g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
313
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
314
 
 
315
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
316
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
 
286
  g_key_file_set_string (pKeyFile, pMailAccountName, "type", "gmail");
 
287
  g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
 
288
 
 
289
  g_key_file_set_string (pKeyFile, pMailAccountName, "username", N_("myLogin"));
 
290
  g_key_file_set_comment (pKeyFile, pMailAccountName, "username", "s0 Username:", NULL);
 
291
 
 
292
  g_key_file_set_string (pKeyFile, pMailAccountName, "password", "");
 
293
  g_key_file_set_comment (pKeyFile, pMailAccountName, "password", "p0 Password:", NULL);
 
294
 
 
295
  g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
 
296
  g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
 
297
 
 
298
  g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
 
299
  g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
317
300
}
318
301
 
319
 
void cd_mail_retrieve_gmail_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
 
302
void cd_mail_retrieve_gmail_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
320
303
{
321
304
  if( !mailaccount || !pKeyFile || !mailbox_name ) return;
322
305
 
335
318
  mailaccount->password = NULL;
336
319
  mailaccount->auth_type = IMAP_AUTH_TYPE_PLAIN;
337
320
  mailaccount->path = g_strdup("Inbox");
338
 
  mailaccount->timeout = 0;
339
321
  
340
322
  if (g_key_file_has_key (pKeyFile, mailbox_name, "username", NULL))
341
323
  {
348
330
 
349
331
    if( encryptedPassword ) g_free(encryptedPassword);
350
332
  }
351
 
  mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
352
333
#else
353
334
  mailaccount->driver = FEED_STORAGE;
354
335
  mailaccount->storage = mailstorage_new(NULL);
360
341
  mailaccount->password = NULL;
361
342
  mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN;
362
343
  mailaccount->path = NULL;
363
 
  mailaccount->timeout = 0;
364
344
  
365
345
  if (g_key_file_has_key (pKeyFile, mailbox_name, "username", NULL))
366
346
  {
398
378
  {
399
379
    mailaccount->path = g_strdup( "https://mail.google.com/mail/feed/atom" );
400
380
  }
401
 
  mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
402
381
 
403
382
  g_free( user_without_column );
404
383
  g_free( password_without_column );
405
384
#endif
406
385
}
407
386
 
408
 
void cd_mail_create_feed_params( GKeyFile *pKeyFile, gchar *pMailAccountName )
 
387
void cd_mail_create_feed_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
409
388
{
410
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "type", "feed");
411
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
412
 
 
413
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "path", "http://www.glx-dock.org/rss/cd_svn.xml");
414
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "path", "s0 address of feed:", NULL);
415
 
 
416
 
        g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
417
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] timeout:\n{In minutes.}", NULL);
418
 
 
419
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
420
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 specific mail application\n{Leave this field empty to use the default mail application.}", NULL);
 
389
  g_key_file_set_string (pKeyFile, pMailAccountName, "type", "feed");
 
390
  g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
 
391
 
 
392
  g_key_file_set_string (pKeyFile, pMailAccountName, "path", "http://identi.ca/api/statuses/user_timeline/cairodock.rss");
 
393
  g_key_file_set_comment (pKeyFile, pMailAccountName, "path", "s0 Address of feed:", NULL);
 
394
 
 
395
  g_key_file_set_integer (pKeyFile, pMailAccountName, "timeout mn", 10);
 
396
  g_key_file_set_comment (pKeyFile, pMailAccountName, "timeout mn", "I0[1;30] Timeout:\n{In minutes.}", NULL);
 
397
 
 
398
  g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
 
399
  g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
421
400
}
422
401
 
423
 
void cd_mail_retrieve_feed_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
 
402
void cd_mail_retrieve_feed_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
424
403
{
425
404
  if( !mailaccount || !pKeyFile || !mailbox_name ) return;
426
405
 
427
 
  extern int mailstream_debug;
428
 
  mailstream_debug = 1;
429
406
 
430
407
  gboolean bFlushConfFileNeeded = FALSE;
431
408
 
439
416
  mailaccount->password = NULL;
440
417
  mailaccount->auth_type = POP3_AUTH_TYPE_PLAIN;
441
418
  mailaccount->path = NULL;
442
 
  mailaccount->timeout = 0;
443
419
  
444
420
  if (g_key_file_has_key (pKeyFile, mailbox_name, "path", NULL))
445
421
  {
446
422
    mailaccount->path = CD_CONFIG_GET_STRING (mailbox_name, "path");
447
423
  }
448
 
  mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
449
424
}
450
425
 
451
426
/*{
461
436
 
462
437
 
463
438
void cd_mail_init_accounts(CairoDockModuleInstance *myApplet)
464
 
{       
465
 
        if (myData.pMailAccounts == NULL)
466
 
                return ;
467
 
        g_print ("%s (%d comptes)\n", __func__, myData.pMailAccounts->len);
468
 
        
469
 
        //\_______________________ On initialise chaque compte.
470
 
        CDMailAccount *pMailAccount;
471
 
        GList *pIconList = NULL;
472
 
        Icon *pIcon;
473
 
        int iNbIcons = 0;
474
 
        int r;
475
 
        guint i;
476
 
        for (i = 0; i < myData.pMailAccounts->len; i ++)
477
 
        {
478
 
                pMailAccount = g_ptr_array_index (myData.pMailAccounts, i);
479
 
                if( !pMailAccount ) continue;
480
 
                
481
 
                // init this account
482
 
                switch (pMailAccount->driver) {
483
 
                        case POP3_STORAGE:
484
 
                                r = pop3_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
485
 
                                        NULL, pMailAccount->connection_type,
486
 
                                        pMailAccount->auth_type, pMailAccount->user, pMailAccount->password,
487
 
                                        myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
488
 
                        break;
489
 
 
490
 
                        case IMAP_STORAGE:
491
 
                                r = imap_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
492
 
                                        NULL, pMailAccount->connection_type,
493
 
                                        IMAP_AUTH_TYPE_PLAIN, pMailAccount->user, pMailAccount->password,
494
 
                                        myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/);
495
 
                        break;
496
 
 
497
 
                        case NNTP_STORAGE:
498
 
                                r = nntp_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
499
 
                                        NULL, pMailAccount->connection_type,
500
 
                                        NNTP_AUTH_TYPE_PLAIN, pMailAccount->user, pMailAccount->password,
501
 
                                        myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
502
 
                        break;
503
 
 
504
 
                        case MBOX_STORAGE:
505
 
                                r = mbox_mailstorage_init(pMailAccount->storage, pMailAccount->path,
506
 
                                        myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
507
 
                        break;
508
 
 
509
 
                        case MH_STORAGE:
510
 
                                r = mh_mailstorage_init(pMailAccount->storage, pMailAccount->path,
511
 
                                        myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
512
 
                        break;
513
 
                        
514
 
                        case MAILDIR_STORAGE:
515
 
                                r = maildir_mailstorage_init(pMailAccount->storage, pMailAccount->path,
516
 
                                        myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
517
 
                        break;
518
 
                        
519
 
                        case FEED_STORAGE:
520
 
                                r = feed_mailstorage_init(pMailAccount->storage, pMailAccount->path,
521
 
                                        myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
522
 
                        break;
523
 
                        default :
524
 
                                r = -1;
525
 
                }
526
 
                
527
 
                // add an icon for this account.
528
 
                if (myData.pMailAccounts->len == 1)  // 1 seul compte
529
 
                {
530
 
                        pIcon = myIcon;
531
 
                }
532
 
                else
533
 
                {
534
 
                        _add_icon (pMailAccount);
535
 
                }
536
 
                iNbIcons ++;
537
 
                
538
 
                //  if all is OK, then set a timeout for this mail account
539
 
                if (r == MAIL_NO_ERROR)
540
 
                {
541
 
                        CD_APPLET_SET_QUICK_INFO_ON_MY_ICON ("...");
542
 
                        pMailAccount->pAccountMailTimer = cairo_dock_new_task (pMailAccount->timeout * 60,
543
 
                                (CairoDockGetDataAsyncFunc) cd_mail_get_folder_data,
544
 
                                (CairoDockUpdateSyncFunc) cd_mail_update_account_status,
545
 
                                pMailAccount);
546
 
                        cairo_dock_launch_task (pMailAccount->pAccountMailTimer);
547
 
                }
548
 
                else
549
 
                {
550
 
                        cd_warning ("mail : the mail account %s couldn't be initialized !", pMailAccount->name);
551
 
                        CairoContainer *pContainer = (myData.pMailAccounts->len == 1 ? myContainer : CD_APPLET_MY_ICONS_LIST_CONTAINER);
552
 
                        cairo_dock_set_quick_info (myDrawContext, pIcon, pContainer, "N/A");
553
 
                }
554
 
        }
555
 
        
556
 
        //\_______________________ On efface l'ancienne liste.
557
 
        CD_APPLET_DELETE_MY_ICONS_LIST;
558
 
        
559
 
        //\_______________________ On charge la nouvelle liste.
560
 
        if (myData.pMailAccounts->len > 1)
561
 
        {
562
 
                gpointer pConfig[2] = {GINT_TO_POINTER (FALSE), GINT_TO_POINTER (FALSE)};
563
 
                CD_APPLET_LOAD_MY_ICONS_LIST (pIconList, myConfig.cRenderer, (iNbIcons > 1 ? "Caroussel" : "Simple"), (iNbIcons > 1 ? pConfig : NULL));
564
 
        }
565
 
        
566
 
        //\_______________ On dessine l'icone principale initialement.
567
 
        CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cNoMailUserImage);
568
 
        if (iNbIcons > 0)
569
 
                CD_APPLET_SET_QUICK_INFO_ON_MY_ICON ("...");
 
439
{       
 
440
  if (myData.pMailAccounts == NULL)
 
441
    return ;
 
442
  cd_debug ("%s (%d comptes)\n", __func__, myData.pMailAccounts->len);
 
443
  
 
444
  //\_______________________ On initialise chaque compte.
 
445
  CDMailAccount *pMailAccount;
 
446
  GList *pIconList = NULL;
 
447
  Icon *pIcon;
 
448
  int iNbIcons = 0;
 
449
  int r;
 
450
  gboolean bIsGettingMail = FALSE;
 
451
  guint i;
 
452
  for (i = 0; i < myData.pMailAccounts->len; i ++)
 
453
  {
 
454
          pMailAccount = g_ptr_array_index (myData.pMailAccounts, i);
 
455
          if( !pMailAccount ) continue;
 
456
          
 
457
          // init this account
 
458
          switch (pMailAccount->driver) {
 
459
                  case POP3_STORAGE:
 
460
                          r = pop3_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
 
461
                                  NULL, pMailAccount->connection_type,
 
462
                                  pMailAccount->auth_type, pMailAccount->user, pMailAccount->password,
 
463
                                  myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
 
464
                  break;
 
465
 
 
466
                  case IMAP_STORAGE:
 
467
                          r = imap_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
 
468
                                  NULL, pMailAccount->connection_type,
 
469
                                  IMAP_AUTH_TYPE_PLAIN, pMailAccount->user, pMailAccount->password,
 
470
                                  myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/);
 
471
                  break;
 
472
 
 
473
                  case NNTP_STORAGE:
 
474
                          r = nntp_mailstorage_init(pMailAccount->storage, pMailAccount->server, pMailAccount->port,
 
475
                                  NULL, pMailAccount->connection_type,
 
476
                                  NNTP_AUTH_TYPE_PLAIN, pMailAccount->user, pMailAccount->password,
 
477
                                  myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
 
478
                  break;
 
479
 
 
480
                  case MBOX_STORAGE:
 
481
                          r = mbox_mailstorage_init(pMailAccount->storage, pMailAccount->path,
 
482
                                  myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
 
483
                  break;
 
484
 
 
485
                  case MH_STORAGE:
 
486
                          r = mh_mailstorage_init(pMailAccount->storage, pMailAccount->path,
 
487
                                  myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
 
488
                  break;
 
489
                  
 
490
                  case MAILDIR_STORAGE:
 
491
                          r = maildir_mailstorage_init(pMailAccount->storage, pMailAccount->path,
 
492
                                  myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
 
493
                  break;
 
494
                  
 
495
                  case FEED_STORAGE:
 
496
                          r = feed_mailstorage_init(pMailAccount->storage, pMailAccount->path,
 
497
                                  myData.cWorkingDirPath!=NULL?TRUE:FALSE /*cached*/, myData.cWorkingDirPath /*cache_directory*/, myData.cWorkingDirPath /*flags_directory*/);
 
498
                  break;
 
499
                  default :
 
500
                          r = -1;
 
501
          }
 
502
          
 
503
          // add an icon for this account.
 
504
          if (myData.pMailAccounts->len == 1)  // 1 seul compte
 
505
          {
 
506
                  pIcon = myIcon;
 
507
          }
 
508
          else
 
509
          {
 
510
                  _add_icon (pMailAccount);
 
511
          }
 
512
          iNbIcons ++;
 
513
          
 
514
          //  if all is OK, then set a timeout for this mail account
 
515
          if (r == MAIL_NO_ERROR)
 
516
          {
 
517
                  CD_APPLET_SET_QUICK_INFO_ON_MY_ICON ("...");
 
518
                  pMailAccount->pAccountMailTimer = cairo_dock_new_task (pMailAccount->timeout * 60,
 
519
                          (CairoDockGetDataAsyncFunc) cd_mail_get_folder_data,
 
520
                          (CairoDockUpdateSyncFunc) cd_mail_update_account_status,
 
521
                          pMailAccount);
 
522
                  cairo_dock_launch_task (pMailAccount->pAccountMailTimer);
 
523
                  bIsGettingMail = TRUE;
 
524
          }
 
525
          else
 
526
          {
 
527
                  cd_warning ("mail : the mail account %s couldn't be initialized !", pMailAccount->name);
 
528
                  CairoContainer *pContainer = (myData.pMailAccounts->len == 1 ? myContainer : CD_APPLET_MY_ICONS_LIST_CONTAINER);
 
529
                  cairo_dock_set_quick_info (pIcon, pContainer, "N/A");
 
530
          }
 
531
  }
 
532
  
 
533
  //\_______________________ On efface l'ancienne liste.
 
534
  CD_APPLET_DELETE_MY_ICONS_LIST;
 
535
  
 
536
  //\_______________________ On charge la nouvelle liste.
 
537
  if (iNbIcons > 1)
 
538
  {
 
539
          gpointer pConfig[2] = {GINT_TO_POINTER (FALSE), GINT_TO_POINTER (FALSE)};
 
540
          CD_APPLET_LOAD_MY_ICONS_LIST (pIconList, myConfig.cRenderer, "Caroussel", pConfig);
 
541
  }
 
542
  
 
543
  //\_______________ On dessine l'icone principale initialement.
 
544
  CD_APPLET_SET_IMAGE_ON_MY_ICON (myConfig.cNoMailUserImage);
 
545
  if (bIsGettingMail)
 
546
          CD_APPLET_SET_QUICK_INFO_ON_MY_ICON ("...");
570
547
}
571
548
 
572
549
 
573
550
void cd_mail_free_account (CDMailAccount *pMailAccount)
574
551
{
575
 
        if (pMailAccount == NULL)
576
 
                return ;
577
 
        
578
 
        cairo_dock_free_task( pMailAccount->pAccountMailTimer );
579
 
        
580
 
        g_free( pMailAccount->name );
581
 
        g_free( pMailAccount->server );
582
 
        g_free( pMailAccount->user );
583
 
        g_free( pMailAccount->password );
584
 
        g_free( pMailAccount->path );
585
 
        g_free( pMailAccount->cMailApp );
 
552
  if (pMailAccount == NULL)
 
553
    return ;
 
554
  
 
555
  cairo_dock_free_task( pMailAccount->pAccountMailTimer );
 
556
  
 
557
  g_free( pMailAccount->name );
 
558
  g_free( pMailAccount->server );
 
559
  g_free( pMailAccount->user );
 
560
  g_free( pMailAccount->password );
 
561
  g_free( pMailAccount->path );
 
562
  g_free( pMailAccount->cMailApp );
586
563
 
587
 
        if( pMailAccount->folder )
588
 
                mailfolder_free(pMailAccount->folder);
589
 
        if( pMailAccount->storage )
590
 
                mailstorage_free(pMailAccount->storage);
591
 
        
592
 
        g_list_foreach (pMailAccount->pUnseenMessageList, (GFunc) g_free, NULL);
593
 
        g_list_free (pMailAccount->pUnseenMessageList);
594
 
        
595
 
        g_list_foreach (pMailAccount->pUnseenMessageUid, (GFunc) g_free, NULL);
596
 
        g_list_free (pMailAccount->pUnseenMessageUid);
597
 
        
598
 
        g_free( pMailAccount );
 
564
  if( pMailAccount->folder )
 
565
    mailfolder_free(pMailAccount->folder);
 
566
  if( pMailAccount->storage )
 
567
    mailstorage_free(pMailAccount->storage);
 
568
  
 
569
  g_list_foreach (pMailAccount->pUnseenMessageList, (GFunc) g_free, NULL);
 
570
  g_list_free (pMailAccount->pUnseenMessageList);
 
571
  
 
572
  g_list_foreach (pMailAccount->pUnseenMessageUid, (GFunc) g_free, NULL);
 
573
  g_list_free (pMailAccount->pUnseenMessageUid);
 
574
  
 
575
  g_free( pMailAccount );
599
576
}
600
577
 
601
578
void cd_mail_free_all_accounts (CairoDockModuleInstance *myApplet)
602
579
{
603
 
        if (myData.pMailAccounts == NULL)
604
 
                return ;
605
 
        CDMailAccount *pMailAccount;
606
 
        guint i;
607
 
        for (i = 0; i < myData.pMailAccounts->len; i ++)
608
 
        {
609
 
                pMailAccount = g_ptr_array_index (myData.pMailAccounts, i);
610
 
                cd_mail_free_account (pMailAccount);
611
 
        }
612
 
        g_ptr_array_free (myData.pMailAccounts, TRUE);
613
 
        myData.pMailAccounts = NULL;
 
580
  if (myData.pMailAccounts == NULL)
 
581
    return ;
 
582
  CDMailAccount *pMailAccount;
 
583
  guint i;
 
584
  for (i = 0; i < myData.pMailAccounts->len; i ++)
 
585
  {
 
586
    pMailAccount = g_ptr_array_index (myData.pMailAccounts, i);
 
587
    cd_mail_free_account (pMailAccount);
 
588
  }
 
589
  g_ptr_array_free (myData.pMailAccounts, TRUE);
 
590
  myData.pMailAccounts = NULL;
614
591
}