[gnome-todo] color-button: Set up minimum height of 24px
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] color-button: Set up minimum height of 24px
- Date: Wed, 12 Sep 2018 11:54:24 +0000 (UTC)
commit 365fa4c5bf3276c30fa00de8fabda955e38dfbfc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Sep 5 10:54:36 2018 -0300
color-button: Set up minimum height of 24px
Looks and behaves slightly better.
src/gtd-task-list-panel.c | 1 +
src/widgets/gtd-color-button.c | 19 ++++++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/src/gtd-task-list-panel.c b/src/gtd-task-list-panel.c
index d004a97..208e8bc 100644
--- a/src/gtd-task-list-panel.c
+++ b/src/gtd-task-list-panel.c
@@ -93,6 +93,7 @@ populate_color_grid (GtdTaskListPanel *self)
gdk_rgba_parse (&color, colors[i]);
button = gtd_color_button_new (&color);
+ gtk_widget_set_size_request (button, -1, 24);
gtk_container_add (GTK_CONTAINER (self->colors_flowbox), button);
}
diff --git a/src/widgets/gtd-color-button.c b/src/widgets/gtd-color-button.c
index eefe544..880d3de 100644
--- a/src/widgets/gtd-color-button.c
+++ b/src/widgets/gtd-color-button.c
@@ -59,7 +59,13 @@ gtd_color_button_measure (GtkWidget *widget,
gint *minimum_baseline,
gint *natural_baseline)
{
- GtdColorButton *self = GTD_COLOR_BUTTON (widget);
+ GtdColorButton *self;
+ gint height_request;
+ gint width_request;
+
+ self = GTD_COLOR_BUTTON (widget);
+
+ gtk_widget_get_size_request (widget, &width_request, &height_request);
gtk_widget_measure (self->selected_icon,
orientation,
@@ -68,6 +74,17 @@ gtd_color_button_measure (GtkWidget *widget,
natural,
NULL,
NULL);
+
+ if (orientation == GTK_ORIENTATION_VERTICAL)
+ {
+ *minimum = MAX (*minimum, height_request);
+ *natural = MAX (*natural, height_request);
+ }
+ else
+ {
+ *minimum = MAX (*minimum, width_request);
+ *natural = MAX (*natural, width_request);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]