summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRebecca Schulman <rebecka@eazel.com>2000-06-28 22:46:25 +0000
committerRebecca Schulman <rebecka@src.gnome.org>2000-06-28 22:46:25 +0000
commit936e97a0de5adbff2d77ed22f85384e9fcb15057 (patch)
tree4cfaea91f7240e884cb52ce29fe8dac4858f0093 /src
parent16f98f7d217e0928622b583d827315b261d309f1 (diff)
downloadnautilus-936e97a0de5adbff2d77ed22f85384e9fcb15057.tar.gz
added ability to add more criterion (still incomplete)
2000-06-28 Rebecca Schulman <rebecka@eazel.com> * libnautilus-extensions/nautilus-search-uri.c: (nautilus_simple_search_criteria_to_search_uri): (add facility to make search uri's from simple search queries ) * src/nautilus-complex-search-bar.c: (nautilus_complex_search_bar_initialize_class), (nautilus_complex_search_bar_initialize), (more_options_callback), (add_file_type_search_criterion_callback), (add_file_name_search_criterion_callback), (add_file_location_search_criterion_callback), (add_content_search_criterion_callback), (add_size_search_criterion_callback), (add_date_modified_search_criterion_callback), (add_notes_search_criterion_callback), (nautilus_complex_search_bar_get_location): added ability to add more criterion (still incomplete) * src/nautilus-complex-search-bar.h: * src/nautilus-search-bar-criterion.c: (nautilus_search_bar_criterion_file_type_new), (nautilus_search_bar_criterion_file_name_new), (nautilus_search_bar_criterion_location_new), (nautilus_search_bar_criterion_content_new), (nautilus_search_bar_criterion_size_new), (nautilus_search_bar_criterion_add_to_search_bar), (nautilus_search_bar_criterion_show): added code to actually create various search button criterion sets. * src/nautilus-search-bar-criterion.h: * src/nautilus-simple-search-bar.c: (nautilus_simple_search_bar_initialize_class), (nautilus_simple_search_bar_get_location), (editable_activated_callback): * src/nautilus-simple-search-bar.h: Updated so that the search location is done correctly. Adjustments to the nautilus-directory should be all that is needed to make all of this stuff work. * src/nautilus-switchable-search-bar.c: (nautilus_switchable_search_bar_initialize), (nautilus_switchable_search_bar_get_location), (nautilus_switchable_search_bar_set_search_controls): Some widget changes, and search get_location calls respective simple or complex search bar get_location functions
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-complex-search-bar.c228
-rw-r--r--src/nautilus-complex-search-bar.h4
-rw-r--r--src/nautilus-search-bar-criterion.c174
-rw-r--r--src/nautilus-search-bar-criterion.h14
-rw-r--r--src/nautilus-simple-search-bar.c7
-rw-r--r--src/nautilus-simple-search-bar.h2
-rw-r--r--src/nautilus-switchable-search-bar.c35
7 files changed, 416 insertions, 48 deletions
diff --git a/src/nautilus-complex-search-bar.c b/src/nautilus-complex-search-bar.c
index ae78c9e84..028dcf284 100644
--- a/src/nautilus-complex-search-bar.c
+++ b/src/nautilus-complex-search-bar.c
@@ -34,21 +34,38 @@
struct NautilusComplexSearchBarDetails {
-
- NautilusSearchBarCriterionList *search_criteria;
+ GtkWidget *hbox;
+ NautilusSearchBarCriterionList *search_criteria;
+ GtkButton *more_options;
+ GtkOptionMenu *more_search_criteria_options;
- gchar *undo_text;
- gboolean undo_registered;
+ gchar *undo_text;
+ gboolean undo_registered;
};
-
-static void nautilus_complex_search_bar_set_search_controls (NautilusSearchBar *bar,
- const char *location);
+static char * nautilus_complex_search_bar_get_location (NautilusComplexSearchBar *bar);
+static char * nautilus_complex_search_bar_get_location (NautilusComplexSearchBar *bar);
static void nautilus_complex_search_bar_initialize_class (NautilusComplexSearchBarClass *class);
static void nautilus_complex_search_bar_initialize (NautilusComplexSearchBar *bar);
static void destroy (GtkObject *object);
+static void more_options_callback (GtkObject *object,
+ gpointer data);
+static void add_file_type_search_criterion_callback (GtkObject *object,
+ gpointer data);
+static void add_file_name_search_criterion_callback (GtkObject *object,
+ gpointer data);
+static void add_file_location_search_criterion_callback (GtkObject *object,
+ gpointer data);
+static void add_content_search_criterion_callback (GtkObject *object,
+ gpointer data);
+static void add_size_search_criterion_callback (GtkObject *object,
+ gpointer data);
+static void add_date_modified_search_criterion_callback (GtkObject *object,
+ gpointer data);
+static void add_notes_search_criterion_callback (GtkObject *object,
+ gpointer data);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusComplexSearchBar, nautilus_complex_search_bar, NAUTILUS_TYPE_SEARCH_BAR)
@@ -64,7 +81,8 @@ nautilus_complex_search_bar_initialize_class (NautilusComplexSearchBarClass *kla
object_class->destroy = destroy;
search_bar_class = NAUTILUS_SEARCH_BAR_CLASS (klass);
- search_bar_class->set_search_controls = nautilus_complex_search_bar_set_search_controls;
+
+ klass->get_location = nautilus_complex_search_bar_get_location;
}
static void
@@ -75,6 +93,8 @@ destroy (GtkObject *object)
}
+
+
static void
nautilus_complex_search_bar_initialize (NautilusComplexSearchBar *bar)
{
@@ -90,25 +110,28 @@ nautilus_complex_search_bar_initialize (NautilusComplexSearchBar *bar)
file_type = nautilus_search_bar_criterion_file_type_new (bar);
nautilus_search_bar_criterion_add_to_search_bar (file_type,
hbox);
+ nautilus_search_bar_criterion_show (file_type);
bar->details->search_criteria = g_list_append (bar->details->search_criteria,
file_type);
-
file_name = nautilus_search_bar_criterion_file_name_new (bar);
nautilus_search_bar_criterion_add_to_search_bar (file_name,
hbox);
bar->details->search_criteria = g_list_append (bar->details->search_criteria,
file_name);
+ nautilus_search_bar_criterion_show (file_name);
+
more_options = gtk_button_new ();
more_options_label = gtk_label_new ("More Options");
+ gtk_signal_connect (GTK_OBJECT (more_options), "pressed",
+ more_options_callback, bar);
gtk_container_add (GTK_CONTAINER (more_options), more_options_label);
-
- gtk_box_pack_start (GTK_BOX (hbox), more_options, TRUE, TRUE, 1);
-
+ bar->details->more_options = GTK_BUTTON (more_options);
+ gtk_box_pack_start (GTK_BOX (hbox), more_options, FALSE, TRUE, 1);
+ bar->details->hbox = hbox;
gtk_container_add (GTK_CONTAINER (bar), hbox);
- gtk_widget_show_all (hbox);
}
@@ -120,8 +143,183 @@ nautilus_complex_search_bar_new (void)
static void
-nautilus_complex_search_bar_set_search_controls (NautilusSearchBar *bar,
- const char *location)
+more_options_callback (GtkObject *object,
+ gpointer data)
+{
+ NautilusComplexSearchBar *bar;
+ GtkWidget *more_options_button;
+ GtkWidget *more_search_criteria_options, *more_search_criteria_values;
+ GtkWidget *file_type_item;
+ GtkWidget *named_item, *located_in_item, *containing_item;
+ GtkWidget *of_size_item, *modified_since_item, *notes_item;
+
+
+ g_return_if_fail (GTK_IS_BUTTON (object));
+ g_return_if_fail (NAUTILUS_IS_COMPLEX_SEARCH_BAR (data));
+
+ bar = NAUTILUS_COMPLEX_SEARCH_BAR (data);
+ more_options_button = GTK_WIDGET (object);
+
+ gtk_widget_hide_all (more_options_button);
+
+ if (bar->details->more_search_criteria_options == NULL) {
+ more_search_criteria_options = gtk_option_menu_new ();
+
+ more_search_criteria_values = gtk_menu_new ();
+
+ file_type_item = gtk_menu_item_new_with_label ("File type");
+ gtk_menu_append (GTK_MENU (more_search_criteria_values),
+ file_type_item);
+ gtk_signal_connect (GTK_OBJECT (file_type_item),
+ "activate",
+ add_file_type_search_criterion_callback,
+ bar);
+
+ named_item = gtk_menu_item_new_with_label ("Named");
+ gtk_menu_append (GTK_MENU (more_search_criteria_values),
+ named_item);
+
+ gtk_signal_connect (GTK_OBJECT (named_item),
+ "activate",
+ add_file_name_search_criterion_callback,
+ bar);
+
+ located_in_item = gtk_menu_item_new_with_label ("Located in");
+ gtk_menu_append (GTK_MENU (more_search_criteria_values),
+ located_in_item);
+
+ gtk_signal_connect (GTK_OBJECT (located_in_item),
+ "activate",
+ add_file_location_search_criterion_callback,
+ bar);
+
+ containing_item = gtk_menu_item_new_with_label ("Containing");
+ gtk_menu_append (GTK_MENU (more_search_criteria_values),
+ containing_item);
+
+ gtk_signal_connect (GTK_OBJECT (containing_item),
+ "activate",
+ add_content_search_criterion_callback,
+ bar);
+
+ of_size_item = gtk_menu_item_new_with_label ("Of Size");
+ gtk_menu_append (GTK_MENU (more_search_criteria_values),
+ of_size_item);
+
+ gtk_signal_connect (GTK_OBJECT (of_size_item),
+ "activate",
+ add_size_search_criterion_callback,
+ bar);
+
+ modified_since_item = gtk_menu_item_new_with_label ("Modified Since");
+ gtk_menu_append (GTK_MENU (more_search_criteria_values),
+ modified_since_item);
+
+ gtk_signal_connect (GTK_OBJECT (modified_since_item),
+ "activate",
+ add_date_modified_search_criterion_callback,
+ bar);
+
+ notes_item = gtk_menu_item_new_with_label ("With Note Containing");
+ gtk_menu_append (GTK_MENU (more_search_criteria_values),
+ notes_item);
+
+ gtk_signal_connect (GTK_OBJECT (notes_item),
+ "activate",
+ add_notes_search_criterion_callback,
+ bar);
+
+
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (more_search_criteria_options),
+ more_search_criteria_values);
+ /* We can use the enum indexes, since the above menu items are
+ in the same order as the enum struct. */
+ gtk_menu_set_active (GTK_MENU (more_search_criteria_values),
+ NAUTILUS_LOCATION_SEARCH_CRITERION);
+
+ gtk_box_pack_start (GTK_BOX (bar->details->hbox),
+ more_search_criteria_options,
+ TRUE, TRUE, 1);
+ bar->details->more_search_criteria_options = GTK_OPTION_MENU (more_search_criteria_options);
+ }
+
+ gtk_widget_show_all (GTK_WIDGET (bar->details->more_search_criteria_options));
+}
+
+
+static void
+add_file_type_search_criterion_callback (GtkObject *object,
+ gpointer data)
+{
+ NautilusComplexSearchBar *bar;
+ NautilusSearchBarCriterion *file_type;
+
+
+ printf ("Entering filetype search callback\n");
+ g_return_if_fail (GTK_IS_MENU_ITEM (object));
+ g_return_if_fail (NAUTILUS_IS_COMPLEX_SEARCH_BAR (data));
+
+ bar = NAUTILUS_COMPLEX_SEARCH_BAR (data);
+
+ gtk_widget_hide_all (GTK_WIDGET (bar->details->more_search_criteria_options));
+
+ file_type = nautilus_search_bar_criterion_file_type_new (bar);
+ nautilus_search_bar_criterion_add_to_search_bar (file_type,
+ bar->details->hbox);
+ nautilus_search_bar_criterion_show (file_type);
+ bar->details->search_criteria = g_list_append (bar->details->search_criteria,
+ file_type);
+ gtk_widget_show_all (GTK_WIDGET (bar->details->more_options));
+}
+
+
+static void
+add_file_name_search_criterion_callback (GtkObject *object,
+ gpointer data)
+{
+ printf ("Entering file name search callback\n");
+}
+
+
+static void
+add_file_location_search_criterion_callback (GtkObject *object,
+ gpointer data)
+{
+ printf ("Entering location callback\n");
+}
+
+static void
+add_content_search_criterion_callback (GtkObject *object,
+ gpointer data)
+{
+ printf ("Entering search criterion search callback\n");
+}
+
+static void
+add_size_search_criterion_callback (GtkObject *object,
+ gpointer data)
+{ printf ("Entering size criterion search callback\n");
+
+}
+
+static void
+add_date_modified_search_criterion_callback (GtkObject *object,
+ gpointer data)
+{
+ printf ("Entering date modified search callback\n");
+}
+
+static void
+add_notes_search_criterion_callback (GtkObject *object,
+ gpointer data)
{
/* FIXME */
}
+
+
+static char *
+nautilus_complex_search_bar_get_location (NautilusComplexSearchBar *bar)
+{
+ return "file:///tmp";
+}
+
diff --git a/src/nautilus-complex-search-bar.h b/src/nautilus-complex-search-bar.h
index cf85b961b..2d5274b8b 100644
--- a/src/nautilus-complex-search-bar.h
+++ b/src/nautilus-complex-search-bar.h
@@ -53,9 +53,7 @@ typedef struct NautilusComplexSearchBar {
typedef struct {
NautilusSearchBarClass parent_class;
- void (*set_search_controls) (NautilusComplexSearchBar *search_bar,
- const char *location);
- void (*get_search_uri) (NautilusComplexSearchBar *search_bar);
+ char* (*get_location) (NautilusComplexSearchBar *search_bar);
} NautilusComplexSearchBarClass;
GtkType nautilus_complex_search_bar_get_type (void);
diff --git a/src/nautilus-search-bar-criterion.c b/src/nautilus-search-bar-criterion.c
index 8a30a4248..5ca052b90 100644
--- a/src/nautilus-search-bar-criterion.c
+++ b/src/nautilus-search-bar-criterion.c
@@ -43,9 +43,9 @@ struct NautilusSearchBarCriterionDetails {
GtkOptionMenu *operator_menu;
gboolean use_value_entry;
- GtkEntry *entry_value;
+ GtkEntry *value_entry;
gboolean use_value_menu;
- GtkOptionMenu *values_available;
+ GtkOptionMenu *value_menu;
};
static void destroy (GtkObject *object);
@@ -108,6 +108,7 @@ nautilus_search_bar_criterion_file_type_new (NautilusComplexSearchBar *bar)
file_type_options = gtk_option_menu_new ();
file_type_menu = gtk_menu_new ();
+ /* FIXME: These need to be configurable in some way */
gtk_menu_append (GTK_MENU (file_type_menu),
gtk_menu_item_new_with_label ("Files"));
gtk_menu_append (GTK_MENU (file_type_menu),
@@ -134,8 +135,8 @@ NautilusSearchBarCriterion *
nautilus_search_bar_criterion_file_name_new (NautilusComplexSearchBar *bar)
{
GtkWidget *new_criterion;
- GtkWidget *intro_label;
NautilusSearchBarCriterion *file_name;
+ GtkWidget *intro_label;
GtkWidget *file_name_menu, *file_name_options, *file_name_entry;
new_criterion = nautilus_search_bar_criterion_new ();
@@ -170,7 +171,7 @@ nautilus_search_bar_criterion_file_name_new (NautilusComplexSearchBar *bar)
file_name->details->use_operator_menu = TRUE;
file_name_entry = gtk_entry_new ();
- file_name->details->entry_value = GTK_ENTRY (file_name_entry);
+ file_name->details->value_entry = GTK_ENTRY (file_name_entry);
file_name->details->use_value_entry = TRUE;
file_name->details->use_value_menu = FALSE;
@@ -178,6 +179,143 @@ nautilus_search_bar_criterion_file_name_new (NautilusComplexSearchBar *bar)
return file_name;
}
+NautilusSearchBarCriterion *
+nautilus_search_bar_criterion_location_new (NautilusComplexSearchBar *bar)
+{
+ GtkWidget *new_criterion;
+ NautilusSearchBarCriterion *location;
+ GtkWidget *intro_label;
+ GtkWidget *location_options, *location_menu;
+
+ new_criterion = nautilus_search_bar_criterion_new ();
+
+ location = NAUTILUS_SEARCH_BAR_CRITERION (new_criterion);
+
+ location->details = g_new0 (NautilusSearchBarCriterionDetails, 1);
+ location->type = NAUTILUS_LOCATION_SEARCH_CRITERION;
+
+ intro_label = gtk_label_new ("in");
+ location->details->intro_label = GTK_LABEL (intro_label);
+ location->details->use_intro_label = TRUE;
+
+ location_options = gtk_option_menu_new ();
+
+ location_menu = gtk_menu_new ();
+ /* FIXME: This is incomplete, and should be configurable */
+ gtk_menu_append (GTK_MENU (location_menu),
+ gtk_menu_item_new_with_label ("My Local Files"));
+ gtk_menu_append (GTK_MENU (location_menu),
+ gtk_menu_item_new_with_label ("This Directory"));
+ gtk_menu_append (GTK_MENU (location_menu),
+ gtk_menu_item_new_with_label ("My Home Directory"));
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (location_options),
+ location_menu);
+
+ location->details->operator_menu = GTK_OPTION_MENU (location_options);
+ location->details->use_operator_menu = TRUE;
+
+ location->details->use_value_entry = FALSE;
+ location->details->use_value_menu = FALSE;
+
+ return location;
+}
+
+NautilusSearchBarCriterion *
+nautilus_search_bar_criterion_content_new (NautilusComplexSearchBar *bar)
+{
+ GtkWidget *new_criterion;
+ NautilusSearchBarCriterion *content;
+ GtkWidget *content_options, *content_menu, *content_entry;
+
+ new_criterion = nautilus_search_bar_criterion_new ();
+
+ content = NAUTILUS_SEARCH_BAR_CRITERION (new_criterion);
+
+ content->details = g_new0 (NautilusSearchBarCriterionDetails, 1);
+ content->type = NAUTILUS_CONTENT_SEARCH_CRITERION;
+
+ content_options = gtk_option_menu_new ();
+
+ content_menu = gtk_menu_new ();
+ gtk_menu_append (GTK_MENU (content_menu),
+ gtk_menu_item_new_with_label ("contains"));
+ gtk_menu_append (GTK_MENU (content_menu),
+ gtk_menu_item_new_with_label ("contains all of"));
+ gtk_menu_append (GTK_MENU (content_menu),
+ gtk_menu_item_new_with_label ("contains any of"));
+ gtk_menu_append (GTK_MENU (content_menu),
+ gtk_menu_item_new_with_label ("does not contain"));
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (content_options),
+ content_menu);
+
+ content->details->operator_menu = GTK_OPTION_MENU (content_options);
+ content->details->use_operator_menu = TRUE;
+
+ content_entry = gtk_entry_new ();
+ content->details->value_entry = GTK_ENTRY (content_entry);
+ content->details->use_value_entry = TRUE;
+
+ content->details->use_value_menu = FALSE;
+
+ return content;
+
+
+}
+
+NautilusSearchBarCriterion *
+nautilus_search_bar_criterion_size_new (NautilusComplexSearchBar *bar)
+{
+ GtkWidget *new_criterion;
+ NautilusSearchBarCriterion *size;
+ GtkWidget *size_options, *size_menu;
+ GtkWidget *size_value_options, *size_value_menu;
+
+ new_criterion = nautilus_search_bar_criterion_new ();
+
+ size = NAUTILUS_SEARCH_BAR_CRITERION (new_criterion);
+
+ size->details = g_new0 (NautilusSearchBarCriterionDetails, 1);
+ size->type = NAUTILUS_SIZE_SEARCH_CRITERION;
+
+ size_options = gtk_option_menu_new ();
+
+ size_menu = gtk_menu_new ();
+ gtk_menu_append (GTK_MENU (size_menu),
+ gtk_menu_item_new_with_label ("larger than"));
+ gtk_menu_append (GTK_MENU (size_menu),
+ gtk_menu_item_new_with_label ("smaller than"));
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (size_options),
+ size_menu);
+
+ size->details->operator_menu = GTK_OPTION_MENU (size_options);
+ size->details->use_operator_menu = TRUE;
+
+ size_value_options = gtk_option_menu_new ();
+
+ size_value_menu = gtk_menu_new ();
+ gtk_menu_append (GTK_MENU (size_value_menu),
+ gtk_menu_item_new_with_label ("1K"));
+ gtk_menu_append (GTK_MENU (size_value_menu),
+ gtk_menu_item_new_with_label ("10K"));
+ gtk_menu_append (GTK_MENU (size_value_menu),
+ gtk_menu_item_new_with_label ("100K"));
+ gtk_menu_append (GTK_MENU (size_value_menu),
+ gtk_menu_item_new_with_label ("1 Meg"));
+ gtk_menu_append (GTK_MENU (size_value_menu),
+ gtk_menu_item_new_with_label ("10 Megs"));
+ gtk_menu_append (GTK_MENU (size_value_menu),
+ gtk_menu_item_new_with_label ("100 Megs"));
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (size_value_options),
+ size_value_menu);
+
+ size->details->value_menu = GTK_OPTION_MENU (size_value_options);
+ size->details->use_value_menu = TRUE;
+
+ size->details->use_value_entry = FALSE;
+
+ return size;
+}
+
void
nautilus_search_bar_criterion_add_to_search_bar (NautilusSearchBarCriterion *criterion,
GtkWidget *hbox)
@@ -187,27 +325,27 @@ nautilus_search_bar_criterion_add_to_search_bar (NautilusSearchBarCriterion *cri
if (criterion->details->use_intro_label) {
gtk_box_pack_start (GTK_BOX (hbox),
GTK_WIDGET (criterion->details->intro_label),
- TRUE,
FALSE,
+ TRUE,
GNOME_PAD_SMALL);
}
if (criterion->details->use_operator_menu) {
gtk_box_pack_start (GTK_BOX (hbox),
GTK_WIDGET (criterion->details->operator_menu),
TRUE,
- FALSE,
+ TRUE,
GNOME_PAD_SMALL);
}
if (criterion->details->use_value_entry) {
gtk_box_pack_start (GTK_BOX (hbox),
- GTK_WIDGET (criterion->details->entry_value),
- TRUE,
+ GTK_WIDGET (criterion->details->value_entry),
FALSE,
+ TRUE,
GNOME_PAD_SMALL);
}
if (criterion->details->use_value_menu) {
gtk_box_pack_start (GTK_BOX (hbox),
- GTK_WIDGET (criterion->details->values_available),
+ GTK_WIDGET (criterion->details->value_menu),
TRUE,
TRUE,
0);
@@ -215,9 +353,21 @@ nautilus_search_bar_criterion_add_to_search_bar (NautilusSearchBarCriterion *cri
}
-
void
-nautilus_search_bar_criterion_add_to_container (GtkContainer *container, NautilusSearchBarCriterion *criterion)
+nautilus_search_bar_criterion_show (NautilusSearchBarCriterion *criterion)
{
-
+ g_return_if_fail (NAUTILUS_IS_SEARCH_BAR_CRITERION (criterion));
+ if (criterion->details->use_intro_label) {
+ gtk_widget_show (GTK_WIDGET (criterion->details->intro_label));
+ }
+ if (criterion->details->use_operator_menu) {
+ gtk_widget_show (GTK_WIDGET (criterion->details->operator_menu));
+ }
+ if (criterion->details->use_value_entry) {
+ gtk_widget_show (GTK_WIDGET (criterion->details->value_entry));
+ }
+ if (criterion->details->use_value_menu) {
+ gtk_widget_show (GTK_WIDGET (criterion->details->value_menu));
+ }
}
+
diff --git a/src/nautilus-search-bar-criterion.h b/src/nautilus-search-bar-criterion.h
index 7287b3c5d..9fe31249e 100644
--- a/src/nautilus-search-bar-criterion.h
+++ b/src/nautilus-search-bar-criterion.h
@@ -48,10 +48,10 @@
typedef enum {
NAUTILUS_FILE_TYPE_SEARCH_CRITERION,
+ NAUTILUS_FILE_NAME_SEARCH_CRITERION,
NAUTILUS_LOCATION_SEARCH_CRITERION,
NAUTILUS_CONTENT_SEARCH_CRITERION,
NAUTILUS_SIZE_SEARCH_CRITERION,
- NAUTILUS_FILE_NAME_SEARCH_CRITERION,
NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION,
NAUTILUS_NOTES_SEARCH_CRITERION
} NautilusSearchBarCriterionType;
@@ -81,8 +81,12 @@ void nautilus_search_bar_criterion_add_to_search_bar
(NautilusSearchBarCriterion *criterion,
GtkWidget *hbox);
NautilusSearchBarCriterion * nautilus_search_bar_criterion_file_name_new (NautilusComplexSearchBar *bar);
-
-void nautilus_search_bar_criterion_add_to_container (GtkContainer *container,
- NautilusSearchBarCriterion *criterion);
-
+NautilusSearchBarCriterion * nautilus_search_bar_criterion_file_type_new (NautilusComplexSearchBar *bar);
+NautilusSearchBarCriterion * nautilus_search_bar_criterion_location_new (NautilusComplexSearchBar *bar);
+NautilusSearchBarCriterion * nautilus_search_bar_criterion_content_new (NautilusComplexSearchBar *bar);
+NautilusSearchBarCriterion * nautilus_search_bar_criterion_size_new (NautilusComplexSearchBar *bar);
+NautilusSearchBarCriterion * nautilus_search_bar_criterion_date_new (NautilusComplexSearchBar *bar);
+/* Search for stuff in your nautilus notes */
+NautilusSearchBarCriterion * nautilus_search_bar_criterion_notes_new (NautilusComplexSearchBar *bar);
+void nautilus_search_bar_criterion_show (NautilusSearchBarCriterion *criterion);
#endif NAUTILUS_SEARCH_BAR_CRITERION_H
diff --git a/src/nautilus-simple-search-bar.c b/src/nautilus-simple-search-bar.c
index 5d1fc5f6c..4cbb5f66e 100644
--- a/src/nautilus-simple-search-bar.c
+++ b/src/nautilus-simple-search-bar.c
@@ -70,6 +70,8 @@ nautilus_simple_search_bar_initialize_class (NautilusSimpleSearchBarClass *klass
search_bar_class = NAUTILUS_SEARCH_BAR_CLASS (klass);
search_bar_class->set_search_controls = nautilus_simple_search_bar_set_search_controls;
+
+ klass->get_location = nautilus_simple_search_bar_get_location;
}
@@ -132,7 +134,9 @@ nautilus_simple_search_bar_set_search_controls (NautilusSearchBar *search_bar,
static char *
nautilus_simple_search_bar_get_location (NautilusSimpleSearchBar *bar)
{
- return g_strdup ("file:///tmp");
+ char *search_entry_text;
+ search_entry_text = gtk_entry_get_text (bar->entry);
+ return nautilus_simple_search_criteria_to_search_uri (search_entry_text);
}
static void
@@ -145,6 +149,7 @@ editable_activated_callback (GtkEditable *editable,
g_assert (NAUTILUS_IS_SIMPLE_SEARCH_BAR (bar));
uri = nautilus_simple_search_bar_get_location (bar);
+ printf ("Changing location to %s\n", uri);
nautilus_navigation_bar_location_changed (NAUTILUS_NAVIGATION_BAR (bar),
uri);
g_free (uri);
diff --git a/src/nautilus-simple-search-bar.h b/src/nautilus-simple-search-bar.h
index 9f8b6e96b..581cd8bf5 100644
--- a/src/nautilus-simple-search-bar.h
+++ b/src/nautilus-simple-search-bar.h
@@ -53,7 +53,7 @@ typedef struct NautilusSimpleSearchBar {
typedef struct {
NautilusSearchBarClass parent_class;
- void (*get_location) (NautilusSimpleSearchBar *search_bar);
+ char* (*get_location) (NautilusSimpleSearchBar *search_bar);
} NautilusSimpleSearchBarClass;
GtkType nautilus_simple_search_bar_get_type (void);
diff --git a/src/nautilus-switchable-search-bar.c b/src/nautilus-switchable-search-bar.c
index 5dd9f1eaf..73cb123d9 100644
--- a/src/nautilus-switchable-search-bar.c
+++ b/src/nautilus-switchable-search-bar.c
@@ -88,6 +88,7 @@ nautilus_switchable_search_bar_initialize (NautilusSwitchableSearchBar *bar)
GtkWidget *label;
GtkWidget *event_box;
+ GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *find_them, *find_them_label;
@@ -96,6 +97,7 @@ nautilus_switchable_search_bar_initialize (NautilusSwitchableSearchBar *bar)
gtk_container_set_border_width (GTK_CONTAINER (event_box),
GNOME_PAD_SMALL);
+ vbox = gtk_vbox_new (0, FALSE);
label = gtk_label_new (_("Search For:"));
gtk_container_add (GTK_CONTAINER (event_box), label);
@@ -114,7 +116,7 @@ nautilus_switchable_search_bar_initialize (NautilusSwitchableSearchBar *bar)
gtk_signal_connect (GTK_OBJECT (find_them), "pressed",
search_activated_callback, bar);
- gtk_box_pack_start (GTK_BOX (hbox), find_them, TRUE, TRUE, 1);
+ gtk_box_pack_start (GTK_BOX (hbox), find_them, FALSE, TRUE, 1);
gtk_container_add (GTK_CONTAINER (bar), hbox);
@@ -135,15 +137,6 @@ nautilus_switchable_search_bar_new (void)
}
-static char *
-nautilus_switchable_search_bar_get_location (NautilusSwitchableSearchBar *bar)
-{
- /* FIXME */
- return g_strdup ("file:///tmp");
-}
-
-
-
void
nautilus_switchable_search_bar_set_mode (NautilusSwitchableSearchBar *bar,
NautilusSearchBarMode mode)
@@ -187,6 +180,25 @@ search_activated_callback (GtkButton *button,
}
+static char *
+nautilus_switchable_search_bar_get_location (NautilusSwitchableSearchBar *bar)
+{
+
+ g_assert (NAUTILUS_IS_SWITCHABLE_SEARCH_BAR (bar));
+
+
+ switch (bar->mode) {
+ case NAUTILUS_SIMPLE_SEARCH_BAR:
+ return (* NAUTILUS_SIMPLE_SEARCH_BAR_CLASS (GTK_OBJECT (bar->simple_search_bar)->klass)->get_location) (NAUTILUS_SIMPLE_SEARCH_BAR (bar->simple_search_bar));
+ break;
+ case NAUTILUS_COMPLEX_SEARCH_BAR:
+ return (* NAUTILUS_COMPLEX_SEARCH_BAR_CLASS (GTK_OBJECT (bar->complex_search_bar)->klass)->get_location) (NAUTILUS_COMPLEX_SEARCH_BAR (bar->complex_search_bar));
+ break;
+ }
+ return NULL;
+}
+
+
static void
nautilus_switchable_search_bar_set_search_controls (NautilusSearchBar *search_bar,
const char *location)
@@ -197,7 +209,8 @@ nautilus_switchable_search_bar_set_search_controls (NautilusSearchBar *search_ba
bar = NAUTILUS_SWITCHABLE_SEARCH_BAR (search_bar);
/* Set the mode of the search bar,
- in case preferences have changed */
+ in case preferences have changed
+ FIXME: This doesn't work right */
mode = nautilus_search_uri_to_search_bar_mode (location);
nautilus_switchable_search_bar_set_mode (bar, mode);