Compare commits

...

1 Commits

Author SHA1 Message Date
Matthias Clasen
e5a5b14aa3 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>.
2019-05-31 13:27:51 +00:00
2 changed files with 3 additions and 37 deletions

View File

@@ -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);
}
/**

View File

@@ -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>