mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-06-11 09:20:19 +00:00
Compare commits
11 Commits
upnp-dcc-s
...
offline-do
| Author | SHA1 | Date | |
|---|---|---|---|
| ba2871dc55 | |||
| a14080523e | |||
| a5cc0c6776 | |||
| 337d7684e4 | |||
|
|
090b39f78b | ||
| 3722de6b13 | |||
|
|
d93c9aa780 | ||
| ea56504aee | |||
| 46b91edfdf | |||
|
|
d2dfde519d | ||
| 1eac56f22c |
39
.github/workflows/appimage-build.yml
vendored
39
.github/workflows/appimage-build.yml
vendored
@@ -62,6 +62,11 @@ jobs:
|
|||||||
rm -rf AppDir
|
rm -rf AppDir
|
||||||
DESTDIR="${PWD}/AppDir" ninja -C build install
|
DESTDIR="${PWD}/AppDir" ninja -C build install
|
||||||
|
|
||||||
|
- name: Verify offline docs install
|
||||||
|
run: |
|
||||||
|
set -eux
|
||||||
|
test -f AppDir/usr/share/doc/zoitechat/html/index.html
|
||||||
|
|
||||||
- name: Bundle scripting runtimes in AppDir
|
- name: Bundle scripting runtimes in AppDir
|
||||||
run: |
|
run: |
|
||||||
set -eux
|
set -eux
|
||||||
@@ -86,11 +91,21 @@ jobs:
|
|||||||
cp -a /usr/lib/x86_64-linux-gnu/python3/dist-packages AppDir/usr/lib/x86_64-linux-gnu/python3/
|
cp -a /usr/lib/x86_64-linux-gnu/python3/dist-packages AppDir/usr/lib/x86_64-linux-gnu/python3/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -d "/usr/lib/x86_64-linux-gnu/perl-base" ]; then
|
||||||
|
install -d AppDir/usr/lib/x86_64-linux-gnu
|
||||||
|
cp -a /usr/lib/x86_64-linux-gnu/perl-base AppDir/usr/lib/x86_64-linux-gnu/
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d "/usr/lib/x86_64-linux-gnu/perl" ]; then
|
if [ -d "/usr/lib/x86_64-linux-gnu/perl" ]; then
|
||||||
install -d AppDir/usr/lib/x86_64-linux-gnu
|
install -d AppDir/usr/lib/x86_64-linux-gnu
|
||||||
cp -a /usr/lib/x86_64-linux-gnu/perl AppDir/usr/lib/x86_64-linux-gnu/
|
cp -a /usr/lib/x86_64-linux-gnu/perl AppDir/usr/lib/x86_64-linux-gnu/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -d "/usr/lib/x86_64-linux-gnu/perl5" ]; then
|
||||||
|
install -d AppDir/usr/lib/x86_64-linux-gnu
|
||||||
|
cp -a /usr/lib/x86_64-linux-gnu/perl5 AppDir/usr/lib/x86_64-linux-gnu/
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d "/usr/share/perl" ]; then
|
if [ -d "/usr/share/perl" ]; then
|
||||||
install -d AppDir/usr/share
|
install -d AppDir/usr/share
|
||||||
cp -a /usr/share/perl AppDir/usr/share/
|
cp -a /usr/share/perl AppDir/usr/share/
|
||||||
@@ -100,6 +115,10 @@ jobs:
|
|||||||
install -d AppDir/usr/share
|
install -d AppDir/usr/share
|
||||||
cp -a /usr/share/perl5 AppDir/usr/share/
|
cp -a /usr/share/perl5 AppDir/usr/share/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
perl -MFile::Spec -e 'print "Build host File::Spec: $INC{\"File/Spec.pm\"}\n"'
|
||||||
|
find AppDir/usr -path '*/File/Spec.pm' -print -quit | grep -q .
|
||||||
|
|
||||||
if compgen -G '/usr/lib/x86_64-linux-gnu/libpython3*.so*' > /dev/null; then
|
if compgen -G '/usr/lib/x86_64-linux-gnu/libpython3*.so*' > /dev/null; then
|
||||||
install -d AppDir/usr/lib/x86_64-linux-gnu
|
install -d AppDir/usr/lib/x86_64-linux-gnu
|
||||||
cp -a /usr/lib/x86_64-linux-gnu/libpython3*.so* AppDir/usr/lib/x86_64-linux-gnu/
|
cp -a /usr/lib/x86_64-linux-gnu/libpython3*.so* AppDir/usr/lib/x86_64-linux-gnu/
|
||||||
@@ -162,7 +181,7 @@ jobs:
|
|||||||
|
|
||||||
APPDIR="${APPDIR:-$(dirname "$(readlink -f "$0")")}"
|
APPDIR="${APPDIR:-$(dirname "$(readlink -f "$0")")}"
|
||||||
|
|
||||||
export PATH="${PATH:-/usr/bin:/bin}:$APPDIR/usr/bin"
|
export PATH="$APPDIR/usr/bin:${PATH:-/usr/bin:/bin}"
|
||||||
export LD_LIBRARY_PATH="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH:-}"
|
export LD_LIBRARY_PATH="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH:-}"
|
||||||
export XDG_DATA_DIRS="$APPDIR/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
|
export XDG_DATA_DIRS="$APPDIR/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
|
||||||
export GTK_EXE_PREFIX="$APPDIR/usr"
|
export GTK_EXE_PREFIX="$APPDIR/usr"
|
||||||
@@ -211,6 +230,23 @@ jobs:
|
|||||||
|
|
||||||
unset GTK_MODULES
|
unset GTK_MODULES
|
||||||
|
|
||||||
|
perl5lib_entries=""
|
||||||
|
for dir in \
|
||||||
|
"$APPDIR/usr/lib/x86_64-linux-gnu/perl-base" \
|
||||||
|
"$APPDIR/usr/lib/x86_64-linux-gnu/perl"/* \
|
||||||
|
"$APPDIR/usr/lib/x86_64-linux-gnu/perl5"/* \
|
||||||
|
"$APPDIR/usr/share/perl"/* \
|
||||||
|
"$APPDIR/usr/share/perl5"
|
||||||
|
do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
perl5lib_entries="${perl5lib_entries:+$perl5lib_entries:}$dir"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "$perl5lib_entries" ]; then
|
||||||
|
export PERL5LIB="$perl5lib_entries${PERL5LIB:+:$PERL5LIB}"
|
||||||
|
fi
|
||||||
|
|
||||||
export PYTHONHOME="$APPDIR/usr"
|
export PYTHONHOME="$APPDIR/usr"
|
||||||
python_stdlib_dir="$(find "$APPDIR/usr/lib" -maxdepth 1 -type d -name 'python3.*' | head -n 1 || true)"
|
python_stdlib_dir="$(find "$APPDIR/usr/lib" -maxdepth 1 -type d -name 'python3.*' | head -n 1 || true)"
|
||||||
pythonpath_entries=""
|
pythonpath_entries=""
|
||||||
@@ -256,7 +292,6 @@ jobs:
|
|||||||
EOF
|
EOF
|
||||||
chmod +x AppRun
|
chmod +x AppRun
|
||||||
|
|
||||||
|
|
||||||
VERSION="$(git describe --tags --always)"
|
VERSION="$(git describe --tags --always)"
|
||||||
|
|
||||||
./linuxdeploy-x86_64.AppImage \
|
./linuxdeploy-x86_64.AppImage \
|
||||||
|
|||||||
6
.github/workflows/flatpak-build.yml
vendored
6
.github/workflows/flatpak-build.yml
vendored
@@ -37,6 +37,12 @@ jobs:
|
|||||||
cache: false
|
cache: false
|
||||||
restore-cache: false
|
restore-cache: false
|
||||||
|
|
||||||
|
- name: Verify offline docs install
|
||||||
|
run: |
|
||||||
|
flatpak --user install -y zoitechat.flatpak
|
||||||
|
app_dir="$(flatpak info --user --show-location net.zoite.Zoitechat)"
|
||||||
|
test -f "$app_dir/files/share/zoitechat/offline-docs/index.html"
|
||||||
|
|
||||||
- name: Upload Flatpak Bundle
|
- name: Upload Flatpak Bundle
|
||||||
id: upload_flatpak
|
id: upload_flatpak
|
||||||
uses: actions/upload-artifact@v6
|
uses: actions/upload-artifact@v6
|
||||||
|
|||||||
10
.github/workflows/windows-build.yml
vendored
10
.github/workflows/windows-build.yml
vendored
@@ -132,6 +132,16 @@ jobs:
|
|||||||
msbuild win32\zoitechat.sln /m /verbosity:minimal /p:Configuration=Release /p:Platform=${{ matrix.platform }}
|
msbuild win32\zoitechat.sln /m /verbosity:minimal /p:Configuration=Release /p:Platform=${{ matrix.platform }}
|
||||||
shell: cmd
|
shell: cmd
|
||||||
|
|
||||||
|
- name: Verify offline docs install
|
||||||
|
run: |
|
||||||
|
if not exist "..\zoitechat-build\${{ matrix.platform }}\rel\offline-docs\index.html" exit /b 1
|
||||||
|
findstr /C:"Name:" "..\zoitechat-build\${{ matrix.platform }}\bin\zoitechat.iss" | findstr /C:"docs"
|
||||||
|
findstr /C:"OFFLINEDOCSURL" "..\zoitechat-build\${{ matrix.platform }}\bin\zoitechat.iss"
|
||||||
|
findstr /C:"Source:" "..\zoitechat-build\${{ matrix.platform }}\bin\zoitechat.iss" | findstr /C:"offline-docs"
|
||||||
|
findstr /C:"offline-docs.tar.gz" "..\zoitechat-build\${{ matrix.platform }}\bin\zoitechat.iss"
|
||||||
|
findstr /C:"InstallOfflineDocs" "..\zoitechat-build\${{ matrix.platform }}\bin\zoitechat.iss"
|
||||||
|
shell: cmd
|
||||||
|
|
||||||
- name: Preparing Artifacts
|
- name: Preparing Artifacts
|
||||||
run: |
|
run: |
|
||||||
move ..\zoitechat-build\${{ matrix.platform }}\ZoiteChat-*.exe .\
|
move ..\zoitechat-build\${{ matrix.platform }}\ZoiteChat-*.exe .\
|
||||||
|
|||||||
@@ -7,3 +7,15 @@ if get_option('gtk-frontend')
|
|||||||
subdir('misc')
|
subdir('misc')
|
||||||
subdir('man')
|
subdir('man')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
offline_docs_url = get_option('offline-docs-url')
|
||||||
|
offline_docs = custom_target('offline-docs',
|
||||||
|
output: 'offline-docs.stamp',
|
||||||
|
command: [find_program('python3'), files('misc/fetch_offline_docs.py'), offline_docs_url, '@OUTDIR@', meson.source_root()],
|
||||||
|
build_by_default: true,
|
||||||
|
)
|
||||||
|
meson.add_install_script(
|
||||||
|
files('misc/install_offline_docs.py'),
|
||||||
|
join_paths(meson.current_build_dir(), 'offline-docs'),
|
||||||
|
offline_docs_dir,
|
||||||
|
)
|
||||||
|
|||||||
89
data/misc/fetch_offline_docs.py
Normal file
89
data/misc/fetch_offline_docs.py
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import html
|
||||||
|
import io
|
||||||
|
import pathlib
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
import tarfile
|
||||||
|
import tempfile
|
||||||
|
import urllib.error
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
|
|
||||||
|
url = sys.argv[1]
|
||||||
|
out_dir = pathlib.Path(sys.argv[2])
|
||||||
|
source_dir = pathlib.Path(sys.argv[3]) if len(sys.argv) > 3 else pathlib.Path.cwd()
|
||||||
|
docs_dir = out_dir / "offline-docs"
|
||||||
|
|
||||||
|
if docs_dir.exists():
|
||||||
|
shutil.rmtree(docs_dir)
|
||||||
|
docs_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
|
def write_source_docs() -> None:
|
||||||
|
parts = [
|
||||||
|
'<!doctype html><html><head><meta charset="utf-8">'
|
||||||
|
"<title>ZoiteChat Documentation</title></head><body>"
|
||||||
|
"<h1>ZoiteChat Documentation</h1>"
|
||||||
|
]
|
||||||
|
|
||||||
|
for name in ("readme.md", "troubleshooting.md", "changelog.rst"):
|
||||||
|
path = source_dir / name
|
||||||
|
if path.exists():
|
||||||
|
parts.append(
|
||||||
|
f"<h2>{html.escape(name)}</h2>"
|
||||||
|
f"<pre>{html.escape(path.read_text(encoding='utf-8', errors='replace'))}</pre>"
|
||||||
|
)
|
||||||
|
|
||||||
|
parts.append("</body></html>")
|
||||||
|
(docs_dir / "index.html").write_text("\n".join(parts), encoding="utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
def safe_extract(tar: tarfile.TarFile, target: pathlib.Path) -> None:
|
||||||
|
target = target.resolve()
|
||||||
|
|
||||||
|
for member in tar.getmembers():
|
||||||
|
member_path = (target / member.name).resolve()
|
||||||
|
if not str(member_path).startswith(str(target) + "/"):
|
||||||
|
raise tarfile.TarError(f"unsafe archive path: {member.name}")
|
||||||
|
|
||||||
|
tar.extractall(target)
|
||||||
|
|
||||||
|
|
||||||
|
def copy_index_tree(extracted_dir: pathlib.Path) -> bool:
|
||||||
|
indexes = sorted(extracted_dir.rglob("index.html"))
|
||||||
|
if not indexes:
|
||||||
|
return False
|
||||||
|
|
||||||
|
root = indexes[0].parent
|
||||||
|
for item in root.iterdir():
|
||||||
|
dest = docs_dir / item.name
|
||||||
|
if item.is_dir():
|
||||||
|
shutil.copytree(item, dest, dirs_exist_ok=True)
|
||||||
|
else:
|
||||||
|
shutil.copy2(item, dest)
|
||||||
|
|
||||||
|
return (docs_dir / "index.html").exists()
|
||||||
|
|
||||||
|
|
||||||
|
if url:
|
||||||
|
try:
|
||||||
|
with urllib.request.urlopen(url, timeout=30) as response:
|
||||||
|
data = response.read()
|
||||||
|
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
extract_dir = pathlib.Path(tmp)
|
||||||
|
with tarfile.open(fileobj=io.BytesIO(data), mode="r:gz") as tar:
|
||||||
|
safe_extract(tar, extract_dir)
|
||||||
|
|
||||||
|
if not copy_index_tree(extract_dir):
|
||||||
|
write_source_docs()
|
||||||
|
|
||||||
|
except (OSError, tarfile.TarError, urllib.error.URLError) as error:
|
||||||
|
print(f"offline docs download failed: {error}", file=sys.stderr)
|
||||||
|
write_source_docs()
|
||||||
|
else:
|
||||||
|
write_source_docs()
|
||||||
|
|
||||||
|
(out_dir / "offline-docs.stamp").write_text("ok", encoding="utf-8")
|
||||||
13
data/misc/install_offline_docs.py
Normal file
13
data/misc/install_offline_docs.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import os
|
||||||
|
import pathlib
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
|
src = pathlib.Path(sys.argv[1])
|
||||||
|
dest = pathlib.Path(os.environ['MESON_INSTALL_DESTDIR_PREFIX']) / sys.argv[2]
|
||||||
|
if not (src / 'index.html').exists():
|
||||||
|
sys.exit(0)
|
||||||
|
if dest.exists():
|
||||||
|
shutil.rmtree(dest)
|
||||||
|
shutil.copytree(src, dest)
|
||||||
@@ -56,7 +56,9 @@
|
|||||||
"-Ddbus-service-use-appid=true",
|
"-Ddbus-service-use-appid=true",
|
||||||
"-Dwith-perl=perl",
|
"-Dwith-perl=perl",
|
||||||
"-Dwith-python=python3",
|
"-Dwith-python=python3",
|
||||||
"-Dwith-lua=lua"
|
"-Dwith-lua=lua",
|
||||||
|
"-Doffline-docs-package=net.zoite.Zoitechat",
|
||||||
|
"-Doffline-docs-dir=share/zoitechat/offline-docs"
|
||||||
],
|
],
|
||||||
"build-options": {
|
"build-options": {
|
||||||
"cflags": "-Wno-error=missing-include-dirs"
|
"cflags": "-Wno-error=missing-include-dirs"
|
||||||
|
|||||||
10
meson.build
10
meson.build
@@ -32,8 +32,18 @@ config_h = configuration_data()
|
|||||||
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
|
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||||
config_h.set_quoted('PACKAGE_NAME', meson.project_name())
|
config_h.set_quoted('PACKAGE_NAME', meson.project_name())
|
||||||
config_h.set_quoted('GETTEXT_PACKAGE', 'zoitechat')
|
config_h.set_quoted('GETTEXT_PACKAGE', 'zoitechat')
|
||||||
|
offline_docs_package = get_option('offline-docs-package')
|
||||||
|
if offline_docs_package == ''
|
||||||
|
offline_docs_package = meson.project_name()
|
||||||
|
endif
|
||||||
|
offline_docs_dir = get_option('offline-docs-dir')
|
||||||
|
if offline_docs_dir == ''
|
||||||
|
offline_docs_dir = join_paths(get_option('datadir'), 'doc', offline_docs_package, 'html')
|
||||||
|
endif
|
||||||
config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'),
|
config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'),
|
||||||
get_option('datadir'), 'locale'))
|
get_option('datadir'), 'locale'))
|
||||||
|
config_h.set_quoted('ZOITECHATDOCDIR', join_paths(get_option('prefix'),
|
||||||
|
offline_docs_dir))
|
||||||
config_h.set10('ENABLE_NLS', true)
|
config_h.set10('ENABLE_NLS', true)
|
||||||
|
|
||||||
# Optional features
|
# Optional features
|
||||||
|
|||||||
@@ -62,3 +62,13 @@ option('with-upd', type: 'boolean',
|
|||||||
option('with-perl-legacy-api', type: 'boolean', value: false,
|
option('with-perl-legacy-api', type: 'boolean', value: false,
|
||||||
description: 'Enables the legacy IRC perl module for compatibility with old scripts'
|
description: 'Enables the legacy IRC perl module for compatibility with old scripts'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option('offline-docs-url', type: 'string', value: 'https://dl.zoitechat.org/offlinedocs/zoitechat-docs-html-2.18.1.tar.gz',
|
||||||
|
description: 'URL for offline documentation archive (tar.gz)'
|
||||||
|
)
|
||||||
|
option('offline-docs-package', type: 'string', value: '',
|
||||||
|
description: 'Package or app id to use under the installed documentation directory'
|
||||||
|
)
|
||||||
|
option('offline-docs-dir', type: 'string', value: '',
|
||||||
|
description: 'Installed offline documentation directory relative to prefix'
|
||||||
|
)
|
||||||
|
|||||||
@@ -66,4 +66,5 @@ build() {
|
|||||||
|
|
||||||
package() {
|
package() {
|
||||||
meson install -C build --destdir "$pkgdir"
|
meson install -C build --destdir "$pkgdir"
|
||||||
|
test -f "$pkgdir/usr/share/doc/zoitechat/html/index.html"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ REM zoitechat.rc needs to be in UCS-2 or Resource Compiler will complain
|
|||||||
powershell "Get-Content -Encoding UTF8 '$(ZoiteChatLib)zoitechat.rc.utf8' | Out-File '$(ZoiteChatLib)zoitechat.rc'; Remove-Item '$(ZoiteChatLib)zoitechat.rc.utf8'"
|
powershell "Get-Content -Encoding UTF8 '$(ZoiteChatLib)zoitechat.rc.utf8' | Out-File '$(ZoiteChatLib)zoitechat.rc'; Remove-Item '$(ZoiteChatLib)zoitechat.rc.utf8'"
|
||||||
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-header --manual-register --sourcedir "$(DataDir)" --target "$(ZoiteChatLib)resources.h" "$(DataDir)zoitechat.gresource.xml"
|
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-header --manual-register --sourcedir "$(DataDir)" --target "$(ZoiteChatLib)resources.h" "$(DataDir)zoitechat.gresource.xml"
|
||||||
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-source --manual-register --sourcedir "$(DataDir)" --target "$(ZoiteChatLib)resources.c" "$(DataDir)zoitechat.gresource.xml"
|
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-source --manual-register --sourcedir "$(DataDir)" --target "$(ZoiteChatLib)resources.c" "$(DataDir)zoitechat.gresource.xml"
|
||||||
|
"$(Python3Path)\python.exe" "$(DataDir)misc\fetch_offline_docs.py" "$(OfflineDocsUrl)" "$(ZoiteChatRel)." "$(SolutionDir).."
|
||||||
]]></Command>
|
]]></Command>
|
||||||
<Message>Build zoitechat.rc and gresource file</Message>
|
<Message>Build zoitechat.rc and gresource file</Message>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
|
|||||||
@@ -272,13 +272,6 @@ gtkutil_apply_palette (GtkWidget *widget, const GdkRGBA *bg, const GdkRGBA *fg,
|
|||||||
theme_manager_apply_palette_widget (widget, bg, fg, font_desc);
|
theme_manager_apply_palette_widget (widget, bg, fg, font_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtkutil_file_req_destroy (GtkWidget * wid, struct file_req *freq)
|
|
||||||
{
|
|
||||||
freq->callback (freq->userdata, NULL);
|
|
||||||
g_free (freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtkutil_check_file (char *filename, struct file_req *freq)
|
gtkutil_check_file (char *filename, struct file_req *freq)
|
||||||
{
|
{
|
||||||
@@ -390,26 +383,6 @@ gtkutil_file_req_done_chooser (GtkFileChooser *fs, struct file_req *freq)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtkutil_file_req_done (GtkWidget * wid, struct file_req *freq)
|
|
||||||
{
|
|
||||||
gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (freq->dialog), freq);
|
|
||||||
gtk_widget_destroy (freq->dialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtkutil_file_req_response (GtkWidget *dialog, gint res, struct file_req *freq)
|
|
||||||
{
|
|
||||||
if (res == GTK_RESPONSE_ACCEPT)
|
|
||||||
{
|
|
||||||
gtkutil_file_req_done (dialog, freq);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_destroy (dialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtkutil_native_dialog_unref_idle (gpointer native)
|
gtkutil_native_dialog_unref_idle (gpointer native)
|
||||||
{
|
{
|
||||||
@@ -423,27 +396,16 @@ gtkutil_native_file_req_response (GtkNativeDialog *dialog, gint res, struct file
|
|||||||
if (res == GTK_RESPONSE_ACCEPT)
|
if (res == GTK_RESPONSE_ACCEPT)
|
||||||
gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (dialog), freq);
|
gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (dialog), freq);
|
||||||
|
|
||||||
/* Match gtk dialog flow by always sending NULL to indicate completion. */
|
|
||||||
freq->callback (freq->userdata, NULL);
|
freq->callback (freq->userdata, NULL);
|
||||||
g_free (freq);
|
g_free (freq);
|
||||||
|
|
||||||
/*
|
|
||||||
* Defer unref until idle to avoid disposing the native chooser while
|
|
||||||
* still in the button-release signal stack on Windows.
|
|
||||||
*/
|
|
||||||
g_idle_add (gtkutil_native_dialog_unref_idle, dialog);
|
g_idle_add (gtkutil_native_dialog_unref_idle, dialog);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *userdata, char *filter, char *extensions,
|
gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *userdata, char *filter, char *extensions,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
struct file_req *freq;
|
struct file_req *freq;
|
||||||
GtkWidget *dialog;
|
|
||||||
GtkFileFilter *filefilter;
|
|
||||||
char *token;
|
|
||||||
char *tokenbuffer;
|
|
||||||
const char *xdir;
|
const char *xdir;
|
||||||
GtkWindow *effective_parent = parent;
|
GtkWindow *effective_parent = parent;
|
||||||
|
|
||||||
@@ -453,7 +415,6 @@ gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *us
|
|||||||
|
|
||||||
xdir = get_xdir ();
|
xdir = get_xdir ();
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
{
|
{
|
||||||
GtkFileChooserNative *native = gtk_file_chooser_native_new (
|
GtkFileChooserNative *native = gtk_file_chooser_native_new (
|
||||||
title,
|
title,
|
||||||
@@ -529,107 +490,7 @@ gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *us
|
|||||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
|
gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (flags & FRF_WRITE)
|
|
||||||
{
|
|
||||||
dialog = gtk_file_chooser_dialog_new (title, NULL,
|
|
||||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
|
||||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
||||||
_("_Save"), GTK_RESPONSE_ACCEPT,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (!(flags & FRF_NOASKOVERWRITE))
|
|
||||||
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
dialog = gtk_file_chooser_dialog_new (title, NULL,
|
|
||||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
|
||||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
||||||
_("_Open"), GTK_RESPONSE_ACCEPT,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
theme_manager_attach_window (dialog);
|
|
||||||
|
|
||||||
if (filter && filter[0] && (flags & FRF_FILTERISINITIAL))
|
|
||||||
{
|
|
||||||
if (flags & FRF_WRITE)
|
|
||||||
{
|
|
||||||
char temp[1024];
|
|
||||||
path_part (filter, temp, sizeof (temp));
|
|
||||||
if (temp[0] && g_file_test (temp, G_FILE_TEST_IS_DIR))
|
|
||||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), temp);
|
|
||||||
else if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
|
|
||||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
|
|
||||||
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file_part (filter));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (g_file_test (filter, G_FILE_TEST_IS_DIR))
|
|
||||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), filter);
|
|
||||||
else if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
|
|
||||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!(flags & FRF_RECENTLYUSED))
|
|
||||||
{
|
|
||||||
if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
|
|
||||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & FRF_MULTIPLE)
|
|
||||||
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
|
|
||||||
if (flags & FRF_CHOOSEFOLDER)
|
|
||||||
gtk_file_chooser_set_action (GTK_FILE_CHOOSER (dialog), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
|
||||||
|
|
||||||
if ((flags & FRF_EXTENSIONS || flags & FRF_MIMETYPES) && extensions != NULL)
|
|
||||||
{
|
|
||||||
filefilter = gtk_file_filter_new ();
|
|
||||||
tokenbuffer = g_strdup (extensions);
|
|
||||||
token = strtok (tokenbuffer, ";");
|
|
||||||
|
|
||||||
while (token != NULL)
|
|
||||||
{
|
|
||||||
if (flags & FRF_EXTENSIONS)
|
|
||||||
gtk_file_filter_add_pattern (filefilter, token);
|
|
||||||
else
|
|
||||||
gtk_file_filter_add_mime_type (filefilter, token);
|
|
||||||
token = strtok (NULL, ";");
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (tokenbuffer);
|
|
||||||
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filefilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
|
|
||||||
{
|
|
||||||
GError *shortcut_error = NULL;
|
|
||||||
|
|
||||||
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog), xdir, &shortcut_error);
|
|
||||||
if (shortcut_error)
|
|
||||||
g_error_free (shortcut_error);
|
|
||||||
}
|
|
||||||
freq = g_new (struct file_req, 1);
|
|
||||||
freq->dialog = dialog;
|
|
||||||
freq->flags = flags;
|
|
||||||
freq->callback = callback;
|
|
||||||
freq->userdata = userdata;
|
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (dialog), "response",
|
|
||||||
G_CALLBACK (gtkutil_file_req_response), freq);
|
|
||||||
g_signal_connect (G_OBJECT (dialog), "destroy",
|
|
||||||
G_CALLBACK (gtkutil_file_req_destroy), (gpointer) freq);
|
|
||||||
|
|
||||||
if (effective_parent)
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), effective_parent);
|
|
||||||
|
|
||||||
if (flags & FRF_MODAL)
|
|
||||||
{
|
|
||||||
g_assert (effective_parent);
|
|
||||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_show (dialog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
@@ -3471,7 +3471,7 @@ mg_create_infoframe (GtkWidget *box)
|
|||||||
|
|
||||||
frame = gtk_frame_new (0);
|
frame = gtk_frame_new (0);
|
||||||
gtk_frame_set_shadow_type ((GtkFrame*)frame, GTK_SHADOW_OUT);
|
gtk_frame_set_shadow_type ((GtkFrame*)frame, GTK_SHADOW_OUT);
|
||||||
gtk_box_pack_start (GTK_BOX (box), frame, FALSE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box), frame, TRUE, TRUE, 0);
|
||||||
|
|
||||||
hbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
hbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||||
@@ -3492,7 +3492,7 @@ mg_create_meters (session_gui *gui, GtkWidget *parent_box)
|
|||||||
|
|
||||||
if ((prefs.hex_gui_lagometer & 2) || (prefs.hex_gui_throttlemeter & 2))
|
if ((prefs.hex_gui_lagometer & 2) || (prefs.hex_gui_throttlemeter & 2))
|
||||||
{
|
{
|
||||||
infbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
infbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, TRUE, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (box), infbox, 0, 0, 0);
|
gtk_box_pack_start (GTK_BOX (box), infbox, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1717,7 +1717,32 @@ menu_ctcpguiopen (void)
|
|||||||
static void
|
static void
|
||||||
menu_docs (GtkWidget *wid, gpointer none)
|
menu_docs (GtkWidget *wid, gpointer none)
|
||||||
{
|
{
|
||||||
fe_open_url ("https://docs.zoitechat.org/en/latest/");
|
GNetworkMonitor *monitor;
|
||||||
|
char *offline_docs;
|
||||||
|
gboolean online;
|
||||||
|
|
||||||
|
offline_docs = g_build_filename (get_xdir (), "offline-docs", "index.html", NULL);
|
||||||
|
if (g_access (offline_docs, R_OK) == 0)
|
||||||
|
{
|
||||||
|
fe_open_url (offline_docs);
|
||||||
|
g_free (offline_docs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
g_free (offline_docs);
|
||||||
|
offline_docs = g_build_filename (ZOITECHATDOCDIR, "index.html", NULL);
|
||||||
|
if (g_access (offline_docs, R_OK) == 0)
|
||||||
|
{
|
||||||
|
fe_open_url (offline_docs);
|
||||||
|
g_free (offline_docs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
g_free (offline_docs);
|
||||||
|
online = TRUE;
|
||||||
|
monitor = g_network_monitor_get_default ();
|
||||||
|
if (monitor)
|
||||||
|
online = g_network_monitor_get_network_available (monitor);
|
||||||
|
if (online)
|
||||||
|
fe_open_url ("https://docs.zoitechat.org/en/latest/");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static void
|
/*static void
|
||||||
|
|||||||
@@ -2300,6 +2300,12 @@ gtk_xtext_leave_notify (GtkWidget * widget, GdkEventCrossing * event)
|
|||||||
xtext->hilight_ent = NULL;
|
xtext->hilight_ent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (xtext->tooltip_stamp_set)
|
||||||
|
{
|
||||||
|
gtk_widget_set_tooltip_text (widget, NULL);
|
||||||
|
xtext->tooltip_stamp_set = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2466,7 +2472,7 @@ gtk_xtext_motion_notify (GtkWidget * widget, GdkEventMotion * event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (xtext->urlcheck_function == NULL)
|
if (xtext->urlcheck_function == NULL)
|
||||||
return FALSE;
|
goto tooltip_check;
|
||||||
|
|
||||||
word_type = gtk_xtext_get_word_adjust (xtext, x, y, &word_ent, &offset, &len);
|
word_type = gtk_xtext_get_word_adjust (xtext, x, y, &word_ent, &offset, &len);
|
||||||
if (word_type > 0)
|
if (word_type > 0)
|
||||||
@@ -2504,6 +2510,46 @@ gtk_xtext_motion_notify (GtkWidget * widget, GdkEventMotion * event)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tooltip_check:
|
||||||
|
if (xtext->buffer->time_stamp && xtext->buffer->indent > 0 && x >= 0 && x < xtext->stamp_width)
|
||||||
|
{
|
||||||
|
textentry *ent = gtk_xtext_find_char (xtext, x, y, NULL, NULL);
|
||||||
|
if (ent && (!xtext->tooltip_stamp_set || xtext->tooltip_stamp != ent->stamp))
|
||||||
|
{
|
||||||
|
char tooltip[96];
|
||||||
|
strftime_utf8 (tooltip, sizeof (tooltip), "%Y-%m-%d", ent->stamp);
|
||||||
|
gtk_widget_set_tooltip_text (widget, tooltip);
|
||||||
|
xtext->tooltip_stamp = ent->stamp;
|
||||||
|
xtext->tooltip_stamp_set = TRUE;
|
||||||
|
}
|
||||||
|
if (ent)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else if (!xtext->buffer->time_stamp && x >= xtext->buffer->indent)
|
||||||
|
{
|
||||||
|
textentry *ent = gtk_xtext_find_char (xtext, x, y, NULL, NULL);
|
||||||
|
if (ent && ent->stamp && (!xtext->tooltip_stamp_set || xtext->tooltip_stamp != ent->stamp))
|
||||||
|
{
|
||||||
|
char tooltip[128];
|
||||||
|
char date[64];
|
||||||
|
char *stamp_text;
|
||||||
|
strftime_utf8 (date, sizeof (date), "%Y-%m-%d", ent->stamp);
|
||||||
|
xtext_get_stamp_str (ent->stamp, &stamp_text);
|
||||||
|
g_snprintf (tooltip, sizeof (tooltip), "%s %s", date, stamp_text);
|
||||||
|
gtk_widget_set_tooltip_text (widget, tooltip);
|
||||||
|
g_free (stamp_text);
|
||||||
|
xtext->tooltip_stamp = ent->stamp;
|
||||||
|
xtext->tooltip_stamp_set = TRUE;
|
||||||
|
}
|
||||||
|
if (ent)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else if (xtext->tooltip_stamp_set)
|
||||||
|
{
|
||||||
|
gtk_widget_set_tooltip_text (widget, NULL);
|
||||||
|
xtext->tooltip_stamp_set = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
gtk_xtext_leave_notify (widget, NULL);
|
gtk_xtext_leave_notify (widget, NULL);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -190,6 +190,8 @@ struct _GtkXText
|
|||||||
textentry *hilight_ent;
|
textentry *hilight_ent;
|
||||||
int hilight_start;
|
int hilight_start;
|
||||||
int hilight_end;
|
int hilight_end;
|
||||||
|
time_t tooltip_stamp;
|
||||||
|
unsigned int tooltip_stamp_set:1;
|
||||||
|
|
||||||
guint16 fontwidth[128]; /* each char's width, only the ASCII ones */
|
guint16 fontwidth[128]; /* each char's width, only the ASCII ones */
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#define PACKAGE_VERSION "<#= [string]::Join('.', $versionParts) #>"
|
#define PACKAGE_VERSION "<#= [string]::Join('.', $versionParts) #>"
|
||||||
#define ZOITECHATLIBDIR ".\\plugins"
|
#define ZOITECHATLIBDIR ".\\plugins"
|
||||||
#define ZOITECHATSHAREDIR "."
|
#define ZOITECHATSHAREDIR "."
|
||||||
|
#define ZOITECHATDOCDIR "offline-docs"
|
||||||
#define OLD_PERL
|
#define OLD_PERL
|
||||||
#define GETTEXT_PACKAGE "zoitechat"
|
#define GETTEXT_PACKAGE "zoitechat"
|
||||||
#define PACKAGE_TARNAME "zoitechat-<#= [string]::Join('.', $versionParts) #>"
|
#define PACKAGE_TARNAME "zoitechat-<#= [string]::Join('.', $versionParts) #>"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#define APPNAM "ZoiteChat"
|
#define APPNAM "ZoiteChat"
|
||||||
#define APPVER "<#= [string]::Join('.', $versionParts) #>"
|
#define APPVER "<#= [string]::Join('.', $versionParts) #>"
|
||||||
|
#define OFFLINEDOCSURL "https://dl.zoitechat.org/offlinedocs/zoitechat-docs-html-" + APPVER + ".tar.gz"
|
||||||
; These are defined by our installer project at build time
|
; These are defined by our installer project at build time
|
||||||
;#define APPARCH "x64"
|
;#define APPARCH "x64"
|
||||||
;#define PROJECTDIR "C:\...\zoitechat\win32\installer\"
|
;#define PROJECTDIR "C:\...\zoitechat\win32\installer\"
|
||||||
@@ -49,6 +50,7 @@ Name: "icons"; Description: "Create Shortcuts"; Types: custom; Flags: disablenou
|
|||||||
Name: "icons\desktopicon"; Description: "Create Desktop Shortcut"; Types: custom; Flags: disablenouninstallwarning
|
Name: "icons\desktopicon"; Description: "Create Desktop Shortcut"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "icons\quicklaunchicon"; Description: "Create Quick Launch Shortcut"; Types: custom; Flags: disablenouninstallwarning
|
Name: "icons\quicklaunchicon"; Description: "Create Quick Launch Shortcut"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "translations"; Description: "Translations"; Types: normal custom; Flags: disablenouninstallwarning
|
Name: "translations"; Description: "Translations"; Types: normal custom; Flags: disablenouninstallwarning
|
||||||
|
Name: "docs"; Description: "Offline Documentation"; Types: normal minimal custom; Flags: disablenouninstallwarning
|
||||||
Name: "spell"; Description: "Spelling Dictionaries"; Types: custom; Flags: disablenouninstallwarning
|
Name: "spell"; Description: "Spelling Dictionaries"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "plugins"; Description: "Plugins"; Types: custom; Flags: disablenouninstallwarning
|
Name: "plugins"; Description: "Plugins"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "plugins\checksum"; Description: "Checksum"; Types: custom; Flags: disablenouninstallwarning
|
Name: "plugins\checksum"; Description: "Checksum"; Types: custom; Flags: disablenouninstallwarning
|
||||||
@@ -95,6 +97,7 @@ Filename: "{sys}\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "-NoProfile
|
|||||||
|
|
||||||
[Dirs]
|
[Dirs]
|
||||||
Name: "{userappdata}\ZoiteChat\gtk3-themes"; Components: themes
|
Name: "{userappdata}\ZoiteChat\gtk3-themes"; Components: themes
|
||||||
|
Name: "{app}\offline-docs"; Components: docs
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
Source: "portable-mode"; DestDir: "{app}"; Tasks: portable
|
Source: "portable-mode"; DestDir: "{app}"; Tasks: portable
|
||||||
@@ -105,6 +108,7 @@ Source: "cert.pem"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
|
|||||||
Source: "share\xml\*"; DestDir: "{app}\share\xml"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs
|
Source: "share\xml\*"; DestDir: "{app}\share\xml"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs
|
||||||
Source: "share\doc\zoitechat\*"; DestDir: "{app}\share\doc\zoitechat"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs
|
Source: "share\doc\zoitechat\*"; DestDir: "{app}\share\doc\zoitechat"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs
|
||||||
Source: "share\doc\WinSparkle\*"; DestDir: "{app}\share\doc\WinSparkle"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs
|
Source: "share\doc\WinSparkle\*"; DestDir: "{app}\share\doc\WinSparkle"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs
|
||||||
|
Source: "offline-docs\*"; DestDir: "{app}\offline-docs"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: docs
|
||||||
Source: "share\themes\MS-Windows\*"; DestDir: "{app}\share\themes\MS-Windows"; Flags: ignoreversion createallsubdirs recursesubdirs skipifsourcedoesntexist; Components: libs
|
Source: "share\themes\MS-Windows\*"; DestDir: "{app}\share\themes\MS-Windows"; Flags: ignoreversion createallsubdirs recursesubdirs skipifsourcedoesntexist; Components: libs
|
||||||
Source: "share\glib-2.0\schemas\*"; DestDir: "{app}\share\glib-2.0\schemas"; Flags: ignoreversion createallsubdirs recursesubdirs skipifsourcedoesntexist; Components: libs
|
Source: "share\glib-2.0\schemas\*"; DestDir: "{app}\share\glib-2.0\schemas"; Flags: ignoreversion createallsubdirs recursesubdirs skipifsourcedoesntexist; Components: libs
|
||||||
Source: "share\icons\hicolor\*"; DestDir: "{app}\share\icons\hicolor"; Flags: ignoreversion createallsubdirs recursesubdirs skipifsourcedoesntexist; Components: libs
|
Source: "share\icons\hicolor\*"; DestDir: "{app}\share\icons\hicolor"; Flags: ignoreversion createallsubdirs recursesubdirs skipifsourcedoesntexist; Components: libs
|
||||||
@@ -314,7 +318,34 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
function InstallOfflineDocs(): Boolean;
|
||||||
|
var
|
||||||
|
Archive: String;
|
||||||
|
DocsDir: String;
|
||||||
|
ResultCode: Integer;
|
||||||
|
Script: String;
|
||||||
|
WorkDir: String;
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
Archive := ExpandConstant('{tmp}\offline-docs.tar.gz');
|
||||||
|
DocsDir := ExpandConstant('{app}\offline-docs');
|
||||||
|
WorkDir := ExpandConstant('{tmp}\offline-docs-extract');
|
||||||
|
if not FileExists(Archive) then
|
||||||
|
Exit;
|
||||||
|
Script := 'Remove-Item -LiteralPath ''' + WorkDir + ''' -Recurse -Force -ErrorAction SilentlyContinue; ' +
|
||||||
|
'New-Item -ItemType Directory -LiteralPath ''' + WorkDir + ''' -Force | Out-Null; ' +
|
||||||
|
'tar -xzf ''' + Archive + ''' -C ''' + WorkDir + '''; ' +
|
||||||
|
'$i = Get-ChildItem -LiteralPath ''' + WorkDir + ''' -Recurse -Filter index.html | Select-Object -First 1; ' +
|
||||||
|
'if (-not $i) { exit 1 }; ' +
|
||||||
|
'Remove-Item -LiteralPath ''' + DocsDir + ''' -Recurse -Force -ErrorAction SilentlyContinue; ' +
|
||||||
|
'New-Item -ItemType Directory -LiteralPath ''' + DocsDir + ''' -Force | Out-Null; ' +
|
||||||
|
'Copy-Item -Path (Join-Path $i.DirectoryName ''*'') -Destination ''' + DocsDir + ''' -Recurse -Force';
|
||||||
|
if not Exec(ExpandConstant('{sys}\WindowsPowerShell\v1.0\powershell.exe'), '-NoProfile -ExecutionPolicy Bypass -Command "' + Script + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
|
||||||
|
Result := False
|
||||||
|
else
|
||||||
|
Result := ResultCode = 0;
|
||||||
|
end;
|
||||||
|
|
||||||
function CheckSpellInstall(): Boolean;
|
function CheckSpellInstall(): Boolean;
|
||||||
var
|
var
|
||||||
Version: TWindowsVersion;
|
Version: TWindowsVersion;
|
||||||
@@ -351,6 +382,9 @@ begin
|
|||||||
if IsComponentSelected('themes\windows10dark') then
|
if IsComponentSelected('themes\windows10dark') then
|
||||||
idpAddFile('https://dl.zoitechat.zoite.net/themes/GTK3Themes/Windows-10-Dark-3.2.1-dark.zip', ExpandConstant('{tmp}\Windows-10-Dark-3.2.1-dark.zip'));
|
idpAddFile('https://dl.zoitechat.zoite.net/themes/GTK3Themes/Windows-10-Dark-3.2.1-dark.zip', ExpandConstant('{tmp}\Windows-10-Dark-3.2.1-dark.zip'));
|
||||||
|
|
||||||
|
if IsComponentSelected('docs') then
|
||||||
|
idpAddFile('{#OFFLINEDOCSURL}', ExpandConstant('{tmp}\offline-docs.tar.gz'));
|
||||||
|
|
||||||
if not IsTaskSelected('portable') then
|
if not IsTaskSelected('portable') then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
@@ -419,6 +453,13 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if IsComponentSelected('docs') and not FileExists(ExpandConstant('{tmp}\offline-docs.tar.gz')) then
|
||||||
|
begin
|
||||||
|
MsgBox('Offline documentation could not be downloaded. Please retry setup or rerun setup with Offline Documentation deselected.', mbError, MB_OK);
|
||||||
|
Result := False;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
if IsComponentSelected('deps\vcredist2015') and not CheckVCInstall() and not FileExists(ExpandConstant('{tmp}\vcredist.exe')) then
|
if IsComponentSelected('deps\vcredist2015') and not CheckVCInstall() and not FileExists(ExpandConstant('{tmp}\vcredist.exe')) then
|
||||||
begin
|
begin
|
||||||
MsgBox('Visual C++ Redistributable could not be downloaded. Please retry setup or install it manually and rerun setup.', mbError, MB_OK);
|
MsgBox('Visual C++ Redistributable could not be downloaded. Please retry setup or install it manually and rerun setup.', mbError, MB_OK);
|
||||||
@@ -497,4 +538,10 @@ begin
|
|||||||
DeleteFile(ExpandConstant('{app}\portable-mode'));
|
DeleteFile(ExpandConstant('{app}\portable-mode'));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if (CurStep=ssPostInstall) and IsComponentSelected('docs') then
|
||||||
|
begin
|
||||||
|
if not InstallOfflineDocs() then
|
||||||
|
MsgBox('Offline documentation could not be installed from the downloaded archive.', mbError, MB_OK);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Reference in New Issue
Block a user