This allows to have shelfs only on specified desktops. Someone might want to add a nice hide/show animation...

SVN revision: 31619
This commit is contained in:
Miculcy Brian 2007-09-04 23:59:01 +00:00
parent 485417d47a
commit aed16d2e23
5 changed files with 196 additions and 12 deletions

View File

@ -39,6 +39,7 @@ static E_Config_DD *_e_config_color_class_edd = NULL;
static E_Config_DD *_e_config_gadcon_edd = NULL;
static E_Config_DD *_e_config_gadcon_client_edd = NULL;
static E_Config_DD *_e_config_shelf_edd = NULL;
static E_Config_DD *_e_config_shelf_desk_edd = NULL;
static E_Config_DD *_e_config_mime_icon_edd = NULL;
EAPI int E_EVENT_CONFIG_ICON_THEME = 0;
@ -108,6 +109,14 @@ e_config_init(void)
E_CONFIG_VAL(D, T, name, STR);
E_CONFIG_VAL(D, T, id, STR);
E_CONFIG_LIST(D, T, clients, _e_config_gadcon_client_edd);
_e_config_shelf_desk_edd = E_CONFIG_DD_NEW("E_Config_Shelf_Desk", E_Config_Shelf_Desk);
#undef T
#undef D
#define T E_Config_Shelf_Desk
#define D _e_config_shelf_desk_edd
E_CONFIG_VAL(D, T, x, INT);
E_CONFIG_VAL(D, T, y, INT);
_e_config_shelf_edd = E_CONFIG_DD_NEW("E_Config_Shelf", E_Config_Shelf);
#undef T
@ -129,7 +138,9 @@ e_config_init(void)
E_CONFIG_VAL(D, T, autohide_show_action, INT);
E_CONFIG_VAL(D, T, hide_timeout, FLOAT);
E_CONFIG_VAL(D, T, hide_duration, FLOAT);
E_CONFIG_VAL(D, T, desk_show_mode, INT);
E_CONFIG_LIST(D, T, desk_list, _e_config_shelf_desk_edd);
_e_config_desktop_bg_edd = E_CONFIG_DD_NEW("E_Config_Desktop_Background", E_Config_Desktop_Background);
#undef T
#undef D
@ -1220,7 +1231,7 @@ e_config_init(void)
{
E_Config_Shelf *cf_es;
#define CFG_SHELF(_name, _con, _zone, _pop, _lay, _orient, _fita, _fits, _style, _size, _overlap, _autohide, _autohide_show_action, _hide_timeout, _hide_duration) \
#define CFG_SHELF(_name, _con, _zone, _pop, _lay, _orient, _fita, _fits, _style, _size, _overlap, _autohide, _autohide_show_action, _hide_timeout, _hide_duration, _desk_show_mode, _desk_list) \
cf_es = E_NEW(E_Config_Shelf, 1); \
cf_es->name = evas_stringshare_add(_name); \
cf_es->container = _con; \
@ -1237,30 +1248,32 @@ e_config_init(void)
cf_es->autohide_show_action = _autohide_show_action; \
cf_es->hide_timeout = _hide_timeout; \
cf_es->hide_duration = _hide_duration; \
cf_es->desk_show_mode = _desk_show_mode; \
cf_es->desk_list = evas_list_append(cf_es->desk_list, cf_es); \
e_config->shelves = evas_list_append(e_config->shelves, cf_es)
/* shelves for 4 zones on head 0 by default */
CFG_SHELF("shelf", 0, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0);
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
CFG_SHELF("shelf", 0, 1,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0);
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
CFG_SHELF("shelf", 0, 2,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0);
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
CFG_SHELF("shelf", 0, 3,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0);
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
/* shelves for heada 1, 2, and 3 by default */
CFG_SHELF("shelf", 1, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0);
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
CFG_SHELF("shelf", 2, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0);
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
CFG_SHELF("shelf", 3, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0);
1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL);
}
IFCFGEND;
@ -1633,6 +1646,7 @@ e_config_shutdown(void)
E_CONFIG_DD_FREE(_e_config_gadcon_edd);
E_CONFIG_DD_FREE(_e_config_gadcon_client_edd);
E_CONFIG_DD_FREE(_e_config_shelf_edd);
E_CONFIG_DD_FREE(_e_config_shelf_desk_edd);
return 1;
}

