Commit 2beb77e034c5b567c0c08a66857326c754c7709c

Authored by perry.werneck@gmail.com
1 parent 859794d8

Implementando instalador windows para versão 5 gtk2

Makefile.in
... ... @@ -72,6 +72,7 @@ XML2POT=src/tools/xml2pot@EXEEXT@
72 72 SHELL=@SHELL@
73 73 AMTAR=@AMTAR@
74 74 DBGCMDPREFIX=@DBGCMDPREFIX@
  75 +MAKENSIS=@MAKENSIS@
75 76  
76 77 #---[ Rules ]------------------------------------------------------------------
77 78  
... ... @@ -127,7 +128,7 @@ src/tools/%@EXEEXT@: src/tools/%.c
127 128  
128 129 all: $(BINDIR)/Release/$(PACKAGE_TARNAME)$(EXEEXT) locale filelist
129 130  
130   -Release: $(BINDIR)/Release/$(PACKAGE_TARNAME)$(EXEEXT) locale
  131 +Release: $(BINDIR)/Release/$(PACKAGE_TARNAME)$(EXEEXT) locale pixmaps
131 132  
132 133 $(BINDIR)/Release/$(PACKAGE_TARNAME)$(EXEEXT): src/pw3270/* $(BINDIR)/Release@DLLDIR@/@DLLPREFIX@3270@DLLEXT@ $(DEPENDS)
133 134 @$(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)
185 186 @$(RPMBUILD) --define="_srcrpmdir $(PWD)" -bs $(PACKAGE_TARNAME).spec
186 187 endif
187 188  
  189 +nsi: Release
  190 +ifneq ($(MAKENSIS),no)
  191 + @chmod +x makegtkruntime.sh
  192 + @./makegtkruntime.sh
  193 + @$(MAKENSIS) $(PACKAGE_NAME).nsi
  194 +endif
  195 +
188 196 $(PACKAGE_NAME).po: $(TMPDIR)/$(PACKAGE_NAME).pot
189 197 @echo " INIT `basename $@`"
190 198 @$(MSGINIT) --no-translator -o $@ --locale=en_US -i $^
... ...
android/AndroidManifest.xml
... ... @@ -12,7 +12,9 @@
12 12 android:label="@string/app_name" >
13 13 <activity
14 14 android:name=".PW3270Activity"
15   - android:label="@string/app_name" >
  15 + android:label="@string/app_name"
  16 + android:configChanges="orientation" >
  17 +
16 18 <intent-filter>
17 19 <action android:name="android.intent.action.MAIN" />
18 20  
... ...
android/src/br/com/bb/pw3270/PW3270Activity.java
... ... @@ -18,7 +18,7 @@
18 18 * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19 19 * St, Fifth Floor, Boston, MA 02110-1301 USA
20 20 *
21   - * Este programa está nomeado como PW3270Activity.hava e possui - linhas de
  21 + * Este programa está nomeado como PW3270Activity.hava e possui - linhas de
22 22 * código.
23 23 *
24 24 * Contatos:
... ... @@ -64,7 +64,7 @@ public class PW3270Activity extends Activity
64 64 private class terminal extends lib3270
65 65 {
66 66  
67   - terminal(SharedPreferences settings)
  67 + terminal(SharedPreferences settings)
68 68 {
69 69 super(settings);
70 70 }
... ... @@ -78,8 +78,8 @@ public class PW3270Activity extends Activity
78 78 {
79 79 view.reload();
80 80 }
81   -
82   - protected boolean showProgramMessage(int id)
  81 +
  82 + protected boolean showProgramMessage(int id)
83 83 {
84 84 if(!super.showProgramMessage(id))
85 85 {
... ... @@ -107,7 +107,7 @@ public class PW3270Activity extends Activity
107 107  
108 108 if(title != "")
109 109 d.setTitle(title);
110   -
  110 +
111 111 if(text != "")
112 112 d.setMessage(text);
113 113  
... ... @@ -124,11 +124,11 @@ public class PW3270Activity extends Activity
124 124 try
125 125 {
126 126 text = new String(getHTML(),getEncoding());
127   - }
128   - catch(Exception e)
129   - {
  127 + }
  128 + catch(Exception e)
  129 + {
130 130 Log.e(TAG,e.getLocalizedMessage());
131   - return "";
  131 + return "";
132 132 }
133 133  
134 134 return text;
... ... @@ -140,106 +140,121 @@ public class PW3270Activity extends Activity
140 140 @Override
141 141 public void onCreate(Bundle savedInstanceState)
142 142 {
143   - SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
144   -
145 143 super.onCreate(savedInstanceState);
146   -
147   - res = getResources();
148   -
149   - // Cria dialogo para as mensagems de sistema
150   - dlgSysMessage = new ProgressDialog(this);
151   - dlgSysMessage.setCancelable(false);
152   - dlgSysMessage.setTitle(res.getString(R.string.wait));
  144 + res = getResources();
  145 + initUI();
  146 + }
153 147  
154   - /*
155   - dlgSysMessage.setButton(-2, "Desconectar", new DialogInterface.OnClickListener()
156   - {
  148 + protected void initUI()
  149 + {
  150 + boolean autoconnect = false;
  151 + SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
157 152  
158   - public void onClick(DialogInterface dialog, int which)
159   - {
160   - // TODO Auto-generated method stub
161   - }
162   -
163   - });
164   - */
165   -
166   - // Reference:
167   - // http://developer.android.com/reference/android/webkit/WebView.html
168   - view = new WebView(this);
  153 + Log.d(TAG, "Initializing UI");
