Enlightenment CVS committal Author : devilhorns Project : e_modules Module : mail
Dir : e_modules/mail Modified Files: e_mod_config.c e_mod_config_box.c e_mod_main.c e_mod_main.h Log Message: Many fixes: -Fix config dialog to allow changing current path for maildir. -When add/del accounts, setup those accounts to get new mail. -Mailbox list in menu now reflects accounts that have been add/del. =================================================================== RCS file: /cvs/e/e_modules/mail/e_mod_config.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- e_mod_config.c 8 Jun 2006 20:37:03 -0000 1.8 +++ e_mod_config.c 8 Jun 2006 22:32:35 -0000 1.9 @@ -242,6 +242,7 @@ ci = cfd->data; cfdata = cfd->cfdata; + _config_box(ci, NULL, cfd); } @@ -303,8 +304,7 @@ if (!cb->name) continue; if (!strcmp(s, cb->name)) { - ci->boxes = evas_list_remove(ci->boxes, cb); - e_config_save_queue(); + _mail_box_deleted(ci->id, cb->name); break; } } =================================================================== RCS file: /cvs/e/e_modules/mail/e_mod_config_box.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- e_mod_config_box.c 8 Jun 2006 20:18:57 -0000 1.1 +++ e_mod_config_box.c 8 Jun 2006 22:32:35 -0000 1.2 @@ -33,6 +33,7 @@ static void _use_exec_cb_change(void *data, Evas_Object *obj); static E_Config_Dialog *prev_dlg; +static Config_Item *mail_ci; void _config_box(Config_Item *ci, Config_Box *cb, E_Config_Dialog *mcfd) @@ -45,16 +46,7 @@ if (!v) return; prev_dlg = mcfd; - - if (!cb) - { - cb = E_NEW(Config_Box, 1); - cb->type = 0; - cb->port = 110; - cb->ssl = 0; - ci->boxes = evas_list_append(ci->boxes, cb); - e_config_save_queue(); - } + mail_ci = ci; v->create_cfdata = _create_data; v->free_cfdata = _free_data; @@ -70,6 +62,16 @@ { char buf[1024]; + if (!cb) + { + cfdata->type = 0; + cfdata->ssl = 0; + cfdata->use_exec = 0; + snprintf(buf, sizeof(buf), "110"); + cfdata->port = strdup(buf); + return; + } + if (cb->name) cfdata->name = strdup(cb->name); @@ -199,7 +201,7 @@ e_widget_frametable_object_append(of, cfdata->cur_path_label, 0, 5, 1, 1, 0, 0, 1, 0); cfdata->cur_path_entry = e_widget_entry_add(evas, &cfdata->cur_path); e_widget_frametable_object_append(of, cfdata->cur_path_entry, 1, 5, 1, 1, 0, 0, 1, 0); - if ((cfdata->type == 0) || (cfdata->type == 2)) + if ((cfdata->type == 1) || (cfdata->type == 3)) { e_widget_disabled_set(cfdata->cur_path_label, 1); e_widget_disabled_set(cfdata->cur_path_entry, 1); @@ -213,8 +215,7 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { Config_Box *cb; - - cb = cfd->data; + int is_new = 0; if (cfdata->name == NULL) { @@ -223,6 +224,16 @@ return 0; } + cb = cfd->data; + if (!cb) + { + cb = E_NEW(Config_Box, 1); + cb->type = 0; + 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); @@ -271,6 +282,15 @@ e_config_save_queue(); + _mail_box_config_updated(prev_dlg); + + if (is_new) + { + mail_ci->boxes = evas_list_append(mail_ci->boxes, cb); + e_config_save_queue(); + _mail_box_added(mail_ci->id, cb->name); + } + _mail_box_config_updated(prev_dlg); return 1; } =================================================================== RCS file: /cvs/e/e_modules/mail/e_mod_main.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- e_mod_main.c 8 Jun 2006 21:05:33 -0000 1.14 +++ e_mod_main.c 8 Jun 2006 22:32:35 -0000 1.15 @@ -958,6 +958,112 @@ ecore_event_handler_del(mb->exit_handler); } +void +_mail_box_added(const char *ci_name, const char *box_name) +{ + Evas_List *l, *b; + + for (l = mail_config->instances; l; l = l->next) + { + Instance *inst; + Config_Item *ci; + + inst = l->data; + ci = _mail_config_item_get(inst->gcc->id); + if ((ci->id) && (!strcmp(ci->id, ci_name))) + { + for (b = ci->boxes; b; b = b->next) + { + Config_Box *cb; + + cb = b->data; + if ((cb->name) && (!strcmp(cb->name, box_name))) + { + Mailbox *mb; + + mb = E_NEW(Mailbox, 1); + mb->inst = inst; + mb->config = cb; + mb->server = NULL; + mb->state = STATE_DISCONNECTED; + mb->cmd = 0; + inst->mboxes = evas_list_append(inst->mboxes, mb); + if (cb->type == MAIL_TYPE_MDIR) + mb->monitor = ecore_file_monitor_add(cb->new_path, _mail_mdir_check, mb); + else if (cb->type == MAIL_TYPE_MBOX) + mb->monitor = ecore_file_monitor_add(cb->new_path, _mail_mbox_check, mb); + else + { + _mail_cb_check(inst); + if (!inst->check_timer) + inst->check_timer = ecore_timer_add((ci->check_time * 60.0), _mail_cb_check, inst); + } + break; + } + } + break; + } + } +} + +void +_mail_box_deleted(const char *ci_name, const char *box_name) +{ + Evas_List *l, *d, *i; + Config_Box *cb; + int found = 0; + + for (i = mail_config->instances; i; i = i->next) + { + Instance *inst; + + inst = i->data; + if (!inst->gcc->id) continue; + if (!strcmp(inst->gcc->id, ci_name)) + { + Config_Item *ci; + + ci = _mail_config_item_get(inst->gcc->id); + for (d = ci->boxes; d; d = d->next) + { + cb = d->data; + if ((cb->name) && (box_name)) + { + if (!strcmp(cb->name, box_name)) + found = 1; + } + if (found) break; + } + if (found) + { + for (l = inst->mboxes; l; l = l->next) + { + Mailbox *mb; + + mb = l->data; + if (((mb->config->name) && (cb->name)) && + (!strcmp(mb->config->name, cb->name))) + { + if (mb->monitor) ecore_file_monitor_del(mb->monitor); + if (mb->add_handler) ecore_event_handler_del(mb->add_handler); + if (mb->data_handler) ecore_event_handler_del(mb->data_handler); + if (mb->del_handler) ecore_event_handler_del(mb->del_handler); + if (mb->server) ecore_con_server_del(mb->server); + mb->server = NULL; + inst->mboxes = evas_list_remove(inst->mboxes, mb); + free(mb); + break; + } + } + ci->boxes = evas_list_remove(ci->boxes, cb); + e_config_save_queue(); + break; + } + break; + } + } +} + void _mail_config_updated(const char *id) { =================================================================== RCS file: /cvs/e/e_modules/mail/e_mod_main.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- e_mod_main.h 8 Jun 2006 20:20:07 -0000 1.4 +++ e_mod_main.h 8 Jun 2006 22:32:35 -0000 1.5 @@ -65,6 +65,8 @@ void _config_mail_module(Config_Item *ci); void _mail_config_updated(const char *id); void _mail_box_config_updated(E_Config_Dialog *cfd); +void _mail_box_deleted(const char *ci_name, const char *box_name); +void _mail_box_added(const char *ci_name, const char *box_name); extern Config *mail_config; _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs