Recreate new home windows on initial load (this handles dual mode also).
authorChristopher Michael <cpmichael1@comcast.net>
Wed, 13 Jan 2010 23:40:23 +0000 (23:40 +0000)
committerChristopher Michael <cpmichael1@comcast.net>
Wed, 13 Jan 2010 23:40:23 +0000 (23:40 +0000)
Rework/Re-implement busycover windows per home window so we can show
launching status.

SVN revision: 45097

src/modules/illume-home/Makefile.am
src/modules/illume-home/e-module-illume-home.edj
src/modules/illume-home/e_busycover.c
src/modules/illume-home/e_busycover.h
src/modules/illume-home/e_mod_main.c

index 3a7f922..35bbe3e 100644 (file)
@@ -20,10 +20,10 @@ pkgdir                 = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH
 pkg_LTLIBRARIES        = module.la
 module_la_SOURCES      = e_mod_main.c \
                          e_mod_main.h \
-                         e_busycover.c \
-                         e_busycover.h \
                          e_mod_config.c \
-                         e_mod_config.h
+                         e_mod_config.h \
+                         e_busycover.c \
+                         e_busycover.h
 
 module_la_LIBADD       = @e_libs@ @dlopen_libs@
 module_la_LDFLAGS      = -module -avoid-version
index 6cbd557..f6dc609 100644 (file)
Binary files a/src/modules/illume-home/e-module-illume-home.edj and b/src/modules/illume-home/e-module-illume-home.edj differ
index fcce848..310a6f2 100644 (file)
 #include "e.h"
 #include "e_busycover.h"
+#include "e_mod_config.h"
 
 /* local function prototypes */
-static void _e_busycover_cb_free(E_Busycover *esw);
-static void _e_busycover_win_cb_resize(E_Win *win);
-static int _e_busycover_zone_cb_move_resize(void *data, int type, void *event);
-static Evas_Object *_theme_obj_new(Evas *evas, const char *custom_dir, const char *group);
-
-/* local variables */
-static Eina_List *busycovers = NULL;
-
-/* public functions */
-EAPI int 
-e_busycover_init(void) 
-{
-   return 1;
-}
-
-EAPI int 
-e_busycover_shutdown(void) 
-{
-   return 1;
-}
+static void _e_busycover_cb_free(E_Busycover *cover);
 
 EAPI E_Busycover *
