[gtk/mcatanzaro/#3509] message dialog: use title style only if there is secondary text
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/mcatanzaro/#3509] message dialog: use title style only if there is secondary text
- Date: Tue, 29 Dec 2020 17:13:57 +0000 (UTC)
commit c0f596866a5eb795a05ea10ba0de0d051873d02a
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Tue Dec 29 11:12:59 2020 -0600
message dialog: use title style only if there is secondary text
If there is no secondary text, then the primary text is just a message,
not a title, and should not use title style.
Fixes #3509
gtk/gtkmessagedialog.c | 6 ++++++
gtk/ui/gtkmessagedialog.ui | 3 ---
2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c
index c28f275b3a..171554d8cc 100644
--- a/gtk/gtkmessagedialog.c
+++ b/gtk/gtkmessagedialog.c
@@ -383,11 +383,13 @@ gtk_message_dialog_set_property (GObject *object,
if (txt)
{
priv->has_secondary_text = TRUE;
+ gtk_widget_add_css_class (priv->label, "title");
gtk_widget_show (priv->secondary_label);
}
else
{
priv->has_secondary_text = FALSE;
+ gtk_widget_remove_css_class (priv->label, "title");
gtk_widget_hide (priv->secondary_label);
}
}
@@ -621,6 +623,7 @@ gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
if (message_format)
{
priv->has_secondary_text = TRUE;
+ gtk_widget_add_css_class (priv->label, "title");
va_start (args, message_format);
msg = g_strdup_vprintf (message_format, args);
@@ -634,6 +637,7 @@ gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
else
{
priv->has_secondary_text = FALSE;
+ gtk_widget_remove_css_class (priv->label, "title");
gtk_widget_hide (priv->secondary_label);
}
}
@@ -677,6 +681,7 @@ gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
if (message_format)
{
priv->has_secondary_text = TRUE;
+ gtk_widget_add_css_class (priv->label, "title");
va_start (args, message_format);
msg = g_strdup_vprintf (message_format, args);
@@ -690,6 +695,7 @@ gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
else
{
priv->has_secondary_text = FALSE;
+ gtk_widget_remove_css_class (priv->label, "title");
gtk_widget_hide (priv->secondary_label);
}
}
diff --git a/gtk/ui/gtkmessagedialog.ui b/gtk/ui/gtkmessagedialog.ui
index c7e29be04d..42c6528b4a 100644
--- a/gtk/ui/gtkmessagedialog.ui
+++ b/gtk/ui/gtkmessagedialog.ui
@@ -28,9 +28,6 @@
<property name="valign">start</property>
<property name="wrap">1</property>
<property name="max-width-chars">60</property>
- <style>
- <class name="title"/>
- </style>
</object>
</child>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]