Commit 4ec193c8b43404ce9fc1f16e90f81b86a150ad5c
1 parent
3f0a2779
Exists in
master
and in
4 other branches
Fixing command line arguments.
Showing
1 changed file
with
28 additions
and
11 deletions
Show diff stats
src/objects/window/terminal.c
... | ... | @@ -243,11 +243,12 @@ |
243 | 243 | |
244 | 244 | static void save_settings(GtkWidget *terminal, struct SessionDescriptor * session) { |
245 | 245 | |
246 | - debug("************************************* %s",__FUNCTION__); | |
246 | + session->changed = FALSE; | |
247 | + | |
247 | 248 | v3270_to_key_file(terminal,session->key_file,"terminal"); |
248 | 249 | v3270_accelerator_map_to_key_file(terminal, session->key_file, "accelerators"); |
249 | 250 | |
250 | - session->changed = TRUE; | |
251 | + g_key_file_save_to_file(session->key_file,session->filename,NULL); | |
251 | 252 | |
252 | 253 | } |
253 | 254 | |
... | ... | @@ -263,7 +264,8 @@ |
263 | 264 | |
264 | 265 | if(session->changed) { |
265 | 266 | g_message("Saving file %s",session->filename); |
266 | - g_key_file_save_to_file(session->key_file,session->filename,NULL); | |
267 | + g_key_file_save_to_file(session->key_file,session->filename,NULL); | |
268 | + session->changed = FALSE; | |
267 | 269 | } else { |
268 | 270 | g_message("Closing file %s",session->filename); |
269 | 271 | } |
... | ... | @@ -358,15 +360,25 @@ |
358 | 360 | |
359 | 361 | g_return_val_if_fail(PW3270_IS_APPLICATION_WINDOW(widget),-1); |
360 | 362 | |
361 | - pw3270ApplicationWindow * window = PW3270_APPLICATION_WINDOW(widget); | |
362 | - GtkWidget * terminal = v3270_new(); | |
363 | + g_autofree gchar *path = g_file_get_path(file); | |
364 | + debug("Path: \"%s\"",path); | |
365 | + | |
366 | + if(path) { | |
367 | + | |
368 | + // It's a session file | |
369 | + pw3270_terminal_new(widget, path); | |
370 | + return 0; | |
371 | + | |
372 | + } | |
363 | 373 | |
364 | - // Identify argument. | |
365 | 374 | g_autofree gchar * scheme = g_file_get_uri_scheme(file); |
366 | 375 | |
367 | 376 | if(!(g_ascii_strcasecmp(scheme,"tn3270") && g_ascii_strcasecmp(scheme,"tn3270s"))) { |
368 | 377 | |
369 | - // Is a 3270 URL. | |
378 | + // It's a TN3270 URL. | |
379 | + | |
380 | + GtkWidget * terminal = v3270_new(); | |
381 | + | |
370 | 382 | g_autofree gchar * uri = g_file_get_uri(file); |
371 | 383 | size_t sz = strlen(uri); |
372 | 384 | |
... | ... | @@ -374,14 +386,19 @@ |
374 | 386 | uri[sz-1] = 0; |
375 | 387 | |
376 | 388 | v3270_set_url(terminal,uri); |
389 | + append_terminal_page(PW3270_APPLICATION_WINDOW(widget), terminal); | |
390 | + return 0; | |
377 | 391 | |
378 | - } else { | |
379 | - | |
380 | - g_message("Unexpected URI scheme: \"%s\"",scheme); | |
392 | + } | |
381 | 393 | |
394 | + // Create a default window. | |
395 | + { | |
396 | + GtkWidget * terminal = v3270_new(); | |
397 | + g_warning("Unexpected session URL, creating a default window"); | |
398 | + append_terminal_page(PW3270_APPLICATION_WINDOW(widget), terminal); | |
382 | 399 | } |
383 | 400 | |
384 | - return append_terminal_page(window, terminal); | |
401 | + return -1; | |
385 | 402 | |
386 | 403 | } |
387 | 404 | ... | ... |