From aa16a66e330c6c0e151c1463d683f911dd4d9f84 Mon Sep 17 00:00:00 2001 From: Jaime Thomas Date: Fri, 26 Dec 2008 05:52:47 +0000 Subject: [PATCH] Now the theme controls what data is set for progress updates. --- experimental/ecdb/trunk/TODO | 1 + .../data/themes/default/groups/burn_image.edc | 21 +++++++++++++++++++ .../data/themes/default/groups/erase_disc.edc | 16 ++++++++++++++ experimental/ecdb/trunk/src/ecdb_burn.c | 21 ++++++++++++------- experimental/ecdb/trunk/src/ecdb_erase.c | 17 +++++++++------ 5 files changed, 62 insertions(+), 14 deletions(-) diff --git a/experimental/ecdb/trunk/TODO b/experimental/ecdb/trunk/TODO index 4fc5dffb..57bdaf84 100644 --- a/experimental/ecdb/trunk/TODO +++ b/experimental/ecdb/trunk/TODO @@ -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 diff --git a/experimental/ecdb/trunk/data/themes/default/groups/burn_image.edc b/experimental/ecdb/trunk/data/themes/default/groups/burn_image.edc index fe38e68c..9af18dac 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/burn_image.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/burn_image.edc @@ -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"; diff --git a/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc b/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc index e63fb35b..abf339e0 100644 --- a/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc +++ b/experimental/ecdb/trunk/data/themes/default/groups/erase_disc.edc @@ -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"; diff --git a/experimental/ecdb/trunk/src/ecdb_burn.c b/experimental/ecdb/trunk/src/ecdb_burn.c index fa4a1296..2de6ff10 100644 --- a/experimental/ecdb/trunk/src/ecdb_burn.c +++ b/experimental/ecdb/trunk/src/ecdb_burn.c @@ -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); } } diff --git a/experimental/ecdb/trunk/src/ecdb_erase.c b/experimental/ecdb/trunk/src/ecdb_erase.c index f935386f..5660ef8e 100644 --- a/experimental/ecdb/trunk/src/ecdb_erase.c +++ b/experimental/ecdb/trunk/src/ecdb_erase.c @@ -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