[gtk/message-dialog-title: 222/222] message dialog: Stop hardcoding title styles



commit 1e3ec7c1f993ec8cab4c6608b968e78f9028d662
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri May 31 12:10:02 2019 +0000

    message dialog: Stop hardcoding title styles
    
    Instead, use a new title style class to let
    themes influence title formatting. Note that
    the theme style will be overridden if the
    application uses markup for presentation,
    such as <b> or <i>.

 gtk/gtkmessagedialog.c         | 37 -------------------------------------
 gtk/theme/Adwaita/_common.scss |  5 +++++
 gtk/ui/gtkmessagedialog.ui     |  3 +++
 3 files changed, 8 insertions(+), 37 deletions(-)
---
diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c
index 52d40a784c..a74e00123c 100644
--- a/gtk/gtkmessagedialog.c
+++ b/gtk/gtkmessagedialog.c
@@ -292,37 +292,6 @@ gtk_message_dialog_init (GtkMessageDialog *dialog)
   gtk_label_set_selectable (GTK_LABEL (priv->secondary_label), use_caret);
 }
 
-static void
-setup_primary_label_font (GtkMessageDialog *dialog)
-{
-  GtkMessageDialogPrivate *priv = gtk_message_dialog_get_instance_private (dialog);
-
-  if (!priv->has_primary_markup)
-    {
-      PangoAttrList *attributes;
-      PangoAttribute *attr;
-
-      attributes = pango_attr_list_new ();
-
-      attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
-      pango_attr_list_insert (attributes, attr);
-
-      if (priv->has_secondary_text)
-        {
-          attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
-          pango_attr_list_insert (attributes, attr);
-        }
-
-      gtk_label_set_attributes (GTK_LABEL (priv->label), attributes);
-      pango_attr_list_unref (attributes);
-    }
-  else
-    {
-      /* unset the font settings */
-      gtk_label_set_attributes (GTK_LABEL (priv->label), NULL);
-    }
-}
-
 static void
 setup_type (GtkMessageDialog *dialog,
            GtkMessageType    type)
@@ -451,7 +420,6 @@ gtk_message_dialog_set_property (GObject      *object,
           gtk_label_set_use_markup (GTK_LABEL (priv->label), priv->has_primary_markup);
           g_object_notify_by_pspec (object, pspec);
         }
-        setup_primary_label_font (dialog);
       break;
     case PROP_SECONDARY_TEXT:
       {
@@ -472,7 +440,6 @@ gtk_message_dialog_set_property (GObject      *object,
            priv->has_secondary_text = FALSE;
            gtk_widget_hide (priv->secondary_label);
          }
-       setup_primary_label_font (dialog);
       }
       break;
     case PROP_SECONDARY_USE_MARKUP:
@@ -719,8 +686,6 @@ gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
       priv->has_secondary_text = FALSE;
       gtk_widget_hide (priv->secondary_label);
     }
-
-  setup_primary_label_font (message_dialog);
 }
 
 /**
@@ -777,8 +742,6 @@ gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
       priv->has_secondary_text = FALSE;
       gtk_widget_hide (priv->secondary_label);
     }
-
-  setup_primary_label_font (message_dialog);
 }
 
 /**
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index 1f6398dbc1..8bb956bd05 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -3822,6 +3822,11 @@ messagedialog { // Message Dialog styling
     border-spacing: 10px;
   }
 
+  & label.title {
+    font-weight: 800;
+    font-size: 15pt;
+  }
+
   &.csd { // rounded bottom border styling for csd version
     &.background {
       // bigger radius for better antialiasing
diff --git a/gtk/ui/gtkmessagedialog.ui b/gtk/ui/gtkmessagedialog.ui
index 128136bc95..52484587df 100644
--- a/gtk/ui/gtkmessagedialog.ui
+++ b/gtk/ui/gtkmessagedialog.ui
@@ -27,6 +27,9 @@
                     <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]