3 struct _E_Config_Dialog_Data
8 Evas_Object *o_autohide, *o_desk_list;
9 Eina_List *autohide_list, *desk_list;
12 int orient, fit_along;
15 int autohide, autohide_action;
16 double hide_timeout, hide_duration;
19 #ifdef _F_SHELF_INPUT_CONTROL_
24 /* local function prototypes */
25 static void *_create_data(E_Config_Dialog *cfd);
26 static void _fill_data(E_Config_Dialog_Data *cfdata);
27 static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
28 static Evas_Object *_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata);
29 static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
30 static void _fill_styles(E_Config_Dialog_Data *cfdata, Evas_Object *obj);
31 static void _cb_autohide_change(void *data, Evas_Object *obj __UNUSED__);
32 static void _fill_desks(E_Config_Dialog_Data *cfdata);
35 e_int_shelf_config(E_Shelf *es)
37 E_Config_Dialog_View *v;
39 if (!(v = E_NEW(E_Config_Dialog_View, 1))) return;
41 v->create_cfdata = _create_data;
42 v->free_cfdata = _free_data;
43 v->basic.create_widgets = _basic_create;
44 v->basic.apply_cfdata = _basic_apply;
47 e_config_dialog_new(es->zone->container, _("Shelf Settings"),
48 "E", "_shelf_config_dialog",
49 "preferences-desktop-shelf", 0, v, es);
50 e_win_centered_set(es->config_dialog->dia->win, EINA_TRUE);
55 _shelf_event_add(E_Config_Dialog_Data *cfdata, int type __UNUSED__, E_Event_Shelf *ev)
57 if (ev->shelf->cfg == cfdata->escfg)
58 cfdata->es = ev->shelf;
59 return ECORE_CALLBACK_RENEW;
63 _shelf_event_del(E_Config_Dialog_Data *cfdata, int type __UNUSED__, E_Event_Shelf *ev)
65 if (ev->shelf == cfdata->es)
67 return ECORE_CALLBACK_RENEW;
71 _create_data(E_Config_Dialog *cfd)
73 E_Config_Dialog_Data *cfdata;
75 cfdata = E_NEW(E_Config_Dialog_Data, 1);
76 cfdata->es = cfd->data;
77 cfdata->escfg = cfdata->es->cfg;
78 E_LIST_HANDLERS_APPEND(cfdata->handlers, E_EVENT_SHELF_ADD, _shelf_event_add, cfdata);
79 E_LIST_HANDLERS_APPEND(cfdata->handlers, E_EVENT_SHELF_DEL, _shelf_event_del, cfdata);
85 _fill_data(E_Config_Dialog_Data *cfdata)
88 if ((!cfdata->escfg->popup) && (cfdata->escfg->layer == 1))
90 else if ((cfdata->escfg->popup) && (cfdata->escfg->layer == 0))
92 else if ((cfdata->escfg->popup) && (cfdata->escfg->layer == 200))
96 cfdata->overlap = cfdata->escfg->overlap;
99 cfdata->orient = cfdata->escfg->orient;
100 cfdata->fit_along = cfdata->escfg->fit_along;
103 cfdata->size = cfdata->escfg->size;
106 if (cfdata->escfg->style)
107 cfdata->style = eina_stringshare_ref(cfdata->escfg->style);
109 cfdata->style = eina_stringshare_add("");
112 cfdata->autohide = cfdata->escfg->autohide;
113 cfdata->autohide_action = cfdata->escfg->autohide_show_action;
114 cfdata->hide_timeout = cfdata->escfg->hide_timeout;
115 cfdata->hide_duration = cfdata->escfg->hide_duration;
118 cfdata->desk_show_mode = cfdata->escfg->desk_show_mode;
119 cfdata->desk_list = cfdata->escfg->desk_list;
121 #ifdef _F_SHELF_INPUT_CONTROL_
123 cfdata->disable_menu = cfdata->escfg->disable_menu;
128 _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
130 eina_list_free(cfdata->autohide_list);
132 eina_stringshare_del(cfdata->style);
133 cfdata->style = NULL;
135 E_FREE_LIST(cfdata->handlers, ecore_event_handler_del);
136 cfdata->es->config_dialog = NULL;
141 _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
143 Evas_Object *otb, *ol, *ow;
146 otb = e_widget_toolbook_add(evas, 24, 24);
149 ol = e_widget_list_add(evas, 0, 0);
150 rg = e_widget_radio_group_new(&(cfdata->layer));
151 ow = e_widget_radio_add(evas, _("Above Everything"), 2, rg);
152 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
153 ow = e_widget_radio_add(evas, _("Below Windows"), 1, rg);
154 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
155 ow = e_widget_radio_add(evas, _("Below Everything"), 0, rg);
156 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
157 ow = e_widget_check_add(evas, _("Allow windows to overlap the shelf"),
159 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
160 e_widget_toolbook_page_append(otb, NULL, _("Stacking"), ol,
161 1, 0, 1, 0, 0.5, 0.0);
164 ol = e_widget_table_add(evas, 1);
165 rg = e_widget_radio_group_new(&(cfdata->orient));
166 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-left",
167 24, 24, E_GADCON_ORIENT_LEFT, rg);
168 e_widget_table_object_append(ol, ow, 0, 2, 1, 1, 1, 1, 1, 1);
169 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-right",
170 24, 24, E_GADCON_ORIENT_RIGHT, rg);
171 e_widget_table_object_append(ol, ow, 2, 2, 1, 1, 1, 1, 1, 1);
172 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-top",
173 24, 24, E_GADCON_ORIENT_TOP, rg);
174 e_widget_table_object_append(ol, ow, 1, 0, 1, 1, 1, 1, 1, 1);
175 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-bottom",
176 24, 24, E_GADCON_ORIENT_BOTTOM, rg);
177 e_widget_table_object_append(ol, ow, 1, 4, 1, 1, 1, 1, 1, 1);
178 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-top-left",
179 24, 24, E_GADCON_ORIENT_CORNER_TL, rg);
180 e_widget_table_object_append(ol, ow, 0, 0, 1, 1, 1, 1, 1, 1);
181 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-top-right",
182 24, 24, E_GADCON_ORIENT_CORNER_TR, rg);
183 e_widget_table_object_append(ol, ow, 2, 0, 1, 1, 1, 1, 1, 1);
184 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-bottom-left",
185 24, 24, E_GADCON_ORIENT_CORNER_BL, rg);
186 e_widget_table_object_append(ol, ow, 0, 4, 1, 1, 1, 1, 1, 1);
187 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-bottom-right",
188 24, 24, E_GADCON_ORIENT_CORNER_BR, rg);
189 e_widget_table_object_append(ol, ow, 2, 4, 1, 1, 1, 1, 1, 1);
190 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-left-top",
191 24, 24, E_GADCON_ORIENT_CORNER_LT, rg);
192 e_widget_table_object_append(ol, ow, 0, 1, 1, 1, 1, 1, 1, 1);
193 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-right-top",
194 24, 24, E_GADCON_ORIENT_CORNER_RT, rg);
195 e_widget_table_object_append(ol, ow, 2, 1, 1, 1, 1, 1, 1, 1);
196 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-left-bottom",
197 24, 24, E_GADCON_ORIENT_CORNER_LB, rg);
198 e_widget_table_object_append(ol, ow, 0, 3, 1, 1, 1, 1, 1, 1);
199 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-right-bottom",
200 24, 24, E_GADCON_ORIENT_CORNER_RB, rg);
201 e_widget_table_object_append(ol, ow, 2, 3, 1, 1, 1, 1, 1, 1);
202 e_widget_toolbook_page_append(otb, NULL, _("Position"), ol,
203 1, 0, 1, 0, 0.5, 0.0);
206 ol = e_widget_list_add(evas, 0, 0);
207 ow = e_widget_slider_add(evas, 1, 0, _("Height (%3.0f pixels)"), 4, 256, 4, 0,
208 NULL, &(cfdata->size), 100);
209 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
210 ow = e_widget_check_add(evas, _("Shrink to Content Width"),
211 &(cfdata->fit_along));
212 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
213 e_widget_toolbook_page_append(otb, NULL, _("Size"), ol,
214 1, 0, 1, 0, 0.5, 0.0);
217 ol = e_widget_list_add(evas, 0, 0);
218 ow = e_widget_ilist_add(evas, 60, 20, &(cfdata->style));
219 _fill_styles(cfdata, ow);
220 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
221 e_widget_toolbook_page_append(otb, NULL, _("Style"), ol,
222 1, 0, 1, 0, 0.5, 0.0);
225 ol = e_widget_list_add(evas, 0, 0);
227 e_widget_check_add(evas, _("Auto-hide the shelf"), &(cfdata->autohide));
228 e_widget_on_change_hook_set(cfdata->o_autohide, _cb_autohide_change, cfdata);
229 e_widget_list_object_append(ol, cfdata->o_autohide, 1, 1, 0.5);
231 rg = e_widget_radio_group_new(&(cfdata->autohide_action));
232 ow = e_widget_radio_add(evas, _("Show on mouse in"), 0, rg);
233 e_widget_disabled_set(ow, !cfdata->autohide);
234 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
235 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
236 ow = e_widget_radio_add(evas, _("Show on mouse click"), 1, rg);
237 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
238 e_widget_disabled_set(ow, !cfdata->autohide);
239 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
241 ow = e_widget_label_add(evas, _("Hide timeout"));
242 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
243 e_widget_disabled_set(ow, !cfdata->autohide);
244 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
245 ow = e_widget_slider_add(evas, 1, 0, _("%.1f seconds"), 0.2, 6.0, 0.2, 0,
246 &(cfdata->hide_timeout), NULL, 100);
247 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
248 e_widget_disabled_set(ow, !cfdata->autohide);
249 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
251 ow = e_widget_label_add(evas, _("Hide duration"));
252 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
253 e_widget_disabled_set(ow, !cfdata->autohide);
254 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
255 ow = e_widget_slider_add(evas, 1, 0, _("%.2f seconds"), 0.05, 6.0, 0.05, 0,
256 &(cfdata->hide_duration), NULL, 100);
257 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
258 e_widget_disabled_set(ow, !cfdata->autohide);
259 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
260 e_widget_toolbook_page_append(otb, NULL, _("Auto Hide"), ol,
261 1, 0, 1, 0, 0.5, 0.0);
264 ol = e_widget_list_add(evas, 0, 0);
265 rg = e_widget_radio_group_new(&(cfdata->desk_show_mode));
266 ow = e_widget_radio_add(evas, _("Show on all Desktops"), 0, rg);
267 e_widget_list_object_append(ol, ow, 1, 0, 0.5);
268 ow = e_widget_radio_add(evas, _("Show on specified Desktops"), 1, rg);
269 e_widget_list_object_append(ol, ow, 1, 0, 0.5);
271 cfdata->o_desk_list = e_widget_ilist_add(evas, 24, 24, NULL);
272 e_widget_ilist_multi_select_set(cfdata->o_desk_list, EINA_TRUE);
274 e_widget_list_object_append(ol, cfdata->o_desk_list, 1, 1, 0.5);
275 e_widget_toolbook_page_append(otb, NULL, _("Desktop"), ol,
276 1, 0, 1, 0, 0.5, 0.0);
278 #ifdef _F_SHELF_INPUT_CONTROL_
280 ol = e_widget_list_add(evas, 0, 0);
281 ow = e_widget_check_add(evas, _("Disable menu on the shelf"),
282 &(cfdata->disable_menu));
283 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
284 e_widget_toolbook_page_append(otb, NULL, _("Control"), ol,
285 1, 0, 1, 0, 0.5, 0.0);
288 e_widget_toolbook_page_show(otb, 0);
293 _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
295 E_Config_Shelf_Desk *sd;
298 if (!cfdata->escfg->style)
300 cfdata->escfg->style = eina_stringshare_ref(cfdata->style);
301 e_shelf_style_set(cfdata->es, cfdata->style);
303 else if ((cfdata->escfg->style) &&
304 (cfdata->escfg->style != cfdata->style))
306 eina_stringshare_replace(&cfdata->escfg->style, cfdata->style);
307 e_shelf_style_set(cfdata->es, cfdata->style);
310 if (cfdata->escfg->orient != cfdata->orient)
312 cfdata->escfg->orient = cfdata->orient;
316 if (cfdata->escfg->fit_along != cfdata->fit_along)
318 cfdata->escfg->fit_along = cfdata->fit_along;
319 cfdata->es->fit_along = cfdata->fit_along;
323 if (cfdata->escfg->size != cfdata->size)
325 cfdata->escfg->size = cfdata->size;
326 cfdata->es->size = cfdata->size;
330 if (cfdata->layer == 0)
332 if ((cfdata->escfg->popup != 0) || (cfdata->escfg->layer != 1))
334 cfdata->escfg->popup = 0;
335 cfdata->escfg->layer = 1;
339 else if (cfdata->layer == 1)
341 if ((cfdata->escfg->popup != 1) || (cfdata->escfg->layer != 0))
343 cfdata->escfg->popup = 1;
344 cfdata->escfg->layer = 0;
348 else if (cfdata->layer == 2)
350 if ((cfdata->escfg->popup != 1) || (cfdata->escfg->layer != 200))
352 cfdata->escfg->popup = 1;
353 cfdata->escfg->layer = 200;
358 cfdata->escfg->overlap = cfdata->overlap;
359 e_shelf_autohide_set(cfdata->es, cfdata->autohide);
360 cfdata->escfg->autohide_show_action = cfdata->autohide_action;
361 cfdata->escfg->hide_timeout = cfdata->hide_timeout;
362 cfdata->escfg->hide_duration = cfdata->hide_duration;
363 cfdata->escfg->desk_show_mode = cfdata->desk_show_mode;
365 EINA_LIST_FREE(cfdata->escfg->desk_list, sd)
367 cfdata->escfg->desk_list = NULL;
369 if (cfdata->desk_show_mode)
372 const E_Ilist_Item *it;
375 EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->o_desk_list), l, it)
380 if ((!it) || (!it->selected)) continue;
381 if (!(desk = e_desk_at_pos_get(cfdata->es->zone, idx))) continue;
382 sd = E_NEW(E_Config_Shelf_Desk, 1);
385 cfdata->escfg->desk_list =
386 eina_list_append(cfdata->escfg->desk_list, sd);
393 E_Config_Shelf *cf_es;
395 zone = cfdata->es->zone;
396 cf_es = cfdata->es->cfg;
397 cfdata->es->config_dialog = NULL;
398 e_object_del(E_OBJECT(cfdata->es));
400 cfdata->es = e_shelf_config_new(zone, cf_es);
401 cfdata->es->config_dialog = cfd;
404 if (cfdata->escfg->desk_show_mode)
410 desk = e_desk_current_get(cfdata->es->zone);
411 EINA_LIST_FOREACH(cfdata->escfg->desk_list, l, sd)
413 if ((desk->x == sd->x) && (desk->y == sd->y))
419 if (show) e_shelf_show(cfdata->es);
420 else e_shelf_hide(cfdata->es);
423 e_shelf_show(cfdata->es);
425 if ((cfdata->escfg->autohide) && (!cfdata->es->hidden))
426 e_shelf_toggle(cfdata->es, 0);
427 else if ((!cfdata->escfg->autohide) && (cfdata->es->hidden))
428 e_shelf_toggle(cfdata->es, 1);
430 #ifdef _F_SHELF_INPUT_CONTROL_
431 cfdata->escfg->disable_menu = cfdata->disable_menu;
432 cfdata->es->disable_menu = cfdata->disable_menu;
435 e_zone_useful_geometry_dirty(cfdata->es->zone);
436 e_config_save_queue();
437 cfdata->es->config_dialog = cfd;
442 _fill_styles(E_Config_Dialog_Data *cfdata, Evas_Object *obj)
445 Eina_List *l, *styles;
450 evas = evas_object_evas_get(obj);
451 evas_event_freeze(evas);
453 e_widget_ilist_freeze(obj);
454 e_widget_ilist_clear(obj);
456 styles = e_theme_shelf_list();
457 EINA_LIST_FOREACH(styles, l, style)
459 Evas_Object *thumb, *ow;
462 thumb = e_livethumb_add(evas);
463 e_livethumb_vsize_set(thumb, 120, 40);
464 ow = edje_object_add(e_livethumb_evas_get(thumb));
465 snprintf(buff, sizeof(buff), "e/shelf/%s/base", style);
466 e_theme_edje_object_set(ow, "base/theme/shelf", buff);
467 e_livethumb_thumb_set(thumb, ow);
468 e_widget_ilist_append(obj, thumb, style, NULL, NULL, style);
469 if (!strcmp(cfdata->style, style))
470 e_widget_ilist_selected_set(obj, n);
474 e_widget_size_min_get(obj, &mw, NULL);
475 e_widget_size_min_set(obj, mw, 180);
477 e_widget_ilist_go(obj);
478 e_widget_ilist_thaw(obj);
480 evas_event_thaw(evas);
482 EINA_LIST_FREE(styles, str)
483 eina_stringshare_del(str);
487 _cb_autohide_change(void *data, Evas_Object *obj __UNUSED__)
489 E_Config_Dialog_Data *cfdata;
493 if (!(cfdata = data)) return;
494 EINA_LIST_FOREACH(cfdata->autohide_list, l, ow)
495 e_widget_disabled_set(ow, !cfdata->autohide);
499 _fill_desks(E_Config_Dialog_Data *cfdata)
505 evas = evas_object_evas_get(cfdata->o_desk_list);
506 evas_event_freeze(evas);
508 e_widget_ilist_freeze(cfdata->o_desk_list);
509 e_widget_ilist_clear(cfdata->o_desk_list);
511 for (y = 0; y < e_config->zone_desks_y_count; y++)
512 for (x = 0; x < e_config->zone_desks_x_count; x++)
516 E_Config_Shelf_Desk *sd;
518 desk = e_desk_at_xy_get(cfdata->es->zone, x, y);
519 e_widget_ilist_append(cfdata->o_desk_list, NULL, desk->name,
523 EINA_LIST_FOREACH(cfdata->desk_list, l, sd)
525 if ((sd->x != x) || (sd->y != y)) continue;
526 e_widget_ilist_multi_select(cfdata->o_desk_list, i);
531 e_widget_size_min_get(cfdata->o_desk_list, &mw, NULL);
532 e_widget_size_min_set(cfdata->o_desk_list, mw, 180);
534 e_widget_ilist_go(cfdata->o_desk_list);
535 e_widget_ilist_thaw(cfdata->o_desk_list);
537 evas_event_thaw(evas);