summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-09-05 22:56:38 +0000
committerDarin Adler <darin@src.gnome.org>2000-09-05 22:56:38 +0000
commit700232e53174a755e31019d50e3940ff38b174e6 (patch)
tree7f46f516c3ad709645690e631d57fc245474b065
parentb01779bfe70e2b511a76a185a555863b554850b6 (diff)
downloadnautilus-700232e53174a755e31019d50e3940ff38b174e6.tar.gz
Removed some special-case file names that aren't needed any more.
* check-FIXME.pl: Removed some special-case file names that aren't needed any more. * libnautilus-extensions/nautilus-file-operations.c: (get_link_name): Added comments to help localizers. * libnautilus-extensions/nautilus-file.c: (nautilus_file_get_date_as_string): Added comments to help localizers. Deals with bug 2720 (Please add a comment to help localizers do date translations) * libnautilus-extensions/nautilus-icon-canvas-item.c: (draw_or_measure_label_text): Added a comment to help localizers. * src/file-manager/fm-directory-view.c: (fm_directory_view_display_selection_info): Unmarked one string that doesn't make sense to translate and adding a comment to another to explain why it is marked for translation. (add_separator): Changed add_open_with_gtk_menu_item into this function, which deals with bug 2735 (add_open_with_gtk_menu_item only called to create separator?). (create_open_with_gtk_menu): Call the new add_separator function. * src/nautilus-zoom-control.c: (create_zoom_menu_item): Added a comment to help localizers. * libnautilus-extensions/nautilus-link.c: (make_local_path): Fixed logic here that was doing strange things with URIs. This deals with bugs 2492 (Incorrect unescaping when dealing with link files), 2493 (Mysterious and probably incorrect "+7" when escaping URI for link file), and 2737 (link code must make path into URI). * libnautilus-extensions/nautilus-search-bar-criterion.c: * libnautilus-extensions/nautilus-search-bar-criterion.h: * po/POTFILES.in: Removed these duplicate files. Rebecca moved them to src, but she didn't remove the old ones. I didn't have to remove them from the makefile, since they were already removed, but I had to remove them from the list of files to translate. * src/nautilus-search-bar-criterion.h: * libnautilus-extensions/nautilus-search-uri.h: Moved some of the stuff from nautilus-search-bar-criterion.h to here, since it's really about search URIs, not specific to the search bar. Over time we will move more. * src/nautilus-search-bar-criterion.c: Added include of the nautilus-search-uri.h header now that stuff was moved there. * src/file-manager/fm-search-list-view.c: Fixed includes to get the nautilus-search-bar-criterion.h from its new location. This is not a real solution to the problem that was exposed by moving the search bar code. The bug 2815 covers this. * src/nautilus-complex-search-bar.c: Fix search bar so it gets the real location of the header. It was including the old one. * src/nautilus-simple-search-bar.c: Fix search bar so it gets the real location of the header. It was including the old one. * src/nautilus-main.c: (main): Some small cleanups including some additional parameter checking and returning a failure code to the invoking shell in the case where the parameters are not consistent.
-rw-r--r--ChangeLog61
-rwxr-xr-xcheck-FIXME.pl6
-rw-r--r--libnautilus-extensions/nautilus-file-operations.c21
-rw-r--r--libnautilus-extensions/nautilus-file.c18
-rw-r--r--libnautilus-extensions/nautilus-icon-canvas-item.c4
-rw-r--r--libnautilus-extensions/nautilus-link.c19
-rw-r--r--libnautilus-extensions/nautilus-search-bar-criterion.c737
-rw-r--r--libnautilus-extensions/nautilus-search-bar-criterion.h109
-rw-r--r--libnautilus-extensions/nautilus-search-uri.h9
-rw-r--r--libnautilus-private/nautilus-file-operations.c21
-rw-r--r--libnautilus-private/nautilus-file.c18
-rw-r--r--libnautilus-private/nautilus-icon-canvas-item.c4
-rw-r--r--libnautilus-private/nautilus-link.c19
-rw-r--r--libnautilus-private/nautilus-search-bar-criterion.c737
-rw-r--r--libnautilus-private/nautilus-search-bar-criterion.h109
-rw-r--r--libnautilus-private/nautilus-search-uri.h9
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/file-manager/fm-directory-view.c32
-rw-r--r--src/file-manager/fm-search-list-view.c15
-rw-r--r--src/nautilus-complex-search-bar.c11
-rw-r--r--src/nautilus-main.c109
-rw-r--r--src/nautilus-search-bar-criterion.c62
-rw-r--r--src/nautilus-search-bar-criterion.h24
-rw-r--r--src/nautilus-simple-search-bar.c3
-rw-r--r--src/nautilus-zoom-control.c9
25 files changed, 298 insertions, 1870 deletions
diff --git a/ChangeLog b/ChangeLog
index e783502ca..e7c4b8fce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,64 @@
+2000-09-05 Darin Adler <darin@eazel.com>
+
+ * check-FIXME.pl: Removed some special-case file names
+ that aren't needed any more.
+
+ * libnautilus-extensions/nautilus-file-operations.c:
+ (get_link_name): Added comments to help localizers.
+ * libnautilus-extensions/nautilus-file.c:
+ (nautilus_file_get_date_as_string): Added comments to help
+ localizers. Deals with bug 2720 (Please add a comment to help
+ localizers do date translations)
+ * libnautilus-extensions/nautilus-icon-canvas-item.c:
+ (draw_or_measure_label_text): Added a comment to help localizers.
+ * src/file-manager/fm-directory-view.c:
+ (fm_directory_view_display_selection_info): Unmarked one string
+ that doesn't make sense to translate and adding a comment to
+ another to explain why it is marked for translation.
+ (add_separator): Changed add_open_with_gtk_menu_item into this
+ function, which deals with bug 2735 (add_open_with_gtk_menu_item
+ only called to create separator?).
+ (create_open_with_gtk_menu): Call the new add_separator function.
+ * src/nautilus-zoom-control.c: (create_zoom_menu_item): Added a
+ comment to help localizers.
+
+ * libnautilus-extensions/nautilus-link.c: (make_local_path): Fixed
+ logic here that was doing strange things with URIs. This deals
+ with bugs 2492 (Incorrect unescaping when dealing with link
+ files), 2493 (Mysterious and probably incorrect "+7" when escaping
+ URI for link file), and 2737 (link code must make path into URI).
+
+ * libnautilus-extensions/nautilus-search-bar-criterion.c:
+ * libnautilus-extensions/nautilus-search-bar-criterion.h:
+ * po/POTFILES.in:
+ Removed these duplicate files. Rebecca moved them to src, but she
+ didn't remove the old ones. I didn't have to remove them from the
+ makefile, since they were already removed, but I had to remove
+ them from the list of files to translate.
+
+ * src/nautilus-search-bar-criterion.h:
+ * libnautilus-extensions/nautilus-search-uri.h:
+ Moved some of the stuff from nautilus-search-bar-criterion.h to
+ here, since it's really about search URIs, not specific to the
+ search bar. Over time we will move more.
+
+ * src/nautilus-search-bar-criterion.c: Added include of the
+ nautilus-search-uri.h header now that stuff was moved there.
+
+ * src/file-manager/fm-search-list-view.c:
+ Fixed includes to get the nautilus-search-bar-criterion.h from its
+ new location. This is not a real solution to the problem that was
+ exposed by moving the search bar code. The bug 2815 covers this.
+ * src/nautilus-complex-search-bar.c: Fix search bar so it gets
+ the real location of the header. It was including the old one.
+ * src/nautilus-simple-search-bar.c: Fix search bar so it gets
+ the real location of the header. It was including the old one.
+
+ * src/nautilus-main.c: (main): Some small cleanups including some
+ additional parameter checking and returning a failure code to
+ the invoking shell in the case where the parameters are not
+ consistent.
+
2000-09-05 Pavel Cisler <pavel@eazel.com>
* configure.in:
diff --git a/check-FIXME.pl b/check-FIXME.pl
index 350fb4827..7ca073a43 100755
--- a/check-FIXME.pl
+++ b/check-FIXME.pl
@@ -44,12 +44,6 @@ if (!@ARGV)
"./libtool" => 1,
"./ltconfig" => 1,
"./ltmain.sh" => 1,
- "./macros/gnome-fileutils.m4" => 1,
- "./macros/gnome-objc-checks.m4" => 1,
- "./macros/gnome-vfs.m4" => 1,
- "./src/file-manager/desktop-canvas.c" => 1,
- "./src/file-manager/desktop-layout.c" => 1,
- "./src/file-manager/desktop-window.c" => 1,
);
}
diff --git a/libnautilus-extensions/nautilus-file-operations.c b/libnautilus-extensions/nautilus-file-operations.c
index ce0b2565a..9f33a1493 100644
--- a/libnautilus-extensions/nautilus-file-operations.c
+++ b/libnautilus-extensions/nautilus-file-operations.c
@@ -456,15 +456,30 @@ get_link_name (const char *name, int count)
*/
switch (count % 10) {
case 1:
+ /* Localizers: Feel free to leave out the "st" suffix
+ * if there's no way to do that nicely for a
+ * particular language.
+ */
return g_strdup_printf (_("%dst link to %s"), count, name);
case 2:
+ /* Localizers: Feel free to leave out the "nd" suffix
+ * if there's no way to do that nicely for a
+ * particular language.
+ */
return g_strdup_printf (_("%dnd link to %s"), count, name);
case 3:
+ /* Localizers: Feel free to leave out the "rd" suffix
+ * if there's no way to do that nicely for a
+ * particular language.
+ */
return g_strdup_printf (_("%drd link to %s"), count, name);
+ default:
+ /* Localizers: Feel free to leave out the "th" suffix
+ * if there's no way to do that nicely for a
+ * particular language.
+ */
+ return g_strdup_printf (_("%dth link to %s"), count, name);
}
-
- /* The general case. */
- return g_strdup_printf (_("%dth link to %s"), count, name);
}
static char *
diff --git a/libnautilus-extensions/nautilus-file.c b/libnautilus-extensions/nautilus-file.c
index c2bff8bca..4892f7fb3 100644
--- a/libnautilus-extensions/nautilus-file.c
+++ b/libnautilus-extensions/nautilus-file.c
@@ -1731,15 +1731,27 @@ nautilus_file_get_date_as_string (NautilusFile *file, NautilusDateType date_type
*/
if (file_date_age == 0) {
- /* today, use special word */
+ /* Today, use special word.
+ * Note to localizers: You can look at man strftime
+ * for details on the format, but do no use format
+ * strings that are specific to the GNU version of
+ * the library, or you will make Nautilus less portable.
+ */
format = _("today %-I:%M %p");
} else if (file_date_age == 1) {
- /* yesterday, use special word */
+ /* Yesterday, use special word.
+ * Note to localizers: Same issues as "today" string.
+ */
format = _("yesterday %-I:%M %p");
} else if (file_date_age < 7) {
- /* current week, include day of week */
+ /* Current week, include day of week.
+ * Note to localizers: Same issues as "today" string.
+ */
format = _("%A %-m/%-d/%y %-I:%M %p");
} else {
+ /* Other dates.
+ * Note to localizers: Same issues as "today" string.
+ */
format = _("%-m/%-d/%y %-I:%M %p");
}
diff --git a/libnautilus-extensions/nautilus-icon-canvas-item.c b/libnautilus-extensions/nautilus-icon-canvas-item.c
index 07d52d1f7..6cf78abd9 100644
--- a/libnautilus-extensions/nautilus-icon-canvas-item.c
+++ b/libnautilus-extensions/nautilus-icon-canvas-item.c
@@ -703,8 +703,10 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item,
text_piece = " ";
}
+ /* The list of characters that cause line breaks can be localized. */
icon_text_info = gnome_icon_layout_text
- (details->font, text_piece, _(" -_,;.?/&"), max_text_width, TRUE);
+ (details->font, text_piece, _(" -_,;.?/&"),
+ max_text_width, TRUE);
/* Draw text if we are not in user rename mode */
if (drawable != NULL && !details->is_renaming) {
diff --git a/libnautilus-extensions/nautilus-link.c b/libnautilus-extensions/nautilus-link.c
index 48447c920..cc5e8b246 100644
--- a/libnautilus-extensions/nautilus-link.c
+++ b/libnautilus-extensions/nautilus-link.c
@@ -267,19 +267,9 @@ nautilus_link_get_additional_text (const char *link_file_uri)
static char *
make_local_path (const char *image_uri)
{
- char *escaped_uri, *unescaped_uri, *local_directory_path, *local_file_path;
+ char *escaped_uri, *local_directory_path, *local_directory_uri, *local_file_path;
- /* We can't call nautilus_get_local_path_from_uri here, since
- * it will return NULL since it's not a local uri, but we
- * still should unescape.
- */
- unescaped_uri = gnome_vfs_unescape_string (image_uri, "/");
- /* FIXME bugzilla.eazel.com 2492: Why should we unescape? The above can return NULL for
- * URIs with slashes in it and other cases like that.
- */
- /* FIXME bugzilla.eazel.com 2493: Why the +7 below? This seems totally wrong. */
- escaped_uri = gnome_vfs_escape_slashes (unescaped_uri + 7);
- g_free (unescaped_uri);
+ escaped_uri = gnome_vfs_escape_slashes (image_uri);
local_directory_path = g_strconcat
(g_get_home_dir (),
@@ -287,9 +277,10 @@ make_local_path (const char *image_uri)
NULL);
/* We must create the directory if it doesn't exist. */
+ local_directory_uri = gnome_vfs_get_uri_from_local_path (local_directory_path);
/* FIXME bugzilla.eazel.com 2494: Is it OK to ignore the error here? */
- /* FIXME bugzilla.eazel.com 2737: This needs to make the path into a URI if it's going to use gnome_vfs. */
- gnome_vfs_make_directory (local_directory_path, REMOTE_ICON_DIR_PERMISSIONS);
+ gnome_vfs_make_directory (local_directory_uri, REMOTE_ICON_DIR_PERMISSIONS);
+ g_free (local_directory_uri);
local_file_path = nautilus_make_path (local_directory_path, escaped_uri);
g_free (escaped_uri);
diff --git a/libnautilus-extensions/nautilus-search-bar-criterion.c b/libnautilus-extensions/nautilus-search-bar-criterion.c
deleted file mode 100644
index 3c15f0390..000000000
--- a/libnautilus-extensions/nautilus-search-bar-criterion.c
+++ /dev/null
@@ -1,737 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-search-bar-criterion.c - Code to bring up
- the various kinds of criterion supported in the nautilus search
- bar
-
- 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 "nautilus-customization-data.h"
-#include "nautilus-dateedit-extensions.h"
-#include "nautilus-file-utilities.h"
-#include "nautilus-gtk-macros.h"
-#include "nautilus-icon-factory.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>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
-#include <libgnome/gnome-defs.h>
-#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 [] = {
- N_("Name"),
- N_("Content"),
- N_("Type"),
- N_("Size"),
- N_("With Emblem"),
- N_("Last Modified"),
- N_("Owned By"),
- NULL
-};
-
-
-static char *name_relations [] = {
- N_("contains"),
- N_("starts with"),
- N_("ends with"),
- N_("matches glob"),
- N_("matches regexp"),
- NULL
-};
-
-static char *content_relations [] = {
- N_("includes all of"),
- N_("includes any of"),
- N_("does not include all of"),
- N_("includes none of"),
- NULL
-
-};
-
-static char *type_relations [] = {
- N_("is"),
- N_("is not"),
- NULL
-};
-
-static char *type_objects [] = {
- N_("regular file"),
- N_("text file"),
- N_("application"),
- N_("directory"),
- N_("music"),
- NULL
-};
-
-static char *size_relations [] = {
- N_("larger than"),
- N_("smaller than"),
- NULL
-};
-
-static char *emblem_relations [] = {
- N_("marked with"),
- N_("not marked with"),
- NULL
-};
-
-static char *modified_relations [] = {
- 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 *owner_relations [] = {
- N_("is"),
- N_("is not"),
- NULL
-};
-
-static NautilusSearchBarCriterion * nautilus_search_bar_criterion_new (void);
-
-static NautilusSearchBarCriterion * nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType type,
- char *operator_options[],
- gboolean use_value_entry,
- gboolean use_value_menu,
- char *value_options[],
- gboolean use_value_suffix,
- char *value_suffix);
-
-NautilusSearchBarCriterionType get_next_default_search_criterion_type (NautilusSearchBarCriterionType type) ;
-
-static char * get_name_location_for (int relation_number,
- char *name_text);
-static char * get_content_location_for (int relation_number,
- char *name_text);
-static char * get_file_type_location_for (int relation_number,
- int value_number);
-static char * get_size_location_for (int relation_number,
- char *size_text);
-static char * get_emblem_location_for (int relation_number,
- GtkWidget *menu_item);
-static char * get_date_modified_location_for (int relation_number,
- char *date);
-static char * get_owner_location_for (int relation_number,
- char *owner_number);
-static void make_emblem_value_menu (NautilusSearchBarCriterion *criterion);
-
-
-void
-nautilus_search_bar_criterion_destroy (NautilusSearchBarCriterion *criterion)
-{
- /* FIXME bugzilla.eazel.com 2437: need more freeage */
- g_free (criterion->details);
- g_free (criterion);
-}
-
-static NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_new (void)
-{
- return g_new0 (NautilusSearchBarCriterion, 1);
-}
-
-
-static void
-option_menu_callback (GtkWidget *widget, gpointer data)
-{
- NautilusSearchBarCriterion *criterion, *new_criterion;
- int type;
-
- criterion = (NautilusSearchBarCriterion *) data;
-
- type = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT(widget), "type"));
-
- new_criterion = nautilus_search_bar_criterion_next_new (type - 1);
-
- criterion->details->callback (criterion, new_criterion, criterion->details->callback_data);
-
- nautilus_search_bar_criterion_destroy (criterion);
-}
-
-
-void
-nautilus_search_bar_criterion_set_callback (NautilusSearchBarCriterion *criterion,
- NautilusSearchBarCriterionCallback callback,
- gpointer data)
-{
- criterion->details->callback = callback;
- criterion->details->callback_data = data;
-}
-
-
-static NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType type,
- char *relation_options[],
- gboolean use_value_entry,
- gboolean use_value_menu,
- char *value_options[],
- gboolean use_value_suffix,
- char *value_suffix)
-{
- NautilusSearchBarCriterion *criterion;
- GtkWidget *search_criteria_option_menu, *search_criteria_menu;
- GtkWidget *relation_option_menu, *relation_menu;
- GtkWidget *value_option_menu, *value_menu;
-
- int i;
-
- criterion = nautilus_search_bar_criterion_new ();
- criterion->details = g_new0 (NautilusSearchBarCriterionDetails, 1);
- criterion->details->type = type;
-
-
- search_criteria_option_menu = gtk_option_menu_new ();
- search_criteria_menu = gtk_menu_new ();
- for (i = 0; criteria_titles[i] != NULL; i++) {
- GtkWidget *item;
- item = gtk_menu_item_new_with_label (_(criteria_titles[i]));
- gtk_object_set_data (GTK_OBJECT(item), "type", GINT_TO_POINTER(i));
- gtk_signal_connect (GTK_OBJECT (item),
- "activate",
- option_menu_callback,
- (gpointer) criterion);
- gtk_menu_append (GTK_MENU (search_criteria_menu),
- item);
- }
- gtk_menu_set_active (GTK_MENU (search_criteria_menu), type);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (search_criteria_option_menu),
- search_criteria_menu);
- criterion->details->available_criteria = GTK_OPTION_MENU (search_criteria_option_menu);
- gtk_widget_show_all (GTK_WIDGET(search_criteria_option_menu));
-
- relation_option_menu = gtk_option_menu_new ();
- relation_menu = gtk_menu_new ();
- for (i = 0; relation_options[i] != NULL; i++) {
- GtkWidget *item;
- item = gtk_menu_item_new_with_label (_(relation_options[i]));
- gtk_object_set_data (GTK_OBJECT(item), "type", GINT_TO_POINTER(i));
- gtk_menu_append (GTK_MENU (relation_menu),
- item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (relation_option_menu),
- relation_menu);
- criterion->details->relation_menu = GTK_OPTION_MENU (relation_option_menu);
- gtk_widget_show_all (GTK_WIDGET(relation_option_menu));
-
-
-
- g_assert (! (use_value_entry && use_value_menu));
- criterion->details->use_value_entry = use_value_entry;
- if (use_value_entry) {
- criterion->details->value_entry = GTK_ENTRY (gtk_entry_new ());
- gtk_widget_show_all(GTK_WIDGET(criterion->details->value_entry));
- }
- criterion->details->use_value_menu = use_value_menu;
- if (use_value_menu && criterion->details->type != NAUTILUS_EMBLEM_SEARCH_CRITERION) {
- g_return_val_if_fail (value_options != NULL, NULL);
- value_option_menu = gtk_option_menu_new ();
- value_menu = gtk_menu_new ();
- for (i = 0; value_options[i] != NULL; i++) {
- GtkWidget *item;
- item = gtk_menu_item_new_with_label (_(value_options[i]));
- gtk_object_set_data (GTK_OBJECT(item), "type", GINT_TO_POINTER(i));
- gtk_menu_append (GTK_MENU (value_menu),
- item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (value_option_menu),
- value_menu);
- criterion->details->value_menu = GTK_OPTION_MENU (value_option_menu);
- gtk_widget_show_all (GTK_WIDGET(criterion->details->value_menu));
- }
- criterion->details->use_value_suffix = use_value_suffix;
- if (use_value_suffix) {
- g_return_val_if_fail (value_suffix != NULL, NULL);
- 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));
- }
- if (criterion->details->type == NAUTILUS_EMBLEM_SEARCH_CRITERION) {
- make_emblem_value_menu (criterion);
- }
-
- return criterion;
-}
-
-
-NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_next_new (NautilusSearchBarCriterionType criterion_type)
-{
- NautilusSearchBarCriterion *new_criterion;
- NautilusSearchBarCriterionType next_type;
-
- next_type = (criterion_type + 1) % NAUTILUS_LAST_CRITERION;
-
- switch(next_type) {
- case NAUTILUS_FILE_NAME_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_FILE_NAME_SEARCH_CRITERION,
- name_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL);
- break;
- case NAUTILUS_CONTENT_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_CONTENT_SEARCH_CRITERION,
- content_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL);
- break;
- case NAUTILUS_FILE_TYPE_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_FILE_TYPE_SEARCH_CRITERION,
- type_relations,
- FALSE,
- TRUE,
- type_objects,
- FALSE,
- NULL);
- break;
- case NAUTILUS_SIZE_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_SIZE_SEARCH_CRITERION,
- size_relations,
- TRUE,
- FALSE,
- NULL,
- TRUE,
- "K");
- break;
- case NAUTILUS_EMBLEM_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_EMBLEM_SEARCH_CRITERION,
- emblem_relations,
- FALSE,
- FALSE,
- NULL,
- FALSE,
- NULL);
-
- break;
- case NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION,
- modified_relations,
- FALSE,
- FALSE,
- NULL,
- FALSE,
- NULL);
- break;
- case NAUTILUS_OWNER_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_OWNER_SEARCH_CRITERION,
- owner_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL);
- break;
- default:
- g_assert_not_reached ();
- }
-
-
- return new_criterion;
-}
-
-NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_first_new (void)
-{
- return nautilus_search_bar_criterion_new_from_values (NAUTILUS_FILE_NAME_SEARCH_CRITERION,
- name_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL);
-}
-
-/* returns a newly allocated string: needs to be freed by the caller. */
-char *
-nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterion)
-{
- GtkWidget *menu;
- GtkWidget *menu_item;
- int name_number, relation_number, value_number;
- char *value_text;
-
- /* There is ONE thing you should be aware of while implementing this function.
- You have to make sure you use non-translated strings for building the uri.
- So, to implement this, you are supposed to:
- - build various tables which contain the strings corresponding to a search type.
- - call
- option_menu = gtk_option_menu_get_menu (criterion->details->some_menu)
- menu_item = gtk_menu_get_active (optin_menu)
- number = gtk_object_get_data (menu_item, "type")
- */
- menu = gtk_option_menu_get_menu (criterion->details->available_criteria);
- menu_item = gtk_menu_get_active (GTK_MENU (menu));
- name_number = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu_item), "type"));
-
- menu = gtk_option_menu_get_menu (criterion->details->relation_menu);
- menu_item = gtk_menu_get_active (GTK_MENU (menu));
- relation_number = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu_item), "type"));
-
- if (criterion->details->use_value_menu) {
- menu = gtk_option_menu_get_menu (criterion->details->value_menu);
- menu_item = gtk_menu_get_active (GTK_MENU (menu));
- value_number = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu_item), "type"));
- }
- 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);
- case NAUTILUS_CONTENT_SEARCH_CRITERION:
- return get_content_location_for (relation_number,
- value_text);
- case NAUTILUS_FILE_TYPE_SEARCH_CRITERION:
- return get_file_type_location_for (relation_number,
- value_number);
- case NAUTILUS_SIZE_SEARCH_CRITERION:
- return get_size_location_for (relation_number,
- value_text);
- case NAUTILUS_EMBLEM_SEARCH_CRITERION:
- return get_emblem_location_for (relation_number,
- menu_item);
- case NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION:
- return get_date_modified_location_for (relation_number,
- value_text);
- case NAUTILUS_OWNER_SEARCH_CRITERION:
- return get_owner_location_for (relation_number,
- value_text);
- default:
- g_assert_not_reached ();
- return NULL;
- }
-
- g_assert_not_reached ();
- return NULL;
-}
-
-
-NautilusSearchBarCriterionType
-get_next_default_search_criterion_type (NautilusSearchBarCriterionType type)
-{
- switch (type) {
- case NAUTILUS_FILE_NAME_SEARCH_CRITERION:
- return NAUTILUS_CONTENT_SEARCH_CRITERION;
- case NAUTILUS_CONTENT_SEARCH_CRITERION:
- return NAUTILUS_FILE_TYPE_SEARCH_CRITERION;
- case NAUTILUS_FILE_TYPE_SEARCH_CRITERION:
- return NAUTILUS_SIZE_SEARCH_CRITERION;
- case NAUTILUS_SIZE_SEARCH_CRITERION:
- return NAUTILUS_SIZE_SEARCH_CRITERION;
- case NAUTILUS_EMBLEM_SEARCH_CRITERION:
- return NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION;
- case NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION:
- return NAUTILUS_OWNER_SEARCH_CRITERION;
- case NAUTILUS_OWNER_SEARCH_CRITERION:
- return NAUTILUS_FILE_NAME_SEARCH_CRITERION;
- default:
- g_assert_not_reached ();
- return NAUTILUS_LAST_CRITERION;
- }
- return NAUTILUS_LAST_CRITERION;
-}
-
-void
-nautilus_search_bar_criterion_show (NautilusSearchBarCriterion *criterion)
-{
-
- gtk_widget_show (GTK_WIDGET (criterion->details->available_criteria));
- gtk_widget_show (GTK_WIDGET (criterion->details->relation_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));
- }
-}
-
-
-
-void
-nautilus_search_bar_criterion_hide (NautilusSearchBarCriterion *criterion)
-{
-
- gtk_widget_hide (GTK_WIDGET (criterion->details->available_criteria));
- gtk_widget_hide (GTK_WIDGET (criterion->details->relation_menu));
-
- if (criterion->details->use_value_entry) {
- gtk_widget_hide (GTK_WIDGET (criterion->details->value_entry));
- }
- if (criterion->details->use_value_menu) {
- gtk_widget_hide (GTK_WIDGET (criterion->details->value_menu));
- }
-}
-
-char *
-nautilus_search_bar_criterion_human_from_uri (const char *location_uri)
-{
- return g_strdup (location_uri);
-}
-
-char *
-nautilus_search_uri_get_first_criterion (const char *search_uri)
-{
- char *unescaped_uri;
- char *first_criterion;
- int matches;
-
- unescaped_uri = gnome_vfs_unescape_string (search_uri, NULL);
-
- /* Start with a string as long as the URI, since
- * we don't necessarily trust the search_uri to have
- * the pattern we're looking for.
- */
- first_criterion = g_strdup (unescaped_uri);
-
- matches = sscanf (unescaped_uri, "search:[file:///]%s %*s", first_criterion);
- g_free (unescaped_uri);
-
- if (matches == 0) {
- g_free (first_criterion);
- return NULL;
- }
-
- return first_criterion;
-}
-
-
-static char *
-get_name_location_for (int relation_number, char *name_text)
-{
- const char *possible_relations[] = { "contains",
- "begins_with",
- "ends_with",
- "matches",
- "matches_regexp" };
-
- g_assert (relation_number >= 0);
- g_assert (relation_number < 5);
-
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_NAME,
- possible_relations[relation_number],
- name_text);
-
-}
-
-static char *
-get_content_location_for (int relation_number, char *name_text)
-{
- const char *possible_relations[] = { "includes_all_of",
- "includes_any_of",
- "does_not_include_all_of",
- "does_not_include_any_of" };
-
- g_assert (relation_number>= 0);
- g_assert (relation_number < 4);
-
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_CONTENT,
- possible_relations[relation_number],
- name_text);
-}
-
-static char *
-get_file_type_location_for (int relation_number,
- int value_number)
-{
- const char *possible_relations[] = { "is", "is_not" };
- const char *possible_values[] = {"file", "text_file", "application", "directory", "music" };
-
- g_assert (relation_number == 0 || relation_number == 1);
- g_assert (value_number >= 0);
- g_assert (value_number < 5);
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_TYPE,
- possible_relations[relation_number],
- possible_values[value_number]);
-}
-
-
-static char *
-get_size_location_for (int relation_number,
- char *size_text)
-{
- const char *possible_relations[] = { "larger_than", "smaller_than" };
- int entered_size;
-
- g_assert (relation_number == 0 || relation_number == 1);
- /* We put a 'K' after the size, so multiply what the user
- entered by 1000 */
- entered_size = strtol (size_text, NULL, 10);
- /* FIXME bugzilla.eazel.com 2438: Need error handling here */
- g_return_val_if_fail (entered_size >= 0, NULL);
- return g_strdup_printf ("%s %s %d", NAUTILUS_SEARCH_URI_TEXT_SIZE,
- possible_relations[relation_number],
- entered_size * 1000);
-
-}
-
-static char *
-get_emblem_location_for (int relation_number,
- GtkWidget *menu_item)
-{
- const char *possible_relations[] = {"include", "does_not_include" };
- char *emblem_text;
-
- g_assert (relation_number == 0 ||
- relation_number == 1);
- emblem_text = gtk_object_get_data (GTK_OBJECT (menu_item),
- "emblem name");
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_EMBLEMS,
- possible_relations[relation_number],
- emblem_text);
-}
-
-static char *
-get_date_modified_location_for (int relation_number,
- char *date_string)
-{
- 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 *
-get_owner_location_for (int relation_number,
- char *owner_text)
-{
- const char *possible_relations[] = { "is", "is not" };
- g_assert (relation_number == 0 || relation_number == 1);
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_OWNER, possible_relations[relation_number], owner_text);
-
-}
-
-static void
-make_emblem_value_menu (NautilusSearchBarCriterion *criterion)
-{
- NautilusCustomizationData *customization_data;
- GtkWidget *temp_hbox;
- GtkWidget *menu_item;
- char *emblem_file_name;
- char *emblem_display_name;
- GtkWidget *emblem_pixmap_widget;
- GtkLabel *emblem_label;
- GtkWidget *value_option_menu, *value_menu;
-
- /* Add the items to the emblems menu here */
- /* FIXME bugzilla.eazel.com 2738: What are the variables for thumbnail icon height and width */
- value_option_menu = gtk_option_menu_new ();
- value_menu = gtk_menu_new ();
- customization_data = nautilus_customization_data_new ("emblems",
- TRUE,
- NAUTILUS_ICON_SIZE_FOR_MENUS,
- NAUTILUS_ICON_SIZE_FOR_MENUS);
- while (nautilus_customization_data_get_next_element_for_display (customization_data,
- &emblem_file_name,
- &emblem_pixmap_widget,
- &emblem_label) == GNOME_VFS_OK) {
-
- menu_item = gtk_menu_item_new ();
- gtk_label_get (emblem_label, &emblem_display_name);
- gtk_object_set_data (GTK_OBJECT (menu_item), "emblem name", emblem_display_name);
- temp_hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (menu_item), temp_hbox);
- gtk_box_pack_start (GTK_BOX (temp_hbox), emblem_pixmap_widget, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (temp_hbox), GTK_WIDGET (emblem_label), FALSE, FALSE, 0);
- gtk_menu_append (GTK_MENU (value_menu), menu_item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (value_option_menu),
- value_menu);
- criterion->details->value_menu = GTK_OPTION_MENU (value_option_menu);
- gtk_widget_show_all (GTK_WIDGET (criterion->details->value_menu));
- criterion->details->use_value_menu = TRUE;
- g_free (emblem_file_name);
-}
-
-
-
-
-
-
-
-
diff --git a/libnautilus-extensions/nautilus-search-bar-criterion.h b/libnautilus-extensions/nautilus-search-bar-criterion.h
deleted file mode 100644
index 9a41be33c..000000000
--- a/libnautilus-extensions/nautilus-search-bar-criterion.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-search-bar-criterion.h - Types that will
- bring up the various search criteria
-
- 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>
-*/
-
-
-#ifndef NAUTILUS_SEARCH_BAR_CRITERION_H
-#define NAUTILUS_SEARCH_BAR_CRITERION_H
-
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtkentry.h>
-
-
-typedef enum {
- NAUTILUS_FILE_NAME_SEARCH_CRITERION,
- NAUTILUS_CONTENT_SEARCH_CRITERION,
- NAUTILUS_FILE_TYPE_SEARCH_CRITERION,
- NAUTILUS_SIZE_SEARCH_CRITERION,
- NAUTILUS_EMBLEM_SEARCH_CRITERION,
- NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION,
- NAUTILUS_OWNER_SEARCH_CRITERION,
- NAUTILUS_LAST_CRITERION
-} NautilusSearchBarCriterionType;
-
-/* These strings are used programatically; they must not be translated */
-#define NAUTILUS_SEARCH_URI_TEXT_NAME "file_name"
-#define NAUTILUS_SEARCH_URI_TEXT_CONTENT "content"
-#define NAUTILUS_SEARCH_URI_TEXT_TYPE "file_type"
-#define NAUTILUS_SEARCH_URI_TEXT_SIZE "size"
-#define NAUTILUS_SEARCH_URI_TEXT_EMBLEMS "keywords"
-#define NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED "modified"
-#define NAUTILUS_SEARCH_URI_TEXT_OWNER "owner"
-
-typedef struct NautilusSearchBarCriterionDetails NautilusSearchBarCriterionDetails;
-typedef struct NautilusSearchBarCriterion {
- NautilusSearchBarCriterionDetails *details;
- NautilusSearchBarCriterionType type;
-} NautilusSearchBarCriterion;
-
-
-typedef void (* NautilusSearchBarCriterionCallback) (NautilusSearchBarCriterion *old_criterion,
- NautilusSearchBarCriterion *new_criterion,
- gpointer data);
-
-#define NAUTILUS_SEARCH_BAR_CRITERION(arg) (NautilusSearchBarCriterion *) arg
-
-
-
-
-NautilusSearchBarCriterion * nautilus_search_bar_criterion_first_new (void);
-
-NautilusSearchBarCriterion * nautilus_search_bar_criterion_next_new (NautilusSearchBarCriterionType criterion_type);
-
-/* set callback called when the user chooses a new criterion type.
- Used by complex-search-bar */
-void nautilus_search_bar_criterion_set_callback (NautilusSearchBarCriterion *criterion,
- NautilusSearchBarCriterionCallback callback,
- gpointer data);
-/* called by the seach-bar-complex when the user asks for a search to be performed.
- We need toi build the serach uri from the different criterions.
- Each criterion returns the part of the search uri it represents
-*/
-char * nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterion);
-
-void nautilus_search_bar_criterion_show (NautilusSearchBarCriterion *criterion);
-void nautilus_search_bar_criterion_hide (NautilusSearchBarCriterion *criterion);
-
-void nautilus_search_bar_criterion_destroy (NautilusSearchBarCriterion *criterion);
-
-
-/* Search URI utilities. Maybe these should go in a separate file? */
-char * nautilus_search_bar_criterion_human_from_uri (const char *location_uri);
-
-char * nautilus_search_uri_get_first_criterion (const char *search_uri);
-
-
-#endif NAUTILUS_SEARCH_BAR_CRITERION_H
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libnautilus-extensions/nautilus-search-uri.h b/libnautilus-extensions/nautilus-search-uri.h
index 96ed4d200..b634ac142 100644
--- a/libnautilus-extensions/nautilus-search-uri.h
+++ b/libnautilus-extensions/nautilus-search-uri.h
@@ -26,6 +26,15 @@
#include <glib.h>
+/* These strings are used programatically; they must not be translated */
+#define NAUTILUS_SEARCH_URI_TEXT_NAME "file_name"
+#define NAUTILUS_SEARCH_URI_TEXT_CONTENT "content"
+#define NAUTILUS_SEARCH_URI_TEXT_TYPE "file_type"
+#define NAUTILUS_SEARCH_URI_TEXT_SIZE "size"
+#define NAUTILUS_SEARCH_URI_TEXT_EMBLEMS "keywords"
+#define NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED "modified"
+#define NAUTILUS_SEARCH_URI_TEXT_OWNER "owner"
+
gboolean nautilus_is_search_uri (const char *uri);
char * nautilus_search_uri_to_human (const char *search_uri);
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index ce0b2565a..9f33a1493 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -456,15 +456,30 @@ get_link_name (const char *name, int count)
*/
switch (count % 10) {
case 1:
+ /* Localizers: Feel free to leave out the "st" suffix
+ * if there's no way to do that nicely for a
+ * particular language.
+ */
return g_strdup_printf (_("%dst link to %s"), count, name);
case 2:
+ /* Localizers: Feel free to leave out the "nd" suffix
+ * if there's no way to do that nicely for a
+ * particular language.
+ */
return g_strdup_printf (_("%dnd link to %s"), count, name);
case 3:
+ /* Localizers: Feel free to leave out the "rd" suffix
+ * if there's no way to do that nicely for a
+ * particular language.
+ */
return g_strdup_printf (_("%drd link to %s"), count, name);
+ default:
+ /* Localizers: Feel free to leave out the "th" suffix
+ * if there's no way to do that nicely for a
+ * particular language.
+ */
+ return g_strdup_printf (_("%dth link to %s"), count, name);
}
-
- /* The general case. */
- return g_strdup_printf (_("%dth link to %s"), count, name);
}
static char *
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index c2bff8bca..4892f7fb3 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -1731,15 +1731,27 @@ nautilus_file_get_date_as_string (NautilusFile *file, NautilusDateType date_type
*/
if (file_date_age == 0) {
- /* today, use special word */
+ /* Today, use special word.
+ * Note to localizers: You can look at man strftime
+ * for details on the format, but do no use format
+ * strings that are specific to the GNU version of
+ * the library, or you will make Nautilus less portable.
+ */
format = _("today %-I:%M %p");
} else if (file_date_age == 1) {
- /* yesterday, use special word */
+ /* Yesterday, use special word.
+ * Note to localizers: Same issues as "today" string.
+ */
format = _("yesterday %-I:%M %p");
} else if (file_date_age < 7) {
- /* current week, include day of week */
+ /* Current week, include day of week.
+ * Note to localizers: Same issues as "today" string.
+ */
format = _("%A %-m/%-d/%y %-I:%M %p");
} else {
+ /* Other dates.
+ * Note to localizers: Same issues as "today" string.
+ */
format = _("%-m/%-d/%y %-I:%M %p");
}
diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c
index 07d52d1f7..6cf78abd9 100644
--- a/libnautilus-private/nautilus-icon-canvas-item.c
+++ b/libnautilus-private/nautilus-icon-canvas-item.c
@@ -703,8 +703,10 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item,
text_piece = " ";
}
+ /* The list of characters that cause line breaks can be localized. */
icon_text_info = gnome_icon_layout_text
- (details->font, text_piece, _(" -_,;.?/&"), max_text_width, TRUE);
+ (details->font, text_piece, _(" -_,;.?/&"),
+ max_text_width, TRUE);
/* Draw text if we are not in user rename mode */
if (drawable != NULL && !details->is_renaming) {
diff --git a/libnautilus-private/nautilus-link.c b/libnautilus-private/nautilus-link.c
index 48447c920..cc5e8b246 100644
--- a/libnautilus-private/nautilus-link.c
+++ b/libnautilus-private/nautilus-link.c
@@ -267,19 +267,9 @@ nautilus_link_get_additional_text (const char *link_file_uri)
static char *
make_local_path (const char *image_uri)
{
- char *escaped_uri, *unescaped_uri, *local_directory_path, *local_file_path;
+ char *escaped_uri, *local_directory_path, *local_directory_uri, *local_file_path;
- /* We can't call nautilus_get_local_path_from_uri here, since
- * it will return NULL since it's not a local uri, but we
- * still should unescape.
- */
- unescaped_uri = gnome_vfs_unescape_string (image_uri, "/");
- /* FIXME bugzilla.eazel.com 2492: Why should we unescape? The above can return NULL for
- * URIs with slashes in it and other cases like that.
- */
- /* FIXME bugzilla.eazel.com 2493: Why the +7 below? This seems totally wrong. */
- escaped_uri = gnome_vfs_escape_slashes (unescaped_uri + 7);
- g_free (unescaped_uri);
+ escaped_uri = gnome_vfs_escape_slashes (image_uri);
local_directory_path = g_strconcat
(g_get_home_dir (),
@@ -287,9 +277,10 @@ make_local_path (const char *image_uri)
NULL);
/* We must create the directory if it doesn't exist. */
+ local_directory_uri = gnome_vfs_get_uri_from_local_path (local_directory_path);
/* FIXME bugzilla.eazel.com 2494: Is it OK to ignore the error here? */
- /* FIXME bugzilla.eazel.com 2737: This needs to make the path into a URI if it's going to use gnome_vfs. */
- gnome_vfs_make_directory (local_directory_path, REMOTE_ICON_DIR_PERMISSIONS);
+ gnome_vfs_make_directory (local_directory_uri, REMOTE_ICON_DIR_PERMISSIONS);
+ g_free (local_directory_uri);
local_file_path = nautilus_make_path (local_directory_path, escaped_uri);
g_free (escaped_uri);
diff --git a/libnautilus-private/nautilus-search-bar-criterion.c b/libnautilus-private/nautilus-search-bar-criterion.c
deleted file mode 100644
index 3c15f0390..000000000
--- a/libnautilus-private/nautilus-search-bar-criterion.c
+++ /dev/null
@@ -1,737 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-search-bar-criterion.c - Code to bring up
- the various kinds of criterion supported in the nautilus search
- bar
-
- 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 "nautilus-customization-data.h"
-#include "nautilus-dateedit-extensions.h"
-#include "nautilus-file-utilities.h"
-#include "nautilus-gtk-macros.h"
-#include "nautilus-icon-factory.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>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
-#include <libgnome/gnome-defs.h>
-#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 [] = {
- N_("Name"),
- N_("Content"),
- N_("Type"),
- N_("Size"),
- N_("With Emblem"),
- N_("Last Modified"),
- N_("Owned By"),
- NULL
-};
-
-
-static char *name_relations [] = {
- N_("contains"),
- N_("starts with"),
- N_("ends with"),
- N_("matches glob"),
- N_("matches regexp"),
- NULL
-};
-
-static char *content_relations [] = {
- N_("includes all of"),
- N_("includes any of"),
- N_("does not include all of"),
- N_("includes none of"),
- NULL
-
-};
-
-static char *type_relations [] = {
- N_("is"),
- N_("is not"),
- NULL
-};
-
-static char *type_objects [] = {
- N_("regular file"),
- N_("text file"),
- N_("application"),
- N_("directory"),
- N_("music"),
- NULL
-};
-
-static char *size_relations [] = {
- N_("larger than"),
- N_("smaller than"),
- NULL
-};
-
-static char *emblem_relations [] = {
- N_("marked with"),
- N_("not marked with"),
- NULL
-};
-
-static char *modified_relations [] = {
- 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 *owner_relations [] = {
- N_("is"),
- N_("is not"),
- NULL
-};
-
-static NautilusSearchBarCriterion * nautilus_search_bar_criterion_new (void);
-
-static NautilusSearchBarCriterion * nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType type,
- char *operator_options[],
- gboolean use_value_entry,
- gboolean use_value_menu,
- char *value_options[],
- gboolean use_value_suffix,
- char *value_suffix);
-
-NautilusSearchBarCriterionType get_next_default_search_criterion_type (NautilusSearchBarCriterionType type) ;
-
-static char * get_name_location_for (int relation_number,
- char *name_text);
-static char * get_content_location_for (int relation_number,
- char *name_text);
-static char * get_file_type_location_for (int relation_number,
- int value_number);
-static char * get_size_location_for (int relation_number,
- char *size_text);
-static char * get_emblem_location_for (int relation_number,
- GtkWidget *menu_item);
-static char * get_date_modified_location_for (int relation_number,
- char *date);
-static char * get_owner_location_for (int relation_number,
- char *owner_number);
-static void make_emblem_value_menu (NautilusSearchBarCriterion *criterion);
-
-
-void
-nautilus_search_bar_criterion_destroy (NautilusSearchBarCriterion *criterion)
-{
- /* FIXME bugzilla.eazel.com 2437: need more freeage */
- g_free (criterion->details);
- g_free (criterion);
-}
-
-static NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_new (void)
-{
- return g_new0 (NautilusSearchBarCriterion, 1);
-}
-
-
-static void
-option_menu_callback (GtkWidget *widget, gpointer data)
-{
- NautilusSearchBarCriterion *criterion, *new_criterion;
- int type;
-
- criterion = (NautilusSearchBarCriterion *) data;
-
- type = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT(widget), "type"));
-
- new_criterion = nautilus_search_bar_criterion_next_new (type - 1);
-
- criterion->details->callback (criterion, new_criterion, criterion->details->callback_data);
-
- nautilus_search_bar_criterion_destroy (criterion);
-}
-
-
-void
-nautilus_search_bar_criterion_set_callback (NautilusSearchBarCriterion *criterion,
- NautilusSearchBarCriterionCallback callback,
- gpointer data)
-{
- criterion->details->callback = callback;
- criterion->details->callback_data = data;
-}
-
-
-static NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType type,
- char *relation_options[],
- gboolean use_value_entry,
- gboolean use_value_menu,
- char *value_options[],
- gboolean use_value_suffix,
- char *value_suffix)
-{
- NautilusSearchBarCriterion *criterion;
- GtkWidget *search_criteria_option_menu, *search_criteria_menu;
- GtkWidget *relation_option_menu, *relation_menu;
- GtkWidget *value_option_menu, *value_menu;
-
- int i;
-
- criterion = nautilus_search_bar_criterion_new ();
- criterion->details = g_new0 (NautilusSearchBarCriterionDetails, 1);
- criterion->details->type = type;
-
-
- search_criteria_option_menu = gtk_option_menu_new ();
- search_criteria_menu = gtk_menu_new ();
- for (i = 0; criteria_titles[i] != NULL; i++) {
- GtkWidget *item;
- item = gtk_menu_item_new_with_label (_(criteria_titles[i]));
- gtk_object_set_data (GTK_OBJECT(item), "type", GINT_TO_POINTER(i));
- gtk_signal_connect (GTK_OBJECT (item),
- "activate",
- option_menu_callback,
- (gpointer) criterion);
- gtk_menu_append (GTK_MENU (search_criteria_menu),
- item);
- }
- gtk_menu_set_active (GTK_MENU (search_criteria_menu), type);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (search_criteria_option_menu),
- search_criteria_menu);
- criterion->details->available_criteria = GTK_OPTION_MENU (search_criteria_option_menu);
- gtk_widget_show_all (GTK_WIDGET(search_criteria_option_menu));
-
- relation_option_menu = gtk_option_menu_new ();
- relation_menu = gtk_menu_new ();
- for (i = 0; relation_options[i] != NULL; i++) {
- GtkWidget *item;
- item = gtk_menu_item_new_with_label (_(relation_options[i]));
- gtk_object_set_data (GTK_OBJECT(item), "type", GINT_TO_POINTER(i));
- gtk_menu_append (GTK_MENU (relation_menu),
- item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (relation_option_menu),
- relation_menu);
- criterion->details->relation_menu = GTK_OPTION_MENU (relation_option_menu);
- gtk_widget_show_all (GTK_WIDGET(relation_option_menu));
-
-
-
- g_assert (! (use_value_entry && use_value_menu));
- criterion->details->use_value_entry = use_value_entry;
- if (use_value_entry) {
- criterion->details->value_entry = GTK_ENTRY (gtk_entry_new ());
- gtk_widget_show_all(GTK_WIDGET(criterion->details->value_entry));
- }
- criterion->details->use_value_menu = use_value_menu;
- if (use_value_menu && criterion->details->type != NAUTILUS_EMBLEM_SEARCH_CRITERION) {
- g_return_val_if_fail (value_options != NULL, NULL);
- value_option_menu = gtk_option_menu_new ();
- value_menu = gtk_menu_new ();
- for (i = 0; value_options[i] != NULL; i++) {
- GtkWidget *item;
- item = gtk_menu_item_new_with_label (_(value_options[i]));
- gtk_object_set_data (GTK_OBJECT(item), "type", GINT_TO_POINTER(i));
- gtk_menu_append (GTK_MENU (value_menu),
- item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (value_option_menu),
- value_menu);
- criterion->details->value_menu = GTK_OPTION_MENU (value_option_menu);
- gtk_widget_show_all (GTK_WIDGET(criterion->details->value_menu));
- }
- criterion->details->use_value_suffix = use_value_suffix;
- if (use_value_suffix) {
- g_return_val_if_fail (value_suffix != NULL, NULL);
- 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));
- }
- if (criterion->details->type == NAUTILUS_EMBLEM_SEARCH_CRITERION) {
- make_emblem_value_menu (criterion);
- }
-
- return criterion;
-}
-
-
-NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_next_new (NautilusSearchBarCriterionType criterion_type)
-{
- NautilusSearchBarCriterion *new_criterion;
- NautilusSearchBarCriterionType next_type;
-
- next_type = (criterion_type + 1) % NAUTILUS_LAST_CRITERION;
-
- switch(next_type) {
- case NAUTILUS_FILE_NAME_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_FILE_NAME_SEARCH_CRITERION,
- name_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL);
- break;
- case NAUTILUS_CONTENT_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_CONTENT_SEARCH_CRITERION,
- content_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL);
- break;
- case NAUTILUS_FILE_TYPE_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_FILE_TYPE_SEARCH_CRITERION,
- type_relations,
- FALSE,
- TRUE,
- type_objects,
- FALSE,
- NULL);
- break;
- case NAUTILUS_SIZE_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_SIZE_SEARCH_CRITERION,
- size_relations,
- TRUE,
- FALSE,
- NULL,
- TRUE,
- "K");
- break;
- case NAUTILUS_EMBLEM_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_EMBLEM_SEARCH_CRITERION,
- emblem_relations,
- FALSE,
- FALSE,
- NULL,
- FALSE,
- NULL);
-
- break;
- case NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION,
- modified_relations,
- FALSE,
- FALSE,
- NULL,
- FALSE,
- NULL);
- break;
- case NAUTILUS_OWNER_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_OWNER_SEARCH_CRITERION,
- owner_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL);
- break;
- default:
- g_assert_not_reached ();
- }
-
-
- return new_criterion;
-}
-
-NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_first_new (void)
-{
- return nautilus_search_bar_criterion_new_from_values (NAUTILUS_FILE_NAME_SEARCH_CRITERION,
- name_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL);
-}
-
-/* returns a newly allocated string: needs to be freed by the caller. */
-char *
-nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterion)
-{
- GtkWidget *menu;
- GtkWidget *menu_item;
- int name_number, relation_number, value_number;
- char *value_text;
-
- /* There is ONE thing you should be aware of while implementing this function.
- You have to make sure you use non-translated strings for building the uri.
- So, to implement this, you are supposed to:
- - build various tables which contain the strings corresponding to a search type.
- - call
- option_menu = gtk_option_menu_get_menu (criterion->details->some_menu)
- menu_item = gtk_menu_get_active (optin_menu)
- number = gtk_object_get_data (menu_item, "type")
- */
- menu = gtk_option_menu_get_menu (criterion->details->available_criteria);
- menu_item = gtk_menu_get_active (GTK_MENU (menu));
- name_number = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu_item), "type"));
-
- menu = gtk_option_menu_get_menu (criterion->details->relation_menu);
- menu_item = gtk_menu_get_active (GTK_MENU (menu));
- relation_number = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu_item), "type"));
-
- if (criterion->details->use_value_menu) {
- menu = gtk_option_menu_get_menu (criterion->details->value_menu);
- menu_item = gtk_menu_get_active (GTK_MENU (menu));
- value_number = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu_item), "type"));
- }
- 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);
- case NAUTILUS_CONTENT_SEARCH_CRITERION:
- return get_content_location_for (relation_number,
- value_text);
- case NAUTILUS_FILE_TYPE_SEARCH_CRITERION:
- return get_file_type_location_for (relation_number,
- value_number);
- case NAUTILUS_SIZE_SEARCH_CRITERION:
- return get_size_location_for (relation_number,
- value_text);
- case NAUTILUS_EMBLEM_SEARCH_CRITERION:
- return get_emblem_location_for (relation_number,
- menu_item);
- case NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION:
- return get_date_modified_location_for (relation_number,
- value_text);
- case NAUTILUS_OWNER_SEARCH_CRITERION:
- return get_owner_location_for (relation_number,
- value_text);
- default:
- g_assert_not_reached ();
- return NULL;
- }
-
- g_assert_not_reached ();
- return NULL;
-}
-
-
-NautilusSearchBarCriterionType
-get_next_default_search_criterion_type (NautilusSearchBarCriterionType type)
-{
- switch (type) {
- case NAUTILUS_FILE_NAME_SEARCH_CRITERION:
- return NAUTILUS_CONTENT_SEARCH_CRITERION;
- case NAUTILUS_CONTENT_SEARCH_CRITERION:
- return NAUTILUS_FILE_TYPE_SEARCH_CRITERION;
- case NAUTILUS_FILE_TYPE_SEARCH_CRITERION:
- return NAUTILUS_SIZE_SEARCH_CRITERION;
- case NAUTILUS_SIZE_SEARCH_CRITERION:
- return NAUTILUS_SIZE_SEARCH_CRITERION;
- case NAUTILUS_EMBLEM_SEARCH_CRITERION:
- return NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION;
- case NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION:
- return NAUTILUS_OWNER_SEARCH_CRITERION;
- case NAUTILUS_OWNER_SEARCH_CRITERION:
- return NAUTILUS_FILE_NAME_SEARCH_CRITERION;
- default:
- g_assert_not_reached ();
- return NAUTILUS_LAST_CRITERION;
- }
- return NAUTILUS_LAST_CRITERION;
-}
-
-void
-nautilus_search_bar_criterion_show (NautilusSearchBarCriterion *criterion)
-{
-
- gtk_widget_show (GTK_WIDGET (criterion->details->available_criteria));
- gtk_widget_show (GTK_WIDGET (criterion->details->relation_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));
- }
-}
-
-
-
-void
-nautilus_search_bar_criterion_hide (NautilusSearchBarCriterion *criterion)
-{
-
- gtk_widget_hide (GTK_WIDGET (criterion->details->available_criteria));
- gtk_widget_hide (GTK_WIDGET (criterion->details->relation_menu));
-
- if (criterion->details->use_value_entry) {
- gtk_widget_hide (GTK_WIDGET (criterion->details->value_entry));
- }
- if (criterion->details->use_value_menu) {
- gtk_widget_hide (GTK_WIDGET (criterion->details->value_menu));
- }
-}
-
-char *
-nautilus_search_bar_criterion_human_from_uri (const char *location_uri)
-{
- return g_strdup (location_uri);
-}
-
-char *
-nautilus_search_uri_get_first_criterion (const char *search_uri)
-{
- char *unescaped_uri;
- char *first_criterion;
- int matches;
-
- unescaped_uri = gnome_vfs_unescape_string (search_uri, NULL);
-
- /* Start with a string as long as the URI, since
- * we don't necessarily trust the search_uri to have
- * the pattern we're looking for.
- */
- first_criterion = g_strdup (unescaped_uri);
-
- matches = sscanf (unescaped_uri, "search:[file:///]%s %*s", first_criterion);
- g_free (unescaped_uri);
-
- if (matches == 0) {
- g_free (first_criterion);
- return NULL;
- }
-
- return first_criterion;
-}
-
-
-static char *
-get_name_location_for (int relation_number, char *name_text)
-{
- const char *possible_relations[] = { "contains",
- "begins_with",
- "ends_with",
- "matches",
- "matches_regexp" };
-
- g_assert (relation_number >= 0);
- g_assert (relation_number < 5);
-
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_NAME,
- possible_relations[relation_number],
- name_text);
-
-}
-
-static char *
-get_content_location_for (int relation_number, char *name_text)
-{
- const char *possible_relations[] = { "includes_all_of",
- "includes_any_of",
- "does_not_include_all_of",
- "does_not_include_any_of" };
-
- g_assert (relation_number>= 0);
- g_assert (relation_number < 4);
-
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_CONTENT,
- possible_relations[relation_number],
- name_text);
-}
-
-static char *
-get_file_type_location_for (int relation_number,
- int value_number)
-{
- const char *possible_relations[] = { "is", "is_not" };
- const char *possible_values[] = {"file", "text_file", "application", "directory", "music" };
-
- g_assert (relation_number == 0 || relation_number == 1);
- g_assert (value_number >= 0);
- g_assert (value_number < 5);
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_TYPE,
- possible_relations[relation_number],
- possible_values[value_number]);
-}
-
-
-static char *
-get_size_location_for (int relation_number,
- char *size_text)
-{
- const char *possible_relations[] = { "larger_than", "smaller_than" };
- int entered_size;
-
- g_assert (relation_number == 0 || relation_number == 1);
- /* We put a 'K' after the size, so multiply what the user
- entered by 1000 */
- entered_size = strtol (size_text, NULL, 10);
- /* FIXME bugzilla.eazel.com 2438: Need error handling here */
- g_return_val_if_fail (entered_size >= 0, NULL);
- return g_strdup_printf ("%s %s %d", NAUTILUS_SEARCH_URI_TEXT_SIZE,
- possible_relations[relation_number],
- entered_size * 1000);
-
-}
-
-static char *
-get_emblem_location_for (int relation_number,
- GtkWidget *menu_item)
-{
- const char *possible_relations[] = {"include", "does_not_include" };
- char *emblem_text;
-
- g_assert (relation_number == 0 ||
- relation_number == 1);
- emblem_text = gtk_object_get_data (GTK_OBJECT (menu_item),
- "emblem name");
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_EMBLEMS,
- possible_relations[relation_number],
- emblem_text);
-}
-
-static char *
-get_date_modified_location_for (int relation_number,
- char *date_string)
-{
- 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 *
-get_owner_location_for (int relation_number,
- char *owner_text)
-{
- const char *possible_relations[] = { "is", "is not" };
- g_assert (relation_number == 0 || relation_number == 1);
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_OWNER, possible_relations[relation_number], owner_text);
-
-}
-
-static void
-make_emblem_value_menu (NautilusSearchBarCriterion *criterion)
-{
- NautilusCustomizationData *customization_data;
- GtkWidget *temp_hbox;
- GtkWidget *menu_item;
- char *emblem_file_name;
- char *emblem_display_name;
- GtkWidget *emblem_pixmap_widget;
- GtkLabel *emblem_label;
- GtkWidget *value_option_menu, *value_menu;
-
- /* Add the items to the emblems menu here */
- /* FIXME bugzilla.eazel.com 2738: What are the variables for thumbnail icon height and width */
- value_option_menu = gtk_option_menu_new ();
- value_menu = gtk_menu_new ();
- customization_data = nautilus_customization_data_new ("emblems",
- TRUE,
- NAUTILUS_ICON_SIZE_FOR_MENUS,
- NAUTILUS_ICON_SIZE_FOR_MENUS);
- while (nautilus_customization_data_get_next_element_for_display (customization_data,
- &emblem_file_name,
- &emblem_pixmap_widget,
- &emblem_label) == GNOME_VFS_OK) {
-
- menu_item = gtk_menu_item_new ();
- gtk_label_get (emblem_label, &emblem_display_name);
- gtk_object_set_data (GTK_OBJECT (menu_item), "emblem name", emblem_display_name);
- temp_hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (menu_item), temp_hbox);
- gtk_box_pack_start (GTK_BOX (temp_hbox), emblem_pixmap_widget, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (temp_hbox), GTK_WIDGET (emblem_label), FALSE, FALSE, 0);
- gtk_menu_append (GTK_MENU (value_menu), menu_item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (value_option_menu),
- value_menu);
- criterion->details->value_menu = GTK_OPTION_MENU (value_option_menu);
- gtk_widget_show_all (GTK_WIDGET (criterion->details->value_menu));
- criterion->details->use_value_menu = TRUE;
- g_free (emblem_file_name);
-}
-
-
-
-
-
-
-
-
diff --git a/libnautilus-private/nautilus-search-bar-criterion.h b/libnautilus-private/nautilus-search-bar-criterion.h
deleted file mode 100644
index 9a41be33c..000000000
--- a/libnautilus-private/nautilus-search-bar-criterion.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-search-bar-criterion.h - Types that will
- bring up the various search criteria
-
- 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>
-*/
-
-
-#ifndef NAUTILUS_SEARCH_BAR_CRITERION_H
-#define NAUTILUS_SEARCH_BAR_CRITERION_H
-
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtkentry.h>
-
-
-typedef enum {
- NAUTILUS_FILE_NAME_SEARCH_CRITERION,
- NAUTILUS_CONTENT_SEARCH_CRITERION,
- NAUTILUS_FILE_TYPE_SEARCH_CRITERION,
- NAUTILUS_SIZE_SEARCH_CRITERION,
- NAUTILUS_EMBLEM_SEARCH_CRITERION,
- NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION,
- NAUTILUS_OWNER_SEARCH_CRITERION,
- NAUTILUS_LAST_CRITERION
-} NautilusSearchBarCriterionType;
-
-/* These strings are used programatically; they must not be translated */
-#define NAUTILUS_SEARCH_URI_TEXT_NAME "file_name"
-#define NAUTILUS_SEARCH_URI_TEXT_CONTENT "content"
-#define NAUTILUS_SEARCH_URI_TEXT_TYPE "file_type"
-#define NAUTILUS_SEARCH_URI_TEXT_SIZE "size"
-#define NAUTILUS_SEARCH_URI_TEXT_EMBLEMS "keywords"
-#define NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED "modified"
-#define NAUTILUS_SEARCH_URI_TEXT_OWNER "owner"
-
-typedef struct NautilusSearchBarCriterionDetails NautilusSearchBarCriterionDetails;
-typedef struct NautilusSearchBarCriterion {
- NautilusSearchBarCriterionDetails *details;
- NautilusSearchBarCriterionType type;
-} NautilusSearchBarCriterion;
-
-
-typedef void (* NautilusSearchBarCriterionCallback) (NautilusSearchBarCriterion *old_criterion,
- NautilusSearchBarCriterion *new_criterion,
- gpointer data);
-
-#define NAUTILUS_SEARCH_BAR_CRITERION(arg) (NautilusSearchBarCriterion *) arg
-
-
-
-
-NautilusSearchBarCriterion * nautilus_search_bar_criterion_first_new (void);
-
-NautilusSearchBarCriterion * nautilus_search_bar_criterion_next_new (NautilusSearchBarCriterionType criterion_type);
-
-/* set callback called when the user chooses a new criterion type.
- Used by complex-search-bar */
-void nautilus_search_bar_criterion_set_callback (NautilusSearchBarCriterion *criterion,
- NautilusSearchBarCriterionCallback callback,
- gpointer data);
-/* called by the seach-bar-complex when the user asks for a search to be performed.
- We need toi build the serach uri from the different criterions.
- Each criterion returns the part of the search uri it represents
-*/
-char * nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterion);
-
-void nautilus_search_bar_criterion_show (NautilusSearchBarCriterion *criterion);
-void nautilus_search_bar_criterion_hide (NautilusSearchBarCriterion *criterion);
-
-void nautilus_search_bar_criterion_destroy (NautilusSearchBarCriterion *criterion);
-
-
-/* Search URI utilities. Maybe these should go in a separate file? */
-char * nautilus_search_bar_criterion_human_from_uri (const char *location_uri);
-
-char * nautilus_search_uri_get_first_criterion (const char *search_uri);
-
-
-#endif NAUTILUS_SEARCH_BAR_CRITERION_H
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libnautilus-private/nautilus-search-uri.h b/libnautilus-private/nautilus-search-uri.h
index 96ed4d200..b634ac142 100644
--- a/libnautilus-private/nautilus-search-uri.h
+++ b/libnautilus-private/nautilus-search-uri.h
@@ -26,6 +26,15 @@
#include <glib.h>
+/* These strings are used programatically; they must not be translated */
+#define NAUTILUS_SEARCH_URI_TEXT_NAME "file_name"
+#define NAUTILUS_SEARCH_URI_TEXT_CONTENT "content"
+#define NAUTILUS_SEARCH_URI_TEXT_TYPE "file_type"
+#define NAUTILUS_SEARCH_URI_TEXT_SIZE "size"
+#define NAUTILUS_SEARCH_URI_TEXT_EMBLEMS "keywords"
+#define NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED "modified"
+#define NAUTILUS_SEARCH_URI_TEXT_OWNER "owner"
+
gboolean nautilus_is_search_uri (const char *uri);
char * nautilus_search_uri_to_human (const char *search_uri);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 95343f221..a68aa7b38 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -9,7 +9,7 @@ components/services/vault/command-line/main.c
components/shell/shell.c
components/websearch/ntl-web-search.c
libnautilus-extensions/nautilus-program-choosing.c
-libnautilus-extensions/nautilus-search-bar-criterion.c
+src/nautilus-search-bar-criterion.c
libnautilus-extensions/nautilus-stock-dialogs.c
nautilus-installer/src/installer.c
nautilus-installer/src/support.c
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index ec1886bbb..1b97d7969 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -1120,10 +1120,17 @@ fm_directory_view_display_selection_info (FMDirectoryView *view)
} else if (folder_count == 0) {
status_string = g_strdup (non_folder_str);
} else if (non_folder_count == 0) {
- status_string = g_strdup_printf (_("%s%s"),
+ /* No use marking this for translation, since you
+ * can't reorder the strings, which is the main thing
+ * you'd want to do.
+ */
+ status_string = g_strdup_printf ("%s%s",
folder_count_str,
folder_item_count_str);
} else {
+ /* This is marked for translation in case a localizer
+ * needs to change ", " to something else.
+ */
status_string = g_strdup_printf (_("%s%s, %s"),
folder_count_str,
folder_item_count_str,
@@ -2577,18 +2584,11 @@ other_viewer_callback (GtkMenuItem *menu_item, GList *files)
}
static void
-add_open_with_gtk_menu_item (GtkMenu *menu, const char *label)
+add_separator (GtkMenu *menu)
{
GtkWidget *menu_item;
- /* FIXME bugzilla.eazel.com 2735: This is only called to add a separator? */
- if (label != NULL) {
- menu_item = gtk_menu_item_new_with_label (label);
- } else {
- /* No label means this is a separator. */
- menu_item = gtk_menu_item_new ();
- }
-
+ menu_item = gtk_menu_item_new ();
finish_adding_menu_item (menu, menu_item, TRUE);
}
@@ -2700,13 +2700,10 @@ create_open_with_gtk_menu (FMDirectoryView *view, GList *files)
if (nautilus_g_list_exactly_one_item (files)) {
uri = nautilus_file_get_uri (NAUTILUS_FILE (files->data));
- applications =
- nautilus_mime_get_short_list_applications_for_uri (uri);
-
+ applications = nautilus_mime_get_short_list_applications_for_uri (uri);
for (node = applications; node != NULL; node = node->next) {
add_application_to_gtk_menu (view, open_with_menu, node->data, uri);
}
-
gnome_vfs_mime_application_list_free (applications);
append_gtk_menu_item_with_view (view,
@@ -2716,15 +2713,12 @@ create_open_with_gtk_menu (FMDirectoryView *view, GList *files)
other_application_callback,
files);
- add_open_with_gtk_menu_item (open_with_menu, NULL);
-
- components =
- nautilus_mime_get_short_list_components_for_uri (uri);
+ add_separator (open_with_menu);
+ components = nautilus_mime_get_short_list_components_for_uri (uri);
for (node = components; node != NULL; node = node->next) {
add_component_to_gtk_menu (view, open_with_menu, node->data, uri);
}
-
gnome_vfs_mime_component_list_free (components);
g_free (uri);
diff --git a/src/file-manager/fm-search-list-view.c b/src/file-manager/fm-search-list-view.c
index d184db3ea..89d702ca9 100644
--- a/src/file-manager/fm-search-list-view.c
+++ b/src/file-manager/fm-search-list-view.c
@@ -29,17 +29,23 @@
#include "fm-directory-view.h"
#include "fm-list-view-private.h"
#include "nautilus-indexing-info.h"
+#include <libgnome/gnome-i18n.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
#include <libnautilus-extensions/nautilus-file-attributes.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
-#include <libnautilus-extensions/nautilus-search-bar-criterion.h>
#include <libnautilus-extensions/nautilus-search-uri.h>
#include <libnautilus-extensions/nautilus-string.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
-#include <libgnome/gnome-i18n.h>
+/* FIXME bugzilla.eazel.com 2815: This code uses part of the
+ * NautilusSearchBarCriterion class, which is really for complex
+ * search bar user interface. We only need to do some non-UI
+ * manipulations of the search URI, so we can refactor the code, put
+ * more into nautilus-search-uri.[ch] and get rid of this terrible
+ * include statement.
+ */
+#include "../nautilus-search-bar-criterion.h"
/* Paths to use when creating & referring to Bonobo menu items */
#define MENU_PATH_INDEXING_INFO "/File/Indexing Info..."
@@ -539,5 +545,4 @@ reveal_selected_items_callback (gpointer ignored, gpointer user_data)
nautilus_file_list_free (selection);
-
}
diff --git a/src/nautilus-complex-search-bar.c b/src/nautilus-complex-search-bar.c
index 73e1ea9b7..801818f42 100644
--- a/src/nautilus-complex-search-bar.c
+++ b/src/nautilus-complex-search-bar.c
@@ -25,22 +25,19 @@
/* nautilus-complex-search-bar.c - Search bar containing many attributes
*/
-
-
+#include <config.h>
#include "nautilus-complex-search-bar.h"
-
+#include "nautilus-search-bar-criterion-private.h"
+#include "nautilus-search-bar-criterion.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <gtk/gtkeventbox.h>
#include <libgnomevfs/gnome-vfs-utils.h>
-
#include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h>
+#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-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>
struct NautilusComplexSearchBarDetails {
diff --git a/src/nautilus-main.c b/src/nautilus-main.c
index 960465d45..1ae30173a 100644
--- a/src/nautilus-main.c
+++ b/src/nautilus-main.c
@@ -95,13 +95,12 @@ main (int argc, char *argv[])
gboolean stop_desktop;
gboolean start_desktop;
gboolean perform_self_check;
-
poptContext popt_context;
const char **args;
-
CORBA_ORB orb;
NautilusApplication *application;
-
+ char **argv_copy;
+
struct poptOption options[] = {
#ifndef NAUTILUS_OMIT_SELF_CHECK
{ "check", '\0', POPT_ARG_NONE, &perform_self_check, 0, N_("Perform high-speed self-check tests."), NULL },
@@ -128,18 +127,49 @@ main (int argc, char *argv[])
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
#endif
-
- /* Initialize the services that we use. */
- kill_shell = FALSE;
- restart_shell = FALSE;
- stop_desktop = FALSE;
- start_desktop = FALSE;
- perform_self_check = FALSE;
+ /* Get parameters. */
+ kill_shell = FALSE;
+ restart_shell = FALSE;
+ stop_desktop = FALSE;
+ start_desktop = FALSE;
+ perform_self_check = FALSE;
gnome_init_with_popt_table ("nautilus", VERSION,
argc, argv, options, 0,
&popt_context);
-
+
+ /* Check for argument consistency. */
+ args = poptGetArgs (popt_context);
+ if (perform_self_check && args != NULL) {
+ fprintf (stderr, _("nautilus: --check cannot be used with URIs.\n"));
+ return EXIT_FAILURE;
+ }
+ if (perform_self_check && (kill_shell || restart_shell || stop_desktop || start_desktop)) {
+ fprintf (stderr, _("nautilus: --check cannot be used with other options.\n"));
+ return EXIT_FAILURE;
+ }
+ if (kill_shell && args != NULL) {
+ fprintf (stderr, _("nautilus: --quit cannot be used with URIs.\n"));
+ return EXIT_FAILURE;
+ }
+ if (restart_shell && args != NULL) {
+ fprintf (stderr, _("nautilus: --restart cannot be used with URIs.\n"));
+ return EXIT_FAILURE;
+ }
+ if (kill_shell && start_desktop) {
+ fprintf (stderr, _("nautilus: --quit and --start-desktop cannot be used together.\n"));
+ return EXIT_FAILURE;
+ }
+ if (restart_shell && start_desktop) {
+ fprintf (stderr, _("nautilus: --restart and --start-desktop cannot be used together.\n"));
+ return EXIT_FAILURE;
+ }
+ if (stop_desktop && start_desktop) {
+ fprintf (stderr, _("nautilus: --stop-desktop and --start-desktop cannot be used together.\n"));
+ return EXIT_FAILURE;
+ }
+
+ /* Initialize the services that we use. */
g_thread_init (NULL);
orb = oaf_init (argc, argv);
gnome_vfs_init ();
@@ -156,55 +186,38 @@ main (int argc, char *argv[])
#endif
} else {
/* Run the nautilus application. */
-
- args = poptGetArgs (popt_context);
-
- if (kill_shell && args != NULL) {
- fprintf(stderr, _("nautilus: --quit cannot be used with URIs.\n"));
- } else if (restart_shell && args != NULL) {
- fprintf(stderr, _("nautilus: --restart cannot be used with URIs.\n"));
- } else if (kill_shell && start_desktop) {
- fprintf(stderr, _("nautilus: --quit and --start-desktop cannot be used together.\n"));
- } else if (restart_shell && start_desktop) {
- fprintf(stderr, _("nautilus: --restart and --start-desktop cannot be used together.\n"));
- } else if (stop_desktop && start_desktop) {
- fprintf(stderr, _("nautiluls: --stop-desktop and --start-desktop cannot be used together.\n"));
- } else {
- application = nautilus_application_new ();
- nautilus_application_startup (application,
- kill_shell,
- restart_shell,
- stop_desktop,
- start_desktop,
- args);
- if (nautilus_main_is_event_loop_needed ()) {
- bonobo_main ();
- }
- bonobo_object_unref (BONOBO_OBJECT (application));
+ application = nautilus_application_new ();
+ nautilus_application_startup
+ (application,
+ kill_shell, restart_shell,
+ stop_desktop, start_desktop,
+ args);
+ if (nautilus_main_is_event_loop_needed ()) {
+ bonobo_main ();
}
+ bonobo_object_unref (BONOBO_OBJECT (application));
poptFreeContext(popt_context);
}
gnome_vfs_shutdown ();
- /* if told to restart, exec() myself again */
- if (getenv ("_NAUTILUS_RESTART")) {
- char *my_path = argv[0];
- char **argv_copy;
- int i;
-
+ /* If told to restart, exec() myself again. This is used when
+ * the program is told to restart with CORBA, for example when
+ * an update takes place.
+ */
+ if (getenv ("_NAUTILUS_RESTART") != NULL) {
unsetenv ("_NAUTILUS_RESTART");
- /* might eventually want to copy all the parameters from argv into the new exec.
- * for now, though, that would just interfere with the re-creation of windows
- * (whose info is stored in gconf).
+ /* Might eventually want to copy all the parameters
+ * from argv into the new exec. For now, though, that
+ * would just interfere with the re-creation of
+ * windows based on the window info stored in gconf,
+ * including whether the desktop was started.
*/
argv_copy = g_new0 (char *, 2);
argv_copy[0] = argv[0];
- argv_copy[1] = NULL;
- i = i;
- execvp(my_path, argv_copy);
+ execvp (argv[0], argv_copy);
}
return EXIT_SUCCESS;
diff --git a/src/nautilus-search-bar-criterion.c b/src/nautilus-search-bar-criterion.c
index 352f3a229..9fc4d9465 100644
--- a/src/nautilus-search-bar-criterion.c
+++ b/src/nautilus-search-bar-criterion.c
@@ -24,31 +24,31 @@
Author: Rebecca Schulman <rebecka@eazel.com>
*/
-#include <libnautilus-extensions/nautilus-customization-data.h>
-#include <libnautilus-extensions/nautilus-dateedit-extensions.h>
-#include <libnautilus-extensions/nautilus-file-utilities.h>
-#include <libnautilus-extensions/nautilus-gtk-macros.h>
-#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <config.h>
#include "nautilus-search-bar-criterion.h"
+
#include "nautilus-search-bar-criterion-private.h"
#include "nautilus-signaller.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include <gtk/gtksignal.h>
#include <gtk/gtkentry.h>
-#include <gtk/gtkoptionmenu.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkmenu.h>
#include <gtk/gtkmenuitem.h>
+#include <gtk/gtkoptionmenu.h>
+#include <gtk/gtksignal.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
#include <libgnomeui/gnome-dateedit.h>
#include <libgnomeui/gnome-uidefs.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
+#include <libnautilus-extensions/nautilus-customization-data.h>
+#include <libnautilus-extensions/nautilus-dateedit-extensions.h>
+#include <libnautilus-extensions/nautilus-file-utilities.h>
+#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-icon-factory.h>
+#include <libnautilus-extensions/nautilus-search-uri.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
static char * criteria_titles [] = {
N_("Name"),
@@ -570,15 +570,16 @@ static char *
get_name_location_for (int relation_number, char *name_text)
{
const char *possible_relations[] = { "contains",
- "begins_with",
- "ends_with",
- "matches",
- "matches_regexp" };
+ "begins_with",
+ "ends_with",
+ "matches",
+ "matches_regexp" };
g_assert (relation_number >= 0);
g_assert (relation_number < 5);
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_NAME,
+ return g_strdup_printf ("%s %s %s",
+ NAUTILUS_SEARCH_URI_TEXT_NAME,
possible_relations[relation_number],
name_text);
@@ -595,7 +596,8 @@ get_content_location_for (int relation_number, char *name_text)
g_assert (relation_number>= 0);
g_assert (relation_number < 4);
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_CONTENT,
+ return g_strdup_printf ("%s %s %s",
+ NAUTILUS_SEARCH_URI_TEXT_CONTENT,
possible_relations[relation_number],
name_text);
}
@@ -610,7 +612,9 @@ get_file_type_location_for (int relation_number,
g_assert (relation_number == 0 || relation_number == 1);
g_assert (value_number >= 0);
g_assert (value_number < 5);
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_TYPE,
+
+ return g_strdup_printf ("%s %s %s",
+ NAUTILUS_SEARCH_URI_TEXT_TYPE,
possible_relations[relation_number],
possible_values[value_number]);
}
@@ -683,6 +687,16 @@ get_date_modified_location_for (int relation_number,
} else {
result = g_strdup ("");
}
+ 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;
}
@@ -693,8 +707,10 @@ get_owner_location_for (int relation_number,
{
const char *possible_relations[] = { "is", "is not" };
g_assert (relation_number == 0 || relation_number == 1);
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_OWNER, possible_relations[relation_number], owner_text);
-
+ return g_strdup_printf ("%s %s %s",
+ NAUTILUS_SEARCH_URI_TEXT_OWNER,
+ possible_relations[relation_number],
+ owner_text);
}
static void
diff --git a/src/nautilus-search-bar-criterion.h b/src/nautilus-search-bar-criterion.h
index 39e077253..4be1dd37b 100644
--- a/src/nautilus-search-bar-criterion.h
+++ b/src/nautilus-search-bar-criterion.h
@@ -42,15 +42,6 @@ typedef enum {
NAUTILUS_LAST_CRITERION
} NautilusSearchBarCriterionType;
-/* These strings are used programatically; they must not be translated */
-#define NAUTILUS_SEARCH_URI_TEXT_NAME "file_name"
-#define NAUTILUS_SEARCH_URI_TEXT_CONTENT "content"
-#define NAUTILUS_SEARCH_URI_TEXT_TYPE "file_type"
-#define NAUTILUS_SEARCH_URI_TEXT_SIZE "size"
-#define NAUTILUS_SEARCH_URI_TEXT_EMBLEMS "keywords"
-#define NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED "modified"
-#define NAUTILUS_SEARCH_URI_TEXT_OWNER "owner"
-
typedef struct NautilusSearchBarCriterionDetails NautilusSearchBarCriterionDetails;
typedef struct NautilusSearchBarCriterion {
NautilusSearchBarCriterionDetails *details;
@@ -92,17 +83,4 @@ char * nautilus_search_bar_criterion_human_from_uri
char * nautilus_search_uri_get_first_criterion (const char *search_uri);
-
-#endif NAUTILUS_SEARCH_BAR_CRITERION_H
-
-
-
-
-
-
-
-
-
-
-
-
+#endif /* NAUTILUS_SEARCH_BAR_CRITERION_H */
diff --git a/src/nautilus-simple-search-bar.c b/src/nautilus-simple-search-bar.c
index e31c38e55..3effdb381 100644
--- a/src/nautilus-simple-search-bar.c
+++ b/src/nautilus-simple-search-bar.c
@@ -28,11 +28,12 @@
#include <config.h>
#include "nautilus-simple-search-bar.h"
+#include "nautilus-search-bar-criterion.h"
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
+#include <libnautilus-extensions/nautilus-search-uri.h>
#include <libnautilus-extensions/nautilus-string.h>
-#include <libnautilus-extensions/nautilus-search-bar-criterion.h>
struct NautilusSimpleSearchBarDetails {
GtkEntry *entry;
diff --git a/src/nautilus-zoom-control.c b/src/nautilus-zoom-control.c
index befa8e188..200522d5a 100644
--- a/src/nautilus-zoom-control.c
+++ b/src/nautilus-zoom-control.c
@@ -463,7 +463,7 @@ zoom_menu_callback (GtkMenuItem *item, gpointer callback_data)
double zoom_level;
NautilusZoomControl *zoom_control;
- zoom_level = *(double*) gtk_object_get_data (GTK_OBJECT (item), "zoom_level");
+ zoom_level = * (double *) gtk_object_get_data (GTK_OBJECT (item), "zoom_level");
zoom_control = NAUTILUS_ZOOM_CONTROL (callback_data);
/* Check to see if we can zoom out */
@@ -483,7 +483,10 @@ create_zoom_menu_item (GtkMenu *menu, GtkWidget *widget, double zoom_level)
zoom_control = NAUTILUS_ZOOM_CONTROL (widget);
- g_snprintf(item_text, sizeof (item_text), _("%.0f%%"), 100.0 * zoom_level);
+ /* This is marked for localization in case the % sign is not
+ * appropriate in some locale. I guess that's unlikely.
+ */
+ g_snprintf (item_text, sizeof (item_text), _("%.0f%%"), 100.0 * zoom_level);
menu_item = gtk_check_menu_item_new_with_label (item_text);
zoom_level_ptr = g_new (double, 1);
@@ -512,7 +515,7 @@ create_zoom_menu(GtkWidget *zoom_control)
p = NAUTILUS_ZOOM_CONTROL (zoom_control)->details->preferred_zoom_levels;
while (p != NULL) {
- create_zoom_menu_item (menu, zoom_control, *(double*)p->data);
+ create_zoom_menu_item (menu, zoom_control, * (double *) p->data);
p = g_list_next (p);
}