Add in a capacity widget and set up the callbacks to update it.

This commit is contained in:
Jaime Thomas 2008-12-24 22:59:59 +00:00
parent 9bbac64f4c
commit 076cb1f674
17 changed files with 288 additions and 4 deletions

View File

@ -17,4 +17,5 @@ collections {
#include "groups/combo.edc"
#include "groups/label.edc"
#include "groups/burn_data.edc"
#include "groups/capacity.edc"
}

View File

@ -9,4 +9,5 @@ EXTRA_DIST= burn_data.edc \
icons.edc \
label.edc \
welcome_page.edc \
capacity.edc \
window.edc

View File

@ -142,6 +142,28 @@ group {
}
}
part {
name: "ecdb/burn_data/vol_name";
type: SWALLOW;
repeat_events: 1;
description {
state: "default" 0.0;
rel1 {
to: "ecdb/burn_data/speed";
relative: 0.0 1.0;
offset: 0 5;
}
rel2 {
to: "ecdb/burn_data/speed";
relative: 1.0 1.0;
offset: 0 30;
}
}
}
/* Missing a description later */
part {
name: "ecdb/burn_data/filelist";
@ -160,7 +182,30 @@ group {
rel2 {
to: "bg";
relative: 0.5 1.0;
offset: -1 -10;
offset: -1 -26;
}
}
}
part {
name: "ecdb/burn_data/capacity";
type: SWALLOW;
repeat_events: 0;
description {
state: "default" 0.0;
max: 99999 20;
rel1 {
to: "bg";
relative: 0.0 1.0;
offset: 10 -23;
}
rel2 {
to: "bg";
relative: 1.0 1.0;
offset: -11 -1;
}
}
}

View File

@ -0,0 +1,195 @@
/* vim: set sw=3 ts=3 sts=3 expandtab: */
group {
name: "ecdb/capacity";
max: 999999 20;
script {
public message(Msg_Type:type, id, ...) {
if ((type == MSG_FLOAT) && (id == 1)) {
new Float:freq;
freq = getfarg(2);
set_drag(PART:"draggie", freq, 0.0);
}
}
}
parts {
part {
name: "confine";
mouse_events: 0;
type: RECT;
description {
state: "default" 0.0;
min: 0 17;
fixed: 1 1;
rel1 {
relative: 0.0 0.0;
offset: 2 1;
}
rel2 {
relative: 1.0 1.0;
offset: -2 -3;
}
}
}
part {
name: "bg";
type: IMAGE;
description {
state: "default" 0.0;
fixed: 1 1;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
image {
normal: "progress_trough.png";
border: 3 3 3 4;
}
fill {
smooth: 0;
}
}
}
part {
name: "progress_left";
type: IMAGE;
clip_to: "confine";
description {
state: "default" 0.0;
fixed: 1 1;
min: 2 17;
max: 2 17;
rel1 {
to: "confine";
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
to: "confine";
relative: 0.0 1.0;
offset: -1 -1;
}
image {
normal: "progress_bar_left.png";
}
fill {
smooth: 0;
}
}
}
part {
name: "draggie";
type: RECT;
clip_to: "confine";
dragable {
confine: "confine";
x: 1 1 0;
y: 0 0 0;
}
description {
state: "default" 0.0;
min: 1 21;
fixed: 1 1;
color: 0 0 0 0;
rel1 {
relative: 0.0 0.0;
}
rel2 {
relative: 0.0 1.0;
}
}
}
part {
name: "fill";
type: IMAGE;
mouse_events: 0;
clip_to: "confine";
description {
state: "default" 0.0;
fixed: 1 1;
rel1 {
relative: 1.0 0.0;
offset: 0 0;
to: "progress_left";
}
rel2 {
relative: 0.0 1.0;
offset: -1 -1;
to: "draggie";
}
image {
normal: "progress_bar_fill_0.png";
}
fill {
smooth: 1;
size {
relative: 0.0 0.0;
offset: 28 17;
}
}
}
}
part {
name: "progress_right";
type: IMAGE;
description {
state: "default" 0.0;
fixed: 1 1;
min: 2 17;
max: 2 17;
rel1 {
to: "fill";
relative: 1.0 0.0;
}
rel2 {
to: "fill";
relative: 1.0 1.0;
}
image {
normal: "progress_bar_right.png";
}
fill {
smooth: 0;
}
}
}
}
}

View File

