1 Commits

40 changed files with 354 additions and 1233 deletions

68
.github/workflows/theme-tests.yml vendored Normal file
View File

@@ -0,0 +1,68 @@
name: Theme Tests
on:
push:
branches: [master, main]
paths:
- '.github/workflows/theme-tests.yml'
- 'meson.build'
- 'meson_options.txt'
- 'src/common/**'
- 'src/fe-gtk/meson.build'
- 'src/fe-gtk/theme/**'
pull_request:
branches: [master, main]
paths:
- '.github/workflows/theme-tests.yml'
- 'meson.build'
- 'meson_options.txt'
- 'src/common/**'
- 'src/fe-gtk/meson.build'
- 'src/fe-gtk/theme/**'
workflow_dispatch:
permissions:
contents: read
jobs:
theme_tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: Install dependencies
run: |
set -eux
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
meson \
ninja-build \
pkg-config \
gettext \
libgtk-3-dev \
libglib2.0-dev \
libdbus-glib-1-dev \
libcanberra-dev \
libarchive-dev \
libssl-dev \
xvfb
- name: Configure
run: |
set -eux
meson setup build-theme-tests \
-Dauto_features=disabled \
-Dplugin=false \
-Dtext-frontend=true
- name: Run theme tests
run: |
set -eux
xvfb-run -a env NO_AT_BRIDGE=1 GSETTINGS_BACKEND=memory \
meson test -C build-theme-tests --print-errorlogs \
--timeout-multiplier 2 \
'Theme Manager Dispatch Routing Tests'

View File

