forked from enlightenment/enlightenment
one more todo item being knocked off. but there. also no proper icon for it yet. mostly code from the old taskbar with lots of little things fixed. SVN revision: 64518devs/princeamd/enlightenment-0.17-elive
parent
feecfa36ea
commit
4a76470496
13 changed files with 1832 additions and 26 deletions
@ -0,0 +1,29 @@ |
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MODULE = tasks
|
||||
|
||||
# data files for the module
|
||||
filesdir = $(libdir)/enlightenment/modules/$(MODULE)
|
||||
files_DATA = \
|
||||
e-module-$(MODULE).edj module.desktop |
||||
|
||||
EXTRA_DIST = $(files_DATA)
|
||||
|
||||
# the module .so file
|
||||
INCLUDES = -I. \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/src/modules/$(MODULE) \
|
||||
-I$(top_srcdir)/src/bin \
|
||||
-I$(top_builddir)/src/bin \
|
||||
-I$(top_srcdir)/src/modules \
|
||||
@e_cflags@
|
||||
pkgdir = $(libdir)/enlightenment/modules/$(MODULE)/$(MODULE_ARCH)
|
||||
pkg_LTLIBRARIES = module.la
|
||||
module_la_SOURCES = e_mod_main.c \
|
||||
e_mod_main.h \
|
||||
e_mod_config.c
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
module_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
||||
uninstall: |
||||
rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
|
Binary file not shown.
@ -0,0 +1,104 @@ |
||||
#include <e.h> |
||||
#include "e_mod_main.h" |
||||
|
||||
struct _E_Config_Dialog_Data |
||||
{ |
||||
int show_all; |
||||
int minw, minh; |
||||
}; |
||||
|
||||
/* Protos */ |
||||
static void *_create_data(E_Config_Dialog *cfd); |
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); |
||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); |
||||
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); |
||||
|
||||
void |
||||
_config_tasks_module(Config_Item *ci) |
||||
{ |
||||
E_Config_Dialog *cfd; |
||||
E_Config_Dialog_View *v; |
||||
E_Container *con; |
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1); |
||||
|
||||
v->create_cfdata = _create_data; |
||||
v->free_cfdata = _free_data; |
||||
v->basic.apply_cfdata = _basic_apply_data; |
||||
v->basic.create_widgets = _basic_create_widgets; |
||||
|
||||
con = e_container_current_get(e_manager_current_get()); |
||||
cfd = e_config_dialog_new(con, D_("Tasks Configuration"), "Tasks",
|
||||
"_e_modules_tasks_config_dialog", NULL, 0, v, ci); |
||||
if (tasks_config->config_dialog) |
||||
e_object_del(E_OBJECT(tasks_config->config_dialog)); |
||||
tasks_config->config_dialog = cfd; |
||||
} |
||||
|
||||
static void |
||||
_fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata) |
||||
{ |
||||
cfdata->show_all = ci->show_all; |
||||
cfdata->minw = ci->minw; |
||||
cfdata->minh = ci->minh; |
||||
} |
||||
|
||||
static void * |
||||
_create_data(E_Config_Dialog *cfd) |
||||
{ |
||||
E_Config_Dialog_Data *cfdata; |
||||
Config_Item *ci; |
||||
|
||||
ci = cfd->data; |
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1); |
||||
_fill_data(ci, cfdata); |
||||
return cfdata; |
||||
} |
||||
|
||||
static void |
||||
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) |
||||
{ |
||||
if (!tasks_config) return; |
||||
tasks_config->config_dialog = NULL; |
||||
free(cfdata); |
||||
} |
||||
|
||||
static Evas_Object * |
||||
_basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata) |
||||
{ |
||||
Evas_Object *o, *of, *ob, *ow; |
||||
|
||||
o = e_widget_list_add(evas, 0, 0); |
||||
|
||||
of = e_widget_framelist_add(evas, D_("Display"), 0); |
||||
ob = e_widget_check_add(evas, D_("Show windows from all desktops"), |
||||
&(cfdata->show_all)); |
||||
e_widget_framelist_object_append(of, ob); |
||||
ow = e_widget_label_add(evas, _("Minimum Width")); |
||||
e_widget_framelist_object_append(of, ow); |
||||
ow = e_widget_slider_add(evas, 1, 0, _("%1.0f px"), 20, 420, 1, 0, |
||||
NULL, &(cfdata->minw), 100); |
||||
e_widget_framelist_object_append(of, ow); |
||||
ow = e_widget_label_add(evas, _("Minimum Height")); |
||||
e_widget_framelist_object_append(of, ow); |
||||
ow = e_widget_slider_add(evas, 1, 0, _("%1.0f px"), 20, 420, 1, 0, |
||||
NULL, &(cfdata->minh), 100); |
||||
e_widget_framelist_object_append(of, ow); |
||||
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5); |
||||
return o; |
||||
} |
||||
|
||||
static int |
||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) |
||||
{ |
||||
Config_Item *ci; |
||||
|
||||
ci = cfd->data; |
||||
ci->show_all = cfdata->show_all; |
||||
ci->minw = cfdata->minw; |
||||
ci->minh = cfdata->minh; |
||||
e_config_save_queue(); |
||||
_tasks_config_updated(ci); |
||||
return 1; |
||||
} |
@ -0,0 +1,899 @@ |
||||
#include "e.h" |
||||
#include "e_mod_main.h" |
||||
|
||||
/***************************************************************************/ |
||||
/**/ |
||||
/* gadcon requirements */ |
||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style); |
||||
static void _gc_shutdown(E_Gadcon_Client *gcc); |
||||
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient); |
||||
static char *_gc_label(E_Gadcon_Client_Class *client_class); |
||||
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas); |
||||
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class); |
||||
|
||||
/* and actually define the gadcon class that this module provides (just 1) */ |
||||
static E_Gadcon_Client_Class _gadcon_class = { |
||||
GADCON_CLIENT_CLASS_VERSION, |
||||
"tasks", |
||||
{ |
||||
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, NULL |
||||
}, |
||||
E_GADCON_CLIENT_STYLE_PLAIN |
||||
}; |
||||
/**/ |
||||
/***************************************************************************/ |
||||
/***************************************************************************/ |
||||
/**/ |
||||
/* actual module specifics */ |
||||
|
||||
typedef struct _Tasks Tasks; |
||||
typedef struct _Tasks_Item Tasks_Item; |
||||
|
||||
struct _Tasks |
||||
{ |
||||
E_Gadcon_Client *gcc; // The gadcon client
|
||||
Evas_Object *o_items; // Table of items
|
||||
Eina_List *items; // List of items
|
||||
E_Zone *zone; // Current Zone
|
||||
Config_Item *config; // Configuration
|
||||
int horizontal; |
||||
}; |
||||
|
||||
struct _Tasks_Item |
||||
{ |
||||
Tasks *tasks; // Parent tasks
|
||||
E_Border *border; // The border this item points to
|
||||
Evas_Object *o_item; // The edje theme object
|
||||
Evas_Object *o_icon; // The icon
|
||||
}; |
||||
|
||||
static Tasks *_tasks_new(Evas *evas, E_Zone *zone, const char *id); |
||||
static void _tasks_free(Tasks *tasks); |
||||
static void _tasks_refill(Tasks *tasks); |
||||
static void _tasks_refill_all(); |
||||
static void _tasks_refill_border(E_Border *border); |
||||
static void _tasks_signal_emit(E_Border *border, char *sig, char *src); |
||||
|
||||
static Tasks_Item *_tasks_item_find(Tasks *tasks, E_Border *border); |
||||
static Tasks_Item *_tasks_item_new(Tasks *tasks, E_Border *border); |
||||
|
||||
static int _tasks_item_check_add(Tasks *tasks, E_Border *border); |
||||
static void _tasks_item_add(Tasks *tasks, E_Border *border); |
||||
static void _tasks_item_remove(Tasks_Item *item); |
||||
static void _tasks_item_refill(Tasks_Item *item); |
||||
static void _tasks_item_fill(Tasks_Item *item); |
||||
static void _tasks_item_free(Tasks_Item *item); |
||||
static void _tasks_item_signal_emit(Tasks_Item *item, char *sig, char *src); |
||||
|
||||
static Config_Item *_tasks_config_item_get(const char *id); |
||||
|
||||
static void _tasks_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi); |
||||
static void _tasks_cb_item_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); |
||||
static void _tasks_cb_item_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); |
||||
|
||||
static Eina_Bool _tasks_cb_event_border_add(void *data, int type, void *event); |
||||
static Eina_Bool _tasks_cb_event_border_remove(void *data, int type, void *event); |
||||
static Eina_Bool _tasks_cb_event_border_iconify(void *data, int type, void *event); |
||||
static Eina_Bool _tasks_cb_event_border_uniconify(void *data, int type, void *event); |
||||
static Eina_Bool _tasks_cb_event_border_icon_change(void *data, int type, void *event); |
||||
static Eina_Bool _tasks_cb_event_border_zone_set(void *data, int type, void *event); |
||||
static Eina_Bool _tasks_cb_event_border_desk_set(void *data, int type, void *event); |
||||
static Eina_Bool _tasks_cb_window_focus_in(void *data, int type, void *event); |
||||
static Eina_Bool _tasks_cb_window_focus_out(void *data, int type, void *event); |
||||
static Eina_Bool _tasks_cb_event_border_property(void *data, int type, void *event); |
||||
static Eina_Bool _tasks_cb_event_desk_show(void *data, int type, void *event); |
||||
static Eina_Bool _tasks_cb_event_border_urgent_change(void *data, int type, void *event); |
||||
|
||||
static E_Config_DD *conf_edd = NULL; |
||||
static E_Config_DD *conf_item_edd = NULL; |
||||
|
||||
Config *tasks_config = NULL; |
||||
|
||||
/* module setup */ |
||||
EAPI E_Module_Api e_modapi = |
||||
{ |
||||
E_MODULE_API_VERSION, |
||||
"Tasks" |
||||
}; |
||||
|
||||
EAPI void * |
||||
e_modapi_init(E_Module *m) |
||||
{ |
||||
char buf[4096]; |
||||
|
||||
snprintf(buf, sizeof(buf), "%s/locale", e_module_dir_get(m)); |
||||
bindtextdomain(PACKAGE, buf); |
||||
bind_textdomain_codeset(PACKAGE, "UTF-8"); |
||||
|
||||
conf_item_edd = E_CONFIG_DD_NEW("Tasks_Config_Item", Config_Item); |
||||
|
||||
#undef T |
||||
#undef D |
||||
#define T Config_Item |
||||
#define D conf_item_edd |
||||
E_CONFIG_VAL(D, T, id, STR); |
||||
E_CONFIG_VAL(D, T, show_all, INT); |
||||
E_CONFIG_VAL(D, T, minw, INT); |
||||
E_CONFIG_VAL(D, T, minh, INT); |
||||
|
||||
conf_edd = E_CONFIG_DD_NEW("Tasks_Config", Config); |
||||
|
||||
#undef T |
||||
#undef D |
||||
#define T Config |
||||
#define D conf_edd |
||||
E_CONFIG_LIST(D, T, items, conf_item_edd); |
||||
|
||||
tasks_config = e_config_domain_load("module.tasks", conf_edd); |
||||
if (!tasks_config) |
||||
{ |
||||
Config_Item *config; |
||||
|
||||
tasks_config = E_NEW(Config, 1); |
||||
config = E_NEW(Config_Item, 1); |
||||
config->id = eina_stringshare_add("0"); |
||||
config->show_all = 0; |
||||
config->minw = 80; |
||||
config->minh = 32; |
||||
tasks_config->items = eina_list_append(tasks_config->items, config); |
||||
} |
||||
|
||||
tasks_config->module = m; |
||||
|
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_BORDER_ADD, _tasks_cb_event_border_add, NULL)); |
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_BORDER_REMOVE, _tasks_cb_event_border_remove, NULL)); |
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_BORDER_ICONIFY, _tasks_cb_event_border_iconify, NULL)); |
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_BORDER_UNICONIFY, _tasks_cb_event_border_uniconify, NULL)); |
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_BORDER_ICON_CHANGE, _tasks_cb_event_border_icon_change, NULL)); |
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_BORDER_DESK_SET, _tasks_cb_event_border_desk_set, NULL)); |
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_BORDER_ZONE_SET, _tasks_cb_event_border_zone_set, NULL)); |
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_BORDER_FOCUS_IN, _tasks_cb_window_focus_in, NULL)); |
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_BORDER_FOCUS_OUT, _tasks_cb_window_focus_out, NULL)); |
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_BORDER_PROPERTY, _tasks_cb_event_border_property, NULL)); |
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_DESK_SHOW, _tasks_cb_event_desk_show, NULL)); |
||||
tasks_config->handlers = eina_list_append |
||||
(tasks_config->handlers, ecore_event_handler_add |
||||
(E_EVENT_BORDER_URGENT_CHANGE, _tasks_cb_event_border_urgent_change, NULL)); |
||||
|
||||
tasks_config->borders = eina_list_clone(e_border_client_list()); |
||||
|
||||
e_gadcon_provider_register(&_gadcon_class); |
||||
return m; |
||||
} |
||||
|
||||
EAPI int |
||||
e_modapi_shutdown(E_Module *m) |
||||
{ |
||||
Ecore_Event_Handler *eh; |
||||
Tasks *tasks; |
||||
|
||||
e_gadcon_provider_unregister(&_gadcon_class); |
||||
|
||||
EINA_LIST_FREE(tasks_config->tasks, tasks) |
||||
{ |
||||
_tasks_free(tasks); |
||||
} |
||||
|
||||
if (tasks_config->config_dialog) |
||||
e_object_del(E_OBJECT(tasks_config->config_dialog)); |
||||
|
||||
EINA_LIST_FREE(tasks_config->handlers, eh) |
||||
{ |
||||
ecore_event_handler_del(eh); |
||||
} |
||||
|
||||
eina_list_free(tasks_config->borders); |
||||
|
||||
free(tasks_config); |
||||
tasks_config = NULL; |
||||
E_CONFIG_DD_FREE(conf_item_edd); |
||||
E_CONFIG_DD_FREE(conf_edd); |
||||
return 1; |
||||
} |
||||
|
||||
EAPI int |
||||
e_modapi_save(E_Module *m) |
||||
{ |
||||
e_config_domain_save("module.tasks", conf_edd, tasks_config); |
||||
return 1; |
||||
} |
||||
|
||||
/**************************************************************/ |
||||
|
||||
static E_Gadcon_Client * |
||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) |
||||
{ |
||||
Tasks *tasks; |
||||
Evas_Object *o; |
||||
E_Gadcon_Client *gcc; |
||||
Evas_Coord x, y, w, h; |
||||
int cx, cy, cw, ch; |
||||
|
||||
tasks = _tasks_new(gc->evas, gc->zone, id); |
||||
|
||||
o = tasks->o_items; |
||||
gcc = e_gadcon_client_new(gc, name, id, style, o); |
||||
gcc->data = tasks; |
||||
tasks->gcc = gcc; |
||||
|
||||
e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &cx, &cy, &cw, &ch); |
||||
evas_object_geometry_get(o, &x, &y, &w, &h); |
||||
|
||||
tasks_config->tasks = eina_list_append(tasks_config->tasks, tasks); |
||||
|
||||
// Fill on initial config
|
||||
_tasks_config_updated(tasks->config); |
||||
|
||||
return gcc; |
||||
} |
||||
|
||||
static void |
||||
_gc_shutdown(E_Gadcon_Client *gcc) |
||||
{ |
||||
Tasks *tasks; |
||||
|
||||
tasks = (Tasks *)gcc->data; |
||||
tasks_config->tasks = eina_list_remove(tasks_config->tasks, tasks); |
||||
_tasks_free(tasks); |
||||
} |
||||
|
||||
/* TODO */ |
||||
static void |
||||
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient) |
||||
{ |
||||
Tasks *tasks; |
||||
|
||||
tasks = (Tasks *)gcc->data; |
||||
|
||||
switch (orient) |
||||
{ |
||||
case E_GADCON_ORIENT_FLOAT: |
||||
case E_GADCON_ORIENT_HORIZ: |
||||
case E_GADCON_ORIENT_TOP: |
||||
case E_GADCON_ORIENT_BOTTOM: |
||||
case E_GADCON_ORIENT_CORNER_TL: |
||||
case E_GADCON_ORIENT_CORNER_TR: |
||||
case E_GADCON_ORIENT_CORNER_BL: |
||||
case E_GADCON_ORIENT_CORNER_BR: |
||||
if (!tasks->horizontal) |
||||
{ |
||||
tasks->horizontal = 1; |
||||
e_box_orientation_set(tasks->o_items, tasks->horizontal); |
||||
_tasks_refill(tasks); |
||||
} |
||||
break; |
||||
case E_GADCON_ORIENT_VERT: |
||||
case E_GADCON_ORIENT_LEFT: |
||||
case E_GADCON_ORIENT_RIGHT: |
||||
case E_GADCON_ORIENT_CORNER_LT: |
||||
case E_GADCON_ORIENT_CORNER_RT: |
||||
case E_GADCON_ORIENT_CORNER_LB: |
||||
case E_GADCON_ORIENT_CORNER_RB: |
||||
if (tasks->horizontal) |
||||
{ |
||||
tasks->horizontal = 0; |
||||
e_box_orientation_set(tasks->o_items, tasks->horizontal); |
||||
_tasks_refill(tasks); |
||||
} |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
e_box_align_set(tasks->o_items, 0.5, 0.5); |
||||
} |
||||
|
||||
static char * |
||||
_gc_label(E_Gadcon_Client_Class *client_class) |
||||
{ |
||||
return D_("Tasks"); |
||||
} |
||||
|
||||
static Evas_Object * |
||||
_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas) |
||||
{ |
||||
Evas_Object *o; |
||||