-e_busycover_new(E_Zone *zone, const char *themedir
+e_busycover_new(E_Win *win
 {
-   E_Busycover *esw;
-   Ecore_X_Window_State states[2];
-
-   esw = E_OBJECT_ALLOC(E_Busycover, E_BUSYCOVER_TYPE, _e_busycover_cb_free);
-   if (!esw) return NULL;
-
-   esw->zone = zone;
-   if (themedir) esw->themedir = eina_stringshare_add(themedir);
-
-   esw->win = e_win_new(zone->container);
-   esw->win->data = esw;
-   states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
-   states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
-   e_win_title_set(esw->win, _("Illume Busycover"));
-   e_win_name_class_set(esw->win, "Illume-Busycover", "Illume-Busycover");
-   e_win_resize_callback_set(esw->win, _e_busycover_win_cb_resize);
-   ecore_x_icccm_hints_set(esw->win->evas_win, 0, 0, 0, 0, 0, 0, 0);
-   ecore_x_netwm_window_state_set(esw->win->evas_win, states, 2);
-   ecore_x_netwm_window_type_set(esw->win->evas_win, ECORE_X_WINDOW_TYPE_SPLASH);
-
-   esw->o_base = _theme_obj_new(e_win_evas_get(esw->win), esw->themedir, 
-                                "modules/illume-home/busycover/default");
-   evas_object_move(esw->o_base, 0, 0);
-   evas_object_show(esw->o_base);
-   edje_object_part_text_set(esw->o_base, "e.text.title", "LOADING");
-
-   ecore_evas_alpha_set(esw->win->ecore_evas, 1);
-
-   busycovers = eina_list_append(busycovers, esw);
-
-   esw->handlers = 
-     eina_list_append(esw->handlers, 
-                      ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE, 
-                                              _e_busycover_zone_cb_move_resize, 
-                                              esw));
-   return esw;
+   E_Busycover *cover;
+   char buff[PATH_MAX];
+
+   cover = E_OBJECT_ALLOC(E_Busycover, E_BUSYCOVER_TYPE, _e_busycover_cb_free);
+   if (!cover) return NULL;
+   snprintf(buff, sizeof(buff), "%s/e-module-illume-home.edj", 
+            il_home_cfg->mod_dir);
+
+   cover->o_base = edje_object_add(e_win_evas_get(win));
+   if (!e_theme_edje_object_set(cover->o_base, 
+                                "base/theme/modules/illume-home", 
+                                "modules/illume-home/busycover")) 
+     edje_object_file_set(cover->o_base, buff, "modules/illume-home/busycover");
+   edje_object_part_text_set(cover->o_base, "e.text.title", _("LOADING"));
+   evas_object_move(cover->o_base, win->x, win->y);
+   evas_object_resize(cover->o_base, win->w, win->h);
+   evas_object_layer_set(cover->o_base, 999);
+   return cover;
 }
 
 EAPI E_Busycover_Handle *
-e_busycover_push(E_Busycover *esw, const char *msg, const char *icon) 
+e_busycover_push(E_Busycover *cover, const char *msg, const char *icon) 
 {
-   E_Busycover_Handle *h;
-
-   E_OBJECT_CHECK(esw);
-   E_OBJECT_TYPE_CHECK_RETURN(esw, E_BUSYCOVER_TYPE, NULL);
-   h = E_NEW(E_Busycover_Handle, 1);
-   h->busycover = esw;
-   if (msg) h->msg = eina_stringshare_add(msg);
-   if (icon) h->icon = eina_stringshare_add(icon);
-   esw->handles = eina_list_prepend(esw->handles, h);
-   edje_object_part_text_set(esw->o_base, "e.text.label", h->msg);
-   /* FIXME: handle icon */
-
-   e_win_layer_set(esw->win, 9999);
-   e_win_show(esw->win);
-   e_border_zone_set(esw->win->border, esw->zone);
-
-//   evas_object_show(esw->o_base);
-//   evas_object_raise(esw->o_base);
-   return h;
+   E_Busycover_Handle *handle;
+
+   E_OBJECT_CHECK(cover);
+   E_OBJECT_TYPE_CHECK_RETURN(cover, E_BUSYCOVER_TYPE, NULL);
+
+   handle = E_NEW(E_Busycover_Handle, 1);
+   handle->cover = cover;
+   if (msg) handle->msg = eina_stringshare_add(msg);
+   if (icon) handle->icon = eina_stringshare_add(icon);
+   cover->handles = eina_list_append(cover->handles, handle);
+   edje_object_part_text_set(cover->o_base, "e.text.title", msg);
+   evas_object_show(cover->o_base);
+   return handle;
 }
 
 EAPI void 
-e_busycover_pop(E_Busycover *esw, E_Busycover_Handle *handle) 
+e_busycover_pop(E_Busycover *cover, E_Busycover_Handle *handle) 
 {
-   E_OBJECT_CHECK(esw);
-   E_OBJECT_TYPE_CHECK(esw, E_BUSYCOVER_TYPE);
-   if (!eina_list_data_find(esw->handles, handle)) return;
-   esw->handles = eina_list_remove(esw->handles, handle);
+   E_OBJECT_CHECK(cover);
+   E_OBJECT_TYPE_CHECK(cover, E_BUSYCOVER_TYPE);
+   if (!eina_list_data_find(cover->handles, handle)) return;
+   cover->handles = eina_list_remove(cover->handles, handle);
    if (handle->msg) eina_stringshare_del(handle->msg);
    if (handle->icon) eina_stringshare_del(handle->icon);
    E_FREE(handle);
-   if (esw->handles) 
+   if (cover->handles) 
      {
-        handle = esw->handles->data;
-        edje_object_part_text_set(esw->o_base, "e.text.label", handle->msg);
+        handle = cover->handles->data;
+        edje_object_part_text_set(cover->o_base, "e.text.title", handle->msg);
      }
    else 
-     e_object_del(E_OBJECT(esw));
+     evas_object_hide(cover->o_base);
 }
 
-/* local functions */
-static void 
-_e_busycover_cb_free(E_Busycover *esw) 
+EAPI void 
+e_busycover_resize(E_Busycover *cover, int w, int h) 
 {
-   Ecore_Event_Handler *handle;
-
-   if (esw->o_base) evas_object_del(esw->o_base);
-   e_object_del(E_OBJECT(esw->win));
-   esw->win = NULL;
-   busycovers = eina_list_remove(busycovers, esw);
-   EINA_LIST_FREE(esw->handlers, handle)
-     ecore_event_handler_del(handle);
-   if (esw->themedir) eina_stringshare_del(esw->themedir);
-   E_FREE(esw);
+   E_OBJECT_CHECK(cover);
+   E_OBJECT_TYPE_CHECK(cover, E_BUSYCOVER_TYPE);
+   evas_object_resize(cover->o_base, w, h);
 }
 
+/* local function prototypes */
 static void 
-_e_busycover_win_cb_resize(E_Win *win) 
-{
-   E_Busycover *esw;
-
-   if (!(esw = win->data)) return;
-   evas_object_resize(esw->o_base, win->w, win->h);
-}
-
-static int 
-_e_busycover_zone_cb_move_resize(void *data, int type, void *event) 
-{
-   E_Event_Zone_Move_Resize *ev;
-   E_Busycover *esw;
-
-   ev = event;
-   esw = data;
-   if (esw->zone == ev->zone) 
-     {
-        int x, y, w, h;
-
-        e_zone_useful_geometry_get(esw->zone, &x, &y, &w, &h);
-        e_win_move_resize(esw->win, x, y, w, h);
-     }
-   return 1;
-}
-
-static Evas_Object *
-_theme_obj_new(Evas *evas, const char *custom_dir, const char *group) 
+_e_busycover_cb_free(E_Busycover *cover) 
 {
-   Evas_Object *o;
-
-   o = edje_object_add(evas);
-   if (!e_theme_edje_object_set(o, "base/theme/modules/illume-home", group)) 
-     {
-        if (custom_dir) 
-          {
-             char buff[PATH_MAX];
-
-             snprintf(buff, sizeof(buff), "%s/e-module-illume-home.edj", 
-                      custom_dir);
-             edje_object_file_set(o, buff, group);
-          }
-     }
-   return o;
+   if (cover->o_base) evas_object_del(cover->o_base);
+   E_FREE(cover);
 }
-
index e307e0f..35e0849 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef E_BUSYCOVER_H
-#define E_BUSYCOVER_H
+# define E_BUSYCOVER_H
 
-#define E_BUSYCOVER_TYPE 0xE1b0782
+# define E_BUSYCOVER_TYPE 0xE1b0782
 
 typedef struct _E_Busycover E_Busycover;
 typedef struct _E_Busycover_Handle E_Busycover_Handle;
@@ -9,23 +9,18 @@ typedef struct _E_Busycover_Handle E_Busycover_Handle;
 struct _E_Busycover 
 {
    E_Object e_obj_inherit;
-   E_Zone *zone;
-   E_Win *win;
    Evas_Object *o_base;
-   Eina_List *handlers, *handles;
-   const char *themedir;
+   Eina_List *handles;
 };
-
 struct _E_Busycover_Handle 
 {
-   E_Busycover *busycover;
+   E_Busycover *cover;
    const char *msg, *icon;
 };
 
-EAPI int e_busycover_init(void);
-EAPI int e_busycover_shutdown(void);
-EAPI E_Busycover *e_busycover_new(E_Zone *zone, const char *themedir);
-EAPI E_Busycover_Handle *e_busycover_push(E_Busycover *esw, const char *msg, const char *icon);
-EAPI void e_busycover_pop(E_Busycover *esw, E_Busycover_Handle *handle);
+EAPI E_Busycover *e_busycover_new(E_Win *win);
+EAPI E_Busycover_Handle *e_busycover_push(E_Busycover *cover, const char *msg, const char *icon);
+EAPI void e_busycover_pop(E_Busycover *cover, E_Busycover_Handle *handle);
+EAPI void e_busycover_resize(E_Busycover *cover, int w, int h);
 
 #endif
index b3cdf93..d3c5a23 100644 (file)
@@ -22,16 +22,16 @@ struct _Il_Home_Win
    E_Object e_obj_inherit;
 
    E_Win *win;
-   Evas_Object *o_bg, *o_sf, *o_fm;
+   Evas_Object *o_bg, *o_sf, *o_fm, *o_cover;
    E_Busycover *cover;
 };
 struct _Il_Home_Exec 
 {
+   E_Busycover *cover;
    Efreet_Desktop *desktop;
    Ecore_Exe *exec;
    E_Border *border;
    Ecore_Timer *timeout;
-   E_Busycover *cover;
    int startup_id;
    pid_t pid;
    void *handle;
@@ -95,8 +95,6 @@ e_modapi_init(E_Module *m)
    _il_home_apps_unpopulate();
    _il_home_apps_populate();
 
-   e_busycover_init();
-
    handlers = 
      eina_list_append(handlers, 
                       ecore_event_handler_add(EFREET_EVENT_DESKTOP_LIST_CHANGE, 
@@ -145,14 +143,11 @@ e_modapi_shutdown(E_Module *m)
              exe->handle = NULL;
           }
         if (exe->timeout) ecore_timer_del(exe->timeout);
-        exe->cover = NULL;
         E_FREE(exe);
      }
 
    _il_home_apps_unpopulate();
 
-   e_busycover_shutdown();
-
    EINA_LIST_FREE(handlers, handle)
      ecore_event_handler_del(handle);
 
@@ -192,18 +187,18 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
    inst->o_btn = e_widget_button_add(gc->evas, NULL, NULL, 
                                      _il_home_btn_cb_click, inst, NULL);
    icon = e_icon_add(evas_object_evas_get(inst->o_btn));
-   e_icon_file_edje_set(icon, buff, "btn_icon");
+   e_icon_file_edje_set(icon, buff, "icon");
    e_widget_button_icon_set(inst->o_btn, icon);
 
    inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_btn);
    inst->gcc->data = inst;
 
