mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 16:00:18 +00:00
feat: GTK3-only theming overhaul—new theme service (discover/import/inherits), layered CSS+settings.ini apply w/ safe rollback + caching; widget/xtext palette mapping + all-colors editor; lots of win32/CI libarchive plumbing + installer assets;
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../theme-manager.h"
|
||||
#include "../theme-gtk3.h"
|
||||
#include "../../fe-gtk.h"
|
||||
#include "../../../common/zoitechat.h"
|
||||
#include "../../../common/zoitechatc.h"
|
||||
@@ -19,6 +20,9 @@ static ThemeChangedEvent last_event;
|
||||
static int idle_add_calls;
|
||||
static guint next_idle_source_id = 33;
|
||||
|
||||
void test_theme_gtk3_stub_reset (void);
|
||||
int test_theme_gtk3_stub_apply_current_calls (void);
|
||||
|
||||
void setup_apply_real (const ThemeChangedEvent *event)
|
||||
{
|
||||
(void) event;
|
||||
@@ -85,6 +89,11 @@ void theme_runtime_user_set_color (ThemeSemanticToken token, const GdkRGBA *colo
|
||||
(void) color;
|
||||
}
|
||||
|
||||
void theme_runtime_reset_mode_colors (gboolean dark_mode)
|
||||
{
|
||||
(void) dark_mode;
|
||||
}
|
||||
|
||||
gboolean theme_runtime_apply_mode (unsigned int mode, gboolean *dark_active)
|
||||
{
|
||||
(void) mode;
|
||||
@@ -135,6 +144,12 @@ void theme_get_widget_style_values (ThemeWidgetStyleValues *out_values)
|
||||
gdk_rgba_parse (&out_values->foreground, "#f0f0f0");
|
||||
}
|
||||
|
||||
void theme_get_widget_style_values_for_widget (GtkWidget *widget, ThemeWidgetStyleValues *out_values)
|
||||
{
|
||||
(void) widget;
|
||||
theme_get_widget_style_values (out_values);
|
||||
}
|
||||
|
||||
void fe_win32_apply_native_titlebar (GtkWidget *window, gboolean dark)
|
||||
{
|
||||
(void) window;
|
||||
@@ -167,6 +182,8 @@ reset_state (void)
|
||||
listener_calls = 0;
|
||||
idle_add_calls = 0;
|
||||
next_idle_source_id = 33;
|
||||
prefs.hex_gui_gtk3_variant = THEME_GTK3_VARIANT_FOLLOW_SYSTEM;
|
||||
test_theme_gtk3_stub_reset ();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -187,6 +204,7 @@ test_auto_refresh_dispatches_mode_palette_and_style_reasons (void)
|
||||
g_assert_cmpint (auto_state_calls, ==, 2);
|
||||
g_assert_true (last_auto_state);
|
||||
g_assert_cmpint (listener_calls, ==, 1);
|
||||
g_assert_cmpint (test_theme_gtk3_stub_apply_current_calls (), ==, 1);
|
||||
g_assert_true (theme_changed_event_has_reason (&last_event, THEME_CHANGED_REASON_PALETTE));
|
||||
g_assert_true (theme_changed_event_has_reason (&last_event, THEME_CHANGED_REASON_WIDGET_STYLE));
|
||||
g_assert_true (theme_changed_event_has_reason (&last_event, THEME_CHANGED_REASON_USERLIST));
|
||||
@@ -212,6 +230,29 @@ test_auto_refresh_ignores_non_auto_mode (void)
|
||||
g_assert_cmpint (idle_add_calls, ==, 1);
|
||||
g_assert_cmpint (auto_state_calls, ==, 0);
|
||||
g_assert_cmpint (listener_calls, ==, 0);
|
||||
g_assert_cmpint (test_theme_gtk3_stub_apply_current_calls (), ==, 0);
|
||||
|
||||
theme_manager_set_idle_add_func (NULL);
|
||||
theme_listener_unregister (listener_id);
|
||||
}
|
||||
|
||||
static void
|
||||
test_auto_refresh_reapplies_gtk3_for_follow_system_variant (void)
|
||||
{
|
||||
guint listener_id;
|
||||
|
||||
reset_state ();
|
||||
prefs.hex_gui_dark_mode = ZOITECHAT_DARK_MODE_DARK;
|
||||
prefs.hex_gui_gtk3_variant = THEME_GTK3_VARIANT_FOLLOW_SYSTEM;
|
||||
listener_id = theme_listener_register ("auto.gtk3", auto_listener, NULL);
|
||||
theme_manager_set_idle_add_func (immediate_idle_add);
|
||||
|
||||
theme_manager_refresh_auto_mode ();
|
||||
|
||||
g_assert_cmpint (idle_add_calls, ==, 1);
|
||||
g_assert_cmpint (auto_state_calls, ==, 0);
|
||||
g_assert_cmpint (listener_calls, ==, 0);
|
||||
g_assert_cmpint (test_theme_gtk3_stub_apply_current_calls (), ==, 1);
|
||||
|
||||
theme_manager_set_idle_add_func (NULL);
|
||||
theme_listener_unregister (listener_id);
|
||||
@@ -225,5 +266,7 @@ main (int argc, char **argv)
|
||||
test_auto_refresh_dispatches_mode_palette_and_style_reasons);
|
||||
g_test_add_func ("/theme/manager/auto_refresh_ignores_non_auto_mode",
|
||||
test_auto_refresh_ignores_non_auto_mode);
|
||||
g_test_add_func ("/theme/manager/auto_refresh_reapplies_gtk3_for_follow_system_variant",
|
||||
test_auto_refresh_reapplies_gtk3_for_follow_system_variant);
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user