169 154  
170   - host = new terminal(settings);
171   - view.addJavascriptInterface(host, "pw3270");
  155 + if(dlgSysMessage == null)
  156 + {
  157 + // Cria dialogo para as mensagems de sistema
  158 + Log.d(TAG, "Creating dlgSysMessage");
  159 + dlgSysMessage = new ProgressDialog(this);
  160 + dlgSysMessage.setCancelable(false);
  161 + dlgSysMessage.setTitle(res.getString(R.string.wait));
  162 + }
172 163  
173   - view.setWebChromeClient(new WebChromeClient());
174   -
175   - view.getSettings().setBuiltInZoomControls(true);
176   - view.getSettings().setSupportZoom(true);
177   - view.getSettings().setUseWideViewPort(true);
178   - view.getSettings().setLoadWithOverviewMode(true);
179   - view.getSettings().setJavaScriptEnabled(true);
180   -
181   - view.setWebViewClient(new WebViewClient()
  164 + if(host == null)
182 165 {
  166 + Log.d(TAG, "Creating terminal object");
  167 + host = new terminal(settings);
  168 + autoconnect = settings.getString("hostname","") != "" && settings.getBoolean("autoconnect",false);
  169 + }
183 170  
184   - @Override
185   - public WebResourceResponse shouldInterceptRequest(WebView view, String url)
  171 + if(view == null)
  172 + {
  173 + // Reference:
  174 + // http://developer.android.com/reference/android/webkit/WebView.html
  175 + Log.d(TAG, "Creating Webview");
  176 + view = new WebView(this);
  177 +
  178 + view.addJavascriptInterface(host, "pw3270");
  179 +
  180 + view.setWebChromeClient(new WebChromeClient());
  181 +
  182 + view.getSettings().setBuiltInZoomControls(true);
  183 + view.getSettings().setSupportZoom(true);
  184 + view.getSettings().setUseWideViewPort(true);
  185 + view.getSettings().setLoadWithOverviewMode(true);
  186 + view.getSettings().setJavaScriptEnabled(true);
  187 +
  188 + view.setWebViewClient(new WebViewClient()
186 189 {
187   - int id = R.raw.index;
188   - String mime = "text/html";
189   - int pos = url.lastIndexOf("/");
190   -
191   - if(pos >=0 )
192   - url = url.substring(pos+1);
193   -
194   - Log.i(TAG,"Loading [" + url + "]");
195   -
196   - if(url.equalsIgnoreCase("jsmain.js"))
  190 +
  191 + @Override
  192 + public WebResourceResponse shouldInterceptRequest(WebView view, String url)
197 193 {
198   - id = R.raw.jsmain;
  194 + int id = R.raw.index;
  195 + String mime = "text/html";
  196 + int pos = url.lastIndexOf("/");
  197 +
  198 + if(pos >=0 )
  199 + url = url.substring(pos+1);
  200 +
  201 + Log.i(TAG,"Loading [" + url + "]");
  202 +
  203 + if(url.equalsIgnoreCase("jsmain.js"))
  204 + {
  205 + id = R.raw.jsmain;
  206 + }
  207 + else if(url.equalsIgnoreCase("theme.css"))
  208 + {
  209 + mime = "text/css";
  210 + id = R.raw.theme;
  211 + }
  212 +
  213 + // http://developer.android.com/reference/android/webkit/WebResourceResponse.html
  214 + return new WebResourceResponse(mime,"utf-8",getResources().openRawResource(id));
199 215 }
200   - else if(url.equalsIgnoreCase("theme.css"))
201   - {
202   - mime = "text/css";
203   - id = R.raw.theme;
204   - }
205   -
206   - // http://developer.android.com/reference/android/webkit/WebResourceResponse.html
207   - return new WebResourceResponse(mime,"utf-8",getResources().openRawResource(id));
208   - }
209   -
210   - });
211   -
  216 +
  217 + });
  218 + }
  219 +
