Added a test for MUIA_Listview_SelectChange.
[AROS.git] / workbench / system / find / main.c
blobea00935c9cf58c3e76bef83779624f9de6bdcf02
1 /*
2 Copyright © 2016, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <proto/muimaster.h>
9 #include <proto/intuition.h>
10 #include <proto/utility.h>
11 #include <proto/dos.h>
12 #include <proto/icon.h>
13 #include <proto/alib.h>
15 #include <libraries/mui.h>
16 #include <workbench/startup.h>
18 #include <stdlib.h>
20 #include "findgroup_class.h"
21 #include "locale.h"
23 #define ARGTEMPLATE "PATH,PATTERN,CONTENTS"
25 enum
27 ARG_PATH,
28 ARG_PATTERN,
29 ARG_CONTENTS,
30 ARG_COUNT
33 static void cleanup_exit(CONST_STRPTR str);
35 static Object *app, *win;
36 static struct DiskObject *dobj;
37 static struct RDArgs *rda;
38 static IPTR args[ARG_COUNT];
40 int main(int argc, char **argv)
42 STRPTR path = NULL;
43 STRPTR pattern = NULL;
44 STRPTR contents = NULL;
46 dobj = GetDiskObject("PROGDIR:Find");
48 if (argc) // started from CLI
50 rda = ReadArgs(ARGTEMPLATE, args, NULL);
51 if (!rda)
53 cleanup_exit(_(MSG_ERR_READARGS));
55 path = (STRPTR)args[ARG_PATH];
56 pattern = (STRPTR)args[ARG_PATTERN];
57 contents = (STRPTR)args[ARG_CONTENTS];
60 app = ApplicationObject,
61 MUIA_Application_Author, (IPTR)"The AROS Development Team",
62 MUIA_Application_Base, (IPTR)"FIND",
63 MUIA_Application_Title, __(MSG_APP_TITLE),
64 MUIA_Application_Version, (IPTR)"$VER: Find 1.1 (30.03.2016)",
65 MUIA_Application_Copyright, __(MSG_APP_COPYRIGHT),
66 MUIA_Application_Description, __(MSG_APP_DESCRIPTION),
67 MUIA_Application_DiskObject, (IPTR)dobj,
68 SubWindow, (IPTR)(win = WindowObject,
69 MUIA_Window_Title, __(MSG_WI_TITLE),
70 MUIA_Window_ID, MAKE_ID('F', 'I', 'N', 'D'),
71 WindowContents, (IPTR)(FindGroupObject,
72 MUIA_FindGroup_Path, (IPTR)path,
73 MUIA_FindGroup_Pattern, (IPTR)pattern,
74 MUIA_FindGroup_Contents, (IPTR)contents,
75 End),
76 End),
77 End;
79 if (!app)
80 cleanup_exit(_(MSG_ERR_NO_APPLICATION));
82 DoMethod
84 win, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
85 app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit
88 SET(win, MUIA_Window_Open, TRUE);
89 if (XGET(win, MUIA_Window_Open))
91 DoMethod(app, MUIM_Application_Execute);
93 else
95 MUI_Request(app, NULL, 0, _(MSG_APP_TITLE), _(MSG_OK), _(MSG_ERR_NO_WINDOW));
98 cleanup_exit(NULL);
99 return 0;
103 static void cleanup_exit(CONST_STRPTR str)
105 if (str)
107 struct EasyStruct es =
109 sizeof(struct EasyStruct), 0,
110 _(MSG_ERR), str, _(MSG_OK)
112 EasyRequestArgs(NULL, &es, NULL, NULL);
114 MUI_DisposeObject(app);
116 if (dobj) FreeDiskObject(dobj);
117 if (rda) FreeArgs(rda);
118 exit(0);