MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Window_SaveFileDialog

Function Window_SaveFileDialog

src/Window_X11.c:1199–1220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1197}
1198
1199cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
1200 const char* const* titles = args->titles;
1201 const char* const* fileExts = args->filters;
1202 cc_string path; char pathBuffer[1024];
1203 int i;
1204
1205 String_InitArray_NT(path, pathBuffer);
1206 String_AppendConst(&path, "zenity --file-selection");
1207 for (i = 0; fileExts[i]; i++)
1208 {
1209 String_Format3(&path, " --file-filter='%c (*%c) | *%c'", titles[i], fileExts[i], fileExts[i]);
1210 }
1211 String_AppendConst(&path, " --save --confirm-overwrite");
1212
1213 /* TODO: Utf8 encode filename */
1214 if (args->defaultName.length) {
1215 String_Format1(&path, " --filename='%s'", &args->defaultName);
1216 }
1217
1218 path.buffer[path.length] = '\0';
1219 return OpenSaveFileDialog(path.buffer, args->Callback, fileExts[0]);
1220}
1221
1222static GC fb_gc;
1223static XImage* fb_image;

Callers

nothing calls this directly

Calls 4

String_AppendConstFunction · 0.85
String_Format3Function · 0.85
String_Format1Function · 0.85
OpenSaveFileDialogFunction · 0.70

Tested by

no test coverage detected