-//   _il_home_win_new(inst);
+   _il_home_win_new(inst);
 
    xwin = inst->gcc->gadcon->zone->black_win;
    mode = ecore_x_e_illume_mode_get(xwin);
-//   if (mode > ECORE_X_ILLUME_MODE_SINGLE)
-//     _il_home_win_new(inst);
+   if (mode > ECORE_X_ILLUME_MODE_SINGLE)
+     _il_home_win_new(inst);
 
    inst->hdl = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, 
                                        _il_home_cb_client_message, inst);
@@ -305,12 +300,6 @@ _il_home_win_new(Instance *inst)
    e_win_name_class_set(hwin->win, "Illume-Home", "Illume-Home");
    e_win_resize_callback_set(hwin->win, _il_home_win_cb_resize);
 
-   if (!hwin->cover) 
-     {
-        hwin->cover = 
-          e_busycover_new(inst->gcc->gadcon->zone, il_home_cfg->mod_dir);
-     }
-
    snprintf(buff, sizeof(buff), "%s/e-module-illume-home.edj", 
             il_home_cfg->mod_dir);
 
@@ -347,6 +336,8 @@ _il_home_win_new(Instance *inst)
    evas_object_smart_callback_add(hwin->o_fm, "selected", 
                                   _il_home_cb_selected, hwin);
 
