Commit a59301e90863983cdcff38d4da6f1d61c1c91f86

Authored by Perry Werneck
1 parent 63f1469f
Exists in master and in 1 other branch develop

Fixing windows build.

src/dialogs/save/save.c
@@ -100,34 +100,7 @@ @@ -100,34 +100,7 @@
100 gtk_dialog_response(dialog,GTK_RESPONSE_APPLY); 100 gtk_dialog_response(dialog,GTK_RESPONSE_APPLY);
101 } 101 }
102 102
103 - /*  
104 - static GtkFileChooserConfirmation confirm_overwrite(GtkFileChooser *chooser, V3270SaveDialog G_GNUC_UNUSED(*widget))  
105 - {  
106 - GtkFileChooserConfirmation ret = GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME;  
107 -  
108 - GtkWidget * dialog = gtk_message_dialog_new_with_markup(  
109 - GTK_WINDOW(chooser),  
110 - GTK_DIALOG_DESTROY_WITH_PARENT,  
111 - GTK_MESSAGE_QUESTION,GTK_BUTTONS_OK_CANCEL,  
112 - "%s",_("The file already exists. Replace it?")  
113 - );  
114 -  
115 -  
116 - if(gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_OK)  
117 - ret = GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN;  
118 -  
119 - gtk_widget_destroy(dialog);  
120 -  
121 - return ret;  
122 -  
123 - }  
124 - */  
125 -  
126 -#ifdef WIN32  
127 -static void select_local_file(GtkButton G_GNUC_UNUSED(*button), V3270SaveDialog *widget) {  
128 -#else  
129 -static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, V3270SaveDialog *widget) {  
130 -#endif // WIN32 103 + static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, V3270SaveDialog *widget) {
131 104
132 //gint format = gtk_combo_box_get_active(GTK_COMBO_BOX(widget->format)); 105 //gint format = gtk_combo_box_get_active(GTK_COMBO_BOX(widget->format));
133 //g_autofree gchar * extension = g_strconcat("*",formats[format].extension,NULL); 106 //g_autofree gchar * extension = g_strconcat("*",formats[format].extension,NULL);
@@ -142,6 +115,9 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon @@ -142,6 +115,9 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon
142 NULL ); 115 NULL );
143 116
144 117
  118 + gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE);
  119 + g_signal_connect(G_OBJECT(dialog),"close",G_CALLBACK(v3270_dialog_close),NULL);
  120 +
145 const gchar *filename = gtk_entry_get_text(GTK_ENTRY(widget->filename)); 121 const gchar *filename = gtk_entry_get_text(GTK_ENTRY(widget->filename));
146 122
147 if(filename && *filename) 123 if(filename && *filename)
@@ -154,10 +130,8 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon @@ -154,10 +130,8 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon
154 130
155 gtk_widget_destroy(dialog); 131 gtk_widget_destroy(dialog);
156 132
157 -  
158 } 133 }
159 134
160 -  
161 static void V3270SaveDialog_init(V3270SaveDialog *dialog) 135 static void V3270SaveDialog_init(V3270SaveDialog *dialog)
162 { 136 {
163 // 0--------1---------------------2-------3--------------------4 137 // 0--------1---------------------2-------3--------------------4
@@ -194,16 +168,18 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon @@ -194,16 +168,18 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon
194 gtk_grid_attach(grid,widget,0,0,1,1); 168 gtk_grid_attach(grid,widget,0,0,1,1);
195 gtk_label_set_mnemonic_widget(GTK_LABEL(widget),dialog->filename); 169 gtk_label_set_mnemonic_widget(GTK_LABEL(widget),dialog->filename);
196 170
  171 +/*
197 #ifdef WIN32 172 #ifdef WIN32
198 widget = gtk_button_new_from_icon_name("document-open",GTK_ICON_SIZE_BUTTON); 173 widget = gtk_button_new_from_icon_name("document-open",GTK_ICON_SIZE_BUTTON);
199 g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(select_local_file),dialog); 174 g_signal_connect(G_OBJECT(widget),"clicked",G_CALLBACK(select_local_file),dialog);
200 gtk_grid_attach(grid,widget,4,0,1,1); 175 gtk_grid_attach(grid,widget,4,0,1,1);
201 #else 176 #else
  177 +*/
202 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,"document-open"); 178 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,"document-open");
203 gtk_entry_set_icon_activatable(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,TRUE); 179 gtk_entry_set_icon_activatable(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,TRUE);
204 gtk_entry_set_icon_tooltip_text(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,_("Select file")); 180 gtk_entry_set_icon_tooltip_text(GTK_ENTRY(dialog->filename),GTK_ENTRY_ICON_SECONDARY,_("Select file"));
205 g_signal_connect(G_OBJECT(dialog->filename),"icon-press",G_CALLBACK(icon_press),dialog); 181 g_signal_connect(G_OBJECT(dialog->filename),"icon-press",G_CALLBACK(icon_press),dialog);
206 -#endif // WIN32 182 +// #endif // WIN32
207 183
208 gtk_entry_set_width_chars(GTK_ENTRY(dialog->filename),60); 184 gtk_entry_set_width_chars(GTK_ENTRY(dialog->filename),60);
209 gtk_entry_set_max_length(GTK_ENTRY(dialog->filename),PATH_MAX); 185 gtk_entry_set_max_length(GTK_ENTRY(dialog->filename),PATH_MAX);
@@ -261,6 +237,7 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon @@ -261,6 +237,7 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon
261 gtk_grid_attach(grid,widget,2,1,1,1); 237 gtk_grid_attach(grid,widget,2,1,1,1);
262 238
263 dialog->format = gtk_combo_box_text_new(); 239 dialog->format = gtk_combo_box_text_new();
  240 +
