[nautilus/wip/gbsneto/search-popover: 4/7] search-popover: add popover to edit search filters



commit 3857ab12a20c76ab8f4a56d4dbea3619ef1929c7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Oct 5 21:07:25 2015 -0300

    search-popover: add popover to edit search filters
    
    The newest mockups for Nautilus search shows a popover
    that contains all the necessary options to edit search
    filters.
    
    This commit implements it. The following commits will
    adapt NautilusQueryEditor to match the latest mockups
    and display this popover.

 src/Makefile.am                |    3 +
 src/nautilus-search-popover.c  |  480 ++++++++++++++++++++++++++++++++++++++++
 src/nautilus-search-popover.h  |   49 ++++
 src/nautilus-search-popover.ui |  414 ++++++++++++++++++++++++++++++++++
 src/nautilus.gresource.xml     |    1 +
 5 files changed, 947 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index d214211..0cb9006 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -80,6 +80,7 @@ $(dbus_shell_search_provider_built_sources) : Makefile.am $(top_srcdir)/data/she
                $(NULL)
 
 headers =                                      \
+       nautilus-search-popover.h               \
        nautilus-special-location-bar.h         \
        $(NULL)
 
@@ -203,6 +204,8 @@ nautilus_SOURCES = \
        nautilus-properties-window.h            \
        nautilus-query-editor.c                 \
        nautilus-query-editor.h                 \
+       nautilus-search-popover.c               \
+       nautilus-search-popover.h               \
        nautilus-self-check-functions.c         \
        nautilus-self-check-functions.h         \
        nautilus-shell-search-provider.h        \
