diff --git a/src/gtk/main.c b/src/gtk/main.c index fbf59f1..5e8892f 100644 --- a/src/gtk/main.c +++ b/src/gtk/main.c @@ -107,11 +107,46 @@ static int initialize(void) int main(int argc, char *argv[]) { - int rc = 0; + static const gchar * appname = PACKAGE_NAME; + int rc = 0; - g_set_application_name(PACKAGE_NAME); + // Process command-line options + { + static const GOptionEntry app_options[] = + { + { "appname", 'a', 0, G_OPTION_ARG_STRING, &appname, N_( "Application name" ), PACKAGE_NAME }, + + { NULL } + }; + + GOptionContext * options = g_option_context_new (_("- 3270 Emulator for Gtk")); + GError * error = NULL; + + g_option_context_add_main_entries(options, app_options, NULL); + + gtk_init(&argc, &argv); + + if(!g_option_context_parse( options, &argc, &argv, &error )) + { + GtkWidget *dialog = gtk_message_dialog_new( NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CANCEL, + "%s", _( "Option parsing failed." )); + + gtk_window_set_title(GTK_WINDOW(dialog),_( "Parse error" )); + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s", error->message); + + gtk_dialog_run(GTK_DIALOG (dialog)); + gtk_widget_destroy(dialog); + + g_error_free(error); + + return -1; + } + } - gtk_init(&argc, &argv); + g_set_application_name(appname); rc = initialize(); if(!rc) diff --git a/src/gtk/mainwindow.c b/src/gtk/mainwindow.c index e288ffe..8ea12ac 100644 --- a/src/gtk/mainwindow.c +++ b/src/gtk/mainwindow.c @@ -122,33 +122,15 @@ gtk_action_group_set_sensitive(group[ACTION_GROUP_PASTE],FALSE); gtk_action_group_set_sensitive(group[ACTION_GROUP_ONLINE],FALSE); gtk_action_group_set_sensitive(group[ACTION_GROUP_OFFLINE],TRUE); + gtk_window_set_title(GTK_WINDOW(gtk_widget_get_toplevel(widget)),g_get_application_name()); } -/* -#ifndef WIN32 - static void clipboard_text_check(GtkClipboard *clipboard, const gchar *text, GtkActionGroup **group) - { - trace("%s called with text=%p",__FUNCTION__,text); - gtk_action_group_set_sensitive(group[ACTION_GROUP_PASTE],text != NULL); - } -#endif -*/ - - static void connected(GtkWidget *widget, GtkActionGroup **group) + static void connected(GtkWidget *widget, const gchar *host, GtkActionGroup **group) { + gtk_window_set_title(GTK_WINDOW(gtk_widget_get_toplevel(widget)),host); gtk_action_group_set_sensitive(group[ACTION_GROUP_ONLINE],TRUE); gtk_action_group_set_sensitive(group[ACTION_GROUP_OFFLINE],FALSE); gtk_action_group_set_sensitive(group[ACTION_GROUP_PASTE],TRUE); - -/* -#ifdef WIN32 - gtk_action_group_set_sensitive(group[ACTION_GROUP_PASTE],TRUE); -#else - gtk_action_group_set_sensitive(group[ACTION_GROUP_PASTE],FALSE); - gtk_clipboard_request_text(gtk_widget_get_clipboard(widget,GDK_SELECTION_CLIPBOARD),(GtkClipboardTextReceivedFunc) clipboard_text_check,(gpointer) group); -#endif -*/ - } static void update_config(GtkWidget *widget, const gchar *name, const gchar *value) diff --git a/src/gtk/v3270/genmarshal b/src/gtk/v3270/genmarshal index c9ce916..45c6c39 100644 --- a/src/gtk/v3270/genmarshal +++ b/src/gtk/v3270/genmarshal @@ -2,6 +2,7 @@ VOID:VOID VOID:VOID,ENUM,BOOL,POINTER VOID:VOID,ENUM VOID:VOID,POINTER +VOID:POINTER VOID:VOID,POINTER,POINTER VOID:VOID,UINT,POINTER BOOL:VOID,UINT,ENUM diff --git a/src/gtk/v3270/widget.c b/src/gtk/v3270/widget.c index 23b37a2..2168279 100644 --- a/src/gtk/v3270/widget.c +++ b/src/gtk/v3270/widget.c @@ -318,8 +318,8 @@ static void v3270_class_init(v3270Class *klass) G_SIGNAL_RUN_FIRST, 0, NULL, NULL, - pw3270_VOID__VOID, - G_TYPE_NONE, 0); + pw3270_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_STRING); v3270_widget_signal[SIGNAL_DISCONNECTED] = g_signal_new( "disconnected", @@ -524,7 +524,7 @@ static void update_connect(H3270 *session, unsigned char connected) if(connected) { widget->cursor.show |= 2; - g_signal_emit(GTK_WIDGET(widget), v3270_widget_signal[SIGNAL_CONNECTED], 0); + g_signal_emit(GTK_WIDGET(widget), v3270_widget_signal[SIGNAL_CONNECTED], 0, session->full_current_host); } else { -- libgit2 0.21.2