From 66b3b98d70739835f723893ce7c114c0304fab98 Mon Sep 17 00:00:00 2001 From: codewarrior Date: Tue, 25 Oct 2005 22:01:50 +0000 Subject: [PATCH] - more work on internal eap editor - temporary e_entry fix SVN revision: 17960 --- src/bin/e_apps.c | 49 +++++++++++------ src/bin/e_eap_editor.c | 130 ++++++++++++++++++++++++++++++++++++++-------- src/bin/e_eap_editor.h | 6 ++- src/bin/e_entry.c | 72 ++++++++++++++++--------- src/bin/e_entry.h | 67 ++++++++++++++---------- src/bin/e_fileman_smart.c | 6 +-- src/bin/e_main.c | 1 - src/bin/e_widget_entry.c | 47 ++++++++++++++--- src/bin/e_widget_entry.h | 2 +- src/bin/e_widget_image.c | 12 +++-- 10 files changed, 281 insertions(+), 111 deletions(-) diff --git a/src/bin/e_apps.c b/src/bin/e_apps.c index 8255097..64012ec 100644 --- a/src/bin/e_apps.c +++ b/src/bin/e_apps.c @@ -106,6 +106,11 @@ static Evas_List *_e_apps_start_pending = NULL; " }\n" \ "}\n" +#define EAP_EDC_TMPL_EMPTY \ +"images {\n " \ +"}\n" \ +"collections {\n" \ +"}\n" /* externally accessible functions */ @@ -1002,6 +1007,9 @@ e_app_fields_save(E_App *a) unsigned char tmp[1]; int img; + if(!a->path) + return; + if(!ecore_file_exists(a->path)) { _e_app_new_save(a); @@ -1230,31 +1238,38 @@ _e_app_new_save(E_App *a) } i = 0; - start = strchr(a->image, '/'); - end = strrchr(a->image ,'/'); - if (start == end) - { - imgdir = strdup("/");; - } - else if ((!start) || (!end)) - { - imgdir = strdup(""); - } - else + if(a->image) { - imgdir = malloc((end - start + 1)); - if (imgdir) + start = strchr(a->image, '/'); + end = strrchr(a->image ,'/'); + + if (start == end) { - memcpy(imgdir, start, end - start); - imgdir[end - start] = 0; + imgdir = strdup("/");; } - } + else if ((!start) || (!end)) + { + imgdir = strdup(""); + } + else + { + imgdir = malloc((end - start + 1)); + if (imgdir) + { + memcpy(imgdir, start, end - start); + imgdir[end - start] = 0; + } + } + } if (imgdir) snprintf(ipart, sizeof(ipart), "-id %s", imgdir); else ipart[0] = '\0'; - fprintf(out, EAP_EDC_TMPL, a->image, "48", "48", a->image); + if(a->image) + fprintf(out, EAP_EDC_TMPL, a->image, "48", "48", a->image); + else + fprintf(out, EAP_EDC_TMPL_EMPTY); fclose(out); snprintf(cmd, sizeof(cmd), "edje_cc -v %s %s %s", ipart, tmpn, a->path); diff --git a/src/bin/e_eap_editor.c b/src/bin/e_eap_editor.c index f21c35d..e7a16f0 100644 --- a/src/bin/e_eap_editor.c +++ b/src/bin/e_eap_editor.c @@ -7,6 +7,7 @@ static void _e_eap_edit_cancel_cb(void *data, E_Dialog *dia); static void _e_eap_edit_browse_cb(void *data1, void *data2); static void _e_eap_edit_free(E_App_Edit *app); +#define IFDUP(src, dst) if(src) dst = strdup(src); else dst = NULL /* externally accessible functions */ E_App_Edit * @@ -14,7 +15,7 @@ e_eap_edit_show(E_Container *con, E_App *a) { E_Manager *man; E_App_Edit *app; - Evas_Object *o, *ol; + Evas_Object *o, *ol, *img; app = E_OBJECT_ALLOC(E_App_Edit, E_EAP_EDIT_TYPE, _e_eap_edit_free); if (!app) return NULL; @@ -32,8 +33,33 @@ e_eap_edit_show(E_Container *con, E_App *a) app->eap = a; ol = e_widget_list_add(app->evas, 0, 0); - o = e_widget_table_add(app->evas, _("Eap Info"), 0); - + o = e_widget_table_add(app->evas, _("Eap Info"), 0); + + IFDUP(a->name, app->data.name); + IFDUP(a->generic, app->data.generic); + IFDUP(a->comment, app->data.comment); + IFDUP(a->exe, app->data.exe); + IFDUP(a->win_name, app->data.wname); + IFDUP(a->win_class, app->data.wclass); + IFDUP(a->win_title, app->data.wtitle); + IFDUP(a->win_role, app->data.wrole); + IFDUP(a->path, app->data.path); + + if(a->path) + { + img = edje_object_add(app->evas); + edje_object_file_set(img, a->path, "icon"); + } + else + { + img = edje_object_add(app->evas); + e_theme_edje_object_set(img, "base/theme/icons/enlightenment/e", "icons/enlightenment/e"); + } + + e_widget_table_object_append(o, e_widget_image_add_from_object(app->evas, img, 48, 48), + 0, 0, 1, 1, + 1, 1, 1, 1); + e_widget_table_object_append(o, e_widget_button_add(app->evas, "Set Icon", NULL, _e_eap_edit_browse_cb, app, NULL), @@ -45,7 +71,7 @@ e_eap_edit_show(E_Container *con, E_App *a) 1, 1, 1, 1); { Evas_Object *entry; - entry = e_widget_entry_add(app->evas, NULL); + entry = e_widget_entry_add(app->evas, &(app->data.name)); e_widget_min_size_set(entry, 100, 1); e_widget_table_object_append(o, entry, 1, 1, 1, 1, @@ -55,57 +81,78 @@ e_eap_edit_show(E_Container *con, E_App *a) e_widget_table_object_append(o, e_widget_label_add(app->evas, "Generic Info"), 0, 2, 1, 1, 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_entry_add(app->evas, NULL), + e_widget_table_object_append(o, e_widget_entry_add(app->evas, &(app->data.generic)), 1, 2, 1, 1, 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_label_add(app->evas, "Comments"), + e_widget_table_object_append(o, e_widget_label_add(app->evas, "Comment"), 0, 3, 1, 1, 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_entry_add(app->evas, NULL), + e_widget_table_object_append(o, e_widget_entry_add(app->evas, &(app->data.comment)), 1, 3, 1, 1, 1, 1, 1, 1); e_widget_table_object_append(o, e_widget_label_add(app->evas, "Executable"), 0, 4, 1, 1, 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_entry_add(app->evas, NULL), + e_widget_table_object_append(o, e_widget_entry_add(app->evas, &(app->data.exe)), 1, 4, 1, 1, 1, 1, 1, 1); e_widget_table_object_append(o, e_widget_label_add(app->evas, "Window Name"), 0, 5, 1, 1, 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_entry_add(app->evas, NULL), + e_widget_table_object_append(o, e_widget_entry_add(app->evas, &(app->data.wname)), 1, 5, 1, 1, 1, 1, 1, 1); e_widget_table_object_append(o, e_widget_label_add(app->evas, "Window Class"), 0, 6, 1, 1, 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_entry_add(app->evas, NULL), + e_widget_table_object_append(o, e_widget_entry_add(app->evas, &(app->data.wclass)), 1, 6, 1, 1, 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_label_add(app->evas, "Path"), + e_widget_table_object_append(o, e_widget_label_add(app->evas, "Window Title"), 0, 7, 1, 1, 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_entry_add(app->evas, NULL), + e_widget_table_object_append(o, e_widget_entry_add(app->evas, &(app->data.wtitle)), 1, 7, 1, 1, - 1, 1, 1, 1); + 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_label_add(app->evas, "Startup notify"), + e_widget_table_object_append(o, e_widget_label_add(app->evas, "Window Role"), 0, 8, 1, 1, 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_check_add(app->evas, "", NULL), + e_widget_table_object_append(o, e_widget_entry_add(app->evas, &(app->data.wrole)), 1, 8, 1, 1, - 1, 1, 1, 1); + 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_label_add(app->evas, "Wait exit"), + e_widget_table_object_append(o, e_widget_label_add(app->evas, "Icon Class"), 0, 9, 1, 1, 1, 1, 1, 1); - e_widget_table_object_append(o, e_widget_check_add(app->evas, "", NULL), + e_widget_table_object_append(o, e_widget_entry_add(app->evas, &(app->data.iclass)), 1, 9, 1, 1, + 1, 1, 1, 1); + + e_widget_table_object_append(o, e_widget_label_add(app->evas, "Path"), + 0, 10, 1, 1, + 1, 1, 1, 1); + e_widget_table_object_append(o, e_widget_entry_add(app->evas, &(app->data.path)), + 1, 10, 1, 1, + 1, 1, 1, 1); + + e_widget_table_object_append(o, e_widget_label_add(app->evas, "Startup notify"), + 0, 11, 1, 1, + 1, 1, 1, 1); + e_widget_table_object_append(o, e_widget_check_add(app->evas, "", &(app->data.startup_notify)), + 1, 11, 1, 1, + 1, 1, 1, 1); + + e_widget_table_object_append(o, e_widget_label_add(app->evas, "Wait exit"), + 0, 12, 1, 1, + 1, 1, 1, 1); + e_widget_table_object_append(o, e_widget_check_add(app->evas, "", &(app->data.wait_exit)), + 1, 12, 1, 1, 1, 1, 1, 1); e_widget_list_object_append(ol, o, 1, 1, 0.5); @@ -127,11 +174,50 @@ e_eap_edit_show(E_Container *con, E_App *a) static void _e_eap_edit_save_cb(void *data, E_Dialog *dia) { - E_App_Edit *app; - E_App *a; + E_App_Edit *editor; + E_App *eap; + + editor = data; + eap = editor->eap; + + if(!(editor->data.path)) + return; + + printf("path : %s\n", editor->data.path); + + E_FREE(eap->name); + E_FREE(eap->generic); + E_FREE(eap->comment); + E_FREE(eap->exe); + E_FREE(eap->win_name); + E_FREE(eap->win_class); + E_FREE(eap->win_title); + E_FREE(eap->win_role); + E_FREE(eap->icon_class); + E_FREE(eap->path); + E_FREE(eap->image); + if(editor->data.startup_notify) + eap->startup_notify = 1; + if(editor->data.wait_exit) + eap->wait_exit = 1; + + IFDUP(editor->data.name, eap->name); + IFDUP(editor->data.generic, eap->generic); + IFDUP(editor->data.comment, eap->comment); + IFDUP(editor->data.exe, eap->exe); + IFDUP(editor->data.wname, eap->win_name); + IFDUP(editor->data.wclass, eap->win_class); + IFDUP(editor->data.wtitle, eap->win_title); + IFDUP(editor->data.wrole, eap->win_role); + IFDUP(editor->data.iclass, eap->icon_class); + IFDUP(editor->data.path, eap->path); + IFDUP(editor->data.image, eap->image); + + printf("eap path: %s\n", eap->path); + + e_app_fields_save(eap); - app = data; - a = app->eap; + _e_eap_edit_free(editor); } static void diff --git a/src/bin/e_eap_editor.h b/src/bin/e_eap_editor.h index f18673b..574b3ec 100644 --- a/src/bin/e_eap_editor.h +++ b/src/bin/e_eap_editor.h @@ -20,12 +20,16 @@ struct _E_App_Edit E_App *eap; struct { + char *image; char *name; char *generic; - char *comments; + char *comment; char *exe; char *wname; char *wclass; + char *wtitle; + char *wrole; + char *iclass; char *path; int startup_notify; int wait_exit; diff --git a/src/bin/e_entry.c b/src/bin/e_entry.c index 3d03799..f7d4186 100644 --- a/src/bin/e_entry.c +++ b/src/bin/e_entry.c @@ -22,13 +22,16 @@ struct _E_Editable_Text_Smart_Data Ecore_Timer *cursor_timer; Evas_Bool cursor_at_the_end; - Evas_Bool show_cursor; + Evas_Bool show_cursor; }; struct _E_Entry_Smart_Data { Evas_Object *entry_object; Evas_Object *edje_object; + + void (*change_func) (void *data, Evas_Object *entry, char *key); + void *change_data; }; static Evas_Bool _e_editable_text_is_empty(Evas_Object *object); @@ -328,29 +331,39 @@ e_editable_text_cursor_hide(Evas_Object *object) Evas_Object * e_entry_add(Evas *evas) { - if (!e_entry_smart) - { - e_entry_smart = evas_smart_new("e_entry", - _e_entry_smart_add, /* add */ - _e_entry_smart_del, /* del */ - NULL, /* layer_set */ - _e_entry_smart_raise, /* raise */ - _e_entry_smart_lower, /* lower */ - _e_entry_smart_stack_above, /* stack_above */ - _e_entry_smart_stack_below, /* stack_below */ - _e_entry_smart_move, /* move */ - _e_entry_smart_resize, /* resize */ - _e_entry_smart_show, /* show */ - _e_entry_smart_hide, /* hide */ - NULL, /* color_set */ - NULL, /* clip_set */ - NULL, /* clip_unset */ - NULL); /* data*/ - } + if(!e_entry_smart) + e_entry_smart = evas_smart_new("e_entry", + _e_entry_smart_add, /* add */ + _e_entry_smart_del, /* del */ + NULL, /* layer_set */ + _e_entry_smart_raise, /* raise */ + _e_entry_smart_lower, /* lower */ + _e_entry_smart_stack_above, /* stack_above */ + _e_entry_smart_stack_below, /* stack_below */ + _e_entry_smart_move, /* move */ + _e_entry_smart_resize, /* resize */ + _e_entry_smart_show, /* show */ + _e_entry_smart_hide, /* hide */ + NULL, /* color_set */ + NULL, /* clip_set */ + NULL, /* clip_unset */ + NULL); /* data*/ return evas_object_smart_add(evas, e_entry_smart); } void +e_entry_change_handler_set(Evas_Object *object, void (*func)(void *data, Evas_Object *entry, char *key), void *data) +{ + E_Entry_Smart_Data *e_entry_sd; + + if ((!object) || !(e_entry_sd = evas_object_smart_data_get(object))) + return; + + e_entry_sd->change_func = func; + e_entry_sd->change_data = data; +} + +void e_entry_text_set(Evas_Object *entry, const char *text) { E_Entry_Smart_Data *e_entry_sd; @@ -522,7 +535,7 @@ _e_editable_text_cursor_position_update(Evas_Object *object) if (_e_editable_text_is_empty(object)) { - evas_object_move(editable_text_sd->cursor_object, ox, oy); + evas_object_move(editable_text_sd->cursor_object, tx, ty); evas_object_resize(editable_text_sd->cursor_object, 1, oh); return; } @@ -545,7 +558,7 @@ _e_editable_text_cursor_position_update(Evas_Object *object) cx = ox + 20; } else if (cx < ox) - { + { evas_object_move(editable_text_sd->text_object, tx + ox - cx, ty); cx = ox; } @@ -561,7 +574,7 @@ _e_editable_text_cursor_position_update(Evas_Object *object) } evas_object_move(editable_text_sd->cursor_object, cx, ty + cy); - evas_object_resize(editable_text_sd->cursor_object, 1, ch); + evas_object_resize(editable_text_sd->cursor_object, 1, ch); } /* Updates the visibility state of the cursor */ @@ -822,7 +835,15 @@ _e_entry_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event) else if (strcmp(key_event->keyname, "End") == 0) e_editable_text_cursor_move_at_end(obj); else - e_editable_text_insert(obj, key_event->string); + { + e_editable_text_insert(obj, key_event->string); + + if(key_event->string && strcmp(key_event->keyname, "Escape")) + { + if(*(key_event->string) >= 32 && *(key_event->string) <= 126) + e_entry_sd->change_func(e_entry_sd->change_data, obj, key_event->string); + } + } } /* Called when the entry is focused */ @@ -940,8 +961,9 @@ _e_entry_smart_move(Evas_Object *object, Evas_Coord x, Evas_Coord y) if ((!object) || !(e_entry_sd = evas_object_smart_data_get(object))) return; - + evas_object_move(e_entry_sd->edje_object, x, y); + e_entry_cursor_move_at_start(object); } static void diff --git a/src/bin/e_entry.h b/src/bin/e_entry.h index 45229c6..d7b452a 100644 --- a/src/bin/e_entry.h +++ b/src/bin/e_entry.h @@ -1,39 +1,50 @@ /* * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ +#ifdef E_TYPEDEFS + +typedef struct _E_Event_Entry_Change E_Event_Entry_Change; + +#else #ifndef E_ENTRY_H #define E_ENTRY_H -#include +struct _E_Event_Entry_Change +{ + Evas_Object *object; + char *keyname; + char *key; + char *string; +}; EAPI Evas_Object *e_editable_text_add(Evas *evas); - -EAPI void e_editable_text_text_set(Evas_Object *object, const char *text); -EAPI const char *e_entry_text_get(Evas_Object *object); -EAPI void e_editable_text_insert(Evas_Object *object, const char *text); - -EAPI void e_editable_text_delete_char_before(Evas_Object *object); -EAPI void e_editable_text_delete_char_after(Evas_Object *object); - -EAPI void e_editable_text_cursor_move_at_start(Evas_Object *object); -EAPI void e_editable_text_cursor_move_at_end(Evas_Object *object); -EAPI void e_editable_text_cursor_move_left(Evas_Object *object); -EAPI void e_editable_text_cursor_move_right(Evas_Object *object); - -EAPI void e_editable_text_cursor_show(Evas_Object *object); -EAPI void e_editable_text_cursor_hide(Evas_Object *object); - +EAPI void e_editable_text_text_set(Evas_Object *object, const char *text); +EAPI const char *e_entry_text_get(Evas_Object *object); +EAPI void e_editable_text_insert(Evas_Object *object, const char *text); +EAPI void e_editable_text_delete_char_before(Evas_Object *object); +EAPI void e_editable_text_delete_char_after(Evas_Object *object); +EAPI void e_editable_text_cursor_move_at_start(Evas_Object *object); +EAPI void e_editable_text_cursor_move_at_end(Evas_Object *object); +EAPI void e_editable_text_cursor_move_left(Evas_Object *object); +EAPI void e_editable_text_cursor_move_right(Evas_Object *object); +EAPI void e_editable_text_cursor_show(Evas_Object *object); +EAPI void e_editable_text_cursor_hide(Evas_Object *object); + +EAPI int e_entry_init(void); +EAPI int e_entry_shutdown(void); EAPI Evas_Object *e_entry_add(Evas *evas); -EAPI void e_entry_text_set (Evas_Object *entry, const char *text); -EAPI const char* e_editable_text_text_get(Evas_Object *object); -EAPI void e_entry_text_insert (Evas_Object *entry, const char *text); -EAPI void e_entry_delete_char_before(Evas_Object *object); -EAPI void e_entry_delete_char_after(Evas_Object *object); -EAPI void e_entry_cursor_move_at_start(Evas_Object *object); -EAPI void e_entry_cursor_move_at_end(Evas_Object *object); -EAPI void e_entry_cursor_move_left(Evas_Object *object); -EAPI void e_entry_cursor_move_right(Evas_Object *object); -EAPI void e_entry_cursor_show(Evas_Object *object); -EAPI void e_entry_cursor_hide(Evas_Object *object); +EAPI void e_entry_text_set (Evas_Object *entry, const char *text); +EAPI const char *e_editable_text_text_get(Evas_Object *object); +EAPI void e_entry_text_insert (Evas_Object *entry, const char *text); +EAPI void e_entry_delete_char_before(Evas_Object *object); +EAPI void e_entry_delete_char_after(Evas_Object *object); +EAPI void e_entry_cursor_move_at_start(Evas_Object *object); +EAPI void e_entry_cursor_move_at_end(Evas_Object *object); +EAPI void e_entry_cursor_move_left(Evas_Object *object); +EAPI void e_entry_cursor_move_right(Evas_Object *object); +EAPI void e_entry_cursor_show(Evas_Object *object); +EAPI void e_entry_cursor_hide(Evas_Object *object); +EAPI void e_entry_change_handler_set(Evas_Object *object, void (*func)(void *data, Evas_Object *entry, char *key), void *data); #endif +#endif diff --git a/src/bin/e_fileman_smart.c b/src/bin/e_fileman_smart.c index 24dc269..e1d3d40 100644 --- a/src/bin/e_fileman_smart.c +++ b/src/bin/e_fileman_smart.c @@ -810,9 +810,6 @@ _e_fm_file_menu_rename(void *data, E_Menu *m, E_Menu_Item *mi) evas_object_focus_set(icon->sd->entry_object, 1); evas_object_show(icon->sd->entry_object); e_entry_cursor_show(icon->sd->entry_object); - e_entry_text_set(icon->sd->entry_object, icon->file->name); - e_entry_cursor_move_at_end(icon->sd->entry_object); - e_entry_cursor_move_at_start(icon->sd->entry_object); e_fm_icon_edit_entry_set(icon->icon_object, icon->sd->entry_object); e_fm_icon_title_set(icon->icon_object, ""); @@ -820,6 +817,9 @@ _e_fm_file_menu_rename(void *data, E_Menu *m, E_Menu_Item *mi) e_fm_mouse_up_handler = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP, _e_fm_win_mouse_up_cb, icon); e_grabinput_get(icon->sd->win->evas_win, 1, icon->sd->win->evas_win); + e_entry_cursor_move_at_start(icon->sd->entry_object); + e_entry_text_set(icon->sd->entry_object, icon->file->name); + e_fm_grab_time = ecore_time_get(); } diff --git a/src/bin/e_main.c b/src/bin/e_main.c index ca1ce6a..22a35b7 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -371,7 +371,6 @@ main(int argc, char **argv) _e_main_shutdown_push(e_fm_shutdown); _e_main_shutdown_push(e_fm_icon_shutdown); - /*** Finished loading subsystems, Loading WM Specifics ***/ /* setup directories we will be using for configurations storage etc. */ diff --git a/src/bin/e_widget_entry.c b/src/bin/e_widget_entry.c index e3ec698..bc04ba9 100644 --- a/src/bin/e_widget_entry.c +++ b/src/bin/e_widget_entry.c @@ -8,7 +8,8 @@ typedef struct _E_Widget_Data E_Widget_Data; struct _E_Widget_Data { Evas_Object *o_entry; - int *valptr; + char **valptr; + Ecore_Event_Handler *change_handler; }; static void _e_wid_del_hook(Evas_Object *obj); @@ -18,7 +19,8 @@ static void _e_wid_activate_hook(Evas_Object *obj); static void _e_wid_disable_hook(Evas_Object *obj); static void _e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source); static void _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info); - +static int _e_wid_text_change(void *data, Evas_Object *entry, char *key); + /* local subsystem functions */ static void @@ -108,9 +110,36 @@ _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info) e_widget_focus_steal(data); } +static int +_e_wid_text_change(void *data, Evas_Object *entry, char *key) +{ + E_Widget_Data *wd; + int size; + + wd = data; + + if(*(wd->valptr) == NULL) + { + size = (strlen(key) + 1) * sizeof(char); + *(wd->valptr) = realloc(*(wd->valptr), size); + snprintf(*(wd->valptr), size, "%s", key); + } + else + { + char *tmp; + + size = (strlen(*(wd->valptr)) + strlen(key) + 1) * sizeof(char); + tmp = E_NEW(char *, strlen(*(wd->valptr)) + 1); + snprintf(tmp, strlen(*(wd->valptr)) + 1, "%s", *(wd->valptr)); + *(wd->valptr) = realloc(*(wd->valptr), size); + snprintf(*(wd->valptr), size, "%s%s\0", tmp, key); + E_FREE(tmp); + } +} + /* externally accessible functions */ Evas_Object * -e_widget_entry_add(Evas *evas, char *val) +e_widget_entry_add(Evas *evas, char **val) { Evas_Object *obj, *o; E_Widget_Data *wd; @@ -133,20 +162,21 @@ e_widget_entry_add(Evas *evas, char *val) evas_object_show(o); edje_object_size_min_calc(o, &mw, &mh); e_widget_min_size_set(obj, mw, mh); - if (wd->valptr) - { - - } + + if (*(wd->valptr)) + e_entry_text_set(wd->o_entry, *(wd->valptr)); e_widget_sub_object_add(obj, o); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj); e_widget_resize_object_set(obj, o); + + e_entry_change_handler_set(wd->o_entry, _e_wid_text_change, wd); return obj; } - +#if 0 void e_widget_entry_text_set(Evas_Object *entry, const char *text) { @@ -212,3 +242,4 @@ e_widget_entry_cursor_hide(Evas_Object *entry) { e_entry_cursor_hide(entry); } +#endif diff --git a/src/bin/e_widget_entry.h b/src/bin/e_widget_entry.h index 7517def..1892998 100644 --- a/src/bin/e_widget_entry.h +++ b/src/bin/e_widget_entry.h @@ -6,7 +6,7 @@ #ifndef E_WIDGET_ENTRY_H #define E_WIDGET_ENTRY_H -EAPI Evas_Object *e_widget_entry_add(Evas *evas, char *val); +EAPI Evas_Object *e_widget_entry_add(Evas *evas, char **val); EAPI void e_widget_entry_text_set (Evas_Object *entry, const char *text); EAPI const char *e_editable_text_text_get(Evas_Object *entry); EAPI void e_widget_entry_text_insert (Evas_Object *entry, const char *text); diff --git a/src/bin/e_widget_image.c b/src/bin/e_widget_image.c index 84f703f..3751865 100644 --- a/src/bin/e_widget_image.c +++ b/src/bin/e_widget_image.c @@ -9,15 +9,15 @@ Evas_Object * e_widget_image_add_from_object(Evas *evas, Evas_Object *object, int minw, int minh) { - Evas_Object *obj, *o; + Evas_Object *obj; obj = e_widget_add(evas); - evas_object_show(o); + evas_object_show(object); e_widget_can_focus_set(obj, 0); e_widget_min_size_set(obj, minw, minh); - e_widget_sub_object_add(obj, o); - e_widget_resize_object_set(obj, o); + e_widget_sub_object_add(obj, object); + e_widget_resize_object_set(obj, object); return obj; } @@ -37,7 +37,9 @@ e_widget_image_add_from_file(Evas *evas, char *file, int minw, int minh) e_widget_can_focus_set(obj, 0); e_widget_min_size_set(obj, minw, minh); e_widget_sub_object_add(obj, o); - e_widget_resize_object_set(obj, o); + e_widget_resize_object_set(obj, o); + + return obj; } -- 2.7.4