[gtk/matthiasc/for-master] Give all search entries an icon
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] Give all search entries an icon
- Date: Fri, 23 Oct 2020 16:20:49 +0000 (UTC)
commit fdb1fa4d089359951c34212008e876bd91e6c0bc
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 23 12:19:31 2020 -0400
Give all search entries an icon
This was first requested for the search entry in
GtkDropDown, but it is better to be consistent and
give every search entry an icon.
Related: #3291
docs/reference/gtk/images/search-entry.png | Bin 2418 -> 2990 bytes
gtk/gtkdropdown.c | 10 ----------
gtk/gtksearchentry.c | 9 +++++++++
3 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/docs/reference/gtk/images/search-entry.png b/docs/reference/gtk/images/search-entry.png
index 22549fc093..4ecdbfe8c4 100644
Binary files a/docs/reference/gtk/images/search-entry.png and b/docs/reference/gtk/images/search-entry.png
differ
diff --git a/gtk/gtkdropdown.c b/gtk/gtkdropdown.c
index d33f1e9524..80dc7a1ae6 100644
--- a/gtk/gtkdropdown.c
+++ b/gtk/gtkdropdown.c
@@ -251,8 +251,6 @@ gtk_drop_down_dispose (GObject *object)
{
GtkDropDown *self = GTK_DROP_DOWN (object);
- gtk_widget_unparent (gtk_widget_get_first_child (self->search_entry));
-
g_clear_pointer (&self->popup, gtk_widget_unparent);
g_clear_pointer (&self->button, gtk_widget_unparent);
@@ -596,19 +594,11 @@ set_default_factory (GtkDropDown *self)
static void
gtk_drop_down_init (GtkDropDown *self)
{
- GtkWidget *icon;
-
g_type_ensure (GTK_TYPE_BUILTIN_ICON);
g_type_ensure (GTK_TYPE_LIST_ITEM_WIDGET);
gtk_widget_init_template (GTK_WIDGET (self));
- icon = g_object_new (GTK_TYPE_IMAGE,
- "accessible-role", GTK_ACCESSIBLE_ROLE_NONE,
- "icon-name", "system-search-symbolic",
- NULL);
- gtk_widget_insert_after (icon, self->search_entry, NULL);
-
set_default_factory (self);
}
diff --git a/gtk/gtksearchentry.c b/gtk/gtksearchentry.c
index 78268113c8..5c227f6853 100644
--- a/gtk/gtksearchentry.c
+++ b/gtk/gtksearchentry.c
@@ -160,6 +160,8 @@ gtk_search_entry_finalize (GObject *object)
gtk_editable_finish_delegate (GTK_EDITABLE (entry));
+ gtk_widget_unparent (gtk_widget_get_first_child (GTK_WIDGET (entry)));
+
g_clear_pointer (&entry->entry, gtk_widget_unparent);
g_clear_pointer (&entry->icon, gtk_widget_unparent);
@@ -549,8 +551,15 @@ activate_cb (GtkText *text,
static void
gtk_search_entry_init (GtkSearchEntry *entry)
{
+ GtkWidget *icon;
GtkGesture *press;
+ icon = g_object_new (GTK_TYPE_IMAGE,
+ "accessible-role", GTK_ACCESSIBLE_ROLE_NONE,
+ "icon-name", "system-search-symbolic",
+ NULL);
+ gtk_widget_set_parent (icon, GTK_WIDGET (entry));
+
entry->entry = gtk_text_new ();
gtk_widget_set_parent (entry->entry, GTK_WIDGET (entry));
gtk_widget_set_hexpand (entry->entry, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]