From f1b385d81a4b6fd6857165f47d4824c862394d74 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 24 May 2021 03:12:35 +0300 Subject: [PATCH 26/44] gtk3.22/gtk4: Make tab notice color different from alert color Reported by pjlsergeant See osdn #42295 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.22/gui_stuff.c | 17 ++++++++++++----- client/gui-gtk-4.0/gui_stuff.c | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/client/gui-gtk-3.22/gui_stuff.c b/client/gui-gtk-3.22/gui_stuff.c index 71b04cda96..cf9f38fedf 100644 --- a/client/gui-gtk-3.22/gui_stuff.c +++ b/client/gui-gtk-3.22/gui_stuff.c @@ -434,8 +434,10 @@ static void gui_dialog_switch_page_handler(GtkNotebook *notebook, n = gtk_notebook_page_num(GTK_NOTEBOOK(dlg->v.tab.notebook), dlg->vbox); if (n == num) { - gtk_style_context_remove_class(gtk_widget_get_style_context(dlg->v.tab.label), - "alert"); + GtkStyleContext *context = gtk_widget_get_style_context(dlg->v.tab.label); + + gtk_style_context_remove_class(context, "alert"); + gtk_style_context_remove_class(context, "notice"); } } @@ -846,7 +848,7 @@ void gui_dialog_present(struct gui_dialog *dlg) GtkWidget *label = dlg->v.tab.label; gtk_style_context_add_class(gtk_widget_get_style_context(label), - "alert"); + "notice"); } } break; @@ -896,9 +898,11 @@ void gui_dialog_alert(struct gui_dialog *dlg) if (current != n) { GtkWidget *label = dlg->v.tab.label; + GtkStyleContext *context = gtk_widget_get_style_context(label); - gtk_style_context_add_class(gtk_widget_get_style_context(label), - "alert"); + /* Have only alert - remove notice if it exist. */ + gtk_style_context_remove_class(context, "notice"); + gtk_style_context_add_class(context, "alert"); } } break; @@ -1146,6 +1150,9 @@ void dlg_tab_provider_prepare(void) gtk_css_provider_load_from_data(dlg_tab_provider, ".alert {\n" "color: rgba(255, 0, 0, 255);\n" + "}\n" + ".notice {\n" + "color: rgba(0, 0, 255, 255);\n" "}\n", -1, NULL); } diff --git a/client/gui-gtk-4.0/gui_stuff.c b/client/gui-gtk-4.0/gui_stuff.c index 142be0e901..09757572ce 100644 --- a/client/gui-gtk-4.0/gui_stuff.c +++ b/client/gui-gtk-4.0/gui_stuff.c @@ -427,8 +427,10 @@ static void gui_dialog_switch_page_handler(GtkNotebook *notebook, n = gtk_notebook_page_num(GTK_NOTEBOOK(dlg->v.tab.notebook), dlg->vbox); if (n == num) { - gtk_style_context_remove_class(gtk_widget_get_style_context(dlg->v.tab.label), - "alert"); + GtkStyleContext *context = gtk_widget_get_style_context(dlg->v.tab.label); + + gtk_style_context_remove_class(context, "alert"); + gtk_style_context_remove_class(context, "notice"); } } @@ -815,7 +817,7 @@ void gui_dialog_present(struct gui_dialog *dlg) GtkWidget *label = dlg->v.tab.label; gtk_style_context_add_class(gtk_widget_get_style_context(label), - "alert"); + "notice"); } } break; @@ -865,9 +867,11 @@ void gui_dialog_alert(struct gui_dialog *dlg) if (current != n) { GtkWidget *label = dlg->v.tab.label; + GtkStyleContext *context = gtk_widget_get_style_context(label); - gtk_style_context_add_class(gtk_widget_get_style_context(label), - "alert"); + /* Have only alert - remove notice if it exist. */ + gtk_style_context_remove_class(context, "notice"); + gtk_style_context_add_class(context, "alert"); } } break; @@ -1115,6 +1119,9 @@ void dlg_tab_provider_prepare(void) gtk_css_provider_load_from_data(dlg_tab_provider, ".alert {\n" "color: rgba(255, 0, 0, 255);\n" + "}\n" + ".notice {\n" + "color: rgba(0, 0, 255, 255);\n" "}\n", -1); } -- 2.30.2