summaryrefslogtreecommitdiff
path: root/src/tests/efreet/efreet_spec_test.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-29 23:04:40 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-29 23:04:40 +0000
commit4bc0210bd31ed1de6554441562bd93ea863ee9d9 (patch)
tree5d83be12538f8c8d3816bbf65916ce383d050c2e /src/tests/efreet/efreet_spec_test.c
parent727ddbeaf0c53f31cd62c254fdebe26823d537eb (diff)
efl: merge efreet.
seems to be fine, pass distcheck and friends. please report. changes: - documentation hierarchy fixes - replaced __UNUSED__ with EINA_UNUSED - replaced PKG_DATA_DIR with PACKAGE_DATA_DIR"/efreet" SVN revision: 81889
Diffstat (limited to 'src/tests/efreet/efreet_spec_test.c')
-rw-r--r--src/tests/efreet/efreet_spec_test.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/tests/efreet/efreet_spec_test.c b/src/tests/efreet/efreet_spec_test.c
new file mode 100644
index 0000000000..a0fb11590c
--- /dev/null
+++ b/src/tests/efreet/efreet_spec_test.c
@@ -0,0 +1,57 @@
1#include <Efreet.h>
2#include <stdio.h>
3#include <limits.h>
4#include "ef_test.h"
5
6static void dump(Efreet_Menu *menu, const char *path);
7
8int
9main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
10{
11 Efreet_Menu *menu;
12
13 if (!efreet_init())
14 {
15 fprintf(stderr, "Failed to init Efreet\n");
16 return 1;
17 }
18
19 menu = efreet_menu_get();
20 if (!menu)
21 {
22 fprintf(stderr, "Failed to read menu\n");
23 return 1;
24 }
25
26 dump(menu, "");
27
28 efreet_menu_free(menu);
29 efreet_shutdown();
30 return 0;
31}
32
33static void
34dump(Efreet_Menu *menu, const char *path)
35{
36 Efreet_Menu *entry;
37 Eina_List *l;
38
39 if (!menu || !menu->entries) return;
40
41 EINA_LIST_FOREACH(menu->entries, l, entry)
42 {
43 if (entry->type == EFREET_MENU_ENTRY_DESKTOP)
44 {
45 if (!path || !*path) path = "/";
46 printf("%s\t%s\t%s\n", path, entry->id,
47 entry->desktop->orig_path);
48 }
49 else if (entry->type == EFREET_MENU_ENTRY_MENU)
50 {
51 char new_path[PATH_MAX];
52
53 snprintf(new_path, sizeof(new_path), "%s%s/", path, entry->name);
54 dump(entry, new_path);
55 }
56 }
57}