" }\n" \
"}\n"
+#define EAP_EDC_TMPL_EMPTY \
+"images {\n " \
+"}\n" \
+"collections {\n" \
+"}\n"
/* externally accessible functions */
unsigned char tmp[1];
int img;
+ if(!a->path)
+ return;
+
if(!ecore_file_exists(a->path))
{
_e_app_new_save(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);
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 *
{
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;
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),
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,
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);
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
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;
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);
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;
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;
}
cx = ox + 20;
}
else if (cx < ox)
- {
+ {
evas_object_move(editable_text_sd->text_object, tx + ox - cx, ty);
cx = ox;
}
}
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 */
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 */
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
/*
* 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 <Evas.h>
+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
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, "");
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();
}
_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. */
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);
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
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;
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)
{
{
e_entry_cursor_hide(entry);
}
+#endif
#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);
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;
}
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;
}