@@ -29,7 +29,7 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: '3.14.3'
python-version: '3.14.2'
architecture: ${{ matrix.arch }}
- name: Install Dependencies
@@ -62,16 +62,19 @@ jobs:
}
}
Download-WithRetry -Url https://github.com/jrsoftware/issrc/releases/download/is-6_7_1/innosetup-6.7.1.exe -OutFile deps\innosetup-unicode.exe
Download-WithRetry -Url https://files.jrsoftware.org/is/6/innosetup-6.7.0.exe -OutFile deps\innosetup-unicode.exe
& deps\innosetup-unicode.exe /VERYSILENT | Out-Null
Download-WithRetry -Url https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.17.0/idpsetup-1.5.1.exe -OutFile deps\idpsetup.exe
& deps\idpsetup.exe /VERYSILENT
Download-WithRetry -Url https://github.com/ZoiteChat/gvsbuild/releases/download/zoitechat-2.18.0-pre1/GTK3_Gvsbuild_zoitechat-2.18.0-pre1_${{ matrix.platform }}.7z -OutFile deps\gtk-${{ matrix.arch }}.7z
& 7z.exe x deps\gtk-${{ matrix.arch }}.7z -oC:\gtk-build\gtk\x64\release
Download-WithRetry -Url https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-hicolor-icon-theme-0.18-1-any.pkg.tar.zst -OutFile deps\hicolor-icon-theme.pkg.tar.zst
python -c "import tarfile,zstandard,pathlib;archive=pathlib.Path(r'deps\\hicolor-icon-theme.pkg.tar.zst');target=pathlib.Path(r'C:\\gtk-build\\gtk\\x64\\release');dctx=zstandard.ZstdDecompressor();f=archive.open('rb');reader=dctx.stream_reader(f);tf=tarfile.open(fileobj=reader,mode='r|');[tf.extract(m,path=target) for m in tf if m.name.startswith('mingw64/share/icons/hicolor/')];tf.close();reader.close();f.close()"
Download-WithRetry -Url https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libarchive-3.8.6-1-any.pkg.tar.zst -OutFile deps\libarchive.pkg.tar.zst
Download-WithRetry -Url https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libarchive-3.8.1-1-any.pkg.tar.zst -OutFile deps\libarchive.pkg.tar.zst
python -c "import tarfile,zstandard,pathlib;archive=pathlib.Path(r'deps\\libarchive.pkg.tar.zst');target=pathlib.Path(r'C:\\gtk-build\\gtk\\x64\\release');dctx=zstandard.ZstdDecompressor();f=archive.open('rb');reader=dctx.stream_reader(f);tf=tarfile.open(fileobj=reader,mode='r|');[tf.extract(m,path=target) for m in tf if m.name.startswith(('mingw64/include/archive','mingw64/lib/libarchive','mingw64/bin/libarchive'))];tf.close();reader.close();f.close()"
if (Test-Path C:\gtk-build\gtk\x64\release\mingw64\share\icons\hicolor) {
@@ -94,19 +97,19 @@ jobs:
Remove-Item -Path C:\gtk-build\gtk\x64\release\mingw64 -Recurse -Force
}
Download-WithRetry -Url https://github.com/ZoiteChat/gvsbuild/releases/download/zoitechat-2.18.0-pre4/gendef20260315.7z -OutFile deps\gendef.7z
Download-WithRetry -Url https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.17.0/gendef-20111031.7z -OutFile deps\gendef.7z
& 7z.exe x deps\gendef.7z -oC:\gtk-build
Download-WithRetry -Url https://github.com/ZoiteChat/gvsbuild/releases/download/zoitechat-2.18.0-pre4/WinSparkle-20260315.7z -OutFile deps\WinSparkle.7z
Download-WithRetry -Url https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.17.0/WinSparkle-20151011.7z -OutFile deps\WinSparkle.7z
& 7z.exe x deps\WinSparkle.7z -oC:\gtk-build\WinSparkle
Download-WithRetry -Url https://github.com/ZoiteChat/gvsbuild/releases/download/zoitechat-2.18.0-pre4/perl-5.42.0.1-${{ matrix.arch }}.7z -OutFile deps\perl-${{ matrix.arch }}.7z
& 7z.exe x deps\perl-${{ matrix.arch }}.7z -oC:\gtk-build\perl-5.42.0.1\${{ matrix.platform }}
Download-WithRetry -Url https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.17.0/perl-5.20.0-${{ matrix.arch }}.7z -OutFile deps\perl-${{ matrix.arch }}.7z
& 7z.exe x deps\perl-${{ matrix.arch }}.7z -oC:\gtk-build\perl-5.20\${{ matrix.platform }}
$pyRoot = $env:pythonLocation
if (-not $pyRoot) { $pyRoot = & python -c "import sys; print(sys.prefix)" }
foreach ($pyDir in @("C:\gtk-build\python-3.14.3", "C:\gtk-build\python-3.14")) {
foreach ($pyDir in @("C:\gtk-build\python-3.14.2", "C:\gtk-build\python-3.14")) {
New-Item -Path $pyDir -ItemType Directory -Force | Out-Null
$target = Join-Path $pyDir "${{ matrix.platform }}"
if (Test-Path $target) { Remove-Item $target -Recurse -Force }
@@ -117,7 +120,7 @@ jobs:
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat"
set "PYTHON_DIR=C:\gtk-build\python-3.14.3\${{ matrix.platform }}"
set "PYTHON_DIR=C:\gtk-build\python-3.14.2\${{ matrix.platform }}"
if not exist "%PYTHON_DIR%\libs\python314.lib" (
echo Missing %PYTHON_DIR%\libs\python314.lib
dir "%PYTHON_DIR%\libs"

View File

@@ -1,15 +1,6 @@
ZoiteChat ChangeLog
=================
2.18.0~pre4 (2026-03-15)
------------------------
- Fixed a regression where Ctrl+A could incorrectly mark you away instead of selecting all text.
- Fixed a crash when toggling the GUI with F9 or the menu toggle action.
- Fixed sidebar collapse behavior on fresh installs.
- Added multiline topic bar support with clickable URLs.
- Improved GTK selection styling so text selection is shown visually on topic and chat text box.
2.18.0~pre3 (2026-03-13)
------------------------

View File

@@ -29,18 +29,6 @@
<id>zoitechat.desktop</id>
</provides>
<releases>
<release date="2026-03-14" version="2.18.0~pre4">
<description>
<p>UI fixes, topic bar improvements, and selection styling updates:</p>
<ul>
<li>Fixed a regression where <code>Ctrl+A</code> could incorrectly mark you away instead of selecting all text.</li>
<li>Fixed a crash when toggling the GUI with <code>F9</code> or the menu toggle action.</li>
<li>Fixed sidebar collapse behavior on fresh installs.</li>
<li>Added multiline topic bar support with clickable URLs.</li>
<li>Improved GTK selection styling so text selection is shown visually in the topic bar and chat input box.</li>
</ul>
</description>
</release>
<release date="2026-03-13" version="2.18.0~pre3">
<description>
<p>GTK3 theming, UI, and platform improvements:</p>

View File

@@ -1,5 +1,5 @@
project('zoitechat', 'c',
version: '2.18.0~pre4',
version: '2.18.0~pre3',
meson_version: '>= 0.55.0',
default_options: [
'c_std=c17',

View File

@@ -12,7 +12,6 @@ depends=(
'glib2'
'gtk3'
'iso-codes'
'libayatana-appindicator'
'libcanberra'
'lua'
'openssl'
@@ -27,6 +26,7 @@ makedepends=(
'python'
)
optdepends=(
'libayatana-appindicator: Ayatana/AppIndicator tray backend'
'pciutils: sysinfo plugin hardware detection details'
)
provides=('zoitechat')

View File

@@ -45,22 +45,6 @@ endif
perl_ldflags = []
perl_rpath = ''
foreach flag : ret.stdout().strip().split(' ')
if flag.startswith('/') and '/libperl.' in flag
split = flag.split('/')
libperl_dir = ''
foreach part : split
if part != '' and not part.startswith('libperl.')
if libperl_dir == ''
libperl_dir = '/' + part
else
libperl_dir += '/' + part
endif
endif
endforeach
perl_ldflags += '-L' + libperl_dir
perl_ldflags += '-lperl'
continue
endif
if flag.startswith('-L') or flag.startswith('-l')
perl_ldflags += flag
endif

View File

@@ -19,7 +19,7 @@ else:
if not hasattr(sys, 'argv'):
sys.argv = ['<zoitechat>']
VERSION = b'2.18.0~pre4'
VERSION = b'2.18.0~pre3'
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_VERSION = ffi.new('char[]', VERSION)

View File

@@ -1009,51 +1009,15 @@ load_config (void)
return 0;
}
static int
save_config_write_to_fd (int fh)
{
int i;
if (!cfg_put_str (fh, "version", PACKAGE_VERSION))
return 0;
i = 0;
do
{
switch (vars[i].type)
{
case TYPE_STR:
if (!cfg_put_str (fh, vars[i].name, (char *) &prefs + vars[i].offset))
return 0;
break;
case TYPE_INT:
case TYPE_BOOL:
if (!cfg_put_int (fh, *((int *) &prefs + vars[i].offset), vars[i].name))
return 0;
}
if (vars[i].after_update != NULL)
vars[i].after_update();
i++;
}
while (vars[i].name);
return 1;
}
int
save_config_prepare (char **temp_path)
save_config (void)
{
int fh;
char *config;
char *new_config;
int fh, i;
char *config, *new_config;
if (check_config_dir () != 0)
make_config_dirs ();
if (!temp_path)
return 0;
config = default_file ();
new_config = g_strconcat (config, ".new", NULL);
@@ -1064,67 +1028,63 @@ save_config_prepare (char **temp_path)
return 0;
}
if (!save_config_write_to_fd (fh))
if (!cfg_put_str (fh, "version", PACKAGE_VERSION))
{
close (fh);
g_free (new_config);
return 0;
}
i = 0;
do
{
switch (vars[i].type)
{
case TYPE_STR:
if (!cfg_put_str (fh, vars[i].name, (char *) &prefs + vars[i].offset))
{
close (fh);
g_free (new_config);
return 0;
}
break;
case TYPE_INT:
case TYPE_BOOL:
if (!cfg_put_int (fh, *((int *) &prefs + vars[i].offset), vars[i].name))
{
close (fh);
g_free (new_config);
return 0;
}
}
if (vars[i].after_update != NULL)
{
vars[i].after_update();
}
i++;
}
while (vars[i].name);
if (close (fh) == -1)
{
g_free (new_config);
return 0;
}
*temp_path = new_config;
return 1;
}
int
save_config_finalize (const char *temp_path)
{
char *config;
if (!temp_path)
return 0;
config = default_file ();
#ifdef WIN32
g_unlink (config);
g_unlink (config); /* win32 can't rename to an existing file */
#endif
if (g_rename (temp_path, config) == -1)
if (g_rename (new_config, config) == -1)
{
g_free (new_config);
return 0;
}
g_free (new_config);
return 1;
}
void
save_config_discard (const char *temp_path)
{
if (!temp_path)
return;
g_unlink (temp_path);
}
int
save_config (void)
{
char *temp_path = NULL;
int result;
if (!save_config_prepare (&temp_path))
return 0;
result = save_config_finalize (temp_path);
if (!result)
save_config_discard (temp_path);
g_free (temp_path);
return result;
}
static void
set_showval (session *sess, const struct prefs *var, char *tbuf)
{

View File

@@ -43,9 +43,6 @@ int make_config_dirs (void);
int make_dcc_dirs (void);
int load_config (void);
int save_config (void);
int save_config_prepare (char **temp_path);
int save_config_finalize (const char *temp_path);
void save_config_discard (const char *temp_path);
void list_free (GSList ** list);
void list_loadconf (char *file, GSList ** list, char *defaultconf);
int list_delentry (GSList ** list, char *name);

View File

@@ -292,13 +292,7 @@ match_host (const char *word, int *start, int *end)
static gboolean
match_host6 (const char *word, int *start, int *end)
{
if (!regex_match (re_host6 (), word, start, end))
return FALSE;
if (word[*start] != '[')
return FALSE;
return TRUE;
return regex_match (re_host6 (), word, start, end);
}
static gboolean
@@ -378,65 +372,41 @@ url_last (int *lstart, int *lend)
return lasttype;
}
static gboolean
match_has_valid_context (const char *word, int start, int end)
{
if (start > 0)
{
char prev = word[start - 1];
if (g_ascii_isalnum ((guchar)prev) || prev == '_' || prev == '-')
return FALSE;
}
if (word[end] != '\0')
{
char next = word[end];
if (g_ascii_isalnum ((guchar)next) || next == '_')
return FALSE;
}
return TRUE;
}
static gboolean
regex_match (const GRegex *re, const char *word, int *start, int *end)
{
GMatchInfo *gmi;
gboolean found = FALSE;
int mstart;
int mend;
g_regex_match (re, word, 0, &gmi);
if (!g_match_info_matches (gmi))
{
g_match_info_free (gmi);
return FALSE;
}
while (g_match_info_matches (gmi))
{
g_match_info_fetch_pos (gmi, 0, &mstart, &mend);
if (match_has_valid_context (word, mstart, mend))
{
*start = mstart;
*end = mend;
found = TRUE;
}
g_match_info_fetch_pos (gmi, 0, start, end);
g_match_info_next (gmi, NULL);
}
g_match_info_free (gmi);
return found;
return TRUE;
}
/* Miscellaneous description --- */
#define DOMAIN_LABEL "[\\pL\\pN](?:[-\\pL\\pN]{0,61}[\\pL\\pN])?"
#define DOMAIN DOMAIN_LABEL "(\\." DOMAIN_LABEL ")*"
#define TLD "\\.[\\pL](?:[-\\pL\\pN]*[\\pL\\pN])?"
#define IPADDR "(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}"
#define DOMAIN "[_\\pL\\pN\\pS][-_\\pL\\pN\\pS]*(\\.[-_\\pL\\pN\\pS]+)*"
#define TLD "\\.[\\pL][-\\pL\\pN]*[\\pL]"
#define IPADDR "[0-9]{1,3}(\\.[0-9]{1,3}){3}"
#define IPV6GROUP "([0-9a-f]{0,4})"
#define IPV6ADDR "((" IPV6GROUP "(:" IPV6GROUP "){7})" \
"|(" IPV6GROUP "(:" IPV6GROUP ")*:(:" IPV6GROUP ")+))" /* with :: compression */
#define HOST "(" DOMAIN TLD "|" IPADDR "|" IPV6ADDR ")"
/* In urls the IPv6 must be enclosed in square brackets */
#define HOST_URL "(" DOMAIN TLD "|" IPADDR "|" "\\[" IPV6ADDR "\\]" ")"
#define HOST_URL_OPT_TLD HOST_URL
#define HOST_URL_OPT_TLD "(" DOMAIN "|" HOST_URL ")"
#define PORT "(:[1-9][0-9]{0,4})"
#define OPT_PORT "(" PORT ")?"

View File

@@ -1104,8 +1104,7 @@ zoitechat_exit (void)
plugin_kill_all ();
fe_cleanup ();
if (!save_config ())
g_printerr ("Could not save zoitechat.conf.\n");
save_config ();
if (prefs.save_pevents)
{
pevent_save (NULL);

View File

@@ -508,72 +508,36 @@ chanlist_match_topic_button_toggled (GtkWidget * wid, server *serv)
serv->gui->chanlist_match_wants_topic = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wid));
}
static GSList *
chanlist_get_selection (server *serv, int column)
{
GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (serv->gui->chanlist_list));
GtkTreeModel *model = GET_MODEL (serv);
GList *rows;
GList *cur;
GSList *result = NULL;
rows = gtk_tree_selection_get_selected_rows (sel, &model);
for (cur = rows; cur != NULL; cur = cur->next)
{
GtkTreeIter iter;
char *value;
if (gtk_tree_model_get_iter (model, &iter, (GtkTreePath *)cur->data))
{
gtk_tree_model_get (model, &iter, column, &value, -1);
result = g_slist_prepend (result, value);
}
}
g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free);
return g_slist_reverse (result);
}
static char *
chanlist_get_selected (server *serv, gboolean get_topic)
{
GSList *selection = chanlist_get_selection (serv, get_topic ? COL_TOPIC : COL_CHANNEL);
char *value;
char *chan;
GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (serv->gui->chanlist_list));
GtkTreeModel *model;
GtkTreeIter iter;
if (!selection)
if (!gtk_tree_selection_get_selected (sel, &model, &iter))
return NULL;
value = selection->data;
selection->data = NULL;
g_slist_free_full (selection, g_free);
return value;
gtk_tree_model_get (model, &iter, get_topic ? COL_TOPIC : COL_CHANNEL, &chan, -1);
return chan;
}
static void
chanlist_join (GtkWidget * wid, server *serv)
{
char tbuf[CHANLEN + 6];
GSList *selection;
GSList *item;
gboolean joined = FALSE;
selection = chanlist_get_selection (serv, COL_CHANNEL);
for (item = selection; item != NULL; item = item->next)
char *chan = chanlist_get_selected (serv, FALSE);
if (chan)
{
char *chan = item->data;
if (serv->connected && strcmp (chan, "*") != 0)
if (serv->connected && (strcmp (chan, "*") != 0))
{
g_snprintf (tbuf, sizeof (tbuf), "join %s", chan);
handle_command (serv->server_session, tbuf, FALSE);
joined = TRUE;
}
} else
gdk_display_beep (gdk_display_get_default ());
g_free (chan);
}
if (!joined && selection)
gdk_display_beep (gdk_display_get_default ());
g_slist_free_full (selection, g_free);
}
static void
@@ -650,8 +614,7 @@ chanlist_minusers (GtkSpinButton *wid, server *serv)
{
serv->gui->chanlist_minusers = gtk_spin_button_get_value_as_int (wid);
prefs.hex_gui_chanlist_minusers = serv->gui->chanlist_minusers;
if (!save_config ())
fe_message (_("Could not save zoitechat.conf."), FE_MSG_WARN);
save_config();
if (serv->gui->chanlist_minusers < serv->gui->chanlist_minusers_downloaded)
{
@@ -673,8 +636,7 @@ chanlist_maxusers (GtkSpinButton *wid, server *serv)
{
serv->gui->chanlist_maxusers = gtk_spin_button_get_value_as_int (wid);
prefs.hex_gui_chanlist_maxusers = serv->gui->chanlist_maxusers;
if (!save_config ())
fe_message (_("Could not save zoitechat.conf."), FE_MSG_WARN);
save_config();
}
static void
@@ -694,47 +656,23 @@ chanlist_menu_destroy (GtkWidget *menu, gpointer userdata)
static void
chanlist_copychannel (GtkWidget *item, server *serv)
{
GSList *selection = chanlist_get_selection (serv, COL_CHANNEL);
GSList *cur;
GString *text;
if (!selection)
return;
text = g_string_new ("");
for (cur = selection; cur != NULL; cur = cur->next)
char *chan = chanlist_get_selected (serv, FALSE);
if (chan)
{
if (text->len)
g_string_append_c (text, '\n');
g_string_append (text, (char *)cur->data);
gtkutil_copy_to_clipboard (item, NULL, chan);
g_free (chan);
}
gtkutil_copy_to_clipboard (item, NULL, text->str);
g_string_free (text, TRUE);
g_slist_free_full (selection, g_free);
}
static void
chanlist_copytopic (GtkWidget *item, server *serv)
{
GSList *selection = chanlist_get_selection (serv, COL_TOPIC);
GSList *cur;
GString *text;
if (!selection)
return;
text = g_string_new ("");
for (cur = selection; cur != NULL; cur = cur->next)
char *topic = chanlist_get_selected (serv, TRUE);
if (topic)
{
if (text->len)
g_string_append_c (text, '\n');
g_string_append (text, (char *)cur->data);
gtkutil_copy_to_clipboard (item, NULL, topic);
g_free (topic);
}
gtkutil_copy_to_clipboard (item, NULL, text->str);
g_string_free (text, TRUE);
g_slist_free_full (selection, g_free);
}
static gboolean
@@ -751,12 +689,10 @@ chanlist_button_cb (GtkTreeView *tree, GdkEventButton *event, server *serv)
if (!gtk_tree_view_get_path_at_pos (tree, event->x, event->y, &path, 0, 0, 0))
return FALSE;
/* select what they right-clicked on */
sel = gtk_tree_view_get_selection (tree);
if (!gtk_tree_selection_path_is_selected (sel, path))
{
gtk_tree_selection_unselect_all (sel);
gtk_tree_selection_select_path (sel, path);
}
gtk_tree_selection_unselect_all (sel);
gtk_tree_selection_select_path (sel, path);
gtk_tree_path_free (path);
menu = gtk_menu_new ();
@@ -895,8 +831,7 @@ chanlist_opengui (server *serv, int do_refresh)
if (prefs.hex_gui_chanlist_minusers < 1 || prefs.hex_gui_chanlist_minusers > 999999)
{
prefs.hex_gui_chanlist_minusers = 5;
if (!save_config ())
fe_message (_("Could not save zoitechat.conf."), FE_MSG_WARN);
save_config();
}
serv->gui->chanlist_minusers = prefs.hex_gui_chanlist_minusers;
@@ -907,8 +842,7 @@ chanlist_opengui (server *serv, int do_refresh)
if (prefs.hex_gui_chanlist_maxusers < 1 || prefs.hex_gui_chanlist_maxusers > 999999)
{
prefs.hex_gui_chanlist_maxusers = 9999;
if (!save_config ())
fe_message (_("Could not save zoitechat.conf."), FE_MSG_WARN);
save_config();
}
serv->gui->chanlist_maxusers = prefs.hex_gui_chanlist_maxusers;
@@ -945,7 +879,6 @@ chanlist_opengui (server *serv, int do_refresh)
chanlist_add_column (view, COL_USERS, 50, _("Users"), TRUE);
chanlist_add_column (view, COL_TOPIC, 50, _("Topic"), FALSE);
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (view), GTK_TREE_VIEW_GRID_LINES_HORIZONTAL);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), GTK_SELECTION_MULTIPLE);
/* this is a speed up, but no horizontal scrollbar :( */
/*gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (view), TRUE);*/
gtk_widget_show (view);