212 220 setContentView(view);
213 221 view.loadUrl("file:index.html");
214   -
215   - if(settings.getString("hostname","") != "" && settings.getBoolean("autoconnect",false))
  222 +
  223 + if(autoconnect)
216 224 host.connect();
217 225  
218 226 }
219 227  
  228 + @Override
  229 + public void onConfigurationChanged(Configuration newConfig)
  230 + {
  231 + super.onConfigurationChanged(newConfig);
  232 + initUI();
  233 + }
  234 +
220 235 @Override
221   - public boolean onCreateOptionsMenu(Menu menu)
  236 + public boolean onCreateOptionsMenu(Menu menu)
222 237 {
223 238 MenuInflater inflater = getMenuInflater();
224 239 Log.d(TAG,"Popup menu");
225 240 inflater.inflate(R.layout.menu, menu);
226 241 return true;
227   - }
228   -
  242 + }
  243 +
229 244 @Override
230   - public boolean onOptionsItemSelected(MenuItem item)
  245 + public boolean onOptionsItemSelected(MenuItem item)
231 246 {
232 247 // Handle item selection
233   - switch (item.getItemId())
  248 + switch (item.getItemId())
234 249 {
235 250 case R.id.connect:
236 251 host.connect();
237 252 break;
238   -
  253 +
239 254 case R.id.disconnect:
240 255 host.disconnect();
241 256 break;
242   -
  257 +
243 258 case R.id.settings:
244 259 Intent myIntent = new Intent(view.getContext(), SettingsActivity.class);
245 260 startActivityForResult(myIntent, 0);
... ... @@ -249,7 +264,7 @@ public class PW3270Activity extends Activity
249 264 return super.onOptionsItemSelected(item);
250 265 }
251 266 return true;
252   -
  267 +
253 268 }
254   -
  269 +
255 270 }
... ...
configure.ac
... ... @@ -116,6 +116,7 @@ case &quot;$host&quot; in
116 116 EXEEXT=".exe"
117 117 SOCKET_LIBS="-lws2_32"
118 118 CFLAGS="$CFLAGS -mms-bitfields"
  119 + localedir="locale"
