2006-04-29 20:43:47 -07:00
|
|
|
#include "e.h"
|
|
|
|
|
2012-06-26 01:58:14 -07:00
|
|
|
static void *_create_data(E_Config_Dialog *cfd);
|
|
|
|
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2007-12-17 17:49:45 -08:00
|
|
|
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
2012-06-26 01:58:14 -07:00
|
|
|
static void _ilist_fill(E_Config_Dialog_Data *cfdata);
|
2012-06-26 04:32:02 -07:00
|
|
|
static void _ilist_empty(E_Config_Dialog_Data *cfdata);
|
2012-06-26 01:58:14 -07:00
|
|
|
static void _ilist_cb_selected(void *data);
|
|
|
|
static void _cb_add(void *data, void *data2);
|
|
|
|
static void _cb_delete(void *data, void *data2);
|
2012-07-04 00:38:11 -07:00
|
|
|
static void _cb_rename(void *data, void *data2);
|
2012-06-26 01:58:14 -07:00
|
|
|
static void _cb_dialog_yes(void *data);
|
|
|
|
static void _cb_dialog_destroy(void *data);
|
|
|
|
static void _cb_config(void *data, void *data2);
|
|
|
|
static void _cb_contents(void *data, void *data2);
|
2012-07-03 04:55:32 -07:00
|
|
|
static void _ilist_refresh(E_Shelf *es);
|
2012-07-04 01:16:25 -07:00
|
|
|
static E_Dialog *_dia_name_shelf(E_Config_Dialog_Data *cfdata, Eina_Bool rename);
|
2012-07-03 06:53:44 -07:00
|
|
|
static void _new_shelf_cb_close(void *data, E_Dialog *dia);
|
|
|
|
static void _new_shelf_cb_ok(void *data, E_Dialog *dia);
|
|
|
|
static void _new_shelf_cb_dia_del(void *obj);
|
2012-07-04 00:38:11 -07:00
|
|
|
static void _rename_shelf_cb_ok(void *data, E_Dialog *dia);
|
2012-06-26 01:58:14 -07:00
|
|
|
|
|
|
|
struct _E_Config_Dialog_Data
|
2006-04-29 20:43:47 -07:00
|
|
|
{
|
2012-07-03 06:53:44 -07:00
|
|
|
Evas_Object *o_list;
|
2012-07-04 00:38:11 -07:00
|
|
|
Evas_Object *o_add;
|
2012-07-03 06:53:44 -07:00
|
|
|
Evas_Object *o_delete;
|
2012-07-04 00:38:11 -07:00
|
|
|
Evas_Object *o_rename;
|
2012-07-03 06:53:44 -07:00
|
|
|
Evas_Object *o_config;
|
|
|
|
Evas_Object *o_contents;
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2012-07-03 06:53:44 -07:00
|
|
|
const char *cur_shelf;
|
2012-07-03 04:55:32 -07:00
|
|
|
Ecore_Event_Handler *shelf_handler;
|
2012-07-03 06:53:44 -07:00
|
|
|
Eina_List *shelves;
|
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
E_Dialog *dia_new_shelf;
|
|
|
|
char *new_shelf;
|
2006-04-29 20:43:47 -07:00
|
|
|
};
|
|
|
|
|
2012-07-04 00:38:11 -07:00
|
|
|
static int orientations[] =
|
|
|
|
{
|
2012-07-04 01:16:25 -07:00
|
|
|
[E_GADCON_ORIENT_FLOAT] = 2,
|
|
|
|
[E_GADCON_ORIENT_HORIZ] = 2,
|
|
|
|
[E_GADCON_ORIENT_VERT] = 2,
|
|
|
|
[E_GADCON_ORIENT_LEFT] = 37,
|
|
|
|
[E_GADCON_ORIENT_RIGHT] = 31,
|
|
|
|
[E_GADCON_ORIENT_TOP] = 29,
|
|
|
|
[E_GADCON_ORIENT_BOTTOM] = 23,
|
|
|
|
[E_GADCON_ORIENT_CORNER_TL] = 19,
|
|
|
|
[E_GADCON_ORIENT_CORNER_TR] = 17,
|
|
|
|
[E_GADCON_ORIENT_CORNER_BL] = 13,
|
|
|
|
[E_GADCON_ORIENT_CORNER_BR] = 11,
|
|
|
|
[E_GADCON_ORIENT_CORNER_LT] = 7,
|
|
|
|
[E_GADCON_ORIENT_CORNER_RT] = 5,
|
|
|
|
[E_GADCON_ORIENT_CORNER_LB] = 3,
|
|
|
|
[E_GADCON_ORIENT_CORNER_RB] = 2
|
2006-10-30 02:42:23 -08:00
|
|
|
};
|
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
E_Config_Dialog *
|
2012-06-26 01:58:14 -07:00
|
|
|
e_int_config_shelf(E_Container *con, const char *params __UNUSED__)
|
2006-04-29 20:43:47 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
E_Config_Dialog_View *v;
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2006-04-29 20:43:47 -07:00
|
|
|
v = E_NEW(E_Config_Dialog_View, 1);
|
2012-06-26 01:58:14 -07:00
|
|
|
if (!v) return NULL;
|
2006-07-28 04:34:38 -07:00
|
|
|
v->create_cfdata = _create_data;
|
|
|
|
v->free_cfdata = _free_data;
|
2007-12-17 17:49:45 -08:00
|
|
|
v->basic.create_widgets = _basic_create;
|
2006-07-28 04:34:38 -07:00
|
|
|
|
2012-06-26 01:58:14 -07:00
|
|
|
cfd = e_config_dialog_new(con, _("Shelf Settings"), "E",
|
|
|
|
"extensions/shelves",
|
|
|
|
"preferences-desktop-shelf", 0, v, NULL);
|
2006-07-28 04:34:38 -07:00
|
|
|
return cfd;
|
2006-04-29 20:43:47 -07:00
|
|
|
}
|
|
|
|
|
2012-07-03 04:55:32 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_shelf_handler_cb(E_Config_Dialog_Data *cfdata, int type __UNUSED__, E_Event_Shelf_Add *ev __UNUSED__)
|
|
|
|
{
|
|
|
|
_ilist_empty(cfdata);
|
|
|
|
_ilist_fill(cfdata);
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
|
2006-04-29 20:43:47 -07:00
|
|
|
static void *
|
2012-06-26 03:06:25 -07:00
|
|
|
_create_data(E_Config_Dialog *cfd)
|
2006-04-29 20:43:47 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2006-04-29 20:43:47 -07:00
|
|
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
2012-07-03 04:55:32 -07:00
|
|
|
cfdata->shelf_handler = ecore_event_handler_add(E_EVENT_SHELF_ADD, (Ecore_Event_Handler_Cb)_shelf_handler_cb, cfdata);
|
2012-06-26 03:06:25 -07:00
|
|
|
cfdata->cfd = cfd;
|
2006-04-29 20:43:47 -07:00
|
|
|
return cfdata;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-26 01:58:14 -07:00
|
|
|
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
2006-04-29 20:43:47 -07:00
|
|
|
{
|
2012-06-26 04:50:12 -07:00
|
|
|
E_Shelf *es;
|
|
|
|
EINA_LIST_FREE(cfdata->shelves, es)
|
|
|
|
{
|
|
|
|
evas_object_data_del(es->o_base, "cfdata");
|
|
|
|
e_object_del_func_set(E_OBJECT(es), NULL);
|
|
|
|
}
|
2012-07-03 04:55:32 -07:00
|
|
|
ecore_event_handler_del(cfdata->shelf_handler);
|
2006-07-24 09:32:34 -07:00
|
|
|
E_FREE(cfdata);
|
2006-04-29 20:43:47 -07:00
|
|
|
}
|
|
|
|
|
2006-07-24 09:32:34 -07:00
|
|
|
static Evas_Object *
|
2012-06-26 01:58:14 -07:00
|
|
|
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2006-07-24 09:32:34 -07:00
|
|
|
{
|
2010-07-28 12:03:57 -07:00
|
|
|
Evas_Object *ol, *ow, *ot, *of;
|
2012-06-26 01:51:10 -07:00
|
|
|
char buf[64];
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2010-07-28 12:03:57 -07:00
|
|
|
ol = e_widget_list_add(evas, 0, 0);
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2012-06-26 01:55:31 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s %d", _("Configured Shelves: Display"), e_util_zone_current_get(cfd->con->manager)->num);
|
2012-06-26 01:51:10 -07:00
|
|
|
of = e_widget_framelist_add(evas, buf, 0);
|
2006-07-24 09:32:34 -07:00
|
|
|
cfdata->o_list = e_widget_ilist_add(evas, 24, 24, &(cfdata->cur_shelf));
|
2012-06-26 05:59:57 -07:00
|
|
|
evas_object_data_set(cfdata->o_list, "cfdata", cfdata);
|
2010-07-28 12:03:57 -07:00
|
|
|
e_widget_size_min_set(cfdata->o_list, (140 * e_scale), (80 * e_scale));
|
|
|
|
e_widget_framelist_object_append(of, cfdata->o_list);
|
|
|
|
e_widget_list_object_append(ol, of, 1, 1, 0.5);
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2006-07-24 09:32:34 -07:00
|
|
|
ot = e_widget_table_add(evas, 0);
|
2012-07-04 00:38:11 -07:00
|
|
|
cfdata->o_add = ow = e_widget_button_add(evas, _("Add"), "list-add", _cb_add, cfdata, NULL);
|
2010-07-28 12:03:57 -07:00
|
|
|
e_widget_table_object_append(ot, ow, 0, 0, 1, 1, 1, 1, 0, 0);
|
2012-06-26 01:58:14 -07:00
|
|
|
cfdata->o_delete = e_widget_button_add(evas, _("Delete"), "list-remove",
|
|
|
|
_cb_delete, cfdata, NULL);
|
2010-07-28 12:03:57 -07:00
|
|
|
e_widget_table_object_append(ot, cfdata->o_delete, 1, 0, 1, 1, 1, 1, 0, 0);
|
2012-07-04 00:38:11 -07:00
|
|
|
cfdata->o_rename = e_widget_button_add(evas, _("Rename"), "edit-rename",
|
|
|
|
_cb_rename, cfdata, NULL);
|
|
|
|
e_widget_table_object_append(ot, cfdata->o_rename, 2, 0, 1, 1, 1, 1, 0, 0);
|
2012-06-26 03:06:25 -07:00
|
|
|
cfdata->o_contents = e_widget_button_add(evas, _("Contents"), "preferences-desktop-shelf",
|
2012-07-03 06:53:44 -07:00
|
|
|
_cb_contents, cfdata, NULL);
|
2012-06-26 03:06:25 -07:00
|
|
|
e_widget_table_object_align_append(ot, cfdata->o_contents,
|
2012-07-04 00:38:11 -07:00
|
|
|
3, 0, 1, 1, 0, 1, 1, 1, 1.0, 0.5);
|
2012-06-26 01:58:14 -07:00
|
|
|
cfdata->o_config = e_widget_button_add(evas, _("Setup"), "configure",
|
|
|
|
_cb_config, cfdata, NULL);
|
|
|
|
e_widget_table_object_align_append(ot, cfdata->o_config,
|
2012-07-04 00:38:11 -07:00
|
|
|
4, 0, 1, 1, 0, 1, 1, 1, 1.0, 0.5);
|
2010-07-28 12:03:57 -07:00
|
|
|
e_widget_list_object_append(ol, ot, 1, 0, 0.0);
|
2006-07-24 09:32:34 -07:00
|
|
|
|
|
|
|
_ilist_fill(cfdata);
|
2012-07-04 00:38:11 -07:00
|
|
|
e_widget_disabled_set(cfdata->o_add, 0);
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2007-04-17 03:52:17 -07:00
|
|
|
e_dialog_resizable_set(cfd->dia, 1);
|
2010-07-28 12:03:57 -07:00
|
|
|
|
|
|
|
return ol;
|
2006-07-24 09:32:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* private functions */
|
2012-06-26 04:32:02 -07:00
|
|
|
static void
|
|
|
|
_ilist_refresh(E_Shelf *es)
|
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
|
|
|
|
cfdata = evas_object_data_get(es->o_base, "cfdata");
|
|
|
|
if (!cfdata) return;
|
|
|
|
_ilist_empty(cfdata);
|
|
|
|
_ilist_fill(cfdata);
|
|
|
|
}
|
|
|
|
|
2012-07-04 00:38:11 -07:00
|
|
|
static void
|
|
|
|
_widgets_disable(E_Config_Dialog_Data *cfdata, Eina_Bool disable, Eina_Bool list_too)
|
|
|
|
{
|
|
|
|
e_widget_disabled_set(cfdata->o_add, disable);
|
|
|
|
if (disable || e_widget_ilist_selected_count_get(cfdata->o_list))
|
|
|
|
{
|
|
|
|
e_widget_disabled_set(cfdata->o_delete, disable);
|
|
|
|
e_widget_disabled_set(cfdata->o_config, disable);
|
|
|
|
e_widget_disabled_set(cfdata->o_contents, disable);
|
|
|
|
e_widget_disabled_set(cfdata->o_rename, disable);
|
|
|
|
}
|
|
|
|
if (list_too) e_widget_disabled_set(cfdata->o_list, disable);
|
|
|
|
}
|
|
|
|
|
2012-06-26 03:06:25 -07:00
|
|
|
static void
|
|
|
|
_ilist_item_new(E_Config_Dialog_Data *cfdata, Eina_Bool append, E_Shelf *es)
|
|
|
|
{
|
|
|
|
char buf[256];
|
|
|
|
Evas_Object *ob;
|
|
|
|
|
2012-07-03 06:53:44 -07:00
|
|
|
if (es->name)
|
|
|
|
snprintf(buf, sizeof(buf), "%s", es->name);
|
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "%s %s", _("Shelf"), e_shelf_orient_string_get(es));
|
2012-06-26 04:32:02 -07:00
|
|
|
e_object_del_func_set(E_OBJECT(es), (E_Object_Cleanup_Func)_ilist_refresh);
|
|
|
|
evas_object_data_set(es->o_base, "cfdata", cfdata);
|
2012-06-26 03:06:25 -07:00
|
|
|
|
|
|
|
ob = e_icon_add(evas_object_evas_get(cfdata->o_list));
|
|
|
|
switch (es->cfg->orient)
|
|
|
|
{
|
|
|
|
case E_GADCON_ORIENT_LEFT:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-left");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_GADCON_ORIENT_RIGHT:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-right");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_GADCON_ORIENT_TOP:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-top");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_GADCON_ORIENT_BOTTOM:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-bottom");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_GADCON_ORIENT_CORNER_TL:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-top-left");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_GADCON_ORIENT_CORNER_TR:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-top-right");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_GADCON_ORIENT_CORNER_BL:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-bottom-left");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_GADCON_ORIENT_CORNER_BR:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-bottom-right");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_GADCON_ORIENT_CORNER_LT:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-left-top");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_GADCON_ORIENT_CORNER_RT:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-right-top");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_GADCON_ORIENT_CORNER_LB:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-left-bottom");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_GADCON_ORIENT_CORNER_RB:
|
|
|
|
e_util_icon_theme_set(ob, "preferences-position-right-bottom");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
e_util_icon_theme_set(ob, "enlightenment");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (append)
|
|
|
|
e_widget_ilist_append(cfdata->o_list, ob, buf,
|
2012-06-26 05:59:57 -07:00
|
|
|
_ilist_cb_selected, es, buf);
|
2012-06-26 03:06:25 -07:00
|
|
|
else
|
|
|
|
e_widget_ilist_prepend(cfdata->o_list, ob, buf,
|
2012-07-03 06:53:44 -07:00
|
|
|
_ilist_cb_selected, es, buf);
|
2012-06-26 04:50:12 -07:00
|
|
|
cfdata->shelves = eina_list_append(cfdata->shelves, es);
|
2012-06-26 03:06:25 -07:00
|
|
|
}
|
|
|
|
|
2012-06-26 04:32:02 -07:00
|
|
|
static void
|
|
|
|
_ilist_empty(E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
E_Shelf *es;
|
|
|
|
E_Desk *desk;
|
|
|
|
E_Zone *zone;
|
|
|
|
|
2012-06-26 04:50:12 -07:00
|
|
|
if ((!cfdata) || (!cfdata->cfd) || (!cfdata->cfd->con) || (!cfdata->cfd->con->manager)) return;
|
2012-06-26 04:32:02 -07:00
|
|
|
zone = e_util_zone_current_get(cfdata->cfd->con->manager);
|
2012-06-26 04:50:12 -07:00
|
|
|
if (!zone) return;
|
2012-06-26 04:32:02 -07:00
|
|
|
desk = e_desk_current_get(zone);
|
|
|
|
EINA_LIST_FOREACH(e_shelf_list(), l, es)
|
|
|
|
{
|
|
|
|
if (es->zone != zone) continue;
|
|
|
|
if (es->cfg->desk_show_mode)
|
|
|
|
{
|
|
|
|
Eina_List *ll;
|
|
|
|
E_Config_Shelf_Desk *sd;
|
2012-07-03 06:53:44 -07:00
|
|
|
|
2012-06-26 04:32:02 -07:00
|
|
|
EINA_LIST_FOREACH(es->cfg->desk_list, ll, sd)
|
|
|
|
{
|
|
|
|
if ((desk->x == sd->x) && (desk->y == sd->y))
|
|
|
|
{
|
|
|
|
e_object_del_func_set(E_OBJECT(es), NULL);
|
2012-06-26 04:50:12 -07:00
|
|
|
evas_object_data_del(es->o_base, "cfdata");
|
2012-06-26 04:32:02 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2012-06-26 04:50:12 -07:00
|
|
|
{
|
|
|
|
e_object_del_func_set(E_OBJECT(es), NULL);
|
|
|
|
evas_object_data_del(es->o_base, "cfdata");
|
|
|
|
}
|
2012-06-26 04:32:02 -07:00
|
|
|
}
|
|
|
|
e_widget_ilist_clear(cfdata->o_list);
|
2012-06-26 04:50:12 -07:00
|
|
|
cfdata->shelves = eina_list_free(cfdata->shelves);
|
2012-06-26 04:32:02 -07:00
|
|
|
}
|
|
|
|
|
2012-06-26 01:58:14 -07:00
|
|
|
static void
|
|
|
|
_ilist_fill(E_Config_Dialog_Data *cfdata)
|
2006-04-30 02:31:31 -07:00
|
|
|
{
|
2006-07-24 09:32:34 -07:00
|
|
|
Evas *evas;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2012-06-26 02:08:01 -07:00
|
|
|
E_Shelf *es;
|
2012-06-26 03:06:25 -07:00
|
|
|
E_Desk *desk;
|
|
|
|
E_Zone *zone;
|
2006-07-24 09:32:34 -07:00
|
|
|
int n = -1;
|
2012-06-26 03:06:25 -07:00
|
|
|
Eina_Bool header = EINA_FALSE;
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2006-07-24 09:32:34 -07:00
|
|
|
if (!cfdata) return;
|
2006-07-24 10:44:37 -07:00
|
|
|
if (!cfdata->o_list) return;
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2006-07-24 09:32:34 -07:00
|
|
|
evas = evas_object_evas_get(cfdata->o_list);
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2012-06-26 01:58:14 -07:00
|
|
|
if (e_widget_ilist_count(cfdata->o_list) > 0)
|
2006-07-24 09:32:34 -07:00
|
|
|
n = e_widget_ilist_selected_get(cfdata->o_list);
|
2006-11-27 08:35:30 -08:00
|
|
|
|
|
|
|
evas_event_freeze(evas);
|
|
|
|
edje_freeze();
|
|
|
|
e_widget_ilist_freeze(cfdata->o_list);
|
2006-07-24 09:32:34 -07:00
|
|
|
e_widget_ilist_clear(cfdata->o_list);
|
|
|
|
e_widget_ilist_go(cfdata->o_list);
|
2012-06-26 03:06:25 -07:00
|
|
|
zone = e_util_zone_current_get(cfdata->cfd->con->manager);
|
|
|
|
desk = e_desk_current_get(zone);
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2012-06-26 02:08:01 -07:00
|
|
|
EINA_LIST_FOREACH(e_shelf_list(), l, es)
|
2006-04-30 02:31:31 -07:00
|
|
|
{
|
2012-06-26 03:06:25 -07:00
|
|
|
if (es->zone != zone) continue;
|
|
|
|
if (es->cfg->desk_show_mode)
|
2006-06-15 06:09:21 -07:00
|
|
|
{
|
2012-06-26 03:06:25 -07:00
|
|
|
Eina_List *ll;
|
|
|
|
E_Config_Shelf_Desk *sd;
|
2012-07-03 06:53:44 -07:00
|
|
|
|
2012-06-26 03:06:25 -07:00
|
|
|
EINA_LIST_FOREACH(es->cfg->desk_list, ll, sd)
|
|
|
|
{
|
|
|
|
if ((desk->x == sd->x) && (desk->y == sd->y))
|
|
|
|
{
|
|
|
|
if (!header)
|
|
|
|
{
|
|
|
|
char buf[32];
|
|
|
|
header = EINA_TRUE;
|
|
|
|
snprintf(buf, sizeof(buf), "Desk %d,%d", desk->x, desk->y);
|
|
|
|
e_widget_ilist_header_append(cfdata->o_list, NULL, buf);
|
|
|
|
}
|
|
|
|
_ilist_item_new(cfdata, EINA_TRUE, es);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-06-15 06:09:21 -07:00
|
|
|
}
|
2012-06-26 03:06:25 -07:00
|
|
|
else
|
|
|
|
_ilist_item_new(cfdata, !header, es);
|
2006-07-24 09:32:34 -07:00
|
|
|
}
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2009-09-01 06:34:42 -07:00
|
|
|
e_widget_size_min_set(cfdata->o_list, 155, 250);
|
2006-07-24 09:32:34 -07:00
|
|
|
e_widget_ilist_go(cfdata->o_list);
|
2006-11-27 08:35:30 -08:00
|
|
|
e_widget_ilist_thaw(cfdata->o_list);
|
|
|
|
edje_thaw();
|
|
|
|
evas_event_thaw(evas);
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2012-06-26 01:58:14 -07:00
|
|
|
if (n > -1)
|
2006-07-24 09:32:34 -07:00
|
|
|
{
|
2012-07-04 00:38:11 -07:00
|
|
|
_widgets_disable(cfdata, 0, EINA_TRUE);
|
2012-06-26 01:58:14 -07:00
|
|
|
e_widget_ilist_selected_set(cfdata->o_list, n);
|
2006-04-30 02:31:31 -07:00
|
|
|
}
|
2006-07-24 09:32:34 -07:00
|
|
|
else
|
|
|
|
{
|
2012-07-04 00:38:11 -07:00
|
|
|
_widgets_disable(cfdata, 1, EINA_TRUE);
|
|
|
|
e_widget_disabled_set(cfdata->o_add, 0);
|
2006-07-24 09:32:34 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-26 01:58:14 -07:00
|
|
|
static void
|
|
|
|
_ilist_cb_selected(void *data)
|
2006-07-24 09:32:34 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2012-06-26 05:59:57 -07:00
|
|
|
E_Shelf *es = data;
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2012-06-26 05:59:57 -07:00
|
|
|
if (!(cfdata = evas_object_data_get(es->o_base, "cfdata"))) return;
|
2012-07-04 00:38:11 -07:00
|
|
|
_widgets_disable(cfdata, 0, EINA_TRUE);
|
2006-04-30 02:31:31 -07:00
|
|
|
}
|
|
|
|
|
2012-07-04 01:16:25 -07:00
|
|
|
static E_Dialog *
|
2012-07-04 00:38:11 -07:00
|
|
|
_dia_name_shelf(E_Config_Dialog_Data *cfdata, Eina_Bool rename)
|
2012-07-03 06:53:44 -07:00
|
|
|
{
|
|
|
|
E_Dialog *dia;
|
|
|
|
Evas *evas;
|
|
|
|
Evas_Coord mw, mh;
|
|
|
|
Evas_Object *ot, *ob;
|
|
|
|
char buf[256];
|
|
|
|
int id;
|
|
|
|
|
|
|
|
dia = e_dialog_new(cfdata->cfd->con, "E", "shelf_new_shelf_dialog");
|
|
|
|
if (!dia) return NULL;
|
|
|
|
dia->data = cfdata;
|
2012-07-04 00:38:11 -07:00
|
|
|
_widgets_disable(cfdata, 1, EINA_TRUE);
|
2012-07-03 06:53:44 -07:00
|
|
|
|
|
|
|
e_object_del_attach_func_set(E_OBJECT(dia), _new_shelf_cb_dia_del);
|
|
|
|
e_win_centered_set(dia->win, 1);
|
|
|
|
|
|
|
|
evas = e_win_evas_get(dia->win);
|
|
|
|
|
2012-07-04 00:38:11 -07:00
|
|
|
if (rename)
|
|
|
|
e_dialog_title_set(dia, _("Rename Shelf"));
|
|
|
|
else
|
|
|
|
e_dialog_title_set(dia, _("Add New Shelf"));
|
2012-07-03 06:53:44 -07:00
|
|
|
|
|
|
|
ot = e_widget_table_add(evas, 0);
|
|
|
|
ob = e_widget_label_add(evas, _("Name:"));
|
|
|
|
e_widget_table_object_append(ot, ob,
|
|
|
|
0, 0, 1, 1,
|
|
|
|
0, 1, 0, 0);
|
|
|
|
|
|
|
|
id = e_widget_ilist_count(cfdata->o_list);
|
2012-07-04 00:38:11 -07:00
|
|
|
if (rename)
|
|
|
|
{
|
|
|
|
E_Shelf *es;
|
|
|
|
|
|
|
|
es = e_widget_ilist_selected_data_get(cfdata->o_list);
|
|
|
|
snprintf(buf, sizeof(buf), "%s", es->name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "%s #%d", _("Shelf"), id);
|
2012-07-03 06:53:44 -07:00
|
|
|
cfdata->new_shelf = strdup(buf);
|
|
|
|
ob = e_widget_entry_add(evas, &(cfdata->new_shelf), NULL, NULL, NULL);
|
|
|
|
e_widget_size_min_set(ob, 100, 1);
|
|
|
|
e_widget_table_object_append(ot, ob, 1, 0, 1, 1, 1, 1, 1, 0);
|
|
|
|
|
|
|
|
e_widget_size_min_get(ot, &mw, &mh);
|
|
|
|
e_dialog_content_set(dia, ot, mw, mh);
|
|
|
|
|
2012-07-04 00:38:11 -07:00
|
|
|
if (rename)
|
|
|
|
e_dialog_button_add(dia, _("OK"), NULL, _rename_shelf_cb_ok, cfdata);
|
|
|
|
else
|
|
|
|
e_dialog_button_add(dia, _("OK"), NULL, _new_shelf_cb_ok, cfdata);
|
2012-07-03 06:53:44 -07:00
|
|
|
e_dialog_button_add(dia, _("Cancel"), NULL, _new_shelf_cb_close, cfdata);
|
|
|
|
|
|
|
|
e_dialog_resizable_set(dia, 0);
|
|
|
|
e_dialog_show(dia);
|
|
|
|
|
|
|
|
return dia;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_new_shelf_cb_close(void *data, E_Dialog *dia)
|
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
cfdata = data;
|
|
|
|
if (!cfdata) return;
|
|
|
|
|
2012-07-04 00:38:11 -07:00
|
|
|
_widgets_disable(cfdata, 0, EINA_TRUE);
|
2012-07-03 06:53:44 -07:00
|
|
|
e_object_unref(E_OBJECT(dia));
|
|
|
|
cfdata->dia_new_shelf = NULL;
|
|
|
|
}
|
|
|
|
|
2012-06-26 01:58:14 -07:00
|
|
|
static void
|
|
|
|
_cb_add(void *data, void *data2 __UNUSED__)
|
2012-07-03 06:53:44 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
|
|
|
|
cfdata = data;
|
|
|
|
if (!cfdata) return;
|
|
|
|
|
2012-07-04 00:38:11 -07:00
|
|
|
cfdata->dia_new_shelf = _dia_name_shelf(cfdata, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_rename_shelf_cb_ok(void *data, E_Dialog *dia)
|
|
|
|
{
|
|
|
|
E_Shelf *es;
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
|
|
|
|
cfdata = data;
|
|
|
|
if (!cfdata) return;
|
|
|
|
if ((!cfdata->new_shelf) || (!cfdata->new_shelf[0]))
|
|
|
|
{
|
|
|
|
free(cfdata->new_shelf);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
es = e_widget_ilist_selected_data_get(cfdata->o_list);
|
|
|
|
eina_stringshare_replace(&es->name, cfdata->new_shelf);
|
|
|
|
e_config_save_queue();
|
|
|
|
|
|
|
|
e_shelf_config_update();
|
|
|
|
cfdata->dia_new_shelf = NULL;
|
|
|
|
e_object_unref(E_OBJECT(dia));
|
|
|
|
_ilist_empty(cfdata);
|
|
|
|
_ilist_fill(cfdata);
|
2012-07-03 06:53:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_new_shelf_cb_ok(void *data, E_Dialog *dia)
|
2006-04-30 02:31:31 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2012-07-04 00:38:11 -07:00
|
|
|
E_Config_Shelf *cfg, *c;
|
2006-07-24 09:32:34 -07:00
|
|
|
E_Container *con;
|
|
|
|
E_Zone *zone;
|
2012-07-04 00:38:11 -07:00
|
|
|
Eina_List *l;
|
|
|
|
unsigned int x;
|
|
|
|
unsigned long orient = 1;
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2012-07-03 06:53:44 -07:00
|
|
|
cfdata = data;
|
|
|
|
if (!cfdata) return;
|
|
|
|
if (!cfdata->new_shelf)
|
|
|
|
{
|
|
|
|
_new_shelf_cb_dia_del(dia);
|
|
|
|
return;
|
|
|
|
}
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2006-07-24 09:32:34 -07:00
|
|
|
con = e_container_current_get(e_manager_current_get());
|
|
|
|
zone = e_zone_current_get(con);
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2006-07-20 06:36:02 -07:00
|
|
|
cfg = E_NEW(E_Config_Shelf, 1);
|
2012-07-03 06:53:44 -07:00
|
|
|
cfg->name = eina_stringshare_add(cfdata->new_shelf);
|
2006-07-24 09:32:34 -07:00
|
|
|
cfg->container = con->num;
|
2012-02-14 20:35:18 -08:00
|
|
|
cfg->zone = zone->num;
|
2006-07-20 06:36:02 -07:00
|
|
|
cfg->popup = 1;
|
|
|
|
cfg->layer = 200;
|
2012-07-04 00:38:11 -07:00
|
|
|
EINA_LIST_FOREACH(e_config->shelves, l, c)
|
|
|
|
orient *= orientations[c->orient];
|
|
|
|
for (x = 3; x < (sizeof(orientations) / sizeof(orientations[0])); x++)
|
|
|
|
if (orient % orientations[x])
|
|
|
|
{
|
|
|
|
cfg->orient = x;
|
|
|
|
break;
|
|
|
|
}
|
2006-07-20 06:36:02 -07:00
|
|
|
cfg->fit_along = 1;
|
|
|
|
cfg->fit_size = 0;
|
2008-10-15 08:12:56 -07:00
|
|
|
cfg->style = eina_stringshare_add("default");
|
2006-07-20 06:36:02 -07:00
|
|
|
cfg->size = 40;
|
2006-10-01 13:10:37 -07:00
|
|
|
cfg->overlap = 0;
|
2007-03-02 09:00:20 -08:00
|
|
|
cfg->autohide = 0;
|
2008-10-22 04:49:33 -07:00
|
|
|
e_config->shelves = eina_list_append(e_config->shelves, cfg);
|
2006-07-26 12:10:20 -07:00
|
|
|
e_config_save_queue();
|
2006-07-20 06:36:02 -07:00
|
|
|
|
2010-11-22 07:23:15 -08:00
|
|
|
e_shelf_config_update();
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2012-07-03 06:53:44 -07:00
|
|
|
cfdata->dia_new_shelf = NULL;
|
|
|
|
e_object_unref(E_OBJECT(dia));
|
2006-04-30 02:31:31 -07:00
|
|
|
_ilist_fill(cfdata);
|
|
|
|
}
|
|
|
|
|
2012-07-03 06:53:44 -07:00
|
|
|
static void
|
|
|
|
_new_shelf_cb_dia_del(void *obj)
|
|
|
|
{
|
|
|
|
E_Dialog *dia = obj;
|
|
|
|
E_Config_Dialog_Data *cfdata = dia->data;
|
|
|
|
|
|
|
|
cfdata->dia_new_shelf = NULL;
|
2012-07-04 00:38:11 -07:00
|
|
|
free(cfdata->new_shelf);
|
2012-07-03 06:53:44 -07:00
|
|
|
cfdata->new_shelf = NULL;
|
2012-07-04 00:38:11 -07:00
|
|
|
e_widget_disabled_set(cfdata->o_list, 0);
|
2012-07-03 06:53:44 -07:00
|
|
|
e_object_unref(E_OBJECT(dia));
|
|
|
|
}
|
|
|
|
|
2012-07-04 00:38:11 -07:00
|
|
|
static void
|
|
|
|
_cb_rename(void *data, void *d __UNUSED__)
|
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata = data;
|
|
|
|
cfdata->dia_new_shelf = _dia_name_shelf(cfdata, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
2012-06-26 01:58:14 -07:00
|
|
|
static void
|
|
|
|
_cb_delete(void *data, void *data2 __UNUSED__)
|
2006-07-24 09:32:34 -07:00
|
|
|
{
|
2012-07-04 01:16:25 -07:00
|
|
|
char buf[1024];
|
|
|
|
E_Config_Dialog_Data *cfdata = data;
|
|
|
|
E_Shelf *es;
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2012-07-04 01:16:25 -07:00
|
|
|
es = e_widget_ilist_selected_data_get(cfdata->o_list);
|
|
|
|
if (!es) return;
|
|
|
|
|
|
|
|
e_object_ref(E_OBJECT(es));
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2008-01-23 16:55:16 -08:00
|
|
|
if (e_config->cnfmdlg_disabled)
|
|
|
|
{
|
2012-07-04 01:16:25 -07:00
|
|
|
if (e_object_is_del(E_OBJECT(es))) return;
|
|
|
|
e_shelf_unsave(es);
|
|
|
|
e_object_del(E_OBJECT(es));
|
2008-01-23 16:55:16 -08:00
|
|
|
e_config_save_queue();
|
|
|
|
|
2012-07-04 01:16:25 -07:00
|
|
|
e_object_unref(E_OBJECT(es));
|
|
|
|
_ilist_fill(cfdata);
|
2011-01-02 13:12:11 -08:00
|
|
|
return;
|
2008-01-23 16:55:16 -08:00
|
|
|
}
|
2012-07-04 00:38:11 -07:00
|
|
|
_widgets_disable(data, 1, EINA_TRUE);
|
2006-07-24 09:32:34 -07:00
|
|
|
snprintf(buf, sizeof(buf), _("You requested to delete \"%s\".<br><br>"
|
2012-06-26 01:58:14 -07:00
|
|
|
"Are you sure you want to delete this shelf?"),
|
2012-07-04 01:16:25 -07:00
|
|
|
cfdata->cur_shelf);
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2012-07-04 01:16:25 -07:00
|
|
|
evas_object_data_set(es->o_base, "cfdata", cfdata);
|
2012-06-26 01:58:14 -07:00
|
|
|
e_confirm_dialog_show(_("Are you sure you want to delete this shelf?"),
|
|
|
|
"application-exit", buf, _("Delete"), _("Keep"),
|
2012-07-04 01:16:25 -07:00
|
|
|
_cb_dialog_yes, NULL, es, NULL, _cb_dialog_destroy, es);
|
2006-07-24 09:32:34 -07:00
|
|
|
}
|
|
|
|
|
2012-06-26 01:58:14 -07:00
|
|
|
static void
|
|
|
|
_cb_dialog_yes(void *data)
|
2006-05-22 13:28:33 -07:00
|
|
|
{
|
2012-07-04 01:16:25 -07:00
|
|
|
E_Shelf *es;
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2006-12-14 07:40:19 -08:00
|
|
|
|
2012-07-04 01:16:25 -07:00
|
|
|
es = data;;
|
|
|
|
if (e_object_is_del(E_OBJECT(es))) return;
|
|
|
|
cfdata = evas_object_data_get(es->o_base, "cfdata");
|
|
|
|
if (!cfdata) return;
|
|
|
|
evas_object_data_del(es->o_base, "cfdata");
|
|
|
|
e_shelf_unsave(es);
|
|
|
|
e_object_del(E_OBJECT(es));
|
2006-07-24 09:32:34 -07:00
|
|
|
e_config_save_queue();
|
2012-07-04 01:16:25 -07:00
|
|
|
_widgets_disable(cfdata, 0, EINA_TRUE);
|
2006-10-30 02:42:23 -08:00
|
|
|
}
|
2006-05-22 05:01:09 -07:00
|
|
|
|
2006-10-30 02:42:23 -08:00
|
|
|
static void
|
|
|
|
_cb_dialog_destroy(void *data)
|
|
|
|
{
|
2012-07-04 01:16:25 -07:00
|
|
|
E_Shelf *es;
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2006-10-30 02:42:23 -08:00
|
|
|
|
2012-07-04 01:16:25 -07:00
|
|
|
es = data;;
|
|
|
|
cfdata = evas_object_data_get(es->o_base, "cfdata");
|
|
|
|
if (!cfdata) return;
|
|
|
|
evas_object_data_del(es->o_base, "cfdata");
|
|
|
|
e_object_unref(E_OBJECT(es));
|
|
|
|
_ilist_empty(cfdata);
|
|
|
|
_ilist_fill(cfdata);
|
2006-04-30 02:31:31 -07:00
|
|
|
}
|
|
|
|
|
2012-07-04 00:38:11 -07:00
|
|
|
static void
|
|
|
|
_cb_config_end(void *data)
|
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd = data;
|
|
|
|
E_Shelf *es;
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
|
|
|
|
es = cfd->data;
|
|
|
|
cfdata = evas_object_data_get(es->o_base, "cfdata");
|
|
|
|
if (!cfdata) return;
|
|
|
|
evas_object_data_del(es->o_base, "cfdata");
|
|
|
|
e_widget_disabled_set(cfdata->o_list, 0);
|
|
|
|
}
|
|
|
|
|
2012-06-26 01:58:14 -07:00
|
|
|
static void
|
|
|
|
_cb_config(void *data, void *data2 __UNUSED__)
|
2006-04-30 02:31:31 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
E_Shelf *es;
|
2007-12-17 17:49:45 -08:00
|
|
|
|
2011-01-02 13:12:11 -08:00
|
|
|
if (!(cfdata = data)) return;
|
2012-06-26 05:59:57 -07:00
|
|
|
es = e_widget_ilist_selected_data_get(cfdata->o_list);
|
2006-04-30 02:31:31 -07:00
|
|
|
if (!es) return;
|
2012-07-04 00:38:11 -07:00
|
|
|
if (!es->config_dialog)
|
|
|
|
{
|
|
|
|
e_int_shelf_config(es);
|
|
|
|
evas_object_data_set(es->o_base, "cfdata", cfdata);
|
|
|
|
e_object_del_attach_func_set(E_OBJECT(es->config_dialog), _cb_config_end);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_contents_end(void *data)
|
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd = data;
|
|
|
|
E_Shelf *es;
|
|
|
|
E_Gadcon *gc;
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
|
|
|
|
gc = cfd->data;
|
|
|
|
es = gc->shelf;
|
|
|
|
cfdata = evas_object_data_get(es->o_base, "cfdata");
|
|
|
|
if (!cfdata) return;
|
|
|
|
evas_object_data_del(es->o_base, "cfdata");
|
|
|
|
e_widget_disabled_set(cfdata->o_list, 0);
|
2006-04-30 02:31:31 -07:00
|
|
|
}
|
2011-06-11 20:05:16 -07:00
|
|
|
|
2012-06-26 01:58:14 -07:00
|
|
|
static void
|
|
|
|
_cb_contents(void *data, void *data2 __UNUSED__)
|
2011-06-11 20:05:16 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
E_Shelf *es;
|
|
|
|
|
|
|
|
if (!(cfdata = data)) return;
|
2012-06-26 05:59:57 -07:00
|
|
|
es = e_widget_ilist_selected_data_get(cfdata->o_list);
|
2011-06-11 20:05:16 -07:00
|
|
|
if (!es) return;
|
2012-07-04 00:38:11 -07:00
|
|
|
if (!es->config_dialog)
|
|
|
|
{
|
|
|
|
e_int_gadcon_config_shelf(es->gadcon);
|
|
|
|
evas_object_data_set(es->o_base, "cfdata", cfdata);
|
|
|
|
e_object_del_attach_func_set(E_OBJECT(es->gadcon->config_dialog), _cb_contents_end);
|
|
|
|
}
|
2011-06-11 20:05:16 -07:00
|
|
|
}
|
2012-06-26 01:58:14 -07:00
|
|
|
|