[nautilus/wip/csoriano/search-popover: 16/16] search-popover: use last access and last time



commit bef010e6103414896f773d57413f271f54b72d80
Author: Carlos Soriano <csoriano gnome org>
Date:   Thu Jan 28 15:30:06 2016 +0100

    search-popover: use last access and last time
    
    It was partly unimplemented.

 src/nautilus-query-editor.c                 |    4 ++++
 src/nautilus-search-popover.c               |   23 +++++++++++++++++++++++
 src/resources/ui/nautilus-search-popover.ui |    2 ++
 3 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index 4440711..272c3b8 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -384,6 +384,10 @@ search_popover_changed_cb (NautilusSearchPopover *popover,
                 nautilus_query_set_mime_types (query, data);
                 break;
 
+        case NAUTILUS_SEARCH_FILTER_LAST:
+                nautilus_query_set_search_type (query, GPOINTER_TO_INT (data));
+                break;
+
         default:
                 g_warning ("Search filter type not valid");
                 break;
diff --git a/src/nautilus-search-popover.c b/src/nautilus-search-popover.c
index ee9551e..485efaa 100644
--- a/src/nautilus-search-popover.c
+++ b/src/nautilus-search-popover.c
@@ -40,6 +40,8 @@ struct _NautilusSearchPopover
   GtkWidget          *type_label;
   GtkWidget          *type_listbox;
   GtkWidget          *type_stack;
+  GtkWidget          *last_used_button;
+  GtkWidget          *last_modified_button;
 
   GFile              *location;
   NautilusQuery      *query;
@@ -483,6 +485,24 @@ types_listbox_row_activated (GtkListBox            *listbox,
   gtk_stack_set_visible_child_name (GTK_STACK (popover->type_stack), "type-button");
 }
 
+static void
+search_time_type_changed (GtkToggleButton       *button,
+                          NautilusSearchPopover *popover)
+{
+  NautilusQuerySearchType type = -1;
+
+  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (popover->last_modified_button)))
+    {
+      type = NAUTILUS_QUERY_SEARCH_TYPE_LAST_MODIFIED;
+    }
+  else
+    {
+      type = NAUTILUS_QUERY_SEARCH_TYPE_LAST_ACCESS;
+    }
+
+  g_signal_emit (popover, signals[CHANGED], 0, NAUTILUS_SEARCH_FILTER_LAST, type);
+}
+
 /* Auxiliary methods */
 
 static GtkWidget*
@@ -976,6 +996,8 @@ nautilus_search_popover_class_init (NautilusSearchPopoverClass *klass)
   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_child (widget_class, NautilusSearchPopover, last_used_button);
+  gtk_widget_class_bind_template_child (widget_class, NautilusSearchPopover, last_modified_button);
 
   gtk_widget_class_bind_template_callback (widget_class, calendar_day_selected);
   gtk_widget_class_bind_template_callback (widget_class, clear_date_button_clicked);
@@ -985,6 +1007,7 @@ nautilus_search_popover_class_init (NautilusSearchPopoverClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, select_type_button_clicked);
   gtk_widget_class_bind_template_callback (widget_class, toggle_calendar_icon_clicked);
   gtk_widget_class_bind_template_callback (widget_class, types_listbox_row_activated);
+  gtk_widget_class_bind_template_callback (widget_class, search_time_type_changed);
 }
 
 static void
diff --git a/src/resources/ui/nautilus-search-popover.ui b/src/resources/ui/nautilus-search-popover.ui
index 1e20571..a61a512 100644
--- a/src/resources/ui/nautilus-search-popover.ui
+++ b/src/resources/ui/nautilus-search-popover.ui
@@ -198,6 +198,7 @@
                     <property name="xalign">0</property>
                     <property name="active">True</property>
                     <property name="draw_indicator">True</property>
+                    <signal name="toggled" handler="search_time_type_changed" object="NautilusSearchPopover" 
swapped="no" />
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -213,6 +214,7 @@
                     <property name="xalign">0</property>
                     <property name="draw_indicator">True</property>
                     <property name="group">last_modified_button</property>
+                    <signal name="toggled" handler="search_time_type_changed" object="NautilusSearchPopover" 
swapped="no" />
                   </object>
                   <packing>
                     <property name="left_attach">1</property>


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