summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Houston <smhouston88@gmail.com>2017-09-26 11:41:38 -0500
committerStephen Houston <smhouston88@gmail.com>2017-09-26 11:41:38 -0500
commit8a3cc811f43f1fd5dde2ebd3616f9707108b7440 (patch)
treee1271921c7aee5a3cff40d9cfe3d342f9cdd5d06
parenta790f13308ea54bef1ef1d2d267f8d10c4834a93 (diff)
Ephoto Directory Browser: Add an item for the top directory.
For instance, if the top directory is /home/stephen then the genlist listing of the directory tree should start with an item for /home/stephen instead of starting with the contents of /home/stephen/*
-rw-r--r--src/bin/ephoto_directory_browser.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/bin/ephoto_directory_browser.c b/src/bin/ephoto_directory_browser.c
index 7445e96..d324215 100644
--- a/src/bin/ephoto_directory_browser.c
+++ b/src/bin/ephoto_directory_browser.c
@@ -1232,8 +1232,10 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
1232 evas_object_data_get(ephoto->dir_browser, "directory_browser"); 1232 evas_object_data_get(ephoto->dir_browser, "directory_browser");
1233 Eina_List *dirs = NULL, *l; 1233 Eina_List *dirs = NULL, *l;
1234 Elm_Object_Item *next = NULL, *cur = NULL; 1234 Elm_Object_Item *next = NULL, *cur = NULL;
1235 char path[PATH_MAX], *dir, *end_dir; 1235 Ephoto_Entry *tentry = NULL;
1236 char top[PATH_MAX], path[PATH_MAX], *dir, *end_dir;
1236 int count = 0; 1237 int count = 0;
1238 const Elm_Genlist_Item_Class *tic;
1237 1239
1238 end_dir = strdup(ephoto->config->directory); 1240 end_dir = strdup(ephoto->config->directory);
1239 if (strcmp(ephoto->config->open, ephoto->config->directory)) 1241 if (strcmp(ephoto->config->open, ephoto->config->directory))
@@ -1257,6 +1259,15 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
1257 dir = NULL; 1259 dir = NULL;
1258 } 1260 }
1259 } 1261 }
1262 snprintf(top, PATH_MAX, "%s", ephoto->config->open);
1263 tentry = ephoto_entry_new(ephoto, ephoto->config->open, basename(top),
1264 EINA_FILE_DIR);
1265 tentry->parent = NULL;
1266 tic = _ephoto_dir_tree_class;
1267 tentry->item = elm_genlist_item_sorted_insert(db->fsel, tic, tentry,
1268 NULL, ELM_GENLIST_ITEM_TREE,
1269 _entry_cmp, NULL, NULL);
1270 elm_genlist_item_expanded_set(tentry->item, EINA_TRUE);
1260 EINA_LIST_FOREACH(dirs, l, dir) 1271 EINA_LIST_FOREACH(dirs, l, dir)
1261 { 1272 {
1262 Eina_Iterator *it; 1273 Eina_Iterator *it;
@@ -1265,7 +1276,9 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
1265 1276
1266 it = eina_file_stat_ls(dir); 1277 it = eina_file_stat_ls(dir);
1267 cur = next; 1278 cur = next;
1268 EINA_ITERATOR_FOREACH(it, finfo) 1279 if (!cur)
1280 cur = tentry->item;
1281 EINA_ITERATOR_FOREACH(it, finfo)
1269 { 1282 {
1270 char *rp = ecore_file_realpath(finfo->path); 1283 char *rp = ecore_file_realpath(finfo->path);
1271 if (finfo->type != EINA_FILE_DIR && finfo->type != EINA_FILE_LNK) 1284 if (finfo->type != EINA_FILE_DIR && finfo->type != EINA_FILE_LNK)
@@ -1340,7 +1353,7 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
1340 } 1353 }
1341 else 1354 else
1342 { 1355 {
1343 ephoto_directory_set(ephoto, ephoto->config->directory, NULL, 1356 ephoto_directory_set(ephoto, ephoto->config->directory, tentry->item,
1344 EINA_FALSE, EINA_FALSE); 1357 EINA_FALSE, EINA_FALSE);
1345 ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory); 1358 ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
1346 } 1359 }