summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-12-07 01:55:39 +0000
committerDarin Adler <darin@src.gnome.org>2000-12-07 01:55:39 +0000
commit8c198fce0a31fd7f0653c1d80d04342953b7944b (patch)
tree05f0b821af3be4694f1ff6c73b07783085a5b612 /src
parent9643a99a47fc3b597b44528bb09e2152a6d2fb96 (diff)
downloadnautilus-8c198fce0a31fd7f0653c1d80d04342953b7944b.tar.gz
reviewed by: John Sullivan <sullivan@eazel.com>
Fixed bug 4992 ("New folder" menu item enable state doesn't follow permissions), bug 4965 (Dragging multiple items to location bar crashes Nautilus), and bug 4995 (Rename a file to bad name -> error cites wrong filename). Fixed a bug jsh spotted where we were doing the mod. time checks wrong in the icon factory for thumbnails. Did some wording fixes after menthos pointed out some problems. * libnautilus-extensions/nautilus-icon-factory.c: (get_cache_time): Split out this function to get the mtime of a file so we can check when it changed. (load_specific_icon): Get the time when loading an icon. (scale_icon): Copy the time when making a scaled icon from an existing icon. (remove_icons_if_file_changed): New renamed function uses get_cache_time to check if the icon needs recomputing because of a change in the underlying file. (get_icon_from_cache): Call the new remove_icons_if_file_changed. (load_icon_with_embedded_text): Copy the time when making an icon with text from an existing icon. * libnautilus-extensions/nautilus-file-attributes.h: Added ATTRIBUTE_CAPABILITIES (and sorted in alphabetical order). * libnautilus-extensions/nautilus-directory-async.c: (nautilus_directory_set_up_request): Changed the name of this, made it public, and added ATTRIBUTE_CAPABILITIES as another way to ask for the file info. (cancel_loading_attributes), (nautilus_directory_cancel_loading_file_attributes): Set up a request and use it to decide what to cancel. * libnautilus-extensions/nautilus-directory-private.h: Moved the request structure and call into here so it can be used by NautilusFile and NautilusDirectory both. * libnautilus-extensions/nautilus-file.c: (nautilus_file_forget_attributes_internal): Set up a request and use it to decide what to forget. (nautilus_file_forget_all_attributes): Add ATTRIBUTE_CAPABILITIES to the set of things in "all". * src/file-manager/fm-directory-view.c: (check_for_directory_hard_limit): Added a FIXME and made some minor wording improvements. (file_changed_callback): Helper to schedule a menu update when the directory's NautilusFile reports a change. (load_directory): Add monitoring of the directory's "capabilities" since they affect whether "New Folder" is allowed. Fixes 4992. (disconnect_handler): Helper for the two functions below. (disconnect_directory_handler): Disconnect a NautilusDirectory handler. (disconnect_directory_as_file_handler): Disconnect a NautilusFile handler. (disconnect_model_handlers): Add code to stop monitoring the directory's "capabilities". * src/file-manager/fm-error-reporting.c: (fm_report_error_renaming_file): Got rid of some unneeded "\n" characters. Improved the error message in the "/"-forbidden case with a specific special case message and the proper file name (was using the old file name, not the new one). Fixes 4995. (fm_rename_file): Added quotes to message. * src/nautilus-location-bar.h: Removed unused fields. * src/nautilus-location-bar.c: (nautilus_location_bar_get_window): Find the window by looking for an ancestor instead of trying to use gtk_object_get_data (on data no one was setting any more!). Fixes 4965. (nautilus_location_bar_initialize): Got rid of redundant initialization to NULL. (nautilus_location_bar_set_location): Got rid of gratuitous check before calling g_free. (nautilus_location_bar_update_label): Added a localization-related FIXME here. * libnautilus-extensions/nautilus-file-operations.c: (handle_xfer_vfs_error): Corrected the "it's" to "its" even though I know that John and Pavel were writing an improved version of the entire message. * libnautilus-extensions/nautilus-search-uri.c: (get_translated_criterion), (nautilus_self_check_search_uri): Say "folder" instead of "directory". * src/nautilus-search-bar-criterion.c: Say "folder" instead of "directory". * src/nautilus-theme-selector.c: (add_theme_to_icons): Say "folder" instead of "directory". Other minor wording improvements. (make_theme_description): Minor wording improvement. * src/nautilus-window-manage-views.c: (window_set_title_with_timestamp): Added a FIXME.
Diffstat (limited to 'src')
-rw-r--r--src/file-manager/fm-directory-view.c72
-rw-r--r--src/file-manager/fm-error-reporting.c23
-rw-r--r--src/nautilus-location-bar.c14
-rw-r--r--src/nautilus-location-bar.h5
-rw-r--r--src/nautilus-search-bar-criterion.c2
-rw-r--r--src/nautilus-theme-selector.c54
-rw-r--r--src/nautilus-window-manage-views.c9
7 files changed, 111 insertions, 68 deletions
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index c83ad562f..9b2c27158 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -136,6 +136,7 @@ struct FMDirectoryViewDetails
guint files_added_handler_id;
guint files_changed_handler_id;
guint load_error_handler_id;
+ guint file_changed_handler_id;
GList *pending_files_added;
GList *pending_files_changed;
@@ -1354,12 +1355,13 @@ check_for_directory_hard_limit (FMDirectoryView *view)
directory = view->details->model;
if (nautilus_directory_file_list_length_reached (directory)) {
- dialog = nautilus_warning_dialog (_("We're sorry, but the directory you're viewing has more files than "
- "we're able to display. As a result, we are only able to show you the "
- "first 4000 files it contains. "
+ /* FIXME: This says Preview Release explicitly. Must remove for real thing. */
+ dialog = nautilus_warning_dialog (_("We're sorry, but the folder you're viewing has more files than "
+ "we're able to display. As a result, we are only able to show you the "
+ "first 4000 files it contains."
"\n"
"This is a temporary limitation in this Preview Release of Nautilus, "
- "and will not be present in the final shipping version.\n"),
+ "and will not be present in the final version."),
_("Too many Files"),
get_containing_window (view));
}
@@ -3468,6 +3470,12 @@ fm_directory_view_activate_files (FMDirectoryView *view,
}
}
+static void
+file_changed_callback (NautilusFile *file, gpointer callback_data)
+{
+ schedule_update_menus (FM_DIRECTORY_VIEW (callback_data));
+}
+
/**
* load_directory:
*
@@ -3512,9 +3520,9 @@ load_directory (FMDirectoryView *view,
view->details->force_reload = force_reload;
- /* FIXME: In theory, we also need to monitor here (as well as
- * doing a call when ready), in case external forces change
- * the directory's file metadata.
+ /* FIXME: In theory, we also need to monitor metadata here (as
+ * well as doing a call when ready), in case external forces
+ * change the directory's file metadata.
*/
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA);
nautilus_file_call_when_ready
@@ -3522,6 +3530,20 @@ load_directory (FMDirectoryView *view,
attributes,
metadata_ready_callback, view);
g_list_free (attributes);
+
+ /* If capabilities change, then we need to update the menus
+ * because of New Folder.
+ */
+ attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES);
+ nautilus_file_monitor_add (view->details->directory_as_file,
+ view, attributes);
+ g_list_free (attributes);
+
+ view->details->file_changed_handler_id = gtk_signal_connect
+ (GTK_OBJECT (view->details->directory_as_file),
+ "changed",
+ file_changed_callback,
+ view);
}
static void
@@ -3633,26 +3655,42 @@ fm_directory_view_merge_menus (FMDirectoryView *view)
}
static void
-disconnect_handler (FMDirectoryView *view, int *id)
+disconnect_handler (GtkObject *object, int *id)
{
if (*id != 0) {
- gtk_signal_disconnect (GTK_OBJECT (view->details->model), *id);
+ gtk_signal_disconnect (object, *id);
*id = 0;
}
}
static void
+disconnect_directory_handler (FMDirectoryView *view, int *id)
+{
+ disconnect_handler (GTK_OBJECT (view->details->model), id);
+}
+
+static void
+disconnect_directory_as_file_handler (FMDirectoryView *view, int *id)
+{
+ disconnect_handler (GTK_OBJECT (view->details->directory_as_file), id);
+}
+
+static void
disconnect_model_handlers (FMDirectoryView *view)
{
- disconnect_handler (view, &view->details->files_added_handler_id);
- disconnect_handler (view, &view->details->files_changed_handler_id);
- disconnect_handler (view, &view->details->load_error_handler_id);
- if (view->details->model != NULL) {
- nautilus_directory_file_monitor_remove (view->details->model, view);
- nautilus_file_cancel_call_when_ready (view->details->directory_as_file,
- metadata_ready_callback,
- view);
+ if (view->details->model == NULL) {
+ return;
}
+ disconnect_directory_handler (view, &view->details->files_added_handler_id);
+ disconnect_directory_handler (view, &view->details->files_changed_handler_id);
+ disconnect_directory_handler (view, &view->details->load_error_handler_id);
+ disconnect_directory_as_file_handler (view, &view->details->file_changed_handler_id);
+ nautilus_directory_file_monitor_remove (view->details->model, view);
+ nautilus_file_cancel_call_when_ready (view->details->directory_as_file,
+ metadata_ready_callback,
+ view);
+ nautilus_file_monitor_remove (view->details->directory_as_file,
+ view);
}
/**
diff --git a/src/file-manager/fm-error-reporting.c b/src/file-manager/fm-error-reporting.c
index e4a26bb63..d545cadef 100644
--- a/src/file-manager/fm-error-reporting.c
+++ b/src/file-manager/fm-error-reporting.c
@@ -26,6 +26,7 @@
#include <config.h>
#include "fm-error-reporting.h"
+#include <string.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libnautilus-extensions/nautilus-file.h>
@@ -51,20 +52,29 @@ fm_report_error_renaming_file (NautilusFile *file,
switch (error) {
case GNOME_VFS_ERROR_FILE_EXISTS:
- message = g_strdup_printf (_("The name \"%s\" is already used in this folder.\nPlease use a different name."),
+ message = g_strdup_printf (_("The name \"%s\" is already used in this folder. "
+ "Please use a different name."),
new_name);
break;
case GNOME_VFS_ERROR_NOT_FOUND:
- message = g_strdup_printf (_("There is no \"%s\" in this folder. Perhaps it was just moved or deleted?"),
+ message = g_strdup_printf (_("There is no \"%s\" in this folder. "
+ "Perhaps it was just moved or deleted?"),
new_name);
break;
case GNOME_VFS_ERROR_ACCESS_DENIED:
- message = g_strdup_printf (_("You do not have the permissions necessary to rename \"%s.\""),
+ message = g_strdup_printf (_("You do not have the permissions necessary to rename \"%s\"."),
original_name);
break;
case GNOME_VFS_ERROR_NOT_PERMITTED:
- message = g_strdup_printf (_("The name \"%s.\" is not valid. \nPlease use a different name."),
- original_name);
+ if (strchr (new_name, '/') != NULL) {
+ message = g_strdup_printf (_("The name \"%s\" is not valid because it contains the character \"/\". "
+ "Please use a different name."),
+ new_name);
+ } else {
+ message = g_strdup_printf (_("The name \"%s\" is not valid. "
+ "Please use a different name."),
+ new_name);
+ }
break;
default:
/* We should invent decent error messages for every case we actually experience. */
@@ -73,6 +83,7 @@ fm_report_error_renaming_file (NautilusFile *file,
message = g_strdup_printf (_("Sorry, couldn't rename \"%s\" to \"%s\"."),
original_name, new_name);
}
+
g_free (original_name);
nautilus_error_dialog (message, _("Renaming Error"), NULL);
@@ -211,7 +222,7 @@ fm_rename_file (NautilusFile *file,
/* Start the timed wait to cancel the rename. */
old_name = nautilus_file_get_name (file);
- wait_message = g_strdup_printf (_("Renaming %s to %s."),
+ wait_message = g_strdup_printf (_("Renaming \"%s\" to \"%s\"."),
old_name,
new_name);
g_free (old_name);
diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c
index 23b2b3d0d..cd4420627 100644
--- a/src/nautilus-location-bar.c
+++ b/src/nautilus-location-bar.c
@@ -92,7 +92,7 @@ static NautilusWindow *
nautilus_location_bar_get_window (GtkWidget *bar)
{
- return NAUTILUS_WINDOW (gtk_object_get_data (GTK_OBJECT (bar), "associated_window"));
+ return NAUTILUS_WINDOW (gtk_widget_get_ancestor (bar, NAUTILUS_TYPE_WINDOW));
}
static void
@@ -439,8 +439,6 @@ nautilus_location_bar_initialize (NautilusLocationBar *bar)
GtkWidget *event_box;
GtkWidget *hbox;
- bar->last_location = NULL;
-
hbox = gtk_hbox_new (0, FALSE);
event_box = gtk_event_box_new ();
@@ -495,8 +493,6 @@ nautilus_location_bar_initialize (NautilusLocationBar *bar)
bar->label = GTK_LABEL (label);
bar->entry = GTK_ENTRY (entry);
-
-
}
@@ -540,10 +536,7 @@ nautilus_location_bar_set_location (NautilusNavigationBar *navigation_bar,
/* remember the original location for later comparison */
- if (bar->last_location) {
- g_free (bar->last_location);
- }
-
+ g_free (bar->last_location);
bar->last_location = g_strdup (location);
nautilus_location_bar_update_label (bar);
}
@@ -591,6 +584,9 @@ nautilus_location_bar_update_label (NautilusLocationBar *bar)
if (nautilus_uris_match (bar->last_location, current_location)) {
gtk_label_set_text (GTK_LABEL (bar->label), _("Location:"));
} else {
+ /* FIXME: Use of spaces here to line up Go To with
+ * Location is fragile and hard to translate.
+ */
gtk_label_set_text (GTK_LABEL (bar->label), _(" Go To:"));
}
g_free (current_location);
diff --git a/src/nautilus-location-bar.h b/src/nautilus-location-bar.h
index 3175ad890..1f419a473 100644
--- a/src/nautilus-location-bar.h
+++ b/src/nautilus-location-bar.h
@@ -49,10 +49,7 @@ typedef struct NautilusLocationBar {
GtkLabel *label;
GtkEntry *entry;
-
- gchar *undo_text;
- gchar *last_location;
- gboolean undo_registered;
+ char *last_location;
} NautilusLocationBar;
typedef struct {
diff --git a/src/nautilus-search-bar-criterion.c b/src/nautilus-search-bar-criterion.c
index 88c0422ef..43669aa8c 100644
--- a/src/nautilus-search-bar-criterion.c
+++ b/src/nautilus-search-bar-criterion.c
@@ -103,7 +103,7 @@ static char *type_objects [] = {
N_("regular file"),
N_("text file"),
N_("application"),
- N_("directory"),
+ N_("folder"),
N_("music"),
NULL
};
diff --git a/src/nautilus-theme-selector.c b/src/nautilus-theme-selector.c
index 11a819dd7..13b7e0991 100644
--- a/src/nautilus-theme-selector.c
+++ b/src/nautilus-theme-selector.c
@@ -370,7 +370,7 @@ add_theme_to_icons (GtkWidget *widget, gpointer *data)
g_free (temp_path);
if (!g_file_exists (xml_path)) {
- char *message = g_strdup_printf (_("Sorry, but %s is not a valid theme directory."), theme_path);
+ char *message = g_strdup_printf (_("Sorry, but \"%s\" is not a valid theme folder."), theme_path);
nautilus_error_dialog (message, _("Couldn't add theme"), GTK_WINDOW (theme_selector));
g_free (message);
} else {
@@ -399,7 +399,7 @@ add_theme_to_icons (GtkWidget *widget, gpointer *data)
g_free (theme_destination_path);
if (result != GNOME_VFS_OK) {
- char *message = g_strdup_printf (_("Sorry, but the theme %s couldn't be installed."), theme_path);
+ char *message = g_strdup_printf (_("Sorry, but the \"%s\" theme couldn't be installed."), theme_path);
nautilus_error_dialog (message, _("Couldn't install theme"), GTK_WINDOW (theme_selector));
g_free (message);
@@ -441,7 +441,7 @@ add_new_theme_button_callback(GtkWidget *widget, NautilusThemeSelector *theme_se
GtkFileSelection *file_dialog;
theme_selector->details->dialog = gtk_file_selection_new
- (_("Select a theme directory to add as a new theme:"));
+ (_("Select a theme folder to add as a new theme:"));
file_dialog = GTK_FILE_SELECTION (theme_selector->details->dialog);
gtk_signal_connect (GTK_OBJECT (theme_selector->details->dialog),
@@ -463,24 +463,20 @@ add_new_theme_button_callback(GtkWidget *widget, NautilusThemeSelector *theme_se
}
}
-/* handle the "remove" button */
static void
-remove_button_callback(GtkWidget *widget, NautilusThemeSelector *theme_selector)
+remove_button_callback (GtkWidget *widget, NautilusThemeSelector *theme_selector)
{
if (theme_selector->details->remove_mode) {
return;
}
theme_selector->details->remove_mode = TRUE;
- /* change the label to the remove message */
- nautilus_label_set_text (NAUTILUS_LABEL(theme_selector->details->help_label),
- _("Click on a theme to remove it."));
-
- /* change the add button label */
- nautilus_label_set_text (NAUTILUS_LABEL(theme_selector->details->add_button_label),
- _("Cancel Remove"));
+
+ nautilus_label_set_text (NAUTILUS_LABEL (theme_selector->details->help_label),
+ _("Click on a theme to remove it."));
+ nautilus_label_set_text (NAUTILUS_LABEL (theme_selector->details->add_button_label),
+ _("Cancel Remove"));
- /* regenerate the list */
populate_list_with_themes (theme_selector);
}
@@ -527,7 +523,8 @@ set_help_label (NautilusThemeSelector *theme_selector, gboolean remove_mode)
_("Click on a theme to remove it."));
} else {
nautilus_label_set_text (NAUTILUS_LABEL(theme_selector->details->help_label),
- _("Click on a theme to change the\nappearance of Nautilus."));
+ _("Click on a theme to change the\n"
+ "appearance of Nautilus."));
}
}
@@ -567,7 +564,8 @@ theme_select_row_callback (GtkCList * clist, int row, int column, GdkEventButton
if (nautilus_strcmp (theme_name, current_theme) == 0) {
g_free (current_theme);
exit_remove_mode (theme_selector);
- nautilus_error_dialog (_("Sorry, but you can't remove the current theme. Please change to another theme before removing this one"),
+ nautilus_error_dialog (_("Sorry, but you can't remove the current theme. "
+ "Please change to another theme before removing this one."),
_("Can't delete current theme"),
GTK_WINDOW (theme_selector));
theme_selector->details->handling_theme_change = FALSE;
@@ -624,18 +622,18 @@ vfs_file_exists (const char *file_uri)
/* utility routine to test for the presence of an icon file */
static gboolean
-has_image_file(const char *path_uri, const char *dir_name, const char *image_file)
+has_image_file (const char *path_uri, const char *dir_name, const char *image_file)
{
char* image_uri;
gboolean exists;
- image_uri = g_strdup_printf("%s/%s/%s.png", path_uri, dir_name, image_file);
+ image_uri = g_strdup_printf ("%s/%s/%s.png", path_uri, dir_name, image_file);
exists = vfs_file_exists (image_uri);
g_free (image_uri);
if (exists)
return TRUE;
- image_uri = g_strdup_printf("%s/%s/%s.svg", path_uri, dir_name, image_file);
+ image_uri = g_strdup_printf ("%s/%s/%s.svg", path_uri, dir_name, image_file);
exists = vfs_file_exists (image_uri);
g_free (image_uri);
return exists;
@@ -657,29 +655,29 @@ make_theme_description (const char *theme_name, const char *theme_path_uri)
theme_path = nautilus_make_path (theme_local_path, theme_file_name);
g_free (theme_local_path);
- if (theme_path) {
+ if (theme_path != NULL) {
/* read the xml document */
theme_document = xmlParseFile(theme_path);
if (theme_document != NULL) {
/* fetch the description mode, of any */
- description_node = nautilus_xml_get_child_by_name (xmlDocGetRootElement (theme_document), "description");
- if (description_node) {
- temp_str = xmlGetProp(description_node, "TEXT");
- if (temp_str)
- description_result = g_strdup (temp_str);
+ description_node = nautilus_xml_get_child_by_name (xmlDocGetRootElement (theme_document),
+ "description");
+ if (description_node != NULL) {
+ temp_str = xmlGetProp (description_node, "TEXT");
+ description_result = g_strdup (temp_str);
}
-
+
xmlFreeDoc (theme_document);
}
-
+
g_free (theme_path);
}
-
+
g_free (theme_file_name);
if (description_result)
return description_result;
- return g_strdup_printf (_("No information available for the %s theme"), theme_name);
+ return g_strdup_printf (_("No information available for the \"%s\" theme"), theme_name);
}
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 7e9022c7d..c7ae6ccfb 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -170,6 +170,7 @@ static void
window_set_title_with_timestamp (NautilusWindow *window, const char *title)
{
char *timestamp;
+ char *title_with_timestamp;
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
g_return_if_fail (title != NULL);
@@ -177,12 +178,14 @@ window_set_title_with_timestamp (NautilusWindow *window, const char *title)
timestamp = nautilus_get_build_timestamp ();
if (timestamp != NULL) {
- char *title_with_timestamp;
+ /* FIXME: The text Preview Release is hardcoded here.
+ * Are all builds with timestamps really best described
+ * as "preview release"?.
+ */
title_with_timestamp = g_strdup_printf ("Preview Release %s: %s", timestamp, title);
gtk_window_set_title (GTK_WINDOW (window), title_with_timestamp);
g_free (title_with_timestamp);
- }
- else {
+ } else {
gtk_window_set_title (GTK_WINDOW (window), title);
}