summaryrefslogtreecommitdiff
path: root/legacy/ecore
diff options
context:
space:
mode:
authorhandyande <handyande>2004-06-17 08:48:06 +0000
committerhandyande <handyande@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2004-06-17 08:48:06 +0000
commite1704a29b526ca419f7d85bcc8a2dac3596be2e4 (patch)
tree234d17f170ed953194c1e4b773fba5a8b55e313c /legacy/ecore
parente1ea47b82e312511c97d66cc2428e2ad0b142c20 (diff)
If each all using ecore_config themes calls this with PACKAGE_DATA_DIR "/themes/" or similar then the search path should be all encompassing
SVN revision: 10533
Diffstat (limited to 'legacy/ecore')
-rw-r--r--legacy/ecore/src/lib/ecore_config/convenience.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/legacy/ecore/src/lib/ecore_config/convenience.c b/legacy/ecore/src/lib/ecore_config/convenience.c
index 701670d84d..e9745cde96 100644
--- a/legacy/ecore/src/lib/ecore_config/convenience.c
+++ b/legacy/ecore/src/lib/ecore_config/convenience.c
@@ -354,6 +354,47 @@ ecore_config_theme_search_path_get(void)
354} 354}
355 355
356/** 356/**
357 * Adds to the search path used to find themes. The current path is found and
358 * searches for occurrences of the appending item. If this item is not found it
359 * is appended to the search path wich is then saved back into the property
360 * "/e/themes/search_path".
361 * Note: This should be called after ecore_config_load() to allow a users
362 * overriding the default search path to be read.
363 * @return On success ECORE_CONFIG_ERR_SUCC, on fail ECORE_CONFIG_ERR_FAIL
364 * (appending item already in search path) or on NULL being passed in
365 * ECORE_CONFIG_ERR_NODATA
366*/
367int
368ecore_config_theme_search_path_append(char *path)
369{
370 char *search_path, *loc, *new_search_path;
371 int len, search_len;
372
373 if (!path)
374 return ECORE_CONFIG_ERR_NODATA;
375 search_path = ecore_config_theme_search_path_get();
376
377 loc = strstr(search_path, path);
378 len = strlen(path);
379 search_len = strlen(search_path);
380
381 if (loc == NULL || (loc != search_path && *(loc - 1) != '|') ||
382 (loc != (search_len - len) && *(loc + len - 1) != '|'))
383 {
384 new_search_path = malloc(search_len + len + 2); /* 2 = \0 + | */
385 strcpy(new_search_path, search_path);
386 strncat(new_search_path, "|", 1);
387 strncat(new_search_path, path, len);
388
389 ecore_config_string_set("/e/themes/search_path", new_search_path);
390 free(new_search_path);
391
392 return ECORE_CONFIG_ERR_SUCC;
393 }
394 return ECORE_CONFIG_ERR_FAIL;
395}
396
397/**
357 * Get a theme files full path, as it is found according to the search path. 398 * Get a theme files full path, as it is found according to the search path.
358 * The theme searched for is @name (e.g. "winter"). 399 * The theme searched for is @name (e.g. "winter").
359 * The search path is defined by ecore_config_theme_search_path_get(). 400 * The search path is defined by ecore_config_theme_search_path_get().
@@ -383,8 +424,9 @@ ecore_config_theme_with_path_from_name_get(char *name)
383 424
384 file = malloc(strlen(search_path_tmp) + strlen(name) + 6); 425 file = malloc(strlen(search_path_tmp) + strlen(name) + 6);
385 /* 6 = / + .eet + \0 */ 426 /* 6 = / + .eet + \0 */
427
386 snprintf(file, strlen(search_path_tmp) + strlen(name) + 6, 428 snprintf(file, strlen(search_path_tmp) + strlen(name) + 6,
387 "%s/%s.eet", search_path_tmp, name); 429 "%s/%s.eet", search_path_tmp, name);
388 430
389 if (stat(file, &st) == 0) 431 if (stat(file, &st) == 0)
390 { 432 {