View File

@@ -131,7 +131,6 @@ cv_tree_init (chanview *cv)
GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (win),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (win), 1);
gtk_container_add (GTK_CONTAINER (cv->box), win);
gtk_widget_show (win);
@@ -166,32 +165,30 @@ cv_tree_init (chanview *cv)
gtk_container_add (GTK_CONTAINER (win), view);
col = gtk_tree_view_column_new();
/* icon column */
if (cv->use_icons)
{
renderer = gtk_cell_renderer_pixbuf_new ();
if (prefs.hex_gui_compact)
g_object_set (G_OBJECT (renderer), "ypad", 0, NULL);
gtk_tree_view_column_pack_start (col, renderer, FALSE);
gtk_tree_view_column_pack_start(col, renderer, FALSE);
gtk_tree_view_column_set_attributes (col, renderer, "pixbuf", COL_PIXBUF, NULL);
}
/* main column */
renderer = gtk_cell_renderer_text_new ();
if (prefs.hex_gui_compact)
g_object_set (G_OBJECT (renderer), "ypad", 0, NULL);
g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1);
gtk_tree_view_column_pack_start (col, renderer, TRUE);
gtk_tree_view_column_pack_start(col, renderer, TRUE);
gtk_tree_view_column_set_attributes (col, renderer,
"text", COL_NAME,
"attributes", COL_ATTR,
"underline", COL_UNDERLINE,
NULL);
gtk_tree_view_column_set_expand (col, TRUE);
gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
gtk_tree_view_column_set_min_width (col, 1);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), col);
gtk_tree_view_set_expander_column (GTK_TREE_VIEW (view), col);
gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (view))),
"changed", G_CALLBACK (cv_tree_sel_cb), cv);

View File

