Commit 953d553a8033b304cef459b5a55abbe7fb2d673a

Authored by Perry Werneck
1 parent 4ef97a3c
Exists in master and in 1 other branch develop

Show host properties when terminal widget is activated without any host

info.
Showing 1 changed file with 20 additions and 6 deletions   Show diff stats
src/terminal/actions.c
@@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
30 #include <config.h> 30 #include <config.h>
31 #include <terminal.h> 31 #include <terminal.h>
32 #include <lib3270/actions.h> 32 #include <lib3270/actions.h>
  33 + #include <v3270/settings.h>
33 34
34 /*--[ Implement ]------------------------------------------------------------------------------------*/ 35 /*--[ Implement ]------------------------------------------------------------------------------------*/
35 36
@@ -53,17 +54,30 @@ LIB3270_EXPORT int v3270_reconnect(GtkWidget *widget) @@ -53,17 +54,30 @@ LIB3270_EXPORT int v3270_reconnect(GtkWidget *widget)
53 return lib3270_reconnect(GTK_V3270(widget)->host,0); 54 return lib3270_reconnect(GTK_V3270(widget)->host,0);
54 } 55 }
55 56
56 -void v3270_activate(GtkWidget *widget)  
57 -{ 57 +void v3270_activate(GtkWidget *widget) {
  58 +
58 v3270 * terminal = GTK_V3270(widget); 59 v3270 * terminal = GTK_V3270(widget);
59 60
60 terminal->activity.timestamp = time(0); 61 terminal->activity.timestamp = time(0);
61 62
62 - if(lib3270_is_connected(terminal->host)) 63 + if(lib3270_is_connected(terminal->host)) {
63 lib3270_enter(terminal->host); 64 lib3270_enter(terminal->host);
64 - else if(lib3270_get_url(terminal->host)) 65 + } else if(lib3270_get_url(terminal->host)) {
65 v3270_reconnect(widget); 66 v3270_reconnect(widget);
66 - else  
67 - g_warning("Terminal widget %p activated without connection or valid url",terminal); 67 + } else {
  68 + g_message("Terminal widget activated without connection or valid url");
  69 +
  70 + GtkWidget * dialog = v3270_settings_dialog_new();
  71 + gtk_container_add(GTK_CONTAINER(dialog), v3270_host_settings_new());
  72 + gtk_window_set_title(GTK_WINDOW(dialog),_("Setup host properties"));
  73 +
  74 + gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(widget)));
  75 +
  76 + v3270_settings_dialog_set_terminal_widget(dialog, widget);
  77 + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL);
  78 + g_signal_connect(dialog,"response",G_CALLBACK(v3270_setttings_dialog_response),NULL);
  79 +
  80 + gtk_widget_show_all(dialog);
  81 + }
68 } 82 }
69 83