summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/folder_select.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/apps/gui/folder_select.c b/apps/gui/folder_select.c
index 512b73f588..05354c4c6c 100644
--- a/apps/gui/folder_select.c
+++ b/apps/gui/folder_select.c
@@ -300,11 +300,12 @@ static enum themable_icons folder_get_icon(int selected_item, void * data)
300static int folder_action_callback(int action, struct gui_synclist *list) 300static int folder_action_callback(int action, struct gui_synclist *list)
301{ 301{
302 struct folder *root = (struct folder*)list->data; 302 struct folder *root = (struct folder*)list->data;
303 struct folder *parent;
304 struct child *this = find_index(root, list->selected_item, &parent), *child;
305 int i;
303 306
304 if (action == ACTION_STD_OK) 307 if (action == ACTION_STD_OK)
305 { 308 {
306 struct folder *parent;
307 struct child *this = find_index(root, list->selected_item, &parent);
308 switch (this->state) 309 switch (this->state)
309 { 310 {
310 case EXPANDED: 311 case EXPANDED:
@@ -321,11 +322,49 @@ static int folder_action_callback(int action, struct gui_synclist *list)
321 break; 322 break;
322 case EACCESS: 323 case EACCESS:
323 /* cannot open, do nothing */ 324 /* cannot open, do nothing */
325 return action;
326 }
327 list->nb_items = count_items(root);
328 return ACTION_REDRAW;
329 }
330 else if (action == ACTION_STD_CONTEXT)
331 {
332 switch (this->state)
333 {
334 case EXPANDED:
335 for (i = 0; i < this->folder->children_count; i++)
336 {
337 child = &this->folder->children[i];
338 if (child->state == SELECTED ||
339 child->state == EXPANDED)
340 child->state = COLLAPSED;
341 else if (child->state == COLLAPSED)
342 child->state = SELECTED;
343 }
324 break; 344 break;
345 case SELECTED:
346 case COLLAPSED:
347 if (this->folder == NULL)
348 this->folder = load_folder(parent, this->name);
349 this->state = this->folder ? (this->folder->children_count == 0 ?
350 SELECTED : EXPANDED) : EACCESS;
351 if (this->state == EACCESS)
352 break;
353 for (i = 0; i < this->folder->children_count; i++)
354 {
355 child = &this->folder->children[i];
356 child->state = SELECTED;
357 }
358 break;
359 case EACCESS:
360 /* cannot open, do nothing */
361 return action;
325 } 362 }
326 list->nb_items = count_items(root); 363 list->nb_items = count_items(root);
327 return ACTION_REDRAW; 364 return ACTION_REDRAW;
328 } 365 }
366
367
329 return action; 368 return action;
330} 369}
331 370