119 120 DLL_FLAGS="-shared"
120 121 LDSOFLAGS="-Wl,-soname,\`basename \$@\`"
121 122 DBGRPATH=""
... ... @@ -354,7 +355,7 @@ AC_CONFIG_FILES([
354 355 src/pw3270/common/common.h
355 356 src/tools/Makefile
356 357 man/Makefile
357   -
  358 + makegtkruntime.sh
358 359 ])
359 360  
360 361 dnl Output the generated config.status script.
... ...
makegtkruntime.sh.in 0 → 100644
... ... @@ -0,0 +1,134 @@
  1 +#!/bin/bash
  2 +PKG_CONFIG="@PKG_CONFIG@"
  3 +GTK_VERSION="gtk+-@GTK_VERSION@"
  4 +
  5 +GTK_PREFIX=$($PKG_CONFIG --variable=prefix $GTK_VERSION)
  6 +TARGET_PATH=".bin/gtkruntime"
  7 +
  8 +# Clean target folder
  9 +rm -fr "$TARGET_PATH/*"
  10 +mkdir -p "$TARGET_PATH"
  11 +
  12 +# Build DLL list
  13 +TEMPFILE="temp1.tmp"
  14 +cat > $TEMPFILE << EOF
  15 +intl.dll
  16 +libatk-1.0-0.dll
  17 +libcairo-2.dll
  18 +libgailutil-18.dll
  19 +libgdk_pixbuf-2.0-0.dll
  20 +libgdk-win32-2.0-0.dll
  21 +libgettextlib-0-*.dll
  22 +libgettextpo*.dll
  23 +libgettextsrc*.dll
  24 +libgio-2.0-0.dll
  25 +libglib-2.0-0.dll
  26 +libgmodule-2.0-0.dll
  27 +libgobject-2.0-0.dll
  28 +libgthread-2.0-0.dll
  29 +libgtk-win32-2.0-0.dll
  30 +libpango-1.0-0.dll
  31 +libpangocairo-1.0-0.dll
  32 +libpangoft2-1.0-0.dll
  33 +libpangowin32-1.0-0.dll
  34 +zlib1.dll
  35 +libpng*.dll
  36 +libfontconfig*.dll
  37 +libasprintf*.dll
  38 +libgettextlib*.dll
  39 +libexpat*.dll
  40 +freetype*.dll
  41 +gspawn-win32-helper-console.exe
  42 +gspawn-win32-helper.exe
  43 +gdk-pixbuf-query-loaders.exe
  44 +EOF
  45 +
  46 +# jpeg62.dll
  47 +# libtiff*.dll
  48 +
  49 +while read FILE
  50 +do
  51 + FILEPATH=$(find "$GTK_PREFIX/bin" -name "$FILE")
  52 + if [ ! -z $FILEPATH ]; then
  53 + echo "$FILEPATH ..."
  54 + cp $FILEPATH "$TARGET_PATH"
  55 + if [ "$?" != "0" ]; then
  56 + echo "Can´t copy $FILEPATH"
  57 + exit -1
  58 + fi
  59 + else
  60 + echo "Can´t find $FILE"
  61 + fi
  62 +done < $TEMPFILE
  63 +rm -f $TEMPFILE
  64 +
  65 +# Build locale dirs
  66 +cat > $TEMPFILE << EOF
  67 +atk10.mo
  68 +gdk-pixbuf.mo
  69 +gettext-runtime.mo
  70 +gettext-tools.mo
  71 +glib20.mo
  72 +gtk20-properties.mo
  73 +gtk20.mo
  74 +libiconv.mo
  75 +EOF
  76 +
  77 +rm -fr $TARGET_PATH/share/locale/pt_BR/LC_MESSAGES
  78 +mkdir -p $TARGET_PATH/share/locale/pt_BR/LC_MESSAGES
  79 +
  80 +while read FILE
  81 +do
  82 + echo "$GTK_PREFIX/share/locale/pt_BR/LC_MESSAGES/$FILE ..."
  83 +
  84 + if [ -e "$GTK_PREFIX/share/locale/pt_BR/LC_MESSAGES/$FILE" ]; then
  85 + cp "$GTK_PREFIX/share/locale/pt_BR/LC_MESSAGES/$FILE" "$TARGET_PATH/share/locale/pt_BR/LC_MESSAGES"
  86 + if [ "$?" != "0" ]; then
  87 + echo "Can´t copy $FILE"
  88 + exit -1
  89 + fi
  90 + fi
  91 +
  92 +done < $TEMPFILE
  93 +rm -f $TEMPFILE
  94 +
  95 +# Copy default theme
  96 +THEME_PATH="themes/MS-Windows/gtk-2.0"
  97 +rm -fr "$TARGET_PATH/$THEME_PATH"
  98 +mkdir -p "$TARGET_PATH/share/$THEME_PATH"
  99 +
  100 +echo "$GTK_PREFIX/share/$THEME_PATH/gtkrc ..."
  101 +cp "$GTK_PREFIX/share/$THEME_PATH/gtkrc" "$TARGET_PATH/share/$THEME_PATH/gtkrc"
  102 +if [ "$?" != "0" ]; then
  103 + echo "Can´t copy default theme"
  104 + exit -1
  105 +fi
  106 +
  107 +cat > $TEMPFILE << EOF
  108 +engines
  109 +loaders
  110 +EOF
  111 +
  112 +rm -fr $TARGET_PATH/lib/gtk-2.0/$GTK_RUNTIME_VERSION/
  113 +mkdir -p $TARGET_PATH/lib/gtk-2.0/$GTK_RUNTIME_VERSION/
  114 +while read DIRNAME
  115 +do
  116 + if [ -d "$GTK_PREFIX/lib/gtk-2.0/$GTK_RUNTIME_VERSION/$DIRNAME" ]; then
  117 + echo "$GTK_PREFIX/lib/gtk-2.0/$GTK_RUNTIME_VERSION/$DIRNAME ..."
  118 + mkdir -p "$TARGET_PATH/lib/gtk-2.0/$GTK_RUNTIME_VERSION/$DIRNAME"
  119 + cp -r "$GTK_PREFIX/lib/gtk-2.0/$GTK_RUNTIME_VERSION/$DIRNAME" "$TARGET_PATH/lib/gtk-2.0/$GTK_RUNTIME_VERSION"
  120 + if [ "$?" != "0" ]; then
  121 + echo "Can´t copy $DIRNAME"
  122 + exit -1
  123 + fi
  124 + fi
  125 +done < $TEMPFILE
  126 +rm -f $TEMPFILE
  127 +
  128 +mkdir -p $TARGET_PATH/etc/gtk-2.0/
  129 +echo "gtk-theme-name = \"MS-Windows\"" > $TARGET_PATH/etc/gtk-2.0/gtkrc
  130 +if [ "$?" != "0" ]; then
  131 + echo "Can´t set theme name"
  132 + exit -1
  133 +fi
  134 +
