Changeset 58124 in webkit
- Timestamp:
- Apr 22, 2010 4:00:23 PM (14 years ago)
- Location:
- trunk/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/ChangeLog
r58122 r58124 1 2010-04-22 Leandro Pereira <leandro@profusion.mobi> 2 3 Reviewed by Gustavo Noronha Silva. 4 5 Implement findThemePath to locate the correct theme file instead of 6 relying on a hardcoded location. 7 http://webkit.org/b/37996 8 9 * efl/EWebLauncher/main.c: 10 (findThemePath): Fix to locate the correct theme files. 11 (main): Use findThemePath() instead of a hardcoded one. 12 1 13 2010-04-22 Leandro Pereira <leandro@profusion.mobi> 2 14 -
trunk/WebKit/efl/EWebLauncher/main.c
r56130 r58124 32 32 #include <ctype.h> 33 33 #include <Ecore.h> 34 #include <Ecore_Data.h>35 34 #include <Ecore_Evas.h> 36 35 #include <Ecore_File.h> … … 43 42 #include <stdlib.h> 44 43 #include <string.h> 44 #include <sys/stat.h> 45 45 #include <sys/types.h> 46 46 #include <unistd.h> … … 54 54 printf(format, ##args); \ 55 55 } while (0) 56 57 #define REL_THEME_PATH "../../../WebKit/efl/DefaultTheme/default.edj"58 56 59 57 #define MIN_ZOOM_LEVEL 0 … … 137 135 } ELauncher; 138 136 139 void browserDestroy(Ecore_Evas *ee);140 void closeWindow(Ecore_Evas *ee);141 int browserCreate(const char *url, const char *theme, const char *userAgent, Eina_Rectangle geometry, const char *engine, unsigned char isFullscreen);142 143 void137 static void browserDestroy(Ecore_Evas *ee); 138 static void closeWindow(Ecore_Evas *ee); 139 static int browserCreate(const char *url, const char *theme, const char *userAgent, Eina_Rectangle geometry, const char *engine, unsigned char isFullscreen); 140 141 static void 144 142 print_history(Eina_List *list) 145 143 { … … 174 172 } 175 173 176 void174 static void 177 175 zoom_level_set(Evas_Object *webview, int level) 178 176 { … … 186 184 } 187 185 188 char*189 join_path(const char *base, const char *path)190 {191 char separator[] = "/";192 193 char tmp[PATH_MAX + 1];194 char result[PATH_MAX + 1];195 result[0] = tmp[0] = '\0';196 197 char *str = strdup(path);198 199 char *token = NULL;200 token = strtok(str, separator);201 int count = 0;202 do {203 if (!strcmp(token, ".."))204 count++;205 else206 strcat(tmp, token);207 token = strtok(NULL, separator);208 if (!token)209 break;210 if (tmp[0])211 strcat(tmp, separator);212 } while (EINA_TRUE);213 214 free(str);215 str = strdup(base);216 217 char *base_ptr;218 while (count--) {219 base_ptr = strrchr(str, separator[0]);220 if (!base_ptr) {221 free(str);222 return NULL; // couldn't resolve path223 }224 *base_ptr = '\0';225 }226 227 strcat(result, str);228 strcat(result, separator);229 strcat(result, tmp);230 free(str);231 232 return strdup(result);233 }234 235 186 static void 236 187 on_ecore_evas_resize(Ecore_Evas *ee) … … 395 346 } 396 347 397 void348 static void 398 349 on_mouse_down(void* data, Evas* e, Evas_Object* webview, void* event_info) 399 350 { … … 403 354 } 404 355 405 void356 static void 406 357 on_focus_out(void *data, Evas *e, Evas_Object *obj, void *event_info) 407 358 { … … 409 360 } 410 361 411 void362 static void 412 363 on_focus_in(void *data, Evas *e, Evas_Object *obj, void *event_info) 413 364 { … … 415 366 } 416 367 417 void368 static void 418 369 on_resized(void *data, Evas *e, Evas_Object *obj, void *event_info) 419 370 { … … 423 374 } 424 375 425 void376 static void 426 377 on_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info) 427 378 { … … 531 482 } 532 483 533 void484 static void 534 485 on_browser_del(void *data, Evas *evas, Evas_Object *browser, void *event) 535 486 { … … 543 494 } 544 495 545 void496 static void 546 497 on_closeWindow(Ecore_Evas *ee) 547 498 { … … 549 500 } 550 501 551 int502 static int 552 503 quit(Eina_Bool success, const char *msg) 553 504 { … … 566 517 } 567 518 568 int519 static int 569 520 browserCreate(const char *url, const char *theme, const char *userAgent, Eina_Rectangle geometry, const char *engine, unsigned char isFullscreen) 570 521 { … … 654 605 } 655 606 656 void607 static void 657 608 browserDestroy(Ecore_Evas *ee) 658 609 { … … 662 613 } 663 614 664 void615 static void 665 616 closeWindow(Ecore_Evas *ee) 666 617 { … … 689 640 ecore_main_loop_quit(); 690 641 return 1; 642 } 643 644 static char * 645 findThemePath(void) 646 { 647 const char **itr, *locations[] = { 648 "./default.edj", 649 "./WebKit/efl/DefaultTheme/default.edj", 650 "../WebKit/efl/DefaultTheme/default.edj", 651 DATA_DIR"/themes/default.edj", 652 NULL 653 }; 654 655 for (itr = locations; *itr; itr++) { 656 struct stat st; 657 if (!stat(*itr, &st)) { 658 char path[PATH_MAX]; 659 if (realpath(*itr, path)) 660 return strdup(path); 661 } 662 } 663 664 return NULL; 691 665 } 692 666 … … 751 725 strcat(getenv("HOME"), "blah"); 752 726 753 themePath = join_path(argv[0], REL_THEME_PATH);727 themePath = findThemePath(); 754 728 755 729 ewk_init();
Note: See TracChangeset
for help on using the changeset viewer.