@@ -758,15 +758,11 @@ fe_set_topic (session *sess, char *topic, char *stripped_topic)
{
if (prefs.hex_text_stripcolor_topic)
{
gtk_text_buffer_set_text (
gtk_text_view_get_buffer (GTK_TEXT_VIEW (sess->gui->topic_entry)),
stripped_topic, -1);
gtk_entry_set_text (GTK_ENTRY (sess->gui->topic_entry), stripped_topic);
}
else
{
gtk_text_buffer_set_text (
gtk_text_view_get_buffer (GTK_TEXT_VIEW (sess->gui->topic_entry)),
topic, -1);
gtk_entry_set_text (GTK_ENTRY (sess->gui->topic_entry), topic);
}
mg_set_topic_tip (sess);
}
@@ -1339,79 +1335,22 @@ fe_open_url_inner (const char *url)
g_free (escaped_url);
}
static gboolean
fe_open_url_is_local_path (const char *url)
{
if (g_path_is_absolute (url) || g_file_test (url, G_FILE_TEST_EXISTS))
return TRUE;
#ifdef WIN32
if (g_ascii_isalpha (url[0]) && url[1] == ':' &&
(url[2] == '\\' || url[2] == '/'))
return TRUE;
if (url[0] == '\\' && url[1] == '\\')
return TRUE;
#endif
return FALSE;
}
static char *
fe_open_url_canonicalize_path (const char *path)
{
char *absolute_path;
char *cwd;
if (!path || path[0] == '\0')
return NULL;
if (g_path_is_absolute (path))
return g_strdup (path);
cwd = g_get_current_dir ();
absolute_path = g_build_filename (cwd, path, NULL);
g_free (cwd);
return absolute_path;
}
void
fe_open_url (const char *url)
{
int url_type = url_check_word (url);
char *uri;
char *path;
char *path_uri;
if (fe_open_url_is_local_path (url))
{
path = fe_open_url_canonicalize_path (url);
path_uri = g_filename_to_uri (path, NULL, NULL);
g_free (path);
if (path_uri)
{
fe_open_url_inner (path_uri);
g_free (path_uri);
return;
}
}
/* gvfs likes file:// */
if (url_type == WORD_PATH)
{
path = fe_open_url_canonicalize_path (url);
path_uri = g_filename_to_uri (path, NULL, NULL);
g_free (path);
if (path_uri)
{
fe_open_url_inner (path_uri);
g_free (path_uri);
}
else
{
fe_open_url_inner (url);
}
#ifndef WIN32
uri = g_strconcat ("file://", url, NULL);
fe_open_url_inner (uri);
g_free (uri);
#else
fe_open_url_inner (url);
#endif
}
/* IPv6 addr. Add http:// */
else if (url_type == WORD_HOST6)

View File

@@ -61,7 +61,6 @@ powershell "Get-Content -Encoding UTF8 '$(ZoiteChatLib)zoitechat.rc.utf8' | Out-
<ClInclude Include="icon-resolver.h" />
<ClInclude Include="joind.h" />
<ClInclude Include="maingui.h" />
<ClInclude Include="preferences-persistence.h" />
<ClInclude Include="menu.h" />
<ClInclude Include="notifications\notification-backend.h" />
<ClInclude Include="notifygui.h" />
@@ -108,7 +107,6 @@ powershell "Get-Content -Encoding UTF8 '$(ZoiteChatLib)zoitechat.rc.utf8' | Out-
<ClCompile Include="notifications\notification-windows.c" />
<ClCompile Include="notifygui.c" />
<ClCompile Include="pixmaps.c" />
<ClCompile Include="preferences-persistence.c" />
<ClCompile Include="plugin-notification.c" />
<ClCompile Include="plugin-tray.c" />
<ClCompile Include="plugingui.c" />

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
@@ -51,9 +51,6 @@
<ClInclude Include="maingui.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="preferences-persistence.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="menu.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -185,9 +182,6 @@
<ClCompile Include="pixmaps.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="preferences-persistence.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="plugingui.c">
<Filter>Source Files</Filter>
</ClCompile>

View File

@@ -52,7 +52,6 @@
#include "theme/theme-palette.h"
#include "maingui.h"
#include "menu.h"
#include "preferences-persistence.h"
#include "fkeys.h"
#include "userlistgui.h"
#include "chanview.h"
@@ -174,81 +173,6 @@ enum
static void mg_apply_emoji_fallback_widget (GtkWidget *widget);
#define MG_CONFIG_SAVE_DEBOUNCE_MS 250
static guint mg_config_save_source_id = 0;
static gboolean mg_config_prefs_dirty = FALSE;
static void
mg_show_save_failure (const PreferencesPersistenceResult *save_result)
{
char buffer[192];
if (!save_result || save_result->success)
return;
if (save_result->partial_failure)
{
fe_message (_("Could not fully save preferences. zoitechat.conf was written, but colors.conf failed. Retry is possible."), FE_MSG_ERROR);
return;
}
g_snprintf (buffer, sizeof (buffer), _("Could not save preferences (%s). Retry is possible."), save_result->failed_file ? save_result->failed_file : _("unknown file"));
fe_message (buffer, FE_MSG_ERROR);
}
static gboolean
mg_config_save_timeout_cb (gpointer userdata)
{
PreferencesPersistenceResult save_result;
mg_config_save_source_id = 0;
if (!mg_config_prefs_dirty)
return G_SOURCE_REMOVE;
save_result = preferences_persistence_save_all ();
if (!save_result.success)
mg_show_save_failure (&save_result);
mg_config_prefs_dirty = FALSE;
return G_SOURCE_REMOVE;
}
static void
mg_schedule_config_save (void)
{
if (!mg_config_prefs_dirty)
return;
if (mg_config_save_source_id != 0)
g_source_remove (mg_config_save_source_id);
mg_config_save_source_id = g_timeout_add (MG_CONFIG_SAVE_DEBOUNCE_MS,
mg_config_save_timeout_cb,
NULL);
}
static void
mg_flush_config_save (void)
{
PreferencesPersistenceResult save_result;
if (mg_config_save_source_id != 0)
{
g_source_remove (mg_config_save_source_id);
mg_config_save_source_id = 0;
}
if (mg_config_prefs_dirty)
{
save_result = preferences_persistence_save_all ();
if (!save_result.success)
mg_show_save_failure (&save_result);
mg_config_prefs_dirty = FALSE;
}
}
static inline void
mg_set_source_color (cairo_t *cr, const XTextColor *color)
{
@@ -746,7 +670,7 @@ mg_spellcheck_cb (SexySpellEntry *entry, gchar *word, gpointer data)
{
/* This can cause freezes on long words, nicks arn't very long anyway. */
if (strlen (word) > 20)
return FALSE;
return TRUE;
/* Ignore anything we think is a valid url */
if (url_check_word (word) != 0)
@@ -837,10 +761,6 @@ fe_set_title (session *sess)
static gboolean
mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata)
{
guint win_state;
guint win_fullscreen;
gboolean changed = FALSE;
if ((event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) &&
(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) &&
prefs.hex_gui_tray_minimize && prefs.hex_gui_tray &&
@@ -849,31 +769,13 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
tray_toggle_visibility (TRUE);
}
win_state = 0;
if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
win_state = 1;
prefs.hex_gui_win_state = 0;
if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
prefs.hex_gui_win_state = 1;
win_fullscreen = 0;
if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
win_fullscreen = 1;
if (prefs.hex_gui_win_state != win_state)
{
prefs.hex_gui_win_state = win_state;
changed = TRUE;
}
if (prefs.hex_gui_win_fullscreen != win_fullscreen)
{
prefs.hex_gui_win_fullscreen = win_fullscreen;
changed = TRUE;
}
if (changed)
{
mg_config_prefs_dirty = TRUE;
mg_schedule_config_save ();
}
prefs.hex_gui_win_fullscreen = 0;
if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
prefs.hex_gui_win_fullscreen = 1;
menu_set_fullscreen (current_sess->gui, prefs.hex_gui_win_fullscreen);
@@ -887,46 +789,17 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
static gboolean
mg_configure_cb (GtkWidget *wid, GdkEventConfigure *event, session *sess)
{
gboolean changed = FALSE;
if (sess == NULL) /* for the main_window */
{
if (mg_gui)
{
if (prefs.hex_gui_win_save && !prefs.hex_gui_win_state && !prefs.hex_gui_win_fullscreen)
{
int win_left;
int win_top;
int win_width;
int win_height;
sess = current_sess;
gtk_window_get_position (GTK_WINDOW (wid), &win_left, &win_top);
gtk_window_get_size (GTK_WINDOW (wid), &win_width, &win_height);
if (prefs.hex_gui_win_left != win_left)
{
prefs.hex_gui_win_left = win_left;
changed = TRUE;
}
if (prefs.hex_gui_win_top != win_top)
{
prefs.hex_gui_win_top = win_top;
changed = TRUE;
}
if (prefs.hex_gui_win_width != win_width)
{
prefs.hex_gui_win_width = win_width;
changed = TRUE;
}
if (prefs.hex_gui_win_height != win_height)
{
prefs.hex_gui_win_height = win_height;
changed = TRUE;
}
gtk_window_get_position (GTK_WINDOW (wid), &prefs.hex_gui_win_left,
&prefs.hex_gui_win_top);
gtk_window_get_size (GTK_WINDOW (wid), &prefs.hex_gui_win_width,
&prefs.hex_gui_win_height);
}
}
}
@@ -935,46 +808,13 @@ mg_configure_cb (GtkWidget *wid, GdkEventConfigure *event, session *sess)
{
if (sess->type == SESS_DIALOG && prefs.hex_gui_win_save)
{
int dialog_left;
int dialog_top;
int dialog_width;
int dialog_height;
gtk_window_get_position (GTK_WINDOW (wid), &dialog_left, &dialog_top);
gtk_window_get_size (GTK_WINDOW (wid), &dialog_width, &dialog_height);
if (prefs.hex_gui_dialog_left != dialog_left)
{
prefs.hex_gui_dialog_left = dialog_left;
changed = TRUE;
}
if (prefs.hex_gui_dialog_top != dialog_top)
{
prefs.hex_gui_dialog_top = dialog_top;
changed = TRUE;
}
if (prefs.hex_gui_dialog_width != dialog_width)
{
prefs.hex_gui_dialog_width = dialog_width;
changed = TRUE;
}
if (prefs.hex_gui_dialog_height != dialog_height)
{
prefs.hex_gui_dialog_height = dialog_height;
changed = TRUE;
}
gtk_window_get_position (GTK_WINDOW (wid), &prefs.hex_gui_dialog_left,
&prefs.hex_gui_dialog_top);
gtk_window_get_size (GTK_WINDOW (wid), &prefs.hex_gui_dialog_width,
&prefs.hex_gui_dialog_height);
}
}
if (changed)
{
mg_config_prefs_dirty = TRUE;
mg_schedule_config_save ();
}
return FALSE;
}
@@ -1080,18 +920,13 @@ mg_unpopulate (session *sess)
{
restore_gui *res;
session_gui *gui;
GtkTextBuffer *topic_buffer;
GtkTextIter start;
GtkTextIter end;
int i;
gui = sess->gui;
res = sess->res;
res->input_text = g_strdup (SPELL_ENTRY_GET_TEXT (gui->input_box));
topic_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (gui->topic_entry));
gtk_text_buffer_get_bounds (topic_buffer, &start, &end);
res->topic_text = gtk_text_buffer_get_text (topic_buffer, &start, &end, FALSE);
res->topic_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (gui->topic_entry)));
res->limit_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (gui->limit_entry)));
res->key_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (gui->key_entry)));
if (gui->laginfo)
@@ -1168,9 +1003,6 @@ void
mg_set_topic_tip (session *sess)
{
char *text;
GtkTextBuffer *topic_buffer;
GtkTextIter start;
GtkTextIter end;
switch (sess->type)
{
@@ -1185,14 +1017,11 @@ mg_set_topic_tip (session *sess)
gtk_widget_set_tooltip_text (sess->gui->topic_entry, _("No topic is set"));
break;
default:
topic_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (sess->gui->topic_entry));
gtk_text_buffer_get_bounds (topic_buffer, &start, &end);
text = gtk_text_buffer_get_text (topic_buffer, &start, &end, FALSE);
if (text[0])
gtk_widget_set_tooltip_text (sess->gui->topic_entry, text);
if (gtk_entry_get_text (GTK_ENTRY (sess->gui->topic_entry)) &&
gtk_entry_get_text (GTK_ENTRY (sess->gui->topic_entry))[0])
gtk_widget_set_tooltip_text (sess->gui->topic_entry, (char *)gtk_entry_get_text (GTK_ENTRY (sess->gui->topic_entry)));
else
gtk_widget_set_tooltip_text (sess->gui->topic_entry, NULL);
g_free (text);
}
}
@@ -1223,14 +1052,9 @@ mg_userlist_showhide (session *sess, int show)
session_gui *gui = sess->gui;
int handle_size;
int right_size;
int min_right_size;
GtkAllocation allocation;
gtk_widget_get_size_request (gui->user_box, &min_right_size, NULL);
if (min_right_size < 1)
min_right_size = 1;
right_size = MAX (prefs.hex_gui_pane_right_size, min_right_size);
right_size = MAX (prefs.hex_gui_pane_right_size, prefs.hex_gui_pane_right_size_min);
if (show)
{
@@ -1340,7 +1164,7 @@ mg_populate (session *sess)
/* hide the userlist */
mg_decide_userlist (sess, FALSE);
/* shouldn't edit the topic */
gtk_text_view_set_editable (GTK_TEXT_VIEW (gui->topic_entry), FALSE);
gtk_editable_set_editable (GTK_EDITABLE (gui->topic_entry), FALSE);
/* might be hidden from server tab */
if (prefs.hex_gui_topicbar)
gtk_widget_show (gui->topic_bar);
@@ -1362,8 +1186,8 @@ mg_populate (session *sess)
gtk_widget_show (gui->topicbutton_box);
/* show the userlist */
mg_decide_userlist (sess, FALSE);
/* let the topic be edited */
gtk_text_view_set_editable (GTK_TEXT_VIEW (gui->topic_entry), TRUE);
/* let the topic be editted */
gtk_editable_set_editable (GTK_EDITABLE (gui->topic_entry), TRUE);
if (prefs.hex_gui_topicbar)
gtk_widget_show (gui->topic_bar);
}
@@ -1383,21 +1207,8 @@ mg_populate (session *sess)
if (gui->is_tab)
gtk_widget_set_sensitive (gui->menu, TRUE);
if (res->topic_text)
{
GtkTextBuffer *topic_buffer;
topic_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (gui->topic_entry));
gtk_text_buffer_set_text (topic_buffer, res->topic_text, -1);
g_free (res->topic_text);
res->topic_text = NULL;
} else
{
GtkTextBuffer *topic_buffer;
topic_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (gui->topic_entry));
gtk_text_buffer_set_text (topic_buffer, "", -1);
}
/* restore all the GtkEntry's */
mg_restore_entry (gui->topic_entry, &res->topic_text);
mg_restore_speller (gui->input_box, &res->input_text);
mg_restore_entry (gui->key_entry, &res->key_text);
mg_restore_entry (gui->limit_entry, &res->limit_text);
@@ -2303,204 +2114,30 @@ mg_create_userlistbuttons (GtkWidget *box)
}
static void
mg_topic_cb (GtkWidget *entry)
mg_topic_cb (GtkWidget *entry, gpointer userdata)
{
session *sess = current_sess;
GtkTextBuffer *topic_buffer;
GtkTextIter start;
GtkTextIter end;
char *text;
if (sess->channel[0] && sess->server->connected && sess->type == SESS_CHANNEL)
{
topic_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (entry));
gtk_text_buffer_get_bounds (topic_buffer, &start, &end);
text = gtk_text_buffer_get_text (topic_buffer, &start, &end, FALSE);
text = (char *)gtk_entry_get_text (GTK_ENTRY (entry));
if (text[0] == 0)
sess->server->p_topic (sess->server, sess->channel, NULL);
else
sess->server->p_topic (sess->server, sess->channel, text);
g_free (text);
text = NULL;
sess->server->p_topic (sess->server, sess->channel, text);
} else
{
topic_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (entry));
gtk_text_buffer_set_text (topic_buffer, "", -1);
}
gtk_entry_set_text (GTK_ENTRY (entry), "");
/* restore focus to the input widget, where the next input will most
likely be */
gtk_widget_grab_focus (sess->gui->input_box);
}
static gboolean
mg_topic_key_press_cb (GtkWidget *entry, GdkEventKey *event, gpointer userdata)
{
if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter)
{
mg_topic_cb (entry);
return TRUE;
}
return FALSE;
}
static char *
mg_topic_get_word_at_pos (GtkWidget *entry, gdouble event_x, gdouble event_y, int *word_pos)
{
GtkTextBuffer *buffer;
GtkTextIter iter;
GtkTextIter start;
GtkTextIter end;
GtkTextIter cursor;
int x;
int y;
x = (int)event_x;
y = (int)event_y;
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (entry), GTK_TEXT_WINDOW_TEXT,
x, y, &x, &y);
gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (entry), &iter, x, y);
cursor = iter;
start = iter;
while (!gtk_text_iter_starts_line (&start))
{
GtkTextIter prev = start;
gunichar ch;
gtk_text_iter_backward_char (&prev);
ch = gtk_text_iter_get_char (&prev);
if (g_unichar_isspace (ch))
break;
start = prev;
}
end = iter;
while (!gtk_text_iter_ends_line (&end))
{
gunichar ch;
ch = gtk_text_iter_get_char (&end);
if (ch == 0 || g_unichar_isspace (ch))
break;
gtk_text_iter_forward_char (&end);
}
if (gtk_text_iter_equal (&start, &end))
return NULL;
if (word_pos)
{
char *prefix;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (entry));
prefix = gtk_text_buffer_get_text (buffer, &start, &cursor, FALSE);
*word_pos = (int)strlen (prefix);
g_free (prefix);
}
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (entry));
return gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
}
static void
mg_topic_set_cursor (GtkWidget *entry, GdkCursorType cursor_type)
{
GdkWindow *text_window;
GdkDisplay *display;
GdkCursor *cursor;
text_window = gtk_text_view_get_window (GTK_TEXT_VIEW (entry), GTK_TEXT_WINDOW_TEXT);
if (!text_window)
return;
display = gdk_window_get_display (text_window);
cursor = gdk_cursor_new_for_display (display, cursor_type);
gdk_window_set_cursor (text_window, cursor);
g_object_unref (cursor);
}
static gboolean
mg_topic_word_is_clickable (const char *word, int word_pos)
{
int start;
int end;
if (!word || word[0] == 0)
return FALSE;
if (strcmp (word, "/") == 0)
return FALSE;
if (url_check_word (word) == 0)
return FALSE;
url_last (&start, &end);
return word_pos >= start && word_pos < end;
}
static gboolean
mg_topic_motion_cb (GtkWidget *entry, GdkEventMotion *event, gpointer userdata)
{
char *word;
int word_pos;
gboolean word_is_clickable;
word_pos = 0;
word = mg_topic_get_word_at_pos (entry, event->x, event->y, &word_pos);
word_is_clickable = mg_topic_word_is_clickable (word, word_pos);
if (word_is_clickable)
mg_topic_set_cursor (entry, GDK_HAND2);
else
mg_topic_set_cursor (entry, GDK_XTERM);
g_free (word);
return FALSE;
}
static gboolean
mg_topic_leave_cb (GtkWidget *entry, GdkEventCrossing *event, gpointer userdata)
{
mg_topic_set_cursor (entry, GDK_XTERM);
return FALSE;
}
static gboolean
mg_topic_button_release_cb (GtkWidget *entry, GdkEventButton *event, gpointer userdata)
{
char *word;
int word_pos;
int start;
int end;
if (event->button != 1)
return FALSE;
word_pos = 0;
word = mg_topic_get_word_at_pos (entry, event->x, event->y, &word_pos);
if (!word)
return FALSE;
if (mg_topic_word_is_clickable (word, word_pos))
{
url_last (&start, &end);
word[end] = 0;
fe_open_url (word + start);
g_free (word);
return TRUE;
}
g_free (word);
return FALSE;
}
static void
mg_tabwindow_kill_cb (GtkWidget *win, gpointer userdata)
{
GSList *list, *next;
session *sess;
mg_flush_config_save ();
zoitechat_is_quitting = TRUE;
/* see if there's any non-tab windows left */
@@ -2778,20 +2415,6 @@ mg_apply_entry_style (GtkWidget *entry)
theme_manager_apply_entry_palette (entry, input_style->font_desc);
}
static gboolean
mg_entry_select_all (GtkWidget *entry, GdkEventKey *event, gpointer userdata)
{
if ((event->state & GDK_CONTROL_MASK) &&
!(event->state & (GDK_SHIFT_MASK | GDK_MOD1_MASK | GDK_META_MASK)) &&
(event->keyval == GDK_KEY_a || event->keyval == GDK_KEY_A))
{
gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
return TRUE;
}
return FALSE;
}
static void
mg_create_chanmodebuttons (session_gui *gui, GtkWidget *box)
{
@@ -2811,8 +2434,6 @@ mg_create_chanmodebuttons (session_gui *gui, GtkWidget *box)
mg_apply_emoji_fallback_widget (gui->key_entry);
g_signal_connect (G_OBJECT (gui->key_entry), "activate",
G_CALLBACK (mg_key_entry_cb), NULL);
g_signal_connect (G_OBJECT (gui->key_entry), "key_press_event",
G_CALLBACK (mg_entry_select_all), NULL);
if (prefs.hex_gui_input_style)
mg_apply_entry_style (gui->key_entry);
@@ -2826,8 +2447,6 @@ mg_create_chanmodebuttons (session_gui *gui, GtkWidget *box)
mg_apply_emoji_fallback_widget (gui->limit_entry);
g_signal_connect (G_OBJECT (gui->limit_entry), "activate",
G_CALLBACK (mg_limit_entry_cb), NULL);
g_signal_connect (G_OBJECT (gui->limit_entry), "key_press_event",
G_CALLBACK (mg_entry_select_all), NULL);
if (prefs.hex_gui_input_style)
mg_apply_entry_style (gui->limit_entry);
@@ -2851,18 +2470,12 @@ mg_dialog_button_cb (GtkWidget *wid, char *cmd)
char buf[128];
char *host = "";
char *topic;
char *topic_text;
GtkTextBuffer *topic_buffer;
GtkTextIter start;
GtkTextIter end;
if (!current_sess)
return;
topic_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (current_sess->gui->topic_entry));
gtk_text_buffer_get_bounds (topic_buffer, &start, &end);
topic_text = gtk_text_buffer_get_text (topic_buffer, &start, &end, FALSE);
topic = strrchr (topic_text, '@');
topic = (char *)(gtk_entry_get_text (GTK_ENTRY (current_sess->gui->topic_entry)));
topic = strrchr (topic, '@');
if (topic)
host = topic + 1;
@@ -2871,7 +2484,6 @@ mg_dialog_button_cb (GtkWidget *wid, char *cmd)
current_sess->channel, "");
handle_command (current_sess, buf, TRUE);
g_free (topic_text);
/* dirty trick to avoid auto-selection */
SPELL_ENTRY_SET_EDITABLE (current_sess->gui->input_box, FALSE);
@@ -2918,23 +2530,16 @@ mg_create_topicbar (session *sess, GtkWidget *box)
if (!gui->is_tab)
sess->res->tab = NULL;
gui->topic_entry = topic = gtk_text_view_new ();
gui->topic_entry = topic = sexy_spell_entry_new ();
gtk_widget_set_name (topic, "zoitechat-inputbox");
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_right_margin (GTK_TEXT_VIEW (topic), 4);
sexy_spell_entry_set_checked (SEXY_SPELL_ENTRY (topic), FALSE);
gtk_box_pack_start (GTK_BOX (hbox), topic, TRUE, TRUE, 0);
mg_apply_emoji_fallback_widget (topic);
gtk_widget_add_events (topic, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
g_signal_connect (G_OBJECT (topic), "key-press-event",
G_CALLBACK (mg_topic_key_press_cb), NULL);
g_signal_connect (G_OBJECT (topic), "button-release-event",
G_CALLBACK (mg_topic_button_release_cb), NULL);
g_signal_connect (G_OBJECT (topic), "motion-notify-event",
G_CALLBACK (mg_topic_motion_cb), NULL);
g_signal_connect (G_OBJECT (topic), "leave-notify-event",
G_CALLBACK (mg_topic_leave_cb), NULL);
g_signal_connect (G_OBJECT (topic), "activate",
G_CALLBACK (mg_topic_cb), 0);
if (prefs.hex_gui_input_style)
mg_apply_entry_style (topic);
gui->topicbutton_box = bbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), bbox, 0, 0, 0);
@@ -3305,8 +2910,6 @@ mg_create_userlist (session_gui *gui, GtkWidget *box)
gtk_box_pack_start (GTK_BOX (vbox), frame, 0, 0, GUI_SPACING);
gui->namelistinfo = gtk_label_new (NULL);
gtk_label_set_xalign (GTK_LABEL (gui->namelistinfo), 0.0f);
gtk_widget_set_halign (gui->namelistinfo, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (frame), gui->namelistinfo);
gui->user_tree = ulist = userlist_create (vbox);
@@ -3381,12 +2984,12 @@ mg_create_center (session *sess, session_gui *gui, GtkWidget *box)
if (prefs.hex_gui_win_swap)
{
gtk_paned_pack2 (GTK_PANED (gui->hpane_left), gui->vpane_left, FALSE, FALSE);
gtk_paned_pack2 (GTK_PANED (gui->hpane_left), gui->vpane_left, FALSE, TRUE);
gtk_paned_pack1 (GTK_PANED (gui->hpane_left), gui->hpane_right, TRUE, TRUE);
}
else
{
gtk_paned_pack1 (GTK_PANED (gui->hpane_left), gui->vpane_left, FALSE, FALSE);
gtk_paned_pack1 (GTK_PANED (gui->hpane_left), gui->vpane_left, FALSE, TRUE);
gtk_paned_pack2 (GTK_PANED (gui->hpane_left), gui->hpane_right, TRUE, TRUE);
}
gtk_paned_pack2 (GTK_PANED (gui->hpane_right), gui->vpane_right, FALSE, TRUE);
@@ -3845,8 +3448,7 @@ static void
search_set_option (GtkToggleButton *but, guint *pref)
{
*pref = gtk_toggle_button_get_active(but);
if (!save_config ())
fe_message (_("Could not save zoitechat.conf."), FE_MSG_WARN);
save_config();
}
void
@@ -4486,8 +4088,7 @@ fe_clear_channel (session *sess)
if (!sess->gui->is_tab || sess == current_tab)
{
gtk_text_buffer_set_text (
gtk_text_view_get_buffer (GTK_TEXT_VIEW (gui->topic_entry)), "", -1);
gtk_entry_set_text (GTK_ENTRY (gui->topic_entry), "");
if (gui->op_xpm)
{

View File

@@ -869,9 +869,6 @@ menu_nickmenu (session *sess, GdkEventButton *event, char *nick, int num_sel)
static void
menu_showhide_cb (session *sess)
{
if (!sess->gui->menu || !GTK_IS_WIDGET (sess->gui->menu))
return;
if (prefs.hex_gui_hide_menu)
gtk_widget_hide (sess->gui->menu);
else
@@ -929,11 +926,6 @@ menu_setting_foreach (void (*callback) (session *), int id, guint state)
while (list)
{
sess = list->data;
if (!sess || !sess->gui)
{
list = list->next;
continue;
}
if (!sess->gui->is_tab || !maindone)
{
@@ -943,20 +935,9 @@ menu_setting_foreach (void (*callback) (session *), int id, guint state)
{
GtkWidget *menu_item = sess->gui->menu_item[id];
if (menu_item != NULL && GTK_IS_CHECK_MENU_ITEM (menu_item))
if (menu_item != NULL)
{
guint toggled_signal = g_signal_lookup ("toggled", G_OBJECT_TYPE (menu_item));
if (toggled_signal != 0)
{
g_signal_handlers_block_matched (menu_item, G_SIGNAL_MATCH_ID, toggled_signal, 0, NULL, NULL, NULL);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), state);
g_signal_handlers_unblock_matched (menu_item, G_SIGNAL_MATCH_ID, toggled_signal, 0, NULL, NULL, NULL);
}
else
{
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), state);
}
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), state);
}
}
if (callback)
@@ -971,7 +952,7 @@ void
menu_bar_toggle (void)
{
prefs.hex_gui_hide_menu = !prefs.hex_gui_hide_menu;
menu_setting_foreach (menu_showhide_cb, -1, !prefs.hex_gui_hide_menu);
menu_setting_foreach (menu_showhide_cb, MENU_ID_MENUBAR, !prefs.hex_gui_hide_menu);
}
static void
@@ -2189,11 +2170,6 @@ menu_foreach_gui (menu_entry *me, void (*callback) (GtkWidget *, menu_entry *, c
while (list)
{
sess = list->data;
if (!sess || !sess->gui)
{
list = list->next;
continue;
}
/* do it only once for tab sessions, since they share a GUI */
if (!sess->gui->is_tab || !tabdone)
{
@@ -2619,14 +2595,13 @@ menu_create_main (void *accel_group, int bar, int away, int toplevel,
normalitem:
if (mymenu[i].key != 0)
gtk_widget_add_accelerator (item, "activate", accel_group,
mymenu[i].key,
mymenu[i].key == GDK_KEY_F1 ? 0 :
mymenu[i].key == GDK_KEY_w ? close_mask :
mymenu[i].id == MENU_ID_AWAY ? away_mask :
(g_ascii_isupper (mymenu[i].key)) ?
STATE_SHIFT | STATE_CTRL :
STATE_CTRL,
GTK_ACCEL_VISIBLE);
mymenu[i].key,
mymenu[i].key == GDK_KEY_F1 ? 0 :
mymenu[i].key == GDK_KEY_w ? close_mask :
(g_ascii_isupper (mymenu[i].key)) ?
STATE_SHIFT | STATE_CTRL :
STATE_CTRL,
GTK_ACCEL_VISIBLE);
if (mymenu[i].callback)
g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (mymenu[i].callback), 0);

View File

@@ -28,7 +28,6 @@ zoitechat_gtk_sources = [
'maingui.c',
'notifygui.c',
'pixmaps.c',
'preferences-persistence.c',
'plugin-tray.c',
'plugin-notification.c',
'rawlog.c',

View File

@@ -1,66 +0,0 @@
#include "preferences-persistence.h"
#include "../common/cfgfiles.h"
#include "theme/theme-runtime.h"
PreferencesPersistenceResult
preferences_persistence_save_all (void)
{
PreferencesPersistenceResult result;
char *config_temp;
char *theme_temp;
result.success = FALSE;
result.retry_possible = TRUE;
result.partial_failure = FALSE;
result.config_failed = FALSE;
result.theme_failed = FALSE;
result.failed_file = NULL;
config_temp = NULL;
theme_temp = NULL;
if (!save_config_prepare (&config_temp))
{
result.config_failed = TRUE;
goto done;
}
if (!theme_runtime_save_prepare (&theme_temp))
{
result.theme_failed = TRUE;
goto done;
}
if (!save_config_finalize (config_temp))
{
result.config_failed = TRUE;
goto done;
}
if (!theme_runtime_save_finalize (theme_temp))
{
result.theme_failed = TRUE;
result.partial_failure = TRUE;
goto done;
}
result.success = TRUE;
done:
if (!result.success)
{
if (result.config_failed && result.theme_failed)
result.failed_file = "zoitechat.conf and colors.conf";
else if (result.config_failed)
result.failed_file = "zoitechat.conf";
else if (result.theme_failed)
result.failed_file = "colors.conf";
}
save_config_discard (config_temp);
theme_runtime_save_discard (theme_temp);
g_free (config_temp);
g_free (theme_temp);
return result;
}

View File

@@ -1,18 +0,0 @@
#ifndef ZOITECHAT_PREFERENCES_PERSISTENCE_H
#define ZOITECHAT_PREFERENCES_PERSISTENCE_H
#include <glib.h>
typedef struct
{
gboolean success;
gboolean retry_possible;
gboolean partial_failure;
gboolean config_failed;
gboolean theme_failed;
const char *failed_file;
} PreferencesPersistenceResult;
PreferencesPersistenceResult preferences_persistence_save_all (void);
#endif

View File

@@ -1002,8 +1002,7 @@ servlist_savegui (void)
sp[0] = 0; /* spaces will break the login */
/* strcpy (prefs.hex_irc_real_name, gtk_entry_get_text (GTK_ENTRY (entry_greal))); */
servlist_save ();
if (!save_config ())
fe_message (_("Could not save zoitechat.conf."), FE_MSG_WARN);
save_config (); /* For nicks stored in zoitechat.conf */
return 0;
}

View File

@@ -40,7 +40,6 @@
#include "maingui.h"
#include "pixmaps.h"
#include "menu.h"
#include "preferences-persistence.h"
#include "plugin-tray.h"
#include "notifications/notification-backend.h"
@@ -2192,23 +2191,10 @@ setup_apply (struct zoitechatprefs *pr)
static void
setup_ok_cb (GtkWidget *but, GtkWidget *win)
{
PreferencesPersistenceResult save_result;
char buffer[192];
gtk_widget_destroy (win);
setup_apply (&setup_prefs);
save_result = preferences_persistence_save_all ();
if (save_result.success)
return;
if (save_result.partial_failure)
{
fe_message (_("Preferences were partially saved. zoitechat.conf succeeded, colors.conf failed. Retry is possible."), FE_MSG_ERROR);
return;
}
g_snprintf (buffer, sizeof (buffer), _("Could not save preferences (%s). Retry is possible."), save_result.failed_file ? save_result.failed_file : _("unknown file"));
fe_message (buffer, FE_MSG_ERROR);
save_config ();
theme_manager_save_preferences ();
}
static GtkWidget *

View File

@@ -964,9 +964,6 @@ default_word_check(SexySpellEntry *entry, const gchar *word)
/* We only want to check words */
return FALSE;
}
if (g_utf8_strlen (word, -1) > 20)
return FALSE;
for (li = entry->priv->dict_list; li; li = g_slist_next (li)) {
struct EnchantDict *dict = (struct EnchantDict *) li->data;
if (enchant_dict_check(dict, word, strlen(word)) == 0) {
@@ -1164,34 +1161,13 @@ check_color:
}
}
static gboolean
attr_list_has_attrs (PangoAttrList *attrs)
{
PangoAttrIterator *it;
GSList *list;
gboolean has = FALSE;
if (!attrs)
return FALSE;
it = pango_attr_list_get_iterator (attrs);
if (!it)
return FALSE;
list = pango_attr_iterator_get_attrs (it);
has = (list != NULL);
g_slist_free_full (list, (GDestroyNotify) pango_attribute_destroy);
pango_attr_iterator_destroy (it);
return has;
}
static void
sexy_spell_entry_recheck_all(SexySpellEntry *entry)
{
GdkRectangle rect;
GtkAllocation allocation;
GtkWidget *widget = GTK_WIDGET(entry);
PangoLayout *layout;
int length, i, text_len;
const char *text;
@@ -1220,7 +1196,8 @@ sexy_spell_entry_recheck_all(SexySpellEntry *entry)
}
}
gtk_entry_set_attributes (GTK_ENTRY (entry), attr_list_has_attrs (entry->priv->attr_list) ? entry->priv->attr_list : NULL);
layout = gtk_entry_get_layout(GTK_ENTRY(entry));
pango_layout_set_attributes(layout, entry->priv->attr_list);
if (gtk_widget_get_realized (GTK_WIDGET(entry)))
{
@@ -1236,6 +1213,13 @@ sexy_spell_entry_recheck_all(SexySpellEntry *entry)
static gboolean
sexy_spell_entry_draw(GtkWidget *widget, cairo_t *cr)
{
SexySpellEntry *entry = SEXY_SPELL_ENTRY(widget);
GtkEntry *gtk_entry = GTK_ENTRY(widget);
PangoLayout *layout;
layout = gtk_entry_get_layout(gtk_entry);
pango_layout_set_attributes(layout, entry->priv->attr_list);
return GTK_WIDGET_CLASS(parent_class)->draw (widget, cr);
}

View File

@@ -57,10 +57,9 @@ theme_runtime_load (void)
{
}
gboolean
void
theme_runtime_save (void)
{
return TRUE;
}
void

View File

@@ -119,9 +119,8 @@ void theme_runtime_load (void)
{
}
gboolean theme_runtime_save (void)
void theme_runtime_save (void)
{
return TRUE;
}
gboolean theme_runtime_is_dark_active (void)

View File

@@ -112,9 +112,8 @@ void theme_runtime_load (void)
{
}
gboolean theme_runtime_save (void)
void theme_runtime_save (void)
{
return TRUE;
}
gboolean theme_runtime_is_dark_active (void)

View File

@@ -122,9 +122,8 @@ void theme_runtime_load (void)
{
}
gboolean theme_runtime_save (void)
void theme_runtime_save (void)
{
return TRUE;
}
gboolean theme_runtime_is_dark_active (void)

View File

@@ -66,10 +66,9 @@ theme_manager_reset_mode_colors (unsigned int mode, gboolean *palette_changed)
*palette_changed = FALSE;
}
gboolean
void
theme_manager_save_preferences (void)
{
return TRUE;
}
ThemePaletteBehavior

View File

@@ -27,12 +27,6 @@ typedef struct
guint16 bg_red;
guint16 bg_green;
guint16 bg_blue;
guint16 sel_fg_red;
guint16 sel_fg_green;
guint16 sel_fg_blue;
guint16 sel_bg_red;
guint16 sel_bg_green;
guint16 sel_bg_blue;
} ThemeCssInputFingerprint;
static GtkCssProvider *theme_css_input_provider;
@@ -98,12 +92,6 @@ theme_css_input_fingerprint_matches (const ThemeCssInputFingerprint *next)
if (theme_css_input_fp.bg_red != next->bg_red || theme_css_input_fp.bg_green != next->bg_green
|| theme_css_input_fp.bg_blue != next->bg_blue)
return FALSE;
if (theme_css_input_fp.sel_fg_red != next->sel_fg_red || theme_css_input_fp.sel_fg_green != next->sel_fg_green
|| theme_css_input_fp.sel_fg_blue != next->sel_fg_blue)
return FALSE;
if (theme_css_input_fp.sel_bg_red != next->sel_bg_red || theme_css_input_fp.sel_bg_green != next->sel_bg_green
|| theme_css_input_fp.sel_bg_blue != next->sel_bg_blue)
return FALSE;
if (g_strcmp0 (theme_css_input_fp.theme_name, next->theme_name) != 0)
return FALSE;
if (g_strcmp0 (theme_css_input_fp.font, next->font) != 0)
@@ -131,9 +119,7 @@ theme_css_input_fingerprint_clear (void)
static char *
theme_css_build_input (const char *theme_name, guint16 fg_red, guint16 fg_green, guint16 fg_blue,
guint16 bg_red, guint16 bg_green, guint16 bg_blue,
guint16 sel_fg_red, guint16 sel_fg_green, guint16 sel_fg_blue,
guint16 sel_bg_red, guint16 sel_bg_green, guint16 sel_bg_blue)
guint16 bg_red, guint16 bg_green, guint16 bg_blue)
{
GString *css = g_string_new ("");
@@ -151,11 +137,6 @@ theme_css_build_input (const char *theme_name, guint16 fg_red, guint16 fg_green,
"%s {"
"color: #%02x%02x%02x;"
"caret-color: #%02x%02x%02x;"
"}"
"%s selection, %s text selection, %s:focus selection, %s:focus text selection, %s *:selected, %s *:selected:focus {"
"background-color: #%02x%02x%02x;"
"color: #%02x%02x%02x;"
"text-shadow: none;"
"}",
theme_css_selector_input,
(bg_red >> 8), (bg_green >> 8), (bg_blue >> 8),
@@ -163,15 +144,7 @@ theme_css_build_input (const char *theme_name, guint16 fg_red, guint16 fg_green,
(fg_red >> 8), (fg_green >> 8), (fg_blue >> 8),
theme_css_selector_input_text,
(fg_red >> 8), (fg_green >> 8), (fg_blue >> 8),
(fg_red >> 8), (fg_green >> 8), (fg_blue >> 8),
theme_css_selector_input,
theme_css_selector_input,
theme_css_selector_input,
theme_css_selector_input,
theme_css_selector_input,
theme_css_selector_input,
(sel_bg_red >> 8), (sel_bg_green >> 8), (sel_bg_blue >> 8),
(sel_fg_red >> 8), (sel_fg_green >> 8), (sel_fg_blue >> 8));
(fg_red >> 8), (fg_green >> 8), (fg_blue >> 8));
return g_string_free (css, FALSE);
}
@@ -204,10 +177,6 @@ theme_css_reload_input_style (gboolean enabled, const PangoFontDescription *font
&next.fg_red, &next.fg_green, &next.fg_blue);
theme_palette_color_get_rgb16 (&style_values.background,
&next.bg_red, &next.bg_green, &next.bg_blue);
theme_palette_color_get_rgb16 (&style_values.selection_foreground,
&next.sel_fg_red, &next.sel_fg_green, &next.sel_fg_blue);
theme_palette_color_get_rgb16 (&style_values.selection_background,
&next.sel_bg_red, &next.sel_bg_green, &next.sel_bg_blue);
next.colors_set = TRUE;
}
@@ -224,9 +193,7 @@ theme_css_reload_input_style (gboolean enabled, const PangoFontDescription *font
css = theme_css_build_input (theme_name ? theme_name : "",
next.fg_red, next.fg_green, next.fg_blue,
next.bg_red, next.bg_green, next.bg_blue,
next.sel_fg_red, next.sel_fg_green, next.sel_fg_blue,
next.sel_bg_red, next.sel_bg_green, next.sel_bg_blue);
next.bg_red, next.bg_green, next.bg_blue);
gtk_css_provider_load_from_data (theme_css_input_provider, css, -1, NULL);
g_free (css);
theme_css_apply_app_provider (GTK_STYLE_PROVIDER (theme_css_input_provider));
@@ -309,7 +276,7 @@ theme_css_apply_palette_widget (GtkWidget *widget, const GdkRGBA *bg, const GdkR
if (fg)
g_string_append_printf (css, " color: %s;", fg_color);
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 *: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 {", 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);
if (sel_bg_color)
g_string_append_printf (css, " background-color: %s;", sel_bg_color);
else if (bg)

View File

@@ -284,10 +284,10 @@ theme_manager_commit_preferences (unsigned int old_mode, gboolean *color_change)
fe_set_auto_dark_mode_state (theme_policy_is_dark_mode_active (ZOITECHAT_DARK_MODE_AUTO));
}
gboolean
void
theme_manager_save_preferences (void)
{
return theme_runtime_save ();
theme_runtime_save ();
}
gboolean

View File

@@ -43,7 +43,7 @@ void theme_manager_set_mode (unsigned int mode, gboolean *palette_changed);
void theme_manager_set_token_color (unsigned int mode, ThemeSemanticToken token, const GdkRGBA *color, gboolean *palette_changed);
void theme_manager_reset_mode_colors (unsigned int mode, gboolean *palette_changed);
void theme_manager_commit_preferences (unsigned int old_mode, gboolean *color_change);
gboolean theme_manager_save_preferences (void);
void theme_manager_save_preferences (void);
gboolean theme_changed_event_has_reason (const ThemeChangedEvent *event, ThemeChangedReason reason);
void theme_manager_apply_and_dispatch (unsigned int mode, ThemeChangedReason reasons, gboolean *palette_changed);
void theme_manager_dispatch_changed (ThemeChangedReason reasons);

View File

@@ -70,9 +70,6 @@ typedef struct
#define COLOR_MANAGER_RESPONSE_RESET 1
static void
theme_preferences_show_import_error (GtkWidget *button, const char *message);
static void
theme_preferences_manager_row_free (gpointer data)
{
@@ -738,9 +735,8 @@ theme_preferences_manage_colors_cb (GtkWidget *button, gpointer user_data)
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
if (color_change_flag && *color_change_flag != old_changed &&
!theme_manager_save_preferences ())
theme_preferences_show_import_error (button, _("Could not save colors.conf."));
if (color_change_flag && *color_change_flag != old_changed)
theme_manager_save_preferences ();
}
static void
@@ -916,9 +912,8 @@ theme_preferences_import_colors_conf_cb (GtkWidget *button, gpointer user_data)
if (!any_imported)
theme_preferences_show_import_error (button, _("No importable colors were found in that colors.conf file."));
else if (color_change_flag && *color_change_flag != old_changed &&
!theme_manager_save_preferences ())
theme_preferences_show_import_error (button, _("Could not save colors.conf."));
else if (color_change_flag && *color_change_flag != old_changed)
theme_manager_save_preferences ();
g_free (cfg);
g_free (path);
@@ -1137,12 +1132,25 @@ theme_preferences_create_color_page (GtkWindow *parent,
static void
theme_preferences_open_gtk3_folder_cb (GtkWidget *button, gpointer user_data)
{
theme_preferences_ui *ui = user_data;
GAppInfo *handler;
char *themes_dir;
(void)user_data;
(void)button;
themes_dir = zoitechat_gtk3_theme_service_get_user_themes_dir ();
g_mkdir_with_parents (themes_dir, 0700);
handler = g_app_info_get_default_for_uri_scheme ("file");
if (!handler)
{
theme_preferences_show_message (ui,
GTK_MESSAGE_ERROR,
_("No application is configured to open folders."));
g_free (themes_dir);
return;
}
g_object_unref (handler);
fe_open_url (themes_dir);
g_free (themes_dir);
}
@@ -1397,34 +1405,26 @@ theme_preferences_populate_gtk3 (theme_preferences_ui *ui)
g_ptr_array_unref (themes);
}
static void
theme_preferences_gtk3_import_path (theme_preferences_ui *ui, char *path)
{
char *id = NULL;
GError *error = NULL;
if (!zoitechat_gtk3_theme_service_import (path, &id, &error))
theme_preferences_show_message (ui, GTK_MESSAGE_ERROR,
error ? error->message : _("Failed to import GTK3 theme."));
g_clear_error (&error);
g_free (id);
g_free (path);
theme_preferences_populate_gtk3 (ui);
}
static void
theme_preferences_gtk3_import_cb (GtkWidget *button, gpointer user_data)
{
theme_preferences_ui *ui = user_data;
GtkFileChooserNative *dialog;
GtkWidget *dialog;
GtkFileFilter *filter;
GtkWidget *folder_dialog;
char *path;
char *id = NULL;
GError *error = NULL;
gint response;
(void)button;
dialog = gtk_file_chooser_native_new (_("Import GTK3 Theme"), ui->parent,
dialog = gtk_file_chooser_dialog_new (_("Import GTK3 Theme"), ui->parent,
GTK_FILE_CHOOSER_ACTION_OPEN,
_("_Import"),
_("_Cancel"));
_("Import _Folder"), 1,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Import"), GTK_RESPONSE_ACCEPT,
NULL);
theme_manager_attach_window (dialog);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), TRUE);
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), FALSE);
filter = gtk_file_filter_new ();
@@ -1439,15 +1439,43 @@ theme_preferences_gtk3_import_cb (GtkWidget *button, gpointer user_data)
gtk_file_filter_add_pattern (filter, "*.tbz");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
if (gtk_native_dialog_run (GTK_NATIVE_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
response = gtk_dialog_run (GTK_DIALOG (dialog));
if (response == 1)
{
g_object_unref (dialog);
gtk_widget_destroy (dialog);
folder_dialog = gtk_file_chooser_dialog_new (_("Import GTK3 Theme Folder"), ui->parent,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Import"), GTK_RESPONSE_ACCEPT,
NULL);
theme_manager_attach_window (folder_dialog);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (folder_dialog), TRUE);
if (gtk_dialog_run (GTK_DIALOG (folder_dialog)) != GTK_RESPONSE_ACCEPT)
{
gtk_widget_destroy (folder_dialog);
return;
}
path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (folder_dialog));
gtk_widget_destroy (folder_dialog);
}
else if (response == GTK_RESPONSE_ACCEPT)
{
path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
gtk_widget_destroy (dialog);
}
else
{
gtk_widget_destroy (dialog);
return;
}
path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
g_object_unref (dialog);
theme_preferences_gtk3_import_path (ui, path);
if (!zoitechat_gtk3_theme_service_import (path, &id, &error))
theme_preferences_show_message (ui, GTK_MESSAGE_ERROR,
error ? error->message : _("Failed to import GTK3 theme."));
g_clear_error (&error);
g_free (path);
theme_preferences_populate_gtk3 (ui);
}
static void

