From 2beb77e034c5b567c0c08a66857326c754c7709c Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Wed, 15 Aug 2012 10:52:02 +0000 Subject: [PATCH] Implementando instalador windows para versão 5 gtk2 --- Makefile.in | 10 +++++++++- android/AndroidManifest.xml | 4 +++- android/src/br/com/bb/pw3270/PW3270Activity.java | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------- configure.ac | 3 ++- makegtkruntime.sh.in | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ po/pt_BR.po | 2 +- pw3270.nsi.in | 68 +++++++++++++++++++++++++++++++++----------------------------------- 7 files changed, 276 insertions(+), 118 deletions(-) create mode 100644 makegtkruntime.sh.in diff --git a/Makefile.in b/Makefile.in index b8b6f59..3500d3e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -72,6 +72,7 @@ XML2POT=src/tools/xml2pot@EXEEXT@ SHELL=@SHELL@ AMTAR=@AMTAR@ DBGCMDPREFIX=@DBGCMDPREFIX@ +MAKENSIS=@MAKENSIS@ #---[ Rules ]------------------------------------------------------------------ @@ -127,7 +128,7 @@ src/tools/%@EXEEXT@: src/tools/%.c all: $(BINDIR)/Release/$(PACKAGE_TARNAME)$(EXEEXT) locale filelist -Release: $(BINDIR)/Release/$(PACKAGE_TARNAME)$(EXEEXT) locale +Release: $(BINDIR)/Release/$(PACKAGE_TARNAME)$(EXEEXT) locale pixmaps $(BINDIR)/Release/$(PACKAGE_TARNAME)$(EXEEXT): src/pw3270/* $(BINDIR)/Release@DLLDIR@/@DLLPREFIX@3270@DLLEXT@ $(DEPENDS) @$(MAKE) BINDIR="../../$(BINDIR)" LIB3270_LIBS="$(RLSLIB)" LIB3270_CFLAGS="-I../../src/include" -C src/pw3270 ../../$(BINDIR)/Release/$(PACKAGE_TARNAME)$(EXEEXT) @@ -185,6 +186,13 @@ ifneq ($(RPMBUILD),no) @$(RPMBUILD) --define="_srcrpmdir $(PWD)" -bs $(PACKAGE_TARNAME).spec endif +nsi: Release +ifneq ($(MAKENSIS),no) + @chmod +x makegtkruntime.sh + @./makegtkruntime.sh + @$(MAKENSIS) $(PACKAGE_NAME).nsi +endif + $(PACKAGE_NAME).po: $(TMPDIR)/$(PACKAGE_NAME).pot @echo " INIT `basename $@`" @$(MSGINIT) --no-translator -o $@ --locale=en_US -i $^ diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index e6c2620..28e0913 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -12,7 +12,9 @@ android:label="@string/app_name" > + android:label="@string/app_name" + android:configChanges="orientation" > + diff --git a/android/src/br/com/bb/pw3270/PW3270Activity.java b/android/src/br/com/bb/pw3270/PW3270Activity.java index e7e49cd..b4729ea 100644 --- a/android/src/br/com/bb/pw3270/PW3270Activity.java +++ b/android/src/br/com/bb/pw3270/PW3270Activity.java @@ -18,7 +18,7 @@ * 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 PW3270Activity.hava e possui - linhas de + * Este programa está nomeado como PW3270Activity.hava e possui - linhas de * código. * * Contatos: @@ -64,7 +64,7 @@ public class PW3270Activity extends Activity private class terminal extends lib3270 { - terminal(SharedPreferences settings) + terminal(SharedPreferences settings) { super(settings); } @@ -78,8 +78,8 @@ public class PW3270Activity extends Activity { view.reload(); } - - protected boolean showProgramMessage(int id) + + protected boolean showProgramMessage(int id) { if(!super.showProgramMessage(id)) { @@ -107,7 +107,7 @@ public class PW3270Activity extends Activity if(title != "") d.setTitle(title); - + if(text != "") d.setMessage(text); @@ -124,11 +124,11 @@ public class PW3270Activity extends Activity try { text = new String(getHTML(),getEncoding()); - } - catch(Exception e) - { + } + catch(Exception e) + { Log.e(TAG,e.getLocalizedMessage()); - return ""; + return ""; } return text; @@ -140,106 +140,121 @@ public class PW3270Activity extends Activity @Override public void onCreate(Bundle savedInstanceState) { - SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); - super.onCreate(savedInstanceState); - - res = getResources(); - - // Cria dialogo para as mensagems de sistema - dlgSysMessage = new ProgressDialog(this); - dlgSysMessage.setCancelable(false); - dlgSysMessage.setTitle(res.getString(R.string.wait)); + res = getResources(); + initUI(); + } - /* - dlgSysMessage.setButton(-2, "Desconectar", new DialogInterface.OnClickListener() - { + protected void initUI() + { + boolean autoconnect = false; + SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); - public void onClick(DialogInterface dialog, int which) - { - // TODO Auto-generated method stub - } - - }); - */ - - // Reference: - // http://developer.android.com/reference/android/webkit/WebView.html - view = new WebView(this); + Log.d(TAG, "Initializing UI"); - host = new terminal(settings); - view.addJavascriptInterface(host, "pw3270"); + if(dlgSysMessage == null) + { + // Cria dialogo para as mensagems de sistema + Log.d(TAG, "Creating dlgSysMessage"); + dlgSysMessage = new ProgressDialog(this); + dlgSysMessage.setCancelable(false); + dlgSysMessage.setTitle(res.getString(R.string.wait)); + } - view.setWebChromeClient(new WebChromeClient()); - - view.getSettings().setBuiltInZoomControls(true); - view.getSettings().setSupportZoom(true); - view.getSettings().setUseWideViewPort(true); - view.getSettings().setLoadWithOverviewMode(true); - view.getSettings().setJavaScriptEnabled(true); - - view.setWebViewClient(new WebViewClient() + if(host == null) { + Log.d(TAG, "Creating terminal object"); + host = new terminal(settings); + autoconnect = settings.getString("hostname","") != "" && settings.getBoolean("autoconnect",false); + } - @Override - public WebResourceResponse shouldInterceptRequest(WebView view, String url) + if(view == null) + { + // Reference: + // http://developer.android.com/reference/android/webkit/WebView.html + Log.d(TAG, "Creating Webview"); + view = new WebView(this); + + view.addJavascriptInterface(host, "pw3270"); + + view.setWebChromeClient(new WebChromeClient()); + + view.getSettings().setBuiltInZoomControls(true); + view.getSettings().setSupportZoom(true); + view.getSettings().setUseWideViewPort(true); + view.getSettings().setLoadWithOverviewMode(true); + view.getSettings().setJavaScriptEnabled(true); + + view.setWebViewClient(new WebViewClient() { - int id = R.raw.index; - String mime = "text/html"; - int pos = url.lastIndexOf("/"); - - if(pos >=0 ) - url = url.substring(pos+1); - - Log.i(TAG,"Loading [" + url + "]"); - - if(url.equalsIgnoreCase("jsmain.js")) + + @Override + public WebResourceResponse shouldInterceptRequest(WebView view, String url) { - id = R.raw.jsmain; + int id = R.raw.index; + String mime = "text/html"; + int pos = url.lastIndexOf("/"); + + if(pos >=0 ) + url = url.substring(pos+1); + + Log.i(TAG,"Loading [" + url + "]"); + + if(url.equalsIgnoreCase("jsmain.js")) + { + id = R.raw.jsmain; + } + else if(url.equalsIgnoreCase("theme.css")) + { + mime = "text/css"; + id = R.raw.theme; + } + + // http://developer.android.com/reference/android/webkit/WebResourceResponse.html + return new WebResourceResponse(mime,"utf-8",getResources().openRawResource(id)); } - else if(url.equalsIgnoreCase("theme.css")) - { - mime = "text/css"; - id = R.raw.theme; - } - - // http://developer.android.com/reference/android/webkit/WebResourceResponse.html - return new WebResourceResponse(mime,"utf-8",getResources().openRawResource(id)); - } - - }); - + + }); + } + setContentView(view); view.loadUrl("file:index.html"); - - if(settings.getString("hostname","") != "" && settings.getBoolean("autoconnect",false)) + + if(autoconnect) host.connect(); } + @Override + public void onConfigurationChanged(Configuration newConfig) + { + super.onConfigurationChanged(newConfig); + initUI(); + } + @Override - public boolean onCreateOptionsMenu(Menu menu) + public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); Log.d(TAG,"Popup menu"); inflater.inflate(R.layout.menu, menu); return true; - } - + } + @Override - public boolean onOptionsItemSelected(MenuItem item) + public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection - switch (item.getItemId()) + switch (item.getItemId()) { case R.id.connect: host.connect(); break; - + case R.id.disconnect: host.disconnect(); break; - + case R.id.settings: Intent myIntent = new Intent(view.getContext(), SettingsActivity.class); startActivityForResult(myIntent, 0); @@ -249,7 +264,7 @@ public class PW3270Activity extends Activity return super.onOptionsItemSelected(item); } return true; - + } - + } diff --git a/configure.ac b/configure.ac index 8efb37e..a8160b3 100644 --- a/configure.ac +++ b/configure.ac @@ -116,6 +116,7 @@ case "$host" in EXEEXT=".exe" SOCKET_LIBS="-lws2_32" CFLAGS="$CFLAGS -mms-bitfields" + localedir="locale" DLL_FLAGS="-shared" LDSOFLAGS="-Wl,-soname,\`basename \$@\`" DBGRPATH="" @@ -354,7 +355,7 @@ AC_CONFIG_FILES([ src/pw3270/common/common.h src/tools/Makefile man/Makefile - + makegtkruntime.sh ]) dnl Output the generated config.status script. diff --git a/makegtkruntime.sh.in b/makegtkruntime.sh.in new file mode 100644 index 0000000..323da7c --- /dev/null +++ b/makegtkruntime.sh.in @@ -0,0 +1,134 @@ +#!/bin/bash +PKG_CONFIG="@PKG_CONFIG@" +GTK_VERSION="gtk+-@GTK_VERSION@" + +GTK_PREFIX=$($PKG_CONFIG --variable=prefix $GTK_VERSION) +TARGET_PATH=".bin/gtkruntime" + +# Clean target folder +rm -fr "$TARGET_PATH/*" +mkdir -p "$TARGET_PATH" + +# Build DLL list +TEMPFILE="temp1.tmp" +cat > $TEMPFILE << EOF +intl.dll +libatk-1.0-0.dll +libcairo-2.dll +libgailutil-18.dll +libgdk_pixbuf-2.0-0.dll +libgdk-win32-2.0-0.dll +libgettextlib-0-*.dll +libgettextpo*.dll +libgettextsrc*.dll +libgio-2.0-0.dll +libglib-2.0-0.dll +libgmodule-2.0-0.dll +libgobject-2.0-0.dll +libgthread-2.0-0.dll +libgtk-win32-2.0-0.dll +libpango-1.0-0.dll +libpangocairo-1.0-0.dll +libpangoft2-1.0-0.dll +libpangowin32-1.0-0.dll +zlib1.dll +libpng*.dll +libfontconfig*.dll +libasprintf*.dll +libgettextlib*.dll +libexpat*.dll +freetype*.dll +gspawn-win32-helper-console.exe +gspawn-win32-helper.exe +gdk-pixbuf-query-loaders.exe +EOF + +# jpeg62.dll +# libtiff*.dll + +while read FILE +do + FILEPATH=$(find "$GTK_PREFIX/bin" -name "$FILE") + if [ ! -z $FILEPATH ]; then + echo "$FILEPATH ..." + cp $FILEPATH "$TARGET_PATH" + if [ "$?" != "0" ]; then + echo "Can´t copy $FILEPATH" + exit -1 + fi + else + echo "Can´t find $FILE" + fi +done < $TEMPFILE +rm -f $TEMPFILE + +# Build locale dirs +cat > $TEMPFILE << EOF +atk10.mo +gdk-pixbuf.mo +gettext-runtime.mo +gettext-tools.mo +glib20.mo +gtk20-properties.mo +gtk20.mo +libiconv.mo +EOF + +rm -fr $TARGET_PATH/share/locale/pt_BR/LC_MESSAGES +mkdir -p $TARGET_PATH/share/locale/pt_BR/LC_MESSAGES + +while read FILE +do + echo "$GTK_PREFIX/share/locale/pt_BR/LC_MESSAGES/$FILE ..." + + if [ -e "$GTK_PREFIX/share/locale/pt_BR/LC_MESSAGES/$FILE" ]; then + cp "$GTK_PREFIX/share/locale/pt_BR/LC_MESSAGES/$FILE" "$TARGET_PATH/share/locale/pt_BR/LC_MESSAGES" + if [ "$?" != "0" ]; then + echo "Can´t copy $FILE" + exit -1 + fi + fi + +done < $TEMPFILE +rm -f $TEMPFILE + +# Copy default theme +THEME_PATH="themes/MS-Windows/gtk-2.0" +rm -fr "$TARGET_PATH/$THEME_PATH" +mkdir -p "$TARGET_PATH/share/$THEME_PATH" + +echo "$GTK_PREFIX/share/$THEME_PATH/gtkrc ..." +cp "$GTK_PREFIX/share/$THEME_PATH/gtkrc" "$TARGET_PATH/share/$THEME_PATH/gtkrc" +if [ "$?" != "0" ]; then + echo "Can´t copy default theme" + exit -1 +fi + +cat > $TEMPFILE << EOF +engines +loaders +EOF + +rm -fr $TARGET_PATH/lib/gtk-2.0/$GTK_RUNTIME_VERSION/ +mkdir -p $TARGET_PATH/lib/gtk-2.0/$GTK_RUNTIME_VERSION/ +while read DIRNAME +do + if [ -d "$GTK_PREFIX/lib/gtk-2.0/$GTK_RUNTIME_VERSION/$DIRNAME" ]; then + echo "$GTK_PREFIX/lib/gtk-2.0/$GTK_RUNTIME_VERSION/$DIRNAME ..." + mkdir -p "$TARGET_PATH/lib/gtk-2.0/$GTK_RUNTIME_VERSION/$DIRNAME" + cp -r "$GTK_PREFIX/lib/gtk-2.0/$GTK_RUNTIME_VERSION/$DIRNAME" "$TARGET_PATH/lib/gtk-2.0/$GTK_RUNTIME_VERSION" + if [ "$?" != "0" ]; then + echo "Can´t copy $DIRNAME" + exit -1 + fi + fi +done < $TEMPFILE +rm -f $TEMPFILE + +mkdir -p $TARGET_PATH/etc/gtk-2.0/ +echo "gtk-theme-name = \"MS-Windows\"" > $TARGET_PATH/etc/gtk-2.0/gtkrc +if [ "$?" != "0" ]; then + echo "Can´t set theme name" + exit -1 +fi + diff --git a/po/pt_BR.po b/po/pt_BR.po index 8e77557..fabcbce 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: pw3270 5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-08-13 16:38-0300\n" +"POT-Creation-Date: 2012-08-15 07:51-0300\n" "PO-Revision-Date: 2012-08-13 12:14-0300\n" "Last-Translator: Perry Werneck \n" "Language-Team: Português do Brasil <>\n" diff --git a/pw3270.nsi.in b/pw3270.nsi.in index b25abb7..8c1e8d7 100644 --- a/pw3270.nsi.in +++ b/pw3270.nsi.in @@ -62,9 +62,9 @@ SubSection "@PACKAGE@" SecMain file "/oname=$INSTDIR\@PACKAGE@.ico" "src\pw3270\@PACKAGE@.ico" # Configuration files - file "/oname=$INSTDIR\@PACKAGE@-logo.png" "@PACKAGE@-logo.png" - file "/oname=$INSTDIR\@PACKAGE@.png" "@PACKAGE@.png" - file "/oname=$INSTDIR\colors.conf" "colors.conf" + file "/oname=$INSTDIR\@PACKAGE@-logo.png" "src/pw3270/@PACKAGE@-logo.png" + file "/oname=$INSTDIR\@PACKAGE@.png" "src/pw3270/@PACKAGE@.png" + file "/oname=$INSTDIR\colors.conf" "colors.conf" # Documentation files file "/oname=$INSTDIR\ChangeLog" "ChangeLog" @@ -78,7 +78,7 @@ SubSection "@PACKAGE@" SecMain # Locale files CreateDirectory "$INSTDIR\@localedir@\pt_BR\LC_MESSAGES" - file "/oname=$INSTDIR\@localedir@\pt_BR\LC_MESSAGES\@PACKAGE@.mo" ".bin\Release\usr\local\share\locale\pt_BR\LC_MESSAGES\@PACKAGE@.mo" + file "/oname=$INSTDIR\@localedir@\pt_BR\LC_MESSAGES\@PACKAGE@.mo" ".bin\Release\@localedir@\pt_BR\LC_MESSAGES\@PACKAGE@.mo" # define uninstaller name writeUninstaller $INSTDIR\uninstall.exe @@ -126,14 +126,12 @@ SubSection "@PACKAGE@" SecMain # SubSectionEnd -# -#Section /o "GTK+ Runtime" SecGTK -# -# setOutPath $INSTDIR -# file /r ".bin\gtkruntime\*.*" -# -#SectionEnd -# +Section /o "GTK+ Runtime" SecGTK + + setOutPath $INSTDIR + file /r ".bin\gtkruntime\*.*" + +SectionEnd Section /o "Software Development Kit" SecSDK @@ -200,29 +198,29 @@ Function .onInit # #notRunning: -IfFileExists $PROGRAMFILES\ooRexx\rexx.exe RexxOK RexxNOK - -RexxOK: - SectionGetFlags "${RexxPlugin}" $0 - IntOp $0 $0 | ${SF_SELECTED} - SectionSetFlags "${RexxPlugin}" $0 - - SectionGetFlags "${SecRexxLib}" $0 - IntOp $0 $0 | ${SF_SELECTED} - SectionSetFlags "${SecRexxLib}" $0 - -goto PastRexxCheck - -RexxNOK: - SectionGetFlags "${RexxPlugin}" $0 - IntOp $0 $0 | ${SF_RO} - SectionSetFlags "${RexxPlugin}" $0 - - SectionGetFlags "${SecRexxLib}" $0 - IntOp $0 $0 | ${SF_RO} - SectionSetFlags "${SecRexxLib}" $0 - -PastRexxCheck: +#IfFileExists $PROGRAMFILES\ooRexx\rexx.exe RexxOK RexxNOK +# +#RexxOK: +# SectionGetFlags "${RexxPlugin}" $0 +# IntOp $0 $0 | ${SF_SELECTED} +# SectionSetFlags "${RexxPlugin}" $0 +# +# SectionGetFlags "${SecRexxLib}" $0 +# IntOp $0 $0 | ${SF_SELECTED} +# SectionSetFlags "${SecRexxLib}" $0 +# +#goto PastRexxCheck +# +#RexxNOK: +# SectionGetFlags "${RexxPlugin}" $0 +# IntOp $0 $0 | ${SF_RO} +# SectionSetFlags "${RexxPlugin}" $0 +# +# SectionGetFlags "${SecRexxLib}" $0 +# IntOp $0 $0 | ${SF_RO} +# SectionSetFlags "${SecRexxLib}" $0 +# +#PastRexxCheck: ReadRegStr $4 HKLM "Software\GTK2-Runtime" "DllPath" -- libgit2 0.21.2