mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 16:00:18 +00:00
Switched palette type selection and color conversion helpers to use the HAVE_GTK3 guard consistently in palette definitions and helpers.
Updated GTK3-specific palette color storage handling in DCC, notify, and user list views to align with HAVE_GTK3 guards. Standardized setup color application and dialog logic to use HAVE_GTK3 branches for GTK3/GTK2 separation.
This commit is contained in:
@@ -192,7 +192,7 @@ dcc_store_color (GtkListStore *store, GtkTreeIter *iter, int column, int color_i
|
||||
if (color_index != 1)
|
||||
color = &colors[color_index];
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
if (color)
|
||||
{
|
||||
GdkRGBA rgba = *color;
|
||||
|
||||
@@ -91,7 +91,7 @@ notify_treecell_property_mapper (GtkTreeViewColumn *col, GtkCellRenderer *cell,
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (model), iter,
|
||||
COLOUR_COLUMN, &colour,
|
||||
model_column, &text, -1);
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
g_object_set (G_OBJECT (cell), "text", text,
|
||||
PALETTE_FOREGROUND_PROPERTY, colour, NULL);
|
||||
if (colour)
|
||||
@@ -108,7 +108,7 @@ notify_treecell_property_mapper (GtkTreeViewColumn *col, GtkCellRenderer *cell,
|
||||
static void
|
||||
notify_store_color (GtkListStore *store, GtkTreeIter *iter, const PaletteColor *color)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
if (color)
|
||||
{
|
||||
GdkRGBA rgba = *color;
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "../common/cfgfiles.h"
|
||||
#include "../common/typedef.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
#define PALETTE_COLOR_INIT(r, g, b) { (r) / 65535.0, (g) / 65535.0, (b) / 65535.0, 1.0 }
|
||||
#else
|
||||
#define PALETTE_COLOR_INIT(r, g, b) { 0, (r), (g), (b) }
|
||||
@@ -47,7 +47,7 @@
|
||||
static void
|
||||
palette_color_set_rgb16 (PaletteColor *color, guint16 red, guint16 green, guint16 blue)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
char color_string[16];
|
||||
GdkRGBA parsed = { 0 };
|
||||
gboolean parsed_ok;
|
||||
@@ -82,7 +82,7 @@ palette_color_from_gdk (const PaletteColor *color)
|
||||
{
|
||||
XTextColor result;
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
result.red = color->red;
|
||||
result.green = color->green;
|
||||
result.blue = color->blue;
|
||||
@@ -227,7 +227,7 @@ palette_user_set_color (int idx, const PaletteColor *col)
|
||||
user_colors_valid = TRUE;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
user_colors[idx] = *col;
|
||||
#else
|
||||
user_colors[idx].red = col->red;
|
||||
@@ -252,7 +252,7 @@ palette_dark_set_color (int idx, const PaletteColor *col)
|
||||
dark_user_colors_valid = TRUE;
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
dark_user_colors[idx] = *col;
|
||||
#else
|
||||
dark_user_colors[idx].red = col->red;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "xtext-color.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
typedef GdkRGBA PaletteColor;
|
||||
#define PALETTE_GDK_TYPE GDK_TYPE_RGBA
|
||||
#define PALETTE_FOREGROUND_PROPERTY "foreground-rgba"
|
||||
@@ -39,7 +39,7 @@ extern PaletteColor colors[];
|
||||
static inline void
|
||||
palette_color_get_rgb16 (const PaletteColor *color, guint16 *red, guint16 *green, guint16 *blue)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
*red = (guint16) CLAMP (color->red * 65535.0 + 0.5, 0.0, 65535.0);
|
||||
*green = (guint16) CLAMP (color->green * 65535.0 + 0.5, 0.0, 65535.0);
|
||||
*blue = (guint16) CLAMP (color->blue * 65535.0 + 0.5, 0.0, 65535.0);
|
||||
|
||||
@@ -1692,7 +1692,7 @@ setup_color_button_apply (GtkWidget *button, const PaletteColor *color)
|
||||
{
|
||||
GtkWidget *target = g_object_get_data (G_OBJECT (button), "zoitechat-color-box");
|
||||
GtkWidget *apply_widget = GTK_IS_WIDGET (target) ? target : button;
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
GtkStateFlags states[] = {
|
||||
GTK_STATE_FLAG_NORMAL,
|
||||
GTK_STATE_FLAG_PRELIGHT,
|
||||
@@ -1712,7 +1712,7 @@ setup_color_button_apply (GtkWidget *button, const PaletteColor *color)
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (states); i++)
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_override_background_color (apply_widget, states[i], color);
|
||||
#else
|
||||
gtk_widget_modify_bg (apply_widget, states[i], color);
|
||||
@@ -1720,7 +1720,7 @@ setup_color_button_apply (GtkWidget *button, const PaletteColor *color)
|
||||
|
||||
if (apply_widget != button)
|
||||
for (i = 0; i < G_N_ELEMENTS (states); i++)
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_override_background_color (button, states[i], color);
|
||||
#else
|
||||
gtk_widget_modify_bg (button, states[i], color);
|
||||
@@ -1729,7 +1729,7 @@ setup_color_button_apply (GtkWidget *button, const PaletteColor *color)
|
||||
gtk_widget_queue_draw (button);
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *button;
|
||||
@@ -1812,7 +1812,7 @@ setup_color_ok_cb (GtkWidget *button, GtkWidget *dialog)
|
||||
static void
|
||||
setup_color_cb (GtkWidget *button, gpointer userdata)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
GtkWidget *dialog;
|
||||
PaletteColor *color;
|
||||
GdkRGBA rgba;
|
||||
@@ -2802,7 +2802,7 @@ setup_create_tree (GtkWidget *box, GtkWidget *book)
|
||||
static void
|
||||
setup_apply_entry_style (GtkWidget *entry)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
gtk_widget_override_background_color (entry, GTK_STATE_FLAG_NORMAL, &colors[COL_BG]);
|
||||
gtk_widget_override_color (entry, GTK_STATE_FLAG_NORMAL, &colors[COL_FG]);
|
||||
gtk_widget_override_font (entry, input_style->font_desc);
|
||||
@@ -2828,7 +2828,7 @@ setup_apply_to_sess (session_gui *gui)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
if (prefs.hex_gui_ulist_style || fe_dark_mode_is_enabled ())
|
||||
{
|
||||
gtk_widget_override_background_color (gui->user_tree, GTK_STATE_FLAG_NORMAL, &colors[COL_BG]);
|
||||
|
||||
@@ -473,7 +473,7 @@ userlist_store_color (GtkListStore *store, GtkTreeIter *iter, int color_index)
|
||||
{
|
||||
const PaletteColor *color = color_index ? &colors[color_index] : NULL;
|
||||
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
#if HAVE_GTK3
|
||||
if (color)
|
||||
{
|
||||
GdkRGBA rgba = *color;
|
||||
|
||||
Reference in New Issue
Block a user