Add common file which contains functions used at other popups 98/15798/1
authorTaeyoung Kim <ty317.kim@samsung.com>
Tue, 28 Jan 2014 11:53:10 +0000 (20:53 +0900)
committerTaeyoung Kim <ty317.kim@samsung.com>
Tue, 28 Jan 2014 11:54:16 +0000 (20:54 +0900)
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
Change-Id: I71d1dc8971af4e3261a6979d9e7dc71ec614927b

data/lowbatt-popup.ini [deleted file]
data/lowmem-popup.ini [deleted file]
data/mmc-popup.ini [deleted file]
data/org.tizen.lowbat-syspopup.png [deleted file]
data/org.tizen.lowmem-syspopup.png [deleted file]
data/org.tizen.poweroff-syspopup.png [deleted file]
data/poweroff-popup.ini [deleted file]
share/common.c [new file with mode: 0755]
share/common.h [new file with mode: 0644]

diff --git a/data/lowbatt-popup.ini b/data/lowbatt-popup.ini
deleted file mode 100644 (file)
index 5abbace..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-[ProcessSetting]
-BG_SCHEDULE=true
diff --git a/data/lowmem-popup.ini b/data/lowmem-popup.ini
deleted file mode 100644 (file)
index 5abbace..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-[ProcessSetting]
-BG_SCHEDULE=true
diff --git a/data/mmc-popup.ini b/data/mmc-popup.ini
deleted file mode 100644 (file)
index 5abbace..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-[ProcessSetting]
-BG_SCHEDULE=true
diff --git a/data/org.tizen.lowbat-syspopup.png b/data/org.tizen.lowbat-syspopup.png
deleted file mode 100755 (executable)
index ef74fd1..0000000
Binary files a/data/org.tizen.lowbat-syspopup.png and /dev/null differ
diff --git a/data/org.tizen.lowmem-syspopup.png b/data/org.tizen.lowmem-syspopup.png
deleted file mode 100755 (executable)
index ef74fd1..0000000
Binary files a/data/org.tizen.lowmem-syspopup.png and /dev/null differ
diff --git a/data/org.tizen.poweroff-syspopup.png b/data/org.tizen.poweroff-syspopup.png
deleted file mode 100755 (executable)
index ef74fd1..0000000
Binary files a/data/org.tizen.poweroff-syspopup.png and /dev/null differ
diff --git a/data/poweroff-popup.ini b/data/poweroff-popup.ini
deleted file mode 100644 (file)
index 5abbace..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-[ProcessSetting]
-BG_SCHEDULE=true
diff --git a/share/common.c b/share/common.c
new file mode 100755 (executable)
index 0000000..dcad9f8
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ *  system-popup
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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 "common.h"
+
+/* Terminate popup */
+static Eina_Bool exit_idler_cb(void *data)
+{
+       elm_exit();
+       return ECORE_CALLBACK_CANCEL;
+}
+
+void popup_terminate(void)
+{
+       if (ecore_idler_add(exit_idler_cb, NULL))
+               return;
+
+       exit_idler_cb(NULL);
+}
+
+int load_normal_popup(struct appdata *ad,
+                       char *title,
+                       char *content,
+                       char *lbtnText,
+                       Evas_Smart_Cb lbtn_cb,
+                       char *rbtnText,
+                       Evas_Smart_Cb rbtn_cb)
+{
+       Evas_Object *lbtn;
+       Evas_Object *rbtn;
+       Ecore_X_Window xwin;
+
+       if (!ad || !(ad->win_main) || !content)
+               return -EINVAL;
+
+       evas_object_show(ad->win_main);
+       ad->popup = elm_popup_add(ad->win_main);
+       evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_object_style_set(ad->popup, "transparent");
+       elm_object_text_set(ad->popup, content);
+
+       if (title) {
+               /* Popup title */
+               elm_object_part_text_set(ad->popup, "title,text", title);
+       }
+
+       if (lbtnText && lbtn_cb) {
+               /* Left button */
+               lbtn = elm_button_add(ad->popup);
+               elm_object_text_set(lbtn, lbtnText);
+               elm_object_part_content_set(ad->popup, "button1", lbtn);
+               evas_object_smart_callback_add(lbtn, "clicked", lbtn_cb, ad);
+       }
+
+       if (rbtnText && rbtn_cb) {
+               /* Right button */
+               rbtn = elm_button_add(ad->popup);
+               elm_object_text_set(rbtn, rbtnText);
+               elm_object_part_content_set(ad->popup, "button2", rbtn);
+               evas_object_smart_callback_add(rbtn, "clicked", rbtn_cb, ad);
+       }
+
+       xwin = elm_win_xwindow_get(ad->popup);
+       ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
+
+       evas_object_show(ad->popup);
+
+       return 0;
+}
+
diff --git a/share/common.h b/share/common.h
new file mode 100644 (file)
index 0000000..c7b5c16
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ *  system-popup
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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 __COMMON_H_
+#define __COMMON_H_
+
+#include <Ecore_X.h>
+#include <appcore-efl.h>
+#include <Elementary.h>
+#include <utilX.h>
+#include <syspopup.h>
+#include <dlog.h>
+
+#undef LOG_TAG
+#define LOG_TAG "SYSTEM_POPUP"
+#define _D(fmt, args...)   SLOGD(fmt, ##args)
+#define _E(fmt, args...)   SLOGE(fmt, ##args)
+#define _I(fmt, args...)   SLOGI(fmt, ##args)
+
+#define FREE(arg) \
+       do { \
+               if(arg) { \
+                       free((void *)arg); \
+                       arg = NULL; \
+               } \
+       } while (0);
+
+struct appdata {
+       /* Common */
+       Evas_Object *win_main;
+       Evas_Object *layout_main;
+       Evas_Object *popup;
+       bundle      *b;
+       syspopup_handler handler;
+
+       /* For poweroff popup */
+       Evas_Object *popup_poweroff;
+       Evas_Object *popup_access;
+       Evas_Object *popup_notification;
+       Evas_Object *popup_chk;
+       Evas_Object *list;
+       Evas_Object *list_access;
+
+       /* For usbotg popup */
+       Evas_Object *storage_added_popup;
+       Evas_Object *storage_unmount_popup;
+       Evas_Object *camera_added_popup;
+       char *storage_added_path;
+       char *storage_unmount_path;
+
+       /* IPC by dbus */
+       E_DBus_Signal_Handler *edbus_handler;
+       E_DBus_Connection     *edbus_conn;
+
+};
+
+void popup_terminate(void);
+int load_normal_popup(struct appdata *ad,
+               char *title,
+               char *content,
+               char *lbtnText,
+               Evas_Smart_Cb lbtn_cb,
+               char *rbtnText,
+               Evas_Smart_Cb rbtn_cb);
+
+
+#endif                         /* __COMMON_H__ */