summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-05-31 13:27:51 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-05-31 13:27:51 +0000
commite5a5b14aa37aae0fc957068e803a946335b1b21a (patch)
tree4d9b6cb6c8689cf92bfe56c6d7d02808a22f8282
parent689bc42aaffcf278c145f8e7d46ee6b934e6d709 (diff)
downloadgtk+-message-dialog-title-for-3.tar.gz
message dialog: Stop hardcoding title stylesmessage-dialog-title-for-3
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>.
-rw-r--r--gtk/gtkmessagedialog.c37
-rw-r--r--gtk/ui/gtkmessagedialog.ui3
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
@@ -336,37 +336,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
}
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>