implement ui_savefiledialog name parameter (GTK) newapi

Sun, 29 Sep 2024 19:01:47 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 29 Sep 2024 19:01:47 +0200
branch
newapi
changeset 317
b30415965ec3
parent 316
e15ff2183b43
child 318
8d8a31d55dd5

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) {

mercurial