Icon and label should now properly reflect new mail count from all mailboxes.

HandyAndE, let me know if your imap works with this or not.


SVN revision: 23417
This commit is contained in:
Christopher Michael 2006-06-13 12:24:07 +00:00
parent cdf33fb4be
commit a1c10b64ef
7 changed files with 30 additions and 32 deletions

View File

@ -292,13 +292,12 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
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);

View File

@ -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", "");
}

9
imap.c
View File

@ -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;
@ -195,10 +194,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);

2
imap.h
View File

@ -21,7 +21,7 @@ struct _ImapServer
Ecore_Con_Server *server;
Evas_List *clients;
ImapClient *current;
int cmd, count;
int cmd;
ImapState state;
void *data;

5
mbox.c
View File

@ -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);
}

5
mdir.c
View File

@ -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);
}

5
pop.c
View File

@ -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);