264 gtk_grid_attach(grid,dialog->format,3,1,1,1); 241 gtk_grid_attach(grid,dialog->format,3,1,1,1);
265 242
266 for(ix=0;ix<G_N_ELEMENTS(formats);ix++) 243 for(ix=0;ix<G_N_ELEMENTS(formats);ix++)
@@ -280,7 +257,9 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon @@ -280,7 +257,9 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon
280 257
281 // Buttons 258 // Buttons
282 // https://developer.gnome.org/icon-naming-spec/ 259 // https://developer.gnome.org/icon-naming-spec/
283 -#if GTK_CHECK_VERSION(3,14,0) 260 +#ifdef _WIN32
  261 + widget = NULL;
  262 +#elif GTK_CHECK_VERSION(3,14,0)
284 widget = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); 263 widget = gtk_dialog_get_header_bar(GTK_DIALOG(dialog));
285 #else 264 #else
286 widget = NULL; 265 widget = NULL;
@@ -301,6 +280,11 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon @@ -301,6 +280,11 @@ static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIcon
301 } 280 }
302 else 281 else
303 { 282 {
  283 + gtk_box_set_spacing(
  284 + GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
  285 + 18
  286 + );
  287 +
304 gtk_dialog_add_buttons( 288 gtk_dialog_add_buttons(
305 GTK_DIALOG (dialog), 289 GTK_DIALOG (dialog),
306 _("_Cancel"), GTK_RESPONSE_CANCEL, 290 _("_Cancel"), GTK_RESPONSE_CANCEL,
src/dialogs/tools.c
@@ -99,6 +99,12 @@ @@ -99,6 +99,12 @@
99 99
100 } 100 }
101 101
  102 + void v3270_dialog_close(GtkDialog *dialog, gpointer G_GNUC_UNUSED(user_data) )
  103 + {
  104 + debug("%s",__FUNCTION__);
  105 + gtk_dialog_response(dialog,GTK_RESPONSE_CANCEL);
  106 + }
  107 +
102 #if ! GLIB_CHECK_VERSION(2,44,0) 108 #if ! GLIB_CHECK_VERSION(2,44,0)
103 109
104 // Reference: https://github.com/ImageMagick/glib/blob/master/glib/glib-autocleanups.h 110 // Reference: https://github.com/ImageMagick/glib/blob/master/glib/glib-autocleanups.h
src/dialogs/windows/select.c
@@ -29,6 +29,7 @@ @@ -29,6 +29,7 @@
29 */ 29 */
30 30
31 #include "../private.h" 31 #include "../private.h"
  32 +#include <internals.h>
32 #include <stdarg.h> 33 #include <stdarg.h>
33 #include <gdk/gdkwin32.h> 34 #include <gdk/gdkwin32.h>
34 #include <lib3270/log.h> 35 #include <lib3270/log.h>
@@ -159,6 +160,9 @@ gchar * v3270_select_file(GtkWidget *widget, const gchar *title, const gchar *bu @@ -159,6 +160,9 @@ gchar * v3270_select_file(GtkWidget *widget, const gchar *title, const gchar *bu
159 NULL 160 NULL
160 ); 161 );
161 162
  163 + gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE);
  164 + g_signal_connect(G_OBJECT(chooser),"close",G_CALLBACK(v3270_dialog_close),NULL);
  165 +
162 if(filename && *filename) 166 if(filename && *filename)
163 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(chooser),filename); 167 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(chooser),filename);
164 168
src/include/internals.h
@@ -105,6 +105,9 @@ @@ -105,6 +105,9 @@
105 G_GNUC_INTERNAL GtkWidget * v3270_dialog_create_grid(GtkAlign align); 105 G_GNUC_INTERNAL GtkWidget * v3270_dialog_create_grid(GtkAlign align);
106 G_GNUC_INTERNAL GtkWidget * v3270_dialog_create_frame(GtkWidget * child, const gchar *title); 106 G_GNUC_INTERNAL GtkWidget * v3270_dialog_create_frame(GtkWidget * child, const gchar *title);
107 107
  108 + G_GNUC_INTERNAL void v3270_dialog_close(GtkDialog *dialog, gpointer user_data);
  109 +
  110 +
