e_mod_pol_pingpong: code cleanup
[platform/core/uifw/e-mod-tizen-wm-policy.git] / src / e_mod_pol_pingpong.c
index 154c2d7..29d870e 100644 (file)
@@ -65,6 +65,18 @@ _pp_win_find(E_Client *ec)
    return NULL;
 }
 
+static void
+_pp_win_remove(E_Client *ec)
+{
+   PP_Win *ppw = NULL;
+
+   ppw = _pp_win_find(ec);
+   if (!ppw) return;
+
+   _pp_wins = eina_list_remove(_pp_wins, ppw);
+   _pp_win_del(ppw);
+}
+
 static Eina_Bool
 _cb_pong_check(void *data)
 {
@@ -188,15 +200,10 @@ _cb_client_hide(void *data EINA_UNUSED,
                 int type EINA_UNUSED,
                 void *event)
 {
-   PP_Win *ppw = NULL;
    E_Event_Client *ev = (E_Event_Client *)event;
-   E_Client *ec = ev->ec;
-
-   ppw = _pp_win_find(ec);
-   if (!ppw) return ECORE_CALLBACK_PASS_ON;
 
-   _pp_wins = eina_list_remove(_pp_wins, ppw);
-   _pp_win_del(ppw);
+   if (ev->ec)
+     _pp_win_remove(ev->ec);
 
    return ECORE_CALLBACK_PASS_ON;
 }
@@ -206,15 +213,10 @@ _cb_client_del(void *data EINA_UNUSED,
                int type EINA_UNUSED,
                void *event)
 {
-   PP_Win *ppw = NULL;
    E_Event_Client *ev = (E_Event_Client *)event;
-   E_Client *ec = ev->ec;
-
-   ppw = _pp_win_find(ec);
-   if (!ppw) return ECORE_CALLBACK_PASS_ON;
 
-   _pp_wins = eina_list_remove(_pp_wins, ppw);
-   _pp_win_del(ppw);
+   if (ev->ec)
+     _pp_win_remove(ev->ec);
 
    return ECORE_CALLBACK_PASS_ON;
 }