Commit e44081e7 authored by Adrien Plazas's avatar Adrien Plazas
Browse files

debian: Add adaptiveness patches

parent 1452ea10
From 49c7284056af57596dca5d388fec3aa407c78d24 Mon Sep 17 00:00:00 2001
From: Adrien Plazas <kekun.plazas@laposte.net>
Date: Tue, 10 Aug 2021 09:21:22 +0200
Subject: [PATCH 01/17] Polish the page sizes
Fixes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1322
---
src/gs-category-page.ui | 5 +++--
src/gs-details-page.ui | 24 ++++++++++++++++++++++++
src/gs-extras-page.ui | 2 ++
src/gs-installed-page.ui | 2 ++
src/gs-loading-page.ui | 2 ++
src/gs-moderate-page.ui | 2 ++
src/gs-overview-page.ui | 1 +
src/gs-search-page.ui | 3 ++-
src/gs-updates-page.ui | 4 ++++
9 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/src/gs-category-page.ui b/src/gs-category-page.ui
index d46befaf..13e90a35 100644
--- a/src/gs-category-page.ui
+++ b/src/gs-category-page.ui
@@ -15,8 +15,9 @@
<child>
<object class="HdyClamp">
<property name="visible">True</property>
- <!-- This is 3*420 plus margins, paddings, CSS borders -->
- <property name="maximum-size">1338</property>
+ <!-- We use the same sizes as the overview page. -->
+ <property name="maximum-size">1000</property>
+ <property name="tightening-threshold">600</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
diff --git a/src/gs-details-page.ui b/src/gs-details-page.ui
index 6d85cb34..d087bc31 100644
--- a/src/gs-details-page.ui
+++ b/src/gs-details-page.ui
@@ -73,6 +73,8 @@
<object class="HdyClamp">
<property name="visible">True</property>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
@@ -345,6 +347,8 @@
<object class="HdyClamp">
<property name="visible">True</property>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
@@ -387,6 +391,8 @@
<object class="HdyClamp">
<property name="visible">True</property>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
@@ -443,6 +449,8 @@
<object class="HdyClamp">
<property name="visible">True</property>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
@@ -457,6 +465,8 @@
<object class="HdyClamp">
<property name="visible">True</property>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
@@ -511,6 +521,8 @@
<object class="HdyClamp">
<property name="visible" bind-source="label_webapp_warning" bind-property="visible" bind-flags="sync-create"/>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
@@ -533,6 +545,8 @@
<object class="HdyClamp">
<property name="visible" bind-source="infobar_details_app_repo" bind-property="visible" bind-flags="sync-create"/>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
@@ -550,6 +564,8 @@
<object class="HdyClamp">
<property name="visible" bind-source="infobar_details_app_norepo" bind-property="visible" bind-flags="sync-create"/>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
@@ -567,6 +583,8 @@
<object class="HdyClamp">
<property name="visible" bind-source="infobar_details_package_baseos" bind-property="visible" bind-flags="sync-create"/>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
@@ -584,6 +602,8 @@
<object class="HdyClamp">
<property name="visible" bind-source="infobar_details_repo" bind-property="visible" bind-flags="sync-create"/>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
@@ -602,6 +622,8 @@
<object class="HdyClamp">
<property name="visible">True</property>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
@@ -833,6 +855,8 @@
<object class="HdyClamp">
<property name="visible" bind-source="box_reviews" bind-property="visible" bind-flags="sync-create"/>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
diff --git a/src/gs-extras-page.ui b/src/gs-extras-page.ui
index 0ade17eb..3d9ada3e 100644
--- a/src/gs-extras-page.ui
+++ b/src/gs-extras-page.ui
@@ -49,6 +49,8 @@
<object class="HdyClamp">
<property name="visible">True</property>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<child>
<object class="GtkBox" id="box_results">
<property name="visible">True</property>
diff --git a/src/gs-installed-page.ui b/src/gs-installed-page.ui
index e46d0b1b..7a1ea935 100644
--- a/src/gs-installed-page.ui
+++ b/src/gs-installed-page.ui
@@ -42,6 +42,8 @@
<child>
<object class="HdyClamp">
<property name="visible">True</property>
+ <property name="maximum-size">600</property>
+ <property name="tightening-threshold">400</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
diff --git a/src/gs-loading-page.ui b/src/gs-loading-page.ui
index e68969f0..bd95ad90 100644
--- a/src/gs-loading-page.ui
+++ b/src/gs-loading-page.ui
@@ -15,6 +15,8 @@
<child>
<object class="HdyClamp">
<property name="visible">True</property>
+ <!-- We explicitely want to use the default HdyClamp sizes here, as
+ does HdyStatusPage. -->
<child>
<object class="GtkProgressBar" id="progressbar">
<property name="visible">True</property>
diff --git a/src/gs-moderate-page.ui b/src/gs-moderate-page.ui
index 78401811..65b81c1e 100644
--- a/src/gs-moderate-page.ui
+++ b/src/gs-moderate-page.ui
@@ -40,6 +40,8 @@
<object class="HdyClamp">
<property name="visible">True</property>
<property name="maximum-size">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<child>
<object class="GtkListBox" id="list_box_install">
<property name="visible">True</property>
diff --git a/src/gs-overview-page.ui b/src/gs-overview-page.ui
index 550010b2..95dc908b 100644
--- a/src/gs-overview-page.ui
+++ b/src/gs-overview-page.ui
@@ -73,6 +73,7 @@
<child>
<object class="HdyClamp">
<property name="visible">True</property>
+ <!-- We use the same sizes as the category page. -->
<property name="maximum-size">1000</property>
<property name="tightening-threshold">600</property>
<child>
diff --git a/src/gs-search-page.ui b/src/gs-search-page.ui
index e0f04824..3fbeebe3 100644
--- a/src/gs-search-page.ui
+++ b/src/gs-search-page.ui
@@ -56,7 +56,8 @@
<object class="HdyClamp">
<property name="visible">True</property>
<property name="maximum-size">860</property>
- <property name="tightening-threshold">860</property>
+ <!-- ~⅔ of the maximum size. -->
+ <property name="tightening-threshold">576</property>
<child>
<object class="GtkListBox" id="list_box_search">
<property name="visible">True</property>
diff --git a/src/gs-updates-page.ui b/src/gs-updates-page.ui
index 993b6ef3..72980349 100644
--- a/src/gs-updates-page.ui
+++ b/src/gs-updates-page.ui
@@ -69,6 +69,8 @@
<object class="HdyClamp">
<property name="visible">True</property>
<property name="valign">center</property>
+ <!-- We explicitely want to use the default HdyClamp sizes here,
+ as does HdyStatusPage. -->
<style>
<class name="status-page"/>
</style>
@@ -132,6 +134,8 @@
<child>
<object class="HdyClamp">
<property name="visible">True</property>
+ <property name="maximum-size">600</property>
+ <property name="tightening-threshold">400</property>
<child>
<object class="GtkBox" id="list_box_updates_box">
<property name="visible">True</property>
--
2.30.2
From d9eac958f5c1ec0c864b758c22a2850352d7a077 Mon Sep 17 00:00:00 2001
From: Adrien Plazas <kekun.plazas@laposte.net>
Date: Tue, 10 Aug 2021 14:46:16 +0200
Subject: [PATCH 02/17] shell: Set a minimum width of 360px
We don't need to go below.
---
src/gs-shell.ui | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/gs-shell.ui b/src/gs-shell.ui
index ca56ac1d..6b9b1d75 100644
--- a/src/gs-shell.ui
+++ b/src/gs-shell.ui
@@ -30,6 +30,7 @@
<object class="GtkStack" id="stack_loading">
<property name="visible">True</property>
<property name="transition-type">crossfade</property>
+ <property name="width-request">360</property>
<signal name="notify::visible-child" handler="stack_notify_visible_child_cb"/>
<child>
<object class="GtkOverlay" id="overlay">
--
2.30.2
From 57b70ab14fec96d256c98063f7cbe34a53998c8a Mon Sep 17 00:00:00 2001
From: Adrien Plazas <kekun.plazas@laposte.net>
Date: Wed, 11 Aug 2021 14:34:49 +0200
Subject: [PATCH 03/17] shell: Add the .narrow style class when narrow
This will help changing the syle when the window is narrow.
---
src/gs-shell.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/gs-shell.c b/src/gs-shell.c
index dd859984..5038e88d 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -2480,6 +2480,7 @@ allocation_changed_cb (gpointer user_data)
GsShell *shell = GS_SHELL (user_data);
GtkAllocation allocation;
gboolean is_narrow;
+ GtkStyleContext *context;
gtk_widget_get_allocation (GTK_WIDGET (shell), &allocation);
@@ -2492,6 +2493,13 @@ allocation_changed_cb (gpointer user_data)
shell->allocation_changed_cb_id = 0;
+ context = gtk_widget_get_style_context (GTK_WIDGET (shell));
+
+ if (is_narrow)
+ gtk_style_context_add_class (context, "narrow");
+ else
+ gtk_style_context_remove_class (context, "narrow");
+
return G_SOURCE_REMOVE;
}
--
2.30.2
From d1f15e64d02e3d69f5148913db2be5844c3a52a7 Mon Sep 17 00:00:00 2001
From: Adrien Plazas <kekun.plazas@laposte.net>
Date: Tue, 10 Aug 2021 14:00:49 +0200
Subject: [PATCH 04/17] description-box: Drop the forced width in chars
This allows the box to fit on small form factors without changing its
visible behavior.
---
src/gs-description-box.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/gs-description-box.c b/src/gs-description-box.c
index 77e2d749..1e278faa 100644
--- a/src/gs-description-box.c
+++ b/src/gs-description-box.c
@@ -151,7 +151,6 @@ gs_description_box_init (GsDescriptionBox *box)
"visible", TRUE,
"can-focus", FALSE,
"max-width-chars", 40,
- "width-chars", 40,
"selectable", TRUE,
"wrap", TRUE,
"xalign", 0.0,
--
2.30.2
From 757303efb3ec1954c2daaa32b8e370a552dc8f0a Mon Sep 17 00:00:00 2001
From: Adrien Plazas <kekun.plazas@laposte.net>
Date: Tue, 10 Aug 2021 12:02:07 +0200
Subject: [PATCH 05/17] app-context-bar: Make it specialize GtkBox
We don't need it to be a grid, and it will help us for the following
commits.
---
src/gs-app-context-bar.c | 4 ++--
src/gs-app-context-bar.h | 2 +-
src/gs-app-context-bar.ui | 24 +++---------------------
3 files changed, 6 insertions(+), 24 deletions(-)
diff --git a/src/gs-app-context-bar.c b/src/gs-app-context-bar.c
index a1850194..79eae84a 100644
--- a/src/gs-app-context-bar.c
+++ b/src/gs-app-context-bar.c
@@ -60,7 +60,7 @@ typedef enum
struct _GsAppContextBar
{
- GtkGrid parent_instance;
+ GtkBox parent_instance;
GsApp *app; /* (nullable) (owned) */
gulong app_notify_handler;
@@ -68,7 +68,7 @@ struct _GsAppContextBar
GsAppContextTile tiles[N_TILE_TYPES];
};
-G_DEFINE_TYPE (GsAppContextBar, gs_app_context_bar, GTK_TYPE_GRID)
+G_DEFINE_TYPE (GsAppContextBar, gs_app_context_bar, GTK_TYPE_BOX)
typedef enum {
PROP_APP = 1,
diff --git a/src/gs-app-context-bar.h b/src/gs-app-context-bar.h
index 75daf9df..e0167475 100644
--- a/src/gs-app-context-bar.h
+++ b/src/gs-app-context-bar.h
@@ -20,7 +20,7 @@ G_BEGIN_DECLS
#define GS_TYPE_APP_CONTEXT_BAR (gs_app_context_bar_get_type ())
-G_DECLARE_FINAL_TYPE (GsAppContextBar, gs_app_context_bar, GS, APP_CONTEXT_BAR, GtkGrid)
+G_DECLARE_FINAL_TYPE (GsAppContextBar, gs_app_context_bar, GS, APP_CONTEXT_BAR, GtkBox)
GtkWidget *gs_app_context_bar_new (GsApp *app);
diff --git a/src/gs-app-context-bar.ui b/src/gs-app-context-bar.ui
index 5f65cfb1..7abc6745 100644
--- a/src/gs-app-context-bar.ui
+++ b/src/gs-app-context-bar.ui
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.10"/>
- <template class="GsAppContextBar" parent="GtkGrid">
- <property name="column-homogeneous">True</property>
- <property name="column-spacing">0</property>
- <property name="row-homogeneous">True</property>
- <property name="row-spacing">0</property>
+ <template class="GsAppContextBar" parent="GtkBox">
+ <property name="homogeneous">True</property>
+ <property name="spacing">0</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<style>
@@ -87,10 +85,6 @@
</object>
</child>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
@@ -167,10 +161,6 @@
</object>
</child>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
@@ -249,10 +239,6 @@
</object>
</child>
</object>
- <packing>
- <property name="left-attach">2</property>
- <property name="top-attach">0</property>
- </packing>
</child>
<child>
@@ -330,10 +316,6 @@
</object>
</child>
</object>
- <packing>
- <property name="left-attach">3</property>
- <property name="top-attach">0</property>
- </packing>
</child>
</template>
--
2.30.2
From 54a14d2d5817e790a140cbacfa2c8bf705aff90b Mon Sep 17 00:00:00 2001
From: Adrien Plazas <kekun.plazas@laposte.net>
Date: Tue, 10 Aug 2021 12:32:25 +0200
Subject: [PATCH 06/17] app-context-bar: Split the tiles in two boxes
Allows the app context bar to be arranged in a 2x2 grid simply by making
it vertical.
This leaves the indentation broken to ease review, it will be fixed in
the next commit.
---
src/gs-app-context-bar.ui | 16 +++++++++++++++
src/gtk-style.css | 42 +++++++++++++++++++++++++++++----------
2 files changed, 48 insertions(+), 10 deletions(-)
diff --git a/src/gs-app-context-bar.ui b/src/gs-app-context-bar.ui
index 7abc6745..add79b60 100644
--- a/src/gs-app-context-bar.ui
+++ b/src/gs-app-context-bar.ui
@@ -10,6 +10,11 @@
<class name="linked"/>
</style>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="homogeneous">True</property>
+
<child>
<object class="GtkButton" id="storage_tile">
<property name="visible">True</property>
@@ -163,6 +168,14 @@
</object>
</child>
+ </object>
+ </child>
+
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="homogeneous">True</property>
+
<child>
<object class="GtkButton" id="hardware_support_tile">
<property name="visible">True</property>
@@ -317,6 +330,9 @@
</child>
</object>
</child>
+
+ </object>
+ </child>
</template>
<object class="GtkSizeGroup" id="app_context_bar_size_group">
diff --git a/src/gtk-style.css b/src/gtk-style.css
index 86deea6b..9526208a 100644
--- a/src/gtk-style.css
+++ b/src/gtk-style.css
@@ -721,22 +721,44 @@ clamp.status-page .title:not(:last-child) {
margin-bottom: 12px;
}
-app-context-bar {
- border-radius: 8px;
+app-context-bar .context-tile {
border: 1px solid shade(@theme_bg_color, 0.9);
background-color: @theme_base_color;
-}
-
-app-context-bar .context-tile {
- padding: 24px 12px 21px 12px;
border-radius: 0;
- border: none;
+ padding: 24px 12px 21px 12px;
border-right: 1px solid shade(@theme_bg_color, 0.9);
}
-app-context-bar .context-tile:last-child {
- border-right: none;
- border-bottom-right-radius: 8px;
+
+app-context-bar box:first-child .context-tile:first-child {
+ border-top-left-radius: 8px;
+ -gtk-outline-top-left-radius: 7px;
+}
+
+app-context-bar.horizontal box:last-child .context-tile:last-child,
+app-context-bar.vertical box:first-child .context-tile:last-child {
border-top-right-radius: 8px;
+ -gtk-outline-top-right-radius: 7px;
+}
+
+app-context-bar.horizontal box:first-child .context-tile:first-child,
+app-context-bar.vertical box:last-child .context-tile:first-child {
+ border-bottom-left-radius: 8px;
+ -gtk-outline-bottom-left-radius: 7px;
+}
+
+app-context-bar box:last-child .context-tile:last-child {
+ border-bottom-right-radius: 8px;
+ -gtk-outline-bottom-right-radius: 7px;
+}
+
+app-context-bar.horizontal box:not(:last-child) .context-tile,
+app-context-bar.horizontal box:last-child .context-tile:not(:last-child),
+app-context-bar.vertical .context-tile:not(:last-child) {
+ border-right: none;
+}
+
+app-context-bar.vertical box:not(:last-child) .context-tile {
+ border-bottom: none;
}
.context-tile-lozenge {
--
2.30.2
This diff is collapsed.
From d8eea25b380b210e0a1087c8fd890a4023f7d62d Mon Sep 17 00:00:00 2001
From: Adrien Plazas <kekun.plazas@laposte.net>
Date: Tue, 10 Aug 2021 14:35:29 +0200
Subject: [PATCH 08/17] review-row: Make it a box of boxes
This fixes some oddities with how GtkGrid works. This leaves the
indentation broken for ease of review, it will be fixed in the next
commit.
---
src/gs-review-row.ui | 73 ++++++++++++++------------------------------
1 file changed, 23 insertions(+), 50 deletions(-)
diff --git a/src/gs-review-row.ui b/src/gs-review-row.ui
index 3ed3c4e6..341cf950 100644
--- a/src/gs-review-row.ui
+++ b/src/gs-review-row.ui
@@ -8,13 +8,25 @@
<class name="review-row"/>
</style>
<child>
- <object class="GtkGrid" id="grid">
+ <object class="GtkBox">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="margin_top">32</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">10</property>
+ <property name="spacing">6</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>