Move controls to setting-common 56/231856/1 submit/tizen/20200427.060825
authorLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Fri, 24 Apr 2020 06:24:37 +0000 (08:24 +0200)
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Fri, 24 Apr 2020 06:24:37 +0000 (08:24 +0200)
Change-Id: Ia725274c120ded3d544231cba64f24b7ff493ada

setting-common/CMakeLists.txt
setting-common/include/controls/confirm-popup.h [new file with mode: 0644]
setting-common/src/controls/confirm-popup.c [new file with mode: 0644]
setting-reset/CMakeLists.txt
setting-reset/include/controls/confirm-popup.h [deleted file]
setting-reset/src/controls/confirm-popup.c [deleted file]

index 607cdb5543c80e974f7d4c0031e7be12259de6e3..0933beb7e63251071cb7091eb2a4dd36a3611b19 100755 (executable)
@@ -51,6 +51,7 @@ ADD_LIBRARY(${LIB_SETTING_COMMON} SHARED
        ./src/setting-common-general-func.c
        ./src/setting-common-init.c
        ./src/setting-common-view.c
+       ./src/controls/confirm-popup.c
 )
 
 TARGET_LINK_LIBRARIES(${LIB_SETTING_COMMON} ${pkgs_common_data_LDFLAGS})
diff --git a/setting-common/include/controls/confirm-popup.h b/setting-common/include/controls/confirm-popup.h
new file mode 100644 (file)
index 0000000..18344de
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CONFIRM_POPUP_H
+#define CONFIRM_POPUP_H
+
+#include <Elementary.h>
+
+/**
+ * @brief Creates new confirm popup widget, with title, content text
+ * and two buttons: "confirm", "reject"
+ *
+ * --------------------------------
+ * |              Title           |
+ * |------------------------------|
+ * |                              |
+ * |              Text            |
+ * |                              |
+ * |-------------- ---------------|
+ * ||Reject button||Confirm button|
+ * --------------------------------
+ *
+ * Usage:
+ *
+ *   Evas_Object *cp = confirm_popup_create(window);
+ *
+ *   confirm_popup_title_set(cp, "Confirmation");
+ *   confirm_popup_text_set(cp, "Remove all files?");
+ *   confirm_popup_accept_text_set(cp, "Remove");
+ *   confirm_popup_reject_text_set(cp, "Cancel");
+ *
+ *   evas_object_smart_callback_add(cp, "confirmed", accepted_cb, NULL);
+ *   evas_object_smart_callback_add(cp, "rejected", rejected_cb, NULL);
+ *
+ *   evas_object_show(cp);
+ */
+Evas_Object *confirm_popup_create(Evas_Object *parent);
+
+void confirm_popup_title_set(Evas_Object *confirm_popup, const char *title);
+
+void confirm_popup_text_set(Evas_Object *confirm_popup, const char *text);
+
+void confirm_popup_confirm_text_set(Evas_Object *confirm_popup, const char *text);
+
+void confirm_popup_reject_text_set(Evas_Object *confirm_popup, const char *text);
+
+#endif /* end of include guard: CONFIRM_POPUP_H */
diff --git a/setting-common/src/controls/confirm-popup.c b/setting-common/src/controls/confirm-popup.c
new file mode 100644 (file)
index 0000000..76437b4
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "setting-common-general-func.h"
+#include "controls/confirm-popup.h"
+
+static void _on_reject_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       Evas_Object *popup = data;
+       evas_object_smart_callback_call(popup, "rejected", NULL);
+}
+
+static void _on_confirm_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       Evas_Object *popup = data;
+       evas_object_smart_callback_call(popup, "confirmed", NULL);
+}
+
+EXPORT_PUBLIC
+Evas_Object *confirm_popup_create(Evas_Object *parent)
+{
+       Evas_Object *popup = elm_popup_add(parent);
+
+       elm_popup_align_set(popup, 0.5, 1.0);
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+       Evas_Object *btn = elm_button_add(popup);
+       elm_object_style_set(btn, "popup");
+       evas_object_smart_callback_add(btn, "clicked", _on_reject_clicked, popup);
+       elm_object_part_content_set(popup, "button1", btn);
+
+       Evas_Object *btn2 = elm_button_add(popup);
+       elm_object_style_set(btn2, "popup");
+       evas_object_smart_callback_add(btn2, "clicked", _on_confirm_clicked, popup);
+       elm_object_part_content_set(popup, "button2", btn2);
+
+       return popup;
+}
+
+EXPORT_PUBLIC
+void confirm_popup_title_set(Evas_Object *confirm_popup, const char *title)
+{
+       elm_object_part_text_set(confirm_popup, "title,text", title);
+}
+
+EXPORT_PUBLIC
+void confirm_popup_text_set(Evas_Object *confirm_popup, const char *text)
+{
+       elm_object_text_set(confirm_popup, text);
+}
+
+EXPORT_PUBLIC
+void confirm_popup_confirm_text_set(Evas_Object *confirm_popup, const char *text)
+{
+       Evas_Object *btn = elm_object_part_content_get(confirm_popup, "button2");
+       elm_object_text_set(btn, text);
+}
+
+EXPORT_PUBLIC
+void confirm_popup_reject_text_set(Evas_Object *confirm_popup, const char *text)
+{
+       Evas_Object *btn = elm_object_part_content_get(confirm_popup, "button1");
+       elm_object_text_set(btn, text);
+}
index 58be68bd5c4a3874b5ef50baaba5f7223afb1776..36e98d134b6697109366a73e2541066400b52e35 100644 (file)
@@ -28,7 +28,6 @@ ADD_EXECUTABLE(${PROJECT_SETTING_RESET}
        ./src/setting-reset-factory-reset.c
        ./src/setting-reset-network.c
        ./src/setting-reset-settings.c
-       ./src/controls/confirm-popup.c
        )
 
 TARGET_LINK_LIBRARIES(${PROJECT_SETTING_RESET} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common)
