Now the theme controls what data is set for progress updates.

This commit is contained in:
Jaime Thomas 2008-12-26 05:52:47 +00:00
parent 29fa73f8f6
commit 1620e5d3fb
5 changed files with 62 additions and 14 deletions

View File

@ -8,3 +8,4 @@
-> move callbacks to buttons instead of swallow (done except for welcome page)
-> figure out what to do about dnd, should it be consolidated into one system, how to handle internel, etc.
-> don't load the sources all at one time (lots of memory consumed -- for my entire development tree containing 154256 files, ecdb uses 46mb)
-> better way to detect pipe deletion

View File

@ -3,6 +3,27 @@ group {
name: "ecdb/burn_image_page";
min: 640 170;
script {
public message(Msg_Type:type, id, ...) {
if ((type == MSG_INT_SET) && (id == 0)) {
new percent[10], sectors[100];
snprintf(percent, 10, "%d%%", getarg(2));
set_text(PART:"progress_percent", percent);
snprintf(sectors, 100, "%d/%d", getarg(3), getarg(4));
set_text(PART:"progress_text", sectors);
/* See the erase_disc.edc for other info sent */
}
else if ((type == MSG_STRING) && (id == 1))
{
new text[100];
snprintf(text, 100, "%s", getarg(2));
set_text(PART:"progress_text", text);
set_text(PART:"progress_percent", "100%");
}
}
}
parts {
part {
name: "bg";

View File

@ -3,6 +3,22 @@ group {
name: "ecdb/erase_page";
min: 640 170;
script {
public message(Msg_Type:type, id, ...) {
if ((type == MSG_INT_SET) && (id == 0)) {
new percent[10], sectors[100];
snprintf(percent, 10, "%d%%", getarg(2));
set_text(PART:"progress_percent", percent);
snprintf(sectors, 100, "%d/%d", getarg(3), getarg(4));
set_text(PART:"progress_text", sectors);
/* Also sent is the buffer available [getarg(5)] and
* the buffer capacity [getarg(6)]
*/
}
}
}
parts {
part {
name: "bg";

View File

@ -212,9 +212,10 @@ ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte)
{
BurnProgress *p;
Evas_Object *swallow;
char buf[1024];
static int last_sector = 0;
int percent;
Edje_Message_Int_Set *progress_msg = NULL;
Edje_Message_String finalize;
if ((nbyte != sizeof(BurnProgress)) || (!strcmp((char *)buffer, "AC")))
{
@ -243,19 +244,23 @@ ecdb_burn_progress_handler(void *data, void *buffer, unsigned int nbyte)
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
"burn_image_page");
percent = (int)((double)(last_sector + 1) / (double)p->sectors * 100.0);
snprintf(buf, sizeof(buf), "%d%%", percent);
edje_object_part_text_set(swallow, "progress_percent", buf);
// Display an nice and comforting message here
if (percent >= 100)
{
edje_object_part_text_set(swallow, "progress_text", "Finalizing disc...");
finalize.str = "Finalizing disc...";
edje_object_message_send(swallow, EDJE_MESSAGE_STRING, 1, &finalize);
}
else
{
snprintf(buf, sizeof(buf), "%d/%d", last_sector, p->sectors);
edje_object_part_text_set(swallow, "progress_text", buf);
progress_msg = alloca(sizeof(Edje_Message_Int_Set) + (4 * sizeof(int)));
progress_msg->count = 5;
progress_msg->val[0] = percent;
progress_msg->val[1] = last_sector;
progress_msg->val[2] = p->sectors;
progress_msg->val[3] = (int)p->buffer_available;
progress_msg->val[4] = (int)p->buffer_capacity;
edje_object_message_send(swallow, EDJE_MESSAGE_INT_SET, 0, progress_msg);
}
}

View File

@ -99,8 +99,8 @@ ecdb_erase_progress_handler(void *data, void *buffer, unsigned int nbyte)
{
BurnProgress *p;
Evas_Object *swallow;
char buf[1024];
static int last_sector = 0;
Edje_Message_Int_Set *progress_msg;
if ((nbyte != sizeof(BurnProgress)) || (!strcmp((char *)buffer, "AC")))
{
@ -129,11 +129,16 @@ ecdb_erase_progress_handler(void *data, void *buffer, unsigned int nbyte)
swallow = evas_object_name_find(ecore_evas_get(em->main_win_ee),
"erase_page");
snprintf(buf, sizeof(buf), "%d/%d", last_sector, p->sectors);
edje_object_part_text_set(swallow, "progress_text", buf);
snprintf(buf, sizeof(buf), "%d%%", (int)((double)(last_sector + 1) /
(double)p->sectors * 100.0));
edje_object_part_text_set(swallow, "progress_percent", buf);
progress_msg = alloca(sizeof(Edje_Message_Int_Set) + (4 * sizeof(int)));
progress_msg->count = 5;
progress_msg->val[0] = (int)((double)(last_sector + 1) /
(double)p->sectors * 100.0);
progress_msg->val[1] = last_sector;
progress_msg->val[2] = p->sectors;
progress_msg->val[3] = (int)p->buffer_available;
progress_msg->val[4] = (int)p->buffer_capacity;
edje_object_message_send(swallow, EDJE_MESSAGE_INT_SET, 0, progress_msg);
}
int