View File

@@ -276,7 +276,7 @@ theme_runtime_load_migrated_legacy_color (char *cfg,
return palette_read_legacy_color (cfg, mode->legacy_prefix, def->legacy_index, out_color);
}
static gboolean
static void
palette_write_token_color (int fh, const char *mode_name, const ThemePaletteTokenDef *def, const GdkRGBA *color)
{
char prefname[256];
@@ -284,13 +284,13 @@ palette_write_token_color (int fh, const char *mode_name, const ThemePaletteToke
guint16 green;
guint16 blue;
g_return_val_if_fail (mode_name != NULL, FALSE);
g_return_val_if_fail (def != NULL, FALSE);
g_return_val_if_fail (color != NULL, FALSE);
g_return_if_fail (mode_name != NULL);
g_return_if_fail (def != NULL);
g_return_if_fail (color != NULL);
g_snprintf (prefname, sizeof prefname, "theme.mode.%s.token.%s", mode_name, def->name);
theme_palette_color_get_rgb16 (color, &red, &green, &blue);
return cfg_put_color (fh, red, green, blue, prefname);
cfg_put_color (fh, red, green, blue, prefname);
}
@@ -449,11 +449,12 @@ theme_runtime_load (void)
user_colors_valid = TRUE;
}
static gboolean
theme_runtime_save_to_fd (int fh)
void
theme_runtime_save (void)
{
size_t i;
size_t j;
int fh;
ThemePalettePersistenceMode modes[] = {
{ "light", "color", &light_palette, &user_colors_valid },
{ "dark", "dark_color", &dark_palette, &dark_user_colors_valid },
@@ -484,8 +485,11 @@ theme_runtime_save_to_fd (int fh)
else
modes[1].palette = &dark_palette;
if (!cfg_put_int (fh, THEME_PALETTE_MIGRATION_MARKER_VALUE, (char *) THEME_PALETTE_MIGRATION_MARKER_KEY))
return FALSE;
fh = zoitechat_open_file ("colors.conf", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
if (fh == -1)
return;
cfg_put_int (fh, THEME_PALETTE_MIGRATION_MARKER_VALUE, (char *) THEME_PALETTE_MIGRATION_MARKER_KEY);
for (i = 0; i < mode_count; i++)
{
@@ -503,130 +507,11 @@ theme_runtime_save_to_fd (int fh)
if (!custom_tokens[def->token])
continue;
g_assert (theme_palette_get_color (modes[i].palette, def->token, &color));
if (!palette_write_token_color (fh, modes[i].mode_name, def, &color))
return FALSE;
palette_write_token_color (fh, modes[i].mode_name, def, &color);
}
}
return TRUE;
}
gboolean
theme_runtime_save_prepare (char **temp_path)
{
int fh;
const char *temp_name;
if (!temp_path)
return FALSE;
temp_name = "colors.conf.new";
fh = zoitechat_open_file (temp_name, O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
if (fh == -1)
return FALSE;
if (!theme_runtime_save_to_fd (fh))
{
close (fh);
return FALSE;
}
if (close (fh) == -1)
return FALSE;
*temp_path = g_strdup (temp_name);
return TRUE;
}
gboolean
theme_runtime_save_finalize (const char *temp_path)
{
int src_fh;
int dst_fh;
char buffer[4096];
ssize_t read_len;
if (!temp_path)
return FALSE;
src_fh = zoitechat_open_file (temp_path, O_RDONLY, 0, XOF_DOMODE);
if (src_fh == -1)
return FALSE;
dst_fh = zoitechat_open_file ("colors.conf", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
if (dst_fh == -1)
{
close (src_fh);
return FALSE;
}
while ((read_len = read (src_fh, buffer, sizeof (buffer))) > 0)
{
ssize_t offset;
offset = 0;
while (offset < read_len)
{
ssize_t written;
written = write (dst_fh, buffer + offset, (size_t) (read_len - offset));
if (written <= 0)
{
close (src_fh);
close (dst_fh);
return FALSE;
}
offset += written;
}
}
if (read_len < 0)
{
close (src_fh);
close (dst_fh);
return FALSE;
}
if (close (src_fh) == -1)
{
close (dst_fh);
return FALSE;
}
if (close (dst_fh) == -1)
return FALSE;
return TRUE;
}
void
theme_runtime_save_discard (const char *temp_path)
{
int fh;
if (!temp_path)
return;
fh = zoitechat_open_file (temp_path, O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
if (fh != -1)
close (fh);
}
gboolean
theme_runtime_save (void)
{
char *temp_path = NULL;
gboolean result;
if (!theme_runtime_save_prepare (&temp_path))
return FALSE;
result = theme_runtime_save_finalize (temp_path);
if (!result)
theme_runtime_save_discard (temp_path);
g_free (temp_path);
return result;
close (fh);
}
static gboolean

View File

@@ -18,10 +18,7 @@ typedef struct
} ThemeGtkPaletteMap;
void theme_runtime_load (void);
gboolean theme_runtime_save (void);
gboolean theme_runtime_save_prepare (char **temp_path);
gboolean theme_runtime_save_finalize (const char *temp_path);
void theme_runtime_save_discard (const char *temp_path);
void theme_runtime_save (void);
gboolean theme_runtime_apply_mode (unsigned int mode, gboolean *palette_changed);
gboolean theme_runtime_apply_dark_mode (gboolean enable);
void theme_runtime_user_set_color (ThemeSemanticToken token, const GdkRGBA *col);

View File

@@ -52,29 +52,6 @@ enum
static void userlist_store_color (GtkListStore *store, GtkTreeIter *iter, ThemeSemanticToken token, gboolean has_token);
static void
userlist_update_min_width (session *sess)
{
GtkRequisition minimum;
GtkRequisition natural;
GtkWidget *scrolled_window;
int width;
if (!sess || !sess->gui || !sess->gui->user_box || !sess->gui->namelistinfo || !sess->gui->user_tree)
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);
if (GTK_IS_SCROLLED_WINDOW (scrolled_window))
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (scrolled_window), width);
gtk_widget_set_size_request (sess->gui->user_tree, width, -1);
gtk_widget_set_size_request (sess->gui->user_box, width, -1);
}
GdkPixbuf *
get_user_icon (server *serv, struct User *user)
{
@@ -133,11 +110,9 @@ fe_userlist_numbers (session *sess)
g_snprintf (tbuf, sizeof (tbuf), _("%d ops, %d total"), sess->ops, sess->total);
tbuf[sizeof (tbuf) - 1] = 0;
gtk_label_set_text (GTK_LABEL (sess->gui->namelistinfo), tbuf);
userlist_update_min_width (sess);
} else
{
gtk_label_set_text (GTK_LABEL (sess->gui->namelistinfo), NULL);
userlist_update_min_width (sess);
}
if (sess->type == SESS_CHANNEL && prefs.hex_gui_win_ucount)
@@ -687,7 +662,6 @@ static void
userlist_add_columns (GtkTreeView * treeview)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
/* icon column */
renderer = gtk_cell_renderer_pixbuf_new ();
@@ -696,22 +670,15 @@ userlist_add_columns (GtkTreeView * treeview)
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1, NULL, renderer,
"pixbuf", 0, NULL);
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), 0);
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
/* nick column */
renderer = gtk_cell_renderer_text_new ();
if (prefs.hex_gui_compact)
g_object_set (G_OBJECT (renderer), "ypad", 0, NULL);
g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1, NULL, renderer,
"text", 1, THEME_GTK_FOREGROUND_PROPERTY, 4, NULL);
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), 1);
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_expand (column, TRUE);
gtk_tree_view_column_set_min_width (column, 1);
if (prefs.hex_gui_ulist_show_hosts)
{
@@ -719,15 +686,10 @@ userlist_add_columns (GtkTreeView * treeview)
renderer = gtk_cell_renderer_text_new ();
if (prefs.hex_gui_compact)
g_object_set (G_OBJECT (renderer), "ypad", 0, NULL);
g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
-1, NULL, renderer,
"text", 2, NULL);
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), 2);
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_expand (column, TRUE);
gtk_tree_view_column_set_min_width (column, 1);
}
}