... ...
po/pt_BR.po
... ... @@ -5,7 +5,7 @@ msgid &quot;&quot;
5 5 msgstr ""
6 6 "Project-Id-Version: pw3270 5.0\n"
7 7 "Report-Msgid-Bugs-To: \n"
8   -"POT-Creation-Date: 2012-08-13 16:38-0300\n"
  8 +"POT-Creation-Date: 2012-08-15 07:51-0300\n"
9 9 "PO-Revision-Date: 2012-08-13 12:14-0300\n"
10 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 11 "Language-Team: Português do Brasil <>\n"
... ...
pw3270.nsi.in
... ... @@ -62,9 +62,9 @@ SubSection &quot;@PACKAGE@&quot; SecMain
62 62 file "/oname=$INSTDIR\@PACKAGE@.ico" "src\pw3270\@PACKAGE@.ico"
63 63  
64 64 # Configuration files
65   - file "/oname=$INSTDIR\@PACKAGE@-logo.png" "@PACKAGE@-logo.png"
66   - file "/oname=$INSTDIR\@PACKAGE@.png" "@PACKAGE@.png"
67   - file "/oname=$INSTDIR\colors.conf" "colors.conf"
  65 + file "/oname=$INSTDIR\@PACKAGE@-logo.png" "src/pw3270/@PACKAGE@-logo.png"
  66 + file "/oname=$INSTDIR\@PACKAGE@.png" "src/pw3270/@PACKAGE@.png"
  67 + file "/oname=$INSTDIR\colors.conf" "colors.conf"
