Commit 05d9253bcb8f214cc9d544988bc9035525af77d0

Authored by Perry Werneck
1 parent 3f48813e

Fixing bug on command-line url.

src/objects/application/actions/open.c
@@ -132,67 +132,3 @@ @@ -132,67 +132,3 @@
132 return G_ACTION(action); 132 return G_ACTION(action);
133 } 133 }
134 134
135 - /*  
136 - static gchar * get_session_file_name(GtkApplication *application, const gchar *title) {  
137 -  
138 - gchar * filename = NULL;  
139 -  
140 - GtkWidget * dialog =  
141 - gtk_file_chooser_dialog_new(  
142 - title,  
143 - gtk_application_get_active_window(application),  
144 - GTK_FILE_CHOOSER_ACTION_OPEN,  
145 - _("Open Session"), GTK_RESPONSE_OK,  
146 - _("Cancel"),GTK_RESPONSE_CANCEL,  
147 - NULL  
148 - );  
149 -  
150 - gtk_file_chooser_set_pw3270_filters(GTK_FILE_CHOOSER(dialog));  
151 -  
152 - gtk_widget_show_all(dialog);  
153 - if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {  
154 - filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));  
155 - }  
156 -  
157 - gtk_widget_destroy(dialog);  
158 -  
159 - return filename;  
160 - }  
161 -  
162 - void pw3270_application_open_activated(GSimpleAction * action, GVariant G_GNUC_UNUSED(*parameter), gpointer G_GNUC_UNUSED(application)) {  
163 -  
164 - debug("%s",__FUNCTION__);  
165 - g_simple_action_set_enabled(action,FALSE);  
166 -  
167 - g_simple_action_set_enabled(action,TRUE);  
168 - }  
169 -  
170 - void pw3270_application_open_tab_activated(GSimpleAction * action, GVariant G_GNUC_UNUSED(*parameter), gpointer application) {  
171 -  
172 - debug("%s",__FUNCTION__);  
173 - g_simple_action_set_enabled(action,FALSE);  
174 - g_autofree gchar * session_file_name = get_session_file_name(GTK_APPLICATION(application),_("Open session in new tab"));  
175 -  
176 - if(session_file_name) {  
177 - pw3270_application_window_new_tab(GTK_WIDGET(gtk_application_get_active_window(GTK_APPLICATION(application))), session_file_name);  
178 - }  
179 -  
180 - g_simple_action_set_enabled(action,TRUE);  
181 - }  
182 -  
183 - void pw3270_application_open_window_activated(GSimpleAction * action, GVariant G_GNUC_UNUSED(*parameter), gpointer application) {  
184 -  
185 - debug("%s",__FUNCTION__);  
186 - g_simple_action_set_enabled(action,FALSE);  
187 - g_autofree gchar * session_file_name = get_session_file_name(GTK_APPLICATION(application),_("Open session in new window"));  
188 -  
189 - if(session_file_name) {  
190 - GtkWidget *window = pw3270_application_window_new(GTK_APPLICATION(application), session_file_name);  
191 - pw3270_window_set_current_page(window,0);  
192 - gtk_window_present(GTK_WINDOW(window));  
193 - }  
194 -  
195 - g_simple_action_set_enabled(action,TRUE);  
196 - }  
197 - */  
198 -  
src/objects/application/open.c
@@ -38,13 +38,12 @@ @@ -38,13 +38,12 @@
38 for(file = 0; file < n_files; file++) { 38 for(file = 0; file < n_files; file++) {
39 39
40 g_autofree gchar *path = g_file_get_path(files[file]); 40 g_autofree gchar *path = g_file_get_path(files[file]);
41 - GtkWidget * terminal = NULL;  
42 -  
43 if(!window) { 41 if(!window) {
  42 + debug("%s: Open in new window",__FUNCTION__);
44 window = pw3270_application_window_new(GTK_APPLICATION(application), path); 43 window = pw3270_application_window_new(GTK_APPLICATION(application), path);
45 - terminal = gtk_window_get_default_widget(GTK_WINDOW(window));  
46 } else { 44 } else {
47 - terminal = pw3270_application_window_new_tab(window,path); 45 + debug("%s: Open in new tab",__FUNCTION__);
  46 + window = pw3270_application_window_new_tab(window,path);
48 } 47 }
49 48
50 if(!path) { 49 if(!path) {
@@ -60,7 +59,7 @@ @@ -60,7 +59,7 @@
60 if(sz > 0 && uri[sz-1] == '/') 59 if(sz > 0 && uri[sz-1] == '/')
61 uri[sz-1] = 0; 60 uri[sz-1] = 0;
62 61
63 - v3270_set_url(terminal,uri); 62 + v3270_set_url(pw3270_application_window_get_active_terminal(window),uri);
64 63
65 } 64 }
66 65
src/objects/window/window.c
@@ -445,6 +445,8 @@ @@ -445,6 +445,8 @@
445 } 445 }
446 } 446 }
447 447
  448 + pw3270_application_window_set_active_terminal(GTK_WIDGET(window),terminal);
  449 +
448 // gtk_window_set_interactive_debugging(TRUE); 450 // gtk_window_set_interactive_debugging(TRUE);
449 451
450 return GTK_WIDGET(window); 452 return GTK_WIDGET(window);