+static int __compare_event(void *prev_event, void *curr_event, int type)
+{
+ char *curr_strval;
+ char *prev_strval;
+ int curr_intval;
+ int prev_intval;
+ int ret = -1;
+
+ switch (type) {
+ case APPCORE_BASE_EVENT_LOW_MEMORY:
+ case APPCORE_BASE_EVENT_LOW_BATTERY:
+ case APPCORE_BASE_EVENT_DEVICE_ORIENTATION_CHANGED:
+ case APPCORE_BASE_EVENT_SUSPENDED_STATE_CHANGE:
+ prev_intval = GPOINTER_TO_INT(prev_event);
+ curr_intval = *(int *)curr_event;
+ if (prev_intval == curr_intval)
+ ret = 0;
+ break;
+ case APPCORE_BASE_EVENT_LANG_CHANGE:
+ case APPCORE_BASE_EVENT_REGION_CHANGE:
+ prev_strval = prev_event;
+ curr_strval = curr_event;
+ if (prev_strval && curr_strval &&
+ !strcmp(prev_strval, curr_strval))
+ ret = 0;
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+static void __unset_prev_event(void **prev_event, int type)
+{
+ if (type == APPCORE_BASE_EVENT_LANG_CHANGE ||
+ type == APPCORE_BASE_EVENT_REGION_CHANGE)
+ free(*prev_event);
+ *prev_event = NULL;
+}
+
+static void __set_prev_event(void **prev_event, void *curr_event, int type)
+{
+ int curr_intval;
+ char *curr_strval;
+
+ switch (type) {
+ case APPCORE_BASE_EVENT_LOW_MEMORY:
+ case APPCORE_BASE_EVENT_LOW_BATTERY:
+ case APPCORE_BASE_EVENT_DEVICE_ORIENTATION_CHANGED:
+ case APPCORE_BASE_EVENT_SUSPENDED_STATE_CHANGE:
+ curr_intval = *(int *)curr_event;
+ *prev_event = GINT_TO_POINTER(curr_intval);
+ break;
+ case APPCORE_BASE_EVENT_LANG_CHANGE:
+ case APPCORE_BASE_EVENT_REGION_CHANGE:
+ curr_strval = curr_event;
+ if (curr_strval)
+ *prev_event = strdup(curr_strval);
+ break;
+ default:
+ break;
+ }
+}