Commit 22a59d7e6576150651548f2dd9e96bf7385ed487
1 parent
b962a055
Exists in
master
and in
2 other branches
Still working on command line parser.
Showing
1 changed file
with
18 additions
and
9 deletions
Show diff stats
src/objects/application/open.c
... | ... | @@ -71,16 +71,24 @@ gchar * v3270_keyfile_find(const gchar *name) { |
71 | 71 | } |
72 | 72 | |
73 | 73 | /// @brief Open session file |
74 | -static void open(GtkApplication *application, const gchar *filename) { | |
74 | +static void open(GtkApplication *application, GtkWindow **window, const gchar *filename) { | |
75 | 75 | |
76 | 76 | g_message("Opening '%s'",filename); |
77 | 77 | |
78 | - GtkWindow *window = GTK_WINDOW(pw3270_application_window_new(application, filename)); | |
79 | - gtk_window_present(window); | |
78 | + if(*window) { | |
79 | + | |
80 | + // Already open a window, open in new tab. | |
81 | + pw3270_application_window_new_tab(GTK_WIDGET(*window), filename); | |
82 | + | |
83 | + } else { | |
84 | + // It's a new window | |
85 | + *window = GTK_WINDOW(pw3270_application_window_new(application, filename)); | |
86 | + | |
87 | + } | |
80 | 88 | |
81 | 89 | } |
82 | 90 | |
83 | -void pw3270_application_open_file(GtkApplication *application, GFile *file) { | |
91 | +void pw3270_application_open_file(GtkApplication *application, GtkWindow **window, GFile *file) { | |
84 | 92 | |
85 | 93 | // GtkWidget * window = gtk_application_get_active_window(application); |
86 | 94 | g_autofree gchar * scheme = g_file_get_uri_scheme(file); |
... | ... | @@ -92,7 +100,7 @@ void pw3270_application_open_file(GtkApplication *application, GFile *file) { |
92 | 100 | |
93 | 101 | // The file exists, load it. |
94 | 102 | g_autofree gchar *filename = g_file_get_path(file); |
95 | - open(application,filename); | |
103 | + open(application,window,filename); | |
96 | 104 | |
97 | 105 | } else { |
98 | 106 | |
... | ... | @@ -101,7 +109,7 @@ void pw3270_application_open_file(GtkApplication *application, GFile *file) { |
101 | 109 | g_autofree gchar * filename = v3270_keyfile_find(basename); |
102 | 110 | |
103 | 111 | if(filename) { |
104 | - open(application,filename); | |
112 | + open(application,window,filename); | |
105 | 113 | } else { |
106 | 114 | g_warning("Cant find session '%s'",basename); |
107 | 115 | } |
... | ... | @@ -124,13 +132,14 @@ void pw3270_application_open_file(GtkApplication *application, GFile *file) { |
124 | 132 | void pw3270_application_open(GApplication *application, GFile **files, gint n_files, const gchar G_GNUC_UNUSED(*hint)) { |
125 | 133 | |
126 | 134 | gint file; |
135 | + GtkWindow *window = NULL; | |
127 | 136 | |
128 | 137 | debug("\n\n%s files=%d",__FUNCTION__,n_files); |
129 | 138 | |
130 | 139 | for(file = 0; file < n_files; file++) { |
131 | 140 | |
132 | 141 | debug("%s(%d,%p)",__FUNCTION__,file,files[file]); |
133 | - pw3270_application_open_file(GTK_APPLICATION(application),files[file]); | |
142 | + pw3270_application_open_file(GTK_APPLICATION(application),&window,files[file]); | |
134 | 143 | |
135 | 144 | /* |
136 | 145 | |
... | ... | @@ -209,8 +218,8 @@ void pw3270_application_open(GApplication *application, GFile **files, gint n_fi |
209 | 218 | */ |
210 | 219 | } |
211 | 220 | |
212 | -// if(window) | |
213 | -// gtk_window_present(GTK_WINDOW(window)); | |
221 | + if(window) | |
222 | + gtk_window_present(GTK_WINDOW(window)); | |
214 | 223 | |
215 | 224 | } |
216 | 225 | ... | ... |