summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog33
-rw-r--r--libnautilus-extensions/Makefile.am2
-rw-r--r--libnautilus-extensions/nautilus-dateedit-extensions.c58
-rw-r--r--libnautilus-extensions/nautilus-dateedit-extensions.h31
-rw-r--r--libnautilus-extensions/nautilus-search-bar-criterion-private.h3
-rw-r--r--libnautilus-extensions/nautilus-search-bar-criterion.c91
-rw-r--r--libnautilus-extensions/nautilus-search-bar-criterion.h2
-rw-r--r--libnautilus-extensions/nautilus-search-uri.c60
-rw-r--r--libnautilus-private/Makefile.am2
-rw-r--r--libnautilus-private/nautilus-dateedit-extensions.c58
-rw-r--r--libnautilus-private/nautilus-dateedit-extensions.h31
-rw-r--r--libnautilus-private/nautilus-search-bar-criterion-private.h3
-rw-r--r--libnautilus-private/nautilus-search-bar-criterion.c91
-rw-r--r--libnautilus-private/nautilus-search-bar-criterion.h2
-rw-r--r--libnautilus-private/nautilus-search-uri.c60
-rw-r--r--src/file-manager/nautilus-indexing-info.c8
-rw-r--r--src/nautilus-complex-search-bar.c18
17 files changed, 439 insertions, 114 deletions
diff --git a/ChangeLog b/ChangeLog
index b09029a89..06f41278b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2000-08-25 Rebecca Schulman <rebecka@eazel.com>
+
+ Fixed bug 2071 to improve the date modified search
+ criterion. Also, an change to the indexing info dialog
+ because of a change in the medusa search service API
+
+ * libnautilus-extensions/nautilus-dateedit-extensions.c:
+ (nautilus_gnome_date_edit_get_date_as_string):
+ * libnautilus-extensions/nautilus-dateedit-extensions.h:
+ * libnautilus-extensions/Makefile.am:
+ An extra addition to the gnome dateedit widget we need for
+ the modified search criterion
+
+ * src/nautilus-complex-search-bar.c:
+ (nautilus_complex_search_bar_get_location),
+ (attach_criterion_to_search_bar):
+ * libnautilus-extensions/nautilus-search-bar-criterion-private.h:
+ * libnautilus-extensions/nautilus-search-bar-criterion.c:
+ * libnautilus-extensions/nautilus-search-bar-criterion.h:
+ (nautilus_search_bar_criterion_new_from_values),
+ (nautilus_search_bar_criterion_next_new),
+ (nautilus_search_bar_criterion_get_location),
+ (get_date_modified_location_for):
+ Changed date modified bar to take a date edit widget
+ instead of an entry or menu, and parse the operatory coorectly
+
+
+ * src/file-manager/nautilus-indexing-info.c:
+ (nautilus_indexing_info_show_dialog):
+ Changed because medusa api was updated
+
+
2000-08-25 J Shane Culpepper <pepper@eazel.com>
@@ -22,6 +54,7 @@
through all the exit code, then does an exec() on itself instead
of exit().
+>>>>>>> 1.1527
2000-08-25 John Sullivan <sullivan@eazel.com>
Fixed bug 1782 (File->Open after opening a folder crashes)
diff --git a/libnautilus-extensions/Makefile.am b/libnautilus-extensions/Makefile.am
index 8bb6b497d..0329596af 100644
--- a/libnautilus-extensions/Makefile.am
+++ b/libnautilus-extensions/Makefile.am
@@ -51,6 +51,7 @@ libnautilus_extensions_la_SOURCES = \
nautilus-buffered-widget.c \
nautilus-caption-table.c \
nautilus-caption.c \
+ nautilus-dateedit-extensions.c \
nautilus-debug.c \
nautilus-default-file-icon.c \
nautilus-directory-async.c \
@@ -133,6 +134,7 @@ noinst_HEADERS = \
nautilus-caption-table.h \
nautilus-caption.h \
nautilus-cdrom-extensions.h \
+ nautilus-dateedit-extensions.h \
nautilus-debug.h \
nautilus-default-file-icon.h \
nautilus-directory-background.h \
diff --git a/libnautilus-extensions/nautilus-dateedit-extensions.c b/libnautilus-extensions/nautilus-dateedit-extensions.c
new file mode 100644
index 000000000..48fb60818
--- /dev/null
+++ b/libnautilus-extensions/nautilus-dateedit-extensions.c
@@ -0,0 +1,58 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* nautilus-dateedit-extensions.c -- Extension functions to the gnome-dateedit
+ widget
+
+ Copyright (C) 2000 Eazel, Inc.
+
+ 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 2 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; see the file COPYING. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Author: Rebecca Schulman <rebecka@eazel.com>
+*/
+
+#include <stdio.h>
+#include <time.h>
+
+#include <libgnomeui/gnome-dateedit.h>
+
+#include "nautilus-dateedit-extensions.h"
+
+char *
+nautilus_gnome_date_edit_get_date_as_string (GnomeDateEdit *dateedit)
+{
+ struct tm *time_struct;
+ time_t selected_time;
+ int day, month, year;
+ char *date_string;
+
+ selected_time = gnome_date_edit_get_date (dateedit);
+ if (selected_time < 0) {
+ printf ("That was no good\n");
+ return NULL;
+ }
+ time_struct = localtime (&selected_time);
+
+ day = time_struct->tm_mday;
+ month = time_struct->tm_mon;
+ year = time_struct->tm_year;
+
+ date_string = g_strdup_printf ("%d/%d/%d", month + 1, day, year + 1900);
+ printf ("returning date %s\n", date_string);
+ return date_string;
+
+
+
+}
diff --git a/libnautilus-extensions/nautilus-dateedit-extensions.h b/libnautilus-extensions/nautilus-dateedit-extensions.h
new file mode 100644
index 000000000..01bc6ef66
--- /dev/null
+++ b/libnautilus-extensions/nautilus-dateedit-extensions.h
@@ -0,0 +1,31 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* nautilus-dateedit-extensions.h -- Extension functions to the gnome-dateedit
+ widget
+
+ Copyright (C) 2000 Eazel, Inc.
+
+ 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 2 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; see the file COPYING. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Author: Rebecca Schulman <rebecka@eazel.com>
+*/
+
+/* This is annoying, but someone forgot it in the gnome-dateedit header, so it has to be here.
+ A bug report about this has been submitted. */
+#include <time.h>
+#include <libgnomeui/gnome-dateedit.h>
+
+char * nautilus_gnome_date_edit_get_date_as_string (GnomeDateEdit *dateedit);
diff --git a/libnautilus-extensions/nautilus-search-bar-criterion-private.h b/libnautilus-extensions/nautilus-search-bar-criterion-private.h
index 464a984ff..9f23a8641 100644
--- a/libnautilus-extensions/nautilus-search-bar-criterion-private.h
+++ b/libnautilus-extensions/nautilus-search-bar-criterion-private.h
@@ -31,6 +31,8 @@
#include <gtk/gtkentry.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkoptionmenu.h>
+#include <time.h>
+#include <libgnomeui/gnome-dateedit.h>
struct NautilusSearchBarCriterionDetails {
NautilusSearchBarCriterionType type;
@@ -44,6 +46,7 @@ struct NautilusSearchBarCriterionDetails {
GtkOptionMenu *value_menu;
gboolean use_value_suffix;
GtkLabel *value_suffix;
+ GnomeDateEdit *date;
/* callback to be called when the criterion type changes */
NautilusSearchBarCriterionCallback callback;
diff --git a/libnautilus-extensions/nautilus-search-bar-criterion.c b/libnautilus-extensions/nautilus-search-bar-criterion.c
index 315e3a842..89b2276c3 100644
--- a/libnautilus-extensions/nautilus-search-bar-criterion.c
+++ b/libnautilus-extensions/nautilus-search-bar-criterion.c
@@ -24,12 +24,14 @@
Author: Rebecca Schulman <rebecka@eazel.com>
*/
+#include "nautilus-dateedit-extensions.h"
#include "nautilus-gtk-macros.h"
#include "nautilus-search-bar-criterion.h"
#include "nautilus-search-bar-criterion-private.h"
#include <stdio.h>
#include <stdlib.h>
+#include <time.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkentry.h>
@@ -41,6 +43,7 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-utils.h>
+#include <libgnomeui/gnome-dateedit.h>
#include <libgnomeui/gnome-uidefs.h>
static char * criteria_titles [] = {
@@ -118,17 +121,19 @@ static char *emblem_objects [] = {
};
static char *modified_relations [] = {
- N_("after"),
- N_("before"),
+ N_("is"),
+ N_("is not"),
+ N_("is after"),
+ N_("is before"),
+ N_("--"),
+ N_("is today"),
+ N_("is yesterday"),
+ N_("--"),
+ N_("is within a week of"),
+ N_("is within a month of"),
NULL
};
-static char *modified_objects [] = {
- N_("today"),
- N_("this week"),
- N_("this month"),
- NULL
-};
static char *owner_relations [] = {
N_("is"),
@@ -159,7 +164,7 @@ static char * get_size_location_for
static char * get_emblem_location_for (int relation_number,
int value_number);
static char * get_date_modified_location_for (int relation_number,
- int value_number);
+ char *date);
static char * get_owner_location_for (int relation_number,
char *owner_number);
@@ -292,6 +297,11 @@ nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType ty
criterion->details->value_suffix = GTK_LABEL (gtk_label_new (value_suffix));
gtk_widget_show_all (GTK_WIDGET (criterion->details->value_suffix));
}
+ /* Special case widgets here */
+ if (criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION) {
+ criterion->details->date = GNOME_DATE_EDIT (gnome_date_edit_new (time (NULL), FALSE, FALSE));
+ gtk_widget_show_all (GTK_WIDGET (criterion->details->date));
+ }
return criterion;
}
@@ -363,8 +373,8 @@ nautilus_search_bar_criterion_next_new (NautilusSearchBarCriterionType criterion
new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION,
modified_relations,
FALSE,
- TRUE,
- modified_objects,
+ FALSE,
+ NULL,
FALSE,
NULL);
break;
@@ -428,14 +438,17 @@ nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterio
menu_item = gtk_menu_get_active (GTK_MENU (menu));
value_number = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu_item), "type"));
}
- else {
+ else if (criterion->details->use_value_entry) {
value_text = gtk_entry_get_text (GTK_ENTRY (criterion->details->value_entry));
}
+ else if (criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION) {
+ value_text = nautilus_gnome_date_edit_get_date_as_string (criterion->details->date);
+ }
switch (name_number) {
case NAUTILUS_FILE_NAME_SEARCH_CRITERION:
return get_name_location_for (relation_number,
- value_text);
+ value_text);
case NAUTILUS_CONTENT_SEARCH_CRITERION:
return get_content_location_for (relation_number,
value_text);
@@ -450,7 +463,7 @@ nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterio
value_number);
case NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION:
return get_date_modified_location_for (relation_number,
- value_number);
+ value_text);
case NAUTILUS_OWNER_SEARCH_CRITERION:
return get_owner_location_for (relation_number,
value_text);
@@ -458,7 +471,9 @@ nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterio
g_assert_not_reached ();
return NULL;
}
- return g_strdup ("file_name contains evolution ");
+
+ g_assert_not_reached ();
+ return NULL;
}
@@ -630,19 +645,43 @@ get_emblem_location_for (int relation_number,
static char *
get_date_modified_location_for (int relation_number,
- int value_number)
+ char *date_string)
{
- const char *possible_relations[] = { "updated", "not_updated" };
- const char *possible_values[] = { "today", "this_week", "this_month" };
-
- g_assert (relation_number == 0 || relation_number == 1);
- g_assert (value_number >= 0);
- g_assert (value_number < 3);
-
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED,
- possible_relations[relation_number],
- possible_values[value_number]);
+ const char *possible_relations[] = { "is",
+ "is_not",
+ "is_after",
+ "is_before",
+ "--",
+ "is today",
+ "is yesterday",
+ "--",
+ "is_within_a_week_of",
+ "is_within_a_month_of" };
+ char *result;
+ g_assert (relation_number >= 0);
+ g_assert (relation_number < 10);
+ g_return_val_if_fail (relation_number != 4 && relation_number != 7, g_strdup (""));
+
+ /* Handle "is today" and "is yesterday" separately */
+ if (relation_number == 5) {
+ result = g_strdup_printf ("%s is today", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED);
+ }
+ if (relation_number == 6) {
+ result = g_strdup_printf ("%s is yesterday", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED);
+ }
+ if (relation_number != 5 && relation_number != 6) {
+ if (date_string == NULL) {
+ return g_strdup ("");
+ }
+ else {
+ result = g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED,
+ possible_relations[relation_number],
+ date_string);
+ }
+ }
+ return result;
+
}
static char *
diff --git a/libnautilus-extensions/nautilus-search-bar-criterion.h b/libnautilus-extensions/nautilus-search-bar-criterion.h
index 9ffa5cfd7..f535794ab 100644
--- a/libnautilus-extensions/nautilus-search-bar-criterion.h
+++ b/libnautilus-extensions/nautilus-search-bar-criterion.h
@@ -49,7 +49,7 @@ typedef enum {
#define NAUTILUS_SEARCH_URI_TEXT_TYPE "file_type"
#define NAUTILUS_SEARCH_URI_TEXT_SIZE "size"
#define NAUTILUS_SEARCH_URI_TEXT_EMBLEMS "emblem"
-#define NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED "mod_time"
+#define NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED "modified"
#define NAUTILUS_SEARCH_URI_TEXT_OWNER "owner"
typedef struct NautilusSearchBarCriterionDetails NautilusSearchBarCriterionDetails;
diff --git a/libnautilus-extensions/nautilus-search-uri.c b/libnautilus-extensions/nautilus-search-uri.c
index bcc91e6ce..553b5ce3c 100644
--- a/libnautilus-extensions/nautilus-search-uri.c
+++ b/libnautilus-extensions/nautilus-search-uri.c
@@ -32,7 +32,7 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-utils.h>
-static const char * strip_uri_begenning (const char *location_uri);
+static const char * strip_uri_beginning (const char *location_uri);
static GSList * tokenize_uri (const char *string);
static char * get_translated_criterion (const GSList *criterion);
static char * get_first_criterion_prefix (GSList *criterion);
@@ -43,14 +43,14 @@ static char * parse_uri (const char *search_uri);
static void free_tokenized_uri (GSList *list);
/**
- * strip_uri_begenning:
+ * strip_uri_beginning:
* @location_uri: search uri.
*
* strips the search:[file:///...] part of the input uri.
*
*/
static const char *
-strip_uri_begenning (const char *location_uri)
+strip_uri_beginning (const char *location_uri)
{
char **first_token;
char *ptr;
@@ -62,7 +62,7 @@ strip_uri_begenning (const char *location_uri)
return NULL;
}
- /* parse the first token from the end to the begenning.
+ /* parse the first token from the end to the beginning.
to extract the search:[] part.
*/
for (ptr = first_token[0]+strlen(first_token[0]);
@@ -127,7 +127,7 @@ tokenize_uri (const char *string)
criterion_list = NULL;
- string = strip_uri_begenning (string);
+ string = strip_uri_beginning (string);
if (string == NULL) {
return NULL;
}
@@ -200,22 +200,22 @@ struct _value_criterion_item {
static operand_criterion_item file_name2_table [] = {
{"contains",
- N_("name contains \"%s\""),
+ N_("that contain \"%s\""),
NULL},
{"starts_with",
- N_("name starts with \"%s\""),
+ N_("that start with \"%s\""),
NULL},
{"ends_with",
- "name ends with %s",
+ N_("that end with %s"),
NULL},
{"does_not_contain",
- N_("name does not contain \"%s\""),
+ N_("that don't contain \"%s\""),
NULL},
{"regexp_matches",
- N_("name matches regexp \"%s\""),
+ N_("that match the regular expression \"%s\""),
NULL},
{"matches",
- N_("name matches glob \"%s\""),
+ N_("that match the file pattern \"%s\""),
NULL},
{NULL, NULL, NULL}
@@ -257,17 +257,17 @@ static operand_criterion_item file_type2_table [] = {
*/
static operand_criterion_item owner2_table [] = {
{"is_not",
- N_("owner is not \"%s\""),
+ N_("are not owned by \"%s\""),
NULL},
{"is",
- N_("owner is \"%s\""),
+ N_("are owned by \"%s\""),
NULL},
/* folowing ones are not supported by Nautilus UI */
{"has_uid",
- N_("owner has uid of \"%s\""),
+ N_("have owner UID \"%s\""),
NULL},
{"does_not_have_uid",
- N_("does not have UID"),
+ N_("have owner UID other than \"%s\""),
NULL},
{NULL, NULL, NULL}
};
@@ -278,13 +278,13 @@ static operand_criterion_item owner2_table [] = {
*/
static operand_criterion_item size2_table [] = {
{"larger_than",
- N_("size is larger than %s bytes"),
+ N_("that are larger than %s kilobytes"),
NULL},
{"smaller_than",
- N_("size is smaller than %s bytes"),
+ N_("that are smaller than %s kilobytes"),
NULL},
{"is",
- N_("size is %s kilobytes"),
+ N_("that are %s kilobytes"),
NULL},
{NULL, NULL, NULL}
};
@@ -295,10 +295,10 @@ static operand_criterion_item size2_table [] = {
*/
static operand_criterion_item mod_time2_table [] = {
{"updated",
- N_("after"),
+ N_("modified after"),
NULL},
{"not_updated",
- N_("before"),
+ N_("modified before"),
NULL},
{NULL, NULL, NULL}
};
@@ -321,6 +321,12 @@ static operand_criterion_item emblem2_table [] = {
/* FIXME: I cannot find any doc on this one */
static operand_criterion_item contains2_table [] = {
+ {"includes",
+ N_("with the word"),
+ NULL},
+ {"does_not_include",
+ N_("without the word"),
+ NULL},
{NULL, NULL, NULL},
};
@@ -333,24 +339,24 @@ static operand_criterion_item contains2_table [] = {
static field_criterion_item main_table[] = {
{"file_name",
- N_("whose"),
+ N_(""),
file_name2_table},
{"file_type",
- N_("who"),
+ N_("that"),
file_type2_table},
{"owner",
- N_("whose"),
+ N_(""),
owner2_table},
{"size",
- N_("whose"),
+ N_(""),
size2_table},
/* FIXME: waiting for doc */
{"contains",
- N_("who"),
+ N_(""),
contains2_table},
/* FIXME: waiting for spec */
{"mod_time",
- N_("whose"),
+ N_(""),
mod_time2_table},
/* FIXME: waiting for implementation */
{"emblem",
@@ -614,12 +620,10 @@ nautilus_search_uri_to_human (const char *search_uri)
uri = gnome_vfs_unescape_string_for_display (search_uri);
human = parse_uri (uri);
if (human == NULL) {
- /* g_print ("mathieu: %s\n", uri); */
return uri;
}
g_free (uri);
- /* g_print ("mathieu: %s\n", human); */
return human;
}
diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am
index 8bb6b497d..0329596af 100644
--- a/libnautilus-private/Makefile.am
+++ b/libnautilus-private/Makefile.am
@@ -51,6 +51,7 @@ libnautilus_extensions_la_SOURCES = \
nautilus-buffered-widget.c \
nautilus-caption-table.c \
nautilus-caption.c \
+ nautilus-dateedit-extensions.c \
nautilus-debug.c \
nautilus-default-file-icon.c \
nautilus-directory-async.c \
@@ -133,6 +134,7 @@ noinst_HEADERS = \
nautilus-caption-table.h \
nautilus-caption.h \
nautilus-cdrom-extensions.h \
+ nautilus-dateedit-extensions.h \
nautilus-debug.h \
nautilus-default-file-icon.h \
nautilus-directory-background.h \
diff --git a/libnautilus-private/nautilus-dateedit-extensions.c b/libnautilus-private/nautilus-dateedit-extensions.c
new file mode 100644
index 000000000..48fb60818
--- /dev/null
+++ b/libnautilus-private/nautilus-dateedit-extensions.c
@@ -0,0 +1,58 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* nautilus-dateedit-extensions.c -- Extension functions to the gnome-dateedit
+ widget
+
+ Copyright (C) 2000 Eazel, Inc.
+
+ 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 2 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; see the file COPYING. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Author: Rebecca Schulman <rebecka@eazel.com>
+*/
+
+#include <stdio.h>
+#include <time.h>
+
+#include <libgnomeui/gnome-dateedit.h>
+
+#include "nautilus-dateedit-extensions.h"
+
+char *
+nautilus_gnome_date_edit_get_date_as_string (GnomeDateEdit *dateedit)
+{
+ struct tm *time_struct;
+ time_t selected_time;
+ int day, month, year;
+ char *date_string;
+
+ selected_time = gnome_date_edit_get_date (dateedit);
+ if (selected_time < 0) {
+ printf ("That was no good\n");
+ return NULL;
+ }
+ time_struct = localtime (&selected_time);
+
+ day = time_struct->tm_mday;
+ month = time_struct->tm_mon;
+ year = time_struct->tm_year;
+
+ date_string = g_strdup_printf ("%d/%d/%d", month + 1, day, year + 1900);
+ printf ("returning date %s\n", date_string);
+ return date_string;
+
+
+
+}
diff --git a/libnautilus-private/nautilus-dateedit-extensions.h b/libnautilus-private/nautilus-dateedit-extensions.h
new file mode 100644
index 000000000..01bc6ef66
--- /dev/null
+++ b/libnautilus-private/nautilus-dateedit-extensions.h
@@ -0,0 +1,31 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* nautilus-dateedit-extensions.h -- Extension functions to the gnome-dateedit
+ widget
+
+ Copyright (C) 2000 Eazel, Inc.
+
+ 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 2 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; see the file COPYING. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Author: Rebecca Schulman <rebecka@eazel.com>
+*/
+
+/* This is annoying, but someone forgot it in the gnome-dateedit header, so it has to be here.
+ A bug report about this has been submitted. */
+#include <time.h>
+#include <libgnomeui/gnome-dateedit.h>
+
+char * nautilus_gnome_date_edit_get_date_as_string (GnomeDateEdit *dateedit);
diff --git a/libnautilus-private/nautilus-search-bar-criterion-private.h b/libnautilus-private/nautilus-search-bar-criterion-private.h
index 464a984ff..9f23a8641 100644
--- a/libnautilus-private/nautilus-search-bar-criterion-private.h
+++ b/libnautilus-private/nautilus-search-bar-criterion-private.h
@@ -31,6 +31,8 @@
#include <gtk/gtkentry.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkoptionmenu.h>
+#include <time.h>
+#include <libgnomeui/gnome-dateedit.h>
struct NautilusSearchBarCriterionDetails {
NautilusSearchBarCriterionType type;
@@ -44,6 +46,7 @@ struct NautilusSearchBarCriterionDetails {
GtkOptionMenu *value_menu;
gboolean use_value_suffix;
GtkLabel *value_suffix;
+ GnomeDateEdit *date;
/* callback to be called when the criterion type changes */
NautilusSearchBarCriterionCallback callback;
diff --git a/libnautilus-private/nautilus-search-bar-criterion.c b/libnautilus-private/nautilus-search-bar-criterion.c
index 315e3a842..89b2276c3 100644
--- a/libnautilus-private/nautilus-search-bar-criterion.c
+++ b/libnautilus-private/nautilus-search-bar-criterion.c
@@ -24,12 +24,14 @@
Author: Rebecca Schulman <rebecka@eazel.com>
*/
+#include "nautilus-dateedit-extensions.h"
#include "nautilus-gtk-macros.h"
#include "nautilus-search-bar-criterion.h"
#include "nautilus-search-bar-criterion-private.h"
#include <stdio.h>
#include <stdlib.h>
+#include <time.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkentry.h>
@@ -41,6 +43,7 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-utils.h>
+#include <libgnomeui/gnome-dateedit.h>
#include <libgnomeui/gnome-uidefs.h>
static char * criteria_titles [] = {
@@ -118,17 +121,19 @@ static char *emblem_objects [] = {
};
static char *modified_relations [] = {
- N_("after"),
- N_("before"),
+ N_("is"),
+ N_("is not"),
+ N_("is after"),
+ N_("is before"),
+ N_("--"),
+ N_("is today"),
+ N_("is yesterday"),
+ N_("--"),
+ N_("is within a week of"),
+ N_("is within a month of"),
NULL
};
-static char *modified_objects [] = {
- N_("today"),
- N_("this week"),
- N_("this month"),
- NULL
-};
static char *owner_relations [] = {
N_("is"),
@@ -159,7 +164,7 @@ static char * get_size_location_for
static char * get_emblem_location_for (int relation_number,
int value_number);
static char * get_date_modified_location_for (int relation_number,
- int value_number);
+ char *date);
static char * get_owner_location_for (int relation_number,
char *owner_number);
@@ -292,6 +297,11 @@ nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType ty
criterion->details->value_suffix = GTK_LABEL (gtk_label_new (value_suffix));
gtk_widget_show_all (GTK_WIDGET (criterion->details->value_suffix));
}
+ /* Special case widgets here */
+ if (criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION) {
+ criterion->details->date = GNOME_DATE_EDIT (gnome_date_edit_new (time (NULL), FALSE, FALSE));
+ gtk_widget_show_all (GTK_WIDGET (criterion->details->date));
+ }
return criterion;
}
@@ -363,8 +373,8 @@ nautilus_search_bar_criterion_next_new (NautilusSearchBarCriterionType criterion
new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION,
modified_relations,
FALSE,
- TRUE,
- modified_objects,
+ FALSE,
+ NULL,
FALSE,
NULL);
break;
@@ -428,14 +438,17 @@ nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterio
menu_item = gtk_menu_get_active (GTK_MENU (menu));
value_number = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu_item), "type"));
}
- else {
+ else if (criterion->details->use_value_entry) {
value_text = gtk_entry_get_text (GTK_ENTRY (criterion->details->value_entry));
}
+ else if (criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION) {
+ value_text = nautilus_gnome_date_edit_get_date_as_string (criterion->details->date);
+ }
switch (name_number) {
case NAUTILUS_FILE_NAME_SEARCH_CRITERION:
return get_name_location_for (relation_number,
- value_text);
+ value_text);
case NAUTILUS_CONTENT_SEARCH_CRITERION:
return get_content_location_for (relation_number,
value_text);
@@ -450,7 +463,7 @@ nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterio
value_number);
case NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION:
return get_date_modified_location_for (relation_number,
- value_number);
+ value_text);
case NAUTILUS_OWNER_SEARCH_CRITERION:
return get_owner_location_for (relation_number,
value_text);
@@ -458,7 +471,9 @@ nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterio
g_assert_not_reached ();
return NULL;
}
- return g_strdup ("file_name contains evolution ");
+
+ g_assert_not_reached ();
+ return NULL;
}
@@ -630,19 +645,43 @@ get_emblem_location_for (int relation_number,
static char *
get_date_modified_location_for (int relation_number,
- int value_number)
+ char *date_string)
{
- const char *possible_relations[] = { "updated", "not_updated" };
- const char *possible_values[] = { "today", "this_week", "this_month" };
-
- g_assert (relation_number == 0 || relation_number == 1);
- g_assert (value_number >= 0);
- g_assert (value_number < 3);
-
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED,
- possible_relations[relation_number],
- possible_values[value_number]);
+ const char *possible_relations[] = { "is",
+ "is_not",
+ "is_after",
+ "is_before",
+ "--",
+ "is today",
+ "is yesterday",
+ "--",
+ "is_within_a_week_of",
+ "is_within_a_month_of" };
+ char *result;
+ g_assert (relation_number >= 0);
+ g_assert (relation_number < 10);
+ g_return_val_if_fail (relation_number != 4 && relation_number != 7, g_strdup (""));
+
+ /* Handle "is today" and "is yesterday" separately */
+ if (relation_number == 5) {
+ result = g_strdup_printf ("%s is today", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED);
+ }
+ if (relation_number == 6) {
+ result = g_strdup_printf ("%s is yesterday", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED);
+ }
+ if (relation_number != 5 && relation_number != 6) {
+ if (date_string == NULL) {
+ return g_strdup ("");
+ }
+ else {
+ result = g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED,
+ possible_relations[relation_number],
+ date_string);
+ }
+ }
+ return result;
+
}
static char *
diff --git a/libnautilus-private/nautilus-search-bar-criterion.h b/libnautilus-private/nautilus-search-bar-criterion.h
index 9ffa5cfd7..f535794ab 100644
--- a/libnautilus-private/nautilus-search-bar-criterion.h
+++ b/libnautilus-private/nautilus-search-bar-criterion.h
@@ -49,7 +49,7 @@ typedef enum {
#define NAUTILUS_SEARCH_URI_TEXT_TYPE "file_type"
#define NAUTILUS_SEARCH_URI_TEXT_SIZE "size"
#define NAUTILUS_SEARCH_URI_TEXT_EMBLEMS "emblem"
-#define NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED "mod_time"
+#define NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED "modified"
#define NAUTILUS_SEARCH_URI_TEXT_OWNER "owner"
typedef struct NautilusSearchBarCriterionDetails NautilusSearchBarCriterionDetails;
diff --git a/libnautilus-private/nautilus-search-uri.c b/libnautilus-private/nautilus-search-uri.c
index bcc91e6ce..553b5ce3c 100644
--- a/libnautilus-private/nautilus-search-uri.c
+++ b/libnautilus-private/nautilus-search-uri.c
@@ -32,7 +32,7 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-utils.h>
-static const char * strip_uri_begenning (const char *location_uri);
+static const char * strip_uri_beginning (const char *location_uri);
static GSList * tokenize_uri (const char *string);
static char * get_translated_criterion (const GSList *criterion);
static char * get_first_criterion_prefix (GSList *criterion);
@@ -43,14 +43,14 @@ static char * parse_uri (const char *search_uri);
static void free_tokenized_uri (GSList *list);
/**
- * strip_uri_begenning:
+ * strip_uri_beginning:
* @location_uri: search uri.
*
* strips the search:[file:///...] part of the input uri.
*
*/
static const char *
-strip_uri_begenning (const char *location_uri)
+strip_uri_beginning (const char *location_uri)
{
char **first_token;
char *ptr;
@@ -62,7 +62,7 @@ strip_uri_begenning (const char *location_uri)
return NULL;
}
- /* parse the first token from the end to the begenning.
+ /* parse the first token from the end to the beginning.
to extract the search:[] part.
*/
for (ptr = first_token[0]+strlen(first_token[0]);
@@ -127,7 +127,7 @@ tokenize_uri (const char *string)
criterion_list = NULL;
- string = strip_uri_begenning (string);
+ string = strip_uri_beginning (string);
if (string == NULL) {
return NULL;
}
@@ -200,22 +200,22 @@ struct _value_criterion_item {
static operand_criterion_item file_name2_table [] = {
{"contains",
- N_("name contains \"%s\""),
+ N_("that contain \"%s\""),
NULL},
{"starts_with",
- N_("name starts with \"%s\""),
+ N_("that start with \"%s\""),
NULL},
{"ends_with",
- "name ends with %s",
+ N_("that end with %s"),
NULL},
{"does_not_contain",
- N_("name does not contain \"%s\""),
+ N_("that don't contain \"%s\""),
NULL},
{"regexp_matches",
- N_("name matches regexp \"%s\""),
+ N_("that match the regular expression \"%s\""),
NULL},
{"matches",
- N_("name matches glob \"%s\""),
+ N_("that match the file pattern \"%s\""),
NULL},
{NULL, NULL, NULL}
@@ -257,17 +257,17 @@ static operand_criterion_item file_type2_table [] = {
*/
static operand_criterion_item owner2_table [] = {
{"is_not",
- N_("owner is not \"%s\""),
+ N_("are not owned by \"%s\""),
NULL},
{"is",
- N_("owner is \"%s\""),
+ N_("are owned by \"%s\""),
NULL},
/* folowing ones are not supported by Nautilus UI */
{"has_uid",
- N_("owner has uid of \"%s\""),
+ N_("have owner UID \"%s\""),
NULL},
{"does_not_have_uid",
- N_("does not have UID"),
+ N_("have owner UID other than \"%s\""),
NULL},
{NULL, NULL, NULL}
};
@@ -278,13 +278,13 @@ static operand_criterion_item owner2_table [] = {
*/
static operand_criterion_item size2_table [] = {
{"larger_than",
- N_("size is larger than %s bytes"),
+ N_("that are larger than %s kilobytes"),
NULL},
{"smaller_than",
- N_("size is smaller than %s bytes"),
+ N_("that are smaller than %s kilobytes"),
NULL},
{"is",
- N_("size is %s kilobytes"),
+ N_("that are %s kilobytes"),
NULL},
{NULL, NULL, NULL}
};
@@ -295,10 +295,10 @@ static operand_criterion_item size2_table [] = {
*/
static operand_criterion_item mod_time2_table [] = {
{"updated",
- N_("after"),
+ N_("modified after"),
NULL},
{"not_updated",
- N_("before"),
+ N_("modified before"),
NULL},
{NULL, NULL, NULL}
};
@@ -321,6 +321,12 @@ static operand_criterion_item emblem2_table [] = {
/* FIXME: I cannot find any doc on this one */
static operand_criterion_item contains2_table [] = {
+ {"includes",
+ N_("with the word"),
+ NULL},
+ {"does_not_include",
+ N_("without the word"),
+ NULL},
{NULL, NULL, NULL},
};
@@ -333,24 +339,24 @@ static operand_criterion_item contains2_table [] = {
static field_criterion_item main_table[] = {
{"file_name",
- N_("whose"),
+ N_(""),
file_name2_table},
{"file_type",
- N_("who"),
+ N_("that"),
file_type2_table},
{"owner",
- N_("whose"),
+ N_(""),
owner2_table},
{"size",
- N_("whose"),
+ N_(""),
size2_table},
/* FIXME: waiting for doc */
{"contains",
- N_("who"),
+ N_(""),
contains2_table},
/* FIXME: waiting for spec */
{"mod_time",
- N_("whose"),
+ N_(""),
mod_time2_table},
/* FIXME: waiting for implementation */
{"emblem",
@@ -614,12 +620,10 @@ nautilus_search_uri_to_human (const char *search_uri)
uri = gnome_vfs_unescape_string_for_display (search_uri);
human = parse_uri (uri);
if (human == NULL) {
- /* g_print ("mathieu: %s\n", uri); */
return uri;
}
g_free (uri);
- /* g_print ("mathieu: %s\n", human); */
return human;
}
diff --git a/src/file-manager/nautilus-indexing-info.c b/src/file-manager/nautilus-indexing-info.c
index 4e1ab233e..e4024c969 100644
--- a/src/file-manager/nautilus-indexing-info.c
+++ b/src/file-manager/nautilus-indexing-info.c
@@ -33,8 +33,9 @@
#include <unistd.h>
#include <time.h>
-#include <libmedusa/medusa-search-service.h>
+
#include <libmedusa/medusa-index-service.h>
+#include <libmedusa/medusa-indexed-search.h>
#include "nautilus-indexing-info.h"
@@ -121,7 +122,10 @@ nautilus_indexing_info_show_dialog (void)
char *time_str;
char *label_str;
- if (medusa_search_service_connection_is_available () != GNOME_VFS_OK) {
+ /* FIXME: is it ok to show the index dialog if
+ we can't use the index right now?
+ This assumes not */
+ if (medusa_indexed_search_is_available () != GNOME_VFS_OK) {
GtkWidget *error =
gnome_error_dialog (_("Search service not available"));
gnome_dialog_run (GNOME_DIALOG (error));
diff --git a/src/nautilus-complex-search-bar.c b/src/nautilus-complex-search-bar.c
index 49d2555b0..12c8ec5c9 100644
--- a/src/nautilus-complex-search-bar.c
+++ b/src/nautilus-complex-search-bar.c
@@ -37,6 +37,7 @@
#include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-search-bar-criterion.h>
#include <libnautilus-extensions/nautilus-search-bar-criterion-private.h>
#include <libnautilus-extensions/nautilus-string.h>
@@ -144,6 +145,8 @@ nautilus_complex_search_bar_initialize (NautilusComplexSearchBar *bar)
bar->details->table = GTK_TABLE (gtk_table_new (1, 3, TRUE));
gtk_table_set_col_spacings (bar->details->table,
1);
+ gtk_table_set_row_spacings (bar->details->table,
+ 1);
gtk_container_set_resize_mode (GTK_CONTAINER (bar->details->table),
GTK_RESIZE_IMMEDIATE);
@@ -260,7 +263,12 @@ nautilus_complex_search_bar_get_location (NautilusNavigationBar *navigation_bar)
g_free (criteria_text);
escaped_fragment = gnome_vfs_escape_string (trimmed_fragment);
- search_uri = g_strconcat ("search:", escaped_fragment, NULL);
+ if (nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SEARCH_METHOD, FALSE)) {
+ search_uri = g_strconcat ("search:index-with-backup", escaped_fragment, NULL);
+ }
+ else {
+ search_uri = g_strconcat ("search:index-only", escaped_fragment, NULL);
+ }
g_free (escaped_fragment);
return search_uri;
}
@@ -293,7 +301,8 @@ attach_criterion_to_search_bar (NautilusComplexSearchBar *bar,
GTK_WIDGET (criterion->details->relation_menu),
1, 2, row - 1, row);
g_assert (criterion->details->use_value_entry +
- criterion->details->use_value_menu == 1);
+ criterion->details->use_value_menu == 1 ||
+ criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION);
if (criterion->details->use_value_entry) {
/* If there is a suffix, we want to take the space from
the entry, to keep things neat. So make a box
@@ -328,6 +337,11 @@ attach_criterion_to_search_bar (NautilusComplexSearchBar *bar,
GTK_WIDGET (criterion->details->value_menu),
2, 3, row - 1, row);
}
+ if (criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION) {
+ gtk_table_attach_defaults (bar->details->table,
+ GTK_WIDGET (criterion->details->date),
+ 2, 3, row - 1, row);
+ }
gtk_table_resize (bar->details->table, row, 3);
}