summaryrefslogtreecommitdiffstats
path: root/src/eulogium.c
diff options
context:
space:
mode:
authorOlliver Schinagl <o.schinagl@ultimaker.com>2015-04-27 19:40:04 (GMT)
committerOlliver Schinagl <o.schinagl@ultimaker.com>2015-04-28 05:07:16 (GMT)
commit7d31447af8d2876f296be34e7f713b76d01a1de8 (patch)
tree9b132ab1a46547fa39ed64f1bffcc2f0a27eab71 /src/eulogium.c
parent731d599eed2dc3763571284819df066c2e5adae5 (diff)
downloadeulogium-7d31447af8d2876f296be34e7f713b76d01a1de8.zip
eulogium-7d31447af8d2876f296be34e7f713b76d01a1de8.tar.gz
eulogium-7d31447af8d2876f296be34e7f713b76d01a1de8.tar.bz2
Make progress screen appear based on successful start of print.
With this patch we start the print progress dialog based on the return status of harma's startPrint request. If we fail to contact harma or start a print, right now we emit a generic error. Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
Diffstat (limited to '')
-rw-r--r--src/eulogium.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/eulogium.c b/src/eulogium.c
index 0a389d2..700bdcc 100644
--- a/src/eulogium.c
+++ b/src/eulogium.c
@@ -334,21 +334,34 @@ Evas_Object *eulogium_generic_error(struct eulogium_data *eulogium, uint8_t eulo
static void _on_print_start_ret(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
{
+ Evas_Object *content;
const char *errname, *errmsg;
+ Eina_Bool print_started = EINA_FALSE;
+ struct eulogium_data *eulogium = data;
if (eldbus_message_error_get(msg, &errname, &errmsg)) {
EINA_LOG_ERR("%s %s", errname, errmsg);
- return;
+ } else if (!eldbus_message_arguments_get(msg, "b", &print_started)) {
+ EINA_LOG_ERR("Failed to start print.");
}
+
+ if (print_started == EINA_TRUE)
+ content = eulogium_print_progress(eulogium);
+ else
+ content = eulogium_generic_error(eulogium, 0); /* TODO make enum/table of error codes and pass that. */
+ /* TODO: check why the print failed, and possibly show progress */
+ elm_naviframe_item_simple_push(eulogium->navi, content);
}
-Evas_Object *eulogium_start_print(struct eulogium_data *eulogium, char *filepath)
+static void eulogium_start_print(struct eulogium_data *eulogium, char *filepath)
{
eulogium_print_data_set(eulogium, filepath);
eldbus_proxy_call(eulogium->dbus.proxy[HARMA], "startPrint", _on_print_start_ret, eulogium, -1, "sss",
eulogium->print.name, eulogium->print.file, eulogium->print.flags);
- /* TODO check status of print and show that to the user before going to the progress screen */
- return eulogium_print_progress(eulogium);
+ /* TODO: calling startPrint may have a longer then expected timeout. While unlikely we may want to inform
+ * the user about this via a screen. Difficulty being here, is that we don't want to 'flash' a screen
+ * too shortly but may not want to delay without reason.
+ */
}
struct _filelist_data {
@@ -366,10 +379,10 @@ static void _cb_select_file(void *data, Evas_Object *obj EINA_UNUSED, void *even
if (filepath) {
if (ecore_file_is_dir(filepath)) {
content = eulogium_print_menu(eulogium, filepath);
+ elm_naviframe_item_simple_push(eulogium->navi, content);
} else {
- content = eulogium_start_print(eulogium, filepath);
+ eulogium_start_print(eulogium, filepath);
}
- elm_naviframe_item_simple_push(eulogium->navi, content);
}
}