Commit 5fd9cfa25e907f025712f22db2702779d9410e86
1 parent
ade002ba
Exists in
master
and in
1 other branch
Fixing windows save dialog.
Showing
3 changed files
with
60 additions
and
22 deletions
Show diff stats
src/dialogs/save/save.c
@@ -100,7 +100,44 @@ | @@ -100,7 +100,44 @@ | ||
100 | gtk_dialog_response(dialog,GTK_RESPONSE_APPLY); | 100 | gtk_dialog_response(dialog,GTK_RESPONSE_APPLY); |
101 | } | 101 | } |
102 | 102 | ||
103 | - static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, V3270SaveDialog *widget) { | 103 | +#ifdef WIN32 |
104 | +static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, V3270SaveDialog *widget) | ||
105 | +{ | ||
106 | + /* | ||
107 | + | ||
108 | + GtkFileChooserNative * dialog = | ||
109 | + gtk_file_chooser_native_new( | ||
110 | + _( "Select destination file"), | ||
111 | + GTK_WINDOW(widget), | ||
112 | + GTK_FILE_CHOOSER_ACTION_SAVE, | ||
113 | + _("Select"), | ||
114 | + _("Cancel") | ||
115 | + ); | ||
116 | + | ||
117 | + gint rc = gtk_native_dialog_run (GTK_NATIVE_DIALOG(dialog)); | ||
118 | + | ||
119 | + debug("rc=%d",rc); | ||
120 | + */ | ||
121 | + | ||
122 | + g_autofree gchar *filename = | ||
123 | + v3270_select_file( | ||
124 | + GTK_WIDGET(widget), | ||
125 | + _( "Select destination file"), | ||
126 | + _("Select"), | ||
127 | + GTK_FILE_CHOOSER_ACTION_SAVE, | ||
128 | + gtk_entry_get_text(GTK_ENTRY(widget->filename)), | ||
129 | + N_("All files"), "*.*", | ||
130 | + NULL | ||
131 | + ); | ||
132 | + | ||
133 | + if(filename && *filename) { | ||
134 | + gtk_entry_set_text(GTK_ENTRY(widget->filename),filename); | ||
135 | + } | ||
136 | + | ||
137 | +} | ||
138 | +#else | ||
139 | +static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, V3270SaveDialog *widget) | ||
140 | +{ | ||
104 | 141 | ||
105 | //gint format = gtk_combo_box_get_active(GTK_COMBO_BOX(widget->format)); | 142 | //gint format = gtk_combo_box_get_active(GTK_COMBO_BOX(widget->format)); |
106 | //g_autofree gchar * extension = g_strconcat("*",formats[format].extension,NULL); | 143 | //g_autofree gchar * extension = g_strconcat("*",formats[format].extension,NULL); |
@@ -118,19 +155,20 @@ | @@ -118,19 +155,20 @@ | ||
118 | gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE); | 155 | gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE); |
119 | g_signal_connect(G_OBJECT(dialog),"close",G_CALLBACK(v3270_dialog_close),NULL); | 156 | g_signal_connect(G_OBJECT(dialog),"close",G_CALLBACK(v3270_dialog_close),NULL); |
120 | 157 | ||
121 | - const gchar *filename = gtk_entry_get_text(GTK_ENTRY(widget->filename)); | 158 | + const gchar *filename = gtk_entry_get_text(GTK_ENTRY(dialog->filename)); |
122 | 159 | ||
123 | if(filename && *filename) | 160 | if(filename && *filename) |
124 | gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),filename); | 161 | gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),filename); |
125 | else | 162 | else |
126 | - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS)); | 163 | + gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), _("Untitled document")); |
127 | 164 | ||
128 | if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | 165 | if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) |
129 | - gtk_entry_set_text(GTK_ENTRY(widget->filename),gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog))); | 166 | + gtk_entry_set_text(GTK_ENTRY(dialog->filename),gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog))); |
130 | 167 | ||
131 | gtk_widget_destroy(dialog); | 168 | gtk_widget_destroy(dialog); |
132 | 169 | ||
133 | } | 170 | } |
171 | +#endif // _WIN32 | ||
134 | 172 | ||
135 | static void V3270SaveDialog_init(V3270SaveDialog *dialog) | 173 | static void V3270SaveDialog_init(V3270SaveDialog *dialog) |
136 | { | 174 | { |
@@ -168,18 +206,16 @@ | @@ -168,18 +206,16 @@ | ||
168 | gtk_grid_attach(grid,widget,0,0,1,1); | 206 | gtk_grid_attach(grid,widget,0,0,1,1); |
169 | gtk_label_set_mnemonic_widget(GTK_LABEL(widget),dialog->filename); | 207 | gtk_label_set_mnemonic_widget(GTK_LABEL(widget),dialog->filename); |
170 | 208 | ||
171 | -/* | ||
172 | -#ifdef WIN32 | ||
173 | - widget = gtk_button_new_from_icon_name("document-open",GTK_ICON_SIZE_BUTTON); | ||
174 | - g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(select_local_file),dialog); | ||
175 | - gtk_grid_attach(grid,widget,4,0,1,1); | ||
176 | -#else | ||
177 | -*/ | 209 | +//#ifdef WIN32 |
210 | +// widget = gtk_button_new_from_icon_name("document-open",GTK_ICON_SIZE_BUTTON); | ||
211 | +// g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(select_file),dialog); | ||
212 | +// gtk_grid_attach(grid,widget,4,0,1,1); | ||
213 | +//#else | ||
178 | gtk_entry_set_icon_from_icon_name(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,"document-open"); | 214 | gtk_entry_set_icon_from_icon_name(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,"document-open"); |
179 | gtk_entry_set_icon_activatable(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,TRUE); | 215 | gtk_entry_set_icon_activatable(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,TRUE); |
180 | gtk_entry_set_icon_tooltip_text(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,_("Select file")); | 216 | gtk_entry_set_icon_tooltip_text(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,_("Select file")); |
181 | g_signal_connect(G_OBJECT(dialog->filename),"icon-press",G_CALLBACK(icon_press),dialog); | 217 | g_signal_connect(G_OBJECT(dialog->filename),"icon-press",G_CALLBACK(icon_press),dialog); |
182 | -// #endif // WIN32 | 218 | +//#endif // WIN32 |
183 | 219 | ||
184 | gtk_entry_set_width_chars(GTK_ENTRY(dialog->filename),60); | 220 | gtk_entry_set_width_chars(GTK_ENTRY(dialog->filename),60); |
185 | gtk_entry_set_max_length(GTK_ENTRY(dialog->filename),PATH_MAX); | 221 | gtk_entry_set_max_length(GTK_ENTRY(dialog->filename),PATH_MAX); |
src/dialogs/windows/select.c
@@ -165,6 +165,8 @@ gchar * v3270_select_file(GtkWidget *widget, const gchar *title, const gchar *bu | @@ -165,6 +165,8 @@ gchar * v3270_select_file(GtkWidget *widget, const gchar *title, const gchar *bu | ||
165 | 165 | ||
166 | if(filename && *filename) | 166 | if(filename && *filename) |
167 | gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(chooser),filename); | 167 | gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(chooser),filename); |
168 | + else | ||
169 | + gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(chooser), _("Untitled document")); | ||
168 | 170 | ||
169 | // Setup filters | 171 | // Setup filters |
170 | /* | 172 | /* |
src/filetransfer/v3270ft.c
@@ -293,11 +293,11 @@ static gboolean spin_format(GtkSpinButton *spin, G_GNUC_UNUSED gpointer data) { | @@ -293,11 +293,11 @@ static gboolean spin_format(GtkSpinButton *spin, G_GNUC_UNUSED gpointer data) { | ||
293 | return TRUE; | 293 | return TRUE; |
294 | } | 294 | } |
295 | 295 | ||
296 | -#ifdef WIN32 | ||
297 | -static void select_local_file(GtkButton G_GNUC_UNUSED(*button), v3270ft *dialog) { | ||
298 | -#else | 296 | +//#ifdef WIN32 |
297 | +//static void select_local_file(GtkButton G_GNUC_UNUSED(*button), v3270ft *dialog) { | ||
298 | +//#else | ||
299 | static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, v3270ft *dialog) { | 299 | static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, v3270ft *dialog) { |
300 | -#endif // WIN32 | 300 | +//#endif // WIN32 |
301 | 301 | ||
302 | debug("%s",__FUNCTION__); | 302 | debug("%s",__FUNCTION__); |
303 | 303 | ||
@@ -567,16 +567,16 @@ static void v3270ft_init(v3270ft *dialog) { | @@ -567,16 +567,16 @@ static void v3270ft_init(v3270ft *dialog) { | ||
567 | 567 | ||
568 | gtk_widget_set_hexpand(GTK_WIDGET(dialog->local),TRUE); | 568 | gtk_widget_set_hexpand(GTK_WIDGET(dialog->local),TRUE); |
569 | 569 | ||
570 | -#ifdef WIN32 | ||
571 | - widget = gtk_button_new_from_icon_name("document-open",GTK_ICON_SIZE_BUTTON); | ||
572 | - g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(select_local_file),dialog); | ||
573 | - gtk_grid_attach(grid,widget,2,1,1,1); | ||
574 | -#else | 570 | +//#ifdef WIN32 |
571 | +// widget = gtk_button_new_from_icon_name("document-open",GTK_ICON_SIZE_BUTTON); | ||
572 | +// g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(select_local_file),dialog); | ||
573 | +// gtk_grid_attach(grid,widget,2,1,1,1); | ||
574 | +//#else | ||
575 | gtk_entry_set_icon_from_icon_name(dialog->local,GTK_ENTRY_ICON_SECONDARY,"document-open"); | 575 | gtk_entry_set_icon_from_icon_name(dialog->local,GTK_ENTRY_ICON_SECONDARY,"document-open"); |
576 | gtk_entry_set_icon_activatable(dialog->local,GTK_ENTRY_ICON_SECONDARY,TRUE); | 576 | gtk_entry_set_icon_activatable(dialog->local,GTK_ENTRY_ICON_SECONDARY,TRUE); |
577 | gtk_entry_set_icon_tooltip_text(dialog->local,GTK_ENTRY_ICON_SECONDARY,_("Select file")); | 577 | gtk_entry_set_icon_tooltip_text(dialog->local,GTK_ENTRY_ICON_SECONDARY,_("Select file")); |
578 | g_signal_connect(G_OBJECT(dialog->local),"icon-press",G_CALLBACK(icon_press),dialog); | 578 | g_signal_connect(G_OBJECT(dialog->local),"icon-press",G_CALLBACK(icon_press),dialog); |
579 | -#endif // WIN32 | 579 | +//#endif // WIN32 |
580 | 580 | ||
581 | g_signal_connect(G_OBJECT(dialog->local),"changed",G_CALLBACK(local_file_changed),dialog); | 581 | g_signal_connect(G_OBJECT(dialog->local),"changed",G_CALLBACK(local_file_changed),dialog); |
582 | 582 |