diff --git a/mac/Info.plist b/mac/Info.plist new file mode 100644 index 0000000..bea4d01 --- /dev/null +++ b/mac/Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + pw3270 + CFBundleGetInfoString + pw3270 - 5.0-0 + CFBundleIconFile + pw3270.icns + CFBundleIdentifier + pw3270 + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + pw3270-pw3270 © Banco do Brasil S.A. + CFBundleName + pw3270 + CFBundlePackageType + APPL + CFBundleShortVersionString + 5.0 + CFBundleSignature + ???? + CFBundleVersion + 5.0 + CSResourcesFileMapped + + LSRequiresCarbon + + NSHumanReadableCopyright + Copyright (C) 2008 Banco do Brasil S.A., GNU General Public License. + LSMinimumSystemVersion + 10.6 + + diff --git a/mac/launcher.sh b/mac/launcher.sh new file mode 100755 index 0000000..008e6ba --- /dev/null +++ b/mac/launcher.sh @@ -0,0 +1,168 @@ +#!/bin/sh + +if test "x$IGE_DEBUG_LAUNCHER" != x; then + set -x +fi + +if test "x$IGE_DEBUG_GDB" != x; then + EXEC="gdb --args" +else + EXEC=exec +fi + +name="`basename $0`" +tmp="`pwd`/$0" +tmp=`dirname "$tmp"` +tmp=`dirname "$tmp"` +bundle=`dirname "$tmp"` +bundle_contents="$bundle"/Contents +bundle_res="$bundle_contents"/Resources +bundle_lib="$bundle_res"/lib +bundle_bin="$bundle_res"/bin +bundle_data="$bundle_res"/share +bundle_etc="$bundle_res"/etc + +export DYLD_LIBRARY_PATH="$bundle_lib" +export XDG_CONFIG_DIRS="$bundle_etc"/xdg +export XDG_DATA_DIRS="$bundle_data" +export GTK_DATA_PREFIX="$bundle_res" +export GTK_EXE_PREFIX="$bundle_res" +export GTK_PATH="$bundle_res" + +export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc" +export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules" +export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders" +export PANGO_RC_FILE="$bundle_etc/pango/pangorc" + +APP=name +I18NDIR="$bundle_data/locale" +# Set the locale-related variables appropriately: +unset LANG LC_MESSAGES LC_MONETARY LC_COLLATE + +# Has a language ordering been set? +# If so, set LC_MESSAGES and LANG accordingly; otherwise skip it. +# First step uses sed to clean off the quotes and commas, to change - to _, and change the names for the chinese scripts from "Hans" to CN and "Hant" to TW. +APPLELANGUAGES=`defaults read .GlobalPreferences AppleLanguages | sed -En -e 's/\-/_/' -e 's/Hant/TW/' -e 's/Hans/CN/' -e 's/[[:space:]]*\"?([[:alnum:]_]+)\"?,?/\1/p' ` +if test "$APPLELANGUAGES"; then + # A language ordering exists. + # Test, item per item, to see whether there is an corresponding locale. + for L in $APPLELANGUAGES; do + #test for exact matches: + if test -f "$I18NDIR/${L}/LC_MESSAGES/$APP.mo"; then + export LANG=$L + break + fi + #This is a special case, because often the original strings are in US + #English and there is no translation file. + if test "x$L" == "xen_US"; then + export LANG=$L + break + fi + #OK, now test for just the first two letters: + if test -f "$I18NDIR/${L:0:2}/LC_MESSAGES/$APP.mo"; then + export LANG=${L:0:2} + break + fi + #Same thing, but checking for any english variant. + if test "x${L:0:2}" == "xen"; then + export LANG=$L + break + fi; + done +fi +unset APPLELANGUAGES L + +# If we didn't get a language from the language list, try the Collation preference, in case it's the only setting that exists. +APPLECOLLATION=`defaults read .GlobalPreferences AppleCollationOrder` +if test -z ${LANG} -a -n $APPLECOLLATION; then + if test -f "$I18NDIR/${APPLECOLLATION:0:2}/LC_MESSAGES/$APP.mo"; then + export LANG=${APPLECOLLATION:0:2} + fi +fi +if test ! -z $APPLECOLLATION; then + export LC_COLLATE=$APPLECOLLATION +fi +unset APPLECOLLATION + +# Continue by attempting to find the Locale preference. +APPLELOCALE=`defaults read .GlobalPreferences AppleLocale` + +if test -f "$I18NDIR/${APPLELOCALE:0:5}/LC_MESSAGES/$APP.mo"; then + if test -z $LANG; then + export LANG="${APPLELOCALE:0:5}" + fi + +elif test -z $LANG -a -f "$I18NDIR/${APPLELOCALE:0:2}/LC_MESSAGES/$APP.mo"; then + export LANG="${APPLELOCALE:0:2}" +fi + +#Next we need to set LC_MESSAGES. If at all possilbe, we want a full +#5-character locale to avoid the "Locale not supported by C library" +#warning from Gtk -- even though Gtk will translate with a +#two-character code. +if test -n $LANG; then +#If the language code matches the applelocale, then that's the message +#locale; otherwise, if it's longer than two characters, then it's +#probably a good message locale and we'll go with it. + if test $LANG == ${APPLELOCALE:0:5} -o $LANG != ${LANG:0:2}; then + export LC_MESSAGES=$LANG +#Next try if the Applelocale is longer than 2 chars and the language +#bit matches $LANG + elif test $LANG == ${APPLELOCALE:0:2} -a $APPLELOCALE > ${APPLELOCALE:0:2}; then + export LC_MESSAGES=${APPLELOCALE:0:5} +#Fail. Get a list of the locales in $PREFIX/share/locale that match +#our two letter language code and pick the first one, special casing +#english to set en_US + elif test $LANG == "en"; then + export LC_MESSAGES="en_US" + else + LOC=`find $PREFIX/share/locale -name $LANG???` + for L in $LOC; do + export LC_MESSAGES=$L + done + fi +else +#All efforts have failed, so default to US english + export LANG="en_US" + export LC_MESSAGES="en_US" +fi +CURRENCY=`echo $APPLELOCALE | sed -En 's/.*currency=([[:alpha:]]+).*/\1/p'` +if test "x$CURRENCY" != "x"; then +#The user has set a special currency. Gtk doesn't install LC_MONETARY files, but Apple does in /usr/share/locale, so we're going to look there for a locale to set LC_CURRENCY to. + if test -f /usr/local/share/$LC_MESSAGES/LC_MONETARY; then + if test -a `cat /usr/local/share/$LC_MESSAGES/LC_MONETARY` == $CURRENCY; then + export LC_MONETARY=$LC_MESSAGES + fi + fi + if test -z "$LC_MONETARY"; then + FILES=`find /usr/share/locale -name LC_MONETARY -exec grep -H $CURRENCY {} \;` + if test -n "$FILES"; then + export LC_MONETARY=`echo $FILES | sed -En 's%/usr/share/locale/([[:alpha:]_]+)/LC_MONETARY.*%\1%p'` + fi + fi +fi +#No currency value means that the AppleLocale governs: +if test -z "$LC_MONETARY"; then + LC_MONETARY=${APPLELOCALE:0:5} +fi +#For Gtk, which only looks at LC_ALL: +export LC_ALL=$LC_MESSAGES + +unset APPLELOCALE FILES LOC + +if test -f "$bundle_lib/charset.alias"; then + export CHARSETALIASDIR="$bundle_lib" +fi + +# Extra arguments can be added in environment.sh. +EXTRA_ARGS= +if test -f "$bundle_res/environment.sh"; then + source "$bundle_res/environment.sh" +fi + +# Strip out the argument added by the OS. +if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then + shift 1 +fi + +$EXEC "$bundle_contents/MacOS/$name-bin" $* $EXTRA_ARGS diff --git a/mac/pw3270.icns b/mac/pw3270.icns new file mode 100644 index 0000000..e68e4a0 Binary files /dev/null and b/mac/pw3270.icns differ diff --git a/po/pt_BR.po b/po/pt_BR.po index d83ffec..d209324 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-30 23:17-0300\n" +"POT-Creation-Date: 2012-08-31 04:17-0300\n" "PO-Revision-Date: 2012-08-27 09:01-0300\n" "Last-Translator: Perry Werneck \n" "Language-Team: Português do Brasil <>\n" diff --git a/pw3270.xcodeproj/project.pbxproj b/pw3270.xcodeproj/project.pbxproj index 22718e1..56df99c 100644 --- a/pw3270.xcodeproj/project.pbxproj +++ b/pw3270.xcodeproj/project.pbxproj @@ -257,9 +257,9 @@ C272076B15D7FBF700CCCD22 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; C272076C15D7FBF700CCCD22 /* Makefile.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.in; sourceTree = ""; }; C272076D15D7FBF700CCCD22 /* xml2pot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xml2pot.c; sourceTree = ""; }; - C2C3E14515F0503B00B02C1C /* pw3270.bundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = pw3270.bundle; sourceTree = ""; }; C2C3E14D15F0598900B02C1C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = mac/Info.plist; sourceTree = ""; }; C2C3E14E15F0598900B02C1C /* launcher.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = launcher.sh; path = mac/launcher.sh; sourceTree = ""; }; + C2C3E15015F09BE200B02C1C /* pw3270.bundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = pw3270.bundle; sourceTree = ""; }; C2C4DAD815D8282600E8C6A0 /* autogen.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = autogen.sh; sourceTree = ""; }; /* End PBXFileReference section */ @@ -679,9 +679,9 @@ C2C3E14715F0547300B02C1C /* Bundle */ = { isa = PBXGroup; children = ( + C2C3E15015F09BE200B02C1C /* pw3270.bundle */, C2C3E14D15F0598900B02C1C /* Info.plist */, C2C3E14E15F0598900B02C1C /* launcher.sh */, - C2C3E14515F0503B00B02C1C /* pw3270.bundle */, ); name = Bundle; sourceTree = ""; diff --git a/src/pw3270/main.c b/src/pw3270/main.c index d8238a5..9de7f20 100644 --- a/src/pw3270/main.c +++ b/src/pw3270/main.c @@ -36,16 +36,13 @@ #include "v3270/accessible.h" #include -#ifdef HAVE_GTKMAC - #include -#endif // HAVE_GTKMAC - /*--[ Statics ]--------------------------------------------------------------------------------------*/ static GtkWidget *toplevel = NULL; #ifdef HAVE_GTKMAC - static GtkOSXApplication * osxapp = NULL; + GtkOSXApplication * osxapp = NULL; + GtkMacBundle * macbundle = NULL; #endif // HAVE_GTKMAC /*--[ Implement ]------------------------------------------------------------------------------------*/ @@ -153,17 +150,14 @@ int main(int argc, char *argv[]) #elif defined(HAVE_GTKMAC) { osxapp = GTK_OSX_APPLICATION(g_object_new(GTK_TYPE_OSX_APPLICATION,NULL)); - - - gchar * appdir = g_build_filename(DATAROOTDIR,PACKAGE_NAME,NULL); - gchar * locdir = g_build_filename(DATAROOTDIR,"locale",NULL); - - g_chdir(appdir); - bindtextdomain( PACKAGE_NAME, locdir); - - g_free(locdir); - g_free(appdir); - + + macbundle = gtk_mac_bundle_get_default(); + if(!macbundle) + macbundle = gtk_mac_bundle_new(); + + g_chdir(gtk_mac_bundle_get_datadir(macbundle)); + bindtextdomain(PACKAGE_NAME,gtk_mac_bundle_get_localedir(macbundle)); + } #elif defined( DATAROOTDIR ) { -- libgit2 0.21.2