From 228b06a67df7a671408c5812065c5dda977908f0 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Wed, 11 Apr 2012 13:52:41 +0000 Subject: [PATCH] Incluindo dialogo de about --- src/gtk/actions.c | 8 ++------ src/gtk/dialog.c | 41 +++++++++++++++++++++++++++++++++++++++++ src/gtk/globals.h | 1 + src/gtk/mainwindow.c | 4 ++-- src/gtk/v3270/clipboard.c | 8 ++++++++ src/gtk/v3270/v3270.h | 2 ++ src/gtk/v3270/widget.c | 10 ++++++++++ src/lib3270/Makefile.in | 6 +++--- ui/00default.xml | 2 +- 9 files changed, 70 insertions(+), 12 deletions(-) diff --git a/src/gtk/actions.c b/src/gtk/actions.c index e84322a..6321491 100644 --- a/src/gtk/actions.c +++ b/src/gtk/actions.c @@ -182,6 +182,7 @@ static void connect_standard_action(GtkAction *action, GtkWidget *widget, const { "disconnect", disconnect_action }, { "hostname", hostname_action }, { "editcolors", editcolors_action }, + { "about", about_dialog_action }, }; int f; @@ -492,12 +493,7 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash } else if(!g_strcasecmp(name,"select")) { - static const gchar * src[] = { "all", - "field", - "none", - "last", - NULL - }; + static const gchar * src[] = { "all", "field", "none", "last", NULL }; static const GCallback cbk[] = { G_CALLBACK(action_select_all), G_CALLBACK(action_select_field), diff --git a/src/gtk/dialog.c b/src/gtk/dialog.c index 2244fb2..d8cc575 100644 --- a/src/gtk/dialog.c +++ b/src/gtk/dialog.c @@ -514,3 +514,44 @@ g_free(encattr); } + G_GNUC_INTERNAL void about_dialog_action(GtkAction *action, GtkWidget *widget) + { + static const gchar *authors[] = { "Paul Mattes ", + "GTRC", + "Perry Werneck ", + "and others", + NULL }; + + static const gchar *license = + N_( "This program is free software; you can redistribute it and/or " + "modify it under the terms of the GNU General Public License as " + "published by the Free Software Foundation; either version 2 of the " + "License, or (at your option) any later version.\n\n" + "This program is distributed in the hope that it will be useful, " + "but WITHOUT ANY WARRANTY; without even the implied warranty of " + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " + "GNU General Public License for more details.\n\n" + "You should have received a copy of the GNU General Public License " + "along with this program; if not, write to the Free Software " + "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 " + "USA" ); + + GtkAboutDialog *dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); + + gtk_about_dialog_set_version(dialog, PACKAGE_VERSION ); + gtk_about_dialog_set_copyright(dialog, "Copyright © 2008 Banco do Brasil S.A." ); + gtk_about_dialog_set_comments(dialog, _( "3270 terminal emulator for GTK+" ) ); + + gtk_about_dialog_set_license(dialog, gettext( license ) ); + gtk_about_dialog_set_wrap_license(dialog,TRUE); + + gtk_about_dialog_set_website(dialog,"http://www.softwarepublico.gov.br/dotlrn/clubs/pw3270"); + gtk_about_dialog_set_website_label(dialog,_( "Brazilian Public Software Portal" )); + + gtk_about_dialog_set_authors(dialog,authors); + gtk_about_dialog_set_translator_credits(dialog,_("translator-credits")); + + gtk_widget_show_all(GTK_WIDGET(dialog)); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(GTK_WIDGET(dialog)); + } diff --git a/src/gtk/globals.h b/src/gtk/globals.h index 00d55bc..7739988 100644 --- a/src/gtk/globals.h +++ b/src/gtk/globals.h @@ -73,4 +73,5 @@ G_GNUC_INTERNAL void print_selected_action(GtkAction *action, GtkWidget *widget); G_GNUC_INTERNAL void print_copy_action(GtkAction *action, GtkWidget *widget); G_GNUC_INTERNAL void editcolors_action(GtkAction *action, GtkWidget *widget); + G_GNUC_INTERNAL void about_dialog_action(GtkAction *action, GtkWidget *widget); diff --git a/src/gtk/mainwindow.c b/src/gtk/mainwindow.c index b9ab439..35b397c 100644 --- a/src/gtk/mainwindow.c +++ b/src/gtk/mainwindow.c @@ -368,7 +368,7 @@ g_free(path); - if(lib3270_get_toggle(host,LIB3270_TOGGLE_FULL_SCREEN)) + if(v3270_get_toggle(terminal,LIB3270_TOGGLE_FULL_SCREEN)) gtk_window_fullscreen(GTK_WINDOW(window)); #ifdef DEBUG @@ -378,7 +378,7 @@ trace("%s ends",__FUNCTION__); gtk_window_set_focus(GTK_WINDOW(window),terminal); - if(lib3270_get_toggle(host,LIB3270_TOGGLE_CONNECT_ON_STARTUP)) + if(v3270_get_toggle(terminal,LIB3270_TOGGLE_CONNECT_ON_STARTUP)) lib3270_connect(host,NULL,0); return window; diff --git a/src/gtk/v3270/clipboard.c b/src/gtk/v3270/clipboard.c index 87f4abf..3d502d0 100644 --- a/src/gtk/v3270/clipboard.c +++ b/src/gtk/v3270/clipboard.c @@ -96,6 +96,14 @@ gchar * v3270_get_text(GtkWidget *widget, int offset, int len) return text; } +/** + * Get lib3270 selection as a g_malloc buffer. + * + * @param widget Widget containing the desired section. + * + * @return NULL if error, otherwise the selected buffer contents (release with g_free). + * + */ static gchar * v3270_get_selected(v3270 *widget) { gchar *text = lib3270_get_selected(widget->host); diff --git a/src/gtk/v3270/v3270.h b/src/gtk/v3270/v3270.h index 0291057..8cb52f2 100644 --- a/src/gtk/v3270/v3270.h +++ b/src/gtk/v3270/v3270.h @@ -171,6 +171,8 @@ // Misc GtkIMContext * v3270_get_im_context(GtkWidget *widget); + gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix); + G_END_DECLS diff --git a/src/gtk/v3270/widget.c b/src/gtk/v3270/widget.c index ad73025..e48503f 100644 --- a/src/gtk/v3270/widget.c +++ b/src/gtk/v3270/widget.c @@ -1180,3 +1180,13 @@ GtkIMContext * v3270_get_im_context(GtkWidget *widget) return GTK_V3270(widget)->input_method; } + gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix) + { + g_return_val_if_fail(GTK_IS_V3270(widget),FALSE); + + if(ix < LIB3270_TOGGLE_COUNT) + return lib3270_get_toggle(GTK_V3270(widget)->host,ix) ? TRUE : FALSE; + + return FALSE; + } + diff --git a/src/lib3270/Makefile.in b/src/lib3270/Makefile.in index 85a4d3c..1930f97 100644 --- a/src/lib3270/Makefile.in +++ b/src/lib3270/Makefile.in @@ -28,7 +28,7 @@ PACKAGE=@PACKAGE_NAME@ -CFLAGS=@CFLAGS@ @DLL_CFLAGS@ -DAPPDATA=\"$(datarootdir)/$(PACKAGE_NAME)\" -I../../src/include +CFLAGS=@CFLAGS@ @DLL_CFLAGS@ -DAPPDATA=\"$(datarootdir)/$(PACKAGE_NAME)\" -I../include SSL_CFLAGS=@LIBSSL_CFLAGS@ DLL_FLAGS=@DLL_FLAGS@ @@ -37,7 +37,7 @@ LDFLAGS=@LDFLAGS@ LIBS=@LIBS@ @LIBSSL_LIBS@ @INTL_LIBS@ @SOCKET_LIBS@ DEBUG_CFLAGS=-DDEBUG=1 -g -DEPENDS ?= *.h ../../src/include/*.h Makefile +DEPENDS ?= *.h ../include/*.h Makefile #---[ Paths ]------------------------------------------------------------------ @@ -118,7 +118,7 @@ $(BINRLS)/@DLLPREFIX@3270@DLLEXT@: $(foreach SRC, $(basename $(SOURCES)), $(OBJR @$(LD) $(DLL_FLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) @$(STRIP) $@ -$(BINDIR)/Debug/testprogram$(EXEEXT): testprogram.o $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) +$(BINDBG)/testprogram$(EXEEXT): $(OBJDBG)/testprogram.o $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC)@OBJEXT@) @echo $@ ... @$(MKDIR) `dirname $@` diff --git a/ui/00default.xml b/ui/00default.xml index 06f4f82..df57207 100644 --- a/ui/00default.xml +++ b/ui/00default.xml @@ -137,7 +137,7 @@ - + -- libgit2 0.21.2