elementary: add policy for elm exit
authorBruno Dilly <bdilly@profusion.mobi>
Tue, 2 Oct 2012 17:06:11 +0000 (17:06 +0000)
committerBruno Dilly <bdilly@profusion.mobi>
Tue, 2 Oct 2012 17:06:11 +0000 (17:06 +0000)
With ELM_POLICY_EXIT it's possible to request elementary
to delete all the windows before shutdown instead of just
quitting the main loop.

SVN revision: 77328

src/lib/elm_general.h
src/lib/elm_main.c

index ac751c7..3946b68 100644 (file)
@@ -77,6 +77,9 @@ typedef enum
                      * should quit automatically. @see
                      * Elm_Policy_Quit.
                      */
+   ELM_POLICY_EXIT, /**< defines elm_exit() behaviour. @see Elm_Policy_Exit.
+                     * @since 1.8
+                     */
    ELM_POLICY_LAST
 } Elm_Policy; /**< Elementary policy identifiers/groups enumeration.  @see elm_policy_set() */
 
@@ -91,6 +94,13 @@ typedef enum
 
 typedef enum
 {
+   ELM_POLICY_EXIT_NONE = 0, /**< just quit the main loop on elm_exit() */
+   ELM_POLICY_EXIT_WINDOWS_DEL /**< delete all the windows after quitting
+                                * the main loop */
+} Elm_Policy_Exit; /**< Possible values for the #ELM_POLICY_EXIT policy */
+
+typedef enum
+{
    ELM_FOCUS_PREVIOUS,
    ELM_FOCUS_NEXT
 } Elm_Focus_Direction;
index 11e9083..3e4dd17 100644 (file)
@@ -847,6 +847,15 @@ EAPI void
 elm_exit(void)
 {
    ecore_main_loop_quit();
+
+   if (elm_policy_get(ELM_POLICY_EXIT) == ELM_POLICY_EXIT_WINDOWS_DEL)
+     {
+        Eina_List *l, *l_next;
+        Evas_Object *win;
+
+        EINA_LIST_FOREACH_SAFE(_elm_win_list, l, l_next, win)
+           evas_object_del(win);
+     }
 }
 
 //FIXME: Use Elm_Policy Parameter when 2.0 is released.