[gnome-initial-setup/8-nicer-final-page] Adjust page title fonts
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/8-nicer-final-page] Adjust page title fonts
- Date: Sun, 26 Jan 2020 20:44:31 +0000 (UTC)
commit 37178dec0dae48f793f5899d967c9c347cac1b85
Author: Will Thompson <will willthompson co uk>
Date: Mon Jan 20 21:18:36 2020 +0000
Adjust page title fonts
As [suggested by Jakub Steiner][0], the final page uses a larger,
lighter style, and other pages' titles use a heavier, smaller style.
[0]: https://gitlab.gnome.org/GNOME/gnome-initial-setup/merge_requests/70#note_690706
gnome-initial-setup/gis-assistant.gresource.xml | 1 +
gnome-initial-setup/gis-page-header.c | 6 ++++++
gnome-initial-setup/gis-page-header.css | 13 +++++++++++++
gnome-initial-setup/gis-page-header.ui | 7 +++----
gnome-initial-setup/pages/language/gis-welcome-widget.c | 11 ++---------
gnome-initial-setup/pages/summary/gis-summary-page.ui | 7 +++----
6 files changed, 28 insertions(+), 17 deletions(-)
---
diff --git a/gnome-initial-setup/gis-assistant.gresource.xml b/gnome-initial-setup/gis-assistant.gresource.xml
index 59102c5..041cfb0 100644
--- a/gnome-initial-setup/gis-assistant.gresource.xml
+++ b/gnome-initial-setup/gis-assistant.gresource.xml
@@ -3,5 +3,6 @@
<gresource prefix="/org/gnome/initial-setup">
<file preprocess="xml-stripblanks">gis-assistant.ui</file>
<file preprocess="xml-stripblanks">gis-page-header.ui</file>
+ <file>gis-page-header.css</file>
</gresource>
</gresources>
diff --git a/gnome-initial-setup/gis-page-header.c b/gnome-initial-setup/gis-page-header.c
index 26f3468..0b1a5af 100644
--- a/gnome-initial-setup/gis-page-header.c
+++ b/gnome-initial-setup/gis-page-header.c
@@ -181,4 +181,10 @@ gis_page_header_class_init (GisPageHeaderClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
+
+ g_autoptr(GtkCssProvider) provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_resource (provider, "/org/gnome/initial-setup/gis-page-header.css");
+ gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
diff --git a/gnome-initial-setup/gis-page-header.css b/gnome-initial-setup/gis-page-header.css
new file mode 100644
index 0000000..ce02cc8
--- /dev/null
+++ b/gnome-initial-setup/gis-page-header.css
@@ -0,0 +1,13 @@
+/* Styles borrowed from GTK 4
+ *
https://gitlab.gnome.org/GNOME/gtk/blob/672d7f679adf543785042ab45d7e59688103464c/gtk/theme/Adwaita/_common.scss#L287-327
+ */
+.large-title {
+ font-weight: 300;
+ font-size: 24pt;
+ letter-spacing: 0.2rem;
+}
+
+.title-1 {
+ font-weight: 800;
+ font-size: 20pt;
+}
diff --git a/gnome-initial-setup/gis-page-header.ui b/gnome-initial-setup/gis-page-header.ui
index 905bec6..e5e1795 100644
--- a/gnome-initial-setup/gis-page-header.ui
+++ b/gnome-initial-setup/gis-page-header.ui
@@ -23,10 +23,9 @@
<property name="justify">center</property>
<property name="max_width_chars">65</property>
<property name="wrap">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.8"/>
- </attributes>
+ <style>
+ <class name="title-1"/>
+ </style>
</object>
</child>
<child>
diff --git a/gnome-initial-setup/pages/language/gis-welcome-widget.c
b/gnome-initial-setup/pages/language/gis-welcome-widget.c
index 39ad583..7f030bd 100644
--- a/gnome-initial-setup/pages/language/gis-welcome-widget.c
+++ b/gnome-initial-setup/pages/language/gis-welcome-widget.c
@@ -144,16 +144,9 @@ welcome (const char *locale_id)
static GtkWidget *
big_label (const char *text)
{
- GtkWidget *label;
- PangoAttrList *attrs;
-
- label = gtk_label_new (text);
+ GtkWidget *label = gtk_label_new (text);
- attrs = pango_attr_list_new ();
- pango_attr_list_insert (attrs, pango_attr_scale_new (2));
- pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
- gtk_label_set_attributes (GTK_LABEL (label), attrs);
- pango_attr_list_unref (attrs);
+ gtk_style_context_add_class (gtk_widget_get_style_context (label), "title-1");
return label;
}
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.ui
b/gnome-initial-setup/pages/summary/gis-summary-page.ui
index ab6f850..9f9c5eb 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.ui
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.ui
@@ -69,10 +69,9 @@
<property name="justify">center</property>
<property name="label" translatable="yes">All done!</property>
<property name="wrap">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.8"/>
- </attributes>
+ <style>
+ <class name="large-title"/>
+ </style>
</object>
<packing>
<property name="pack_type">end</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]