From 538cf9e29432186586f0983f6dbd3baae34a94d1 Mon Sep 17 00:00:00 2001 From: nana-4 Date: Sat, 12 Dec 2020 15:30:01 +0900 Subject: [PATCH] dropdown: Improve search bar styling As per the mockup. See: https://gitlab.gnome.org/Teams/Design/os-mockups/-/blob/master/dropdown-lists/dropdown-lists.png --- gtk/gtkdropdown.c | 4 +++- gtk/theme/Adwaita/_common.scss | 9 ++++----- gtk/ui/gtkdropdown.ui | 20 ++++++++++++++------ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/gtk/gtkdropdown.c b/gtk/gtkdropdown.c index 669305d539..4d1b178952 100644 --- a/gtk/gtkdropdown.c +++ b/gtk/gtkdropdown.c @@ -96,6 +96,7 @@ struct _GtkDropDown GtkWidget *button_stack; GtkWidget *button_item; GtkWidget *button_placeholder; + GtkWidget *search_box; GtkWidget *search_entry; gboolean enable_search; @@ -521,6 +522,7 @@ gtk_drop_down_class_init (GtkDropDownClass *klass) gtk_widget_class_bind_template_child (widget_class, GtkDropDown, button_item); gtk_widget_class_bind_template_child (widget_class, GtkDropDown, popup); gtk_widget_class_bind_template_child (widget_class, GtkDropDown, popup_list); + gtk_widget_class_bind_template_child (widget_class, GtkDropDown, search_box); gtk_widget_class_bind_template_child (widget_class, GtkDropDown, search_entry); gtk_widget_class_bind_template_callback (widget_class, row_activated); @@ -936,7 +938,7 @@ gtk_drop_down_set_enable_search (GtkDropDown *self, self->enable_search = enable_search; gtk_editable_set_text (GTK_EDITABLE (self->search_entry), ""); - gtk_widget_set_visible (self->search_entry, enable_search); + gtk_widget_set_visible (self->search_box, enable_search); g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ENABLE_SEARCH]); } diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss index 845582650d..303d1922f6 100644 --- a/gtk/theme/Adwaita/_common.scss +++ b/gtk/theme/Adwaita/_common.scss @@ -1230,11 +1230,10 @@ combobox { } } - .search { //drodowns with searchboxes on top - border-radius: $popover_radius; - padding: 3px 10px; - border-radius: 3px; - margin: 4px 4px -4px 4px; + // drodowns with searchboxes on top + .dropdown-searchbar { + padding: 6px; + border-bottom: 1px solid $borders_color; } } } diff --git a/gtk/ui/gtkdropdown.ui b/gtk/ui/gtkdropdown.ui index e2dbdaf4d1..16e55b5b3d 100644 --- a/gtk/ui/gtkdropdown.ui +++ b/gtk/ui/gtkdropdown.ui @@ -55,13 +55,21 @@ vertical - - - + 0 - 6 - 6 - Search… + + + + + + 1 + 6 + 6 + Search… + +