+   hwin->cover = e_busycover_new(hwin->win);
+
    e_win_move_resize(hwin->win, zone->x, zone->y, zone->w, 100);
    e_win_show(hwin->win);
    e_border_zone_set(hwin->win->border, zone);
@@ -362,6 +353,10 @@ _il_home_win_cb_free(Il_Home_Win *hwin)
 {
    if (hwin->win->evas_win)
      e_drop_xdnd_register_set(hwin->win->evas_win, 0);
+
+   if (hwin->cover) e_object_del(E_OBJECT(hwin->cover));
+   hwin->cover = NULL;
+
    if (hwin->o_bg) evas_object_del(hwin->o_bg);
    hwin->o_bg = NULL;
    if (hwin->o_sf) evas_object_del(hwin->o_sf);
@@ -401,6 +396,11 @@ _il_home_win_cb_resize(E_Win *win)
         if (hwin->win)
           evas_object_resize(hwin->o_sf, hwin->win->w, hwin->win->h);
      }
+   if (hwin->cover) 
+     {
+        if (hwin->win)
+          e_busycover_resize(hwin->cover, hwin->win->w, hwin->win->h);
+     }
 }
 
 static void 
@@ -492,6 +492,7 @@ _il_home_desktop_run(Il_Home_Win *hwin, Efreet_Desktop *desktop)
 
    exe = E_NEW(Il_Home_Exec, 1);
    if (!exe) return;
+   exe->cover = hwin->cover;
 
    eins = e_exec(hwin->win->border->zone, desktop, NULL, NULL, "illume-home");
    exe->desktop = desktop;
@@ -504,10 +505,8 @@ _il_home_desktop_run(Il_Home_Win *hwin, Efreet_Desktop *desktop)
      }
 
    exe->timeout = ecore_timer_add(20.0, _il_home_win_cb_timeout, exe);
-   exe->cover = hwin->cover;
    snprintf(buff, sizeof(buff), "Starting %s", desktop->name);
-   exe->handle = e_busycover_push(exe->cover, buff, NULL);
-
+   exe->handle = e_busycover_push(hwin->cover, buff, NULL);
    exes = eina_list_append(exes, exe);
 }
 
@@ -679,7 +678,6 @@ _il_home_win_cb_exe_del(void *data, int type, void *event)
                }
              exes = eina_list_remove_list(exes, l);
              if (exe->timeout) ecore_timer_del(exe->timeout);
-             exe->cover = NULL;
              E_FREE(exe);
              return 1;
           }
@@ -751,8 +749,11 @@ _il_home_win_cb_timeout(void *data)
    Il_Home_Exec *exe;
 
    if (!(exe = data)) return 1;
-   if (exe->handle) e_busycover_pop(exe->cover, exe->handle);
-   exe->handle = NULL;
+   if (exe->handle) 
+     {
+        e_busycover_pop(exe->cover, exe->handle);
+        exe->handle = NULL;
+     }
    if (!exe->border) 
      {
         exes = eina_list_remove(exes, exe);