diff --git a/e_mod_config_box.c b/e_mod_config_box.c index 07c0cde..6956ba1 100644 --- a/e_mod_config_box.c +++ b/e_mod_config_box.c @@ -244,8 +244,8 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) cb->port = 110; cb->ssl = 0; is_new = 1; - } - + } + if (cb->name) evas_stringshare_del(cb->name); if (cfdata->name != NULL) cb->name = evas_stringshare_add(cfdata->name); @@ -291,14 +291,13 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) cb->cur_path = evas_stringshare_add(cfdata->cur_path); else cb->cur_path = evas_stringshare_add(""); - - e_config_save_queue(); - _mail_box_config_updated(prev_dlg); + if (!is_new) + e_config_save_queue(); if (is_new) { - cfd->data = cb; +// cfd->data = cb; mail_ci->boxes = evas_list_append(mail_ci->boxes, cb); e_config_save_queue(); _mail_box_added(mail_ci->id, cb->name); diff --git a/e_mod_main.c b/e_mod_main.c index 55aa372..7bd5000 100644 --- a/e_mod_main.c +++ b/e_mod_main.c @@ -7,7 +7,7 @@ * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * - * This program is distributed in the hope that it will be useful, + * This program is distributed in the hope that it cwill be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. @@ -487,7 +487,6 @@ _mail_cb_check(void *data) int have_imap = 0, have_pop = 0; if (!inst) return 1; - inst->count = 0; ci = _mail_config_item_get(inst->gcc->id); if (!ci->boxes) return 1; @@ -520,13 +519,29 @@ void _mail_set_text(void *data) { Instance *inst = data; + Config_Item *ci; + Evas_List *l; char buf[1024]; + int count = 0; if (!inst) return; - - if (inst->count > 0) + + ci = _mail_config_item_get(inst->gcc->id); + if (!ci) return; + for (l = ci->boxes; l; l = l->next) { - snprintf(buf, sizeof(buf), "%d", inst->count); + Config_Box *cb; + + cb = l->data; + if (!cb) continue; + count += cb->num_new; + } + + printf("Count: %i\n", count); + + if (count > 0) + { + snprintf(buf, sizeof(buf), "%d", count); edje_object_part_text_set(inst->mail->mail_obj, "new_label", buf); edje_object_signal_emit(inst->mail->mail_obj, "new_mail", ""); } diff --git a/imap.c b/imap.c index 8188efb..e9f2039 100644 --- a/imap.c +++ b/imap.c @@ -182,7 +182,6 @@ _mail_imap_server_del(void *data, int type, void *event) { Ecore_Con_Event_Server_Del *ev = event; ImapServer *is; - Instance *inst; is = _mail_imap_server_get(ev->server); if (!is) return 1; @@ -194,10 +193,6 @@ _mail_imap_server_del(void *data, int type, void *event) ecore_con_server_del(is->server); is->server = NULL; - - inst = is->data; - inst->count += is->count; - _mail_set_text(inst); return 0; } @@ -208,7 +203,6 @@ _mail_imap_server_data(void *data, int type, void *event) Ecore_Con_Event_Server_Data *ev = event; ImapServer *is; ImapClient *ic; - Instance *inst; int len, num = 0, total = 0; char in[1024], out[1024], *spc; size_t slen; @@ -256,9 +250,10 @@ _mail_imap_server_data(void *data, int type, void *event) case IMAP_STATE_STATUS_OK: if (sscanf(in, "* STATUS %*s (MESSAGES %i UNSEEN %i)", &total, &num) == 2) { - is->count += num; ic->config->num_new = num; ic->config->num_total = total; + _mail_set_text(is->data); + if ((num > 0) && (ic->config->use_exec) && (ic->config->exec)) _mail_start_exe(ic->config); diff --git a/imap.h b/imap.h index f57762f..ae5e737 100644 --- a/imap.h +++ b/imap.h @@ -21,7 +21,7 @@ struct _ImapServer Ecore_Con_Server *server; Evas_List *clients; ImapClient *current; - int cmd, count; + int cmd; ImapState state; void *data; diff --git a/mbox.c b/mbox.c index 9371414..d367e96 100644 --- a/mbox.c +++ b/mbox.c @@ -74,7 +74,6 @@ _mail_mbox_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event char buf[1024]; int total = 0, unread = 0; int header; - Instance *inst; mb = data; if (!mb) return; @@ -104,9 +103,7 @@ _mail_mbox_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event } fclose(f); - inst = mb->data; - inst->count += mb->config->num_new; - _mail_set_text(inst); + _mail_set_text(mb->data); if ((mb->config->num_new > 0) && (mb->config->use_exec) && (mb->config->exec)) _mail_start_exe(mb->config); } diff --git a/mdir.c b/mdir.c index 766fea8..7a811b7 100644 --- a/mdir.c +++ b/mdir.c @@ -68,7 +68,6 @@ static void _mail_mdir_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event event, const char *path) { MdirClient *mc; - Instance *inst; mc = data; if (!mc) return; @@ -76,9 +75,7 @@ _mail_mdir_check_mail(void *data, Ecore_File_Monitor *monitor, Ecore_File_Event mc->config->num_total = _mail_mdir_get_files(mc->config->cur_path); mc->config->num_new = _mail_mdir_get_files(mc->config->new_path); - inst = mc->data; - inst->count += mc->config->num_new; - _mail_set_text(inst); + _mail_set_text(mc->data); if ((mc->config->num_new > 0) && (mc->config->use_exec) && (mc->config->exec)) _mail_start_exe(mc->config); } diff --git a/pop.c b/pop.c index 244cef4..34b09ec 100644 --- a/pop.c +++ b/pop.c @@ -123,7 +123,6 @@ _mail_pop_server_del(void *data, int type, void *event) { Ecore_Con_Event_Server_Del *ev = event; PopClient *pc; - Instance *inst; pc = _mail_pop_client_get_from_server(ev->server); if (!pc) return 1; @@ -143,7 +142,6 @@ _mail_pop_server_data(void *data, int type, void *event) { Ecore_Con_Event_Server_Data *ev = event; PopClient *pc; - Instance *inst; char in[2048], out[2048]; int len, num = 0, total = 0; @@ -151,8 +149,6 @@ _mail_pop_server_data(void *data, int type, void *event) if (!pc) return 1; if (pc->state == POP_STATE_DISCONNECTED) return 1; - inst = pc->data; - len = sizeof(in) -1; len = (((len) > (ev->size)) ? ev->size : len); memcpy(in, ev->data, len); @@ -192,7 +188,6 @@ _mail_pop_server_data(void *data, int type, void *event) pc->config->num_new = num; pc->config->num_total = num; } - inst->count += num; _mail_pop_client_quit(pc); if ((num > 0) && (pc->config->use_exec) && (pc->config->exec)) _mail_start_exe(pc->config);