diff --git a/src/dialogs/colorscheme.c b/src/dialogs/colorscheme.c index d6baf79..3c25967 100644 --- a/src/dialogs/colorscheme.c +++ b/src/dialogs/colorscheme.c @@ -423,8 +423,8 @@ } while(gtk_tree_model_iter_next(model,&iter)); } - g_message("Can't find color scheme for %s",colors); - gtk_combo_box_set_active(GTK_COMBO_BOX(widget),-1); + g_message("Can't find color scheme"); + //gtk_combo_box_set_active(GTK_COMBO_BOX(widget),-1); // TODO: Create an entry for this scheme as "custom" and select it. diff --git a/src/dialogs/hostselect.c b/src/dialogs/hostselect.c index 629a02b..c729599 100644 --- a/src/dialogs/hostselect.c +++ b/src/dialogs/hostselect.c @@ -29,6 +29,7 @@ #include "private.h" #include + #include /*--[ Widget definition ]----------------------------------------------------------------------------*/ diff --git a/src/dialogs/popups.c b/src/dialogs/popups.c new file mode 100644 index 0000000..c0361df --- /dev/null +++ b/src/dialogs/popups.c @@ -0,0 +1,102 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + + #include + #include + #include + + /*--[ Implement ]------------------------------------------------------------------------------------*/ + + void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *title, const gchar *message, const gchar *text) + { + GtkWidget * dialog; + GtkWidget * toplevel = NULL; + GtkMessageType msgtype = GTK_MESSAGE_WARNING; + GtkButtonsType buttons = GTK_BUTTONS_OK; + + if(widget && GTK_IS_WIDGET(widget)) + toplevel = gtk_widget_get_toplevel(GTK_WIDGET(widget)); + + if(!GTK_IS_WINDOW(toplevel)) + toplevel = NULL; + + if(type == LIB3270_NOTIFY_CRITICAL) + { + msgtype = GTK_MESSAGE_ERROR; + buttons = GTK_BUTTONS_CLOSE; + } + + if(!title) + title = _( "Error" ); + + if(message) + { + dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",message); + if(text && *text) + gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),"%s",text); + } + else if(text && *text) + { + dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",text); + } + else + { + dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",title); + } + + gtk_window_set_title(GTK_WINDOW(dialog),title); + gtk_widget_show_all(dialog); + gtk_dialog_run(GTK_DIALOG (dialog)); + gtk_widget_destroy(dialog); + + } + + void v3270_error_popup(GtkWidget *widget, const gchar *title, const gchar *summary, const gchar *body) + { + GtkWidget * dialog = + gtk_message_dialog_new_with_markup( + GTK_WINDOW(gtk_widget_get_toplevel(widget)), + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "%s",summary + ); + + gtk_window_set_title(GTK_WINDOW(dialog), (title ? title : _("Error"))); + + if(body) + gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),"%s",body); + + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL); + g_signal_connect(dialog,"response",G_CALLBACK(gtk_widget_destroy),NULL); + + gtk_widget_show_all(dialog); + + } + diff --git a/src/include/v3270.h b/src/include/v3270.h index 073f822..0f2dc60 100644 --- a/src/include/v3270.h +++ b/src/include/v3270.h @@ -18,14 +18,12 @@ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin * St, Fifth Floor, Boston, MA 02110-1301 USA * - * Este programa está nomeado como v3270.h e possui - linhas de código. + * Este programa está nomeado como - e possui - linhas de código. * * Contatos: * * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * licinio@bb.com.br (Licínio Luis Branco) - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) * */ @@ -261,7 +259,6 @@ LIB3270_EXPORT void v3270_popup_security_dialog(GtkWidget *widget); // Auxiliary widgets - LIB3270_EXPORT GtkWidget * v3270_host_select_new(GtkWidget *widget); LIB3270_EXPORT void v3270_select_host(GtkWidget *widget); // Print @@ -280,8 +277,6 @@ // Misc LIB3270_EXPORT int v3270_exec_command(GtkWidget *widget, const gchar *cmdline); - LIB3270_EXPORT GtkWidget * v3270_dialog_new(GtkWidget *widget, const gchar *title, const gchar *apply); - // Convenience LIB3270_EXPORT void gtk_entry_set_printf(GtkEntry *entry, const gchar *fmt, ...) G_GNUC_PRINTF(2,3); diff --git a/src/include/v3270/dialogs.h b/src/include/v3270/dialogs.h new file mode 100644 index 0000000..e5d8b89 --- /dev/null +++ b/src/include/v3270/dialogs.h @@ -0,0 +1,44 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +#ifndef V3270_DIALOGS_H_INCLUDED + + #define V3270_DIALOGS_H_INCLUDED 1 + + #include + + G_BEGIN_DECLS + + LIB3270_EXPORT GtkWidget * v3270_host_select_new(GtkWidget *widget); + LIB3270_EXPORT GtkWidget * v3270_dialog_new(GtkWidget *widget, const gchar *title, const gchar *apply); + LIB3270_EXPORT void v3270_error_popup(GtkWidget *widget, const gchar *title, const gchar *summary, const gchar *body); + + G_END_DECLS + +#endif // V3270_DIALOGS_H_INCLUDED diff --git a/src/include/v3270/security.h b/src/include/v3270/security.h new file mode 100644 index 0000000..48b3669 --- /dev/null +++ b/src/include/v3270/security.h @@ -0,0 +1,46 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +#ifndef V3270_SECURITY_H_INCLUDED + + #define V3270_SECURITY_H_INCLUDED 1 + + #include + + G_BEGIN_DECLS + + LIB3270_EXPORT const gchar * v3270_get_ssl_state_icon_name(GtkWidget *widget); + LIB3270_EXPORT const gchar * v3270_get_ssl_state_message(GtkWidget *widget); + LIB3270_EXPORT const gchar * v3270_get_ssl_state_description(GtkWidget *widget); + LIB3270_EXPORT GtkWidget * v3270_security_dialog_new(GtkWidget *widget); + LIB3270_EXPORT void v3270_popup_security_dialog(GtkWidget *widget); + + G_END_DECLS + +#endif // V3270_SECURITY_H_INCLUDED diff --git a/src/terminal/widget.c b/src/terminal/widget.c index 49620d4..b6228a4 100644 --- a/src/terminal/widget.c +++ b/src/terminal/widget.c @@ -136,50 +136,6 @@ void get_preferred_width(GtkWidget *widget, gint *minimum_width, gint *natural_w *natural_width = 600; } -void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *title, const gchar *message, const gchar *text) -{ - GtkWidget * dialog; - GtkWidget * toplevel = NULL; - GtkMessageType msgtype = GTK_MESSAGE_WARNING; - GtkButtonsType buttons = GTK_BUTTONS_OK; - - if(widget && GTK_IS_WIDGET(widget)) - toplevel = gtk_widget_get_toplevel(GTK_WIDGET(widget)); - - if(!GTK_IS_WINDOW(toplevel)) - toplevel = NULL; - - if(type == LIB3270_NOTIFY_CRITICAL) - { - msgtype = GTK_MESSAGE_ERROR; - buttons = GTK_BUTTONS_CLOSE; - } - - if(!title) - title = _( "Error" ); - - if(message) - { - dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",message); - if(text && *text) - gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),"%s",text); - } - else if(text && *text) - { - dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",text); - } - else - { - dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",title); - } - - gtk_window_set_title(GTK_WINDOW(dialog),title); - gtk_widget_show_all(dialog); - gtk_dialog_run(GTK_DIALOG (dialog)); - gtk_widget_destroy(dialog); - -} - gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, G_GNUC_UNUSED gboolean keyboard_tooltip, GtkTooltip *tooltip) { if(y >= GTK_V3270(widget)->oia.rect->y) diff --git a/src/testprogram/toolbar.c b/src/testprogram/toolbar.c index 04588ac..34045ae 100644 --- a/src/testprogram/toolbar.c +++ b/src/testprogram/toolbar.c @@ -32,6 +32,7 @@ #include #include #include + #include #include #include #include @@ -65,6 +66,8 @@ static void save_all_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *termin static void ft_clicked(GtkButton *button, GtkWidget *terminal) { + v3270_error_popup(terminal,"title","summary","body"); + /* GtkWidget * dialog = v3270_dialog_new(terminal, _("test"), _("test")); GtkWidget * trace = v3270_trace_new(terminal); @@ -100,6 +103,7 @@ static void save_all_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *termin v3270_ft_activity_set_options(activity,LIB3270_FT_OPTION_RECEIVE|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_REMAP); */ + /* // // Test settings dialog // @@ -110,6 +114,7 @@ static void save_all_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *termin // V5.1 dialog // GtkWidget *dialog = v3270ft_new(GTK_WIDGET(button)); + */ /* // @@ -123,9 +128,11 @@ static void save_all_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *termin v3270_ft_worker_start(worker); */ + /* gtk_widget_show_all(dialog); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); + */ } diff --git a/v3270.cbp b/v3270.cbp index bfc3281..11db7c4 100644 --- a/v3270.cbp +++ b/v3270.cbp @@ -60,6 +60,9 @@ + + @@ -153,9 +156,11 @@ + +