@ -1,7 +1,7 @@
/* vim: set sw=3 ts=3 sts=3 expandtab: */
group {
name: "ecdb/window";
min: 640 360;
min: 640 390;
parts {
part {
@ -10,7 +10,7 @@ group {
description {
state: "default" 0.0;
min: 640 360;
min: 640 390;
max: 999999 999999;
rel1 {
@ -62,7 +62,7 @@ group {
rel2 {
relative: 1.0 1.0;
offset: 0 -175;
offset: 0 -230;
}
}
}

View File

@ -25,4 +25,8 @@ images {
image: "combobox_button_clicked.png" COMP;
image: "combobox_button_disabled.png" COMP;
image: "combo_arrow.png" COMP;
image: "progress_bar_fill_0.png" COMP;
image: "progress_bar_left.png" COMP;
image: "progress_bar_right.png" COMP;
image: "progress_trough.png" COMP;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

View File

@ -5,6 +5,7 @@
int ECDB_DRIVE_ACTION_FINISHED = 0;
int ECDB_DRIVE_ACTION_BEGUN = 0;
int ECDB_DRIVE_ACTION_UPDATE = 0;
int ECDB_FILELIST_SIZE_CHANGED = 0;
Ecdb_Main *em;
int ecdb_setup();
@ -176,6 +177,7 @@ ecdb_setup(void)
ECDB_DRIVE_ACTION_FINISHED = ecore_event_type_new();
ECDB_DRIVE_ACTION_BEGUN = ecore_event_type_new();
ECDB_DRIVE_ACTION_UPDATE = ecore_event_type_new();
ECDB_FILELIST_SIZE_CHANGED = ecore_event_type_new();
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, ecdb_shutdown, NULL);
ecore_event_handler_add(ECORE_X_EVENT_XDND_POSITION, ecdb_dnd_position, em);

View File

@ -47,6 +47,7 @@ extern Ecdb_Main *em;
extern int ECDB_DRIVE_ACTION_FINISHED;
extern int ECDB_DRIVE_ACTION_BEGUN;
extern int ECDB_DRIVE_ACTION_UPDATE;
extern int ECDB_FILELIST_SIZE_CHANGED;
#include "ecdb_common.h"
#include "ecdb_drives.h"

View File

@ -4,6 +4,19 @@
static void _button_cb_return(void *data, Evas_Object *obj, void *event_info);
static void _button_cb_begin(void *data, Evas_Object *obj, void *event_info);
static void _combo_cb_clicked(void *data, Evas_Object *obj, void *event_info);
static int _update_capacity(void *data, int type, void *ev_data);
static int
_update_capacity(void *data, int type, void *ev_data)
{
Ecdb_Source *src;
Evas_Object *o;
o = data;
src = evas_object_data_get(o, "source");
return ECORE_CALLBACK_RENEW;
}
static void
_button_cb_return(void *data, Evas_Object *obj, void *event_info)
@ -245,6 +258,17 @@ ecdb_burn_data_page_show(void)
b = edje_object_part_swallow_get(swallow, "ecdb/burn_data/filelist");
ecdb_widget_focus_callback_add(b, "ecdb/burn_data/filelist");
b = ecdb_entry_add(swallow, "ecdb/burn_data/vol_name");
ecdb_entry_text_set(b, "Volume Name");
evas_object_show(b);
// FIXME Turn this into a normal widget
b = ecdb_widget_add(swallow, "ecdb/burn_data/capacity");
edje_object_file_set(b, em->theme_path, "ecdb/capacity");
evas_object_data_set(b, "source", src);
ecore_event_handler_add(ECDB_FILELIST_SIZE_CHANGED, _update_capacity, b);
evas_object_show(b);
}
else if (edje_object_part_swallow_get(gui, "action_area") != swallow)

View File

@ -92,6 +92,7 @@ struct _Ecdb_Source
const char *dst;
unsigned char dir:1;
unsigned int num_children;
long long size; //Sizeof itself and children
Ecdb_Source **children;
Ecdb_Source *parent;
IsoNode *node;

View File

@ -77,6 +77,10 @@ ecdb_custom_filelist_dnd_dropped_cb(Ewl_Widget *w, void *ev,
(EWL_MVC(EWL_FILELIST(w)->controller)),
0, EWL_SORT_DIRECTION_ASCENDING);
ewl_mvc_dirty_set(EWL_MVC(EWL_FILELIST(w)->controller), TRUE);
// Send out this event so that we can get notified on size changes
// and update the capacity measure
ecore_event_add(ECDB_FILELIST_SIZE_CHANGED, NULL, NULL, NULL);
}
void
@ -308,6 +312,7 @@ ecdb_custom_filelist_cb_key_down(Ewl_Widget *w, void *ev, void *data)
ecdb_source_child_remove(parent, child);
ecdb_source_destroy(child);
ecdb_custom_filelist_directory_set(fl, parent);
ecore_event_add(ECDB_FILELIST_SIZE_CHANGED, NULL, NULL, NULL);
break;
}
}

View File

@ -28,6 +28,7 @@ ecdb_source_init(Ecdb_Source *src)
{
src->dir = FALSE;
src->num_children = 0;
src->size = 0;
src->children = calloc(1, sizeof(Ecdb_Source));
if (!src->children)
{
@ -65,6 +66,7 @@ ecdb_source_data_set(Ecdb_Source *src, const char *dst)
}
src->dst = eina_stringshare_add(dst);
src->size = ecore_file_size(dst);
/* Add the files recursively here */
if (ecore_file_is_dir(src->dst))
@ -109,6 +111,7 @@ ecdb_source_child_append(Ecdb_Source *src, Ecdb_Source *child)
(src->num_children + 1));
src->children[src->num_children - 1] = child;
src->children[src->num_children] = NULL;
src->size += child->size;
child->parent = src;
}
@ -146,6 +149,7 @@ ecdb_source_child_remove(Ecdb_Source *src, Ecdb_Source *child)
FREE(src->children);
src->children = temp;
src->num_children--;
src->size -= child->size;
child->parent = NULL;
}

View File

@ -3,6 +3,7 @@
#define ECDB_WIDGETS_H
void ecdb_widget_focus_callback_add(Evas_Object *o, const char *name);
Evas_Object *ecdb_widget_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);