diff options
author | Rebecca Schulman <rebecka@eazel.com> | 2000-08-03 02:30:44 +0000 |
---|---|---|
committer | Rebecca Schulman <rebecka@src.gnome.org> | 2000-08-03 02:30:44 +0000 |
commit | 0c8b5b0506149d6dd2135f7094a4ef15c4cc39be (patch) | |
tree | c2e98181396fc7766a03b52368177fe67e3f9565 /libnautilus-private/nautilus-search-uri.c | |
parent | 4d0d674ddf55b74a41a48a40b9602634cf70e957 (diff) | |
download | nautilus-0c8b5b0506149d6dd2135f7094a4ef15c4cc39be.tar.gz |
Completed bug 1433, the interface to search by file name and attribute.
2000-08-02 Rebecca Schulman <rebecka@eazel.com>
Completed bug 1433, the interface to search by file
name and attribute.
* libnautilus-extensions/nautilus-search-uri.c:
* libnautilus-extensions/nautilus-search-uri.h:
* libnautilus-extensions/Makefile.am:
removed the search uri files and placed their functionality
in the appropriate search bar classes.
* libnautilus-extensions/nautilus-search-bar-criterion-private.h:
* libnautilus-extensions/nautilus-search-bar-criterion.h:
* libnautilus-extensions/nautilus-search-bar-criterion.c:
(nautilus_search_bar_criterion_new_from_values),
(nautilus_search_bar_criterion_next_new),
(nautilus_search_bar_criterion_get_location),
(get_next_default_search_criterion_type),
(nautilus_search_bar_criterion_show),
(nautilus_search_bar_criterion_hide), (get_name_location_for),
(get_content_location_for), (get_file_type_location_for),
(get_size_location_for), (get_emblem_location_for),
(get_date_modified_location_for), (get_owner_location_for):
added ability to turn the criteria state into a text
explanation for the search uri. It is slightly circuitous,
because search uris are not internationalized.
* libnautilus-extensions/nautilus-string.c:
* libnautilus-extensions/nautilus-string.h:
(nautilus_str_strip_trailing_str), (nautilus_self_check_string):
added new string function used by the search bar criterion code,
to strip a string off the end of an existing string.
* src/nautilus-complex-search-bar.c:
(nautilus_complex_search_bar_initialize),
(nautilus_complex_search_bar_get_location),
(attach_criterion_to_search_bar),
(unattach_criterion_from_search_bar),
(load_find_them_pixmap_widget), (fewer_options_callback):
tweaks to make sizing an spacing on the bar better, and
added search pixmap to the find button. Moved the find
them button here from the switchable search bar
class for appearance reasons.
* src/nautilus-simple-search-bar.c:
(nautilus_simple_search_bar_initialize),
(nautilus_simple_search_bar_set_location),
(nautilus_simple_search_bar_get_location),
(nautilus_search_uri_to_simple_search_criteria),
(nautilus_simple_search_criteria_to_search_uri):
moved search uri functionality and
find them button into the simple search bar class for
apprearance reasons.
* src/nautilus-switchable-search-bar.c:
* src/nautilus-switchable-search-bar.h:
(nautilus_switchable_search_bar_initialize_class),
(nautilus_switchable_search_bar_initialize),
(nautilus_switchable_search_bar_set_mode),
(nautilus_search_uri_to_search_bar_mode),
(nautilus_search_uri_is_displayable_by_mode), (other_search_mode):
moved the find them button out of this class.
Diffstat (limited to 'libnautilus-private/nautilus-search-uri.c')
-rw-r--r-- | libnautilus-private/nautilus-search-uri.c | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/libnautilus-private/nautilus-search-uri.c b/libnautilus-private/nautilus-search-uri.c deleted file mode 100644 index b3660c360..000000000 --- a/libnautilus-private/nautilus-search-uri.c +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-search-uri.c -- tools for creating - and parsing search uris - - 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 <string.h> -#include <libgnomevfs/gnome-vfs-utils.h> -#include "nautilus-search-uri.h" - -static NautilusSearchBarMode other_search_mode (NautilusSearchBarMode mode); - -char * -nautilus_search_uri_to_simple_search_criteria (const char *uri) -{ - /* FIXME: Not yet implemented. */ - return g_strdup (""); -} - -char * -nautilus_simple_search_criteria_to_search_uri (const char *search_criteria) -{ - char **words; - char *search_uri; - char *fragment; - char *escaped_fragment; - int length, i; - - g_return_val_if_fail (search_criteria != NULL, NULL); - - words = g_new0 (char *, strlen (search_criteria)); - words = g_strsplit (search_criteria, " ", strlen (search_criteria)); - /* FIXME: this should eventually be: length = strlen ("[file%3A%2F%2F%2F]"); */ - length = strlen ("[file:///]"); - /* Count total length */ - for (i = 0; words[i] != NULL; i++) { - length += strlen (words[i]) + strlen ("file_name contains & "); - } - fragment = g_new0 (char, length); - /* FIXME: this should eventually be: sprintf (fragment, "[file%%3A%%2F%%2F%%2F]"); */ - sprintf (fragment, "[file:///]"); - if (words[0] != NULL) { - for (i = 0; words[i+1] != NULL; i++) { - strcat (fragment, "file_name contains "); - strcat (fragment, words[i]); - strcat (fragment, " & "); - } - strcat (fragment, "file_name contains "); - strcat (fragment, words[i]); - } - escaped_fragment = gnome_vfs_escape_string (fragment); - g_free (fragment); - search_uri = g_strconcat ("search:", escaped_fragment, NULL); - g_free (escaped_fragment); -#ifdef SEARCH_URI_DEBUG - printf ("Made uri %s from simple search criteria %s\n", - search_uri, search_criteria); -#endif - return search_uri; -} - - -NautilusSearchBarMode -nautilus_search_uri_to_search_bar_mode (const char *uri) -{ - NautilusSearchBarMode preferred_mode; - - preferred_mode = nautilus_preferences_get_enum (NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE, - NAUTILUS_SIMPLE_SEARCH_BAR); - if (nautilus_search_uri_is_displayable_by_mode (uri, preferred_mode)) { - return preferred_mode; - } - else { - return (other_search_mode (preferred_mode)); - } -} - - - -gboolean -nautilus_search_uri_is_displayable_by_mode (const char *uri, - NautilusSearchBarMode mode) -{ - /* FIXME */ - return TRUE; -} - - -static NautilusSearchBarMode -other_search_mode (NautilusSearchBarMode mode) -{ - switch (mode) { - case NAUTILUS_SIMPLE_SEARCH_BAR: - return NAUTILUS_COMPLEX_SEARCH_BAR; - break; - case NAUTILUS_COMPLEX_SEARCH_BAR: - return NAUTILUS_SIMPLE_SEARCH_BAR; - break; - default: - g_assert_not_reached (); - } - return NAUTILUS_COMPLEX_SEARCH_BAR; -} |