forked from enlightenment/enlightenment
Updated module to use the dialog that raster designed. :) Some Cleanups
SVN revision: 19091
This commit is contained in:
parent
7576bbcbb4
commit
e59b6b354a
|
@ -5,22 +5,11 @@
|
|||
typedef struct _cfdata CFData;
|
||||
typedef struct _Cfg_File_Data Cfg_File_Data;
|
||||
|
||||
#define ICONSIZE_SMALL 24
|
||||
#define ICONSIZE_MEDIUM 32
|
||||
#define ICONSIZE_LARGE 40
|
||||
#define ICONSIZE_VERYLARGE 48
|
||||
|
||||
struct _cfdata
|
||||
{
|
||||
/* Basic Config */
|
||||
int method;
|
||||
int icon_method;
|
||||
|
||||
int autofit;
|
||||
int follower;
|
||||
int width;
|
||||
int iconsize;
|
||||
|
||||
/* Advanced Config */
|
||||
double follow_speed;
|
||||
double autoscroll_speed;
|
||||
};
|
||||
|
@ -40,15 +29,11 @@ static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
|
|||
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
|
||||
static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
|
||||
|
||||
IBox *ib = NULL;
|
||||
|
||||
void e_int_config_ibox(E_Container *con, IBox *ibox)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View v;
|
||||
|
||||
ib = ibox;
|
||||
|
||||
/* Dialog Methods */
|
||||
v.create_cfdata = _create_data;
|
||||
v.free_cfdata = _free_data;
|
||||
|
@ -58,26 +43,14 @@ void e_int_config_ibox(E_Container *con, IBox *ibox)
|
|||
v.advanced.create_widgets = _advanced_create_widgets;
|
||||
|
||||
/* Create The Dialog */
|
||||
cfd = e_config_dialog_new(con, _("IBox Module"), NULL, 0, &v, ibox);
|
||||
cfd = e_config_dialog_new(con, _("IBox Configuration"), NULL, 0, &v, ibox);
|
||||
}
|
||||
|
||||
static void _fill_data(CFData *cfdata)
|
||||
static void _fill_data(IBox *ib, CFData *cfdata)
|
||||
{
|
||||
cfdata->autofit = (ib->conf->width == IBOX_WIDTH_AUTO);
|
||||
cfdata->follower = ib->conf->follower;
|
||||
cfdata->width = ib->conf->width;
|
||||
if (cfdata->width == IBOX_WIDTH_AUTO)
|
||||
{
|
||||
cfdata->method = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cfdata->method = 0;
|
||||
}
|
||||
cfdata->iconsize = ib->conf->iconsize;
|
||||
if (cfdata->iconsize <=24) cfdata->icon_method = ICONSIZE_SMALL;
|
||||
if ((cfdata->iconsize > 24) && (cfdata->iconsize <=32)) cfdata->icon_method = ICONSIZE_MEDIUM;
|
||||
if ((cfdata->iconsize > 32) && (cfdata->iconsize <=40)) cfdata->icon_method = ICONSIZE_LARGE;
|
||||
if (cfdata->iconsize > 40) cfdata->icon_method = ICONSIZE_VERYLARGE;
|
||||
cfdata->follow_speed = ib->conf->follow_speed;
|
||||
cfdata->autoscroll_speed = ib->conf->autoscroll_speed;
|
||||
}
|
||||
|
@ -85,8 +58,11 @@ static void _fill_data(CFData *cfdata)
|
|||
static void *_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
CFData *cfdata;
|
||||
|
||||
IBox *ib;
|
||||
|
||||
ib = cfd->data;
|
||||
cfdata = E_NEW(CFData, 1);
|
||||
_fill_data(ib, cfdata);
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
|
@ -97,51 +73,44 @@ static void _free_data(E_Config_Dialog *cfd, CFData *cfdata)
|
|||
|
||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||
{
|
||||
Evas_Object *o, *of, *ob;
|
||||
E_Radio_Group *rg;
|
||||
Evas_Object *o, *ob;
|
||||
IBox *ib;
|
||||
|
||||
ib = cfd->data;
|
||||
_fill_data(ib, cfdata);
|
||||
|
||||
_fill_data(cfdata);
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
of = e_widget_framelist_add(evas, _("General Settings"), 0);
|
||||
ob = e_widget_check_add(evas, _("Show Follower"), &(cfdata->follower));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_check_add(evas, _("Auto Fit Icons"), &(cfdata->method));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Icon Size"), 0);
|
||||
rg = e_widget_radio_group_new(&(cfdata->icon_method));
|
||||
ob = e_widget_radio_add(evas, _("Small"), ICONSIZE_SMALL, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, _("Medium"), ICONSIZE_MEDIUM, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, _("Large"), ICONSIZE_LARGE, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_radio_add(evas, _("Very Large"), ICONSIZE_VERYLARGE, rg);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
ob = e_widget_check_add(evas, _("Auto Fit Icons"), &(cfdata->autofit));
|
||||
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||
return o;
|
||||
}
|
||||
|
||||
static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||
{
|
||||
e_border_button_bindings_ungrab_all();
|
||||
ib->conf->follower = cfdata->follower;
|
||||
if (cfdata->method == 0)
|
||||
{
|
||||
cfdata->width = IBOX_WIDTH_FIXED;
|
||||
}
|
||||
else
|
||||
{
|
||||
cfdata->width = IBOX_WIDTH_AUTO;
|
||||
}
|
||||
ib->conf->width = cfdata->width;
|
||||
if (cfdata->icon_method == ICONSIZE_SMALL) ib->conf->iconsize = 24;
|
||||
if (cfdata->icon_method == ICONSIZE_MEDIUM) ib->conf->iconsize = 32;
|
||||
if (cfdata->icon_method == ICONSIZE_LARGE) ib->conf->iconsize = 40;
|
||||
if (cfdata->icon_method == ICONSIZE_VERYLARGE) ib->conf->iconsize = 48;
|
||||
IBox *ib;
|
||||
Evas_List *l;
|
||||
|
||||
ib = cfd->data;
|
||||
e_border_button_bindings_ungrab_all();
|
||||
if ((cfdata->follower) && (!ib->conf->follower))
|
||||
{
|
||||
ib->conf->follower = 1;
|
||||
}
|
||||
else if (!(cfdata->follower) && (ib->conf->follower))
|
||||
{
|
||||
ib->conf->follower = 0;
|
||||
}
|
||||
|
||||
if ((cfdata->autofit) && (ib->conf->width == IBOX_WIDTH_FIXED))
|
||||
{
|
||||
ib->conf->width = IBOX_WIDTH_AUTO;
|
||||
}
|
||||
else if (!(cfdata->autofit) && (ib->conf->width == IBOX_WIDTH_AUTO))
|
||||
{
|
||||
ib->conf->width = IBOX_WIDTH_FIXED;
|
||||
}
|
||||
e_border_button_bindings_grab_all();
|
||||
e_config_save_queue();
|
||||
|
||||
|
@ -151,57 +120,76 @@ static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
|||
|
||||
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||
{
|
||||
Evas_Object *o, *of, *ob, *ot;
|
||||
E_Radio_Group *rg;
|
||||
Evas_Object *o, *of, *ob;
|
||||
IBox *ib;
|
||||
|
||||
ib = cfd->data;
|
||||
_fill_data(ib, cfdata);
|
||||
|
||||
_fill_data(cfdata);
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
of = e_widget_framelist_add(evas, _("General Settings"), 0);
|
||||
ob = e_widget_check_add(evas, _("Show Follower"), &(cfdata->follower));
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Follower"), 0);
|
||||
ob = e_widget_check_add(evas, _("Visible"), &(cfdata->follower));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_check_add(evas, _("Auto Fit Icons"), &(cfdata->method));
|
||||
ob = e_widget_label_add(evas, _("Follow Speed"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0, &(cfdata->follow_speed), NULL,200);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Icon Settings"), 0);
|
||||
ob = e_widget_label_add(evas, _("Icon Size:"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f pixels"), 8, 128, 1, 0, NULL, &(cfdata->iconsize), 200);
|
||||
of = e_widget_framelist_add(evas, _("Icon Size"), 0);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%3.0f pixels"), 8.0, 128.0, 1.0, 0, NULL, &(cfdata->iconsize), 200);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
/* Advanced Options */
|
||||
of = e_widget_framelist_add(evas, _("Advanced Settings"), 0);
|
||||
ob = e_widget_label_add(evas, _("Follow Speed:"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f pixels/sec"), 0.01, 0.99, 0.01, 0, &(cfdata->follow_speed), NULL,200);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Width"), 0);
|
||||
ob = e_widget_check_add(evas, _("Auto Fit"), &(cfdata->autofit));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_label_add(evas, _("Autoscroll Speed:"));
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f pixels/sec"), 0.01, 0.99, 0.01, 0, &(cfdata->autoscroll_speed), NULL,200);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01, 0, &(cfdata->autoscroll_speed), NULL,200);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
return o;
|
||||
}
|
||||
|
||||
static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||
{
|
||||
IBox *ib;
|
||||
|
||||
ib = cfd->data;
|
||||
e_border_button_bindings_ungrab_all();
|
||||
ib->conf->follower = cfdata->follower;
|
||||
if (cfdata->method == 0)
|
||||
if ((cfdata->follower) && (!ib->conf->follower))
|
||||
{
|
||||
cfdata->width = IBOX_WIDTH_FIXED;
|
||||
ib->conf->follower = 1;
|
||||
}
|
||||
else
|
||||
else if (!(cfdata->follower) && (ib->conf->follower))
|
||||
{
|
||||
cfdata->width = IBOX_WIDTH_AUTO;
|
||||
ib->conf->follower = 0;
|
||||
}
|
||||
|
||||
if ((cfdata->autofit) && (ib->conf->width == IBOX_WIDTH_FIXED))
|
||||
{
|
||||
ib->conf->width = IBOX_WIDTH_AUTO;
|
||||
}
|
||||
else if (!(cfdata->autofit) && (ib->conf->width == IBOX_WIDTH_AUTO))
|
||||
{
|
||||
ib->conf->width = IBOX_WIDTH_FIXED;
|
||||
}
|
||||
ib->conf->width = cfdata->width;
|
||||
ib->conf->iconsize = cfdata->iconsize;
|
||||
ib->conf->follow_speed = cfdata->follow_speed;
|
||||
ib->conf->autoscroll_speed = cfdata->autoscroll_speed;
|
||||
|
||||
if (cfdata->iconsize != ib->conf->iconsize)
|
||||
{
|
||||
ib->conf->iconsize = cfdata->iconsize;
|
||||
}
|
||||
if (cfdata->follow_speed != ib->conf->follow_speed)
|
||||
{
|
||||
ib->conf->follow_speed = cfdata->follow_speed;
|
||||
}
|
||||
if (cfdata->autoscroll_speed != ib->conf->autoscroll_speed)
|
||||
{
|
||||
ib->conf->autoscroll_speed = cfdata->autoscroll_speed;
|
||||
}
|
||||
|
||||
e_border_button_bindings_grab_all();
|
||||
e_config_save_queue();
|
||||
|
||||
|
|
Loading…
Reference in New Issue