View File

@@ -4,6 +4,12 @@
;#define APPARCH "x64"
;#define PROJECTDIR "C:\...\zoitechat\win32\installer\"
;http://mitrich.net23.net/?/inno-download-plugin.html
#ifexist "idp.iss"
#define USE_INNO_DOWNLOAD_PLUGIN
#include <idp.iss>
#endif
[Setup]
AppName=ZoiteChat
AppVersion={#APPVER}
@@ -59,8 +65,8 @@ Name: "plugins\upd"; Description: "Update Checker"; Types: normal custom; Flags:
Name: "plugins\winamp"; Description: "Winamp"; 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\perl"; Description: "Perl (requires Perl 5.42)"; Types: custom; Flags: disablenouninstallwarning
Name: "langs\python"; Description: "Python (requires Python 3.14.3)"; Types: custom; Flags: disablenouninstallwarning
Name: "langs\perl"; Description: "Perl (requires Perl 5.20)"; Types: custom; Flags: disablenouninstallwarning
Name: "langs\python"; Description: "Python (requires Python 3.14.2)"; Types: custom; Flags: disablenouninstallwarning
[Tasks]
Name: portable; Description: "Yes"; GroupDescription: "Portable Mode: Stores configuration files within install directory for portable drives."; Flags: unchecked
@@ -276,8 +282,8 @@ begin
begin
REDIST := 'https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.16.2/vcredist_2015_x64.exe';
PERL := 'https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/SP_54201_64bit/strawberry-perl-5.42.0.1-64bit.msi';
PY3 := 'https://www.python.org/ftp/python/3.14.3/python-3.14.3-amd64.exe';
PERL := 'https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.16.2/Perl.5.20.0.x64.msi';
PY3 := 'https://www.python.org/ftp/python/3.14.2/python-3.14.2-amd64.exe';
SPELL := 'https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.16.2/ZoiteChat.Spelling.Dictionaries.r2.exe';
if not CheckVCInstall() then
@@ -288,7 +294,7 @@ begin
if not WizardSilent() then
begin
if IsComponentSelected('langs\perl') and not CheckDLL('perl542.dll') then
if IsComponentSelected('langs\perl') and not CheckDLL('perl520.dll') then
begin
idpAddFile(PERL, ExpandConstant('{tmp}\perl.msi'))
end;

View File

@@ -1 +1 @@
2.18.0~pre4
2.18.0~pre3

View File

@@ -6,7 +6,7 @@
<YourDepsPath>c:\gtk-build\gtk</YourDepsPath>
<YourGendefPath>c:\gtk-build\gendef</YourGendefPath>
<YourPerlPath>c:\gtk-build\perl-5.42.0.1</YourPerlPath>
<YourPerlPath>c:\gtk-build\perl-5.20</YourPerlPath>
<YourPython3Path>c:\gtk-build\python-3.14</YourPython3Path>
<YourWinSparklePath>c:\gtk-build\WinSparkle</YourWinSparklePath>
@@ -24,7 +24,7 @@
<GendefPath>$(YourGendefPath)</GendefPath>
<WinSparklePath>$(YourWinSparklePath)\$(ZoiteChatPlatform)</WinSparklePath>
<PerlPath>$(YourPerlPath)\$(ZoiteChatPlatform)</PerlPath>
<PerlLib>perl542</PerlLib>
<PerlLib>perl520</PerlLib>
<Python3Path>$(YourPython3Path)\$(ZoiteChatPlatform)</Python3Path>
<Python3Lib>python314</Python3Lib>