mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Updated RGB16 palette parsing to use 16-bit RGBA strings with gdk_rgba_parse for GTK3 builds.
Parsed palette colors before initializing the GTK3 color chooser dialog to ensure RGBA normalization. Switched GTK3 GtkCellRendererText foreground bindings to foreground-rgba with GTK2 fallbacks in user list, notify, and DCC views.
This commit is contained in:
@@ -735,9 +735,15 @@ dcc_add_column (GtkWidget *tree, int textcol, int colorcol, char *title, gboolea
|
|||||||
renderer = gtk_cell_renderer_text_new ();
|
renderer = gtk_cell_renderer_text_new ();
|
||||||
if (right_justified)
|
if (right_justified)
|
||||||
g_object_set (G_OBJECT (renderer), "xalign", (float) 1.0, NULL);
|
g_object_set (G_OBJECT (renderer), "xalign", (float) 1.0, NULL);
|
||||||
|
#if GTK_CHECK_VERSION(3,0,0)
|
||||||
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1, title, renderer,
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1, title, renderer,
|
||||||
"text", textcol, PALETTE_FOREGROUND_PROPERTY, colorcol,
|
"text", textcol, "foreground-rgba", colorcol,
|
||||||
NULL);
|
NULL);
|
||||||
|
#else
|
||||||
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1, title, renderer,
|
||||||
|
"text", textcol, "foreground-gdk", colorcol,
|
||||||
|
NULL);
|
||||||
|
#endif
|
||||||
gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1);
|
gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,11 @@ notify_treecell_property_mapper (GtkTreeViewColumn *col, GtkCellRenderer *cell,
|
|||||||
COLOUR_COLUMN, &colour,
|
COLOUR_COLUMN, &colour,
|
||||||
model_column, &text, -1);
|
model_column, &text, -1);
|
||||||
g_object_set (G_OBJECT (cell), "text", text, NULL);
|
g_object_set (G_OBJECT (cell), "text", text, NULL);
|
||||||
g_object_set (G_OBJECT (cell), PALETTE_FOREGROUND_PROPERTY, colour, NULL);
|
#if GTK_CHECK_VERSION(3,0,0)
|
||||||
|
g_object_set (G_OBJECT (cell), "foreground-rgba", colour, NULL);
|
||||||
|
#else
|
||||||
|
g_object_set (G_OBJECT (cell), "foreground-gdk", colour, NULL);
|
||||||
|
#endif
|
||||||
g_free (text);
|
g_free (text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ palette_color_set_rgb16 (PaletteColor *color, guint16 red, guint16 green, guint1
|
|||||||
gboolean parsed_ok;
|
gboolean parsed_ok;
|
||||||
char *color_string;
|
char *color_string;
|
||||||
|
|
||||||
color_string = g_strdup_printf ("#%02x%02x%02x", red >> 8, green >> 8, blue >> 8);
|
color_string = g_strdup_printf ("#%04x%04x%04x", red, green, blue);
|
||||||
parsed_ok = gdk_rgba_parse (&parsed, color_string);
|
parsed_ok = gdk_rgba_parse (&parsed, color_string);
|
||||||
g_free (color_string);
|
g_free (color_string);
|
||||||
if (!parsed_ok)
|
if (!parsed_ok)
|
||||||
|
|||||||
@@ -1595,12 +1595,18 @@ setup_color_cb (GtkWidget *button, gpointer userdata)
|
|||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
PaletteColor *color;
|
PaletteColor *color;
|
||||||
GdkRGBA rgba;
|
GdkRGBA rgba;
|
||||||
|
gboolean parsed_ok;
|
||||||
|
char *color_string;
|
||||||
setup_color_dialog_data *data;
|
setup_color_dialog_data *data;
|
||||||
|
|
||||||
color = &colors[GPOINTER_TO_INT (userdata)];
|
color = &colors[GPOINTER_TO_INT (userdata)];
|
||||||
|
|
||||||
dialog = gtk_color_chooser_dialog_new (_("Select color"), GTK_WINDOW (setup_window));
|
dialog = gtk_color_chooser_dialog_new (_("Select color"), GTK_WINDOW (setup_window));
|
||||||
rgba = *color;
|
color_string = gdk_rgba_to_string (color);
|
||||||
|
parsed_ok = gdk_rgba_parse (&rgba, color_string);
|
||||||
|
g_free (color_string);
|
||||||
|
if (!parsed_ok)
|
||||||
|
rgba = *color;
|
||||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog), &rgba);
|
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog), &rgba);
|
||||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||||
|
|
||||||
|
|||||||
@@ -547,9 +547,15 @@ userlist_add_columns (GtkTreeView * treeview)
|
|||||||
if (prefs.hex_gui_compact)
|
if (prefs.hex_gui_compact)
|
||||||
g_object_set (G_OBJECT (renderer), "ypad", 0, NULL);
|
g_object_set (G_OBJECT (renderer), "ypad", 0, NULL);
|
||||||
gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1);
|
gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1);
|
||||||
|
#if GTK_CHECK_VERSION(3,0,0)
|
||||||
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
|
||||||
-1, NULL, renderer,
|
-1, NULL, renderer,
|
||||||
"text", 1, PALETTE_FOREGROUND_PROPERTY, 4, NULL);
|
"text", 1, "foreground-rgba", 4, NULL);
|
||||||
|
#else
|
||||||
|
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
|
||||||
|
-1, NULL, renderer,
|
||||||
|
"text", 1, "foreground-gdk", 4, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (prefs.hex_gui_ulist_show_hosts)
|
if (prefs.hex_gui_ulist_show_hosts)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user