summaryrefslogtreecommitdiff
path: root/src/nautilus-error-reporting.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2011-01-11 16:31:28 +0100
committerCosimo Cecchi <cosimoc@gnome.org>2011-01-11 16:31:28 +0100
commit70b1acf6b0d4ef68903445d4198e78c5ea4807e5 (patch)
tree2a227049d6eb712d33232bc189d0e9d9bf0175cc /src/nautilus-error-reporting.c
parente0538b42e65601d9ebee5beffaefebb3e425672e (diff)
downloadnautilus-70b1acf6b0d4ef68903445d4198e78c5ea4807e5.tar.gz
Finish renaming fm_* -> nautilus_*
Diffstat (limited to 'src/nautilus-error-reporting.c')
-rw-r--r--src/nautilus-error-reporting.c204
1 files changed, 102 insertions, 102 deletions
diff --git a/src/nautilus-error-reporting.c b/src/nautilus-error-reporting.c
index ea8ace83e..db67dd61e 100644
--- a/src/nautilus-error-reporting.c
+++ b/src/nautilus-error-reporting.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* fm-error-reporting.h - implementation of file manager functions that report
- errors to the user.
+/* nautilus-error-reporting.h - implementation of file manager functions that report
+ errors to the user.
Copyright (C) 2000 Eazel, Inc.
@@ -42,9 +42,9 @@
static void finish_rename (NautilusFile *file, gboolean stop_timer, GError *error);
void
-fm_report_error_loading_directory (NautilusFile *file,
- GError *error,
- GtkWindow *parent_window)
+nautilus_report_error_loading_directory (NautilusFile *file,
+ GError *error,
+ GtkWindow *parent_window)
{
char *file_name;
char *message;
@@ -84,86 +84,12 @@ fm_report_error_loading_directory (NautilusFile *file,
g_free (file_name);
g_free (message);
-}
-
-void
-fm_report_error_renaming_file (NautilusFile *file,
- const char *new_name,
- GError *error,
- GtkWindow *parent_window)
-{
- char *original_name, *original_name_truncated;
- char *new_name_truncated;
- char *message;
-
- /* Truncate names for display since very long file names with no spaces
- * in them won't get wrapped, and can create insanely wide dialog boxes.
- */
- original_name = nautilus_file_get_display_name (file);
- original_name_truncated = eel_str_middle_truncate (original_name, MAXIMUM_DISPLAYED_FILE_NAME_LENGTH);
- g_free (original_name);
-
- new_name_truncated = eel_str_middle_truncate (new_name, MAXIMUM_DISPLAYED_FILE_NAME_LENGTH);
-
- message = NULL;
- if (error->domain == G_IO_ERROR) {
- switch (error->code) {
- case G_IO_ERROR_EXISTS:
- message = g_strdup_printf (_("The name \"%s\" is already used in this folder. "
- "Please use a different name."),
- new_name_truncated);
- break;
- case G_IO_ERROR_NOT_FOUND:
- message = g_strdup_printf (_("There is no \"%s\" in this folder. "
- "Perhaps it was just moved or deleted?"),
- original_name_truncated);
- break;
- case G_IO_ERROR_PERMISSION_DENIED:
- message = g_strdup_printf (_("You do not have the permissions necessary to rename \"%s\"."),
- original_name_truncated);
- break;
- case G_IO_ERROR_INVALID_FILENAME:
- 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_truncated);
- } else {
- message = g_strdup_printf (_("The name \"%s\" is not valid. "
- "Please use a different name."),
- new_name_truncated);
- }
- break;
- case G_IO_ERROR_FILENAME_TOO_LONG:
- message = g_strdup_printf (_("The name \"%s\" is too long. "
- "Please use a different name."),
- new_name_truncated);
- break;
- default:
- break;
- }
- }
-
- if (message == NULL) {
- /* We should invent decent error messages for every case we actually experience. */
- g_warning ("Hit unhandled case %s:%d in fm_report_error_renaming_file",
- g_quark_to_string (error->domain), error->code);
- /* fall through */
- message = g_strdup_printf (_("Sorry, could not rename \"%s\" to \"%s\": %s"),
- original_name_truncated, new_name_truncated,
- error->message);
- }
-
- g_free (original_name_truncated);
- g_free (new_name_truncated);
-
- eel_show_error_dialog (_("The item could not be renamed."), message, parent_window);
- g_free (message);
}
void
-fm_report_error_setting_group (NautilusFile *file,
- GError *error,
- GtkWindow *parent_window)
+nautilus_report_error_setting_group (NautilusFile *file,
+ GError *error,
+ GtkWindow *parent_window)
{
char *file_name;
char *message;
@@ -188,7 +114,7 @@ fm_report_error_setting_group (NautilusFile *file,
if (message == NULL) {
/* We should invent decent error messages for every case we actually experience. */
- g_warning ("Hit unhandled case %s:%d in fm_report_error_setting_group",
+ g_warning ("Hit unhandled case %s:%d in nautilus_report_error_setting_group",
g_quark_to_string (error->domain), error->code);
/* fall through */
message = g_strdup_printf (_("Sorry, could not change the group of \"%s\": %s"), file_name,
@@ -203,9 +129,9 @@ fm_report_error_setting_group (NautilusFile *file,
}
void
-fm_report_error_setting_owner (NautilusFile *file,
- GError *error,
- GtkWindow *parent_window)
+nautilus_report_error_setting_owner (NautilusFile *file,
+ GError *error,
+ GtkWindow *parent_window)
{
char *file_name;
char *message;
@@ -225,9 +151,9 @@ fm_report_error_setting_owner (NautilusFile *file,
}
void
-fm_report_error_setting_permissions (NautilusFile *file,
- GError *error,
- GtkWindow *parent_window)
+nautilus_report_error_setting_permissions (NautilusFile *file,
+ GError *error,
+ GtkWindow *parent_window)
{
char *file_name;
char *message;
@@ -246,14 +172,88 @@ fm_report_error_setting_permissions (NautilusFile *file,
g_free (message);
}
-typedef struct _FMRenameData {
+typedef struct _NautilusRenameData {
char *name;
NautilusFileOperationCallback callback;
gpointer callback_data;
-} FMRenameData;
+} NautilusRenameData;
+
+void
+nautilus_report_error_renaming_file (NautilusFile *file,
+ const char *new_name,
+ GError *error,
+ GtkWindow *parent_window)
+{
+ char *original_name, *original_name_truncated;
+ char *new_name_truncated;
+ char *message;
+
+ /* Truncate names for display since very long file names with no spaces
+ * in them won't get wrapped, and can create insanely wide dialog boxes.
+ */
+ original_name = nautilus_file_get_display_name (file);
+ original_name_truncated = eel_str_middle_truncate (original_name, MAXIMUM_DISPLAYED_FILE_NAME_LENGTH);
+ g_free (original_name);
+
+ new_name_truncated = eel_str_middle_truncate (new_name, MAXIMUM_DISPLAYED_FILE_NAME_LENGTH);
+
+ message = NULL;
+ if (error->domain == G_IO_ERROR) {
+ switch (error->code) {
+ case G_IO_ERROR_EXISTS:
+ message = g_strdup_printf (_("The name \"%s\" is already used in this folder. "
+ "Please use a different name."),
+ new_name_truncated);
+ break;
+ case G_IO_ERROR_NOT_FOUND:
+ message = g_strdup_printf (_("There is no \"%s\" in this folder. "
+ "Perhaps it was just moved or deleted?"),
+ original_name_truncated);
+ break;
+ case G_IO_ERROR_PERMISSION_DENIED:
+ message = g_strdup_printf (_("You do not have the permissions necessary to rename \"%s\"."),
+ original_name_truncated);
+ break;
+ case G_IO_ERROR_INVALID_FILENAME:
+ 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_truncated);
+ } else {
+ message = g_strdup_printf (_("The name \"%s\" is not valid. "
+ "Please use a different name."),
+ new_name_truncated);
+ }
+ break;
+ case G_IO_ERROR_FILENAME_TOO_LONG:
+ message = g_strdup_printf (_("The name \"%s\" is too long. "
+ "Please use a different name."),
+ new_name_truncated);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (message == NULL) {
+ /* We should invent decent error messages for every case we actually experience. */
+ g_warning ("Hit unhandled case %s:%d in nautilus_report_error_renaming_file",
+ g_quark_to_string (error->domain), error->code);
+ /* fall through */
+ message = g_strdup_printf (_("Sorry, could not rename \"%s\" to \"%s\": %s"),
+ original_name_truncated, new_name_truncated,
+ error->message);
+ }
+
+ g_free (original_name_truncated);
+ g_free (new_name_truncated);
+
+ eel_show_error_dialog (_("The item could not be renamed."), message, parent_window);
+ g_free (message);
+}
static void
-fm_rename_data_free (FMRenameData *data)
+nautilus_rename_data_free (NautilusRenameData *data)
{
g_free (data->name);
g_free (data);
@@ -263,7 +263,7 @@ static void
rename_callback (NautilusFile *file, GFile *result_location,
GError *error, gpointer callback_data)
{
- FMRenameData *data;
+ NautilusRenameData *data;
g_assert (NAUTILUS_IS_FILE (file));
g_assert (callback_data == NULL);
@@ -274,7 +274,7 @@ rename_callback (NautilusFile *file, GFile *result_location,
if (error &&
!(error->domain == G_IO_ERROR && error->code == G_IO_ERROR_CANCELLED)) {
/* If rename failed, notify the user. */
- fm_report_error_renaming_file (file, data->name, error, NULL);
+ nautilus_report_error_renaming_file (file, data->name, error, NULL);
}
finish_rename (file, TRUE, error);
@@ -293,7 +293,7 @@ cancel_rename_callback (gpointer callback_data)
static void
finish_rename (NautilusFile *file, gboolean stop_timer, GError *error)
{
- FMRenameData *data;
+ NautilusRenameData *data;
data = g_object_get_data (G_OBJECT (file), NEW_NAME_TAG);
if (data == NULL) {
@@ -315,13 +315,13 @@ finish_rename (NautilusFile *file, gboolean stop_timer, GError *error)
}
void
-fm_rename_file (NautilusFile *file,
- const char *new_name,
- NautilusFileOperationCallback callback,
- gpointer callback_data)
+nautilus_rename_file (NautilusFile *file,
+ const char *new_name,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data)
{
char *old_name, *wait_message;
- FMRenameData *data;
+ NautilusRenameData *data;
char *uri;
GError *error;
@@ -333,7 +333,7 @@ fm_rename_file (NautilusFile *file,
finish_rename (file, TRUE, error);
g_error_free (error);
- data = g_new0 (FMRenameData, 1);
+ data = g_new0 (NautilusRenameData, 1);
data->name = g_strdup (new_name);
data->callback = callback;
data->callback_data = callback_data;
@@ -341,7 +341,7 @@ fm_rename_file (NautilusFile *file,
/* Attach the new name to the file. */
g_object_set_data_full (G_OBJECT (file),
NEW_NAME_TAG,
- data, (GDestroyNotify)fm_rename_data_free);
+ data, (GDestroyNotify)nautilus_rename_data_free);
/* Start the timed wait to cancel the rename. */
old_name = nautilus_file_get_display_name (file);