Commit 5a112412779b537b4f14dd12dd9632b74df064dd
1 parent
e2eff006
Exists in
master
and in
2 other branches
Cant disable top menu and save shortcut in apple platform.
Showing
8 changed files
with
38 additions
and
362 deletions
Show diff stats
pw3270.cbp
@@ -136,6 +136,12 @@ | @@ -136,6 +136,12 @@ | ||
136 | <Unit filename="src/objects/os/linux/savedesktopicon.c"> | 136 | <Unit filename="src/objects/os/linux/savedesktopicon.c"> |
137 | <Option compilerVar="CC" /> | 137 | <Option compilerVar="CC" /> |
138 | </Unit> | 138 | </Unit> |
139 | + <Unit filename="src/objects/os/macos/open.c"> | ||
140 | + <Option compilerVar="CC" /> | ||
141 | + </Unit> | ||
142 | + <Unit filename="src/objects/os/macos/savedesktopicon.c"> | ||
143 | + <Option compilerVar="CC" /> | ||
144 | + </Unit> | ||
139 | <Unit filename="src/objects/os/windows/open.c"> | 145 | <Unit filename="src/objects/os/windows/open.c"> |
140 | <Option compilerVar="CC" /> | 146 | <Option compilerVar="CC" /> |
141 | </Unit> | 147 | </Unit> |
schemas/macos/window.gschema.xml.in
@@ -68,12 +68,6 @@ | @@ -68,12 +68,6 @@ | ||
68 | <description></description> | 68 | <description></description> |
69 | </key> | 69 | </key> |
70 | 70 | ||
71 | - <key name="menubar-visible" type="b"> | ||
72 | - <default>false</default> | ||
73 | - <summary>The menubar visible state</summary> | ||
74 | - <description></description> | ||
75 | - </key> | ||
76 | - | ||
77 | <key name="toolbar-style" type="i"> | 71 | <key name="toolbar-style" type="i"> |
78 | <default>-1</default> | 72 | <default>-1</default> |
79 | <summary>How to draw the toolbar.</summary> | 73 | <summary>How to draw the toolbar.</summary> |
src/objects/application/application.c
@@ -204,13 +204,17 @@ static gboolean on_user_interface(const gchar G_GNUC_UNUSED(*option), const gcha | @@ -204,13 +204,17 @@ static gboolean on_user_interface(const gchar G_GNUC_UNUSED(*option), const gcha | ||
204 | 204 | ||
205 | g_settings_set_uint(app_settings,"ui-style",PW3270_UI_STYLE_GNOME); | 205 | g_settings_set_uint(app_settings,"ui-style",PW3270_UI_STYLE_GNOME); |
206 | g_settings_set_boolean(win_settings,"toolbar-visible",TRUE); | 206 | g_settings_set_boolean(win_settings,"toolbar-visible",TRUE); |
207 | +#ifndef __APPLE__ | ||
207 | g_settings_set_boolean(win_settings,"menubar-visible",FALSE); | 208 | g_settings_set_boolean(win_settings,"menubar-visible",FALSE); |
209 | +#endif // __APPLE__ | ||
208 | 210 | ||
209 | } else if(!g_ascii_strcasecmp(value,"classic")) { | 211 | } else if(!g_ascii_strcasecmp(value,"classic")) { |
210 | 212 | ||
211 | g_settings_set_uint(app_settings,"ui-style",PW3270_UI_STYLE_CLASSICAL); | 213 | g_settings_set_uint(app_settings,"ui-style",PW3270_UI_STYLE_CLASSICAL); |
212 | g_settings_set_boolean(win_settings,"toolbar-visible",TRUE); | 214 | g_settings_set_boolean(win_settings,"toolbar-visible",TRUE); |
215 | +#ifndef __APPLE__ | ||
213 | g_settings_set_boolean(win_settings,"menubar-visible",TRUE); | 216 | g_settings_set_boolean(win_settings,"menubar-visible",TRUE); |
217 | +#endif // __APPLE__ | ||
214 | 218 | ||
215 | } else if(!g_ascii_strcasecmp(value,"default")) { | 219 | } else if(!g_ascii_strcasecmp(value,"default")) { |
216 | 220 |
src/objects/os/linux/savedesktopicon.c
@@ -105,7 +105,7 @@ static const struct _entry { | @@ -105,7 +105,7 @@ static const struct _entry { | ||
105 | 105 | ||
106 | }; | 106 | }; |
107 | 107 | ||
108 | -GAction * pw3270_action_save_desktop_icon_new(void) { | 108 | +GAction * pw3270_action_save_session_shortcut_new(void) { |
109 | 109 | ||
110 | V3270SimpleAction * action = v3270_dialog_action_new(factory); | 110 | V3270SimpleAction * action = v3270_dialog_action_new(factory); |
111 | 111 | ||
@@ -117,40 +117,6 @@ GAction * pw3270_action_save_desktop_icon_new(void) { | @@ -117,40 +117,6 @@ GAction * pw3270_action_save_desktop_icon_new(void) { | ||
117 | 117 | ||
118 | } | 118 | } |
119 | 119 | ||
120 | -/* | ||
121 | -static gchar * get_filename(GtkWidget *terminal) { | ||
122 | - | ||
123 | - g_autofree gchar * defname = v3270_keyfile_get_default_filename(); | ||
124 | -const gchar * current = v3270_key_file_get_filename(terminal); | ||
125 | - | ||
126 | -// If is not the default name, return it. | ||
127 | -if(strcmp(defname,current)) { | ||
128 | - return g_strdup(current); | ||
129 | -} | ||
130 | - | ||
131 | -// It's the default one, create a new one on the user_config dir | ||
132 | -g_autofree gchar * config_path = v3270_key_file_get_default_path(terminal); | ||
133 | - | ||
134 | -// Use the hostname | ||
135 | -const char * hostname = lib3270_host_get_name(v3270_get_session(terminal)); | ||
136 | -if(!hostname) { | ||
137 | - hostname = G_STRINGIFY(PRODUCT_NAME); | ||
138 | -} | ||
139 | - | ||
140 | -// Build the filename | ||
141 | -gchar *filename = g_strconcat(config_path,G_DIR_SEPARATOR_S,hostname,".3270",NULL); | ||
142 | - | ||
143 | -unsigned int index = 0; | ||
144 | -while(g_file_test(filename,G_FILE_TEST_EXISTS)) { | ||
145 | - g_free(filename); | ||
146 | - filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s.%u.3270",config_path,hostname,++index); | ||
147 | -} | ||
148 | - | ||
149 | -return filename; | ||
150 | - | ||
151 | -} | ||
152 | -*/ | ||
153 | - | ||
154 | GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal) { | 120 | GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal) { |
155 | 121 | ||
156 | size_t ix; | 122 | size_t ix; |
src/objects/os/macos/savedesktopicon.c
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | /** | 30 | /** |
31 | - * @brief Implement Linux version of the save desktop icon action. | 31 | + * @brief Implement MacOS version of the save desktop icon action. |
32 | * | 32 | * |
33 | */ | 33 | */ |
34 | 34 | ||
@@ -44,68 +44,8 @@ | @@ -44,68 +44,8 @@ | ||
44 | #include <v3270/tools.h> | 44 | #include <v3270/tools.h> |
45 | 45 | ||
46 | static GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal); | 46 | static GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal); |
47 | -static void response(GtkWidget *dialog, gint response_id, GtkWidget *terminal); | ||
48 | 47 | ||
49 | -static const struct _entry { | ||
50 | - | ||
51 | - const gchar * key; | ||
52 | - const gchar * label; | ||
53 | - const gchar * tooltip; | ||
54 | - const gchar * default_value; | ||
55 | - gint margin_top; | ||
56 | - gint width; | ||
57 | - | ||
58 | -} entries[] = { | ||
59 | - | ||
60 | - // 0 = Shortcut name | ||
61 | - { | ||
62 | - .key = "Name", | ||
63 | - .label = N_("Shortcut name"), | ||
64 | - .default_value = G_STRINGIFY(PRODUCT_NAME), | ||
65 | - .width = 20, | ||
66 | - }, | ||
67 | - | ||
68 | - // 1 = Shortcut file | ||
69 | - { | ||
70 | - .label = N_("Shortcut file"), | ||
71 | - .tooltip = N_("Path for the new shortcut"), | ||
72 | - .width = 40, | ||
73 | - }, | ||
74 | - | ||
75 | - // 2 = Session name | ||
76 | - { | ||
77 | - .label = N_("Session name"), | ||
78 | - .margin_top = 12, | ||
79 | - .tooltip = N_("The session name used in the window/tab title (empty for default)"), | ||
80 | - .width = 15, | ||
81 | - }, | ||
82 | - | ||
83 | - // 3 = Session file | ||
84 | - { | ||
85 | - .label = N_("Session file"), | ||
86 | - .tooltip = N_("The file with the session preferences for this shortcut"), | ||
87 | - .width = 40, | ||
88 | - }, | ||
89 | - | ||
90 | - // 4 = Generic name. | ||
91 | - { | ||
92 | - .key = "GenericName", | ||
93 | - .margin_top = 12, | ||
94 | - .label = N_("Generic name"), | ||
95 | - .default_value = G_STRINGIFY(PRODUCT_NAME), | ||
96 | - .width = 20, | ||
97 | - }, | ||
98 | - | ||
99 | - { | ||
100 | - .key = "Comment", | ||
101 | - .label = N_("Comment"), | ||
102 | - .default_value = N_("IBM 3270 Terminal emulator"), | ||
103 | - .width = 30, | ||
104 | - } | ||
105 | - | ||
106 | -}; | ||
107 | - | ||
108 | -GAction * pw3270_action_save_desktop_icon_new(void) { | 48 | +GAction * pw3270_action_save_session_shortcut_new(void) { |
109 | 49 | ||
110 | V3270SimpleAction * action = v3270_dialog_action_new(factory); | 50 | V3270SimpleAction * action = v3270_dialog_action_new(factory); |
111 | 51 | ||
@@ -117,262 +57,24 @@ GAction * pw3270_action_save_desktop_icon_new(void) { | @@ -117,262 +57,24 @@ GAction * pw3270_action_save_desktop_icon_new(void) { | ||
117 | 57 | ||
118 | } | 58 | } |
119 | 59 | ||
120 | -/* | ||
121 | -static gchar * get_filename(GtkWidget *terminal) { | ||
122 | - | ||
123 | - g_autofree gchar * defname = v3270_keyfile_get_default_filename(); | ||
124 | -const gchar * current = v3270_key_file_get_filename(terminal); | ||
125 | - | ||
126 | -// If is not the default name, return it. | ||
127 | -if(strcmp(defname,current)) { | ||
128 | - return g_strdup(current); | ||
129 | -} | ||
130 | - | ||
131 | -// It's the default one, create a new one on the user_config dir | ||
132 | -g_autofree gchar * config_path = v3270_key_file_get_default_path(terminal); | ||
133 | - | ||
134 | -// Use the hostname | ||
135 | -const char * hostname = lib3270_host_get_name(v3270_get_session(terminal)); | ||
136 | -if(!hostname) { | ||
137 | - hostname = G_STRINGIFY(PRODUCT_NAME); | ||
138 | -} | ||
139 | - | ||
140 | -// Build the filename | ||
141 | -gchar *filename = g_strconcat(config_path,G_DIR_SEPARATOR_S,hostname,".3270",NULL); | ||
142 | - | ||
143 | -unsigned int index = 0; | ||
144 | -while(g_file_test(filename,G_FILE_TEST_EXISTS)) { | ||
145 | - g_free(filename); | ||
146 | - filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s.%u.3270",config_path,hostname,++index); | ||
147 | -} | ||
148 | - | ||
149 | -return filename; | ||
150 | - | ||
151 | -} | ||
152 | -*/ | ||
153 | - | ||
154 | GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal) { | 60 | GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal) { |
155 | 61 | ||
156 | - size_t ix; | ||
157 | - | ||
158 | - gboolean use_header; | ||
159 | - g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &use_header, NULL); | ||
160 | - | ||
161 | - GtkWidget * dialog = | ||
162 | - GTK_WIDGET(g_object_new( | ||
163 | - GTK_TYPE_DIALOG, | ||
164 | - "use-header-bar", (use_header ? 1 : 0), | ||
165 | - NULL | ||
166 | - )); | ||
167 | - | ||
168 | - | ||
169 | - gtk_window_set_modal(GTK_WINDOW(dialog),TRUE); | ||
170 | - gtk_window_set_title(GTK_WINDOW(dialog),action->label); | ||
171 | - | ||
172 | - gtk_dialog_add_buttons( | ||
173 | - GTK_DIALOG(dialog), | ||
174 | - _("_Cancel"), GTK_RESPONSE_CANCEL, | ||
175 | - _("_Save"), GTK_RESPONSE_APPLY, | ||
176 | - NULL | ||
177 | - ); | ||
178 | - | ||
179 | - g_signal_connect(dialog,"response",G_CALLBACK(response),terminal); | ||
180 | - | ||
181 | - // Create entry fields | ||
182 | - GtkWidget ** inputs = g_new0(GtkWidget *,G_N_ELEMENTS(entries)); | ||
183 | - g_object_set_data_full(G_OBJECT(dialog),"inputs",inputs,g_free); | ||
184 | - debug("Dialog=%p inputs=%p",dialog,inputs); | ||
185 | - | ||
186 | - GtkGrid * grid = GTK_GRID(gtk_grid_new()); | ||
187 | - | ||
188 | - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),GTK_WIDGET(grid),TRUE,TRUE,0); | ||
189 | - | ||
190 | - // https://developer.gnome.org/hig/stable/visual-layout.html.en | ||
191 | - gtk_container_set_border_width(GTK_CONTAINER(grid),18); | ||
192 | - gtk_grid_set_row_spacing(GTK_GRID(grid),6); | ||
193 | - gtk_grid_set_column_spacing(GTK_GRID(grid),12); | ||
194 | - | ||
195 | - // https://developer.gnome.org/hig/stable/visual-layout.html.en | ||
196 | - // gtk_box_set_spacing(GTK_BOX(content_area),18); | ||
197 | - | ||
198 | - for(ix = 0; ix < G_N_ELEMENTS(entries); ix++) { | ||
199 | - | ||
200 | - GtkWidget * label = gtk_label_new(gettext(entries[ix].label)); | ||
201 | - gtk_label_set_xalign(GTK_LABEL(label),1); | ||
202 | - gtk_grid_attach(grid,label,0,ix,1,1); | ||
203 | - | ||
204 | - inputs[ix] = gtk_entry_new(); | ||
205 | - debug("inputs[%u]=%p",(unsigned int) ix, inputs[ix]); | ||
206 | - | ||
207 | - if(entries[ix].margin_top) { | ||
208 | - gtk_widget_set_margin_top(label,entries[ix].margin_top); | ||
209 | - gtk_widget_set_margin_top(inputs[ix],entries[ix].margin_top); | ||
210 | - } | ||
211 | - | ||
212 | - if(entries[ix].default_value) { | ||
213 | - gtk_entry_set_text(GTK_ENTRY(inputs[ix]),gettext(entries[ix].default_value)); | ||
214 | - } | ||
215 | - | ||
216 | - if(entries[ix].tooltip) { | ||
217 | - gtk_widget_set_tooltip_markup(GTK_WIDGET(inputs[ix]),gettext(entries[ix].tooltip)); | ||
218 | - } | ||
219 | - | ||
220 | - gtk_entry_set_width_chars(GTK_ENTRY(inputs[ix]),entries[ix].width); | ||
221 | - gtk_widget_set_hexpand(inputs[ix],FALSE); | ||
222 | - gtk_widget_set_vexpand(inputs[ix],FALSE); | ||
223 | - | ||
224 | - gtk_grid_attach(grid,inputs[ix],1,ix,entries[ix].width,1); | ||
225 | - | ||
226 | - } | ||
227 | - | ||
228 | - g_autofree gchar * filename = g_strdup_printf("%s/" G_STRINGIFY(PRODUCT_NAME) ".desktop",g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP)); | ||
229 | - | ||
230 | - // 1 = Shortcut filename | ||
231 | - { | ||
232 | - gtk_entry_set_text(GTK_ENTRY(inputs[1]),filename); | ||
233 | - gtk_entry_bind_to_filechooser( | ||
234 | - inputs[1], | ||
235 | - GTK_FILE_CHOOSER_ACTION_SAVE, | ||
236 | - _("Save to shortcut file"), | ||
237 | - NULL, | ||
238 | - "*.desktop", | ||
239 | - _("Standard desktop files") | 62 | + GtkWidget * dialog = |
63 | + gtk_message_dialog_new( | ||
64 | + GTK_WINDOW(gtk_widget_get_toplevel(terminal)), | ||
65 | + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, | ||
66 | + GTK_MESSAGE_ERROR, | ||
67 | + GTK_BUTTONS_OK, | ||
68 | + _("This action is not available in this platform") | ||
240 | ); | 69 | ); |
241 | 70 | ||
242 | - } | ||
243 | - | ||
244 | - // 2 = Session name | ||
245 | - { | ||
246 | - gchar * session_name = g_strdup(v3270_get_session_name(terminal)); | ||
247 | - gchar * ptr = strchr(session_name,':'); | ||
248 | - if(ptr) | ||
249 | - *ptr = 0; | ||
250 | - | ||
251 | - if(strcmp(session_name,G_STRINGIFY(PRODUCT_NAME))) | ||
252 | - gtk_entry_set_text(GTK_ENTRY(inputs[2]),session_name); | ||
253 | - | ||
254 | - } | ||
255 | - | ||
256 | - // 3 = Session filename | ||
257 | - { | ||
258 | - g_autofree gchar * session_filename = v3270_key_file_build_filename(terminal); | ||
259 | - gtk_entry_set_text(GTK_ENTRY(inputs[3]),session_filename); | ||
260 | - | ||
261 | - gtk_entry_bind_to_filechooser( | ||
262 | - inputs[3], | ||
263 | - GTK_FILE_CHOOSER_ACTION_SAVE, | ||
264 | - _("Save to session filename"), | ||
265 | - NULL, | ||
266 | - "*.3270", | ||
267 | - _("3270 session files") | ||
268 | - ); | 71 | + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL); |
72 | + g_signal_connect(dialog,"response",G_CALLBACK(gtk_widget_destroy),NULL); | ||
269 | 73 | ||
270 | - } | ||
271 | - | ||
272 | - // 4 = Generic name | ||
273 | - gtk_entry_set_placeholder_text(GTK_ENTRY(inputs[4]),v3270_get_url(terminal)); | ||
274 | - gtk_entry_set_text(GTK_ENTRY(inputs[4]),v3270_get_url(terminal)); | ||
275 | - gtk_entry_set_input_hints(GTK_ENTRY(inputs[4]),GTK_INPUT_HINT_SPELLCHECK); | ||
276 | - | ||
277 | - gtk_widget_show_all(GTK_WIDGET(grid)); | ||
278 | return dialog; | 74 | return dialog; |
279 | } | 75 | } |
280 | 76 | ||
281 | static void apply(GtkWidget *dialog, GtkWidget *terminal) { | 77 | static void apply(GtkWidget *dialog, GtkWidget *terminal) { |
282 | 78 | ||
283 | - GError * error = NULL; | ||
284 | - size_t ix; | ||
285 | - | ||
286 | - static const char * key_file_data = | ||
287 | - "[Desktop Entry]\n" \ | ||
288 | - "Icon=" G_STRINGIFY(PRODUCT_NAME) "\n" \ | ||
289 | - "Terminal=false\n" \ | ||
290 | - "Type=Application\n" \ | ||
291 | - "StartupNotify=true\n" \ | ||
292 | - "Categories=GTK;GNOME;TerminalEmulator\n" \ | ||
293 | - "OnlyShowIn=GNOME;Unity\n"; | ||
294 | - | ||
295 | - GKeyFile * keyfile = g_key_file_new(); | ||
296 | - g_key_file_load_from_data(keyfile,key_file_data,-1,G_KEY_FILE_NONE,NULL); | ||
297 | - | ||
298 | -#ifdef DEBUG | ||
299 | - { | ||
300 | - g_autofree gchar * dbg_data = g_key_file_to_data(keyfile,NULL,NULL); | ||
301 | - debug("\n%s\n",dbg_data); | ||
302 | - } | ||
303 | -#endif // DEBUG | ||
304 | - | ||
305 | - | ||
306 | - GtkWidget ** inputs = g_object_get_data(G_OBJECT(dialog),"inputs"); | ||
307 | - debug("dialog=%p inputs=%p",dialog,inputs); | ||
308 | - | ||
309 | - for(ix = 0; ix < G_N_ELEMENTS(entries); ix++) { | ||
310 | - if(entries[ix].key) { | ||
311 | - debug("inputs[%u]=%p",(unsigned int) ix, inputs[ix]); | ||
312 | - g_key_file_set_string(keyfile,"Desktop Entry",entries[ix].key,gtk_entry_get_text(GTK_ENTRY(inputs[ix]))); | ||
313 | - } | ||
314 | - } | ||
315 | - | ||
316 | - // Save keyfile | ||
317 | - v3270_key_file_save_to_file( | ||
318 | - terminal, | ||
319 | - gtk_entry_get_text(GTK_ENTRY(inputs[3])), | ||
320 | - &error | ||
321 | - ); | ||
322 | - | ||
323 | - // Get program file name | ||
324 | - // https://stackoverflow.com/questions/4517425/how-to-get-program-path | ||
325 | - if(!error) { | ||
326 | - char buffer[4096]; | ||
327 | - g_autofree gchar * pidfile = g_strdup_printf("/proc/%d/exe", getpid()); | ||
328 | - | ||
329 | - int bytes = readlink(pidfile,buffer,4095); | ||
330 | - | ||
331 | - if(bytes >= 0) | ||
332 | - buffer[bytes] = '\0'; | ||
333 | - | ||
334 | - g_autofree gchar * exec_line = | ||
335 | - g_strconcat( | ||
336 | - buffer, | ||
337 | - " \"",gtk_entry_get_text(GTK_ENTRY(inputs[3])),"\"", | ||
338 | - NULL | ||
339 | - ); | ||
340 | - | ||
341 | - g_key_file_set_string(keyfile,"Desktop Entry","Exec",exec_line); | ||
342 | - | ||
343 | - } | ||
344 | - | ||
345 | - // Save shortcut | ||
346 | - g_key_file_save_to_file(keyfile,gtk_entry_get_text(GTK_ENTRY(inputs[1])),&error); | ||
347 | - | ||
348 | - g_key_file_free(keyfile); | ||
349 | - | ||
350 | - if(error) { | ||
351 | - | ||
352 | - g_message("%s",error->message); | ||
353 | - g_error_free(error); | ||
354 | - | ||
355 | - } else { | ||
356 | - | ||
357 | - // Set session name (after save to avoid changes on the old session file). | ||
358 | - v3270_set_session_name(terminal,gtk_entry_get_text(GTK_ENTRY(inputs[2]))); | ||
359 | - v3270_emit_save_settings(terminal,NULL); | ||
360 | - | ||
361 | - } | ||
362 | - | ||
363 | -} | ||
364 | - | ||
365 | -void response(GtkWidget *dialog, gint response_id, GtkWidget *terminal) { | ||
366 | - | ||
367 | - debug("%s(%d)",__FUNCTION__,response_id); | ||
368 | - | ||
369 | - gtk_widget_hide(dialog); | ||
370 | - if(response_id == GTK_RESPONSE_APPLY) { | ||
371 | - apply(dialog,terminal); | ||
372 | - } | ||
373 | - | ||
374 | - gtk_widget_destroy(dialog); | ||
375 | - | ||
376 | } | 79 | } |
377 | 80 | ||
378 | - |
src/objects/os/windows/savedesktopicon.c
@@ -98,7 +98,7 @@ static const struct _entry { | @@ -98,7 +98,7 @@ static const struct _entry { | ||
98 | 98 | ||
99 | }; | 99 | }; |
100 | 100 | ||
101 | -GAction * pw3270_action_save_desktop_icon_new(void) { | 101 | +GAction * pw3270_action_save_session_shortcut_new(void) { |
102 | 102 | ||
103 | V3270SimpleAction * action = v3270_dialog_action_new(factory); | 103 | V3270SimpleAction * action = v3270_dialog_action_new(factory); |
104 | 104 |
src/objects/window/private.h
@@ -91,7 +91,7 @@ G_GNUC_INTERNAL GAction * pw3270_file_transfer_action_new(void); | @@ -91,7 +91,7 @@ G_GNUC_INTERNAL GAction * pw3270_file_transfer_action_new(void); | ||
91 | G_GNUC_INTERNAL GAction * pw3270_action_window_close_new(void); | 91 | G_GNUC_INTERNAL GAction * pw3270_action_window_close_new(void); |
92 | G_GNUC_INTERNAL GAction * pw3270_action_connect_new(void); | 92 | G_GNUC_INTERNAL GAction * pw3270_action_connect_new(void); |
93 | G_GNUC_INTERNAL GAction * pw3270_action_save_session_preferences_new(void); | 93 | G_GNUC_INTERNAL GAction * pw3270_action_save_session_preferences_new(void); |
94 | -G_GNUC_INTERNAL GAction * pw3270_action_save_desktop_icon_new(void); | 94 | +G_GNUC_INTERNAL GAction * pw3270_action_save_session_shortcut_new(void); |
95 | 95 | ||
96 | GAction * pw3270_action_session_properties_new(void); | 96 | GAction * pw3270_action_session_properties_new(void); |
97 | 97 |
src/objects/window/window.c
@@ -501,22 +501,18 @@ static void pw3270ApplicationWindow_init(pw3270ApplicationWindow *widget) { | @@ -501,22 +501,18 @@ static void pw3270ApplicationWindow_init(pw3270ApplicationWindow *widget) { | ||
501 | size_t ix; | 501 | size_t ix; |
502 | 502 | ||
503 | GAction * actions[] = { | 503 | GAction * actions[] = { |
504 | -// pw3270_action_host_properties_new(), | ||
505 | pw3270_action_session_properties_new(), | 504 | pw3270_action_session_properties_new(), |
506 | -// pw3270_set_color_action_new(), | ||
507 | - | ||
508 | pw3270_action_save_session_preferences_new(), | 505 | pw3270_action_save_session_preferences_new(), |
509 | - | ||
510 | pw3270_file_transfer_action_new(), | 506 | pw3270_file_transfer_action_new(), |
511 | - | ||
512 | pw3270_action_window_close_new(), | 507 | pw3270_action_window_close_new(), |
513 | - | ||
514 | pw3270_action_connect_new(), | 508 | pw3270_action_connect_new(), |
515 | 509 | ||
516 | v3270_pfkey_action_new(), | 510 | v3270_pfkey_action_new(), |
517 | v3270_pakey_action_new(), | 511 | v3270_pakey_action_new(), |
518 | 512 | ||
519 | - pw3270_action_save_desktop_icon_new(), | 513 | +#ifndef __APPLE__ |
514 | + pw3270_action_save_session_shortcut_new(), | ||
515 | +#endif // __APPLE__ | ||
520 | 516 | ||
521 | }; | 517 | }; |
522 | 518 | ||
@@ -535,10 +531,12 @@ static void pw3270ApplicationWindow_init(pw3270ApplicationWindow *widget) { | @@ -535,10 +531,12 @@ static void pw3270ApplicationWindow_init(pw3270ApplicationWindow *widget) { | ||
535 | // | 531 | // |
536 | // Bind properties | 532 | // Bind properties |
537 | // | 533 | // |
534 | +#ifndef __APPLE__ | ||
538 | g_action_map_add_action( | 535 | g_action_map_add_action( |
539 | G_ACTION_MAP(widget), | 536 | G_ACTION_MAP(widget), |
540 | G_ACTION(g_property_action_new("menubar", widget, "show-menubar")) | 537 | G_ACTION(g_property_action_new("menubar", widget, "show-menubar")) |
541 | ); | 538 | ); |
539 | +#endif // !__APPLE__ | ||
542 | 540 | ||
543 | g_settings_bind( | 541 | g_settings_bind( |
544 | settings, | 542 | settings, |
@@ -640,15 +638,19 @@ GtkWidget * pw3270_application_window_new(GtkApplication * application, const gc | @@ -640,15 +638,19 @@ GtkWidget * pw3270_application_window_new(GtkApplication * application, const gc | ||
640 | #endif // DEBUG | 638 | #endif // DEBUG |
641 | 639 | ||
642 | if(style == PW3270_UI_STYLE_AUTOMATIC) { | 640 | if(style == PW3270_UI_STYLE_AUTOMATIC) { |
643 | - | ||
644 | -#ifdef G_OS_UNIX | 641 | +#if defined(__APPLE__) |
642 | + style = PW3270_UI_STYLE_GNOME; | ||
643 | + g_settings_set_int(settings,"header-icon-type",1); | ||
644 | +#elif defined( G_OS_UNIX ) | ||
645 | style = PW3270_UI_STYLE_GNOME; | 645 | style = PW3270_UI_STYLE_GNOME; |
646 | g_settings_set_boolean(settings,"menubar-visible",FALSE); | 646 | g_settings_set_boolean(settings,"menubar-visible",FALSE); |
647 | g_settings_set_int(settings,"header-icon-type",1); | 647 | g_settings_set_int(settings,"header-icon-type",1); |
648 | -#else | 648 | +#elif defined( G_OS_WIN32 ) |
649 | style = PW3270_UI_STYLE_CLASSICAL; | 649 | style = PW3270_UI_STYLE_CLASSICAL; |
650 | g_settings_set_boolean(settings,"menubar-visible",TRUE); | 650 | g_settings_set_boolean(settings,"menubar-visible",TRUE); |
651 | g_settings_set_int(settings,"header-icon-type",0); | 651 | g_settings_set_int(settings,"header-icon-type",0); |
652 | +#else | ||
653 | + #error Unsupported platform | ||
652 | #endif // G_OS_UNIX | 654 | #endif // G_OS_UNIX |
653 | 655 | ||
654 | g_settings_set_boolean(settings,"toolbar-visible",TRUE); | 656 | g_settings_set_boolean(settings,"toolbar-visible",TRUE); |
@@ -692,6 +694,7 @@ GtkWidget * pw3270_application_window_new(GtkApplication * application, const gc | @@ -692,6 +694,7 @@ GtkWidget * pw3270_application_window_new(GtkApplication * application, const gc | ||
692 | 694 | ||
693 | } | 695 | } |
694 | 696 | ||
697 | +#ifndef __APPLE__ | ||
695 | g_settings_bind( | 698 | g_settings_bind( |
696 | settings, | 699 | settings, |
697 | "menubar-visible", | 700 | "menubar-visible", |
@@ -699,6 +702,7 @@ GtkWidget * pw3270_application_window_new(GtkApplication * application, const gc | @@ -699,6 +702,7 @@ GtkWidget * pw3270_application_window_new(GtkApplication * application, const gc | ||
699 | "show-menubar", | 702 | "show-menubar", |
700 | G_SETTINGS_BIND_DEFAULT | 703 | G_SETTINGS_BIND_DEFAULT |
701 | ); | 704 | ); |
705 | +#endif // !__APPLE__ | ||
702 | 706 | ||
703 | } | 707 | } |
704 | 708 |