108 #if GTK_CHECK_VERSION(3,12,0) 111 #if GTK_CHECK_VERSION(3,12,0)
109 G_GNUC_INTERNAL GtkHeaderBar * v3270_dialog_get_header_bar(GtkWidget * widget); 112 G_GNUC_INTERNAL GtkHeaderBar * v3270_dialog_get_header_bar(GtkWidget * widget);
110 G_GNUC_INTERNAL void v3270_dialog_cancel(GtkButton G_GNUC_UNUSED(*button), GtkWidget *dialog); 113 G_GNUC_INTERNAL void v3270_dialog_cancel(GtkButton G_GNUC_UNUSED(*button), GtkWidget *dialog);
src/selection/windows/copy.c
@@ -57,14 +57,14 @@ static void clipboard_get(G_GNUC_UNUSED GtkClipboard *clipboard, GtkSelectionDa @@ -57,14 +57,14 @@ static void clipboard_get(G_GNUC_UNUSED GtkClipboard *clipboard, GtkSelectionDa
57 { 57 {
58 case CLIPBOARD_TYPE_TEXT: // Get clipboard contents as text 58 case CLIPBOARD_TYPE_TEXT: // Get clipboard contents as text
59 { 59 {
60 - g_autofree gchar *text = v3270_get_copy_as_text(terminal); 60 + g_autofree gchar *text = v3270_get_copy_as_text(terminal,"UTF-8");
61 gtk_selection_data_set_text(selection,text,-1); 61 gtk_selection_data_set_text(selection,text,-1);
62 } 62 }
63 break; 63 break;
64 64
65 case CLIPBOARD_TYPE_CSV: 65 case CLIPBOARD_TYPE_CSV:
66 { 66 {
67 - g_autofree gchar *text = v3270_get_copy_as_table(terminal,";"); 67 + g_autofree gchar *text = v3270_get_copy_as_table(terminal,";","UTF-8");
68 debug("Selection:\n%s",text); 68 debug("Selection:\n%s",text);
69 gtk_selection_data_set( 69 gtk_selection_data_set(
70 selection, 70 selection,
@@ -78,7 +78,7 @@ static void clipboard_get(G_GNUC_UNUSED GtkClipboard *clipboard, GtkSelectionDa @@ -78,7 +78,7 @@ static void clipboard_get(G_GNUC_UNUSED GtkClipboard *clipboard, GtkSelectionDa
78 78
79 case CLIPBOARD_TYPE_HTML: 79 case CLIPBOARD_TYPE_HTML:
80 { 80 {
81 - g_autofree gchar *text = v3270_get_copy_as_html(terminal); 81 + g_autofree gchar *text = v3270_get_copy_as_html(terminal,"UTF-8");
82 //debug("Selection:\n%s",text); 82 //debug("Selection:\n%s",text);
83 gtk_selection_data_set( 83 gtk_selection_data_set(
84 selection, 84 selection,