[nautilus/wip/antoniof/gnome-42: 41/72] Revert "floating-bar: Stop overriding widget measurement vfunc"
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gnome-42: 41/72] Revert "floating-bar: Stop overriding widget measurement vfunc"
- Date: Fri, 11 Feb 2022 19:28:00 +0000 (UTC)
commit 377b76f338c9a9a10fb4edcd31e4dcf08b39b79c
Author: António Fernandes <antoniof gnome org>
Date: Fri Feb 11 19:01:50 2022 +0000
Revert "floating-bar: Stop overriding widget measurement vfunc"
This reverts commit c77ac3080817f3ff346b2a4b3f29d9b60424ed02.
src/nautilus-floating-bar.c | 97 +++++++++++++++++++++++++++++++++++++++++++
src/resources/css/Adwaita.css | 2 +-
2 files changed, 98 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-floating-bar.c b/src/nautilus-floating-bar.c
index 88157a965..10fa19773 100644
--- a/src/nautilus-floating-bar.c
+++ b/src/nautilus-floating-bar.c
@@ -327,6 +327,97 @@ on_parent_changed (GObject *object,
}
}
+static void
+get_padding_and_border (GtkWidget *widget,
+ GtkBorder *border)
+{
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ GtkBorder tmp;
+
+ context = gtk_widget_get_style_context (widget);
+ state = gtk_style_context_get_state (context);
+
+ gtk_style_context_get_padding (context, state, border);
+ gtk_style_context_get_border (context, state, &tmp);
+ border->top += tmp.top;
+ border->right += tmp.right;
+ border->bottom += tmp.bottom;
+ border->left += tmp.left;
+}
+
+static void
+nautilus_floating_bar_get_preferred_width (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ GtkBorder border;
+
+ get_padding_and_border (widget, &border);
+
+ GTK_WIDGET_CLASS (nautilus_floating_bar_parent_class)->get_preferred_width (widget,
+ minimum_size,
+ natural_size);
+
+ *minimum_size += border.left + border.right;
+ *natural_size += border.left + border.right;
+}
+
+static void
+nautilus_floating_bar_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ GtkBorder border;
+
+ get_padding_and_border (widget, &border);
+
+ GTK_WIDGET_CLASS (nautilus_floating_bar_parent_class)->get_preferred_width_for_height (widget,
+ height,
+ minimum_size,
+ natural_size);
+
+ *minimum_size += border.left + border.right;
+ *natural_size += border.left + border.right;
+}
+
+static void
+nautilus_floating_bar_get_preferred_height (GtkWidget *widget,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ GtkBorder border;
+
+ get_padding_and_border (widget, &border);
+
+ GTK_WIDGET_CLASS (nautilus_floating_bar_parent_class)->get_preferred_height (widget,
+ minimum_size,
+ natural_size);
+
+ *minimum_size += border.top + border.bottom;
+ *natural_size += border.top + border.bottom;
+}
+
+static void
+nautilus_floating_bar_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_size,
+ gint *natural_size)
+{
+ GtkBorder border;
+
+ get_padding_and_border (widget, &border);
+
+ GTK_WIDGET_CLASS (nautilus_floating_bar_parent_class)->get_preferred_height_for_width (widget,
+ width,
+ minimum_size,
+ natural_size);
+
+ *minimum_size += border.top + border.bottom;
+ *natural_size += border.top + border.bottom;
+}
+
static void
nautilus_floating_bar_constructed (GObject *obj)
{
@@ -411,12 +502,18 @@ static void
nautilus_floating_bar_class_init (NautilusFloatingBarClass *klass)
{
GObjectClass *oclass = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
oclass->constructed = nautilus_floating_bar_constructed;
oclass->set_property = nautilus_floating_bar_set_property;
oclass->get_property = nautilus_floating_bar_get_property;
oclass->finalize = nautilus_floating_bar_finalize;
+ wclass->get_preferred_width = nautilus_floating_bar_get_preferred_width;
+ wclass->get_preferred_width_for_height = nautilus_floating_bar_get_preferred_width_for_height;
+ wclass->get_preferred_height = nautilus_floating_bar_get_preferred_height;
+ wclass->get_preferred_height_for_width = nautilus_floating_bar_get_preferred_height_for_width;
+
properties[PROP_PRIMARY_LABEL] =
g_param_spec_string ("primary-label",
"Bar's primary label",
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index 8a0bb9c01..0e2f302f0 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -106,7 +106,7 @@ entry.search > * {
/* Floating status bar */
.floating-bar {
- padding: 3px;
+ padding: 1px;
background-color: @theme_base_color;
border-width: 1px;
border-style: solid solid none;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]