[gtk/message-dialog-title-for-3] message dialog: Stop hardcoding title styles
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/message-dialog-title-for-3] message dialog: Stop hardcoding title styles
- Date: Fri, 31 May 2019 13:29:33 +0000 (UTC)
commit e5a5b14aa37aae0fc957068e803a946335b1b21a
Author: Matthias Clasen <mclasen redhat com>
Date: Fri May 31 13:27:51 2019 +0000
message dialog: Stop hardcoding title styles
Instead, use a new title-2 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/ui/gtkmessagedialog.ui | 3 +++
2 files changed, 3 insertions(+), 37 deletions(-)
---
diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c
index e70c82056c..08bc981ec6 100644
--- a/gtk/gtkmessagedialog.c
+++ b/gtk/gtkmessagedialog.c
@@ -335,37 +335,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
gtk_label_set_selectable (GTK_LABEL (priv->secondary_label), use_caret);
}
-static void
-setup_primary_label_font (GtkMessageDialog *dialog)
-{
- GtkMessageDialogPrivate *priv = dialog->priv;
-
- 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)
@@ -492,7 +461,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:
{
@@ -513,7 +481,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:
@@ -838,8 +805,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);
}
/**
@@ -900,8 +865,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/ui/gtkmessagedialog.ui b/gtk/ui/gtkmessagedialog.ui
index bc3532f46c..bce48b2f00 100644
--- a/gtk/ui/gtkmessagedialog.ui
+++ b/gtk/ui/gtkmessagedialog.ui
@@ -34,6 +34,9 @@
<property name="valign">start</property>
<property name="wrap">1</property>
<property name="max-width-chars">60</property>
+ <style>
+ <class name="title-2"/>
+ </style>
</object>
<packing>
<property name="fill">0</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]