#include "e.h"
#include "e_mod_main.h"
-static void _e_wizard_next_eval(void);
+static int _e_wizard_next_eval(void);
static E_Popup *_e_wizard_main_new(E_Zone *zone);
static E_Popup *_e_wizard_extra_new(E_Zone *zone);
static void _e_wizard_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event);
static void _e_wizard_cb_next(void *data, Evas_Object *obj, const char *emission, const char *source);
+static Eina_Bool _e_wizard_cb_next_page(void *data);
+static Eina_Bool _e_wizard_cb_desktops_update(void *data, int ev_type, void *ev);
+static Eina_Bool _e_wizard_cb_icons_update(void *data, int ev_type, void *ev);
+
static E_Popup *pop = NULL;
static Eina_List *pops = NULL;
static Evas_Object *o_bg = NULL;
static Eina_List *pages = NULL;
static E_Wizard_Page *curpage = NULL;
static int next_ok = 1;
-static int next_can = 0;
static int next_prev = 0;
+static Eina_Bool no_show = EINA_FALSE;
+static Eina_Bool next_can = EINA_FALSE;
+
+static Eina_List *handlers = NULL;
+static Eina_Bool got_desktops = EINA_FALSE;
+static Eina_Bool got_icons = EINA_FALSE;
+static Eina_Bool next_need_xdg_desktops = EINA_FALSE;
+static Eina_Bool next_need_xdg_icons = EINA_FALSE;
+
+static Ecore_Timer *next_timer = NULL;
EAPI int
e_wizard_init(void)
}
}
}
+
+ E_LIST_HANDLER_APPEND(handlers, EFREET_EVENT_DESKTOP_CACHE_BUILD,
+ _e_wizard_cb_desktops_update, NULL);
+
+ E_LIST_HANDLER_APPEND(handlers, EFREET_EVENT_ICON_CACHE_UPDATE,
+ _e_wizard_cb_icons_update, NULL);
return 1;
}
e_object_del(eo);
EINA_LIST_FREE(pages, pg)
e_wizard_page_del(pg);
+
+ if (next_timer) ecore_timer_del(next_timer);
+ next_timer = NULL;
+ E_FREE_LIST(handlers, ecore_event_handler_del);
return 1;
}
if (pages)
{
curpage = pages->data;
- if (pages->next) next_can = 1;
}
}
if (curpage)
{
- if ((!curpage->data) && (curpage->init)) curpage->init(curpage);
- _e_wizard_next_eval();
+ int next;
+
+ if (curpage->init) curpage->init(curpage, &next_need_xdg_desktops, &next_need_xdg_icons);
+ next = _e_wizard_next_eval();
if ((curpage->show) && (!curpage->show(curpage)))
{
- e_wizard_next();
+ if (next)
+ e_wizard_next();
}
}
}
{
if (eina_list_next(l))
{
+ int next;
if (curpage)
{
if (curpage->hide)
curpage->hide(curpage);
}
curpage = eina_list_data_get(eina_list_next(l));
- if (!curpage->data)
+ next_need_xdg_desktops = EINA_FALSE;
+ next_need_xdg_icons = EINA_FALSE;
+ if (curpage->init)
+ curpage->init(curpage, &next_need_xdg_desktops, &next_need_xdg_icons);
+ no_show = EINA_FALSE;
+ next = _e_wizard_next_eval();
+ if ((curpage->show) && (curpage->show(curpage)))
{
- if (curpage->init)
- curpage->init(curpage);
+ break;
}
- next_can = 1;
- _e_wizard_next_eval();
- if ((curpage->show) && (curpage->show(curpage)))
+ if (!next)
{
+ no_show = EINA_TRUE;
+ /* Advance within 15 secs if no other trigger */
+ next_timer = ecore_timer_add(15.0, _e_wizard_cb_next_page, NULL);
break;
}
}
EAPI E_Wizard_Page *
e_wizard_page_add(void *handle,
- int (*init_cb)(E_Wizard_Page *pg),
+ int (*init_cb)(E_Wizard_Page *pg, Eina_Bool *need_xdg_desktops, Eina_Bool *need_xdg_icons),
int (*shutdown_cb)(E_Wizard_Page *pg),
int (*show_cb)(E_Wizard_Page *pg),
int (*hide_cb)(E_Wizard_Page *pg),
return e_module_dir_get(wiz_module);
}
-static void
+EAPI void
+e_wizard_xdg_desktops_reset(void)
+{
+ got_desktops = EINA_FALSE;
+}
+
+static int
_e_wizard_next_eval(void)
{
int ok;
- ok = next_can;
+ if (next_timer) ecore_timer_del(next_timer);
+ next_timer = NULL;
+
+ ok = 1;
+ if (((next_need_xdg_desktops) && (!got_desktops)) ||
+ ((next_need_xdg_icons) && (!got_icons)))
+ ok = 0;
if (!next_ok) ok = 0;
if (next_prev != ok)
{
if (ok)
- {
- edje_object_part_text_set(o_bg, "e.text.label", _("Next"));
- edje_object_signal_emit(o_bg, "e,state,next,enable", "e");
- }
+ {
+ if (no_show)
+ {
+ /* If we are waiting on a hidden page, continue */
+ e_wizard_next();
+ no_show = EINA_FALSE;
+ ok = -1;
+ }
+ else
+ {
+ edje_object_part_text_set(o_bg, "e.text.label", _("Next"));
+ edje_object_signal_emit(o_bg, "e,state,next,enable", "e");
+ }
+ }
else
- {
- edje_object_part_text_set(o_bg, "e.text.label", _("Please Wait..."));
- edje_object_signal_emit(o_bg, "e,state,next,disable", "e");
- }
+ {
+ edje_object_part_text_set(o_bg, "e.text.label", _("Please Wait..."));
+ edje_object_signal_emit(o_bg, "e,state,next,disable", "e");
+ }
next_prev = ok;
}
+ next_can = ok;
+ return ok;
}
static E_Popup *
static void
_e_wizard_cb_next(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
- e_wizard_next();
+ /* TODO: Disable button in theme */
+ if (next_can)
+ e_wizard_next();
+}
+
+static Eina_Bool
+_e_wizard_cb_next_page(void *data __UNUSED__)
+{
+ next_timer = NULL;
+ next_need_xdg_desktops = EINA_FALSE;
+ next_need_xdg_icons = EINA_FALSE;
+ _e_wizard_next_eval();
+ return ECORE_CALLBACK_CANCEL;
}
+
+static Eina_Bool
+_e_wizard_cb_desktops_update(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
+{
+ got_desktops = EINA_TRUE;
+ _e_wizard_next_eval();
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_wizard_cb_icons_update(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
+{
+ got_icons = EINA_TRUE;
+ _e_wizard_next_eval();
+ return ECORE_CALLBACK_PASS_ON;
+}
{
void *handle;
Evas *evas;
- int (*init) (E_Wizard_Page *pg);
+ int (*init) (E_Wizard_Page *pg, Eina_Bool *need_xdg_desktops, Eina_Bool *need_xdg_icons);
int (*shutdown) (E_Wizard_Page *pg);
int (*show) (E_Wizard_Page *pg);
int (*hide) (E_Wizard_Page *pg);
int (*apply) (E_Wizard_Page *pg);
- void *data;
};
EAPI int e_wizard_init(void);
EAPI void e_wizard_next(void);
EAPI void e_wizard_page_show(Evas_Object *obj);
EAPI E_Wizard_Page *e_wizard_page_add(void *handle,
- int (*init) (E_Wizard_Page *pg),
+ int (*init) (E_Wizard_Page *pg, Eina_Bool *need_xdg_desktops, Eina_Bool *need_xdg_icons),
int (*shutdown) (E_Wizard_Page *pg),
int (*show) (E_Wizard_Page *pg),
int (*hide) (E_Wizard_Page *pg),
EAPI void e_wizard_title_set(const char *title);
EAPI void e_wizard_labels_update(void);
EAPI const char *e_wizard_dir_get(void);
+EAPI void e_wizard_xdg_desktops_reset(void);
#endif
#endif
#include "e.h"
#include "e_mod_main.h"
-static Ecore_Event_Handler *_update_handler = NULL;
static Ecore_Timer *_next_timer = NULL;
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
EAPI int
wizard_page_shutdown(E_Wizard_Page *pg __UNUSED__)
{
- if (_update_handler) ecore_event_handler_del(_update_handler);
- _update_handler = NULL;
if (_next_timer) ecore_timer_del(_next_timer);
_next_timer = NULL;
return 1;
_next_page(void *data __UNUSED__)
{
_next_timer = NULL;
- if (_update_handler) ecore_event_handler_del(_update_handler);
- _update_handler = NULL;
e_wizard_button_next_enable_set(1);
e_wizard_next();
return ECORE_CALLBACK_CANCEL;
}
-static Eina_Bool
-_cb_desktops_update(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
-{
- if (_update_handler) ecore_event_handler_del(_update_handler);
- _update_handler = NULL;
- if (_next_timer) ecore_timer_del(_next_timer);
- _next_timer = ecore_timer_add(2.0, _next_page, NULL);
- return ECORE_CALLBACK_PASS_ON;
-}
-
EAPI int
wizard_page_show(E_Wizard_Page *pg __UNUSED__)
{
e_theme_edje_object_set(o, "base/theme/wizard", "e/wizard/firstpage");
e_wizard_page_show(o);
- _update_handler =
- ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_BUILD,
- _cb_desktops_update, NULL);
-
- /* advance in 15 sec anyway if no efreet update comes */
- _next_timer = ecore_timer_add(15.0, _next_page, NULL);
+ /* advance in 1 sec */
+ _next_timer = ecore_timer_add(1.0, _next_page, NULL);
return 1;
}
}
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
FILE *output;
/* special - language inits its stuff the moment it goes away */
eina_stringshare_del(e_config->language);
e_config->language = eina_stringshare_ref(lang);
- /* TODO: This can trigger a efreet cache rebuild, need to wait until it is done */
+ /* TODO:
+ * This should be on lang select,
+ * so if next page needs xdg we can't press next */
+ e_wizard_xdg_desktops_reset();
e_intl_language_set(e_config->language);
e_wizard_labels_update();
return 1;
}
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
// parse kbd rules here
find_rules();
}
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
#include "e_mod_main.h"
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
#include "e.h"
#include "e_mod_main.h"
-static Ecore_Event_Handler *_update_handler = NULL;
static Ecore_Timer *_next_timer = NULL;
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops, Eina_Bool *need_xdg_icons __UNUSED__)
{
+ *need_xdg_desktops = EINA_TRUE;
return 1;
}
EAPI int
wizard_page_shutdown(E_Wizard_Page *pg __UNUSED__)
{
- if (_update_handler) ecore_event_handler_del(_update_handler);
- _update_handler = NULL;
if (_next_timer) ecore_timer_del(_next_timer);
_next_timer = NULL;
return 1;
_next_page(void *data __UNUSED__)
{
_next_timer = NULL;
- if (_update_handler) ecore_event_handler_del(_update_handler);
- _update_handler = NULL;
e_wizard_button_next_enable_set(1);
e_wizard_next();
return ECORE_CALLBACK_CANCEL;
}
-static Eina_Bool
-_cb_desktops_update(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
-{
- if (_update_handler) ecore_event_handler_del(_update_handler);
- _update_handler = NULL;
- if (_next_timer) ecore_timer_del(_next_timer);
- _next_timer = ecore_timer_add(0.1, _next_page, NULL);
- return ECORE_CALLBACK_PASS_ON;
-}
-
EAPI int
wizard_page_show(E_Wizard_Page *pg __UNUSED__)
{
snprintf(buf, sizeof(buf), "%s/extra_desktops", e_wizard_dir_get());
extra_desks = ecore_file_ls(buf);
- _update_handler =
- ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE,
- _cb_desktops_update, NULL);
-
- /* advance in 15 sec anyway if no efreet update comes */
- _next_timer = ecore_timer_add(15.0, _next_page, NULL);
- if (!extra_desks) return 1;
+ /* advance in 1 sec */
+ _next_timer = ecore_timer_add(1.0, _next_page, NULL);
EINA_LIST_FREE(extra_desks, file)
{
{
if (_next_timer) ecore_timer_del(_next_timer);
_next_timer = NULL;
- if (_update_handler) ecore_event_handler_del(_update_handler);
- _update_handler = NULL;
return 0; /* we didnt copy anything so advance anyway */
}
return 1; /* 1 == show ui, and wait for user, 0 == just continue */
static Eina_List *obs = NULL;
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
static int focus_mode = 1;
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
#include "e_mod_main.h"
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons)
{
+ *need_xdg_icons = EINA_TRUE;
return 1;
}
{
return 1;
}
-
#include "e_mod_main.h"
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops, Eina_Bool *need_xdg_icons __UNUSED__)
{
+ *need_xdg_desktops = EINA_TRUE;
return 1;
}
{
return 1;
}
-
}
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
#endif
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
#endif
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
*/
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
#include "e_mod_main.h"
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
#include "e_mod_main.h"
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
}
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
#include "e_mod_main.h"
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
static int do_up = 1;
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
static int do_tasks = 1;
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}
#include "e_mod_main.h"
EAPI int
-wizard_page_init(E_Wizard_Page *pg __UNUSED__)
+wizard_page_init(E_Wizard_Page *pg __UNUSED__, Eina_Bool *need_xdg_desktops __UNUSED__, Eina_Bool *need_xdg_icons __UNUSED__)
{
return 1;
}