diff --git a/setting-reset/include/controls/confirm-popup.h b/setting-reset/include/controls/confirm-popup.h
deleted file mode 100644 (file)
index 18344de..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef CONFIRM_POPUP_H
-#define CONFIRM_POPUP_H
-
-#include <Elementary.h>
-
-/**
- * @brief Creates new confirm popup widget, with title, content text
- * and two buttons: "confirm", "reject"
- *
- * --------------------------------
- * |              Title           |
- * |------------------------------|
- * |                              |
- * |              Text            |
- * |                              |
- * |-------------- ---------------|
- * ||Reject button||Confirm button|
- * --------------------------------
- *
- * Usage:
- *
- *   Evas_Object *cp = confirm_popup_create(window);
- *
- *   confirm_popup_title_set(cp, "Confirmation");
- *   confirm_popup_text_set(cp, "Remove all files?");
- *   confirm_popup_accept_text_set(cp, "Remove");
- *   confirm_popup_reject_text_set(cp, "Cancel");
- *
- *   evas_object_smart_callback_add(cp, "confirmed", accepted_cb, NULL);
- *   evas_object_smart_callback_add(cp, "rejected", rejected_cb, NULL);
- *
- *   evas_object_show(cp);
- */
-Evas_Object *confirm_popup_create(Evas_Object *parent);
-
-void confirm_popup_title_set(Evas_Object *confirm_popup, const char *title);
-
-void confirm_popup_text_set(Evas_Object *confirm_popup, const char *text);
-
-void confirm_popup_confirm_text_set(Evas_Object *confirm_popup, const char *text);
-
-void confirm_popup_reject_text_set(Evas_Object *confirm_popup, const char *text);
-
-#endif /* end of include guard: CONFIRM_POPUP_H */
diff --git a/setting-reset/src/controls/confirm-popup.c b/setting-reset/src/controls/confirm-popup.c
deleted file mode 100644 (file)
index a2cb43c..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "controls/confirm-popup.h"
-
-static void _on_reject_clicked(void *data, Evas_Object *obj, void *event_info)
-{
-       Evas_Object *popup = data;
-       evas_object_smart_callback_call(popup, "rejected", NULL);
-}
-
-static void _on_confirm_clicked(void *data, Evas_Object *obj, void *event_info)
-{
-       Evas_Object *popup = data;
-       evas_object_smart_callback_call(popup, "confirmed", NULL);
-}
-
-Evas_Object *confirm_popup_create(Evas_Object *parent)
-{
-       Evas_Object *popup = elm_popup_add(parent);
-
-       elm_popup_align_set(popup, 0.5, 1.0);
-       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
-       Evas_Object *btn = elm_button_add(popup);
-       elm_object_style_set(btn, "popup");
-       evas_object_smart_callback_add(btn, "clicked", _on_reject_clicked, popup);
-       elm_object_part_content_set(popup, "button1", btn);
-
-       Evas_Object *btn2 = elm_button_add(popup);
-       elm_object_style_set(btn2, "popup");
-       evas_object_smart_callback_add(btn2, "clicked", _on_confirm_clicked, popup);
-       elm_object_part_content_set(popup, "button2", btn2);
-
-       return popup;
-}
-
-void confirm_popup_title_set(Evas_Object *confirm_popup, const char *title)
-{
-       elm_object_part_text_set(confirm_popup, "title,text", title);
-}
-
-void confirm_popup_text_set(Evas_Object *confirm_popup, const char *text)
-{
-       elm_object_text_set(confirm_popup, text);
-}
-
-void confirm_popup_confirm_text_set(Evas_Object *confirm_popup, const char *text)
-{
-       Evas_Object *btn = elm_object_part_content_get(confirm_popup, "button2");
-       elm_object_text_set(btn, text);
-}
-
-void confirm_popup_reject_text_set(Evas_Object *confirm_popup, const char *text)
-{
-       Evas_Object *btn = elm_object_part_content_get(confirm_popup, "button1");
-       elm_object_text_set(btn, text);
-}