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;
20 /* local function prototypes */
21 static void *_create_data(E_Config_Dialog *cfd);
22 static void _fill_data(E_Config_Dialog_Data *cfdata);
23 static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
24 static Evas_Object *_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata);
25 static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
26 static void _fill_styles(E_Config_Dialog_Data *cfdata, Evas_Object *obj);
27 static void _cb_autohide_change(void *data, Evas_Object *obj __UNUSED__);
28 static void _fill_desks(E_Config_Dialog_Data *cfdata);
31 e_int_shelf_config(E_Shelf *es)
33 E_Config_Dialog_View *v;
35 if (!(v = E_NEW(E_Config_Dialog_View, 1))) return;
37 v->create_cfdata = _create_data;
38 v->free_cfdata = _free_data;
39 v->basic.create_widgets = _basic_create;
40 v->basic.apply_cfdata = _basic_apply;
43 e_config_dialog_new(es->zone->container, _("Shelf Settings"),
44 "E", "_shelf_config_dialog",
45 "preferences-desktop-shelf", 0, v, es);
46 e_win_centered_set(es->config_dialog->dia->win, EINA_TRUE);
51 _create_data(E_Config_Dialog *cfd)
53 E_Config_Dialog_Data *cfdata;
55 cfdata = E_NEW(E_Config_Dialog_Data, 1);
56 cfdata->es = cfd->data;
57 cfdata->escfg = cfdata->es->cfg;
63 _fill_data(E_Config_Dialog_Data *cfdata)
66 if ((!cfdata->escfg->popup) && (cfdata->escfg->layer == 1))
68 else if ((cfdata->escfg->popup) && (cfdata->escfg->layer == 0))
70 else if ((cfdata->escfg->popup) && (cfdata->escfg->layer == 200))
74 cfdata->overlap = cfdata->escfg->overlap;
77 cfdata->orient = cfdata->escfg->orient;
78 cfdata->fit_along = cfdata->escfg->fit_along;
81 cfdata->size = cfdata->escfg->size;
84 if (cfdata->escfg->style)
85 cfdata->style = eina_stringshare_ref(cfdata->escfg->style);
87 cfdata->style = eina_stringshare_add("");
90 cfdata->autohide = cfdata->escfg->autohide;
91 cfdata->autohide_action = cfdata->escfg->autohide_show_action;
92 cfdata->hide_timeout = cfdata->escfg->hide_timeout;
93 cfdata->hide_duration = cfdata->escfg->hide_duration;
96 cfdata->desk_show_mode = cfdata->escfg->desk_show_mode;
97 cfdata->desk_list = cfdata->escfg->desk_list;
101 _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
103 eina_list_free(cfdata->autohide_list);
105 if (cfdata->style) eina_stringshare_del(cfdata->style);
106 cfdata->style = NULL;
108 cfdata->es->config_dialog = NULL;
113 _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
115 Evas_Object *otb, *ol, *ow;
118 otb = e_widget_toolbook_add(evas, 24, 24);
121 ol = e_widget_list_add(evas, 0, 0);
122 rg = e_widget_radio_group_new(&(cfdata->layer));
123 ow = e_widget_radio_add(evas, _("Above Everything"), 2, rg);
124 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
125 ow = e_widget_radio_add(evas, _("Below Windows"), 1, rg);
126 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
127 ow = e_widget_radio_add(evas, _("Below Everything"), 0, rg);
128 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
129 ow = e_widget_check_add(evas, _("Allow windows to overlap the shelf"),
131 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
132 e_widget_toolbook_page_append(otb, NULL, _("Stacking"), ol,
133 1, 0, 1, 0, 0.5, 0.0);
136 ol = e_widget_table_add(evas, 1);
137 rg = e_widget_radio_group_new(&(cfdata->orient));
138 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-left",
139 24, 24, E_GADCON_ORIENT_LEFT, rg);
140 e_widget_table_object_append(ol, ow, 0, 2, 1, 1, 1, 1, 1, 1);
141 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-right",
142 24, 24, E_GADCON_ORIENT_RIGHT, rg);
143 e_widget_table_object_append(ol, ow, 2, 2, 1, 1, 1, 1, 1, 1);
144 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-top",
145 24, 24, E_GADCON_ORIENT_TOP, rg);
146 e_widget_table_object_append(ol, ow, 1, 0, 1, 1, 1, 1, 1, 1);
147 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-bottom",
148 24, 24, E_GADCON_ORIENT_BOTTOM, rg);
149 e_widget_table_object_append(ol, ow, 1, 4, 1, 1, 1, 1, 1, 1);
150 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-top-left",
151 24, 24, E_GADCON_ORIENT_CORNER_TL, rg);
152 e_widget_table_object_append(ol, ow, 0, 0, 1, 1, 1, 1, 1, 1);
153 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-top-right",
154 24, 24, E_GADCON_ORIENT_CORNER_TR, rg);
155 e_widget_table_object_append(ol, ow, 2, 0, 1, 1, 1, 1, 1, 1);
156 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-bottom-left",
157 24, 24, E_GADCON_ORIENT_CORNER_BL, rg);
158 e_widget_table_object_append(ol, ow, 0, 4, 1, 1, 1, 1, 1, 1);
159 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-bottom-right",
160 24, 24, E_GADCON_ORIENT_CORNER_BR, rg);
161 e_widget_table_object_append(ol, ow, 2, 4, 1, 1, 1, 1, 1, 1);
162 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-left-top",
163 24, 24, E_GADCON_ORIENT_CORNER_LT, rg);
164 e_widget_table_object_append(ol, ow, 0, 1, 1, 1, 1, 1, 1, 1);
165 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-right-top",
166 24, 24, E_GADCON_ORIENT_CORNER_RT, rg);
167 e_widget_table_object_append(ol, ow, 2, 1, 1, 1, 1, 1, 1, 1);
168 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-left-bottom",
169 24, 24, E_GADCON_ORIENT_CORNER_LB, rg);
170 e_widget_table_object_append(ol, ow, 0, 3, 1, 1, 1, 1, 1, 1);
171 ow = e_widget_radio_icon_add(evas, NULL, "preferences-position-right-bottom",
172 24, 24, E_GADCON_ORIENT_CORNER_RB, rg);
173 e_widget_table_object_append(ol, ow, 2, 3, 1, 1, 1, 1, 1, 1);
174 e_widget_toolbook_page_append(otb, NULL, _("Position"), ol,
175 1, 0, 1, 0, 0.5, 0.0);
178 ol = e_widget_list_add(evas, 0, 0);
179 ow = e_widget_slider_add(evas, 1, 0, _("Height (%3.0f pixels)"), 4, 256, 4, 0,
180 NULL, &(cfdata->size), 100);
181 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
182 ow = e_widget_check_add(evas, _("Shrink to Content Width"),
183 &(cfdata->fit_along));
184 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
185 e_widget_toolbook_page_append(otb, NULL, _("Size"), ol,
186 1, 0, 1, 0, 0.5, 0.0);
189 ol = e_widget_list_add(evas, 0, 0);
190 ow = e_widget_ilist_add(evas, 60, 20, &(cfdata->style));
191 _fill_styles(cfdata, ow);
192 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
193 e_widget_toolbook_page_append(otb, NULL, _("Style"), ol,
194 1, 0, 1, 0, 0.5, 0.0);
197 ol = e_widget_list_add(evas, 0, 0);
199 e_widget_check_add(evas, _("Auto-hide the shelf"), &(cfdata->autohide));
200 e_widget_on_change_hook_set(cfdata->o_autohide, _cb_autohide_change, cfdata);
201 e_widget_list_object_append(ol, cfdata->o_autohide, 1, 1, 0.5);
203 rg = e_widget_radio_group_new(&(cfdata->autohide_action));
204 ow = e_widget_radio_add(evas, _("Show on mouse in"), 0, rg);
205 e_widget_disabled_set(ow, !cfdata->autohide);
206 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
207 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
208 ow = e_widget_radio_add(evas, _("Show on mouse click"), 1, rg);
209 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
210 e_widget_disabled_set(ow, !cfdata->autohide);
211 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
213 ow = e_widget_label_add(evas, _("Hide timeout"));
214 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
215 e_widget_disabled_set(ow, !cfdata->autohide);
216 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
217 ow = e_widget_slider_add(evas, 1, 0, _("%.1f seconds"), 0.2, 6.0, 0.2, 0,
218 &(cfdata->hide_timeout), NULL, 100);
219 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
220 e_widget_disabled_set(ow, !cfdata->autohide);
221 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
223 ow = e_widget_label_add(evas, _("Hide duration"));
224 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
225 e_widget_disabled_set(ow, !cfdata->autohide);
226 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
227 ow = e_widget_slider_add(evas, 1, 0, _("%.2f seconds"), 0.05, 6.0, 0.05, 0,
228 &(cfdata->hide_duration), NULL, 100);
229 cfdata->autohide_list = eina_list_append(cfdata->autohide_list, ow);
230 e_widget_disabled_set(ow, !cfdata->autohide);
231 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
232 e_widget_toolbook_page_append(otb, NULL, _("Auto Hide"), ol,
233 1, 0, 1, 0, 0.5, 0.0);
236 ol = e_widget_list_add(evas, 0, 0);
237 rg = e_widget_radio_group_new(&(cfdata->desk_show_mode));
238 ow = e_widget_radio_add(evas, _("Show on all Desktops"), 0, rg);
239 e_widget_list_object_append(ol, ow, 1, 0, 0.5);
240 ow = e_widget_radio_add(evas, _("Show on specified Desktops"), 1, rg);
241 e_widget_list_object_append(ol, ow, 1, 0, 0.5);
243 cfdata->o_desk_list = e_widget_ilist_add(evas, 24, 24, NULL);
244 e_widget_ilist_multi_select_set(cfdata->o_desk_list, EINA_TRUE);
246 e_widget_list_object_append(ol, cfdata->o_desk_list, 1, 1, 0.5);
247 e_widget_toolbook_page_append(otb, NULL, _("Desktop"), ol,
248 1, 0, 1, 0, 0.5, 0.0);
250 e_widget_toolbook_page_show(otb, 0);
255 _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
257 E_Config_Shelf_Desk *sd;
260 if (!cfdata->escfg->style)
262 cfdata->escfg->style = eina_stringshare_ref(cfdata->style);
263 e_shelf_style_set(cfdata->es, cfdata->style);
265 else if ((cfdata->escfg->style) &&
266 (strcmp(cfdata->escfg->style, cfdata->style)))
268 if (cfdata->escfg->style) eina_stringshare_del(cfdata->escfg->style);
269 cfdata->escfg->style = eina_stringshare_ref(cfdata->style);
270 e_shelf_style_set(cfdata->es, cfdata->style);
273 if (cfdata->escfg->orient != cfdata->orient)
275 cfdata->escfg->orient = cfdata->orient;
276 e_shelf_orient(cfdata->es, cfdata->orient);
277 e_shelf_position_calc(cfdata->es);
281 if (cfdata->escfg->fit_along != cfdata->fit_along)
283 cfdata->escfg->fit_along = cfdata->fit_along;
284 cfdata->es->fit_along = cfdata->fit_along;
288 if (cfdata->escfg->size != cfdata->size)
290 cfdata->escfg->size = cfdata->size;
291 cfdata->es->size = cfdata->size;
295 if (cfdata->layer == 0)
297 if ((cfdata->escfg->popup != 0) || (cfdata->escfg->layer != 1))
299 cfdata->escfg->popup = 0;
300 cfdata->escfg->layer = 1;
304 else if (cfdata->layer == 1)
306 if ((cfdata->escfg->popup != 1) || (cfdata->escfg->layer != 0))
308 cfdata->escfg->popup = 1;
309 cfdata->escfg->layer = 0;
313 else if (cfdata->layer == 2)
315 if ((cfdata->escfg->popup != 1) || (cfdata->escfg->layer != 200))
317 cfdata->escfg->popup = 1;
318 cfdata->escfg->layer = 200;
323 cfdata->escfg->overlap = cfdata->overlap;
324 cfdata->escfg->autohide = cfdata->autohide;
325 cfdata->escfg->autohide_show_action = cfdata->autohide_action;
326 cfdata->escfg->hide_timeout = cfdata->hide_timeout;
327 cfdata->escfg->hide_duration = cfdata->hide_duration;
328 cfdata->escfg->desk_show_mode = cfdata->desk_show_mode;
330 EINA_LIST_FREE(cfdata->escfg->desk_list, sd)
332 cfdata->escfg->desk_list = NULL;
334 if (cfdata->desk_show_mode)
337 const E_Ilist_Item *it;
340 EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->o_desk_list), l, it)
345 if ((!it) || (!it->selected)) continue;
346 if (!(desk = e_desk_at_pos_get(cfdata->es->zone, idx))) continue;
347 sd = E_NEW(E_Config_Shelf_Desk, 1);
350 cfdata->escfg->desk_list =
351 eina_list_append(cfdata->escfg->desk_list, sd);
359 zone = cfdata->es->zone;
360 cfdata->es->config_dialog = NULL;
361 e_object_del(E_OBJECT(cfdata->es));
364 e_shelf_zone_new(zone, cfdata->escfg->name,
365 cfdata->escfg->style, cfdata->escfg->popup,
366 cfdata->escfg->layer, cfdata->escfg->id);
367 cfdata->es->cfg = cfdata->escfg;
368 cfdata->es->fit_along = cfdata->escfg->fit_along;
369 e_shelf_orient(cfdata->es, cfdata->escfg->orient);
370 e_shelf_position_calc(cfdata->es);
371 e_shelf_populate(cfdata->es);
374 if (cfdata->escfg->desk_show_mode)
378 E_Config_Shelf_Desk *sd;
381 desk = e_desk_current_get(cfdata->es->zone);
382 EINA_LIST_FOREACH(cfdata->escfg->desk_list, l, sd)
384 if ((desk->x == sd->x) && (desk->y == sd->y))
390 if (show) e_shelf_show(cfdata->es);
391 else e_shelf_hide(cfdata->es);
394 e_shelf_show(cfdata->es);
396 if ((cfdata->escfg->autohide) && (!cfdata->es->hidden))
397 e_shelf_toggle(cfdata->es, 0);
398 else if ((!cfdata->escfg->autohide) && (cfdata->es->hidden))
399 e_shelf_toggle(cfdata->es, 1);
401 e_zone_useful_geometry_dirty(cfdata->es->zone);
402 e_config_save_queue();
403 cfdata->es->config_dialog = cfd;
408 _fill_styles(E_Config_Dialog_Data *cfdata, Evas_Object *obj)
411 Eina_List *l, *styles;
416 evas = evas_object_evas_get(obj);
417 evas_event_freeze(evas);
419 e_widget_ilist_freeze(obj);
420 e_widget_ilist_clear(obj);
422 styles = e_theme_shelf_list();
423 EINA_LIST_FOREACH(styles, l, style)
425 Evas_Object *thumb, *ow;
428 thumb = e_livethumb_add(evas);
429 e_livethumb_vsize_set(thumb, 120, 40);
430 ow = edje_object_add(e_livethumb_evas_get(thumb));
431 snprintf(buff, sizeof(buff), "e/shelf/%s/base", style);
432 e_theme_edje_object_set(ow, "base/theme/shelf", buff);
433 e_livethumb_thumb_set(thumb, ow);
434 e_widget_ilist_append(obj, thumb, style, NULL, NULL, style);
435 if (!strcmp(cfdata->style, style))
436 e_widget_ilist_selected_set(obj, n);
440 e_widget_size_min_get(obj, &mw, NULL);
441 e_widget_size_min_set(obj, mw, 180);
443 e_widget_ilist_go(obj);
444 e_widget_ilist_thaw(obj);
446 evas_event_thaw(evas);
448 EINA_LIST_FREE(styles, str)
449 eina_stringshare_del(str);
453 _cb_autohide_change(void *data, Evas_Object *obj __UNUSED__)
455 E_Config_Dialog_Data *cfdata;
459 if (!(cfdata = data)) return;
460 EINA_LIST_FOREACH(cfdata->autohide_list, l, ow)
461 e_widget_disabled_set(ow, !cfdata->autohide);
465 _fill_desks(E_Config_Dialog_Data *cfdata)
471 evas = evas_object_evas_get(cfdata->o_desk_list);
472 evas_event_freeze(evas);
474 e_widget_ilist_freeze(cfdata->o_desk_list);
475 e_widget_ilist_clear(cfdata->o_desk_list);
477 for (y = 0; y < e_config->zone_desks_y_count; y++)
478 for (x = 0; x < e_config->zone_desks_x_count; x++)
482 E_Config_Shelf_Desk *sd;
484 desk = e_desk_at_xy_get(cfdata->es->zone, x, y);
485 e_widget_ilist_append(cfdata->o_desk_list, NULL, desk->name,
489 EINA_LIST_FOREACH(cfdata->desk_list, l, sd)
491 if ((sd->x != x) || (sd->y != y)) continue;
492 e_widget_ilist_multi_select(cfdata->o_desk_list, i);
497 e_widget_size_min_get(cfdata->o_desk_list, &mw, NULL);
498 e_widget_size_min_set(cfdata->o_desk_list, mw, 180);
500 e_widget_ilist_go(cfdata->o_desk_list);
501 e_widget_ilist_thaw(cfdata->o_desk_list);
503 evas_event_thaw(evas);