Use custom ewl callback instead of global ecore event. Use the correct fill policy in the config dialog.

This commit is contained in:
Jaime Thomas 2009-02-22 00:21:31 +00:00
parent 58fd9857a7
commit ee5e3024c5
4 changed files with 24 additions and 18 deletions

View File

@ -179,7 +179,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();
ECDB_FILELIST_SIZE_CHANGED = ewl_callback_type_add();
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

@ -9,7 +9,7 @@ static void _button_cb_begin(void *data, Evas_Object *obj,
const char *source);
static void _page_del(void *data, Evas *e, Evas_Object *obj, void *ev);
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 void _update_capacity(Ewl_Widget *w, void *ev_info, void *data);
// Config inwin updates
static void _joliet_clicked(void *data, Evas_Object *obj, const char *emission,
@ -76,8 +76,8 @@ _page_hide_finished(void *data, Evas_Object *o,
evas_object_hide(o);
}
static int
_update_capacity(void *data, int type, void *ev_data)
static void
_update_capacity(Ewl_Widget *w, void *ev_info, void *data)
{
Ecdb_Page *page;
Ecdb_Source *src;
@ -89,7 +89,12 @@ _update_capacity(void *data, int type, void *ev_data)
proj = evas_object_data_get(page->data, "proj");
base_proj = ECDB_PROJECT(proj);
src = evas_object_data_get(proj->capacity, "src");
src = data;
/* Find our topmost source */
while ((src) && (src->parent))
src = src->parent;
if ((base_proj->drive) && (base_proj->drive->capacity > 0))
{
printf("drive capacity: %lld, src->size: %lld\n",
@ -108,8 +113,7 @@ _update_capacity(void *data, int type, void *ev_data)
edje_object_signal_emit(page->data, "ecdb,capacity, exceeded", "ecdb");
}
ecdb_capacity_float_set(proj->capacity, val);
return ECORE_CALLBACK_RENEW;
printf("%lld\n", src->size);
}
static void
@ -209,7 +213,7 @@ _combo_cb_clicked(void *data, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
Evas_Object *b;
Ecdb_Burn_Project *proj;
Ecdb_Data_Project *proj;
Ecdb_Project *base_proj;
int sel, i, num_speeds, speed;
char buf[1024];
@ -226,19 +230,20 @@ _combo_cb_clicked(void *data, Evas_Object *obj __UNUSED__,
base_proj->drive = eina_list_nth(em->drives, sel);
/* Don't keep adding items to the combo if the drive hasn't changed */
if (base_proj->drive == ecdb_combo_data_get(proj->speed_combo))
if (base_proj->drive == ecdb_combo_data_get(ECDB_BURN(proj)->speed_combo))
return;
// Update the capacity here, as our capacity could change with the drive
ecore_event_add(ECDB_FILELIST_SIZE_CHANGED, NULL, NULL, NULL);
ewl_callback_call_with_event_data(proj->filelist, ECDB_FILELIST_SIZE_CHANGED,
ECDB_BURN(proj)->files);
num_speeds = base_proj->drive->write_speeds[0];
ecdb_combo_data_set(proj->speed_combo, base_proj->drive);
ecdb_combo_data_set(ECDB_BURN(proj)->speed_combo, base_proj->drive);
for (i = 1; i < num_speeds; i++)
{
if (base_proj->drive->write_speeds[i] <= 0)
continue;
b = ecdb_combo_item_add(proj->speed_combo, NULL);
b = ecdb_combo_item_add(ECDB_BURN(proj)->speed_combo, NULL);
if ((base_proj->drive->profile_name) &&
(base_proj->drive->profile_name[0] != '\0'))
@ -258,7 +263,7 @@ _combo_cb_clicked(void *data, Evas_Object *obj __UNUSED__,
snprintf(buf, sizeof(buf), "%dX (%dkb/s)", speed,
base_proj->drive->write_speeds[i]);
ecdb_combo_item_label_set(b, buf);
ecdb_combo_append(proj->speed_combo, b);
ecdb_combo_append(ECDB_BURN(proj)->speed_combo, b);
evas_object_show(b);
}
}
@ -567,6 +572,8 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
proj->filelist = ecdb_custom_filelist_new();
ewl_container_child_append(EWL_CONTAINER(embed), proj->filelist);
ewl_callback_append(proj->filelist, ECDB_FILELIST_SIZE_CHANGED,
_update_capacity, page);
ewl_widget_show(proj->filelist);
src = ecdb_source_new();
@ -589,8 +596,6 @@ ecdb_burn_data_page_show(Ecdb_Page *page)
proj->capacity = ecdb_capacity_add(page->data, "ecdb/burn_data/capacity");
evas_object_data_set(proj->capacity, "src", src);
ecore_event_handler_add(ECDB_FILELIST_SIZE_CHANGED, _update_capacity,
page);
evas_object_show(proj->capacity);
t = ecdb_config_inwin_add(bp->ret, NULL);

View File

@ -53,7 +53,7 @@ ecdb_config_dialog_show(void)
ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_TOP);
main_box = ewl_vbox_new();
ewl_container_child_append(EWL_CONTAINER(conf_win), main_box);
ewl_object_fill_policy_set(EWL_OBJECT(main_box), EWL_FLAG_FILL_HSHRINKABLE);
ewl_object_fill_policy_set(EWL_OBJECT(main_box), EWL_FLAG_FILL_FILL);
ewl_widget_show(main_box);
/* Setup and show the stock icons */

View File

@ -90,7 +90,7 @@ ecdb_custom_filelist_dnd_dropped_cb(Ewl_Widget *w, void *ev,
// 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);
ewl_callback_call_with_event_data(w, ECDB_FILELIST_SIZE_CHANGED, parent);
}
void
@ -322,7 +322,8 @@ 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);
ewl_callback_call_with_event_data(EWL_WIDGET(fl),
ECDB_FILELIST_SIZE_CHANGED, parent);
break;
}
}