info-popup: enhance interface & docs 50/239550/1
authorLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Mon, 27 Jul 2020 10:33:32 +0000 (12:33 +0200)
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Mon, 27 Jul 2020 10:33:32 +0000 (12:33 +0200)
Fix issue with wrong parent in reset.

Change-Id: I93fa8428de656b2bcb6df05e2421000e37acb9ca

setting-common/include/controls/info-popup.h
setting-common/src/controls/info-popup.c
setting-reset/src/setting-reset-main.c

index 08069e164af25ae355ed3709da369a74de99c777..cb456822897f46e7a000c31468794ed035fc6128 100644 (file)
  *   evas_object_show(cp);
  */
 
+/**
+ * @brief Creates new info popup instance.
+ */
 Evas_Object *info_popup_create(Evas_Object *parent);
 
+/**
+ * @brief Set title of popup.
+ */
 void info_popup_title_set(Evas_Object *popup, const char *title);
 
+/**
+ * @brief Set main text.
+ */
 void info_popup_text_set(Evas_Object *popup, const char *text);
 
+/**
+ * @brief Set "OK" button text.
+ */
 void info_popup_ok_text_set(Evas_Object *popup, const char *text);
 
 /**
- * @Utility function creating and showing info popup with "OK" button
+ * @Utility function creating and showing info popup
  */
-void info_popup_show_message(Evas_Object *parent, const char *title, const char *text);
+void info_popup_show_message(Evas_Object *parent, const char *title, const char *text, const char *ok_text);
 
 #endif /* end of include guard: INFO_POPUP_H */
index 00cd638f62aa2a7fd4af5be13f8ee550d6f6dc8a..768bc7afdc56717bd09bef432d3842418412dbd2 100644 (file)
@@ -59,12 +59,13 @@ void info_popup_ok_text_set(Evas_Object *popup, const char *text)
 }
 
 EXPORT_PUBLIC
-void info_popup_show_message(Evas_Object *parent, const char *title, const char *text)
+void info_popup_show_message(Evas_Object *parent, const char *title, const char *text, const char *ok_text)
 {
        Evas_Object *cp = info_popup_create(parent);
 
        info_popup_title_set(cp, title);
        info_popup_text_set(cp, text);
+       info_popup_ok_text_set(cp, ok_text);
 
        evas_object_show(cp);
 }
index 767ab306fc2d36f1f85c20f27c0ae138d19d1b11..04bbac880e0078a1855e5c0596e0a89a4b3efa92 100644 (file)
@@ -150,14 +150,14 @@ static void _show_reset_initial_config_result_popup(Evas_Object *parent, bool re
        const char *title = _("IDS_ST_BODY_RESET_INITIAL_CONFIGURATION");
        const char *content = result ? _("IDS_IM_BODY_SUCCESSFULLY_COMPLETED") : _("IDS_IM_POP_UNEXPECTED_ERROR");
 
-       info_popup_show_message(parent, title, content);
+       info_popup_show_message(parent, title, content, _("IDS_ST_BUTTON_OK_ABB"));
 }
 
 static void _on_confirmed_reset_initial_config(void *data, Evas_Object *obj, void *event_info)
 {
        int result = setting_reset_initial_config();
        evas_object_del(obj);
-       _show_reset_initial_config_result_popup(obj, result == 0);
+       _show_reset_initial_config_result_popup(data, result == 0);
 }
 
 static void setting_reset_initial_config_clicked(void *data, Evas_Object *obj, void *event_info)
@@ -168,7 +168,7 @@ static void setting_reset_initial_config_clicked(void *data, Evas_Object *obj, v
        snprintf(popupmsg, MAX_POPUPMSG, "<align=center>%s<br>%s</align>",
                        _("IDS_MSG_RESET_INITIAL_CONFIGURATION"), _("IDS_MSG_RESET_CANNOT_BE_UNDONE"));
        confirm_popup_text_set(confirm_popup, popupmsg);
-       evas_object_smart_callback_add(confirm_popup, "confirmed", _on_confirmed_reset_initial_config, NULL);
+       evas_object_smart_callback_add(confirm_popup, "confirmed", _on_confirmed_reset_initial_config, md->window);
        evas_object_smart_callback_add(confirm_popup, "rejected", _dismiss_popup, NULL);
        elm_genlist_item_selected_set(event_info, EINA_FALSE);
        evas_object_show(confirm_popup);