[nautilus/wip/antoniof/gtk4-preparation-drop-libgd: 10/11] query-editor: Stop using libgd
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-preparation-drop-libgd: 10/11] query-editor: Stop using libgd
- Date: Sun, 26 Dec 2021 18:12:44 +0000 (UTC)
commit 004af59f1aed91e7e897580e711adefefd97de41
Author: António Fernandes <antoniof gnome org>
Date: Tue Nov 2 23:38:40 2021 +0000
query-editor: Stop using libgd
This introduces a temporary regression: missing search entry tags.
This regression is easy to fix after the switch to GTK4, using GtkText
to reimplement an API identical to that of GdTaggedEntry. For this
reason, code is disabled rather than removed.
src/nautilus-query-editor.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index ff9934b22..c88010920 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -26,7 +26,6 @@
#include <gio/gio.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <libgd/gd.h>
#include <string.h>
#include "nautilus-file.h"
@@ -46,8 +45,10 @@ struct _NautilusQueryEditor
GtkWidget *popover;
GtkWidget *dropdown_button;
+#if 0 && TAGGED_ENTRY_NEEDS_GTK4_REIMPLEMENTATION
GdTaggedEntryTag *mime_types_tag;
GdTaggedEntryTag *date_range_tag;
+#endif
gboolean change_frozen;
@@ -225,12 +226,14 @@ nautilus_query_editor_set_property (GObject *object,
static void
nautilus_query_editor_finalize (GObject *object)
{
+#if 0 && TAGGED_ENTRY_NEEDS_GTK4_REIMPLEMENTATION
NautilusQueryEditor *editor;
editor = NAUTILUS_QUERY_EDITOR (object);
g_clear_object (&editor->date_range_tag);
g_clear_object (&editor->mime_types_tag);
+#endif
G_OBJECT_CLASS (nautilus_query_editor_parent_class)->finalize (object);
}
@@ -425,6 +428,7 @@ search_popover_date_range_changed_cb (NautilusSearchPopover *popover,
create_query (editor);
}
+#if 0 && TAGGED_ENTRY_NEEDS_GTK4_REIMPLEMENTATION
gd_tagged_entry_remove_tag (GD_TAGGED_ENTRY (editor->entry),
editor->date_range_tag);
if (date_range)
@@ -437,6 +441,7 @@ search_popover_date_range_changed_cb (NautilusSearchPopover *popover,
gd_tagged_entry_add_tag (GD_TAGGED_ENTRY (editor->entry),
GD_TAGGED_ENTRY_TAG (editor->date_range_tag));
}
+#endif
nautilus_query_set_date_range (editor->query, date_range);
@@ -459,8 +464,10 @@ search_popover_mime_type_changed_cb (NautilusSearchPopover *popover,
create_query (editor);
}
+#if 0 && TAGGED_ENTRY_NEEDS_GTK4_REIMPLEMENTATION
gd_tagged_entry_remove_tag (GD_TAGGED_ENTRY (editor->entry),
editor->mime_types_tag);
+#endif
/* group 0 is anything */
if (mimetype_group == 0)
{
@@ -469,21 +476,27 @@ search_popover_mime_type_changed_cb (NautilusSearchPopover *popover,
else if (mimetype_group > 0)
{
mimetypes = nautilus_mime_types_group_get_mimetypes (mimetype_group);
+#if 0 && TAGGED_ENTRY_NEEDS_GTK4_REIMPLEMENTATION
gd_tagged_entry_tag_set_label (editor->mime_types_tag,
nautilus_mime_types_group_get_name (mimetype_group));
gd_tagged_entry_add_tag (GD_TAGGED_ENTRY (editor->entry),
GD_TAGGED_ENTRY_TAG (editor->mime_types_tag));
+#endif
}
else
{
+#if 0 && TAGGED_ENTRY_NEEDS_GTK4_REIMPLEMENTATION
g_autofree gchar *display_name = NULL;
+#endif
mimetypes = g_ptr_array_new_full (1, g_free);
g_ptr_array_add (mimetypes, g_strdup (mimetype));
+#if 0 && TAGGED_ENTRY_NEEDS_GTK4_REIMPLEMENTATION
display_name = g_content_type_get_description (mimetype);
gd_tagged_entry_tag_set_label (editor->mime_types_tag, display_name);
gd_tagged_entry_add_tag (GD_TAGGED_ENTRY (editor->entry),
GD_TAGGED_ENTRY_TAG (editor->mime_types_tag));
+#endif
}
nautilus_query_set_mime_types (editor->query, mimetypes);
@@ -529,6 +542,7 @@ search_popover_fts_changed_cb (GObject *popover,
nautilus_query_editor_changed (editor);
}
+#if 0 && TAGGED_ENTRY_NEEDS_GTK4_REIMPLEMENTATION
static void
entry_tag_clicked (NautilusQueryEditor *editor)
{
@@ -549,6 +563,7 @@ entry_tag_close_button_clicked (NautilusQueryEditor *editor,
nautilus_search_popover_reset_date_range (NAUTILUS_SEARCH_POPOVER (editor->popover));
}
}
+#endif
static void
setup_widgets (NautilusQueryEditor *editor)
@@ -566,11 +581,16 @@ setup_widgets (NautilusQueryEditor *editor)
gtk_box_append (GTK_BOX (vbox), hbox);
/* create the search entry */
+#if 0 && TAGGED_ENTRY_NEEDS_GTK4_REIMPLEMENTATION
editor->entry = GTK_WIDGET (gd_tagged_entry_new ());
+#else
+ editor->entry = gtk_search_entry_new ();
+#endif
gtk_widget_set_hexpand (editor->entry, TRUE);
gtk_box_append (GTK_BOX (hbox), editor->entry);
+#if 0 && TAGGED_ENTRY_NEEDS_GTK4_REIMPLEMENTATION
editor->mime_types_tag = gd_tagged_entry_tag_new (NULL);
editor->date_range_tag = gd_tagged_entry_tag_new (NULL);
@@ -582,6 +602,7 @@ setup_widgets (NautilusQueryEditor *editor)
"tag-button-clicked",
G_CALLBACK (entry_tag_close_button_clicked),
editor);
+#endif
/* setup the search popover */
editor->popover = nautilus_search_popover_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]