View File

@ -37,6 +37,7 @@ typedef struct _E_Config_Desktop_Name E_Config_Desktop_Name;
typedef struct _E_Config_Gadcon E_Config_Gadcon;
typedef struct _E_Config_Gadcon_Client E_Config_Gadcon_Client;
typedef struct _E_Config_Shelf E_Config_Shelf;
typedef struct _E_Config_Shelf_Desk E_Config_Shelf_Desk;
typedef struct _E_Config_Mime_Icon E_Config_Mime_Icon;
typedef struct _E_Event_Config_Icon_Theme E_Event_Config_Icon_Theme;
@ -412,6 +413,13 @@ struct _E_Config_Shelf
int autohide_show_action;
float hide_timeout;
float hide_duration;
int desk_show_mode;
Evas_List *desk_list;
};
struct _E_Config_Shelf_Desk
{
int x, y;
};
struct _E_Config_Mime_Icon

View File

@ -200,6 +200,7 @@ e_desk_show(E_Desk *desk)
E_Border_List *bl;
E_Border *bd;
E_Event_Desk_Show *ev;
Evas_List *l;
int was_zone = 0;
int x, y, dx = 0, dy = 0;
@ -275,6 +276,33 @@ e_desk_show(E_Desk *desk)
ev->desk = desk;
e_object_ref(E_OBJECT(desk));
ecore_event_add(E_EVENT_DESK_SHOW, ev, _e_border_event_desk_show_free, NULL);
for (l = e_shelf_list(); l; l = l->next)
{
Evas_List *ll;
E_Shelf *es;
int show_shelf=0;
es = l->data;
if (!es->cfg->desk_show_mode) continue;
for (ll = es->cfg->desk_list; ll; ll = ll->next)
{
E_Config_Shelf_Desk *sd;
sd = ll->data;
if (!sd) continue;
if ((desk->x == sd->x) && (desk->y == sd->y))
{
show_shelf=1;
break;
}
}
if (show_shelf)
e_shelf_show (es);
else
e_shelf_hide (es);
}
}
EAPI void

View File

