forked from enlightenment/enlightenment
Updated Battery Config Dialogue. Opinions ?
SVN revision: 19068
This commit is contained in:
parent
b0fafe4f5a
commit
4212bf5607
|
@ -7,10 +7,9 @@ typedef struct _Cfg_File_Data Cfg_File_Data;
|
||||||
|
|
||||||
struct _cfdata
|
struct _cfdata
|
||||||
{
|
{
|
||||||
double poll_time;
|
int show_alert;
|
||||||
|
double poll_time;
|
||||||
int alarm_time;
|
int alarm_time;
|
||||||
int poll_method;
|
|
||||||
int alarm_method;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Cfg_File_Data
|
struct _Cfg_File_Data
|
||||||
|
@ -51,48 +50,16 @@ e_int_config_battery(E_Container *con, Battery *bat)
|
||||||
static void
|
static void
|
||||||
_fill_data(CFData *cfdata)
|
_fill_data(CFData *cfdata)
|
||||||
{
|
{
|
||||||
double p;
|
cfdata->alarm_time = b->conf->alarm;
|
||||||
int a;
|
cfdata->poll_time = b->conf->poll_time;
|
||||||
|
if (cfdata->alarm_time > 0)
|
||||||
/* Fill Data */
|
|
||||||
p = b->conf->poll_time;
|
|
||||||
cfdata->poll_time = p;
|
|
||||||
if ((p >= 1) && (p <= 5))
|
|
||||||
{
|
{
|
||||||
cfdata->poll_method = 1; //Fast
|
cfdata->show_alert = 1;
|
||||||
}
|
}
|
||||||
else if ((p > 5) && (p <= 10))
|
else
|
||||||
{
|
{
|
||||||
cfdata->poll_method = 10; //Normal
|
cfdata->show_alert = 0;
|
||||||
}
|
|
||||||
else if ((p > 10) && (p <= 30))
|
|
||||||
{
|
|
||||||
cfdata->poll_method = 30; //Slow
|
|
||||||
}
|
}
|
||||||
else if (p > 30)
|
|
||||||
{
|
|
||||||
cfdata->poll_method = 60; // Very Slow
|
|
||||||
}
|
|
||||||
|
|
||||||
a = b->conf->alarm;
|
|
||||||
cfdata->alarm_time = a;
|
|
||||||
if (a == 0)
|
|
||||||
{
|
|
||||||
cfdata->alarm_method = 0; //Disable
|
|
||||||
}
|
|
||||||
else if (a <=10)
|
|
||||||
{
|
|
||||||
cfdata->alarm_method = 10; // 10 mins
|
|
||||||
}
|
|
||||||
else if (a <=30)
|
|
||||||
{
|
|
||||||
cfdata->alarm_method = 30; // 10 mins
|
|
||||||
}
|
|
||||||
else if (a <=60)
|
|
||||||
{
|
|
||||||
cfdata->alarm_method = 60; // 10 mins
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -113,35 +80,13 @@ static Evas_Object
|
||||||
*_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
*_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *of, *ob;
|
Evas_Object *o, *of, *ob;
|
||||||
E_Radio_Group *rg;
|
|
||||||
|
|
||||||
_fill_data(cfdata);
|
_fill_data(cfdata);
|
||||||
|
|
||||||
o = e_widget_list_add(evas, 0, 0);
|
o = e_widget_list_add(evas, 0, 0);
|
||||||
of = e_widget_framelist_add(evas, _("Poll Time"), 0);
|
of = e_widget_framelist_add(evas, _("Basic Settings"), 0);
|
||||||
rg = e_widget_radio_group_new(&(cfdata->poll_method));
|
ob = e_widget_check_add(evas, _("Show alert when battery is low"), &(cfdata->show_alert));
|
||||||
ob = e_widget_radio_add(evas, _("Fast"), 1, rg);
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
e_widget_framelist_object_append(of, ob);
|
||||||
ob = e_widget_radio_add(evas, _("Normal"), 10, rg);
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
|
||||||
ob = e_widget_radio_add(evas, _("Slow"), 30, rg);
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
|
||||||
ob = e_widget_radio_add(evas, _("Very Slow"), 60, rg);
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
|
||||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
|
||||||
|
|
||||||
of = e_widget_framelist_add(evas, _("Alarm Time"), 0);
|
|
||||||
rg = e_widget_radio_group_new(&(cfdata->alarm_method));
|
|
||||||
|
|
||||||
ob = e_widget_radio_add(evas, _("Disable"), 0, rg);
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
|
||||||
ob = e_widget_radio_add(evas, _("10 Mins"), 10, rg);
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
|
||||||
ob = e_widget_radio_add(evas, _("30 Mins"), 30, rg);
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
|
||||||
ob = e_widget_radio_add(evas, _("1 Hour"), 60, 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, of, 1, 1, 0.5);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
@ -150,10 +95,7 @@ static int
|
||||||
_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
{
|
{
|
||||||
e_border_button_bindings_ungrab_all();
|
e_border_button_bindings_ungrab_all();
|
||||||
|
b->conf->poll_time = 10.0;
|
||||||
b->conf->poll_time = (double)cfdata->poll_method;
|
|
||||||
b->conf->alarm = cfdata->alarm_method;
|
|
||||||
|
|
||||||
e_border_button_bindings_grab_all();
|
e_border_button_bindings_grab_all();
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
|
|
||||||
|
@ -164,22 +106,29 @@ _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
static Evas_Object
|
static Evas_Object
|
||||||
*_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
*_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *of, *ob;
|
Evas_Object *o, *of, *ob, *ot;
|
||||||
E_Radio_Group *rg;
|
|
||||||
|
|
||||||
/* Use Sliders for both cfg options */
|
/* Use Sliders for both cfg options */
|
||||||
_fill_data(cfdata);
|
_fill_data(cfdata);
|
||||||
|
|
||||||
o = e_widget_list_add(evas, 0, 0);
|
o = e_widget_list_add(evas, 0, 0);
|
||||||
of = e_widget_framelist_add(evas, _("Poll Time"), 0);
|
of = e_widget_frametable_add(evas, _("Advanced Settings"), 1);
|
||||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f seconds"), 0.5, 1000.0, 0.5, 0, &(cfdata->poll_time), 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, _("Alarm Time"), 0);
|
|
||||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f minutes"), 0, 60, 1, 0, NULL, &(cfdata->alarm_time), 200);
|
|
||||||
e_widget_framelist_object_append(of, ob);
|
|
||||||
|
|
||||||
|
ob = e_widget_label_add(evas, _("Check battery every:"));
|
||||||
|
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
|
||||||
|
|
||||||
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f seconds"), 0.5, 1000.0, 0.5, 0, &(cfdata->poll_time), NULL, 200);
|
||||||
|
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
|
||||||
|
|
||||||
|
ob = e_widget_check_add(evas, _("Show alert when battery is low"), &(cfdata->show_alert));
|
||||||
|
e_widget_frametable_object_append(of, ob, 0, 3, 1, 1, 1, 1, 1, 0);
|
||||||
|
|
||||||
|
ob = e_widget_label_add(evas, _("Alert when battery is down to:"));
|
||||||
|
e_widget_frametable_object_append(of, ob, 0, 4, 1, 1, 1, 0, 1, 1);
|
||||||
|
|
||||||
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f minutes"), 1, 60, 1, 0, NULL, &(cfdata->alarm_time), 200);
|
||||||
|
e_widget_frametable_object_append(of, ob, 0, 5, 1, 1, 1, 0, 1, 0);
|
||||||
|
|
||||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +139,14 @@ _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
e_border_button_bindings_ungrab_all();
|
e_border_button_bindings_ungrab_all();
|
||||||
|
|
||||||
b->conf->poll_time = cfdata->poll_time;
|
b->conf->poll_time = cfdata->poll_time;
|
||||||
b->conf->alarm = cfdata->alarm_time;
|
if (cfdata->show_alert)
|
||||||
|
{
|
||||||
|
b->conf->alarm = cfdata->alarm_time;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
b->conf->alarm = 0;
|
||||||
|
}
|
||||||
|
|
||||||
e_border_button_bindings_grab_all();
|
e_border_button_bindings_grab_all();
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
|
|
Loading…
Reference in New Issue