Combo works now, added a label widget, and use stringshare for the constant drive info stuff.
This commit is contained in:
parent
7a6f108ed6
commit
acce34c9dc
@ -15,4 +15,5 @@ collections {
|
|||||||
#include "groups/burn_image.edc"
|
#include "groups/burn_image.edc"
|
||||||
#include "groups/entry.edc"
|
#include "groups/entry.edc"
|
||||||
#include "groups/combo.edc"
|
#include "groups/combo.edc"
|
||||||
|
#include "groups/label.edc"
|
||||||
}
|
}
|
||||||
|
@ -234,9 +234,45 @@ group {
|
|||||||
align: 0.0 0.5;
|
align: 0.0 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
description {
|
||||||
|
state: "deactivate" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 60 60 60 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
part {
|
||||||
|
name: "ecdb.header.swallow";
|
||||||
|
type: SWALLOW;
|
||||||
|
|
||||||
|
description {
|
||||||
|
state: "default" 0.0;
|
||||||
|
align: 0.0 0.5;
|
||||||
|
color: 255 255 255 0;
|
||||||
|
|
||||||
|
rel1 {
|
||||||
|
to: "combo_button";
|
||||||
|
relative: 0.0 0.0;
|
||||||
|
offset: 9 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
rel2 {
|
||||||
|
to: "combo_button";
|
||||||
|
relative: 1.0 1.0;
|
||||||
|
offset: -1 -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
description {
|
||||||
|
state: "active" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 255 255 255 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
programs {
|
programs {
|
||||||
program {
|
program {
|
||||||
name: "clicked";
|
name: "clicked";
|
||||||
@ -319,6 +355,24 @@ group {
|
|||||||
source: "ecdb";
|
source: "ecdb";
|
||||||
target: "combo_button";
|
target: "combo_button";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
program {
|
||||||
|
name: "header_hide";
|
||||||
|
signal: "ecdb,combo,header,swallow";
|
||||||
|
source: "ecdb";
|
||||||
|
action: STATE_SET "deactivate" 0.0;
|
||||||
|
target: "ecdb.header";
|
||||||
|
transition: DECELERATE 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
program {
|
||||||
|
name: "swallow_show";
|
||||||
|
signal: "ecdb,combo,header,swallow";
|
||||||
|
source: "ecdb";
|
||||||
|
action: STATE_SET "active" 0.0;
|
||||||
|
target: "ecdb.header.swallow";
|
||||||
|
transition: DECELERATE 0.5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
35
experimental/ecdb/trunk/data/themes/default/groups/label.edc
Normal file
35
experimental/ecdb/trunk/data/themes/default/groups/label.edc
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/* vim: set sw=3 ts=3 sts=3 expandtab: */
|
||||||
|
group {
|
||||||
|
name: "ecdb/label";
|
||||||
|
|
||||||
|
parts {
|
||||||
|
part {
|
||||||
|
name: "ecdb.label";
|
||||||
|
type: TEXT;
|
||||||
|
|
||||||
|
description {
|
||||||
|
state: "default" 0.0;
|
||||||
|
color: 60 60 60 255;
|
||||||
|
fixed: 1 1;
|
||||||
|
|
||||||
|
rel1 {
|
||||||
|
relative: 0.0 0.0;
|
||||||
|
offset: 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
rel2 {
|
||||||
|
relative: 1.0 1.0;
|
||||||
|
offset: -1 -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
text: "";
|
||||||
|
font: "ecdb/default";
|
||||||
|
min: 1 1;
|
||||||
|
size: 11;
|
||||||
|
align: 0.0 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -51,13 +51,13 @@ struct _Ecdb_Drive_Info
|
|||||||
int *write_speeds;
|
int *write_speeds;
|
||||||
|
|
||||||
/* Profiles */
|
/* Profiles */
|
||||||
char *profile_name;
|
const char *profile_name;
|
||||||
int profile_loaded;
|
int profile_loaded;
|
||||||
|
|
||||||
/* Drive info */
|
/* Drive info */
|
||||||
char *vendor;
|
const char *vendor;
|
||||||
char *product;
|
const char *product;
|
||||||
char *revision;
|
const char *revision;
|
||||||
char *location;
|
char *location;
|
||||||
|
|
||||||
unsigned char read_dvdram:1;
|
unsigned char read_dvdram:1;
|
||||||
|
@ -31,10 +31,9 @@ ecdb_aquire_drive_info(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It would be nice if there was an easier way to do this */
|
drive->product = eina_stringshare_add(drives_current[i].product);
|
||||||
drive->product = strdup(drives_current[i].product);
|
drive->vendor = eina_stringshare_add(drives_current[i].vendor);
|
||||||
drive->vendor = strdup(drives_current[i].vendor);
|
drive->revision = eina_stringshare_add(drives_current[i].revision);
|
||||||
drive->revision = strdup(drives_current[i].revision);
|
|
||||||
drive->location = strdup(drives_current[i].location);
|
drive->location = strdup(drives_current[i].location);
|
||||||
drive->read_dvdram = drives_current[i].read_dvdram;
|
drive->read_dvdram = drives_current[i].read_dvdram;
|
||||||
drive->read_dvdr = drives_current[i].read_dvdr;
|
drive->read_dvdr = drives_current[i].read_dvdr;
|
||||||
@ -48,7 +47,7 @@ ecdb_aquire_drive_info(void)
|
|||||||
|
|
||||||
burn_drive_get_speedlist(drives_current[i].drive, &speeds);
|
burn_drive_get_speedlist(drives_current[i].drive, &speeds);
|
||||||
|
|
||||||
drive->profile_name = strdup(speeds->profile_name);
|
drive->profile_name = eina_stringshare_add(speeds->profile_name);
|
||||||
drive->profile_loaded = speeds->profile_loaded;
|
drive->profile_loaded = speeds->profile_loaded;
|
||||||
|
|
||||||
while (speeds->next)
|
while (speeds->next)
|
||||||
@ -89,11 +88,11 @@ ecdb_drive_info_list_free(Eina_List *list)
|
|||||||
{
|
{
|
||||||
FREE(info->read_speeds);
|
FREE(info->read_speeds);
|
||||||
FREE(info->write_speeds);
|
FREE(info->write_speeds);
|
||||||
FREE(info->vendor);
|
|
||||||
FREE(info->product);
|
|
||||||
FREE(info->revision);
|
|
||||||
FREE(info->location);
|
FREE(info->location);
|
||||||
FREE(info->profile_name);
|
eina_stringshare_del(info->vendor);
|
||||||
|
eina_stringshare_del(info->product);
|
||||||
|
eina_stringshare_del(info->revision);
|
||||||
|
eina_stringshare_del(info->profile_name);
|
||||||
FREE(info);
|
FREE(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ static void ecdb_erase_page_show(void);
|
|||||||
static void ecdb_burn_image_page_show(void);
|
static void ecdb_burn_image_page_show(void);
|
||||||
static void ecdb_page_hide(const char *pname);
|
static void ecdb_page_hide(const char *pname);
|
||||||
static void ecdb_filelist_focus_handle(int action, Evas_Object *fl);
|
static void ecdb_filelist_focus_handle(int action, Evas_Object *fl);
|
||||||
|
Evas_Object *combo_header_create(Evas_Object *c, const char *name,
|
||||||
|
Evas_Object *obj, int sel);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ecdb_cb_enter(Ecore_Evas *ee)
|
ecdb_cb_enter(Ecore_Evas *ee)
|
||||||
@ -772,6 +774,7 @@ ecdb_erase_page_show(void)
|
|||||||
|
|
||||||
b = ecdb_combo_add(swallow, "ecdb/erase/drive");
|
b = ecdb_combo_add(swallow, "ecdb/erase/drive");
|
||||||
ecdb_combo_header_set(b, "Drive");
|
ecdb_combo_header_set(b, "Drive");
|
||||||
|
ecdb_combo_header_create_set(b, combo_header_create);
|
||||||
|
|
||||||
EINA_LIST_FOREACH(em->drives, l, drive)
|
EINA_LIST_FOREACH(em->drives, l, drive)
|
||||||
{
|
{
|
||||||
@ -912,3 +915,16 @@ ecdb_gui_burn_image_cleanup(void)
|
|||||||
edje_object_signal_emit(swallow, "ecdb,burn_image,done", "ecdb");
|
edje_object_signal_emit(swallow, "ecdb,burn_image,done", "ecdb");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Evas_Object *
|
||||||
|
combo_header_create(Evas_Object *c, const char *name, Evas_Object *obj, int sel)
|
||||||
|
{
|
||||||
|
Evas_Object *ret;
|
||||||
|
Ecdb_Drive_Info *drive;
|
||||||
|
|
||||||
|
ret = ecdb_label_add(c, name);
|
||||||
|
drive = eina_list_nth(em->drives, sel);
|
||||||
|
ecdb_label_text_set(ret, drive->product);
|
||||||
|
evas_object_show(ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -59,6 +59,12 @@ ecdb_button_icon_set(Evas_Object *b, const char *group)
|
|||||||
evas_object_show(icon);
|
evas_object_show(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
ecdb_button_label_get(Evas_Object *b)
|
||||||
|
{
|
||||||
|
return edje_object_part_text_get(b, "ecdb.label");
|
||||||
|
}
|
||||||
|
|
||||||
/************************* CHECK *********************************************/
|
/************************* CHECK *********************************************/
|
||||||
|
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
@ -290,7 +296,11 @@ struct _Combo_Data
|
|||||||
Evas_Object *popup;
|
Evas_Object *popup;
|
||||||
unsigned int expanded;
|
unsigned int expanded;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
int selected;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
const char *header;
|
||||||
|
Evas_Object * (*create_header)(Evas_Object *, const char *name,
|
||||||
|
Evas_Object *, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -348,6 +358,7 @@ _combo_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||||||
cd = evas_object_data_get(data, "cd");
|
cd = evas_object_data_get(data, "cd");
|
||||||
|
|
||||||
eina_stringshare_del(cd->name);
|
eina_stringshare_del(cd->name);
|
||||||
|
eina_stringshare_del(cd->header);
|
||||||
FREE(cd);
|
FREE(cd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +386,31 @@ _combo_hide(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||||||
static void
|
static void
|
||||||
_combo_clicked(void *data, Evas_Object *obj, void *event_info)
|
_combo_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
printf("object clicked...\n");
|
Combo_Data *cd;
|
||||||
|
Evas_Object *swallow, *header;
|
||||||
|
Eina_Iterator *it;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
cd = evas_object_data_get(data, "cd");
|
||||||
|
swallow = edje_object_part_swallow_get(data, "ecdb.header.swallow");
|
||||||
|
if (swallow)
|
||||||
|
evas_object_del(swallow);
|
||||||
|
|
||||||
|
it = evas_object_box_iterator_new(edje_object_part_object_get(cd->popup,
|
||||||
|
"ecdb.box"));
|
||||||
|
while (eina_iterator_next(it, (void **)&swallow))
|
||||||
|
{
|
||||||
|
if (swallow == obj)
|
||||||
|
break;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should I send the part name? The the normal widget_add would handle
|
||||||
|
// the swallowing
|
||||||
|
cd->selected = i;
|
||||||
|
header = cd->create_header(data, "ecdb.header.swallow", swallow, i);
|
||||||
|
edje_object_signal_emit(data, "ecdb,combo,header,swallow", "ecdb");
|
||||||
|
ecdb_combo_collapse(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -441,6 +476,7 @@ ecdb_combo_add(Evas_Object *parent, const char *name)
|
|||||||
|
|
||||||
cd->parent = parent;
|
cd->parent = parent;
|
||||||
cd->name = eina_stringshare_add(name);
|
cd->name = eina_stringshare_add(name);
|
||||||
|
cd->selected = -1;
|
||||||
evas_object_data_set(c, "cd", cd);
|
evas_object_data_set(c, "cd", cd);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
@ -449,7 +485,12 @@ ecdb_combo_add(Evas_Object *parent, const char *name)
|
|||||||
void
|
void
|
||||||
ecdb_combo_header_set(Evas_Object *c, const char *text)
|
ecdb_combo_header_set(Evas_Object *c, const char *text)
|
||||||
{
|
{
|
||||||
|
Combo_Data *cd;
|
||||||
|
|
||||||
|
cd = evas_object_data_get(c, "cd");
|
||||||
edje_object_part_text_set(c, "ecdb.header", text);
|
edje_object_part_text_set(c, "ecdb.header", text);
|
||||||
|
eina_stringshare_del(cd->header);
|
||||||
|
cd->header = eina_stringshare_add(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -527,3 +568,33 @@ ecdb_combo_collapse(Evas_Object *c)
|
|||||||
cd->expanded = 0;
|
cd->expanded = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ecdb_combo_header_create_set(Evas_Object *c, Evas_Object * (*func)
|
||||||
|
(Evas_Object *c, const char *name,
|
||||||
|
Evas_Object *clicked, int idx))
|
||||||
|
{
|
||||||
|
Combo_Data *cd;
|
||||||
|
|
||||||
|
cd = evas_object_data_get(c, "cd");
|
||||||
|
cd->create_header = func;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************* Label ***************************************/
|
||||||
|
|
||||||
|
Evas_Object *
|
||||||
|
ecdb_label_add(Evas_Object *parent, const char *name)
|
||||||
|
{
|
||||||
|
Evas_Object *l;
|
||||||
|
|
||||||
|
l = ecdb_widget_add(parent, name);
|
||||||
|
edje_object_file_set(l, em->theme_path, "ecdb/label");
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ecdb_label_text_set(Evas_Object *l, const char *text)
|
||||||
|
{
|
||||||
|
edje_object_part_text_set(l, "ecdb.label", text);
|
||||||
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
Evas_Object *ecdb_button_add(Evas_Object *parent, const char *name);
|
Evas_Object *ecdb_button_add(Evas_Object *parent, const char *name);
|
||||||
void ecdb_button_label_set(Evas_Object *b, const char *label);
|
void ecdb_button_label_set(Evas_Object *b, const char *label);
|
||||||
void ecdb_button_icon_set(Evas_Object *b, const char *group);
|
void ecdb_button_icon_set(Evas_Object *b, const char *group);
|
||||||
|
const char *ecdb_button_label_get(Evas_Object *b);
|
||||||
|
|
||||||
Evas_Object *ecdb_check_add(Evas_Object *parent, const char *name);
|
Evas_Object *ecdb_check_add(Evas_Object *parent, const char *name);
|
||||||
void ecdb_check_label_set(Evas_Object *c, const char *label);
|
void ecdb_check_label_set(Evas_Object *c, const char *label);
|
||||||
@ -16,12 +17,24 @@ Evas_Object *ecdb_entry_add(Evas_Object *parent, const char *name);
|
|||||||
void ecdb_entry_text_set(Evas_Object *e, const char *text);
|
void ecdb_entry_text_set(Evas_Object *e, const char *text);
|
||||||
char *ecdb_entry_text_get(Evas_Object *e);
|
char *ecdb_entry_text_get(Evas_Object *e);
|
||||||
|
|
||||||
// I am unsure about whether to use elementary here or not... It would be nice
|
/* Combo todo list:
|
||||||
|
* separate hover from combo
|
||||||
|
* able to set whether combo collapses on child click
|
||||||
|
* better theme
|
||||||
|
*/
|
||||||
Evas_Object *ecdb_combo_add(Evas_Object *parent, const char *name);
|
Evas_Object *ecdb_combo_add(Evas_Object *parent, const char *name);
|
||||||
void ecdb_combo_header_set(Evas_Object *c, const char *text);
|
void ecdb_combo_header_set(Evas_Object *c, const char *text);
|
||||||
void ecdb_combo_append(Evas_Object *c, Evas_Object *o);
|
void ecdb_combo_append(Evas_Object *c, Evas_Object *o);
|
||||||
void ecdb_combo_expand(Evas_Object *c);
|
void ecdb_combo_expand(Evas_Object *c);
|
||||||
void ecdb_combo_collapse(Evas_Object *c);
|
void ecdb_combo_collapse(Evas_Object *c);
|
||||||
|
void ecdb_combo_header_create_set(Evas_Object *c, Evas_Object *
|
||||||
|
(*func)(Evas_Object *c,
|
||||||
|
const char *name,
|
||||||
|
Evas_Object *clicked,
|
||||||
|
int idx));
|
||||||
|
|
||||||
|
Evas_Object *ecdb_label_add(Evas_Object *parent, const char *name);
|
||||||
|
void ecdb_label_text_set(Evas_Object *l, const char *text);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user