@ -39,6 +39,11 @@ struct _E_Config_Dialog_Data
int autohiding_show_action;
double hide_timeout;
double hide_duration;
int desk_show_mode;
Evas_List *desk_list;
Evas_Object *desk_sel_list;
};
/* a nice easy setup function that does the dirty work */
@ -123,6 +128,8 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->autohiding_show_action = cfdata->escfg->autohide_show_action;
cfdata->hide_timeout = cfdata->escfg->hide_timeout;
cfdata->hide_duration = cfdata->escfg->hide_duration;
cfdata->desk_show_mode = cfdata->escfg->desk_show_mode;
cfdata->desk_list = cfdata->escfg->desk_list;
if (cfdata->size <= 24)
cfdata->basic_size = 24;
else if (cfdata->size <= 32)
@ -147,6 +154,46 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->layering = 2;
}
static void
_desk_sel_list_load(E_Config_Dialog_Data *cfdata)
{
Evas *evas;
int x, y;
if (!cfdata->desk_sel_list) return;
evas = evas_object_evas_get(cfdata->desk_sel_list);
evas_event_freeze(evas);
edje_freeze();
e_widget_ilist_freeze(cfdata->desk_sel_list);
e_widget_ilist_clear(cfdata->desk_sel_list);
for (y = 0; y < e_config->zone_desks_y_count; y++)
for (x = 0; x < e_config->zone_desks_x_count; x++)
{
E_Desk *desk;
Evas_List *l = NULL;
desk = e_desk_at_xy_get(cfdata->es->zone, x, y);
e_widget_ilist_append(cfdata->desk_sel_list, NULL, desk->name, NULL, NULL, NULL);
for (l = cfdata->desk_list; l; l = l->next)
{
E_Config_Shelf_Desk *sd;
sd = l->data;
if (!sd) continue;
if ((sd->x != x) || (sd->y != y)) continue;
e_widget_ilist_multi_select(cfdata->desk_sel_list, e_widget_ilist_count(cfdata->desk_sel_list));
break;
}
}
e_widget_ilist_go(cfdata->desk_sel_list);
e_widget_ilist_thaw(cfdata->desk_sel_list);
edje_thaw();
evas_event_thaw(evas);
}
static void *
_create_data(E_Config_Dialog *cfd)
{
@ -253,7 +300,7 @@ static int
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
E_Zone *zone;
int id;
int id, idx, x, y;
int restart = 0;
/* Only change style is we need to */
@ -354,6 +401,32 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
else if (!cfdata->escfg->autohide && cfdata->es->hidden)
e_shelf_toggle(cfdata->es, 1);
cfdata->escfg->desk_show_mode = cfdata->desk_show_mode;
cfdata->escfg->desk_list = NULL;
if (cfdata->desk_show_mode)
{
Evas_List *l;
Evas_List *desk_list = NULL;
for (idx = 0, l = e_widget_ilist_items_get(cfdata->desk_sel_list); l; l = l->next, idx++)
{
E_Ilist_Item *item;
E_Desk *desk;
E_Config_Shelf_Desk *sd;
item = l->data;
if ((!item) || (!item->selected)) continue;
desk = e_desk_at_pos_get(cfdata->es->zone, idx);
if (!desk) continue;
sd = E_NEW(E_Config_Shelf_Desk, 1);
sd->x = desk->x;
sd->y = desk->y;
desk_list = evas_list_append(desk_list, sd);
}
cfdata->escfg->desk_list = desk_list;
}
if (restart)
{
zone = cfdata->es->zone;
@ -371,8 +444,31 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
e_shelf_orient(cfdata->es, cfdata->escfg->orient);
e_shelf_position_calc(cfdata->es);
e_shelf_populate(cfdata->es);
e_shelf_show(cfdata->es);
}
if (cfdata->escfg->desk_show_mode)
{
E_Desk *desk;
Evas_List *l;
int show_shelf=0;
desk = e_desk_current_get(cfdata->es->zone);
for (l = cfdata->escfg->desk_list; l; l = l->next)
{
E_Config_Shelf_Desk *sd;
sd = l->data;
if ((desk->x == sd->x) && (desk->y == sd->y))
{
show_shelf=1;
break;
}
}
if (show_shelf)
e_shelf_show(cfdata->es);
else
e_shelf_hide(cfdata->es);
}
else
e_shelf_show(cfdata->es);
e_config_save_queue();
cfdata->es->config_dialog = cfd;
@ -563,6 +659,23 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o2, of, 1, 1, 0.5);
of = e_widget_framelist_add(evas, _("Desktop"), 0);
rg = e_widget_radio_group_new(&(cfdata->desk_show_mode));
ob = e_widget_radio_add(evas, _("Show on all Desktops"), 0, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_radio_add(evas, _("Show on specified Desktops"), 1, rg);
e_widget_framelist_object_append(of, ob);
ob = e_widget_ilist_add(evas, 16, 16, NULL);
cfdata->desk_sel_list = ob;
e_widget_ilist_multi_select_set(ob, 1);
_desk_sel_list_load(cfdata);
e_widget_min_size_get(ob, &wmw, &wmh);
e_widget_min_size_set(ob, wmw, 64);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o2, of, 1, 1, 0.5);
e_widget_list_object_append(o, o2, 0, 0, 0.0);
return o;

View File

@ -87,7 +87,28 @@ e_shelf_config_init(void)
e_shelf_orient(es, cf_es->orient);
e_shelf_position_calc(es);
e_shelf_populate(es);
e_shelf_show(es);
if (cf_es->desk_show_mode)
{
E_Desk *desk;
Evas_List *ll;
desk = e_desk_current_get(zone);
for (ll = cf_es->desk_list; ll; ll = ll->next)
{
E_Config_Shelf_Desk *sd;
sd = ll->data;
if ((desk->x == sd->x) && (desk->y == sd->y))
{
e_shelf_show(es);
break;
}
}
}
else
e_shelf_show(es);
e_shelf_toggle(es, 0);
}
}