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. SVN revision: 23317
This commit is contained in:
parent
da2df4346b
commit
48d14d39f2
|
@ -242,6 +242,7 @@ _cb_add_box(void *data, void *data2)
|
||||||
|
|
||||||
ci = cfd->data;
|
ci = cfd->data;
|
||||||
cfdata = cfd->cfdata;
|
cfdata = cfd->cfdata;
|
||||||
|
|
||||||
_config_box(ci, NULL, cfd);
|
_config_box(ci, NULL, cfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,8 +304,7 @@ _cb_del_box(void *data, void *data2)
|
||||||
if (!cb->name) continue;
|
if (!cb->name) continue;
|
||||||
if (!strcmp(s, cb->name))
|
if (!strcmp(s, cb->name))
|
||||||
{
|
{
|
||||||
ci->boxes = evas_list_remove(ci->boxes, cb);
|
_mail_box_deleted(ci->id, cb->name);
|
||||||
e_config_save_queue();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ static void _type_cb_change(void *data, Evas_Object *obj);
|
||||||
static void _use_exec_cb_change(void *data, Evas_Object *obj);
|
static void _use_exec_cb_change(void *data, Evas_Object *obj);
|
||||||
|
|
||||||
static E_Config_Dialog *prev_dlg;
|
static E_Config_Dialog *prev_dlg;
|
||||||
|
static Config_Item *mail_ci;
|
||||||
|
|
||||||
void
|
void
|
||||||
_config_box(Config_Item *ci, Config_Box *cb, E_Config_Dialog *mcfd)
|
_config_box(Config_Item *ci, Config_Box *cb, E_Config_Dialog *mcfd)
|
||||||
|
@ -45,16 +46,7 @@ _config_box(Config_Item *ci, Config_Box *cb, E_Config_Dialog *mcfd)
|
||||||
if (!v) return;
|
if (!v) return;
|
||||||
|
|
||||||
prev_dlg = mcfd;
|
prev_dlg = mcfd;
|
||||||
|
mail_ci = ci;
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
v->create_cfdata = _create_data;
|
v->create_cfdata = _create_data;
|
||||||
v->free_cfdata = _free_data;
|
v->free_cfdata = _free_data;
|
||||||
|
@ -70,6 +62,16 @@ _fill_data(Config_Box *cb, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
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)
|
if (cb->name)
|
||||||
cfdata->name = strdup(cb->name);
|
cfdata->name = strdup(cb->name);
|
||||||
|
|
||||||
|
@ -199,7 +201,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
e_widget_frametable_object_append(of, cfdata->cur_path_label, 0, 5, 1, 1, 0, 0, 1, 0);
|
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);
|
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);
|
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_label, 1);
|
||||||
e_widget_disabled_set(cfdata->cur_path_entry, 1);
|
e_widget_disabled_set(cfdata->cur_path_entry, 1);
|
||||||
|
@ -213,8 +215,7 @@ static int
|
||||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
Config_Box *cb;
|
Config_Box *cb;
|
||||||
|
int is_new = 0;
|
||||||
cb = cfd->data;
|
|
||||||
|
|
||||||
if (cfdata->name == NULL)
|
if (cfdata->name == NULL)
|
||||||
{
|
{
|
||||||
|
@ -223,6 +224,16 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
return 0;
|
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 (cb->name) evas_stringshare_del(cb->name);
|
||||||
if (cfdata->name != NULL)
|
if (cfdata->name != NULL)
|
||||||
cb->name = evas_stringshare_add(cfdata->name);
|
cb->name = evas_stringshare_add(cfdata->name);
|
||||||
|
@ -271,6 +282,15 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
|
|
||||||
e_config_save_queue();
|
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);
|
_mail_box_config_updated(prev_dlg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
106
e_mod_main.c
106
e_mod_main.c
|
@ -958,6 +958,112 @@ _mail_cb_exe_exit(void *data, int type, void *event)
|
||||||
ecore_event_handler_del(mb->exit_handler);
|
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
|
void
|
||||||
_mail_config_updated(const char *id)
|
_mail_config_updated(const char *id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,6 +65,8 @@ EAPI int e_modapi_about(E_Module *m);
|
||||||
void _config_mail_module(Config_Item *ci);
|
void _config_mail_module(Config_Item *ci);
|
||||||
void _mail_config_updated(const char *id);
|
void _mail_config_updated(const char *id);
|
||||||
void _mail_box_config_updated(E_Config_Dialog *cfd);
|
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;
|
extern Config *mail_config;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue