summaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 28655dc..25ba2c8 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -409,6 +409,41 @@ Evas_Object *utils_add_rectangle(Evas_Object *base, int r, int g, int b, int a)
return rect;
}
+Evas_Object *utils_add_toast(Evas_Object *base, char *message)
+{
+ Evas_Object *notify, *label;
+
+ if (!base || !message) {
+ _ERR("Invalid argument");
+ return NULL;
+
+ }
+
+ notify = elm_notify_add(base);
+ if (!notify) {
+ _ERR("failed to add notify");
+ return NULL;
+ }
+
+ elm_object_style_set(notify, STYLE_TOAST);
+ elm_notify_align_set(notify, 0.0, 1.0);
+ elm_notify_timeout_set(notify, 3.0);
+
+ label = elm_label_add(notify);
+ if (!label) {
+ _ERR("failed to add label");
+ evas_object_del(notify);
+ return NULL;
+ }
+ elm_object_style_set(label, STYLE_TOAST);
+ elm_object_text_set(label, message);
+
+ elm_object_content_set(notify, label);
+ evas_object_show(notify);
+
+ return notify;
+}
+
bool utils_launch_app(const char *pkg, const char *key, const char *value)
{
app_control_h app_control;