diff options
author | António Fernandes <antoniof@gnome.org> | 2022-04-21 12:12:16 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-06-30 18:47:04 +0100 |
commit | 4b9d8216c3ff2620bd45765eeb2d753a817dfc8e (patch) | |
tree | 4acb3508d2123628da2c1a539fdff3c707a65b29 /src/nautilus-query-editor.c | |
parent | 2ee09a9c0c5493dc7ecb6af7d78d2f4aa04a78ba (diff) | |
download | nautilus-4b9d8216c3ff2620bd45765eeb2d753a817dfc8e.tar.gz |
query-editor: Don't subclass GtkBox
We are going to become a custom tagged search entry, so we should
subclass directly from GtkWidget and use a box layout instead.
Diffstat (limited to 'src/nautilus-query-editor.c')
-rw-r--r-- | src/nautilus-query-editor.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c index ac206162b..c36d0026a 100644 --- a/src/nautilus-query-editor.c +++ b/src/nautilus-query-editor.c @@ -38,7 +38,7 @@ struct _NautilusQueryEditor { - GtkBox parent_instance; + GtkWidget parent_instance; GtkWidget *entry; GtkWidget *popover; @@ -81,7 +81,7 @@ static void entry_changed_cb (GtkWidget *entry, NautilusQueryEditor *editor); static void nautilus_query_editor_changed (NautilusQueryEditor *editor); -G_DEFINE_TYPE (NautilusQueryEditor, nautilus_query_editor, GTK_TYPE_BOX); +G_DEFINE_TYPE (NautilusQueryEditor, nautilus_query_editor, GTK_TYPE_WIDGET); static void update_fts_sensitivity (NautilusQueryEditor *editor) @@ -135,6 +135,9 @@ nautilus_query_editor_dispose (GObject *object) editor = NAUTILUS_QUERY_EDITOR (object); + g_clear_pointer (&editor->entry, gtk_widget_unparent); + g_clear_pointer (&editor->dropdown_button, gtk_widget_unparent); + g_clear_object (&editor->location); g_clear_object (&editor->query); @@ -319,6 +322,8 @@ nautilus_query_editor_class_init (NautilusQueryEditorClass *class) "The query that the editor is handling", NAUTILUS_TYPE_QUERY, G_PARAM_READWRITE)); + + gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); } GFile * @@ -570,7 +575,7 @@ nautilus_query_editor_init (NautilusQueryEditor *editor) #endif gtk_widget_set_hexpand (editor->entry, TRUE); - gtk_box_append (GTK_BOX (editor), editor->entry); + gtk_widget_set_parent (editor->entry, GTK_WIDGET (editor)); #if 0 && TAGGED_ENTRY_NEEDS_GTK4_REIMPLEMENTATION editor->mime_types_tag = gd_tagged_entry_tag_new (NULL); @@ -601,7 +606,7 @@ nautilus_query_editor_init (NautilusQueryEditor *editor) /* setup the filter menu button */ editor->dropdown_button = gtk_menu_button_new (); gtk_menu_button_set_popover (GTK_MENU_BUTTON (editor->dropdown_button), editor->popover); - gtk_box_append (GTK_BOX (editor), editor->dropdown_button); + gtk_widget_set_parent (editor->dropdown_button, GTK_WIDGET (editor)); g_signal_connect (editor->entry, "activate", G_CALLBACK (entry_activate_cb), editor); |