diff --git a/src/nautilus-search-popover.c b/src/nautilus-search-popover.c
new file mode 100644
index 0000000..e50faaa
--- /dev/null
+++ b/src/nautilus-search-popover.c
@@ -0,0 +1,480 @@
+/* nautilus-search-popover.c
+ *
+ * Copyright (C) 2015 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "nautilus-enum-types.h"
+#include "nautilus-search-popover.h"
+
+#include <glib/gi18n.h>
+#include <libnautilus-private/nautilus-global-preferences.h>
+
+struct _NautilusSearchPopover
+{
+  GtkPopover          parent;
+
+  GtkWidget          *recursive_switch;
+  GtkWidget          *type_label;
+  GtkWidget          *type_listbox;
+  GtkWidget          *type_stack;
+};
+
+static void          show_other_types_dialog                     (NautilusSearchPopover *popover);
+
+G_DEFINE_TYPE (NautilusSearchPopover, nautilus_search_popover, GTK_TYPE_POPOVER)
+
+enum {
+  CHANGED,
+  LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
+struct {
+  char *name;
+  char *mimetypes[20];
+} mimetype_groups[] = {
+  {
+    N_("Anything"),
+    { NULL }
+  },
+  {
+    N_("Files"),
+    { "application/octet-stream",
+      "text/plain",
+      NULL
+    }
+  },
+  {
+    N_("Folders"),
+    { "inode/directory",
+      NULL
+    }
+  },
+  { N_("Documents"),
+    { "application/rtf",
+      "application/msword",
+      "application/vnd.sun.xml.writer",
+      "application/vnd.sun.xml.writer.global",
+      "application/vnd.sun.xml.writer.template",
+      "application/vnd.oasis.opendocument.text",
+      "application/vnd.oasis.opendocument.text-template",
+      "application/x-abiword",
+      "application/x-applix-word",
+      "application/x-mswrite",
+      "application/docbook+xml",
+      "application/x-kword",
+      "application/x-kword-crypt",
+      "application/x-lyx",
+      NULL
+    }
+  },
+  { N_("Illustration"),
+    { "application/illustrator",
+      "application/vnd.corel-draw",
+      "application/vnd.stardivision.draw",
+      "application/vnd.oasis.opendocument.graphics",
+      "application/x-dia-diagram",
+      "application/x-karbon",
+      "application/x-killustrator",
+      "application/x-kivio",
+      "application/x-kontour",
+      "application/x-wpg",
+      NULL
+    }
+  },
+  { N_("Music"),
+    { "application/ogg",
+      "audio/x-vorbis+ogg",
+      "audio/ac3",
+      "audio/basic",
+      "audio/midi",
+      "audio/x-flac",
+      "audio/mp4",
+      "audio/mpeg",
+      "audio/x-mpeg",
+      "audio/x-ms-asx",
+      "audio/x-pn-realaudio",
+      NULL
+    }
+  },
+  { N_("PDF / Postscript"),
+    { "application/pdf",
+      "application/postscript",
+      "application/x-dvi",
+      "image/x-eps",
+      NULL
+    }
+  },
+  { N_("Picture"),
+    { "application/vnd.oasis.opendocument.image",
+      "application/x-krita",
+      "image/bmp",
+      "image/cgm",
+      "image/gif",
+      "image/jpeg",
+      "image/jpeg2000",
+      "image/png",
+      "image/svg+xml",
+      "image/tiff",
+      "image/x-compressed-xcf",
+      "image/x-pcx",
+      "image/x-photo-cd",
+      "image/x-psd",
+      "image/x-tga",
+      "image/x-xcf",
+      NULL
+    }
+  },
+  { N_("Presentation"),
+    { "application/vnd.ms-powerpoint",
+      "application/vnd.sun.xml.impress",
+      "application/vnd.oasis.opendocument.presentation",
+      "application/x-magicpoint",
+      "application/x-kpresenter",
+      NULL
+    }
+  },
+  { N_("Spreadsheet"),
+    { "application/vnd.lotus-1-2-3",
+      "application/vnd.ms-excel",
+      "application/vnd.stardivision.calc",
+      "application/vnd.sun.xml.calc",
+      "application/vnd.oasis.opendocument.spreadsheet",
+      "application/x-applix-spreadsheet",
+      "application/x-gnumeric",
+      "application/x-kspread",
+      "application/x-kspread-crypt",
+      "application/x-quattropro",
+      "application/x-sc",
+      "application/x-siag",
+      NULL
+    }
+  },
+  { N_("Text File"),
+    { "text/plain",
+      NULL
+    }
+  },
+  { N_("Video"),
+    { "video/mp4",
+      "video/3gpp",
+      "video/mpeg",
+      "video/quicktime",
+      "video/vivo",
+      "video/x-avi",
+      "video/x-mng",
+      "video/x-ms-asf",
+      "video/x-ms-wmv",
+      "video/x-msvideo",
+      "video/x-nsv",
+      "video/x-real-video",
+      NULL
+    }
+  }
+};
+
+
+/* Callbacks */
+
+static void
+select_type_button_clicked (GtkButton             *button,
+                            NautilusSearchPopover *popover)
+{
+  gtk_stack_set_visible_child_name (GTK_STACK (popover->type_stack), "type-list");
+}
+
+static void
+types_listbox_header_func (GtkListBoxRow         *row,
+                           GtkListBoxRow         *before,
+                           NautilusSearchPopover *popover)
+{
+  gboolean show_separator;
+
+  show_separator = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "show-separator"));
+
+  if (show_separator) {
+    GtkWidget *separator;
+
+    separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+    gtk_widget_show (separator);
+
+    gtk_list_box_row_set_header (row, separator);
+  }
+}
+
+static void
+types_listbox_row_activated (GtkListBox            *listbox,
+                             GtkListBoxRow         *row,
+                             NautilusSearchPopover *popover)
+{
+  gint group;
+
+  group = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "mimetype-group"));
+
+  /* The -1 group stands for the "Other Types" group, for which
+   * we should show the mimetype dialog.
+   */
+  if (group == -1) {
+    show_other_types_dialog (popover);
+  }
+  else {
+    GList *mimetypes;
+    gint i;
+
+    mimetypes = NULL;
+
+    /* Setup the new mimetypes set */
+    for (i = 0; mimetype_groups[group].mimetypes[i]; i++) {
+      mimetypes = g_list_append (mimetypes, mimetype_groups[group].mimetypes[i]);
+    }
+
+    gtk_label_set_label (GTK_LABEL (popover->type_label), gettext (mimetype_groups[group].name));
+
+    g_signal_emit (popover, signals[CHANGED], 0, NAUTILUS_SEARCH_FILTER_TYPE, mimetypes);
+  }
+
+  gtk_stack_set_visible_child_name (GTK_STACK (popover->type_stack), "type-button");
+}
+
+/* Auxiliary methods */
+
+static GtkWidget*
+create_row_for_label (const gchar *text,
+                      gint         mimetype_group,
+                      gboolean     show_separator)
+{
+  GtkWidget *row;
+  GtkWidget *label;
+
+  row = gtk_list_box_row_new ();
+
+  g_object_set_data (G_OBJECT (row), "mimetype-group", GINT_TO_POINTER (mimetype_group));
+  g_object_set_data (G_OBJECT (row), "show-separator", GINT_TO_POINTER (show_separator));
+
+  label = g_object_new (GTK_TYPE_LABEL,
+                        "label", text,
+                        "hexpand", TRUE,
+                        "xalign", 0.0,
+                        "margin-start", 6,
+                        NULL);
+
+  gtk_container_add (GTK_CONTAINER (row), label);
+  gtk_widget_show_all (row);
+
+  return row;
+}
+
+static void
+fill_types_listbox (NautilusSearchPopover *popover)
+{
+  GtkWidget *row;
+  int i;
+
+  /* Mimetypes */
+  for (i = 0; i < G_N_ELEMENTS (mimetype_groups); i++) {
+
+    /* On the third row, which is right below "Folders", there should be an
+     * separator to logically group the types.
+     */
+    row = create_row_for_label (gettext (mimetype_groups[i].name), i, i == 3);
+
+    gtk_container_add (GTK_CONTAINER (popover->type_listbox), row);
+  }
+
+  /* Other types */
+  row = create_row_for_label (_("Other Type…"), -1, TRUE);
+  gtk_container_add (GTK_CONTAINER (popover->type_listbox), row);
+}
+
+static void
+show_other_types_dialog (NautilusSearchPopover *popover)
+{
+  GList *mime_infos, *l;
+  GtkWidget *dialog;
+  GtkWidget *scrolled, *treeview;
+  GtkListStore *store;
+  GtkTreeViewColumn *column;
+  GtkCellRenderer *renderer;
+  GtkWidget *toplevel;
+  GtkTreeSelection *selection;
+
+  mime_infos = g_content_types_get_registered ();
+
+  store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
+  for (l = mime_infos; l != NULL; l = l->next) {
+    GtkTreeIter iter;
+    char *mime_type = l->data;
+    char *description;
+
+    description = g_content_type_get_description (mime_type);
+    if (description == NULL) {
+      description = g_strdup (mime_type);
+    }
+
+    gtk_list_store_append (store, &iter);
+    gtk_list_store_set (store, &iter,
+            0, description,
+            1, mime_type,
+            -1);
+
+    g_free (mime_type);
+    g_free (description);
+  }
+  g_list_free (mime_infos);
+
+
+
+  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (popover));
+  dialog = gtk_dialog_new_with_buttons (_("Select type"),
+                GTK_WINDOW (toplevel),
+                GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR,
+                _("_Cancel"), GTK_RESPONSE_CANCEL,
+                _("Select"), GTK_RESPONSE_OK,
+                NULL);
+  gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 600);
+
+  scrolled = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
+          GTK_POLICY_AUTOMATIC,
+          GTK_POLICY_AUTOMATIC);
+
+  gtk_widget_show (scrolled);
+  gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), scrolled, TRUE, TRUE, 0);
+
+  treeview = gtk_tree_view_new ();
+  gtk_tree_view_set_model (GTK_TREE_VIEW (treeview),
+         GTK_TREE_MODEL (store));
+  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), 0,
+                GTK_SORT_ASCENDING);
+
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
+  gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes ("Name",
+                                                     renderer,
+                                                     "text",
+                                                     0,
+                                                     NULL);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
+
+  gtk_widget_show (treeview);
+  gtk_container_add (GTK_CONTAINER (scrolled), treeview);
+
+  if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
+    GtkTreeIter iter;
+    char *mimetype, *description;
+
+    gtk_tree_selection_get_selected (selection, NULL, &iter);
+    gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
+            0, &description,
+            1, &mimetype,
+            -1);
+
+    /*
+    type_add_custom_type (row, mimetype, description, &iter);
+    gtk_combo_box_set_active_iter  (GTK_COMBO_BOX (row->type_widget), &iter);
+     */
+  }
+
+  gtk_widget_destroy (dialog);
+}
+
+/* Overrides */
+
+static void
+nautilus_search_popover_closed (GtkPopover *popover)
+{
+  NautilusSearchPopover *self = NAUTILUS_SEARCH_POPOVER (popover);
+
+  gtk_stack_set_visible_child_name (GTK_STACK (self->type_stack), "type-button");
+}
+
+static void
+nautilus_search_popover_class_init (NautilusSearchPopoverClass *klass)
+{
+  GtkPopoverClass *popover_class = GTK_POPOVER_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  popover_class->closed = nautilus_search_popover_closed;
+
+  signals[CHANGED] = g_signal_new ("changed",
+                                   NAUTILUS_TYPE_SEARCH_POPOVER,
+                                   G_SIGNAL_RUN_LAST,
+                                   0,
+                                   NULL,
+                                   NULL,
+                                   g_cclosure_marshal_generic,
+                                   G_TYPE_NONE,
+                                   2,
+                                   NAUTILUS_TYPE_SEARCH_FILTER,
+                                   G_TYPE_POINTER);
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/nautilus/nautilus-search-popover.ui");
+
+  gtk_widget_class_bind_template_child (widget_class, NautilusSearchPopover, recursive_switch);
+  gtk_widget_class_bind_template_child (widget_class, NautilusSearchPopover, type_label);
+  gtk_widget_class_bind_template_child (widget_class, NautilusSearchPopover, type_listbox);
+  gtk_widget_class_bind_template_child (widget_class, NautilusSearchPopover, type_stack);
+
+  gtk_widget_class_bind_template_callback (widget_class, select_type_button_clicked);
+  gtk_widget_class_bind_template_callback (widget_class, types_listbox_row_activated);
+}
+
+static void
+nautilus_search_popover_init (NautilusSearchPopover *self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+
+  g_settings_bind (nautilus_preferences, "enable-recursive-search",
+                   self->recursive_switch, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  /* Types listbox */
+  gtk_list_box_set_header_func (GTK_LIST_BOX (self->type_listbox),
+                                (GtkListBoxUpdateHeaderFunc) types_listbox_header_func,
+                                self, NULL);
+
+  fill_types_listbox (self);
+}
+
+GtkWidget*
+nautilus_search_popover_new (void)
+{
+  return g_object_new (NAUTILUS_TYPE_SEARCH_POPOVER, NULL);
+}
+
+/**
+ * nautilus_search_popover_set_query:
+ * @popover: a #NautilusSearchPopover
+ * @query (nullable): a #NautilusQuery
+ *
+ * Sets the current query for @popover.
+ *
+ * Returns:
+ */
+void
+nautilus_search_popover_set_query (NautilusSearchPopover *popover,
+                                   NautilusQuery         *query)
+{
+  g_return_if_fail (NAUTILUS_IS_SEARCH_POPOVER (popover));
+
+
+}
diff --git a/src/nautilus-search-popover.h b/src/nautilus-search-popover.h
new file mode 100644
index 0000000..a54847d
--- /dev/null
+++ b/src/nautilus-search-popover.h
@@ -0,0 +1,49 @@
+/* nautilus-search-popover.h
+ *
+ * Copyright (C) 2015 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NAUTILUS_SEARCH_POPOVER_H
+#define NAUTILUS_SEARCH_POPOVER_H
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include <libnautilus-private/nautilus-query.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+  NAUTILUS_SEARCH_FILTER_CONTENT, /* Full text or filename */
+  NAUTILUS_SEARCH_FILTER_DATE,    /* When */
+  NAUTILUS_SEARCH_FILTER_LAST,    /* Last modified or last used */
+  NAUTILUS_SEARCH_FILTER_TYPE     /* What */
+} NautilusSearchFilter;
+
+#define NAUTILUS_TYPE_SEARCH_POPOVER (nautilus_search_popover_get_type())
+
+G_DECLARE_FINAL_TYPE (NautilusSearchPopover, nautilus_search_popover, NAUTILUS, SEARCH_POPOVER, GtkPopover)
+
+GtkWidget*           nautilus_search_popover_new                 (void);
+
+NautilusQuery*       nautilus_search_popover_get_query           (NautilusSearchPopover *popover);
+
+void                 nautilus_search_popover_set_query           (NautilusSearchPopover *popover,
+                                                                  NautilusQuery         *query);
+
+G_END_DECLS
+
+#endif /* NAUTILUS_SEARCH_POPOVER_H */
diff --git a/src/nautilus-search-popover.ui b/src/nautilus-search-popover.ui
new file mode 100644
index 0000000..7340eeb
--- /dev/null
+++ b/src/nautilus-search-popover.ui
@@ -0,0 +1,414 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.1 -->
+<interface>
+  <requires lib="gtk+" version="3.16"/>
+  <template class="NautilusSearchPopover" parent="GtkPopover">
+    <property name="can_focus">False</property>
+    <property name="modal">False</property>
+    <child>
+      <object class="GtkGrid" >
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="border_width">18</property>
+        <property name="row_spacing">12</property>
+        <property name="column_spacing">18</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Search</property>
+            <property name="xalign">1</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">When</property>
+            <property name="xalign">1</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Around...</property>
+            <property name="xalign">1</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">What</property>
+            <property name="xalign">1</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">4</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GtkRadioButton" id="full_text_search_button">
+                <property name="label" translatable="yes">Full Text</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Search on the file content and 
name</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="filename_search_button">
+                <property name="label" translatable="yes">File Name</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Search only on the file name</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">False</property>
+                <property name="group">full_text_search_button</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <style>
+              <class name="linked"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkStack" id="date_stack">
+            <property name="can_focus">False</property>
+            <property name="transition_type">crossfade</property>
+            <property name="transition_duration">250</property>
+            <child>
+              <object class="GtkBox" id="box2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkButton" id="select_date_button">
+                    <property name="label" translatable="yes">Select Dates...</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes">Select a date</property>
+                    <property name="hexpand">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="clear_date_button">
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes">Clear the currently selected 
date</property>
+                    <child>
+                      <object class="GtkImage" id="clear_date_button_image">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="icon_name">edit-clear-symbolic</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <style>
+                  <class name="linked"/>
+                </style>
+              </object>
+              <packing>
+                <property name="name">date-button</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="date_entry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="secondary_icon_name">x-office-calendar-symbolic</property>
+                <property name="secondary_icon_tooltip_text" translatable="yes">Show a calendar to select 
the date</property>
+              </object>
+              <packing>
+                <property name="name">date-entry</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label5">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Search Subfolders</property>
+            <property name="xalign">1</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkSwitch" id="recursive_switch">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="tooltip_text" translatable="yes">When on, the search will be performed on 
subfolders of the current folder</property>
+            <property name="halign">start</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkStack" id="around_stack">
+            <property name="can_focus">False</property>
+            <property name="vhomogeneous">False</property>
+            <property name="transition_type">crossfade</property>
+            <property name="transition_duration">250</property>
+            <child>
+              <object class="GtkGrid">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="row_spacing">12</property>
+                <property name="column_spacing">12</property>
+                <child>
+                  <object class="GtkScrolledWindow">
+                    <property name="height_request">200</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="shadow_type">in</property>
+                    <child>
+                      <object class="GtkViewport">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkListBox" id="dates_listbox">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="last_modified_button">
+                    <property name="label" translatable="yes">Last modified</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="xalign">0</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="last_used_button">
+                    <property name="label" translatable="yes">Last used</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="xalign">0</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="group">last_modified_button</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="name">date-list</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCalendar" id="calendar">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="valign">start</property>
+                <property name="year">2015</property>
+                <property name="month">8</property>
+                <property name="day">30</property>
+                <property name="show_week_numbers">True</property>
+              </object>
+              <packing>
+                <property name="name">date-calendar</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkStack" id="type_stack">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="vhomogeneous">False</property>
+            <property name="transition_type">crossfade</property>
+            <property name="transition_duration">250</property>
+            <child>
+              <object class="GtkButton" id="select_type_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="tooltip_text" translatable="yes">Which file types will be searched</property>
+                <signal name="clicked" handler="select_type_button_clicked" object="NautilusSearchPopover" 
swapped="no" />
+                <child>
+                  <object class="GtkBox">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkLabel" id="type_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="label" translatable="yes">Anything</property>
+                        <property name="width_chars">30</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkImage">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="icon_name">pan-down-symbolic</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="name">type-button</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow">
+                <property name="height_request">250</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkViewport">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkListBox" id="type_listbox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="selection_mode">none</property>
+                        <signal name="row-activated" handler="types_listbox_row_activated" 
object="NautilusSearchPopover" swapped="no" />
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="name">type-list</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">4</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+    </child>
+  </template>
+  <object class="GtkSizeGroup" id="radio_buttons_sizegroup">
+    <property name="mode">vertical</property>
+    <property name="ignore_hidden">True</property>
+    <widgets>
+      <widget name="full_text_search_button"/>
+      <widget name="filename_search_button"/>
+      <widget name="select_date_button"/>
+      <widget name="clear_date_button"/>
+    </widgets>
+  </object>
+</interface>
diff --git a/src/nautilus.gresource.xml b/src/nautilus.gresource.xml
index 6382501..2b63d27 100644
--- a/src/nautilus.gresource.xml
+++ b/src/nautilus.gresource.xml
@@ -3,6 +3,7 @@
   <gresource prefix="/org/gnome/nautilus">
     <file compressed="true">nautilus-bookmarks-window.ui</file>
     <file compressed="true">nautilus-file-management-properties.ui</file>
+    <file compressed="true">nautilus-search-popover.ui</file>
     <file>nautilus-app-menu.ui</file>
     <file>nautilus-pathbar-context-menu.xml</file>
     <file>nautilus-toolbar-ui.xml</file>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]