Enlightenment CVS committal Author : codewarrior Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_apps.c e_apps.h e_entry.h Log Message: - add ability to save eap info to disk - add ability to create and populate empty eaps =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.c,v retrieving revision 1.93 retrieving revision 1.94 diff -u -3 -r1.93 -r1.94 --- e_apps.c 6 Oct 2005 19:38:46 -0000 1.93 +++ e_apps.c 24 Oct 2005 21:52:31 -0000 1.94 @@ -189,6 +189,9 @@ if (ecore_file_exists(path)) { a = E_OBJECT_ALLOC(E_App, E_APP_TYPE, _e_app_free); + + /* no image for now */ + a->image = NULL; /* record the path */ a->path = strdup(path); @@ -233,6 +236,17 @@ return NULL; } +E_App * +e_app_empty_new(const char *path) +{ + E_App *a; + + a = E_OBJECT_ALLOC(E_App, E_APP_TYPE, _e_app_free); + a->image = NULL; + a->path = strdup(path); + return a; +} + int e_app_is_parent(E_App *parent, E_App *app) { @@ -932,6 +946,116 @@ eet_close(ef); } +/* If we are saving a new non-existant .eap, we need to add more info + * so edje can decompile it. Image saving doesnt work yet with newly + * created eaps. + * + * We also need to fix startup-notify and wait-exit as they currently + * dont save too. + */ +void +e_app_fields_save(E_App *a) +{ + Eet_File *ef; + char buf[PATH_MAX]; + char *str, *v; + char *lang; + int size; + unsigned char tmp[1]; + + /* get our current language */ + lang = getenv("LANG"); + /* if its "C" its the default - so drop it */ + if ((lang) && (!strcmp(lang, "C"))) + lang = NULL; + if(ecore_file_exists(a->path)) + ef = eet_open(a->path, EET_FILE_MODE_READ_WRITE); + else + ef = eet_open(a->path, EET_FILE_MODE_WRITE); + if (!ef) return; + + + printf("opened %s\n", a->path); + + if(a->name) + { + /*if (lang) snprintf(buf, sizeof(buf), "app/info/name[%s]", lang); + else */snprintf(buf, sizeof(buf), "app/info/name"); + eet_write(ef, buf, a->name, strlen(a->name), 0); + } + + if(a->generic) + { + /*if (lang) snprintf(buf, sizeof(buf), "app/info/generic[%s]", lang); + else */snprintf(buf, sizeof(buf), "app/info/generic"); + eet_write(ef, buf, a->generic, strlen(a->generic), 0); + } + + if(a->comment) + { + /*if (lang) snprintf(buf, sizeof(buf), "app/info/comment[%s]", lang); + else*/ snprintf(buf, sizeof(buf), "app/info/comment"); + eet_write(ef, buf, a->comment, strlen(a->comment), 0); + } + + if(a->exe) + eet_write(ef, "app/info/exe", a->exe, strlen(a->exe), 0); + if(a->win_name) + eet_write(ef, "app/window/name", a->win_name, strlen(a->win_name), 0); + if(a->win_class) + eet_write(ef, "app/window/class", a->win_class, strlen(a->win_class), 0); + if(a->win_title) + eet_write(ef, "app/window/title", a->win_title, strlen(a->win_title), 0); + if(a->win_role) + eet_write(ef, "app/window/role", a->win_role, strlen(a->win_role), 0); + if(a->icon_class) + eet_write(ef, "app/icon/class", a->icon_class, strlen(a->icon_class), 0); + + if(a->startup_notify) + tmp[0] = 1; + else + tmp[0] = 0; + eet_write(ef, "app/info/startup_notify", tmp, 1, 0); + + if(a->wait_exit) + tmp[0] = 1; + else + tmp[0] = 0; + eet_write(ef, "app/info/wait_exit", tmp, 1, 0); + + if(a->image) + { + int alpha; + Ecore_Evas *buf; + Evas *evasbuf; + Evas_Coord iw, ih; + Evas_Object *im; + int *data; + + buf = ecore_evas_buffer_new(1, 1); + evasbuf = ecore_evas_get(buf); + im = evas_object_image_add(evasbuf); + evas_object_image_file_set(im, a->image, NULL); + iw = 0; ih = 0; + evas_object_image_size_get(im, &iw, &ih); + alpha = evas_object_image_alpha_get(im); + if ((iw > 0) && (ih > 0)) + { + /* we need to change the sizes */ + ecore_evas_resize(buf, 48, 48); + evas_object_image_fill_set(im, 0, 0, 48, 48); + evas_object_resize(im, 48, 48); + evas_object_move(im, 0, 0); + evas_object_show(im); + data = ecore_evas_buffer_pixels_get(buf); + eet_data_image_write(ef, "images/0", data, 48, 48, alpha, 1, 0, 0); + } + } + + + eet_close(ef); +} + void e_app_fields_empty(E_App *a) { =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -3 -r1.23 -r1.24 --- e_apps.h 28 Sep 2005 03:35:16 -0000 1.23 +++ e_apps.h 24 Oct 2005 21:52:31 -0000 1.24 @@ -61,6 +61,8 @@ unsigned char scanned : 1; /* have we scanned a subdir app yet */ unsigned char deleted : 1; /* this app's file is deleted from disk */ + + char *image; /* used when we're saving a image into the eap */ }; struct _E_App_Instance @@ -76,6 +78,7 @@ EAPI int e_app_shutdown (void); EAPI E_App *e_app_new (const char *path, int scan_subdirs); +EAPI E_App *e_app_empty_new (const char *path); EAPI int e_app_is_parent (E_App *parent, E_App *app); EAPI int e_app_equals (E_App *app1, E_App *app2); EAPI void e_app_subdir_scan (E_App *a, int scan_subdirs); @@ -99,6 +102,7 @@ EAPI E_App *e_app_exe_find (char *exe); EAPI void e_app_fields_fill (E_App *a, const char *path); +EAPI void e_app_fields_save (E_App *a); EAPI E_App *e_app_raw_new (void); EAPI Ecore_List *e_app_dir_file_list_get (E_App *a); EAPI void e_app_fields_empty (E_App *a); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_entry.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- e_entry.h 4 Oct 2005 21:32:19 -0000 1.4 +++ e_entry.h 24 Oct 2005 21:52:31 -0000 1.5 @@ -34,6 +34,6 @@ 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_cursor_hide(Evas_Object *object); #endif ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs