Sun, 29 Sep 2024 19:01:47 +0200
implement ui_savefiledialog name parameter (GTK)
application/main.c | file | annotate | diff | comparison | revisions | |
ui/gtk/window.c | file | annotate | diff | comparison | revisions |
--- a/application/main.c Sun Sep 29 18:56:26 2024 +0200 +++ b/application/main.c Sun Sep 29 19:01:47 2024 +0200 @@ -60,7 +60,7 @@ } void action_button(UiEvent *event, void *userdata) { - ui_openfiledialog(event->obj, 0, action_file_selected, NULL); + ui_savefiledialog(event->obj, "myfile.txt", action_file_selected, NULL); } void action_switch(UiEvent *event, void *userdata) {
--- a/ui/gtk/window.c Sun Sep 29 18:56:26 2024 +0200 +++ b/ui/gtk/window.c Sun Sep 29 19:01:47 2024 +0200 @@ -358,6 +358,9 @@ GtkWindow *parent = GTK_WINDOW(gtk_widget_get_root(obj->widget)); GtkFileDialog *dialog = gtk_file_dialog_new(); + if(name) { + gtk_file_dialog_set_initial_name(dialog, name); + } int multi = mode & UI_FILEDIALOG_SELECT_MULTI; if((mode & UI_FILEDIALOG_SELECT_FOLDER) == UI_FILEDIALOG_SELECT_FOLDER) {