Commit 78c87dd2b48d96a828cb1c8eeefe3367758a90b8
1 parent
22a59d7e
Exists in
master
and in
2 other branches
Working on command line parser.
Showing
1 changed file
with
18 additions
and
2 deletions
Show diff stats
src/objects/application/open.c
| ... | ... | @@ -90,7 +90,6 @@ static void open(GtkApplication *application, GtkWindow **window, const gchar *f |
| 90 | 90 | |
| 91 | 91 | void pw3270_application_open_file(GtkApplication *application, GtkWindow **window, GFile *file) { |
| 92 | 92 | |
| 93 | -// GtkWidget * window = gtk_application_get_active_window(application); | |
| 94 | 93 | g_autofree gchar * scheme = g_file_get_uri_scheme(file); |
| 95 | 94 | |
| 96 | 95 | if(g_ascii_strcasecmp(scheme,"file") == 0) { |
| ... | ... | @@ -104,7 +103,7 @@ void pw3270_application_open_file(GtkApplication *application, GtkWindow **windo |
| 104 | 103 | |
| 105 | 104 | } else { |
| 106 | 105 | |
| 107 | - // The file doesn't exist, search for. | |
| 106 | + // Search for file. | |
| 108 | 107 | g_autofree gchar * basename = g_file_get_basename(file); |
| 109 | 108 | g_autofree gchar * filename = v3270_keyfile_find(basename); |
| 110 | 109 | |
| ... | ... | @@ -118,6 +117,23 @@ void pw3270_application_open_file(GtkApplication *application, GtkWindow **windo |
| 118 | 117 | |
| 119 | 118 | } else if(g_ascii_strcasecmp(scheme,"tn3270") == 0 || g_ascii_strcasecmp(scheme,"tn3270s") == 0) { |
| 120 | 119 | |
| 120 | + g_autofree gchar * uri = g_file_get_uri(file); | |
| 121 | + size_t sz = strlen(uri); | |
| 122 | + | |
| 123 | + if(sz > 0 && uri[sz-1] == '/') | |
| 124 | + uri[sz-1] = 0; | |
| 125 | + | |
| 126 | + g_message("Opening '%s' with default settings",uri); | |
| 127 | + | |
| 128 | + if(!*window) { | |
| 129 | + *window = GTK_WINDOW(pw3270_application_window_new(application, NULL)); | |
| 130 | + } else { | |
| 131 | + pw3270_application_window_new_tab(GTK_WIDGET(*window), NULL); | |
| 132 | + } | |
| 133 | + | |
| 134 | + GtkWidget * terminal = pw3270_application_window_get_active_terminal(GTK_WIDGET(*window)); | |
| 135 | + v3270_set_default_session(terminal); | |
| 136 | + v3270_set_url(terminal,uri); | |
| 121 | 137 | |
| 122 | 138 | } else { |
| 123 | 139 | ... | ... |