68 68  
69 69 # Documentation files
70 70 file "/oname=$INSTDIR\ChangeLog" "ChangeLog"
... ... @@ -78,7 +78,7 @@ SubSection &quot;@PACKAGE@&quot; SecMain
78 78  
79 79 # Locale files
80 80 CreateDirectory "$INSTDIR\@localedir@\pt_BR\LC_MESSAGES"
81   - file "/oname=$INSTDIR\@localedir@\pt_BR\LC_MESSAGES\@PACKAGE@.mo" ".bin\Release\usr\local\share\locale\pt_BR\LC_MESSAGES\@PACKAGE@.mo"
  81 + file "/oname=$INSTDIR\@localedir@\pt_BR\LC_MESSAGES\@PACKAGE@.mo" ".bin\Release\@localedir@\pt_BR\LC_MESSAGES\@PACKAGE@.mo"
82 82  
83 83 # define uninstaller name
84 84 writeUninstaller $INSTDIR\uninstall.exe
... ... @@ -126,14 +126,12 @@ SubSection &quot;@PACKAGE@&quot; SecMain
126 126 #
127 127 SubSectionEnd
128 128  
129   -#
130   -#Section /o "GTK+ Runtime" SecGTK
131   -#
132   -# setOutPath $INSTDIR
133   -# file /r ".bin\gtkruntime\*.*"
134   -#
135   -#SectionEnd
136   -#
  129 +Section /o "GTK+ Runtime" SecGTK
  130 +
  131 + setOutPath $INSTDIR
  132 + file /r ".bin\gtkruntime\*.*"
  133 +
  134 +SectionEnd
137 135  
138 136 Section /o "Software Development Kit" SecSDK
139 137  
... ... @@ -200,29 +198,29 @@ Function .onInit
200 198 #
201 199 #notRunning:
202 200  
203   -IfFileExists $PROGRAMFILES\ooRexx\rexx.exe RexxOK RexxNOK
204   -
205   -RexxOK:
206   - SectionGetFlags "${RexxPlugin}" $0
207   - IntOp $0 $0 | ${SF_SELECTED}
208   - SectionSetFlags "${RexxPlugin}" $0
209   -
210   - SectionGetFlags "${SecRexxLib}" $0
211   - IntOp $0 $0 | ${SF_SELECTED}
212   - SectionSetFlags "${SecRexxLib}" $0
213   -
214   -goto PastRexxCheck
215   -
216   -RexxNOK:
217   - SectionGetFlags "${RexxPlugin}" $0
218   - IntOp $0 $0 | ${SF_RO}
219   - SectionSetFlags "${RexxPlugin}" $0
220   -
221   - SectionGetFlags "${SecRexxLib}" $0
222   - IntOp $0 $0 | ${SF_RO}
223   - SectionSetFlags "${SecRexxLib}" $0
224   -
225   -PastRexxCheck:
  201 +#IfFileExists $PROGRAMFILES\ooRexx\rexx.exe RexxOK RexxNOK
  202 +#
  203 +#RexxOK:
  204 +# SectionGetFlags "${RexxPlugin}" $0
  205 +# IntOp $0 $0 | ${SF_SELECTED}
  206 +# SectionSetFlags "${RexxPlugin}" $0
  207 +#
  208 +# SectionGetFlags "${SecRexxLib}" $0
  209 +# IntOp $0 $0 | ${SF_SELECTED}
  210 +# SectionSetFlags "${SecRexxLib}" $0
  211 +#
  212 +#goto PastRexxCheck
  213 +#
  214 +#RexxNOK:
  215 +# SectionGetFlags "${RexxPlugin}" $0
  216 +# IntOp $0 $0 | ${SF_RO}
  217 +# SectionSetFlags "${RexxPlugin}" $0
  218 +#
  219 +# SectionGetFlags "${SecRexxLib}" $0
  220 +# IntOp $0 $0 | ${SF_RO}
  221 +# SectionSetFlags "${SecRexxLib}" $0
  222 +#
  223 +#PastRexxCheck:
226 224  
227 225 ReadRegStr $4 HKLM "Software\GTK2-Runtime" "DllPath"
228 226  
... ...