[gnome-software/1860-app-page-header-switch-to-mobile-layout-at-narrower-width] gs-details-page: Change app header orientation in more narrowed width
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1860-app-page-header-switch-to-mobile-layout-at-narrower-width] gs-details-page: Change app header orientation in more narrowed width
- Date: Thu, 18 Aug 2022 09:30:33 +0000 (UTC)
commit 4ec92c5cb7d2a1566a63fd1a75ef87f63db525e3
Author: Milan Crha <mcrha redhat com>
Date: Thu Aug 18 11:27:59 2022 +0200
gs-details-page: Change app header orientation in more narrowed width
The previous behavior moved the buttons and the origin button too early
below the app name, causing large gap on the right side, even the buttons
still had enough place to fit there.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1860
src/gs-details-page.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index a6711f97a..3ed463afa 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -2187,6 +2187,25 @@ gs_details_page_star_pressed_cb (GtkGestureClick *click,
gs_details_page_write_review (self);
}
+static void
+gs_details_page_shell_allocation_width_cb (GObject *shell,
+ GParamSpec *pspec,
+ GsDetailsPage *self)
+{
+ gint allocation_width = 0;
+ GtkOrientation orientation;
+
+ g_object_get (shell, "allocation-width", &allocation_width, NULL);
+
+ if (allocation_width > 0 && allocation_width < 500)
+ orientation = GTK_ORIENTATION_VERTICAL;
+ else
+ orientation = GTK_ORIENTATION_HORIZONTAL;
+
+ if (orientation != gtk_orientable_get_orientation (GTK_ORIENTABLE
(self->box_details_header_not_icon)))
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (self->box_details_header_not_icon),
orientation);
+}
+
static gboolean
gs_details_page_setup (GsPage *page,
GsShell *shell,
@@ -2204,6 +2223,10 @@ gs_details_page_setup (GsPage *page,
self->cancellable = g_cancellable_new ();
g_cancellable_connect (cancellable, G_CALLBACK (gs_details_page_cancel_cb), self, NULL);
+ g_signal_connect_object (self->shell, "notify::allocation-width",
+ G_CALLBACK (gs_details_page_shell_allocation_width_cb),
+ self, 0);
+
/* hide some UI when offline */
g_signal_connect_object (self->plugin_loader, "notify::network-available",
G_CALLBACK (gs_details_page_network_available_notify_cb),
@@ -2555,8 +2578,6 @@ gs_details_page_init (GsDetailsPage *self)
narrow_to_spacing, NULL, NULL, NULL);
g_object_bind_property_full (self, "is-narrow", self->box_with_source, "halign",
G_BINDING_SYNC_CREATE,
narrow_to_halign, NULL, NULL, NULL);
- g_object_bind_property_full (self, "is-narrow", self->box_details_header_not_icon, "orientation",
G_BINDING_SYNC_CREATE,
- narrow_to_orientation, NULL, NULL, NULL);
g_object_bind_property_full (self, "is-narrow", self->box_license, "orientation",
G_BINDING_SYNC_CREATE,
narrow_to_orientation, NULL, NULL, NULL);
g_object_bind_property_full (self, "is-narrow", self->context_bar, "orientation",
G_BINDING_SYNC_CREATE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]