summaryrefslogtreecommitdiff
path: root/apps/shortcuts.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/shortcuts.c')
-rw-r--r--apps/shortcuts.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/apps/shortcuts.c b/apps/shortcuts.c
index f573d6fe4e..754bd83b80 100644
--- a/apps/shortcuts.c
+++ b/apps/shortcuts.c
@@ -312,18 +312,22 @@ static int readline_cb(int n, char *buf, void *parameters)
312 } 312 }
313 else if (sc && settings_parseline(buf, &name, &value)) 313 else if (sc && settings_parseline(buf, &name, &value))
314 { 314 {
315 if (!strcmp(name, "type")) 315 static const char *nm_options[] = {"type", "name", "data",
316 "icon", "talkclip", NULL};
317 int nm_op = string_option(name, nm_options, false);
318
319 if (nm_op == 0) /*type*/
316 { 320 {
317 int t = 0; 321 int t = 0;
318 for (t=0; t<SHORTCUT_TYPE_COUNT && sc->type == SHORTCUT_UNDEFINED; t++) 322 for (t=0; t<SHORTCUT_TYPE_COUNT && sc->type == SHORTCUT_UNDEFINED; t++)
319 if (!strcmp(value, type_strings[t])) 323 if (!strcmp(value, type_strings[t]))
320 sc->type = t; 324 sc->type = t;
321 } 325 }
322 else if (!strcmp(name, "name")) 326 else if (nm_op == 1) /*name*/
323 { 327 {
324 strlcpy(sc->name, value, MAX_SHORTCUT_NAME); 328 strlcpy(sc->name, value, MAX_SHORTCUT_NAME);
325 } 329 }
326 else if (!strcmp(name, "data")) 330 else if (nm_op == 2) /*data*/
327 { 331 {
328 switch (sc->type) 332 switch (sc->type)
329 { 333 {
@@ -357,7 +361,7 @@ static int readline_cb(int n, char *buf, void *parameters)
357 break; 361 break;
358 } 362 }
359 } 363 }
360 else if (!strcmp(name, "icon")) 364 else if (nm_op == 3) /*icon*/
361 { 365 {
362 if (!strcmp(value, "filetype") && sc->type != SHORTCUT_SETTING && sc->u.path[0]) 366 if (!strcmp(value, "filetype") && sc->type != SHORTCUT_SETTING && sc->u.path[0])
363 { 367 {
@@ -368,7 +372,7 @@ static int readline_cb(int n, char *buf, void *parameters)
368 sc->icon = atoi(value); 372 sc->icon = atoi(value);
369 } 373 }
370 } 374 }
371 else if (!strcmp(name, "talkclip")) 375 else if (nm_op == 4) /*talkclip*/
372 { 376 {
373 strlcpy(sc->talk_clip, value, MAX_PATH); 377 strlcpy(sc->talk_clip, value, MAX_PATH);
374 } 378 }