mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-05-16 21:50:20 +00:00
Compare commits
60 Commits
73733e4176
...
fix-channe
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d65871c4d | |||
|
|
dcb35fb80f | ||
| b1768854c3 | |||
| 4ed4eaf8e8 | |||
|
|
d167b53b17 | ||
| 18eff80a30 | |||
| a44ec5f624 | |||
|
|
5da518f50e | ||
|
|
ebb11a8ac5 | ||
|
|
dd9c5db1aa | ||
| 984ac9763e | |||
|
|
ad67af2f8f | ||
| cc8460d366 | |||
| 1dc9b9c956 | |||
|
|
20b552ad9d | ||
|
|
12f4885ad7 | ||
| 9c1fdef286 | |||
| c125a154da | |||
| 028d768b23 | |||
| 42972e01b0 | |||
| 1bd37af7d0 | |||
| 5fad2d0c02 | |||
|
|
bd9adeb795 | ||
|
|
5fd3c7c9d9 | ||
| 937184429f | |||
| e31ccff3f8 | |||
| edaafba7eb | |||
| 87018fa7fe | |||
| 8fcec519d0 | |||
| aa52236c01 | |||
| cd5b61d9d0 | |||
| 4eefdd6011 | |||
|
|
21748b3133 | ||
|
|
e7db202f88 | ||
| a93e76eaf4 | |||
| 3c5bdb2ab2 | |||
| 8f7c40caf1 | |||
| 150ad62771 | |||
|
|
5e3715dc31 | ||
| 05648ba8e3 | |||
|
|
0956471a10 | ||
| 1f79e62f53 | |||
|
|
c123e93704 | ||
| e49333340f | |||
| 7210f16dfc | |||
|
|
2825e992df | ||
| 8e8f534c21 | |||
| d3d5ac905c | |||
|
|
4cca23a283 | ||
| 0f3fffc728 | |||
| 7261d8637d | |||
|
|
8a1e82986a | ||
|
|
e8d421b3df | ||
| cb2c09b2ba | |||
| a14026f0d1 | |||
| e237df31f4 | |||
|
|
a9421c63a9 | ||
| 4f2938d957 | |||
|
|
8fa9d3678b | ||
| 4bbc23c185 |
4
.github/workflows/appimage-build.yml
vendored
4
.github/workflows/appimage-build.yml
vendored
@@ -28,13 +28,13 @@ jobs:
|
|||||||
sudo apt-get install -y --no-install-recommends \
|
sudo apt-get install -y --no-install-recommends \
|
||||||
build-essential pkg-config meson ninja-build cmake \
|
build-essential pkg-config meson ninja-build cmake \
|
||||||
gettext \
|
gettext \
|
||||||
libcanberra-dev libdbus-glib-1-dev libglib2.0-dev \
|
libcanberra-dev libglib2.0-dev \
|
||||||
libarchive-dev \
|
libarchive-dev \
|
||||||
libgtk-3-dev \
|
libgtk-3-dev \
|
||||||
libwayland-client0 libwayland-cursor0 libwayland-egl1 \
|
libwayland-client0 libwayland-cursor0 libwayland-egl1 \
|
||||||
libxkbcommon0 \
|
libxkbcommon0 \
|
||||||
libgtk-3-bin libglib2.0-bin shared-mime-info gsettings-desktop-schemas \
|
libgtk-3-bin libglib2.0-bin shared-mime-info gsettings-desktop-schemas \
|
||||||
libluajit-5.1-dev libpci-dev libperl-dev libssl-dev libayatana-appindicator3-dev \
|
liblua5.4-dev libpci-dev libperl-dev libssl-dev libayatana-appindicator3-dev \
|
||||||
perl python3 python3-minimal python3-dev python3-cffi mono-devel desktop-file-utils \
|
perl python3 python3-minimal python3-dev python3-cffi mono-devel desktop-file-utils \
|
||||||
fonts-noto-color-emoji breeze-gtk-theme \
|
fonts-noto-color-emoji breeze-gtk-theme \
|
||||||
patchelf file curl
|
patchelf file curl
|
||||||
|
|||||||
3
.github/workflows/flatpak-build.yml
vendored
3
.github/workflows/flatpak-build.yml
vendored
@@ -25,6 +25,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
|
- name: Generate PSL list
|
||||||
|
run: curl -fsSL https://publicsuffix.org/list/public_suffix_list.dat -o src/common/public_suffix_list.dat
|
||||||
|
|
||||||
- name: Build Flatpak
|
- name: Build Flatpak
|
||||||
id: flatpak_builder
|
id: flatpak_builder
|
||||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
|
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
|
||||||
|
|||||||
2
.github/workflows/manjaro-package-build.yml
vendored
2
.github/workflows/manjaro-package-build.yml
vendored
@@ -32,10 +32,8 @@ jobs:
|
|||||||
glib2-devel \
|
glib2-devel \
|
||||||
gtk3 \
|
gtk3 \
|
||||||
openssl \
|
openssl \
|
||||||
dbus-glib \
|
|
||||||
libcanberra \
|
libcanberra \
|
||||||
libayatana-appindicator \
|
libayatana-appindicator \
|
||||||
luajit \
|
|
||||||
iso-codes \
|
iso-codes \
|
||||||
lua \
|
lua \
|
||||||
perl \
|
perl \
|
||||||
|
|||||||
@@ -1,6 +1,23 @@
|
|||||||
ZoiteChat ChangeLog
|
ZoiteChat ChangeLog
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
2.18.0 (2026-04-20)
|
||||||
|
|
||||||
|
- Added optional close buttons on tabs.
|
||||||
|
- Added Ctrl+W to close tabs and Ctrl+Shift+T to reopen recently closed tabs.
|
||||||
|
- Expanded theme import support with .hct support in colors.conf import.
|
||||||
|
- Added pevent import support from .hct theme files and improved import result messaging.
|
||||||
|
- Expanded palette and selection CSS styling for better theme consistency.
|
||||||
|
- Auto-sizes the topic bar to wrapped text for better multi-line topic handling.
|
||||||
|
- Refined command-character parsing when pasting path-like text.
|
||||||
|
- Tightened topic link detection and opening rules.
|
||||||
|
- Added Public Suffix List validation for host links to reduce bad link matches.
|
||||||
|
- Improved channel tree behavior by ignoring collapsed parent selections.
|
||||||
|
- Sanitized the Linux open environment for AppImage builds and added safer fallback handling.
|
||||||
|
- Labeled Windows installer runtimes with exact versions.
|
||||||
|
- Fixed the notification icon and corrected the Flatpak screenshot asset.
|
||||||
|
- Improved AppStream metainfo validation.
|
||||||
|
|
||||||
2.18.0~pre6 (2026-03-30)
|
2.18.0~pre6 (2026-03-30)
|
||||||
|
|
||||||
- Applied app theme CSS to the menubar consistently across the app.
|
- Applied app theme CSS to the menubar consistently across the app.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ if get_option('gtk-frontend')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
desktop_conf = configuration_data()
|
desktop_conf = configuration_data()
|
||||||
if dbus_glib_dep.found()
|
if dbus_dep.found()
|
||||||
desktop_conf.set('exec_command', 'zoitechat --existing %U')
|
desktop_conf.set('exec_command', 'zoitechat --existing %U')
|
||||||
else
|
else
|
||||||
desktop_conf.set('exec_command', 'zoitechat %U')
|
desktop_conf.set('exec_command', 'zoitechat %U')
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<url type="help">https://docs.zoitechat.org/en/latest/</url>
|
<url type="help">https://docs.zoitechat.org/en/latest/</url>
|
||||||
<screenshots>
|
<screenshots>
|
||||||
<screenshot type="default">
|
<screenshot type="default">
|
||||||
<image>https://zoitechat.org/assets/ZoiteChat.png</image>
|
<image>https://zoitechat.org/assets/img/zoitechat-screenshot.png</image>
|
||||||
<caption>Main Chat Window</caption>
|
<caption>Main Chat Window</caption>
|
||||||
</screenshot>
|
</screenshot>
|
||||||
</screenshots>
|
</screenshots>
|
||||||
@@ -29,6 +29,36 @@
|
|||||||
<id>zoitechat.desktop</id>
|
<id>zoitechat.desktop</id>
|
||||||
</provides>
|
</provides>
|
||||||
<releases>
|
<releases>
|
||||||
|
<release date="2026-04-20" version="2.18.0">
|
||||||
|
<description>
|
||||||
|
<p>Tabs and navigation:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Added optional close buttons on tabs.</li>
|
||||||
|
<li>Added Ctrl+W to close tabs and Ctrl+Shift+T to reopen recently closed tabs.</li>
|
||||||
|
<li>Improved channel tree behavior by ignoring collapsed parent selections.</li>
|
||||||
|
</ul>
|
||||||
|
<p>Themes and appearance:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Expanded theme import support with .hct support in colors.conf import.</li>
|
||||||
|
<li>Added pevent import support from .hct theme files and improved import result messaging.</li>
|
||||||
|
<li>Expanded palette and selection CSS styling for better theme consistency.</li>
|
||||||
|
<li>Auto-sizes the topic bar to wrapped text for better multi-line topic handling.</li>
|
||||||
|
</ul>
|
||||||
|
<p>Links and text handling:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Refined command-character parsing when pasting path-like text.</li>
|
||||||
|
<li>Tightened topic link detection and opening rules.</li>
|
||||||
|
<li>Added Public Suffix List validation for host links to reduce bad link matches.</li>
|
||||||
|
</ul>
|
||||||
|
<p>Packaging and platform integration:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Sanitized the Linux open environment for AppImage builds and added safer fallback handling.</li>
|
||||||
|
<li>Labeled Windows installer runtimes with exact versions.</li>
|
||||||
|
<li>Fixed the notification icon and corrected the Flatpak screenshot asset.</li>
|
||||||
|
<li>Improved AppStream metainfo validation.</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
<release date="2026-03-30" version="2.18.0~pre6">
|
<release date="2026-03-30" version="2.18.0~pre6">
|
||||||
<description>
|
<description>
|
||||||
<p>GTK theme and UI:</p>
|
<p>GTK theme and UI:</p>
|
||||||
|
|||||||
@@ -7,14 +7,13 @@
|
|||||||
"command": "zoitechat",
|
"command": "zoitechat",
|
||||||
"finish-args": [
|
"finish-args": [
|
||||||
"--share=ipc",
|
"--share=ipc",
|
||||||
"--socket=x11",
|
"--socket=wayland",
|
||||||
|
"--socket=fallback-x11",
|
||||||
"--share=network",
|
"--share=network",
|
||||||
"--socket=pulseaudio",
|
"--socket=pulseaudio",
|
||||||
"--filesystem=xdg-download",
|
"--filesystem=xdg-download",
|
||||||
"--filesystem=xdg-data/themes:ro",
|
"--filesystem=xdg-data/themes:ro",
|
||||||
"--filesystem=xdg-data/icons:ro",
|
"--filesystem=xdg-data/icons:ro",
|
||||||
"--filesystem=~/.themes:ro",
|
|
||||||
"--filesystem=~/.icons:ro",
|
|
||||||
"--filesystem=xdg-run/tray-icon:create",
|
"--filesystem=xdg-run/tray-icon:create",
|
||||||
"--env=GTK_CSD=1",
|
"--env=GTK_CSD=1",
|
||||||
"--talk-name=org.freedesktop.Notifications",
|
"--talk-name=org.freedesktop.Notifications",
|
||||||
@@ -34,7 +33,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"modules": [
|
"modules": [
|
||||||
"shared-modules/dbus-glib/dbus-glib.json",
|
|
||||||
"shared-modules/lua5.4/lua-5.4.json",
|
"shared-modules/lua5.4/lua-5.4.json",
|
||||||
"shared-modules/libcanberra/libcanberra.json",
|
"shared-modules/libcanberra/libcanberra.json",
|
||||||
"shared-modules/libayatana-appindicator/libayatana-appindicator-gtk3.json",
|
"shared-modules/libayatana-appindicator/libayatana-appindicator-gtk3.json",
|
||||||
@@ -45,9 +43,9 @@
|
|||||||
"buildsystem": "meson",
|
"buildsystem": "meson",
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"type": "git",
|
"type": "archive",
|
||||||
"url": "https://github.com/pavouk/lgi.git",
|
"url": "https://github.com/pavouk/lgi/archive/c9b8e4473c6421f2a215d8c06c0d94b86eb0b26a.tar.gz",
|
||||||
"commit": "c9b8e4473c6421f2a215d8c06c0d94b86eb0b26a"
|
"sha256": "db67b2b7ee89fa566f783486d56be7203552a997bc55f35020b57dd2776b9943"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"type": "archive",
|
"type": "archive",
|
||||||
"url": "https://www.cpan.org/src/5.0/perl-5.40.1.tar.xz",
|
"url": "https://www.cpan.org/src/5.0/perl-5.42.2.tar.xz",
|
||||||
"sha256": "dfa20c2eef2b4af133525610bbb65dd13777ecf998c9c5b1ccf0d308e732ee3f"
|
"sha256": "0a585eeb9e363c0f80482ddb3571625250c2c86aeb408853e8ea50805cfb14bb"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
project('zoitechat', 'c',
|
project('zoitechat', 'c',
|
||||||
version: '2.18.0~pre6',
|
version: '2.18.0',
|
||||||
meson_version: '>= 0.55.0',
|
meson_version: '>= 0.55.0',
|
||||||
default_options: [
|
default_options: [
|
||||||
'c_std=c17',
|
'c_std=c17',
|
||||||
@@ -18,7 +18,7 @@ libgmodule_dep = dependency('gmodule-2.0')
|
|||||||
|
|
||||||
libcanberra_dep = dependency('libcanberra', version: '>= 0.22',
|
libcanberra_dep = dependency('libcanberra', version: '>= 0.22',
|
||||||
required: get_option('libcanberra'))
|
required: get_option('libcanberra'))
|
||||||
dbus_glib_dep = dependency('dbus-glib-1', required: get_option('dbus'))
|
dbus_dep = dependency('gio-2.0', required: get_option('dbus'))
|
||||||
|
|
||||||
global_deps = []
|
global_deps = []
|
||||||
if cc.get_id() == 'msvc'
|
if cc.get_id() == 'msvc'
|
||||||
@@ -39,7 +39,7 @@ config_h.set10('ENABLE_NLS', true)
|
|||||||
# Optional features
|
# Optional features
|
||||||
config_h.set('USE_OPENSSL', libssl_dep.found())
|
config_h.set('USE_OPENSSL', libssl_dep.found())
|
||||||
config_h.set('USE_LIBCANBERRA', libcanberra_dep.found())
|
config_h.set('USE_LIBCANBERRA', libcanberra_dep.found())
|
||||||
config_h.set('USE_DBUS', dbus_glib_dep.found())
|
config_h.set('USE_DBUS', dbus_dep.found())
|
||||||
config_h.set('USE_PLUGIN', get_option('plugin'))
|
config_h.set('USE_PLUGIN', get_option('plugin'))
|
||||||
config_h.set('USE_GTK_FRONTEND', get_option('gtk-frontend'))
|
config_h.set('USE_GTK_FRONTEND', get_option('gtk-frontend'))
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ if meson.version().version_compare('>= 0.55.0')
|
|||||||
'GTK Frontend': get_option('gtk-frontend') ? 'enabled (GTK+ 3.22+)' : 'disabled',
|
'GTK Frontend': get_option('gtk-frontend') ? 'enabled (GTK+ 3.22+)' : 'disabled',
|
||||||
'TLS (openssl)': libssl_dep.found(),
|
'TLS (openssl)': libssl_dep.found(),
|
||||||
'Plugin Support': get_option('plugin'),
|
'Plugin Support': get_option('plugin'),
|
||||||
'DBus Support': dbus_glib_dep.found(),
|
'DBus Support': dbus_dep.found(),
|
||||||
'libcanberra': libcanberra_dep.found(),
|
'libcanberra': libcanberra_dep.found(),
|
||||||
}, section: 'Features')
|
}, section: 'Features')
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ option('with-exec', type: 'boolean',
|
|||||||
option('with-fishlim', type: 'boolean',
|
option('with-fishlim', type: 'boolean',
|
||||||
description: 'Fish encryption plugin, requires openssl'
|
description: 'Fish encryption plugin, requires openssl'
|
||||||
)
|
)
|
||||||
option('with-lua', type: 'string', value: 'luajit',
|
option('with-lua', type: 'string', value: 'lua-5.4',
|
||||||
description: 'Lua scripting plugin, value is pkg-config name to use or "false"'
|
description: 'Lua scripting plugin, value is pkg-config name to use or "false"'
|
||||||
)
|
)
|
||||||
option('with-perl', type: 'string', value: 'perl',
|
option('with-perl', type: 'string', value: 'perl',
|
||||||
@@ -59,9 +59,6 @@ option('with-sysinfo', type: 'boolean',
|
|||||||
option('with-upd', type: 'boolean',
|
option('with-upd', type: 'boolean',
|
||||||
description: 'Update plugin, Windows only'
|
description: 'Update plugin, Windows only'
|
||||||
)
|
)
|
||||||
option('with-winamp', type: 'boolean',
|
|
||||||
description: 'Winamp plugin, Windows only'
|
|
||||||
)
|
|
||||||
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'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ arch=('x86_64')
|
|||||||
url='https://github.com/zoitechat/zoitechat'
|
url='https://github.com/zoitechat/zoitechat'
|
||||||
license=('GPL-2.0-or-later')
|
license=('GPL-2.0-or-later')
|
||||||
depends=(
|
depends=(
|
||||||
'dbus-glib'
|
|
||||||
'glib2'
|
'glib2'
|
||||||
'gtk3'
|
'gtk3'
|
||||||
'iso-codes'
|
'iso-codes'
|
||||||
|
|||||||
@@ -104,12 +104,14 @@ thread_sha256_file (GTask *task, GFile *file, gpointer task_data, GCancellable *
|
|||||||
g_checksum_update (checksum, buffer, ret);
|
g_checksum_update (checksum, buffer, ret);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
g_checksum_free (checksum);
|
|
||||||
g_task_return_error (task, error);
|
g_task_return_error (task, error);
|
||||||
return;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_task_return_pointer (task, g_strdup (g_checksum_get_string (checksum)), g_free);
|
g_task_return_pointer (task, g_strdup (g_checksum_get_string (checksum)), g_free);
|
||||||
|
cleanup:
|
||||||
|
g_input_stream_close(G_INPUT_STREAM(istream), NULL, NULL);
|
||||||
|
g_object_unref(istream);
|
||||||
g_checksum_free (checksum);
|
g_checksum_free (checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,19 @@
|
|||||||
if cc.get_id() == 'msvc'
|
if cc.get_id() == 'msvc'
|
||||||
lua_dep = cc.find_library('lua51')
|
lua_dep = cc.find_library('lua51')
|
||||||
else
|
else
|
||||||
lua_dep = dependency(get_option('with-lua'))
|
lua_opt = get_option('with-lua')
|
||||||
|
lua_dep = dependency(lua_opt, required: false)
|
||||||
|
if not lua_dep.found() and lua_opt == 'lua-5.4'
|
||||||
|
foreach lua_name : ['lua5.4', 'lua-5.3', 'lua5.3', 'lua']
|
||||||
|
lua_dep = dependency(lua_name, required: false)
|
||||||
|
if lua_dep.found()
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
endif
|
||||||
|
if not lua_dep.found()
|
||||||
|
error('Dependency "' + lua_opt + '" not found')
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
shared_module('lua', 'lua.c',
|
shared_module('lua', 'lua.c',
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ if host_machine.system() == 'windows'
|
|||||||
subdir('upd')
|
subdir('upd')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('with-winamp')
|
|
||||||
subdir('winamp')
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('with-checksum')
|
if get_option('with-checksum')
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ else:
|
|||||||
if not hasattr(sys, 'argv'):
|
if not hasattr(sys, 'argv'):
|
||||||
sys.argv = ['<zoitechat>']
|
sys.argv = ['<zoitechat>']
|
||||||
|
|
||||||
VERSION = b'2.18.0~pre6'
|
VERSION = b'2.18.0'
|
||||||
PLUGIN_NAME = ffi.new('char[]', b'Python')
|
PLUGIN_NAME = ffi.new('char[]', b'Python')
|
||||||
PLUGIN_DESC = ffi.new('char[]', b'Python %d.%d scripting interface' % (sys.version_info[0], sys.version_info[1]))
|
PLUGIN_DESC = ffi.new('char[]', b'Python %d.%d scripting interface' % (sys.version_info[0], sys.version_info[1]))
|
||||||
PLUGIN_VERSION = ffi.new('char[]', VERSION)
|
PLUGIN_VERSION = ffi.new('char[]', VERSION)
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
shared_module('winamp', 'winamp.c',
|
|
||||||
dependencies: [libgio_dep, zoitechat_plugin_dep],
|
|
||||||
install: true,
|
|
||||||
install_dir: plugindir,
|
|
||||||
name_prefix: '',
|
|
||||||
vs_module_defs: 'winamp.def',
|
|
||||||
)
|
|
||||||
@@ -1,153 +0,0 @@
|
|||||||
/********************* Winamp Plugin 0.3******************************
|
|
||||||
*
|
|
||||||
* Distribution: GPL
|
|
||||||
*
|
|
||||||
* Originally written by: Leo - leo.nard@free.fr
|
|
||||||
* Modified by: SilvereX - SilvereX@karklas.mif.vu.lt
|
|
||||||
* Modified again by: Derek Buitenhuis - daemon404@gmail.com
|
|
||||||
* Modified yet again by: Berke Viktor - berkeviktor@aol.com
|
|
||||||
*********************************************************************/
|
|
||||||
|
|
||||||
#include "windows.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
#include "zoitechat-plugin.h"
|
|
||||||
|
|
||||||
#define PLAYING 1
|
|
||||||
#define PAUSED 3
|
|
||||||
|
|
||||||
static zoitechat_plugin *ph;
|
|
||||||
|
|
||||||
static int
|
|
||||||
winamp(char *word[], char *word_eol[], void *userdata)
|
|
||||||
{
|
|
||||||
HWND hwndWinamp = FindWindowW(L"Winamp v1.x",NULL);
|
|
||||||
|
|
||||||
if (hwndWinamp)
|
|
||||||
{
|
|
||||||
if (!stricmp("PAUSE", word[2]))
|
|
||||||
{
|
|
||||||
if (SendMessage(hwndWinamp,WM_USER, 0, 104))
|
|
||||||
{
|
|
||||||
SendMessage(hwndWinamp, WM_COMMAND, 40046, 0);
|
|
||||||
|
|
||||||
if (SendMessage(hwndWinamp, WM_USER, 0, 104) == PLAYING)
|
|
||||||
zoitechat_printf(ph, "Winamp: playing");
|
|
||||||
else
|
|
||||||
zoitechat_printf(ph, "Winamp: paused");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!stricmp("STOP", word[2]))
|
|
||||||
{
|
|
||||||
SendMessage(hwndWinamp, WM_COMMAND, 40047, 0);
|
|
||||||
zoitechat_printf(ph, "Winamp: stopped");
|
|
||||||
}
|
|
||||||
else if (!stricmp("PLAY", word[2]))
|
|
||||||
{
|
|
||||||
SendMessage(hwndWinamp, WM_COMMAND, 40045, 0);
|
|
||||||
zoitechat_printf(ph, "Winamp: playing");
|
|
||||||
}
|
|
||||||
else if (!stricmp("NEXT", word[2]))
|
|
||||||
{
|
|
||||||
SendMessage(hwndWinamp, WM_COMMAND, 40048, 0);
|
|
||||||
zoitechat_printf(ph, "Winamp: next playlist entry");
|
|
||||||
}
|
|
||||||
else if (!stricmp("PREV", word[2]))
|
|
||||||
{
|
|
||||||
SendMessage(hwndWinamp, WM_COMMAND, 40044, 0);
|
|
||||||
zoitechat_printf(ph, "Winamp: previous playlist entry");
|
|
||||||
}
|
|
||||||
else if (!stricmp("START", word[2]))
|
|
||||||
{
|
|
||||||
SendMessage(hwndWinamp, WM_COMMAND, 40154, 0);
|
|
||||||
zoitechat_printf(ph, "Winamp: playlist start");
|
|
||||||
}
|
|
||||||
else if (!word_eol[2][0])
|
|
||||||
{
|
|
||||||
wchar_t wcurrent_play[2048];
|
|
||||||
char *current_play, *p;
|
|
||||||
int len = GetWindowTextW(hwndWinamp, wcurrent_play, G_N_ELEMENTS(wcurrent_play));
|
|
||||||
|
|
||||||
current_play = g_utf16_to_utf8 (wcurrent_play, len, NULL, NULL, NULL);
|
|
||||||
if (!current_play)
|
|
||||||
{
|
|
||||||
zoitechat_print (ph, "Winamp: Error getting song information.");
|
|
||||||
return ZOITECHAT_EAT_ALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strchr(current_play, '-'))
|
|
||||||
{
|
|
||||||
/* Remove any trailing text and whitespace */
|
|
||||||
p = current_play + strlen(current_play) - 8;
|
|
||||||
while (p >= current_play)
|
|
||||||
{
|
|
||||||
if (!strnicmp(p, "- Winamp", 8))
|
|
||||||
break;
|
|
||||||
p--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p >= current_play)
|
|
||||||
p--;
|
|
||||||
|
|
||||||
while (p >= current_play && *p == ' ')
|
|
||||||
p--;
|
|
||||||
*++p = '\0';
|
|
||||||
|
|
||||||
/* Ignore any leading track number */
|
|
||||||
p = strstr (current_play, ". ");
|
|
||||||
if (p)
|
|
||||||
p += 2;
|
|
||||||
else
|
|
||||||
p = current_play;
|
|
||||||
|
|
||||||
if (*p != '\0')
|
|
||||||
zoitechat_commandf (ph, "me is now playing: %s", p);
|
|
||||||
else
|
|
||||||
zoitechat_print (ph, "Winamp: No song information found.");
|
|
||||||
g_free (current_play);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
zoitechat_print(ph, "Winamp: Nothing being played.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
zoitechat_printf(ph, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START]\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
zoitechat_print(ph, "Winamp not found.\n");
|
|
||||||
}
|
|
||||||
return ZOITECHAT_EAT_ALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
|
|
||||||
char **plugin_name,
|
|
||||||
char **plugin_desc,
|
|
||||||
char **plugin_version,
|
|
||||||
char *arg)
|
|
||||||
{
|
|
||||||
ph = plugin_handle;
|
|
||||||
|
|
||||||
*plugin_name = "Winamp";
|
|
||||||
*plugin_desc = "Winamp plugin for ZoiteChat";
|
|
||||||
*plugin_version = "0.6";
|
|
||||||
|
|
||||||
zoitechat_hook_command (ph, "WINAMP", ZOITECHAT_PRI_NORM, winamp, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START] - control Winamp or show what's currently playing", 0);
|
|
||||||
zoitechat_command (ph, "MENU -ishare\\music.png ADD \"Window/Display Current Song (Winamp)\" \"WINAMP\"");
|
|
||||||
|
|
||||||
zoitechat_print (ph, "Winamp plugin loaded\n");
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
zoitechat_plugin_deinit(void)
|
|
||||||
{
|
|
||||||
zoitechat_command (ph, "MENU DEL \"Window/Display Current Song (Winamp)\"");
|
|
||||||
zoitechat_print (ph, "Winamp plugin unloaded\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
EXPORTS
|
|
||||||
zoitechat_plugin_init
|
|
||||||
zoitechat_plugin_deinit
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Label="Configuration">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE}</ProjectGuid>
|
|
||||||
<Keyword>Win32Proj</Keyword>
|
|
||||||
<RootNamespace>winamp</RootNamespace>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
<Import Project="..\..\win32\zoitechat.props" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetName>hcwinamp</TargetName>
|
|
||||||
<OutDir>$(ZoiteChatRel)plugins\</OutDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup>
|
|
||||||
<ClCompile>
|
|
||||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(OpenSslInclude);$(Glib);..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<ModuleDefinitionFile>winamp.def</ModuleDefinitionFile>
|
|
||||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="winamp.def" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="winamp.c" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
</Project>
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Resource Files">
|
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="winamp.def">
|
|
||||||
<Filter>Resource Files</Filter>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="winamp.c">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -782,10 +782,12 @@ load_default_config(void)
|
|||||||
prefs.hex_gui_tab_middleclose = 1;
|
prefs.hex_gui_tab_middleclose = 1;
|
||||||
prefs.hex_gui_tab_server = 1;
|
prefs.hex_gui_tab_server = 1;
|
||||||
prefs.hex_gui_tab_sort = 1;
|
prefs.hex_gui_tab_sort = 1;
|
||||||
|
prefs.hex_gui_tab_scrollchans = 1;
|
||||||
prefs.hex_gui_topicbar = 1;
|
prefs.hex_gui_topicbar = 1;
|
||||||
prefs.hex_gui_transparency = 255;
|
prefs.hex_gui_transparency = 255;
|
||||||
prefs.hex_gui_tray = 1;
|
prefs.hex_gui_tray = 1;
|
||||||
prefs.hex_gui_tray_blink = 1;
|
prefs.hex_gui_tray_blink = 1;
|
||||||
|
prefs.hex_gui_ulist_color = 1;
|
||||||
prefs.hex_gui_ulist_count = 1;
|
prefs.hex_gui_ulist_count = 1;
|
||||||
prefs.hex_gui_ulist_icons = 1;
|
prefs.hex_gui_ulist_icons = 1;
|
||||||
prefs.hex_gui_ulist_style = 1;
|
prefs.hex_gui_ulist_style = 1;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
<ClInclude Include="plugin-timer.h" />
|
<ClInclude Include="plugin-timer.h" />
|
||||||
<ClInclude Include="plugin.h" />
|
<ClInclude Include="plugin.h" />
|
||||||
<ClInclude Include="proto-irc.h" />
|
<ClInclude Include="proto-irc.h" />
|
||||||
|
<ClInclude Include="public_suffix_data.h" />
|
||||||
<ClInclude Include="server.h" />
|
<ClInclude Include="server.h" />
|
||||||
<ClInclude Include="servlist.h" />
|
<ClInclude Include="servlist.h" />
|
||||||
<ClInclude Include="ssl.h" />
|
<ClInclude Include="ssl.h" />
|
||||||
@@ -109,6 +110,7 @@
|
|||||||
<Command><![CDATA[
|
<Command><![CDATA[
|
||||||
SET SOLUTIONDIR=$(SolutionDir)..\
|
SET SOLUTIONDIR=$(SolutionDir)..\
|
||||||
"$(Python3Path)\python.exe" $(ProjectDir)make-te.py "$(ProjectDir)textevents.in" "$(ZoiteChatLib)textevents.h" "$(ZoiteChatLib)textenums.h"
|
"$(Python3Path)\python.exe" $(ProjectDir)make-te.py "$(ProjectDir)textevents.in" "$(ZoiteChatLib)textevents.h" "$(ZoiteChatLib)textenums.h"
|
||||||
|
"$(Python3Path)\python.exe" $(ProjectDir)gen-public-suffix.py "$(ZoiteChatLib)public_suffix_data.h"
|
||||||
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\win32\config.h.tt" "$(ZoiteChatLib)config.h"
|
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\win32\config.h.tt" "$(ZoiteChatLib)config.h"
|
||||||
$(GlibGenMarshal) --prefix=_zoitechat_marshal --header "$(ProjectDir)marshalers.list" --output "$(ZoiteChatLib)marshal.h"
|
$(GlibGenMarshal) --prefix=_zoitechat_marshal --header "$(ProjectDir)marshalers.list" --output "$(ZoiteChatLib)marshal.h"
|
||||||
$(GlibGenMarshal) --prefix=_zoitechat_marshal --body "$(ProjectDir)marshalers.list" --output "$(ZoiteChatLib)marshal.c"
|
$(GlibGenMarshal) --prefix=_zoitechat_marshal --body "$(ProjectDir)marshalers.list" --output "$(ZoiteChatLib)marshal.c"
|
||||||
|
|||||||
@@ -65,6 +65,9 @@
|
|||||||
<ClInclude Include="proto-irc.h">
|
<ClInclude Include="proto-irc.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="public_suffix_data.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="server.h">
|
<ClInclude Include="server.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -82,10 +82,6 @@ has_theme_argument (void)
|
|||||||
|
|
||||||
void
|
void
|
||||||
zoitechat_remote (void)
|
zoitechat_remote (void)
|
||||||
/* TODO: dbus_g_connection_unref (connection) are commented because it makes
|
|
||||||
* dbus to crash. Fixed in dbus >=0.70 ?!?
|
|
||||||
* https://launchpad.net/distros/ubuntu/+source/dbus/+bug/54375
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
GDBusProxy *dbus = NULL;
|
GDBusProxy *dbus = NULL;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,203 +1,122 @@
|
|||||||
/* example.c - program to demonstrate some D-BUS stuffs.
|
#include <gio/gio.h>
|
||||||
* Copyright (C) 2006 Claessens Xavier
|
#include <glib.h>
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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 02110-1301, USA
|
|
||||||
*
|
|
||||||
* Claessens Xavier
|
|
||||||
* xclaesse@gmail.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "../marshal.c"
|
|
||||||
|
|
||||||
#define DBUS_SERVICE "org.zoitechat.service"
|
#define DBUS_SERVICE "org.zoitechat.service"
|
||||||
#define DBUS_REMOTE "/org/zoitechat/Remote"
|
#define DBUS_CONNECTION_PATH "/org/zoitechat"
|
||||||
#define DBUS_REMOTE_CONNECTION_INTERFACE "org.zoitechat.connection"
|
#define DBUS_CONNECTION_INTERFACE "org.zoitechat.connection"
|
||||||
#define DBUS_REMOTE_PLUGIN_INTERFACE "org.zoitechat.plugin"
|
#define DBUS_PLUGIN_INTERFACE "org.zoitechat.plugin"
|
||||||
|
|
||||||
guint command_id;
|
static gboolean
|
||||||
guint server_id;
|
call_sync (GDBusProxy *proxy, const char *method, GVariant *params, GVariant **out)
|
||||||
|
|
||||||
static void
|
|
||||||
write_error (const char *message,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
if (error == NULL || *error == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_printerr ("%s: %s\n", message, (*error)->message);
|
|
||||||
g_clear_error (error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
test_server_cb (DBusGProxy *proxy,
|
|
||||||
char *word[],
|
|
||||||
char *word_eol[],
|
|
||||||
guint hook_id,
|
|
||||||
guint context_id,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
if (hook_id == server_id) {
|
|
||||||
g_print ("message: %s\n", word_eol[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
test_command_cb (DBusGProxy *proxy,
|
|
||||||
char *word[],
|
|
||||||
char *word_eol[],
|
|
||||||
guint hook_id,
|
|
||||||
guint context_id,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
GVariant *result;
|
||||||
|
|
||||||
if (hook_id == command_id) {
|
result = g_dbus_proxy_call_sync (proxy,
|
||||||
if (!dbus_g_proxy_call (proxy, "Unhook",
|
method,
|
||||||
&error,
|
params,
|
||||||
G_TYPE_UINT, hook_id,
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
G_TYPE_INVALID, G_TYPE_INVALID)) {
|
-1,
|
||||||
write_error ("Failed to complete unhook", &error);
|
NULL,
|
||||||
}
|
&error);
|
||||||
/* Now if you write "/test blah" again in the ZoiteChat window
|
if (!result)
|
||||||
* you'll get a "Unknown command" error message */
|
{
|
||||||
g_print ("test command received: %s\n", word_eol[1]);
|
g_printerr ("%s failed: %s\n", method, error->message);
|
||||||
if (!dbus_g_proxy_call (proxy, "Print",
|
g_clear_error (&error);
|
||||||
&error,
|
return FALSE;
|
||||||
G_TYPE_STRING, "test command succeed",
|
|
||||||
G_TYPE_INVALID,
|
|
||||||
G_TYPE_INVALID)) {
|
|
||||||
write_error ("Failed to complete Print", &error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
if (out)
|
||||||
unload_cb (void)
|
*out = result;
|
||||||
{
|
else
|
||||||
g_print ("Good bye !\n");
|
g_variant_unref (result);
|
||||||
exit (EXIT_SUCCESS);
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
DBusGConnection *connection;
|
GDBusConnection *connection;
|
||||||
DBusGProxy *remote_object;
|
GDBusProxy *connection_proxy;
|
||||||
GMainLoop *mainloop;
|
GDBusProxy *plugin_proxy;
|
||||||
gchar *path;
|
GVariant *connect_result = NULL;
|
||||||
|
gchar *remote_path = NULL;
|
||||||
|
gchar *command = NULL;
|
||||||
|
const char *path_tmp;
|
||||||
|
int status = EXIT_FAILURE;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
#if ! GLIB_CHECK_VERSION (2, 36, 0)
|
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
|
||||||
g_type_init ();
|
if (!connection)
|
||||||
#endif
|
{
|
||||||
|
g_printerr ("Bus connection failed: %s\n", error->message);
|
||||||
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
|
g_clear_error (&error);
|
||||||
if (connection == NULL) {
|
|
||||||
write_error ("Couldn't connect to session bus", &error);
|
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
remote_object = dbus_g_proxy_new_for_name (connection,
|
connection_proxy = g_dbus_proxy_new_sync (connection,
|
||||||
DBUS_SERVICE,
|
G_DBUS_PROXY_FLAGS_NONE,
|
||||||
DBUS_REMOTE,
|
NULL,
|
||||||
DBUS_REMOTE_CONNECTION_INTERFACE);
|
DBUS_SERVICE,
|
||||||
if (!dbus_g_proxy_call (remote_object, "Connect",
|
DBUS_CONNECTION_PATH,
|
||||||
&error,
|
DBUS_CONNECTION_INTERFACE,
|
||||||
G_TYPE_STRING, argv[0],
|
NULL,
|
||||||
G_TYPE_STRING, "example",
|
&error);
|
||||||
G_TYPE_STRING, "Example of a D-Bus client",
|
if (!connection_proxy)
|
||||||
G_TYPE_STRING, "1.0",
|
{
|
||||||
G_TYPE_INVALID,
|
g_printerr ("Connection proxy failed: %s\n", error->message);
|
||||||
G_TYPE_STRING, &path, G_TYPE_INVALID)) {
|
g_clear_error (&error);
|
||||||
write_error ("Failed to complete Connect", &error);
|
g_object_unref (connection);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
g_object_unref (remote_object);
|
|
||||||
|
|
||||||
remote_object = dbus_g_proxy_new_for_name (connection,
|
if (!call_sync (connection_proxy,
|
||||||
DBUS_SERVICE,
|
"Connect",
|
||||||
path,
|
g_variant_new ("(ssss)", "example", "example", "GDBus example", "1.0"),
|
||||||
DBUS_REMOTE_PLUGIN_INTERFACE);
|
&connect_result))
|
||||||
g_free (path);
|
goto cleanup;
|
||||||
|
|
||||||
if (!dbus_g_proxy_call (remote_object, "HookCommand",
|
g_variant_get (connect_result, "(&s)", &path_tmp);
|
||||||
&error,
|
remote_path = g_strdup (path_tmp);
|
||||||
G_TYPE_STRING, "test",
|
g_variant_unref (connect_result);
|
||||||
G_TYPE_INT, 0,
|
connect_result = NULL;
|
||||||
G_TYPE_STRING, "Simple D-BUS example",
|
|
||||||
G_TYPE_INT, 1, G_TYPE_INVALID,
|
plugin_proxy = g_dbus_proxy_new_sync (connection,
|
||||||
G_TYPE_UINT, &command_id, G_TYPE_INVALID)) {
|
G_DBUS_PROXY_FLAGS_NONE,
|
||||||
write_error ("Failed to complete HookCommand", &error);
|
NULL,
|
||||||
return EXIT_FAILURE;
|
DBUS_SERVICE,
|
||||||
|
remote_path,
|
||||||
|
DBUS_PLUGIN_INTERFACE,
|
||||||
|
NULL,
|
||||||
|
&error);
|
||||||
|
if (!plugin_proxy)
|
||||||
|
{
|
||||||
|
g_printerr ("Plugin proxy failed: %s\n", error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
g_print ("Command hook id=%d\n", command_id);
|
|
||||||
|
|
||||||
if (!dbus_g_proxy_call (remote_object, "HookServer",
|
if (argc > 1)
|
||||||
&error,
|
command = g_strjoinv (" ", &argv[1]);
|
||||||
G_TYPE_STRING, "RAW LINE",
|
else
|
||||||
G_TYPE_INT, 0,
|
command = g_strdup ("gui focus");
|
||||||
G_TYPE_INT, 0, G_TYPE_INVALID,
|
|
||||||
G_TYPE_UINT, &server_id, G_TYPE_INVALID)) {
|
if (!call_sync (plugin_proxy, "Command", g_variant_new ("(s)", command), NULL))
|
||||||
write_error ("Failed to complete HookServer", &error);
|
{
|
||||||
return EXIT_FAILURE;
|
g_object_unref (plugin_proxy);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
g_print ("Server hook id=%d\n", server_id);
|
|
||||||
|
|
||||||
dbus_g_object_register_marshaller (
|
call_sync (connection_proxy, "Disconnect", g_variant_new ("()"), NULL);
|
||||||
_zoitechat_marshal_VOID__POINTER_POINTER_UINT_UINT,
|
status = EXIT_SUCCESS;
|
||||||
G_TYPE_NONE,
|
g_object_unref (plugin_proxy);
|
||||||
G_TYPE_STRV, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
|
|
||||||
dbus_g_object_register_marshaller (
|
cleanup:
|
||||||
g_cclosure_marshal_VOID__VOID,
|
g_free (command);
|
||||||
G_TYPE_NONE,
|
g_free (remote_path);
|
||||||
G_TYPE_INVALID);
|
g_object_unref (connection_proxy);
|
||||||
|
g_object_unref (connection);
|
||||||
dbus_g_proxy_add_signal (remote_object, "CommandSignal",
|
return status;
|
||||||
G_TYPE_STRV,
|
|
||||||
G_TYPE_STRV,
|
|
||||||
G_TYPE_UINT,
|
|
||||||
G_TYPE_UINT,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
dbus_g_proxy_connect_signal (remote_object, "CommandSignal",
|
|
||||||
G_CALLBACK (test_command_cb),
|
|
||||||
NULL, NULL);
|
|
||||||
|
|
||||||
dbus_g_proxy_add_signal (remote_object, "ServerSignal",
|
|
||||||
G_TYPE_STRV,
|
|
||||||
G_TYPE_STRV,
|
|
||||||
G_TYPE_UINT,
|
|
||||||
G_TYPE_UINT,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
dbus_g_proxy_connect_signal (remote_object, "ServerSignal",
|
|
||||||
G_CALLBACK (test_server_cb),
|
|
||||||
NULL, NULL);
|
|
||||||
|
|
||||||
dbus_g_proxy_add_signal (remote_object, "UnloadSignal",
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
dbus_g_proxy_connect_signal (remote_object, "UnloadSignal",
|
|
||||||
G_CALLBACK (unload_cb),
|
|
||||||
NULL, NULL);
|
|
||||||
|
|
||||||
/* Now you can write on the ZoiteChat windows: "/test arg1 arg2 ..." */
|
|
||||||
mainloop = g_main_loop_new (NULL, FALSE);
|
|
||||||
g_main_loop_run (mainloop);
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
dbus_deps = [
|
dbus_deps = []
|
||||||
dbus_glib_dep
|
|
||||||
]
|
|
||||||
|
|
||||||
dbus_sources = [
|
dbus_sources = [
|
||||||
'dbus-plugin.c',
|
'dbus-plugin.c',
|
||||||
@@ -35,16 +33,8 @@ configure_file(
|
|||||||
install_dir: dbus_service_dir
|
install_dir: dbus_service_dir
|
||||||
)
|
)
|
||||||
|
|
||||||
dbus_binding_tool = find_program('dbus-binding-tool')
|
|
||||||
dbus_remote_object = custom_target('remote-object-glue',
|
|
||||||
input: 'remote-object.xml',
|
|
||||||
output: 'remote-object-glue.h',
|
|
||||||
command: [dbus_binding_tool, '--prefix=remote_object', '--mode=glib-server',
|
|
||||||
'--output=@OUTPUT@', '@INPUT@']
|
|
||||||
)
|
|
||||||
|
|
||||||
zoitechat_dbus = static_library('zoitechatdbus',
|
zoitechat_dbus = static_library('zoitechatdbus',
|
||||||
sources: [dbus_remote_object, marshal] + dbus_sources,
|
sources: marshal + dbus_sources,
|
||||||
c_args: dbus_cargs,
|
c_args: dbus_cargs,
|
||||||
dependencies: common_deps + dbus_deps,
|
dependencies: common_deps + dbus_deps,
|
||||||
include_directories: dbus_includes,
|
include_directories: dbus_includes,
|
||||||
|
|||||||
71
src/common/gen-public-suffix.py
Normal file
71
src/common/gen-public-suffix.py
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import sys
|
||||||
|
import urllib.request
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
URLS = (
|
||||||
|
"https://raw.githubusercontent.com/publicsuffix/list/main/public_suffix_list.dat",
|
||||||
|
"https://publicsuffix.org/list/public_suffix_list.dat",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_rules(text: str):
|
||||||
|
rules = []
|
||||||
|
for raw in text.splitlines():
|
||||||
|
line = raw.strip()
|
||||||
|
if not line or line.startswith("//"):
|
||||||
|
continue
|
||||||
|
if " " in line or "\t" in line:
|
||||||
|
line = line.split()[0]
|
||||||
|
rules.append(line.lower())
|
||||||
|
return sorted(set(rules))
|
||||||
|
|
||||||
|
|
||||||
|
def emit_header(path: str, rules):
|
||||||
|
with open(path, "w", encoding="utf-8", newline="\n") as out:
|
||||||
|
out.write("#pragma once\n")
|
||||||
|
out.write("static const char * const public_suffix_rules[] = {\n")
|
||||||
|
for rule in rules:
|
||||||
|
escaped = rule.replace("\\", "\\\\").replace('"', '\\"')
|
||||||
|
out.write(f'\t"{escaped}",\n')
|
||||||
|
out.write("};\n")
|
||||||
|
out.write(
|
||||||
|
"static const unsigned int public_suffix_rules_len = sizeof(public_suffix_rules) / sizeof(public_suffix_rules[0]);\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) not in (2, 3):
|
||||||
|
raise SystemExit("usage: gen-public-suffix.py <output> [source]")
|
||||||
|
output = Path(sys.argv[1])
|
||||||
|
sources = []
|
||||||
|
if len(sys.argv) == 3:
|
||||||
|
sources.append(Path(sys.argv[2]))
|
||||||
|
sources.extend(
|
||||||
|
[
|
||||||
|
Path(__file__).with_name("public_suffix_list.dat"),
|
||||||
|
Path("/usr/share/publicsuffix/public_suffix_list.dat"),
|
||||||
|
Path("/app/share/publicsuffix/public_suffix_list.dat"),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
data = None
|
||||||
|
for url in URLS:
|
||||||
|
try:
|
||||||
|
with urllib.request.urlopen(url, timeout=30) as resp:
|
||||||
|
data = resp.read().decode("utf-8")
|
||||||
|
break
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
if data is None:
|
||||||
|
for source in sources:
|
||||||
|
if source.exists():
|
||||||
|
data = source.read_text(encoding="utf-8")
|
||||||
|
break
|
||||||
|
if data is None:
|
||||||
|
raise SystemExit("unable to load public suffix list")
|
||||||
|
rules = parse_rules(data)
|
||||||
|
emit_header(str(output), rules)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -1221,6 +1221,94 @@ extract_archive (const char *source, GError **error)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
path_find_first_file_recursive (const char *root, const char *name, int depth)
|
||||||
|
{
|
||||||
|
GDir *dir;
|
||||||
|
const char *entry;
|
||||||
|
|
||||||
|
if (!root || !name || depth < 0 || !g_file_test (root, G_FILE_TEST_IS_DIR))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
{
|
||||||
|
char *candidate = g_build_filename (root, name, NULL);
|
||||||
|
if (g_file_test (candidate, G_FILE_TEST_IS_REGULAR))
|
||||||
|
return candidate;
|
||||||
|
g_free (candidate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (depth == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
dir = g_dir_open (root, 0, NULL);
|
||||||
|
if (!dir)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
while ((entry = g_dir_read_name (dir)) != NULL)
|
||||||
|
{
|
||||||
|
char *child = g_build_filename (root, entry, NULL);
|
||||||
|
char *found = NULL;
|
||||||
|
|
||||||
|
if (g_file_test (child, G_FILE_TEST_IS_DIR))
|
||||||
|
found = path_find_first_file_recursive (child, name, depth - 1);
|
||||||
|
g_free (child);
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
g_dir_close (dir);
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_dir_close (dir);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
zoitechat_gtk3_theme_service_read_archive_text_file (const char *archive_path, const char *name, char **contents, GError **error)
|
||||||
|
{
|
||||||
|
char *root;
|
||||||
|
char *path;
|
||||||
|
gboolean ok;
|
||||||
|
GError *local_error = NULL;
|
||||||
|
|
||||||
|
if (contents)
|
||||||
|
*contents = NULL;
|
||||||
|
if (!archive_path || !*archive_path)
|
||||||
|
return g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, "No archive path provided."), FALSE;
|
||||||
|
if (!name || !*name)
|
||||||
|
return g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, "No file name provided."), FALSE;
|
||||||
|
if (!contents)
|
||||||
|
return g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, "No output buffer provided."), FALSE;
|
||||||
|
|
||||||
|
root = extract_archive (archive_path, error);
|
||||||
|
if (!root)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
path = path_find_first_file_recursive (root, name, 8);
|
||||||
|
if (!path)
|
||||||
|
{
|
||||||
|
remove_tree (root);
|
||||||
|
g_free (root);
|
||||||
|
return g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_NOENT, "Requested file was not found in archive."), FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ok = g_file_get_contents (path, contents, NULL, &local_error);
|
||||||
|
g_free (path);
|
||||||
|
remove_tree (root);
|
||||||
|
g_free (root);
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
if (error)
|
||||||
|
*error = local_error;
|
||||||
|
else
|
||||||
|
g_clear_error (&local_error);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
zoitechat_gtk3_theme_service_import (const char *source_path, char **imported_id, GError **error)
|
zoitechat_gtk3_theme_service_import (const char *source_path, char **imported_id, GError **error)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,5 +48,6 @@ gboolean zoitechat_gtk3_theme_service_remove_user_theme (const char *theme_id, G
|
|||||||
char *zoitechat_gtk3_theme_pick_css_dir_for_minor (const char *theme_root, int preferred_minor);
|
char *zoitechat_gtk3_theme_pick_css_dir_for_minor (const char *theme_root, int preferred_minor);
|
||||||
char *zoitechat_gtk3_theme_pick_css_dir (const char *theme_root);
|
char *zoitechat_gtk3_theme_pick_css_dir (const char *theme_root);
|
||||||
GPtrArray *zoitechat_gtk3_theme_build_inheritance_chain (const char *theme_root);
|
GPtrArray *zoitechat_gtk3_theme_build_inheritance_chain (const char *theme_root);
|
||||||
|
gboolean zoitechat_gtk3_theme_service_read_archive_text_file (const char *archive_path, const char *name, char **contents, GError **error);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -96,6 +96,14 @@ marshal = [
|
|||||||
|
|
||||||
make_te = find_program('make-te.py')
|
make_te = find_program('make-te.py')
|
||||||
|
|
||||||
|
|
||||||
|
python3 = find_program('python3', required: true)
|
||||||
|
|
||||||
|
public_suffix_data = custom_target('public_suffix_data_h',
|
||||||
|
output: 'public_suffix_data.h',
|
||||||
|
command: [python3, files('gen-public-suffix.py'), '@OUTPUT@']
|
||||||
|
)
|
||||||
|
|
||||||
textevents = custom_target('textevents',
|
textevents = custom_target('textevents',
|
||||||
input: 'textevents.in',
|
input: 'textevents.in',
|
||||||
output: ['textevents.h', 'textenums.h'],
|
output: ['textevents.h', 'textenums.h'],
|
||||||
@@ -107,7 +115,7 @@ if libssl_dep.found()
|
|||||||
common_deps += libssl_dep
|
common_deps += libssl_dep
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if dbus_glib_dep.found()
|
if dbus_dep.found()
|
||||||
subdir('dbus')
|
subdir('dbus')
|
||||||
common_deps += zoitechat_dbus_dep
|
common_deps += zoitechat_dbus_dep
|
||||||
common_includes += include_directories('dbus')
|
common_includes += include_directories('dbus')
|
||||||
@@ -119,7 +127,7 @@ if get_option('plugin')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
zoitechat_common = static_library('zoitechatcommon',
|
zoitechat_common = static_library('zoitechatcommon',
|
||||||
sources: [textevents] + marshal + common_sources,
|
sources: [textevents, public_suffix_data] + marshal + common_sources,
|
||||||
include_directories: config_h_include,
|
include_directories: config_h_include,
|
||||||
dependencies: common_deps + common_sysinfo_deps,
|
dependencies: common_deps + common_sysinfo_deps,
|
||||||
c_args: common_cflags,
|
c_args: common_cflags,
|
||||||
@@ -127,7 +135,7 @@ zoitechat_common = static_library('zoitechatcommon',
|
|||||||
)
|
)
|
||||||
|
|
||||||
zoitechat_common_dep = declare_dependency(
|
zoitechat_common_dep = declare_dependency(
|
||||||
sources: [textevents] + marshal,
|
sources: [textevents, public_suffix_data] + marshal,
|
||||||
link_with: zoitechat_common,
|
link_with: zoitechat_common,
|
||||||
include_directories: common_includes,
|
include_directories: common_includes,
|
||||||
compile_args: common_cflags,
|
compile_args: common_cflags,
|
||||||
|
|||||||
@@ -493,7 +493,6 @@ plugin_auto_load (session *sess)
|
|||||||
for_files (lib_dir, "hcperl.dll", plugin_auto_load_cb);
|
for_files (lib_dir, "hcperl.dll", plugin_auto_load_cb);
|
||||||
for_files (lib_dir, "hcpython3.dll", plugin_auto_load_cb);
|
for_files (lib_dir, "hcpython3.dll", plugin_auto_load_cb);
|
||||||
for_files (lib_dir, "hcupd.dll", plugin_auto_load_cb);
|
for_files (lib_dir, "hcupd.dll", plugin_auto_load_cb);
|
||||||
for_files (lib_dir, "hcwinamp.dll", plugin_auto_load_cb);
|
|
||||||
for_files (lib_dir, "hcsysinfo.dll", plugin_auto_load_cb);
|
for_files (lib_dir, "hcsysinfo.dll", plugin_auto_load_cb);
|
||||||
#else
|
#else
|
||||||
for_files (lib_dir, "*."PLUGIN_SUFFIX, plugin_auto_load_cb);
|
for_files (lib_dir, "*."PLUGIN_SUFFIX, plugin_auto_load_cb);
|
||||||
|
|||||||
146
src/common/url.c
146
src/common/url.c
@@ -20,12 +20,14 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <glib.h>
|
||||||
#include "zoitechat.h"
|
#include "zoitechat.h"
|
||||||
#include "zoitechatc.h"
|
#include "zoitechatc.h"
|
||||||
#include "cfgfiles.h"
|
#include "cfgfiles.h"
|
||||||
#include "fe.h"
|
#include "fe.h"
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
|
#include "public_suffix_data.h"
|
||||||
#ifdef HAVE_STRINGS_H
|
#ifdef HAVE_STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -35,6 +37,7 @@ GTree *url_btree = NULL;
|
|||||||
static gboolean regex_match (const GRegex *re, const char *word,
|
static gboolean regex_match (const GRegex *re, const char *word,
|
||||||
int *start, int *end);
|
int *start, int *end);
|
||||||
static const GRegex *re_url (void);
|
static const GRegex *re_url (void);
|
||||||
|
static const GRegex *re_url_no_scheme (void);
|
||||||
static const GRegex *re_email (void);
|
static const GRegex *re_email (void);
|
||||||
static const GRegex *re_nick (void);
|
static const GRegex *re_nick (void);
|
||||||
static const GRegex *re_channel (void);
|
static const GRegex *re_channel (void);
|
||||||
@@ -42,6 +45,8 @@ static gboolean match_nick (const char *word, int *start, int *end);
|
|||||||
static gboolean match_channel (const char *word, int *start, int *end);
|
static gboolean match_channel (const char *word, int *start, int *end);
|
||||||
static gboolean match_url (const char *word, int *start, int *end);
|
static gboolean match_url (const char *word, int *start, int *end);
|
||||||
static gboolean match_email (const char *word, int *start, int *end);
|
static gboolean match_email (const char *word, int *start, int *end);
|
||||||
|
static gboolean host_has_public_suffix (const char *host);
|
||||||
|
static gboolean host_has_public_suffix_range (const char *word, int start, int end);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
url_free (char *url, void *data)
|
url_free (char *url, void *data)
|
||||||
@@ -266,7 +271,16 @@ match_channel (const char *word, int *start, int *end)
|
|||||||
static gboolean
|
static gboolean
|
||||||
match_url (const char *word, int *start, int *end)
|
match_url (const char *word, int *start, int *end)
|
||||||
{
|
{
|
||||||
return regex_match (re_url (), word, start, end);
|
if (regex_match (re_url (), word, start, end))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (!regex_match (re_url_no_scheme (), word, start, end))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (*start > 0 && word[*start - 1] == '@')
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return host_has_public_suffix_range (word, *start, *end);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -393,6 +407,114 @@ regex_match (const GRegex *re, const char *word, int *start, int *end)
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
host_has_public_suffix_range (const char *word, int start, int end)
|
||||||
|
{
|
||||||
|
char *candidate;
|
||||||
|
const char *host_start;
|
||||||
|
const char *host_end;
|
||||||
|
const char *host_colon;
|
||||||
|
gboolean ok;
|
||||||
|
int host_len;
|
||||||
|
char *host;
|
||||||
|
|
||||||
|
candidate = g_strndup (word + start, end - start);
|
||||||
|
host_start = candidate;
|
||||||
|
host_end = candidate + strlen (candidate);
|
||||||
|
if (*host_start == '[')
|
||||||
|
{
|
||||||
|
g_free (candidate);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
host_colon = strchr (host_start, ':');
|
||||||
|
if (host_colon)
|
||||||
|
host_end = host_colon;
|
||||||
|
host_colon = strchr (host_start, '/');
|
||||||
|
if (host_colon && host_colon < host_end)
|
||||||
|
host_end = host_colon;
|
||||||
|
host_len = (int)(host_end - host_start);
|
||||||
|
if (host_len <= 0)
|
||||||
|
{
|
||||||
|
g_free (candidate);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
host = g_strndup (host_start, host_len);
|
||||||
|
ok = host_has_public_suffix (host);
|
||||||
|
g_free (host);
|
||||||
|
g_free (candidate);
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GHashTable *
|
||||||
|
public_suffix_table (void)
|
||||||
|
{
|
||||||
|
static GHashTable *table = NULL;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if (table)
|
||||||
|
return table;
|
||||||
|
|
||||||
|
table = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
|
for (i = 0; i < public_suffix_rules_len; i++)
|
||||||
|
{
|
||||||
|
g_hash_table_add (table, (gpointer)public_suffix_rules[i]);
|
||||||
|
}
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
host_has_public_suffix (const char *host)
|
||||||
|
{
|
||||||
|
GHashTable *table;
|
||||||
|
gchar **labels;
|
||||||
|
int i;
|
||||||
|
int n;
|
||||||
|
gboolean matched = FALSE;
|
||||||
|
|
||||||
|
if (!strchr (host, '.'))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
labels = g_strsplit (host, ".", -1);
|
||||||
|
for (n = 0; labels[n]; n++)
|
||||||
|
{
|
||||||
|
if (labels[n][0] == '\0')
|
||||||
|
{
|
||||||
|
g_strfreev (labels);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
table = public_suffix_table ();
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
char *tail = g_strjoinv (".", &labels[i]);
|
||||||
|
if (g_hash_table_contains (table, tail))
|
||||||
|
matched = TRUE;
|
||||||
|
if (i + 1 < n)
|
||||||
|
{
|
||||||
|
char *tail_wild = g_strjoinv (".", &labels[i + 1]);
|
||||||
|
char *wild = g_strconcat ("*.", tail_wild, NULL);
|
||||||
|
if (g_hash_table_contains (table, wild))
|
||||||
|
matched = TRUE;
|
||||||
|
g_free (tail_wild);
|
||||||
|
g_free (wild);
|
||||||
|
}
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
char *exc = g_strconcat ("!", tail, NULL);
|
||||||
|
if (g_hash_table_contains (table, exc))
|
||||||
|
matched = TRUE;
|
||||||
|
g_free (exc);
|
||||||
|
}
|
||||||
|
g_free (tail);
|
||||||
|
if (matched)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_strfreev (labels);
|
||||||
|
return matched;
|
||||||
|
}
|
||||||
|
|
||||||
/* Miscellaneous description --- */
|
/* Miscellaneous description --- */
|
||||||
#define DOMAIN_LABEL "[\\pL\\pN](?:[-\\pL\\pN]{0,61}[\\pL\\pN])?"
|
#define DOMAIN_LABEL "[\\pL\\pN](?:[-\\pL\\pN]{0,61}[\\pL\\pN])?"
|
||||||
#define DOMAIN DOMAIN_LABEL "(\\." DOMAIN_LABEL ")*"
|
#define DOMAIN DOMAIN_LABEL "(\\." DOMAIN_LABEL ")*"
|
||||||
@@ -477,6 +599,28 @@ re_url (void)
|
|||||||
return url_ret;
|
return url_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const GRegex *
|
||||||
|
re_url_no_scheme (void)
|
||||||
|
{
|
||||||
|
static GRegex *url_ret = NULL;
|
||||||
|
GString *grist_gstr;
|
||||||
|
char *grist;
|
||||||
|
|
||||||
|
if (url_ret) return url_ret;
|
||||||
|
|
||||||
|
grist_gstr = g_string_new (NULL);
|
||||||
|
g_string_append (grist_gstr, "(");
|
||||||
|
g_string_append (grist_gstr, HOST_URL_OPT_TLD OPT_PORT);
|
||||||
|
g_string_append_printf (grist_gstr, "(/" PATH ")?");
|
||||||
|
g_string_append (grist_gstr, ")");
|
||||||
|
|
||||||
|
grist = g_string_free (grist_gstr, FALSE);
|
||||||
|
url_ret = make_re (grist);
|
||||||
|
g_free (grist);
|
||||||
|
|
||||||
|
return url_ret;
|
||||||
|
}
|
||||||
|
|
||||||
#define EMAIL_LOCAL_ATOM "[\\pL\\pN!#$%&'*+/=?^_`{|}~-]+"
|
#define EMAIL_LOCAL_ATOM "[\\pL\\pN!#$%&'*+/=?^_`{|}~-]+"
|
||||||
#define EMAIL_LOCAL EMAIL_LOCAL_ATOM "(\\." EMAIL_LOCAL_ATOM ")*"
|
#define EMAIL_LOCAL EMAIL_LOCAL_ATOM "(\\." EMAIL_LOCAL_ATOM ")*"
|
||||||
#define EMAIL EMAIL_LOCAL "@" DOMAIN TLD
|
#define EMAIL EMAIL_LOCAL "@" DOMAIN TLD
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
* Copyright (C) 1998-2010 Peter Zelezny.
|
* Copyright (C) 1998-2010 Peter Zelezny.
|
||||||
* Copyright (C) 2009-2013 Berke Viktor.
|
* Copyright (C) 2009-2013 Berke Viktor.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or
|
||||||
* it under the terms of the GNU General Public License as published by
|
* modify it under the terms of the GNU General Public License
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* as published by the Free Software Foundation; either version 2
|
||||||
* (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, see
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* You can distribute this header with your plugins for easy compilation */
|
/* You can distribute this header with your plugins for easy compilation */
|
||||||
|
|||||||
@@ -61,28 +61,19 @@ static tab_scroll_animation *tab_right_animation;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static inline gint
|
static inline gint
|
||||||
cv_tabs_get_viewport_size (GdkWindow *parent_win, gboolean vertical)
|
cv_tabs_get_viewport_size (GtkAdjustment *adj)
|
||||||
{
|
{
|
||||||
gint viewport_size = 0;
|
return (gint) gtk_adjustment_get_page_size (adj);
|
||||||
|
|
||||||
if (vertical)
|
|
||||||
viewport_size = gdk_window_get_height (parent_win);
|
|
||||||
else
|
|
||||||
viewport_size = gdk_window_get_width (parent_win);
|
|
||||||
|
|
||||||
return viewport_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cv_tabs_sizealloc (GtkWidget *widget, GtkAllocation *allocation, chanview *cv)
|
cv_tabs_sizealloc (GtkWidget *widget, GtkAllocation *allocation, chanview *cv)
|
||||||
{
|
{
|
||||||
GdkWindow *parent_win;
|
|
||||||
GtkAdjustment *adj;
|
GtkAdjustment *adj;
|
||||||
GtkWidget *inner;
|
GtkWidget *inner;
|
||||||
gint viewport_size;
|
gint viewport_size;
|
||||||
|
|
||||||
inner = ((tabview *)cv)->inner;
|
inner = ((tabview *)cv)->inner;
|
||||||
parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner));
|
|
||||||
|
|
||||||
if (cv->vertical)
|
if (cv->vertical)
|
||||||
{
|
{
|
||||||
@@ -92,16 +83,20 @@ cv_tabs_sizealloc (GtkWidget *widget, GtkAllocation *allocation, chanview *cv)
|
|||||||
adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (gtk_widget_get_parent (inner)));
|
adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (gtk_widget_get_parent (inner)));
|
||||||
}
|
}
|
||||||
|
|
||||||
viewport_size = cv_tabs_get_viewport_size (parent_win, cv->vertical);
|
viewport_size = cv_tabs_get_viewport_size (adj);
|
||||||
|
|
||||||
if (gtk_adjustment_get_upper (adj) <= viewport_size)
|
if (gtk_adjustment_get_upper (adj) <= viewport_size)
|
||||||
{
|
{
|
||||||
gtk_widget_hide (((tabview *)cv)->b1);
|
if (((tabview *)cv)->b1)
|
||||||
gtk_widget_hide (((tabview *)cv)->b2);
|
gtk_widget_hide (((tabview *)cv)->b1);
|
||||||
|
if (((tabview *)cv)->b2)
|
||||||
|
gtk_widget_hide (((tabview *)cv)->b2);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
gtk_widget_show (((tabview *)cv)->b1);
|
if (((tabview *)cv)->b1)
|
||||||
gtk_widget_show (((tabview *)cv)->b2);
|
gtk_widget_show (((tabview *)cv)->b1);
|
||||||
|
if (((tabview *)cv)->b2)
|
||||||
|
gtk_widget_show (((tabview *)cv)->b2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,10 +236,8 @@ tab_scroll_left_up_clicked (GtkWidget *widget, chanview *cv)
|
|||||||
gint viewport_size;
|
gint viewport_size;
|
||||||
gfloat new_value;
|
gfloat new_value;
|
||||||
GtkWidget *inner;
|
GtkWidget *inner;
|
||||||
GdkWindow *parent_win;
|
|
||||||
|
|
||||||
inner = ((tabview *)cv)->inner;
|
inner = ((tabview *)cv)->inner;
|
||||||
parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner));
|
|
||||||
|
|
||||||
if (cv->vertical)
|
if (cv->vertical)
|
||||||
{
|
{
|
||||||
@@ -254,7 +247,7 @@ tab_scroll_left_up_clicked (GtkWidget *widget, chanview *cv)
|
|||||||
adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (gtk_widget_get_parent(inner)));
|
adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (gtk_widget_get_parent(inner)));
|
||||||
}
|
}
|
||||||
|
|
||||||
viewport_size = cv_tabs_get_viewport_size (parent_win, cv->vertical);
|
viewport_size = cv_tabs_get_viewport_size (adj);
|
||||||
|
|
||||||
new_value = tab_search_offset (inner, gtk_adjustment_get_value (adj), 0, cv->vertical);
|
new_value = tab_search_offset (inner, gtk_adjustment_get_value (adj), 0, cv->vertical);
|
||||||
|
|
||||||
@@ -279,10 +272,8 @@ tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv)
|
|||||||
gint viewport_size;
|
gint viewport_size;
|
||||||
gfloat new_value;
|
gfloat new_value;
|
||||||
GtkWidget *inner;
|
GtkWidget *inner;
|
||||||
GdkWindow *parent_win;
|
|
||||||
|
|
||||||
inner = ((tabview *)cv)->inner;
|
inner = ((tabview *)cv)->inner;
|
||||||
parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner));
|
|
||||||
|
|
||||||
if (cv->vertical)
|
if (cv->vertical)
|
||||||
{
|
{
|
||||||
@@ -292,7 +283,7 @@ tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv)
|
|||||||
adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (gtk_widget_get_parent(inner)));
|
adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (gtk_widget_get_parent(inner)));
|
||||||
}
|
}
|
||||||
|
|
||||||
viewport_size = cv_tabs_get_viewport_size (parent_win, cv->vertical);
|
viewport_size = cv_tabs_get_viewport_size (adj);
|
||||||
|
|
||||||
new_value = tab_search_offset (inner, gtk_adjustment_get_value (adj), 1, cv->vertical);
|
new_value = tab_search_offset (inner, gtk_adjustment_get_value (adj), 1, cv->vertical);
|
||||||
|
|
||||||
@@ -313,67 +304,37 @@ tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv)
|
|||||||
static gboolean
|
static gboolean
|
||||||
tab_scroll_cb (GtkWidget *widget, GdkEventScroll *event, gpointer cv)
|
tab_scroll_cb (GtkWidget *widget, GdkEventScroll *event, gpointer cv)
|
||||||
{
|
{
|
||||||
|
int direction = cv_scroll_direction (event);
|
||||||
|
|
||||||
if (prefs.hex_gui_tab_scrollchans)
|
if (prefs.hex_gui_tab_scrollchans)
|
||||||
{
|
{
|
||||||
if (event->direction == GDK_SCROLL_DOWN)
|
if (direction != 0)
|
||||||
mg_switch_page (1, 1);
|
{
|
||||||
else if (event->direction == GDK_SCROLL_UP)
|
mg_switch_page (1, direction);
|
||||||
mg_switch_page (1, -1);
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* mouse wheel scrolling */
|
if (direction < 0)
|
||||||
if (event->direction == GDK_SCROLL_UP)
|
{
|
||||||
tab_scroll_left_up_clicked (widget, cv);
|
tab_scroll_left_up_clicked (widget, cv);
|
||||||
else if (event->direction == GDK_SCROLL_DOWN)
|
return TRUE;
|
||||||
|
}
|
||||||
|
else if (direction > 0)
|
||||||
|
{
|
||||||
tab_scroll_right_down_clicked (widget, cv);
|
tab_scroll_right_down_clicked (widget, cv);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make a Scroll (arrow) button */
|
|
||||||
|
|
||||||
static GtkWidget *
|
|
||||||
make_sbutton (GtkArrowType type, void *click_cb, void *userdata)
|
|
||||||
{
|
|
||||||
GtkWidget *button, *arrow;
|
|
||||||
const char *icon_name = "pan-end-symbolic";
|
|
||||||
|
|
||||||
button = gtk_button_new ();
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case GTK_ARROW_UP:
|
|
||||||
icon_name = "pan-up-symbolic";
|
|
||||||
break;
|
|
||||||
case GTK_ARROW_DOWN:
|
|
||||||
icon_name = "pan-down-symbolic";
|
|
||||||
break;
|
|
||||||
case GTK_ARROW_LEFT:
|
|
||||||
icon_name = "pan-start-symbolic";
|
|
||||||
break;
|
|
||||||
case GTK_ARROW_RIGHT:
|
|
||||||
default:
|
|
||||||
icon_name = "pan-end-symbolic";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
arrow = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
|
|
||||||
gtk_container_add (GTK_CONTAINER (button), arrow);
|
|
||||||
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
|
|
||||||
g_signal_connect (G_OBJECT (button), "clicked",
|
|
||||||
G_CALLBACK (click_cb), userdata);
|
|
||||||
g_signal_connect (G_OBJECT (button), "scroll-event",
|
|
||||||
G_CALLBACK (tab_scroll_cb), userdata);
|
|
||||||
gtk_widget_show (arrow);
|
|
||||||
|
|
||||||
return button;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cv_tabs_init (chanview *cv)
|
cv_tabs_init (chanview *cv)
|
||||||
{
|
{
|
||||||
GtkWidget *box, *hbox = NULL;
|
GtkWidget *box;
|
||||||
GtkWidget *viewport;
|
GtkWidget *viewport;
|
||||||
GtkWidget *outer;
|
GtkWidget *outer;
|
||||||
|
|
||||||
@@ -390,12 +351,19 @@ cv_tabs_init (chanview *cv)
|
|||||||
G_CALLBACK (cv_tabs_sizealloc), cv);
|
G_CALLBACK (cv_tabs_sizealloc), cv);
|
||||||
gtk_widget_show (outer);
|
gtk_widget_show (outer);
|
||||||
|
|
||||||
viewport = gtk_viewport_new (0, 0);
|
viewport = gtk_scrolled_window_new (0, 0);
|
||||||
gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (viewport), GTK_SHADOW_NONE);
|
||||||
if (cv->vertical)
|
if (cv->vertical)
|
||||||
gtk_widget_set_size_request (viewport, -1, 1);
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (viewport),
|
||||||
|
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||||
else
|
else
|
||||||
gtk_widget_set_size_request (viewport, 1, -1);
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (viewport),
|
||||||
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
|
||||||
|
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (viewport), 1);
|
||||||
|
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (viewport), 1);
|
||||||
|
gtk_widget_set_hexpand (viewport, TRUE);
|
||||||
|
gtk_widget_set_vexpand (viewport, TRUE);
|
||||||
|
cv_add_scroll_events (viewport);
|
||||||
g_signal_connect (G_OBJECT (viewport), "scroll-event",
|
g_signal_connect (G_OBJECT (viewport), "scroll-event",
|
||||||
G_CALLBACK (tab_scroll_cb), cv);
|
G_CALLBACK (tab_scroll_cb), cv);
|
||||||
gtk_box_pack_start (GTK_BOX (outer), viewport, 1, 1, 0);
|
gtk_box_pack_start (GTK_BOX (outer), viewport, 1, 1, 0);
|
||||||
@@ -413,35 +381,6 @@ cv_tabs_init (chanview *cv)
|
|||||||
gtk_container_add (GTK_CONTAINER (viewport), box);
|
gtk_container_add (GTK_CONTAINER (viewport), box);
|
||||||
gtk_widget_show (box);
|
gtk_widget_show (box);
|
||||||
|
|
||||||
/* if vertical, the buttons can be side by side */
|
|
||||||
if (cv->vertical)
|
|
||||||
{
|
|
||||||
hbox = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
|
||||||
gtk_box_pack_start (GTK_BOX (outer), hbox, 0, 0, 0);
|
|
||||||
gtk_widget_show (hbox);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make the Scroll buttons */
|
|
||||||
((tabview *)cv)->b2 = make_sbutton (cv->vertical ?
|
|
||||||
GTK_ARROW_UP : GTK_ARROW_LEFT,
|
|
||||||
tab_scroll_left_up_clicked,
|
|
||||||
cv);
|
|
||||||
|
|
||||||
((tabview *)cv)->b1 = make_sbutton (cv->vertical ?
|
|
||||||
GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
|
|
||||||
tab_scroll_right_down_clicked,
|
|
||||||
cv);
|
|
||||||
|
|
||||||
if (hbox)
|
|
||||||
{
|
|
||||||
gtk_container_add (GTK_CONTAINER (hbox), ((tabview *)cv)->b2);
|
|
||||||
gtk_container_add (GTK_CONTAINER (hbox), ((tabview *)cv)->b1);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
gtk_box_pack_start (GTK_BOX (outer), ((tabview *)cv)->b2, 0, 0, 0);
|
|
||||||
gtk_box_pack_start (GTK_BOX (outer), ((tabview *)cv)->b1, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (cv->box), outer);
|
gtk_container_add (GTK_CONTAINER (cv->box), outer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -746,9 +685,11 @@ cv_tabs_add (chanview *cv, chan *ch, char *name, GtkTreeIter *parent)
|
|||||||
gtk_widget_set_name (but, "zoitechat-tab");
|
gtk_widget_set_name (but, "zoitechat-tab");
|
||||||
gtk_widget_set_size_request (but, -1, 14);
|
gtk_widget_set_size_request (but, -1, 14);
|
||||||
gtk_widget_add_events (but, GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
|
gtk_widget_add_events (but, GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
|
||||||
|
cv_add_scroll_events (but);
|
||||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
||||||
label = gtk_label_new (name);
|
label = gtk_label_new (name);
|
||||||
close_button = gtk_button_new ();
|
close_button = gtk_button_new ();
|
||||||
|
cv_add_scroll_events (close_button);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (close_button), "flat");
|
gtk_style_context_add_class (gtk_widget_get_style_context (close_button), "flat");
|
||||||
close_icon = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
|
close_icon = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
|
||||||
gtk_image_set_pixel_size (GTK_IMAGE (close_icon), 8);
|
gtk_image_set_pixel_size (GTK_IMAGE (close_icon), 8);
|
||||||
@@ -764,6 +705,10 @@ cv_tabs_add (chanview *cv, chan *ch, char *name, GtkTreeIter *parent)
|
|||||||
/* used to trap right-clicks */
|
/* used to trap right-clicks */
|
||||||
g_signal_connect (G_OBJECT (but), "button-press-event",
|
g_signal_connect (G_OBJECT (but), "button-press-event",
|
||||||
G_CALLBACK (tab_click_cb), ch);
|
G_CALLBACK (tab_click_cb), ch);
|
||||||
|
g_signal_connect (G_OBJECT (but), "scroll-event",
|
||||||
|
G_CALLBACK (tab_scroll_cb), cv);
|
||||||
|
g_signal_connect (G_OBJECT (close_button), "scroll-event",
|
||||||
|
G_CALLBACK (tab_scroll_cb), cv);
|
||||||
g_signal_connect (G_OBJECT (but), "motion-notify-event",
|
g_signal_connect (G_OBJECT (but), "motion-notify-event",
|
||||||
G_CALLBACK (tab_close_motion_cb), ch);
|
G_CALLBACK (tab_close_motion_cb), ch);
|
||||||
g_signal_connect (G_OBJECT (but), "leave-notify-event",
|
g_signal_connect (G_OBJECT (but), "leave-notify-event",
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ cv_tree_sel_cb (GtkTreeSelection *sel, chanview *cv)
|
|||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter prev_iter;
|
GtkTreeIter prev_iter;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
GtkTreePath *path;
|
||||||
|
GtkTreeView *view;
|
||||||
chan *ch;
|
chan *ch;
|
||||||
chan *prev_ch;
|
chan *prev_ch;
|
||||||
gboolean has_prev;
|
gboolean has_prev;
|
||||||
@@ -60,6 +62,20 @@ cv_tree_sel_cb (GtkTreeSelection *sel, chanview *cv)
|
|||||||
if (has_prev)
|
if (has_prev)
|
||||||
{
|
{
|
||||||
gtk_tree_model_get (model, &prev_iter, COL_CHAN, &prev_ch, -1);
|
gtk_tree_model_get (model, &prev_iter, COL_CHAN, &prev_ch, -1);
|
||||||
|
if (prev_ch != ch && gtk_tree_store_is_ancestor (cv->store, &iter, &prev_iter))
|
||||||
|
{
|
||||||
|
view = gtk_tree_selection_get_tree_view (sel);
|
||||||
|
path = gtk_tree_model_get_path (model, &iter);
|
||||||
|
if (path)
|
||||||
|
{
|
||||||
|
if (!gtk_tree_view_row_expanded (view, path))
|
||||||
|
{
|
||||||
|
gtk_tree_path_free (path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gtk_tree_path_free (path);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (prev_ch != ch)
|
if (prev_ch != ch)
|
||||||
gtk_tree_store_set (cv->store, &prev_iter, COL_UNDERLINE, PANGO_UNDERLINE_NONE, -1);
|
gtk_tree_store_set (cv->store, &prev_iter, COL_UNDERLINE, PANGO_UNDERLINE_NONE, -1);
|
||||||
}
|
}
|
||||||
@@ -95,12 +111,12 @@ cv_tree_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, gpointer user
|
|||||||
{
|
{
|
||||||
if (prefs.hex_gui_tab_scrollchans)
|
if (prefs.hex_gui_tab_scrollchans)
|
||||||
{
|
{
|
||||||
if (event->direction == GDK_SCROLL_DOWN)
|
int direction = cv_scroll_direction (event);
|
||||||
mg_switch_page (1, 1);
|
|
||||||
else if (event->direction == GDK_SCROLL_UP)
|
|
||||||
mg_switch_page (1, -1);
|
|
||||||
|
|
||||||
return TRUE;
|
if (direction != 0)
|
||||||
|
mg_switch_page (1, direction);
|
||||||
|
|
||||||
|
return direction != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -125,6 +141,7 @@ cv_tree_init (chanview *cv)
|
|||||||
win = gtk_scrolled_window_new (0, 0);
|
win = gtk_scrolled_window_new (0, 0);
|
||||||
gtk_widget_set_hexpand (win, TRUE);
|
gtk_widget_set_hexpand (win, TRUE);
|
||||||
gtk_widget_set_vexpand (win, TRUE);
|
gtk_widget_set_vexpand (win, TRUE);
|
||||||
|
cv_add_scroll_events (win);
|
||||||
|
|
||||||
/*gtk_container_set_border_width (GTK_CONTAINER (win), 1);*/
|
/*gtk_container_set_border_width (GTK_CONTAINER (win), 1);*/
|
||||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (win),
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (win),
|
||||||
@@ -138,6 +155,7 @@ cv_tree_init (chanview *cv)
|
|||||||
view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (cv->store));
|
view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (cv->store));
|
||||||
gtk_widget_set_hexpand (view, TRUE);
|
gtk_widget_set_hexpand (view, TRUE);
|
||||||
gtk_widget_set_vexpand (view, TRUE);
|
gtk_widget_set_vexpand (view, TRUE);
|
||||||
|
cv_add_scroll_events (view);
|
||||||
gtk_widget_set_name (view, "zoitechat-tree");
|
gtk_widget_set_name (view, "zoitechat-tree");
|
||||||
{
|
{
|
||||||
ThemeWidgetStyleValues style_values;
|
ThemeWidgetStyleValues style_values;
|
||||||
|
|||||||
@@ -95,6 +95,37 @@ static chan *cv_find_chan_by_number (chanview *cv, int num);
|
|||||||
static int cv_find_number_of_chan (chanview *cv, chan *find_ch);
|
static int cv_find_number_of_chan (chanview *cv, chan *find_ch);
|
||||||
static void cv_find_neighbors_for_removal (chanview *cv, chan *find_ch, chan **left_ch, chan **first_ch);
|
static void cv_find_neighbors_for_removal (chanview *cv, chan *find_ch, chan **left_ch, chan **first_ch);
|
||||||
|
|
||||||
|
static void
|
||||||
|
cv_add_scroll_events (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
gtk_widget_add_events (widget, GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cv_scroll_direction (GdkEventScroll *event)
|
||||||
|
{
|
||||||
|
gdouble dx;
|
||||||
|
gdouble dy;
|
||||||
|
|
||||||
|
if (event->direction == GDK_SCROLL_SMOOTH && gdk_event_get_scroll_deltas ((GdkEvent *) event, &dx, &dy))
|
||||||
|
{
|
||||||
|
if (dy > 0)
|
||||||
|
return 1;
|
||||||
|
if (dy < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (event->direction)
|
||||||
|
{
|
||||||
|
case GDK_SCROLL_DOWN:
|
||||||
|
return 1;
|
||||||
|
case GDK_SCROLL_UP:
|
||||||
|
return -1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ======= TABS ======= */
|
/* ======= TABS ======= */
|
||||||
|
|
||||||
|
|||||||
@@ -443,6 +443,27 @@ key_handle_key_press (GtkWidget *wid, GdkEventKey *evt, session *sess)
|
|||||||
if (!list)
|
if (!list)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
current_sess = sess;
|
current_sess = sess;
|
||||||
|
if ((evt->state & GDK_CONTROL_MASK) &&
|
||||||
|
!(evt->state & (GDK_MOD1_MASK | GDK_META_MASK)))
|
||||||
|
{
|
||||||
|
if (!(evt->state & GDK_SHIFT_MASK) &&
|
||||||
|
(evt->keyval == GDK_KEY_w || evt->keyval == GDK_KEY_W))
|
||||||
|
{
|
||||||
|
if (sess->type == SESS_CHANNEL)
|
||||||
|
{
|
||||||
|
fe_close_window (sess);
|
||||||
|
g_signal_stop_emission_by_name (G_OBJECT (wid), "key-press-event");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((evt->state & GDK_SHIFT_MASK) &&
|
||||||
|
(evt->keyval == GDK_KEY_t || evt->keyval == GDK_KEY_T))
|
||||||
|
{
|
||||||
|
mg_reopen_closed_channel_tab ();
|
||||||
|
g_signal_stop_emission_by_name (G_OBJECT (wid), "key-press-event");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (plugin_emit_keypress (sess, evt->state, evt->keyval, gdk_keyval_to_unicode (evt->keyval)))
|
if (plugin_emit_keypress (sess, evt->state, evt->keyval, gdk_keyval_to_unicode (evt->keyval)))
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1952,8 +1973,37 @@ replace_handle (GtkWidget *t)
|
|||||||
{
|
{
|
||||||
ptrdiff_t found_offset = found - text;
|
ptrdiff_t found_offset = found - text;
|
||||||
ptrdiff_t found_end_offset = found_offset + (ptrdiff_t) pop_len;
|
ptrdiff_t found_end_offset = found_offset + (ptrdiff_t) pop_len;
|
||||||
|
gboolean start_ok;
|
||||||
|
gboolean end_ok;
|
||||||
int rank;
|
int rank;
|
||||||
ptrdiff_t distance;
|
ptrdiff_t distance;
|
||||||
|
const char *before = found;
|
||||||
|
const char *after = found + pop_len;
|
||||||
|
|
||||||
|
if (before > text)
|
||||||
|
{
|
||||||
|
before = g_utf8_find_prev_char (text, before);
|
||||||
|
start_ok = !before || (!g_unichar_isalnum (g_utf8_get_char (before)) && g_utf8_get_char (before) != '_');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
start_ok = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*after != '\0')
|
||||||
|
{
|
||||||
|
end_ok = !g_unichar_isalnum (g_utf8_get_char (after)) && g_utf8_get_char (after) != '_';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
end_ok = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!start_ok || !end_ok)
|
||||||
|
{
|
||||||
|
found++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (cursor_byte_offset >= found_offset && cursor_byte_offset <= found_end_offset)
|
if (cursor_byte_offset >= found_offset && cursor_byte_offset <= found_end_offset)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -468,6 +468,14 @@ static session_gui static_mg_gui;
|
|||||||
static session_gui *mg_gui = NULL; /* the shared irc tab */
|
static session_gui *mg_gui = NULL; /* the shared irc tab */
|
||||||
static int ignore_chanmode = FALSE;
|
static int ignore_chanmode = FALSE;
|
||||||
static const char chan_flags[] = { 'c', 'n', 't', 'i', 'm', 'l', 'k' };
|
static const char chan_flags[] = { 'c', 'n', 't', 'i', 'm', 'l', 'k' };
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int server_id;
|
||||||
|
char channel[CHANLEN];
|
||||||
|
char key[64];
|
||||||
|
}
|
||||||
|
mg_closed_channel_tab;
|
||||||
|
static GSList *mg_closed_channel_tabs;
|
||||||
|
|
||||||
static chan *active_tab = NULL; /* active tab */
|
static chan *active_tab = NULL; /* active tab */
|
||||||
GtkWidget *parent_window = NULL; /* the master window */
|
GtkWidget *parent_window = NULL; /* the master window */
|
||||||
@@ -862,12 +870,34 @@ fe_set_title (session *sess)
|
|||||||
gtk_window_set_title (GTK_WINDOW (sess->gui->window), tbuf);
|
gtk_window_set_title (GTK_WINDOW (sess->gui->window), tbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mg_topicbar_update_height (GtkWidget *topic);
|
||||||
|
|
||||||
|
static session *
|
||||||
|
mg_session_from_window (GtkWidget *wid)
|
||||||
|
{
|
||||||
|
GSList *list;
|
||||||
|
session *sess;
|
||||||
|
|
||||||
|
list = sess_list;
|
||||||
|
while (list)
|
||||||
|
{
|
||||||
|
sess = list->data;
|
||||||
|
if (sess && sess->gui && sess->gui->window == wid)
|
||||||
|
return sess;
|
||||||
|
list = list->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return current_sess;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata)
|
mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata)
|
||||||
{
|
{
|
||||||
guint win_state;
|
guint win_state;
|
||||||
guint win_fullscreen;
|
guint win_fullscreen;
|
||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
|
session *sess;
|
||||||
|
|
||||||
if ((event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) &&
|
if ((event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) &&
|
||||||
(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) &&
|
(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) &&
|
||||||
@@ -903,6 +933,20 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
|
|||||||
mg_schedule_config_save ();
|
mg_schedule_config_save ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sess = mg_session_from_window (GTK_WIDGET (wid));
|
||||||
|
if (sess && sess->gui && GTK_IS_WIDGET (sess->gui->topic_entry))
|
||||||
|
{
|
||||||
|
mg_topicbar_update_height (sess->gui->topic_entry);
|
||||||
|
gtk_widget_queue_draw (sess->gui->topic_entry);
|
||||||
|
}
|
||||||
|
if (sess && sess->gui && GTK_IS_XTEXT (sess->gui->xtext))
|
||||||
|
{
|
||||||
|
gtk_xtext_refresh (GTK_XTEXT (sess->gui->xtext));
|
||||||
|
gtk_widget_queue_draw (sess->gui->xtext);
|
||||||
|
}
|
||||||
|
if (sess && sess->gui && GTK_IS_WIDGET (sess->gui->window))
|
||||||
|
gtk_widget_queue_draw (sess->gui->window);
|
||||||
|
|
||||||
menu_set_fullscreen (current_sess->gui, prefs.hex_gui_win_fullscreen);
|
menu_set_fullscreen (current_sess->gui, prefs.hex_gui_win_fullscreen);
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
@@ -916,6 +960,7 @@ static gboolean
|
|||||||
mg_configure_cb (GtkWidget *wid, GdkEventConfigure *event, session *sess)
|
mg_configure_cb (GtkWidget *wid, GdkEventConfigure *event, session *sess)
|
||||||
{
|
{
|
||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
|
session *target_sess;
|
||||||
|
|
||||||
if (sess == NULL)
|
if (sess == NULL)
|
||||||
{
|
{
|
||||||
@@ -998,6 +1043,23 @@ mg_configure_cb (GtkWidget *wid, GdkEventConfigure *event, session *sess)
|
|||||||
mg_schedule_config_save ();
|
mg_schedule_config_save ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target_sess = mg_session_from_window (wid);
|
||||||
|
if (target_sess && target_sess->gui)
|
||||||
|
{
|
||||||
|
if (GTK_IS_WIDGET (target_sess->gui->topic_entry))
|
||||||
|
{
|
||||||
|
mg_topicbar_update_height (target_sess->gui->topic_entry);
|
||||||
|
gtk_widget_queue_draw (target_sess->gui->topic_entry);
|
||||||
|
}
|
||||||
|
if (GTK_IS_XTEXT (target_sess->gui->xtext))
|
||||||
|
{
|
||||||
|
gtk_xtext_refresh (GTK_XTEXT (target_sess->gui->xtext));
|
||||||
|
gtk_widget_queue_draw (target_sess->gui->xtext);
|
||||||
|
}
|
||||||
|
if (GTK_IS_WIDGET (target_sess->gui->window))
|
||||||
|
gtk_widget_queue_draw (target_sess->gui->window);
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1589,6 +1651,71 @@ mg_tab_close_cb (GtkWidget *dialog, gint arg1, session *sess)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mg_closed_channel_tabs_add (session *sess)
|
||||||
|
{
|
||||||
|
mg_closed_channel_tab *item;
|
||||||
|
GSList *last;
|
||||||
|
|
||||||
|
if (!sess || sess->type != SESS_CHANNEL || !sess->channel[0])
|
||||||
|
return;
|
||||||
|
|
||||||
|
item = g_new0 (mg_closed_channel_tab, 1);
|
||||||
|
item->server_id = sess->server->id;
|
||||||
|
g_strlcpy (item->channel, sess->channel, sizeof (item->channel));
|
||||||
|
g_strlcpy (item->key, sess->channelkey, sizeof (item->key));
|
||||||
|
mg_closed_channel_tabs = g_slist_prepend (mg_closed_channel_tabs, item);
|
||||||
|
if (g_slist_length (mg_closed_channel_tabs) > 20)
|
||||||
|
{
|
||||||
|
last = g_slist_last (mg_closed_channel_tabs);
|
||||||
|
g_free (last->data);
|
||||||
|
mg_closed_channel_tabs = g_slist_delete_link (mg_closed_channel_tabs, last);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mg_reopen_closed_channel_tab (void)
|
||||||
|
{
|
||||||
|
mg_closed_channel_tab *item;
|
||||||
|
GSList *head;
|
||||||
|
GSList *list;
|
||||||
|
server *serv;
|
||||||
|
session *sess;
|
||||||
|
|
||||||
|
if (!mg_closed_channel_tabs)
|
||||||
|
return;
|
||||||
|
|
||||||
|
head = mg_closed_channel_tabs;
|
||||||
|
item = head->data;
|
||||||
|
mg_closed_channel_tabs = g_slist_delete_link (mg_closed_channel_tabs, head);
|
||||||
|
if (!item)
|
||||||
|
return;
|
||||||
|
|
||||||
|
serv = NULL;
|
||||||
|
for (list = serv_list; list; list = list->next)
|
||||||
|
{
|
||||||
|
server *candidate = list->data;
|
||||||
|
if (candidate->id == item->server_id)
|
||||||
|
{
|
||||||
|
serv = candidate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (serv && serv->connected && item->channel[0])
|
||||||
|
{
|
||||||
|
sess = find_channel (serv, item->channel);
|
||||||
|
if (sess)
|
||||||
|
fe_ctrl_gui (sess, 2, 0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new_ircwindow (serv, item->channel, SESS_CHANNEL, 1);
|
||||||
|
serv->p_join (serv, item->channel, item->key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (item);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mg_tab_close (session *sess)
|
mg_tab_close (session *sess)
|
||||||
{
|
{
|
||||||
@@ -1596,11 +1723,12 @@ mg_tab_close (session *sess)
|
|||||||
GSList *list;
|
GSList *list;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (chan_remove (sess->res->tab, FALSE))
|
if (chan_remove (sess->res->tab, FALSE))
|
||||||
{
|
{
|
||||||
sess->res->tab = NULL;
|
mg_closed_channel_tabs_add (sess);
|
||||||
mg_ircdestroy (sess);
|
sess->res->tab = NULL;
|
||||||
}
|
mg_ircdestroy (sess);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0, list = sess_list; list; list = list->next)
|
for (i = 0, list = sess_list; list; list = list->next)
|
||||||
@@ -2443,6 +2571,7 @@ mg_topic_word_is_clickable (const char *word, int word_pos)
|
|||||||
{
|
{
|
||||||
int start;
|
int start;
|
||||||
int end;
|
int end;
|
||||||
|
int word_type;
|
||||||
|
|
||||||
if (!word || word[0] == 0)
|
if (!word || word[0] == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -2450,7 +2579,8 @@ mg_topic_word_is_clickable (const char *word, int word_pos)
|
|||||||
if (strcmp (word, "/") == 0)
|
if (strcmp (word, "/") == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (url_check_word (word) == 0)
|
word_type = url_check_word (word);
|
||||||
|
if (word_type != WORD_URL && word_type != WORD_HOST && word_type != WORD_HOST6)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
url_last (&start, &end);
|
url_last (&start, &end);
|
||||||
@@ -2499,7 +2629,8 @@ mg_topic_button_release_cb (GtkWidget *entry, GdkEventButton *event, gpointer us
|
|||||||
if (!word)
|
if (!word)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (mg_topic_word_is_clickable (word, word_pos))
|
if ((event->state & 13) == prefs.hex_gui_url_mod &&
|
||||||
|
mg_topic_word_is_clickable (word, word_pos))
|
||||||
{
|
{
|
||||||
url_last (&start, &end);
|
url_last (&start, &end);
|
||||||
word[end] = 0;
|
word[end] = 0;
|
||||||
@@ -2969,13 +3100,36 @@ mg_create_dialogbuttons (GtkWidget *box)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mg_configure_topic_scroller (GtkWidget *scroller, GtkWidget *topic)
|
mg_topicbar_update_height (GtkWidget *topic)
|
||||||
{
|
{
|
||||||
|
GtkWidget *scroller;
|
||||||
|
GtkTextBuffer *buffer;
|
||||||
|
GtkTextIter start;
|
||||||
|
GtkTextIter end;
|
||||||
|
PangoLayout *layout;
|
||||||
|
char *text;
|
||||||
|
int width;
|
||||||
|
int line_height;
|
||||||
|
int line_count;
|
||||||
|
int target_height;
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
PangoFontMetrics *metrics;
|
PangoFontMetrics *metrics;
|
||||||
int line_height;
|
|
||||||
int min_height;
|
if (!topic || !GTK_IS_TEXT_VIEW (topic))
|
||||||
int max_height;
|
return;
|
||||||
|
|
||||||
|
scroller = gtk_widget_get_parent (topic);
|
||||||
|
|
||||||
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (topic));
|
||||||
|
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||||
|
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
|
||||||
|
layout = gtk_widget_create_pango_layout (topic, text && text[0] ? text : " ");
|
||||||
|
g_free (text);
|
||||||
|
|
||||||
|
width = gtk_widget_get_allocated_width (topic) - 8;
|
||||||
|
if (width > 0)
|
||||||
|
pango_layout_set_width (layout, width * PANGO_SCALE);
|
||||||
|
pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
|
||||||
|
|
||||||
context = gtk_widget_get_pango_context (topic);
|
context = gtk_widget_get_pango_context (topic);
|
||||||
metrics = pango_context_get_metrics (context,
|
metrics = pango_context_get_metrics (context,
|
||||||
@@ -2984,26 +3138,52 @@ mg_configure_topic_scroller (GtkWidget *scroller, GtkWidget *topic)
|
|||||||
line_height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
|
line_height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
|
||||||
pango_font_metrics_get_descent (metrics));
|
pango_font_metrics_get_descent (metrics));
|
||||||
pango_font_metrics_unref (metrics);
|
pango_font_metrics_unref (metrics);
|
||||||
|
|
||||||
if (line_height <= 0)
|
if (line_height <= 0)
|
||||||
line_height = 16;
|
line_height = 16;
|
||||||
|
line_count = pango_layout_get_line_count (layout);
|
||||||
|
if (line_count <= 0)
|
||||||
|
line_count = 1;
|
||||||
|
target_height = line_height * line_count;
|
||||||
|
if (target_height < line_height)
|
||||||
|
target_height = line_height;
|
||||||
|
|
||||||
min_height = line_height + 8;
|
gtk_widget_set_size_request (topic, -1, target_height);
|
||||||
max_height = line_height * 4 + 8;
|
if (scroller && GTK_IS_SCROLLED_WINDOW (scroller))
|
||||||
|
{
|
||||||
|
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (scroller), -1);
|
||||||
|
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scroller), -1);
|
||||||
|
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (scroller), target_height);
|
||||||
|
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scroller), target_height);
|
||||||
|
gtk_widget_set_size_request (scroller, -1, target_height);
|
||||||
|
gtk_widget_queue_resize (scroller);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_widget_queue_resize (topic);
|
||||||
|
}
|
||||||
|
gtk_widget_queue_draw (topic);
|
||||||
|
g_object_unref (layout);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller),
|
static void
|
||||||
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
mg_topicbar_buffer_changed_cb (GtkTextBuffer *buffer, gpointer userdata)
|
||||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroller), GTK_SHADOW_NONE);
|
{
|
||||||
gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (scroller), TRUE);
|
(void) buffer;
|
||||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scroller), min_height);
|
mg_topicbar_update_height (GTK_WIDGET (userdata));
|
||||||
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (scroller), max_height);
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mg_topicbar_size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer userdata)
|
||||||
|
{
|
||||||
|
(void) allocation;
|
||||||
|
(void) userdata;
|
||||||
|
mg_topicbar_update_height (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mg_apply_session_font_prefs (session_gui *gui)
|
mg_apply_session_font_prefs (session_gui *gui)
|
||||||
{
|
{
|
||||||
const PangoFontDescription *font = NULL;
|
const PangoFontDescription *font = NULL;
|
||||||
GtkWidget *topic_scroller;
|
|
||||||
|
|
||||||
if (!gui)
|
if (!gui)
|
||||||
return;
|
return;
|
||||||
@@ -3014,9 +3194,7 @@ mg_apply_session_font_prefs (session_gui *gui)
|
|||||||
if (gui->topic_entry)
|
if (gui->topic_entry)
|
||||||
{
|
{
|
||||||
theme_manager_apply_entry_palette (gui->topic_entry, font);
|
theme_manager_apply_entry_palette (gui->topic_entry, font);
|
||||||
topic_scroller = gtk_widget_get_parent (gui->topic_entry);
|
mg_topicbar_update_height (gui->topic_entry);
|
||||||
if (topic_scroller && GTK_IS_SCROLLED_WINDOW (topic_scroller))
|
|
||||||
mg_configure_topic_scroller (topic_scroller, gui->topic_entry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gui->input_box && prefs.hex_gui_input_style)
|
if (gui->input_box && prefs.hex_gui_input_style)
|
||||||
@@ -3034,7 +3212,7 @@ mg_apply_session_font_prefs (session_gui *gui)
|
|||||||
static void
|
static void
|
||||||
mg_create_topicbar (session *sess, GtkWidget *box)
|
mg_create_topicbar (session *sess, GtkWidget *box)
|
||||||
{
|
{
|
||||||
GtkWidget *vbox, *hbox, *mode_hbox, *topic, *bbox, *topic_scroller;
|
GtkWidget *vbox, *hbox, *mode_hbox, *topic, *bbox;
|
||||||
session_gui *gui = sess->gui;
|
session_gui *gui = sess->gui;
|
||||||
|
|
||||||
gui->topic_bar = vbox = mg_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
gui->topic_bar = vbox = mg_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||||
@@ -3048,14 +3226,21 @@ mg_create_topicbar (session *sess, GtkWidget *box)
|
|||||||
|
|
||||||
gui->topic_entry = topic = gtk_text_view_new ();
|
gui->topic_entry = topic = gtk_text_view_new ();
|
||||||
gtk_widget_set_name (topic, "zoitechat-topicbox");
|
gtk_widget_set_name (topic, "zoitechat-topicbox");
|
||||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (topic), GTK_WRAP_WORD);
|
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (topic), GTK_WRAP_WORD_CHAR);
|
||||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (topic), 4);
|
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (topic), 4);
|
||||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (topic), 4);
|
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (topic), 4);
|
||||||
topic_scroller = gtk_scrolled_window_new (NULL, NULL);
|
gtk_text_view_set_top_margin (GTK_TEXT_VIEW (topic), 4);
|
||||||
gtk_container_add (GTK_CONTAINER (topic_scroller), topic);
|
gtk_text_view_set_bottom_margin (GTK_TEXT_VIEW (topic), 4);
|
||||||
|
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (topic), 0);
|
||||||
|
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (topic), 0);
|
||||||
|
gtk_text_view_set_pixels_inside_wrap (GTK_TEXT_VIEW (topic), 0);
|
||||||
theme_manager_apply_entry_palette (topic, input_style ? input_style->font_desc : NULL);
|
theme_manager_apply_entry_palette (topic, input_style ? input_style->font_desc : NULL);
|
||||||
mg_configure_topic_scroller (topic_scroller, topic);
|
g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (topic)), "changed",
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), topic_scroller, TRUE, TRUE, 0);
|
G_CALLBACK (mg_topicbar_buffer_changed_cb), topic);
|
||||||
|
g_signal_connect (G_OBJECT (topic), "size-allocate",
|
||||||
|
G_CALLBACK (mg_topicbar_size_allocate_cb), NULL);
|
||||||
|
mg_topicbar_update_height (topic);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), topic, TRUE, TRUE, 0);
|
||||||
gtk_widget_add_events (topic, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
gtk_widget_add_events (topic, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
||||||
GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
|
GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
|
||||||
g_signal_connect (G_OBJECT (topic), "key-press-event",
|
g_signal_connect (G_OBJECT (topic), "key-press-event",
|
||||||
@@ -3228,8 +3413,13 @@ mg_create_textarea (session *sess, GtkWidget *box)
|
|||||||
inbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 2);
|
inbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 2);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), inbox, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), inbox, TRUE, TRUE, 0);
|
||||||
|
|
||||||
frame = gtk_frame_new (NULL);
|
frame = gtk_scrolled_window_new (NULL, NULL);
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
gtk_widget_set_hexpand (frame, TRUE);
|
||||||
|
gtk_widget_set_vexpand (frame, TRUE);
|
||||||
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (frame),
|
||||||
|
GTK_SHADOW_IN);
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (frame),
|
||||||
|
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||||
gtk_box_pack_start (GTK_BOX (inbox), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (inbox), frame, TRUE, TRUE, 0);
|
||||||
|
|
||||||
theme_get_xtext_colors_for_widget (frame, xtext_palette, XTEXT_COLS);
|
theme_get_xtext_colors_for_widget (frame, xtext_palette, XTEXT_COLS);
|
||||||
@@ -3246,9 +3436,7 @@ mg_create_textarea (session *sess, GtkWidget *box)
|
|||||||
g_signal_connect (G_OBJECT (xtext), "word_click",
|
g_signal_connect (G_OBJECT (xtext), "word_click",
|
||||||
G_CALLBACK (mg_word_clicked), NULL);
|
G_CALLBACK (mg_word_clicked), NULL);
|
||||||
|
|
||||||
gui->vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL,
|
gui->vscrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (frame));
|
||||||
GTK_XTEXT (xtext)->adj);
|
|
||||||
gtk_box_pack_start (GTK_BOX (inbox), gui->vscrollbar, FALSE, TRUE, 0);
|
|
||||||
|
|
||||||
gtk_drag_dest_set (gui->vscrollbar, 5, dnd_dest_targets, 2,
|
gtk_drag_dest_set (gui->vscrollbar, 5, dnd_dest_targets, 2,
|
||||||
GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK);
|
GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK);
|
||||||
@@ -3381,6 +3569,44 @@ mg_theme_userlist_changed (const ThemeChangedEvent *event, gpointer userdata)
|
|||||||
mg_theme_apply_userlist_style (gui);
|
mg_theme_apply_userlist_style (gui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mg_theme_refresh_menu_widget (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkRequisition minimum;
|
||||||
|
GtkRequisition natural;
|
||||||
|
|
||||||
|
if (!widget)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_widget_queue_resize (widget);
|
||||||
|
gtk_widget_get_preferred_size (widget, &minimum, &natural);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mg_theme_refresh_menu_tree (GtkWidget *menu)
|
||||||
|
{
|
||||||
|
GList *children;
|
||||||
|
GList *node;
|
||||||
|
|
||||||
|
if (!menu || !GTK_IS_MENU_SHELL (menu))
|
||||||
|
return;
|
||||||
|
|
||||||
|
children = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||||
|
for (node = children; node; node = node->next)
|
||||||
|
{
|
||||||
|
GtkWidget *item = GTK_WIDGET (node->data);
|
||||||
|
GtkWidget *submenu = NULL;
|
||||||
|
|
||||||
|
if (GTK_IS_MENU_ITEM (item))
|
||||||
|
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (item));
|
||||||
|
if (submenu)
|
||||||
|
mg_theme_refresh_menu_tree (submenu);
|
||||||
|
mg_theme_refresh_menu_widget (item);
|
||||||
|
}
|
||||||
|
g_list_free (children);
|
||||||
|
mg_theme_refresh_menu_widget (menu);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mg_theme_window_changed (const ThemeChangedEvent *event, gpointer userdata)
|
mg_theme_window_changed (const ThemeChangedEvent *event, gpointer userdata)
|
||||||
{
|
{
|
||||||
@@ -3391,8 +3617,11 @@ mg_theme_window_changed (const ThemeChangedEvent *event, gpointer userdata)
|
|||||||
!theme_changed_event_has_reason (event, THEME_CHANGED_REASON_WIDGET_STYLE))
|
!theme_changed_event_has_reason (event, THEME_CHANGED_REASON_WIDGET_STYLE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gui)
|
if (!gui)
|
||||||
theme_manager_apply_to_window (gui->window);
|
return;
|
||||||
|
|
||||||
|
theme_manager_apply_to_window (gui->window);
|
||||||
|
mg_theme_refresh_menu_tree (gui->menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3435,8 +3664,14 @@ mg_create_userlist (session_gui *gui, GtkWidget *box)
|
|||||||
gtk_box_pack_start (GTK_BOX (box), vbox, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box), vbox, TRUE, TRUE, 0);
|
||||||
|
|
||||||
gui->namelistinfo = gtk_label_new (NULL);
|
gui->namelistinfo = gtk_label_new (NULL);
|
||||||
gtk_label_set_xalign (GTK_LABEL (gui->namelistinfo), 0.0f);
|
gtk_label_set_xalign (GTK_LABEL (gui->namelistinfo), 0.5f);
|
||||||
gtk_widget_set_halign (gui->namelistinfo, GTK_ALIGN_START);
|
gtk_label_set_justify (GTK_LABEL (gui->namelistinfo), GTK_JUSTIFY_CENTER);
|
||||||
|
gtk_label_set_ellipsize (GTK_LABEL (gui->namelistinfo), PANGO_ELLIPSIZE_END);
|
||||||
|
gtk_label_set_width_chars (GTK_LABEL (gui->namelistinfo), 1);
|
||||||
|
gtk_widget_set_margin_start (gui->namelistinfo, 0);
|
||||||
|
gtk_widget_set_margin_end (gui->namelistinfo, 0);
|
||||||
|
gtk_widget_set_hexpand (gui->namelistinfo, TRUE);
|
||||||
|
gtk_widget_set_halign (gui->namelistinfo, GTK_ALIGN_FILL);
|
||||||
if (prefs.hex_gui_ulist_count)
|
if (prefs.hex_gui_ulist_count)
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), gui->namelistinfo, 0, 0, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), gui->namelistinfo, 0, 0, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ void mg_apply_setup (void);
|
|||||||
void mg_apply_session_font_prefs (session_gui *gui);
|
void mg_apply_session_font_prefs (session_gui *gui);
|
||||||
void mg_close_sess (session *);
|
void mg_close_sess (session *);
|
||||||
void mg_tab_close (session *sess);
|
void mg_tab_close (session *sess);
|
||||||
|
void mg_reopen_closed_channel_tab (void);
|
||||||
void mg_detach (session *sess, int mode);
|
void mg_detach (session *sess, int mode);
|
||||||
void mg_progressbar_create (session_gui *gui);
|
void mg_progressbar_create (session_gui *gui);
|
||||||
void mg_progressbar_destroy (session_gui *gui);
|
void mg_progressbar_destroy (session_gui *gui);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ notification_backend_show (const char *title, const char *text)
|
|||||||
g_variant_builder_init (¶ms, G_VARIANT_TYPE ("(susssasa{sv}i)"));
|
g_variant_builder_init (¶ms, G_VARIANT_TYPE ("(susssasa{sv}i)"));
|
||||||
g_variant_builder_add (¶ms, "s", "zoitechat"); /* App name */
|
g_variant_builder_add (¶ms, "s", "zoitechat"); /* App name */
|
||||||
g_variant_builder_add (¶ms, "u", 0); /* ID, 0 means don't replace */
|
g_variant_builder_add (¶ms, "u", 0); /* ID, 0 means don't replace */
|
||||||
g_variant_builder_add (¶ms, "s", "io.github.Hexchat"); /* App icon */
|
g_variant_builder_add (¶ms, "s", "net.zoite.Zoitechat"); /* App icon */
|
||||||
g_variant_builder_add (¶ms, "s", title);
|
g_variant_builder_add (¶ms, "s", title);
|
||||||
g_variant_builder_add (¶ms, "s", text);
|
g_variant_builder_add (¶ms, "s", text);
|
||||||
g_variant_builder_add (¶ms, "as", NULL); /* Actions */
|
g_variant_builder_add (¶ms, "as", NULL); /* Actions */
|
||||||
@@ -65,7 +65,7 @@ notification_backend_show (const char *title, const char *text)
|
|||||||
g_variant_builder_open (¶ms, G_VARIANT_TYPE ("a{sv}"));
|
g_variant_builder_open (¶ms, G_VARIANT_TYPE ("a{sv}"));
|
||||||
g_variant_builder_open (¶ms, G_VARIANT_TYPE ("{sv}"));
|
g_variant_builder_open (¶ms, G_VARIANT_TYPE ("{sv}"));
|
||||||
g_variant_builder_add (¶ms, "s", "desktop-entry");
|
g_variant_builder_add (¶ms, "s", "desktop-entry");
|
||||||
g_variant_builder_add (¶ms, "v", g_variant_new_string ("io.github.Hexchat"));
|
g_variant_builder_add (¶ms, "v", g_variant_new_string ("net.zoite.Zoitechat"));
|
||||||
g_variant_builder_close (¶ms);
|
g_variant_builder_close (¶ms);
|
||||||
g_variant_builder_close (¶ms);
|
g_variant_builder_close (¶ms);
|
||||||
|
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ static const setting filexfer_settings[] =
|
|||||||
{ST_TOGGLE, N_("Receive window"), P_OFFINTNL(hex_gui_autoopen_recv), 0, 0, 0},
|
{ST_TOGGLE, N_("Receive window"), P_OFFINTNL(hex_gui_autoopen_recv), 0, 0, 0},
|
||||||
{ST_TOGGLE, N_("Chat window"), P_OFFINTNL(hex_gui_autoopen_chat), 0, 0, 0},
|
{ST_TOGGLE, N_("Chat window"), P_OFFINTNL(hex_gui_autoopen_chat), 0, 0, 0},
|
||||||
|
|
||||||
{ST_HEADER, N_("Maximum File Transfer Speeds (Byte per Second)"), 0, 0, 0},
|
{ST_HEADER, N_("Maximum File Transfer Speeds (KiB/s or MiB/s)"), 0, 0, 0},
|
||||||
{ST_NUMBER, N_("One upload:"), P_OFFINTNL(hex_dcc_max_send_cps),
|
{ST_NUMBER, N_("One upload:"), P_OFFINTNL(hex_dcc_max_send_cps),
|
||||||
N_("Maximum speed for one transfer"), 0, 10000000},
|
N_("Maximum speed for one transfer"), 0, 10000000},
|
||||||
{ST_NUMBER, N_("One download:"), P_OFFINTNL(hex_dcc_max_get_cps),
|
{ST_NUMBER, N_("One download:"), P_OFFINTNL(hex_dcc_max_get_cps),
|
||||||
@@ -873,6 +873,67 @@ setup_create_italic_label (char *text)
|
|||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const setting *set;
|
||||||
|
GtkSpinButton *spin;
|
||||||
|
GtkComboBox *unit;
|
||||||
|
} setup_dcc_speed_data;
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
setup_is_dcc_speed_setting (const setting *set)
|
||||||
|
{
|
||||||
|
return set->offset == P_OFFINTNL (hex_dcc_max_send_cps)
|
||||||
|
|| set->offset == P_OFFINTNL (hex_dcc_max_get_cps)
|
||||||
|
|| set->offset == P_OFFINTNL (hex_dcc_global_max_send_cps)
|
||||||
|
|| set->offset == P_OFFINTNL (hex_dcc_global_max_get_cps);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
setup_dcc_speed_multiplier (GtkComboBox *combo)
|
||||||
|
{
|
||||||
|
return gtk_combo_box_get_active (combo) == 1 ? 1024 * 1024 : 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup_dcc_speed_spin_range (setup_dcc_speed_data *data)
|
||||||
|
{
|
||||||
|
int max = data->set->extra / setup_dcc_speed_multiplier (data->unit);
|
||||||
|
gtk_spin_button_set_range (data->spin, 0, max > 0 ? max : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup_dcc_speed_store (setup_dcc_speed_data *data)
|
||||||
|
{
|
||||||
|
int value = gtk_spin_button_get_value_as_int (data->spin);
|
||||||
|
int speed = value * setup_dcc_speed_multiplier (data->unit);
|
||||||
|
if (speed > data->set->extra)
|
||||||
|
speed = data->set->extra;
|
||||||
|
setup_set_int (&setup_prefs, data->set, speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup_dcc_speed_spin_cb (GtkSpinButton *spin, setup_dcc_speed_data *data)
|
||||||
|
{
|
||||||
|
(void)spin;
|
||||||
|
setup_dcc_speed_store (data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup_dcc_speed_unit_cb (GtkComboBox *combo, setup_dcc_speed_data *data)
|
||||||
|
{
|
||||||
|
int speed = setup_get_int (&setup_prefs, data->set);
|
||||||
|
int multiplier;
|
||||||
|
int value;
|
||||||
|
|
||||||
|
(void)combo;
|
||||||
|
setup_dcc_speed_spin_range (data);
|
||||||
|
multiplier = setup_dcc_speed_multiplier (data->unit);
|
||||||
|
value = (speed + (multiplier / 2)) / multiplier;
|
||||||
|
gtk_spin_button_set_value (data->spin, value);
|
||||||
|
setup_dcc_speed_store (data);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_spin_cb (GtkSpinButton *spin, const setting *set)
|
setup_spin_cb (GtkSpinButton *spin, const setting *set)
|
||||||
{
|
{
|
||||||
@@ -902,11 +963,43 @@ setup_create_spin (GtkWidget *table, int row, const setting *set)
|
|||||||
g_object_set_data (G_OBJECT (wid), "lbl", label);
|
g_object_set_data (G_OBJECT (wid), "lbl", label);
|
||||||
if (set->tooltip)
|
if (set->tooltip)
|
||||||
gtk_widget_set_tooltip_text (wid, _(set->tooltip));
|
gtk_widget_set_tooltip_text (wid, _(set->tooltip));
|
||||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (wid),
|
if (setup_is_dcc_speed_setting (set))
|
||||||
|
{
|
||||||
|
GtkWidget *unit;
|
||||||
|
setup_dcc_speed_data *data = g_new0 (setup_dcc_speed_data, 1);
|
||||||
|
int speed = setup_get_int (&setup_prefs, set);
|
||||||
|
int use_mib = speed >= (1024 * 1024) && speed % (1024 * 1024) == 0;
|
||||||
|
int multiplier;
|
||||||
|
|
||||||
|
data->set = set;
|
||||||
|
data->spin = GTK_SPIN_BUTTON (wid);
|
||||||
|
|
||||||
|
unit = gtk_combo_box_text_new ();
|
||||||
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (unit), _("KiB/s"));
|
||||||
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (unit), _("MiB/s"));
|
||||||
|
gtk_combo_box_set_wrap_width (GTK_COMBO_BOX (unit), 1);
|
||||||
|
gtk_combo_box_set_active (GTK_COMBO_BOX (unit), use_mib ? 1 : 0);
|
||||||
|
data->unit = GTK_COMBO_BOX (unit);
|
||||||
|
|
||||||
|
setup_dcc_speed_spin_range (data);
|
||||||
|
multiplier = setup_dcc_speed_multiplier (data->unit);
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (wid), (speed + (multiplier / 2)) / multiplier);
|
||||||
|
|
||||||
|
g_signal_connect (G_OBJECT (wid), "value-changed",
|
||||||
|
G_CALLBACK (setup_dcc_speed_spin_cb), data);
|
||||||
|
g_signal_connect (G_OBJECT (unit), "changed",
|
||||||
|
G_CALLBACK (setup_dcc_speed_unit_cb), data);
|
||||||
|
|
||||||
|
gtk_box_pack_start (GTK_BOX (rbox), wid, 0, 0, 0);
|
||||||
|
gtk_box_pack_start (GTK_BOX (rbox), unit, 0, 0, 6);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (wid),
|
||||||
setup_get_int (&setup_prefs, set));
|
setup_get_int (&setup_prefs, set));
|
||||||
g_signal_connect (G_OBJECT (wid), "value-changed",
|
g_signal_connect (G_OBJECT (wid), "value-changed",
|
||||||
G_CALLBACK (setup_spin_cb), (gpointer)set);
|
G_CALLBACK (setup_spin_cb), (gpointer)set);
|
||||||
gtk_box_pack_start (GTK_BOX (rbox), wid, 0, 0, 0);
|
gtk_box_pack_start (GTK_BOX (rbox), wid, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (set->list)
|
if (set->list)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,6 +59,17 @@ fe_open_url (const char *url)
|
|||||||
(void)url;
|
(void)url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
get_xdir (void)
|
||||||
|
{
|
||||||
|
return (char *)"/tmp";
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
load_text_events (void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
theme_get_color (ThemeSemanticToken token, GdkRGBA *color)
|
theme_get_color (ThemeSemanticToken token, GdkRGBA *color)
|
||||||
{
|
{
|
||||||
@@ -188,6 +199,16 @@ zoitechat_gtk3_theme_service_import (const char *source_path, char **imported_id
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
zoitechat_gtk3_theme_service_read_archive_text_file (const char *archive_path, const char *name, char **contents, GError **error)
|
||||||
|
{
|
||||||
|
(void)archive_path;
|
||||||
|
(void)name;
|
||||||
|
(void)contents;
|
||||||
|
(void)error;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
zoitechat_gtk3_theme_service_remove_user_theme (const char *theme_id, GError **error)
|
zoitechat_gtk3_theme_service_remove_user_theme (const char *theme_id, GError **error)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -82,6 +82,36 @@ theme_token_to_rgb16 (ThemeSemanticToken token, guint16 *red, guint16 *green, gu
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GtkStateFlags
|
||||||
|
theme_access_state_with_base (GtkStyleContext *context, GtkStateFlags state)
|
||||||
|
{
|
||||||
|
GtkStateFlags base_state;
|
||||||
|
|
||||||
|
base_state = gtk_style_context_get_state (context);
|
||||||
|
base_state &= (GTK_STATE_FLAG_DIR_LTR | GTK_STATE_FLAG_DIR_RTL | GTK_STATE_FLAG_BACKDROP | GTK_STATE_FLAG_FOCUSED);
|
||||||
|
return base_state | state;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
theme_access_context_get_color (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *out_color)
|
||||||
|
{
|
||||||
|
gtk_style_context_save (context);
|
||||||
|
gtk_style_context_set_state (context, theme_access_state_with_base (context, state));
|
||||||
|
gtk_style_context_get_color (context, gtk_style_context_get_state (context), out_color);
|
||||||
|
gtk_style_context_restore (context);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
theme_access_context_get_background_color (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *out_color)
|
||||||
|
{
|
||||||
|
gtk_style_context_save (context);
|
||||||
|
gtk_style_context_set_state (context, theme_access_state_with_base (context, state));
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
|
gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), out_color);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
gtk_style_context_restore (context);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
theme_access_get_gtk_palette_map (GtkWidget *widget, ThemeGtkPaletteMap *out_map)
|
theme_access_get_gtk_palette_map (GtkWidget *widget, ThemeGtkPaletteMap *out_map)
|
||||||
{
|
{
|
||||||
@@ -96,13 +126,11 @@ theme_access_get_gtk_palette_map (GtkWidget *widget, ThemeGtkPaletteMap *out_map
|
|||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &out_map->text_foreground);
|
theme_access_context_get_color (context, GTK_STATE_FLAG_NORMAL, &out_map->text_foreground);
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
theme_access_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &out_map->text_background);
|
||||||
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &out_map->text_background);
|
theme_access_context_get_color (context, GTK_STATE_FLAG_SELECTED, &out_map->selection_foreground);
|
||||||
gtk_style_context_get_color (context, GTK_STATE_FLAG_SELECTED, &out_map->selection_foreground);
|
theme_access_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &out_map->selection_background);
|
||||||
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &out_map->selection_background);
|
theme_access_context_get_color (context, GTK_STATE_FLAG_LINK, &accent);
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
||||||
gtk_style_context_get_color (context, GTK_STATE_FLAG_LINK, &accent);
|
|
||||||
if (accent.alpha <= 0.0)
|
if (accent.alpha <= 0.0)
|
||||||
accent = out_map->selection_background;
|
accent = out_map->selection_background;
|
||||||
out_map->accent = accent;
|
out_map->accent = accent;
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ static const char *theme_css_selector_dark_class = "zoitechat-dark";
|
|||||||
static const char *theme_css_selector_light_class = "zoitechat-light";
|
static const char *theme_css_selector_light_class = "zoitechat-light";
|
||||||
static const char *theme_css_palette_provider_key = "zoitechat-palette-provider";
|
static const char *theme_css_palette_provider_key = "zoitechat-palette-provider";
|
||||||
static const guint theme_css_provider_priority = GTK_STYLE_PROVIDER_PRIORITY_USER;
|
static const guint theme_css_provider_priority = GTK_STYLE_PROVIDER_PRIORITY_USER;
|
||||||
|
static const char *theme_css_palette_scope_selectors =
|
||||||
|
".zoitechat-palette, .zoitechat-palette *, .zoitechat-palette box, .zoitechat-palette grid, .zoitechat-palette stack, .zoitechat-palette frame, .zoitechat-palette paned, .zoitechat-palette paned > separator, .zoitechat-palette separator, .zoitechat-palette viewport, .zoitechat-palette overlay, .zoitechat-palette revealer, .zoitechat-palette notebook, .zoitechat-palette notebook > header, .zoitechat-palette notebook > header > tabs, .zoitechat-palette notebook > header > tabs > tab, .zoitechat-palette scrolledwindow, .zoitechat-palette scrollbar, .zoitechat-palette scrollbar slider, .zoitechat-palette scrollbar trough, .zoitechat-palette treeview, .zoitechat-palette treeview.view, .zoitechat-palette treeview.view text, .zoitechat-palette treeview.view cell, .zoitechat-palette treeview.view row, .zoitechat-palette treeview header, .zoitechat-palette treeview header button, .zoitechat-palette list, .zoitechat-palette list row, .zoitechat-palette row, .zoitechat-palette textview, .zoitechat-palette textview text, .zoitechat-palette text, .zoitechat-palette entry, .zoitechat-palette entry text, .zoitechat-palette button, .zoitechat-palette button label, .zoitechat-palette check, .zoitechat-palette switch, .zoitechat-palette slider, .zoitechat-palette scale, .zoitechat-palette scale trough, .zoitechat-palette scale highlight, .zoitechat-palette spinbutton, .zoitechat-palette combobox, .zoitechat-palette combobox box, .zoitechat-palette progressbar, .zoitechat-palette progressbar trough, .zoitechat-palette levelbar, .zoitechat-palette levelbar trough, .zoitechat-palette menubar, .zoitechat-palette menu, .zoitechat-palette menuitem, .zoitechat-palette menuitem label, .zoitechat-palette toolbar, .zoitechat-palette headerbar, .zoitechat-palette label, .zoitechat-palette link, .zoitechat-palette infobar, .zoitechat-palette statusbar, .zoitechat-palette statusbar frame, .zoitechat-palette tooltip, .zoitechat-palette tooltip label";
|
||||||
|
static const char *theme_css_palette_selection_selectors =
|
||||||
|
".zoitechat-palette *:selected, .zoitechat-palette *:selected:focus, .zoitechat-palette *:selected:hover, .zoitechat-palette treeview.view:selected, .zoitechat-palette treeview.view:selected:focus, .zoitechat-palette treeview.view:selected:hover, .zoitechat-palette row:selected, .zoitechat-palette row:selected:focus, .zoitechat-palette row:selected:hover, .zoitechat-palette selection, .zoitechat-palette text selection, .zoitechat-palette entry selection, .zoitechat-palette entry text selection, .zoitechat-palette button:selected, .zoitechat-palette button:checked, .zoitechat-palette check:checked, .zoitechat-palette switch:checked, .zoitechat-palette slider:active, .zoitechat-palette menuitem:selected, .zoitechat-palette menuitem:hover, .zoitechat-palette notebook > header > tabs > tab:checked, .zoitechat-palette notebook > header > tabs > tab:hover, .zoitechat-palette treeview header button:hover, .zoitechat-palette treeview header button:active, .zoitechat-palette progressbar progress, .zoitechat-palette levelbar block.filled, .zoitechat-palette:focus selection, .zoitechat-palette:focus text selection";
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -323,13 +327,16 @@ theme_css_apply_palette_widget (GtkWidget *widget, const GdkRGBA *bg, const GdkR
|
|||||||
}
|
}
|
||||||
gtkutil_append_font_css (css, font_desc);
|
gtkutil_append_font_css (css, font_desc);
|
||||||
g_string_append (css, " }");
|
g_string_append (css, " }");
|
||||||
g_string_append_printf (css, ".%s, .%s *, .%s treeview, .%s treeview.view, .%s treeview.view text, .%s treeview.view cell, .%s treeview.view row, .%s list, .%s list row, .%s text {", theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class);
|
g_string_append_printf (css, "%s {", theme_css_palette_scope_selectors);
|
||||||
if (bg)
|
if (bg)
|
||||||
g_string_append_printf (css, " background-color: %s;", bg_color);
|
g_string_append_printf (css, " background-color: %s;", bg_color);
|
||||||
if (fg)
|
if (fg)
|
||||||
|
{
|
||||||
g_string_append_printf (css, " color: %s;", fg_color);
|
g_string_append_printf (css, " color: %s;", fg_color);
|
||||||
|
g_string_append_printf (css, " caret-color: %s;", fg_color);
|
||||||
|
}
|
||||||
g_string_append (css, " }");
|
g_string_append (css, " }");
|
||||||
g_string_append_printf (css, ".%s *:selected, .%s *:selected:focus, .%s *:selected:hover, .%s treeview.view:selected, .%s treeview.view:selected:focus, .%s treeview.view:selected:hover, .%s row:selected, .%s row:selected:focus, .%s row:selected:hover, .%s selection, .%s text selection, .%s entry selection, .%s entry text selection, .%s:focus selection, .%s:focus text selection {", theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class, theme_css_selector_palette_class);
|
g_string_append_printf (css, "%s {", theme_css_palette_selection_selectors);
|
||||||
if (sel_bg_color)
|
if (sel_bg_color)
|
||||||
g_string_append_printf (css, " background-color: %s;", sel_bg_color);
|
g_string_append_printf (css, " background-color: %s;", sel_bg_color);
|
||||||
else if (bg)
|
else if (bg)
|
||||||
|
|||||||
@@ -29,12 +29,15 @@
|
|||||||
|
|
||||||
#include "../gtkutil.h"
|
#include "../gtkutil.h"
|
||||||
#include "../../common/fe.h"
|
#include "../../common/fe.h"
|
||||||
|
#include "../../common/cfgfiles.h"
|
||||||
#include "../../common/util.h"
|
#include "../../common/util.h"
|
||||||
#include "../../common/gtk3-theme-service.h"
|
#include "../../common/gtk3-theme-service.h"
|
||||||
#include "theme-gtk3.h"
|
#include "theme-gtk3.h"
|
||||||
#include "theme-manager.h"
|
#include "theme-manager.h"
|
||||||
#include "theme-preferences.h"
|
#include "theme-preferences.h"
|
||||||
|
|
||||||
|
extern void load_text_events (void);
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GtkWindow *parent;
|
GtkWindow *parent;
|
||||||
@@ -932,6 +935,21 @@ theme_preferences_show_import_error (GtkWidget *button, const char *message)
|
|||||||
gtk_widget_destroy (dialog);
|
gtk_widget_destroy (dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
theme_preferences_show_import_info (GtkWidget *button, const char *message)
|
||||||
|
{
|
||||||
|
GtkWidget *dialog;
|
||||||
|
|
||||||
|
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (button)),
|
||||||
|
GTK_DIALOG_MODAL,
|
||||||
|
GTK_MESSAGE_INFO,
|
||||||
|
GTK_BUTTONS_CLOSE,
|
||||||
|
"%s",
|
||||||
|
message);
|
||||||
|
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||||
|
gtk_widget_destroy (dialog);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
theme_preferences_parse_cfg_color (const char *cfg,
|
theme_preferences_parse_cfg_color (const char *cfg,
|
||||||
const char *key,
|
const char *key,
|
||||||
@@ -1038,40 +1056,77 @@ static void
|
|||||||
theme_preferences_import_colors_conf_cb (GtkWidget *button, gpointer user_data)
|
theme_preferences_import_colors_conf_cb (GtkWidget *button, gpointer user_data)
|
||||||
{
|
{
|
||||||
gboolean *color_change_flag = user_data;
|
gboolean *color_change_flag = user_data;
|
||||||
GtkWidget *dialog;
|
GtkFileChooserNative *dialog;
|
||||||
char *path;
|
char *path;
|
||||||
|
char *lower_path;
|
||||||
char *cfg;
|
char *cfg;
|
||||||
|
char *pevents_cfg = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean any_imported = FALSE;
|
gboolean any_imported = FALSE;
|
||||||
|
gboolean imported_from_hct = FALSE;
|
||||||
|
gboolean imported_pevents = FALSE;
|
||||||
ThemeSemanticToken token;
|
ThemeSemanticToken token;
|
||||||
|
GtkFileFilter *filter;
|
||||||
|
|
||||||
dialog = gtk_file_chooser_dialog_new (_("Import colors.conf colors"),
|
dialog = gtk_file_chooser_native_new (_("Import colors.conf colors"),
|
||||||
GTK_WINDOW (gtk_widget_get_toplevel (button)),
|
GTK_WINDOW (gtk_widget_get_toplevel (button)),
|
||||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
_("_Import"),
|
||||||
_("_Import"), GTK_RESPONSE_ACCEPT,
|
_("_Cancel"));
|
||||||
NULL);
|
|
||||||
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), TRUE);
|
|
||||||
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), FALSE);
|
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), FALSE);
|
||||||
|
filter = gtk_file_filter_new ();
|
||||||
|
gtk_file_filter_set_name (filter, _("Theme colors (*.conf, *.hct)"));
|
||||||
|
gtk_file_filter_add_pattern (filter, "*.conf");
|
||||||
|
gtk_file_filter_add_pattern (filter, "*.hct");
|
||||||
|
gtk_file_filter_add_pattern (filter, "*.HCT");
|
||||||
|
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||||
|
|
||||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
|
if (gtk_native_dialog_run (GTK_NATIVE_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
|
||||||
{
|
{
|
||||||
gtk_widget_destroy (dialog);
|
g_object_unref (dialog);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||||
gtk_widget_destroy (dialog);
|
g_object_unref (dialog);
|
||||||
if (!path)
|
if (!path)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!g_file_get_contents (path, &cfg, NULL, &error))
|
lower_path = g_ascii_strdown (path, -1);
|
||||||
|
if (g_str_has_suffix (lower_path, ".hct"))
|
||||||
|
{
|
||||||
|
imported_from_hct = TRUE;
|
||||||
|
if (!zoitechat_gtk3_theme_service_read_archive_text_file (path, "colors.conf", &cfg, &error))
|
||||||
|
{
|
||||||
|
theme_preferences_show_import_error (button, _("Failed to read colors.conf from .hct file."));
|
||||||
|
g_clear_error (&error);
|
||||||
|
g_free (lower_path);
|
||||||
|
g_free (path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (zoitechat_gtk3_theme_service_read_archive_text_file (path, "pevents.conf", &pevents_cfg, &error))
|
||||||
|
{
|
||||||
|
char *pevents_path = g_build_filename (get_xdir (), "pevents.conf", NULL);
|
||||||
|
if (g_file_set_contents (pevents_path, pevents_cfg, -1, &error))
|
||||||
|
{
|
||||||
|
load_text_events ();
|
||||||
|
imported_pevents = TRUE;
|
||||||
|
}
|
||||||
|
g_free (pevents_path);
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
else if (!g_file_get_contents (path, &cfg, NULL, &error))
|
||||||
{
|
{
|
||||||
theme_preferences_show_import_error (button, _("Failed to read colors.conf file."));
|
theme_preferences_show_import_error (button, _("Failed to read colors.conf file."));
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
|
g_free (lower_path);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
g_free (lower_path);
|
||||||
|
|
||||||
for (token = THEME_TOKEN_MIRC_0; token < THEME_TOKEN_COUNT; token++)
|
for (token = THEME_TOKEN_MIRC_0; token < THEME_TOKEN_COUNT; token++)
|
||||||
{
|
{
|
||||||
@@ -1086,9 +1141,22 @@ theme_preferences_import_colors_conf_cb (GtkWidget *button, gpointer user_data)
|
|||||||
|
|
||||||
if (!any_imported)
|
if (!any_imported)
|
||||||
theme_preferences_show_import_error (button, _("No importable colors were found in that colors.conf file."));
|
theme_preferences_show_import_error (button, _("No importable colors were found in that colors.conf file."));
|
||||||
|
else if (imported_from_hct)
|
||||||
|
{
|
||||||
|
char *message = g_strdup_printf (imported_pevents ?
|
||||||
|
_("Imported colors.conf and pevents.conf from %s.") :
|
||||||
|
_("Imported colors.conf from %s."),
|
||||||
|
path);
|
||||||
|
theme_preferences_show_import_info (button, message);
|
||||||
|
g_free (message);
|
||||||
|
}
|
||||||
else if (color_change_flag)
|
else if (color_change_flag)
|
||||||
*color_change_flag = theme_preferences_stage.active ? theme_preferences_stage.changed : *color_change_flag;
|
*color_change_flag = theme_preferences_stage.active ? theme_preferences_stage.changed : *color_change_flag;
|
||||||
|
|
||||||
|
if (any_imported && color_change_flag)
|
||||||
|
*color_change_flag = theme_preferences_stage.active ? theme_preferences_stage.changed : *color_change_flag;
|
||||||
|
|
||||||
|
g_free (pevents_cfg);
|
||||||
g_free (cfg);
|
g_free (cfg);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,23 +93,14 @@ userlist_apply_saved_column_width (GtkTreeViewColumn *column, int width)
|
|||||||
static void
|
static void
|
||||||
userlist_update_min_width (session *sess)
|
userlist_update_min_width (session *sess)
|
||||||
{
|
{
|
||||||
GtkRequisition minimum;
|
|
||||||
GtkRequisition natural;
|
|
||||||
GtkWidget *scrolled_window;
|
GtkWidget *scrolled_window;
|
||||||
int width;
|
|
||||||
|
|
||||||
if (!sess || !sess->gui || !sess->gui->user_box || !sess->gui->namelistinfo || !sess->gui->user_tree)
|
if (!sess || !sess->gui || !sess->gui->user_tree)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_widget_get_preferred_size (sess->gui->namelistinfo, &minimum, &natural);
|
|
||||||
width = MAX (minimum.width, natural.width);
|
|
||||||
if (width < 1)
|
|
||||||
width = 1;
|
|
||||||
|
|
||||||
scrolled_window = gtk_widget_get_parent (sess->gui->user_tree);
|
scrolled_window = gtk_widget_get_parent (sess->gui->user_tree);
|
||||||
if (GTK_IS_SCROLLED_WINDOW (scrolled_window))
|
if (GTK_IS_SCROLLED_WINDOW (scrolled_window))
|
||||||
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (scrolled_window), width);
|
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (scrolled_window), 1);
|
||||||
gtk_widget_set_size_request (sess->gui->user_box, width, -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPixbuf *
|
GdkPixbuf *
|
||||||
@@ -909,17 +900,19 @@ userlist_create (GtkWidget *box)
|
|||||||
};
|
};
|
||||||
|
|
||||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_widget_set_hexpand (sw, TRUE);
|
||||||
|
gtk_widget_set_vexpand (sw, TRUE);
|
||||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||||
GTK_SHADOW_ETCHED_IN);
|
GTK_SHADOW_IN);
|
||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||||
prefs.hex_gui_ulist_show_hosts ?
|
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
GTK_POLICY_AUTOMATIC :
|
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (sw), 1);
|
||||||
GTK_POLICY_NEVER,
|
|
||||||
GTK_POLICY_AUTOMATIC);
|
|
||||||
gtk_box_pack_start (GTK_BOX (box), sw, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box), sw, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (sw);
|
gtk_widget_show (sw);
|
||||||
|
|
||||||
treeview = gtk_tree_view_new ();
|
treeview = gtk_tree_view_new ();
|
||||||
|
gtk_widget_set_hexpand (treeview, TRUE);
|
||||||
|
gtk_widget_set_vexpand (treeview, TRUE);
|
||||||
gtk_widget_set_name (treeview, "zoitechat-userlist");
|
gtk_widget_set_name (treeview, "zoitechat-userlist");
|
||||||
gtk_widget_set_can_focus (treeview, TRUE);
|
gtk_widget_set_can_focus (treeview, TRUE);
|
||||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
|
||||||
|
|||||||
@@ -110,6 +110,15 @@ enum
|
|||||||
TARGET_COMPOUND_TEXT
|
TARGET_COMPOUND_TEXT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
PROP_HADJUSTMENT,
|
||||||
|
PROP_VADJUSTMENT,
|
||||||
|
PROP_HSCROLL_POLICY,
|
||||||
|
PROP_VSCROLL_POLICY
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Selection targets for PRIMARY selection / copy-paste.
|
/* Selection targets for PRIMARY selection / copy-paste.
|
||||||
*
|
*
|
||||||
@@ -158,7 +167,8 @@ gtk_xtext_install_selection_targets (GtkWidget *widget)
|
|||||||
|
|
||||||
static guint xtext_signals[LAST_SIGNAL];
|
static guint xtext_signals[LAST_SIGNAL];
|
||||||
|
|
||||||
G_DEFINE_TYPE (GtkXText, gtk_xtext, GTK_TYPE_WIDGET)
|
G_DEFINE_TYPE_WITH_CODE (GtkXText, gtk_xtext, GTK_TYPE_WIDGET,
|
||||||
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
|
||||||
|
|
||||||
char *nocasestrstr (const char *text, const char *tofind); /* util.c */
|
char *nocasestrstr (const char *text, const char *tofind); /* util.c */
|
||||||
int xtext_get_stamp_str (time_t, char **);
|
int xtext_get_stamp_str (time_t, char **);
|
||||||
@@ -168,9 +178,13 @@ static gboolean gtk_xtext_is_selecting (GtkXText *xtext);
|
|||||||
static char *gtk_xtext_selection_get_text (GtkXText *xtext, int *len_ret);
|
static char *gtk_xtext_selection_get_text (GtkXText *xtext, int *len_ret);
|
||||||
static textentry *gtk_xtext_nth (GtkXText *xtext, int line, int *subline);
|
static textentry *gtk_xtext_nth (GtkXText *xtext, int line, int *subline);
|
||||||
static void gtk_xtext_adjustment_changed (GtkAdjustment * adj,
|
static void gtk_xtext_adjustment_changed (GtkAdjustment * adj,
|
||||||
GtkXText * xtext);
|
GtkXText * xtext);
|
||||||
static void gtk_xtext_scroll_adjustments (GtkXText *xtext, GtkAdjustment *hadj,
|
static void gtk_xtext_scroll_adjustments (GtkXText *xtext, GtkAdjustment *hadj,
|
||||||
GtkAdjustment *vadj);
|
GtkAdjustment *vadj);
|
||||||
|
static void gtk_xtext_set_property (GObject *object, guint prop_id,
|
||||||
|
const GValue *value, GParamSpec *pspec);
|
||||||
|
static void gtk_xtext_get_property (GObject *object, guint prop_id,
|
||||||
|
GValue *value, GParamSpec *pspec);
|
||||||
static int gtk_xtext_render_ents (GtkXText * xtext, textentry *, textentry *);
|
static int gtk_xtext_render_ents (GtkXText * xtext, textentry *, textentry *);
|
||||||
static void gtk_xtext_recalc_widths (xtext_buffer *buf, int);
|
static void gtk_xtext_recalc_widths (xtext_buffer *buf, int);
|
||||||
static void gtk_xtext_fix_indent (xtext_buffer *buf);
|
static void gtk_xtext_fix_indent (xtext_buffer *buf);
|
||||||
@@ -794,6 +808,9 @@ gtk_xtext_init (GtkXText * xtext)
|
|||||||
xtext->recycle = FALSE;
|
xtext->recycle = FALSE;
|
||||||
xtext->dont_render = FALSE;
|
xtext->dont_render = FALSE;
|
||||||
xtext->dont_render2 = FALSE;
|
xtext->dont_render2 = FALSE;
|
||||||
|
xtext->hadj = NULL;
|
||||||
|
xtext->hscroll_policy = GTK_SCROLL_MINIMUM;
|
||||||
|
xtext->vscroll_policy = GTK_SCROLL_MINIMUM;
|
||||||
gtk_xtext_scroll_adjustments (xtext, NULL, NULL);
|
gtk_xtext_scroll_adjustments (xtext, NULL, NULL);
|
||||||
|
|
||||||
gtk_xtext_install_selection_targets (GTK_WIDGET (xtext));
|
gtk_xtext_install_selection_targets (GTK_WIDGET (xtext));
|
||||||
@@ -886,6 +903,66 @@ gtk_xtext_adjustment_changed (GtkAdjustment * adj, GtkXText * xtext)
|
|||||||
xtext->buffer->old_value = xtext_adj_get_value (adj);
|
xtext->buffer->old_value = xtext_adj_get_value (adj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_xtext_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GtkXText *xtext = GTK_XTEXT (object);
|
||||||
|
GtkAdjustment *adj;
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_HADJUSTMENT:
|
||||||
|
adj = g_value_get_object (value);
|
||||||
|
if (xtext->hadj == adj)
|
||||||
|
break;
|
||||||
|
if (xtext->hadj)
|
||||||
|
g_object_unref (xtext->hadj);
|
||||||
|
xtext->hadj = adj ? g_object_ref (adj) : NULL;
|
||||||
|
g_object_notify (object, "hadjustment");
|
||||||
|
break;
|
||||||
|
case PROP_VADJUSTMENT:
|
||||||
|
gtk_xtext_scroll_adjustments (xtext, NULL, g_value_get_object (value));
|
||||||
|
g_object_notify (object, "vadjustment");
|
||||||
|
break;
|
||||||
|
case PROP_HSCROLL_POLICY:
|
||||||
|
xtext->hscroll_policy = g_value_get_enum (value);
|
||||||
|
g_object_notify (object, "hscroll-policy");
|
||||||
|
break;
|
||||||
|
case PROP_VSCROLL_POLICY:
|
||||||
|
xtext->vscroll_policy = g_value_get_enum (value);
|
||||||
|
g_object_notify (object, "vscroll-policy");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_xtext_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GtkXText *xtext = GTK_XTEXT (object);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_HADJUSTMENT:
|
||||||
|
g_value_set_object (value, xtext->hadj);
|
||||||
|
break;
|
||||||
|
case PROP_VADJUSTMENT:
|
||||||
|
g_value_set_object (value, xtext->adj);
|
||||||
|
break;
|
||||||
|
case PROP_HSCROLL_POLICY:
|
||||||
|
g_value_set_enum (value, xtext->hscroll_policy);
|
||||||
|
break;
|
||||||
|
case PROP_VSCROLL_POLICY:
|
||||||
|
g_value_set_enum (value, xtext->vscroll_policy);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gtk_xtext_new (const XTextColor *palette, int separator)
|
gtk_xtext_new (const XTextColor *palette, int separator)
|
||||||
{
|
{
|
||||||
@@ -952,6 +1029,11 @@ gtk_xtext_cleanup (GtkXText *xtext)
|
|||||||
xtext->adj = NULL;
|
xtext->adj = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (xtext->hadj)
|
||||||
|
{
|
||||||
|
g_object_unref (G_OBJECT (xtext->hadj));
|
||||||
|
xtext->hadj = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (xtext->hand_cursor)
|
if (xtext->hand_cursor)
|
||||||
{
|
{
|
||||||
@@ -1201,13 +1283,25 @@ gtk_xtext_get_preferred_height_for_width (GtkWidget *widget, gint width,
|
|||||||
*natural = requisition.height;
|
*natural = requisition.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_xtext_invalidate_resize (GtkXText *xtext, xtext_buffer *buf)
|
||||||
|
{
|
||||||
|
buf->pagetop_ent = NULL;
|
||||||
|
dontscroll (buf);
|
||||||
|
xtext->force_render = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_xtext_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
|
gtk_xtext_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
|
||||||
{
|
{
|
||||||
GtkXText *xtext = GTK_XTEXT (widget);
|
GtkXText *xtext = GTK_XTEXT (widget);
|
||||||
int height_only = FALSE;
|
int height_only = FALSE;
|
||||||
|
gboolean resized;
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
|
|
||||||
|
resized = allocation->width != xtext->buffer->window_width ||
|
||||||
|
allocation->height != xtext->buffer->window_height;
|
||||||
|
|
||||||
if (allocation->width == xtext->buffer->window_width)
|
if (allocation->width == xtext->buffer->window_width)
|
||||||
height_only = TRUE;
|
height_only = TRUE;
|
||||||
|
|
||||||
@@ -1233,6 +1327,11 @@ gtk_xtext_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
|
|||||||
xtext_adj_set_value (xtext->adj,
|
xtext_adj_set_value (xtext->adj,
|
||||||
xtext_adj_get_upper (xtext->adj) -
|
xtext_adj_get_upper (xtext->adj) -
|
||||||
xtext_adj_get_page_size (xtext->adj));
|
xtext_adj_get_page_size (xtext->adj));
|
||||||
|
if (resized)
|
||||||
|
{
|
||||||
|
gtk_xtext_invalidate_resize (xtext, xtext->buffer);
|
||||||
|
gtk_widget_queue_draw (widget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1505,6 +1604,17 @@ gtk_xtext_render (GtkWidget *widget, GdkRectangle *area, cairo_t *cr)
|
|||||||
|
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
|
if (xtext->force_render && area->x == 0 && area->y == 0 &&
|
||||||
|
area->height == allocation.height &&
|
||||||
|
area->width == allocation.width)
|
||||||
|
{
|
||||||
|
xtext->force_render = FALSE;
|
||||||
|
}
|
||||||
|
else if (xtext->force_render)
|
||||||
|
{
|
||||||
|
gtk_widget_queue_draw (widget);
|
||||||
|
}
|
||||||
|
|
||||||
if (area->x == 0 && area->y == 0 &&
|
if (area->x == 0 && area->y == 0 &&
|
||||||
area->height == allocation.height &&
|
area->height == allocation.height &&
|
||||||
area->width == allocation.width)
|
area->width == allocation.width)
|
||||||
@@ -2924,6 +3034,13 @@ gtk_xtext_class_init (GtkXTextClass * class)
|
|||||||
widget_class = (GtkWidgetClass *) class;
|
widget_class = (GtkWidgetClass *) class;
|
||||||
xtext_class = (GtkXTextClass *) class;
|
xtext_class = (GtkXTextClass *) class;
|
||||||
|
|
||||||
|
object_class->set_property = gtk_xtext_set_property;
|
||||||
|
object_class->get_property = gtk_xtext_get_property;
|
||||||
|
g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment");
|
||||||
|
g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment");
|
||||||
|
g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy");
|
||||||
|
g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
|
||||||
|
|
||||||
xtext_signals[WORD_CLICK] =
|
xtext_signals[WORD_CLICK] =
|
||||||
g_signal_new ("word_click",
|
g_signal_new ("word_click",
|
||||||
G_TYPE_FROM_CLASS (object_class),
|
G_TYPE_FROM_CLASS (object_class),
|
||||||
@@ -4213,13 +4330,9 @@ gtk_xtext_calc_lines (xtext_buffer *buf, int fire_signal)
|
|||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int lines;
|
int lines;
|
||||||
GdkWindow *window;
|
|
||||||
|
|
||||||
window = gtk_widget_get_window (GTK_WIDGET (buf->xtext));
|
height = buf->window_height;
|
||||||
if (!window)
|
width = buf->window_width;
|
||||||
return;
|
|
||||||
height = gdk_window_get_height (window);
|
|
||||||
width = gdk_window_get_width (window);
|
|
||||||
width -= MARGIN;
|
width -= MARGIN;
|
||||||
|
|
||||||
if (width < 30 || height < buf->xtext->fontsize || width < buf->indent + 30)
|
if (width < 30 || height < buf->xtext->fontsize || width < buf->indent + 30)
|
||||||
@@ -4431,6 +4544,7 @@ gtk_xtext_render_page (GtkXText * xtext)
|
|||||||
int startline = adj_value;
|
int startline = adj_value;
|
||||||
int pos, overlap;
|
int pos, overlap;
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
|
GtkAllocation allocation;
|
||||||
|
|
||||||
if(!gtk_widget_get_realized(GTK_WIDGET(xtext)))
|
if(!gtk_widget_get_realized(GTK_WIDGET(xtext)))
|
||||||
return;
|
return;
|
||||||
@@ -4441,8 +4555,9 @@ gtk_xtext_render_page (GtkXText * xtext)
|
|||||||
window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
width = gdk_window_get_width (window);
|
gtk_widget_get_allocation (GTK_WIDGET (xtext), &allocation);
|
||||||
height = gdk_window_get_height (window);
|
width = allocation.width;
|
||||||
|
height = allocation.height;
|
||||||
|
|
||||||
if (width < 34 || height < xtext->fontsize || width < xtext->buffer->indent + 32)
|
if (width < 34 || height < xtext->fontsize || width < xtext->buffer->indent + 32)
|
||||||
return;
|
return;
|
||||||
@@ -5653,6 +5768,7 @@ gtk_xtext_buffer_show (GtkXText *xtext, xtext_buffer *buf, int render)
|
|||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
|
GtkAllocation allocation;
|
||||||
|
|
||||||
buf->xtext = xtext;
|
buf->xtext = xtext;
|
||||||
|
|
||||||
@@ -5679,8 +5795,9 @@ gtk_xtext_buffer_show (GtkXText *xtext, xtext_buffer *buf, int render)
|
|||||||
window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
window = gtk_widget_get_window (GTK_WIDGET (xtext));
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
h = gdk_window_get_height (window);
|
gtk_widget_get_allocation (GTK_WIDGET (xtext), &allocation);
|
||||||
w = gdk_window_get_width (window);
|
h = allocation.height;
|
||||||
|
w = allocation.width;
|
||||||
|
|
||||||
/* after a font change */
|
/* after a font change */
|
||||||
if (buf->needs_recalc)
|
if (buf->needs_recalc)
|
||||||
@@ -5718,6 +5835,10 @@ gtk_xtext_buffer_show (GtkXText *xtext, xtext_buffer *buf, int render)
|
|||||||
|
|
||||||
if (render)
|
if (render)
|
||||||
{
|
{
|
||||||
|
gboolean resized;
|
||||||
|
|
||||||
|
resized = buf->window_width != w || buf->window_height != h;
|
||||||
|
|
||||||
/* did the window change size since this buffer was last shown? */
|
/* did the window change size since this buffer was last shown? */
|
||||||
if (buf->window_width != w)
|
if (buf->window_width != w)
|
||||||
{
|
{
|
||||||
@@ -5738,6 +5859,9 @@ gtk_xtext_buffer_show (GtkXText *xtext, xtext_buffer *buf, int render)
|
|||||||
gtk_xtext_adjustment_set (buf, FALSE);
|
gtk_xtext_adjustment_set (buf, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (resized)
|
||||||
|
gtk_xtext_invalidate_resize (xtext, buf);
|
||||||
|
|
||||||
gtk_xtext_render_page (xtext);
|
gtk_xtext_render_page (xtext);
|
||||||
{
|
{
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
|
|||||||
@@ -134,6 +134,9 @@ struct _GtkXText
|
|||||||
xtext_buffer *selection_buffer;
|
xtext_buffer *selection_buffer;
|
||||||
|
|
||||||
GtkAdjustment *adj;
|
GtkAdjustment *adj;
|
||||||
|
GtkAdjustment *hadj;
|
||||||
|
GtkScrollablePolicy hscroll_policy;
|
||||||
|
GtkScrollablePolicy vscroll_policy;
|
||||||
cairo_surface_t *background_surface; /* 0 = use palette[19] */
|
cairo_surface_t *background_surface; /* 0 = use palette[19] */
|
||||||
cairo_surface_t *background_clip_surface;
|
cairo_surface_t *background_clip_surface;
|
||||||
GdkWindow *draw_window; /* points to ->window */
|
GdkWindow *draw_window; /* points to ->window */
|
||||||
|
|||||||
@@ -56,11 +56,10 @@ Name: "plugins\exec"; Description: "Exec"; Types: custom; Flags: disablenouninst
|
|||||||
Name: "plugins\fishlim"; Description: "FiSHLiM"; Types: custom; Flags: disablenouninstallwarning
|
Name: "plugins\fishlim"; Description: "FiSHLiM"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "plugins\sysinfo"; Description: "SysInfo"; Types: custom; Flags: disablenouninstallwarning
|
Name: "plugins\sysinfo"; Description: "SysInfo"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "plugins\upd"; Description: "Update Checker"; Types: normal custom; Flags: disablenouninstallwarning
|
Name: "plugins\upd"; Description: "Update Checker"; Types: normal custom; Flags: disablenouninstallwarning
|
||||||
Name: "plugins\winamp"; Description: "Winamp"; Types: custom; Flags: disablenouninstallwarning
|
|
||||||
Name: "langs"; Description: "Language Interfaces"; Types: custom; Flags: disablenouninstallwarning
|
Name: "langs"; Description: "Language Interfaces"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "langs\lua"; Description: "Lua"; Types: normal custom; Flags: disablenouninstallwarning
|
Name: "langs\lua"; Description: "Lua (LuaJIT 2.1)"; Types: normal custom; Flags: disablenouninstallwarning
|
||||||
Name: "langs\perl"; Description: "Perl (requires Perl 5.42)"; Types: custom; Flags: disablenouninstallwarning
|
Name: "langs\perl"; Description: "Perl (Strawberry Perl 5.42.0.1)"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "langs\python"; Description: "Python (requires Python 3.14.3)"; Types: custom; Flags: disablenouninstallwarning
|
Name: "langs\python"; Description: "Python (Python 3.14.3)"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "themes"; Description: "GTK3 Themes"; Types: normal minimal custom; Flags: disablenouninstallwarning
|
Name: "themes"; Description: "GTK3 Themes"; Types: normal minimal custom; Flags: disablenouninstallwarning
|
||||||
Name: "themes\windows10"; Description: "Windows 10"; Types: normal minimal custom; Flags: disablenouninstallwarning
|
Name: "themes\windows10"; Description: "Windows 10"; Types: normal minimal custom; Flags: disablenouninstallwarning
|
||||||
Name: "themes\windows10dark"; Description: "Windows 10 Dark"; Types: normal minimal custom; Flags: disablenouninstallwarning
|
Name: "themes\windows10dark"; Description: "Windows 10 Dark"; Types: normal minimal custom; Flags: disablenouninstallwarning
|
||||||
@@ -173,11 +172,9 @@ Source: "plugins\hcexec.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Co
|
|||||||
Source: "plugins\hcfishlim.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\fishlim
|
Source: "plugins\hcfishlim.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\fishlim
|
||||||
Source: "share\gtkpref.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: libs
|
Source: "share\gtkpref.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: libs
|
||||||
Source: "share\adwaita-icons-attribution.txt"; DestDir: "{app}\share"; Flags: ignoreversion; Components: libs
|
Source: "share\adwaita-icons-attribution.txt"; DestDir: "{app}\share"; Flags: ignoreversion; Components: libs
|
||||||
Source: "share\music.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\winamp
|
|
||||||
Source: "share\download.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\upd
|
Source: "share\download.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\upd
|
||||||
Source: "plugins\hcupd.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\upd
|
Source: "plugins\hcupd.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\upd
|
||||||
Source: "WinSparkle.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: plugins\upd
|
Source: "WinSparkle.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: plugins\upd
|
||||||
Source: "plugins\hcwinamp.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\winamp
|
|
||||||
Source: "share\system.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\sysinfo
|
Source: "share\system.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\sysinfo
|
||||||
Source: "plugins\hcsysinfo.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\sysinfo
|
Source: "plugins\hcsysinfo.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\sysinfo
|
||||||
Source: "plugins\hcperl.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: langs\perl
|
Source: "plugins\hcperl.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: langs\perl
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2.18.0~pre6
|
2.18.0
|
||||||
|
|||||||
@@ -40,11 +40,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "upd", "..\plugins\upd\upd.v
|
|||||||
{87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3}
|
{87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winamp", "..\plugins\winamp\winamp.vcxproj", "{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE}"
|
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
{87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3}
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sysinfo", "..\plugins\sysinfo\sysinfo.vcxproj", "{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sysinfo", "..\plugins\sysinfo\sysinfo.vcxproj", "{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3}
|
{87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3}
|
||||||
@@ -73,7 +68,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "installer", "installer\inst
|
|||||||
{E93E1255-95D1-4B08-8FDF-B53CC6A21280} = {E93E1255-95D1-4B08-8FDF-B53CC6A21280}
|
{E93E1255-95D1-4B08-8FDF-B53CC6A21280} = {E93E1255-95D1-4B08-8FDF-B53CC6A21280}
|
||||||
{5EF7F47D-D09C-43C4-BF64-B28B11A0FF91} = {5EF7F47D-D09C-43C4-BF64-B28B11A0FF91}
|
{5EF7F47D-D09C-43C4-BF64-B28B11A0FF91} = {5EF7F47D-D09C-43C4-BF64-B28B11A0FF91}
|
||||||
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA} = {6C0CA980-97C5-427A-BE61-5BCECAFABBDA}
|
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA} = {6C0CA980-97C5-427A-BE61-5BCECAFABBDA}
|
||||||
{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE} = {E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE}
|
|
||||||
{E4BDB4C8-2335-415A-ACEE-BA88B19BFE82} = {E4BDB4C8-2335-415A-ACEE-BA88B19BFE82}
|
{E4BDB4C8-2335-415A-ACEE-BA88B19BFE82} = {E4BDB4C8-2335-415A-ACEE-BA88B19BFE82}
|
||||||
{C53145CC-D021-40C9-B97C-0249AB9A43C9} = {C53145CC-D021-40C9-B97C-0249AB9A43C9}
|
{C53145CC-D021-40C9-B97C-0249AB9A43C9} = {C53145CC-D021-40C9-B97C-0249AB9A43C9}
|
||||||
{D90BC3E3-1341-4849-9354-5F40489D39D1} = {D90BC3E3-1341-4849-9354-5F40489D39D1}
|
{D90BC3E3-1341-4849-9354-5F40489D39D1} = {D90BC3E3-1341-4849-9354-5F40489D39D1}
|
||||||
@@ -121,8 +115,6 @@ Global
|
|||||||
{3C4F42FC-292A-420B-B63D-C03DFBDD8E4E}.Release|x64.Build.0 = Release|x64
|
{3C4F42FC-292A-420B-B63D-C03DFBDD8E4E}.Release|x64.Build.0 = Release|x64
|
||||||
{461DC24A-A410-4171-8C02-CCDBF3702C2A}.Release|x64.ActiveCfg = Release|x64
|
{461DC24A-A410-4171-8C02-CCDBF3702C2A}.Release|x64.ActiveCfg = Release|x64
|
||||||
{461DC24A-A410-4171-8C02-CCDBF3702C2A}.Release|x64.Build.0 = Release|x64
|
{461DC24A-A410-4171-8C02-CCDBF3702C2A}.Release|x64.Build.0 = Release|x64
|
||||||
{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE}.Release|x64.Build.0 = Release|x64
|
|
||||||
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}.Release|x64.ActiveCfg = Release|x64
|
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}.Release|x64.ActiveCfg = Release|x64
|
||||||
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}.Release|x64.Build.0 = Release|x64
|
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}.Release|x64.Build.0 = Release|x64
|
||||||
{B10A2C41-344C-43E0-A32D-B9587C198D8B}.Release|x64.ActiveCfg = Release|x64
|
{B10A2C41-344C-43E0-A32D-B9587C198D8B}.Release|x64.ActiveCfg = Release|x64
|
||||||
@@ -153,7 +145,6 @@ Global
|
|||||||
{17E4BE39-76F7-4A06-AD21-EFD0C5091F76} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
{17E4BE39-76F7-4A06-AD21-EFD0C5091F76} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
||||||
{3C4F42FC-292A-420B-B63D-C03DFBDD8E4E} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
{3C4F42FC-292A-420B-B63D-C03DFBDD8E4E} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
||||||
{461DC24A-A410-4171-8C02-CCDBF3702C2A} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
{461DC24A-A410-4171-8C02-CCDBF3702C2A} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
||||||
{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
|
||||||
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
||||||
{B10A2C41-344C-43E0-A32D-B9587C198D8B} = {0FD996A7-464F-4981-8380-3DCA3A244A13}
|
{B10A2C41-344C-43E0-A32D-B9587C198D8B} = {0FD996A7-464F-4981-8380-3DCA3A244A13}
|
||||||
{C9B735E4-75BC-45AC-A5E3-39A6D076F912} = {0FD996A7-464F-4981-8380-3DCA3A244A13}
|
{C9B735E4-75BC-45AC-A5E3-39A6D076F912} = {0FD996A7-464F-4981-8380-3DCA3A244A13}
|
||||||
|
|||||||
Reference in New Issue
Block a user