battery config.... better!

SVN revision: 38920
devs/princeamd/enlightenment-0.17-elive
Carsten Haitzler 14 years ago
parent b5aa90e3c2
commit a03639d55f
  1. 12
      data/themes/default.edc
  2. 4
      src/bin/Makefile.am
  3. 1
      src/bin/e_includes.h
  4. 102
      src/bin/e_widget_toolbook.c
  5. 14
      src/bin/e_widget_toolbook.h
  6. 76
      src/modules/battery/e_mod_config.c

@ -16304,11 +16304,11 @@ collections { /* begin the collection of edje groups that are in this file */
fixed: 1 0;
rel1 {
relative: 0.0 0.0;
offset: 4 4;
offset: 2 2;
}
rel2 {
relative: 0.0 0.0;
offset: 4 -5;
offset: 2 -5;
to_y: "e.swallow.buttons";
}
}
@ -16318,12 +16318,12 @@ collections { /* begin the collection of edje groups that are in this file */
description { state: "default" 0.0;
rel1 {
relative: 1.0 0.0;
offset: 4 4;
offset: 2 2;
to_x: "e.swallow.icon";
}
rel2 {
relative: 1.0 0.0;
offset: -5 -9;
offset: -3 -5;
to_y: "e.swallow.buttons";
}
}
@ -16476,10 +16476,10 @@ collections { /* begin the collection of edje groups that are in this file */
description { state: "default" 0.0;
align: 0.5 0.5;
min: 100 200;
rel1.offset: 5 5;
rel1.offset: 2 2;
rel2 {
relative: 1.0 0.0;
offset: -6 -9;
offset: -3 -5;
to_y: "e.swallow.button";
}
}

@ -169,7 +169,8 @@ e_slidesel.h \
e_slidecore.h \
e_widget_flist.h \
e_scale.h \
e_widget_toolbar.h
e_widget_toolbar.h \
e_widget_toolbook.h
enlightenment_src = \
e_user.c \
@ -305,6 +306,7 @@ e_slidecore.c \
e_widget_flist.c \
e_scale.c \
e_widget_toolbar.c \
e_widget_toolbook.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \

@ -136,3 +136,4 @@
#include "e_fm_op.h"
#include "e_scale.h"
#include "e_widget_toolbar.h"
#include "e_widget_toolbook.h"

@ -0,0 +1,102 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
typedef struct _E_Widget_Data E_Widget_Data;
struct _E_Widget_Data
{
Evas_Object *o_widget, *o_tb, *o_bar;
Eina_List *content;
};
static void _e_wid_del_hook(Evas_Object *obj);
static void _item_sel(void *data1, void *data2);
/* externally accessible functions */
EAPI Evas_Object *
e_widget_toolbook_add(Evas *evas, int icon_w, int icon_h)
{
Evas_Object *obj, *o;
E_Widget_Data *wd;
Evas_Coord mw, mh;
obj = e_widget_add(evas);
e_widget_del_hook_set(obj, _e_wid_del_hook);
wd = calloc(1, sizeof(E_Widget_Data));
e_widget_data_set(obj, wd);
wd->o_widget = obj;
o = e_widget_table_add(evas, 0);
e_widget_resize_object_set(obj, o);
evas_object_show(o);
e_widget_sub_object_add(obj, o);
wd->o_tb = o;
o = e_widget_toolbar_add(evas, icon_w, icon_h);
e_widget_table_object_append(wd->o_tb, o, 0, 0, 1, 1, 1, 1, 1, 0);
wd->o_bar = o;
evas_object_show(o);
return obj;
}
EAPI void
e_widget_toolbook_page_append(Evas_Object *toolbook, Evas_Object *icon, const char *label, Evas_Object *content, int expand_w, int expand_h, int fill_w, int fill_h, double ax, double ay)
{
E_Widget_Data *wd;
Evas_Coord minw, minh;
wd = e_widget_data_get(toolbook);
e_widget_toolbar_item_append(wd->o_bar, icon, label, _item_sel,
toolbook, content);
e_widget_table_object_align_append(wd->o_tb, content,
0, 1, 1, 1,
fill_w, fill_h, expand_w, expand_h,
ax, ay);
evas_object_hide(content);
wd->content = eina_list_append(wd->content, content);
e_widget_min_size_get(wd->o_tb, &minw, &minh);
e_widget_min_size_set(toolbook, minw, minh);
}
EAPI void
e_widget_toolbook_page_show(Evas_Object *toolbook, int n)
{
E_Widget_Data *wd;
wd = e_widget_data_get(toolbook);
e_widget_toolbar_item_select(wd->o_bar, n);
}
/* Private functions */
static void
_e_wid_del_hook(Evas_Object *obj)
{
E_Widget_Data *wd;
wd = e_widget_data_get(obj);
eina_list_free(wd->content);
free(wd);
}
static void
_item_sel(void *data1, void *data2)
{
E_Widget_Data *wd;
Evas_Object *obj, *sobj;
Eina_List *l;
obj = data1;
sobj = data2;
wd = e_widget_data_get(obj);
for (l = wd->content; l; l = l->next)
{
Evas_Object *o;
o = l->data;
if (o == sobj) evas_object_show(o);
else evas_object_hide(o);
}
}

@ -0,0 +1,14 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
#else
#ifndef E_WIDGET_TOOLBOOK_H
#define E_WIDGET_TOOLBOOK_H
EAPI Evas_Object *e_widget_toolbook_add(Evas *evas, int icon_w, int icon_h);
EAPI void e_widget_toolbook_page_append(Evas_Object *toolbook, Evas_Object *icon, const char *label, Evas_Object *content, int expand_w, int expand_h, int fill_w, int fill_h, double ax, double ay);
EAPI void e_widget_toolbook_page_show(Evas_Object *toolbook, int n);
#endif
#endif

@ -125,59 +125,49 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
static Evas_Object *
_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o, *of, *ob;
Evas_Object *o, *ob, *of, *otb;
E_Radio_Group *rg;
/* Use Sliders for both cfg options */
o = e_widget_list_add(evas, 0, 0);
of = e_widget_frametable_add(evas, _("Polling (Internal)"), 1);
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.0f ticks"), 1, 1024, 4, 0, NULL, &(cfdata->poll_interval), 256);
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_frametable_add(evas, _("Alert"), 1);
ob = e_widget_check_add(evas, _("Show alert when battery is low"), &(cfdata->show_alert));
e_widget_frametable_object_append(of, ob, 0, 0, 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, 1, 1, 1, 1, 0, 1, 1);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f minutes"), 0, 60, 1, 0, NULL, &(cfdata->alert_time), 60);
e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 1, 0);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f percent"), 0, 100, 1, 0, NULL, &(cfdata->alert_percent), 100);
e_widget_frametable_object_append(of, ob, 0, 3, 1, 1, 1, 0, 1, 0);
otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
ob = e_widget_check_add(evas, _("Dismiss alert automatically"), &(cfdata->dismiss_alert));
e_widget_frametable_object_append(of, ob, 0, 4, 1, 1, 1, 1, 1, 0);
ob = e_widget_label_add(evas, _("Dismiss alert after:"));
e_widget_frametable_object_append(of, ob, 0, 5, 1, 1, 1, 0, 1, 0);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 1, 300, 1, 0, NULL, &(cfdata->alert_timeout), 150);
e_widget_frametable_object_append(of, ob, 0, 6, 1, 1, 1, 0, 1, 0);
e_widget_list_object_append(o, of, 1, 1, 0.5);
/* Use Sliders for both cfg options */
o = e_widget_table_add(evas, 0);
ob = e_widget_label_add(evas, _("Check every:"));
e_widget_table_object_append(o, ob, 0, 0, 1, 1, 1, 0, 1, 0);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f ticks"), 1, 256, 4, 0, NULL, &(cfdata->poll_interval), 180);
e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 0);
e_widget_toolbook_page_append(otb, NULL, _("Polling"), o, 0, 0, 0, 0, 0.5, 0.0);
o = e_widget_table_add(evas, 0);
ob = e_widget_check_add(evas, _("Show alert on low battery"), &(cfdata->show_alert));
e_widget_table_object_append(o, ob, 0, 0, 1, 1, 1, 1, 1, 0);
ob = e_widget_label_add(evas, _("Alert when at:"));
e_widget_table_object_append(o, ob, 0, 1, 1, 1, 1, 0, 1, 1);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f min"), 0, 60, 1, 0, NULL, &(cfdata->alert_time), 180);
e_widget_table_object_append(o, ob, 0, 2, 1, 1, 1, 0, 1, 0);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f %%"), 0, 100, 1, 0, NULL, &(cfdata->alert_percent), 180);
e_widget_table_object_append(o, ob, 0, 3, 1, 1, 1, 0, 1, 0);
ob = e_widget_check_add(evas, _("Auto dismiss in..."), &(cfdata->dismiss_alert));
e_widget_table_object_append(o, ob, 0, 4, 1, 1, 1, 1, 1, 0);
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f sec"), 1, 300, 1, 0, NULL, &(cfdata->alert_timeout), 180);
e_widget_table_object_append(o, ob, 0, 5, 1, 1, 1, 0, 1, 0);
e_widget_toolbook_page_append(otb, NULL, _("Alert"), o, 0, 0, 0, 0, 0.5, 0.0);
of = e_widget_framelist_add(evas, _("Hardware Interface"), 0);
o = e_widget_list_add(evas, 0, 0);
rg = e_widget_radio_group_new(&(cfdata->force_mode));
ob = e_widget_radio_add(evas, _("Auto Detect"), 0, rg);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, ob, 1, 0, 0.0);
ob = e_widget_radio_add(evas, _("Internal"), 1, rg);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, ob, 1, 0, 0.0);
ob = e_widget_radio_add(evas, _("HAL"), 2, rg);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, ob, 1, 0, 0.0);
e_widget_list_object_append(o, of, 1, 1, 0.5);
return o;
e_widget_toolbook_page_append(otb, NULL, _("Hardware"), o, 0, 0, 0, 0, 0.5, 0.0);
e_widget_toolbook_page_show(otb, 0);
return otb;
}
static int

Loading…
Cancel
Save