summaryrefslogtreecommitdiff
path: root/programs
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2009-08-24 16:42:12 +0200
committerAlexander Larsson <alexl@redhat.com>2009-08-24 17:04:19 +0200
commit05a9669be00e55f6b686327da95ffc56220bed22 (patch)
treeacb01c0400c47ee508c40d4acbe4f2d3399dfa7d /programs
parentf20369496be7bdb7a614916367c6d4fd459dd44a (diff)
downloadgvfs-05a9669be00e55f6b686327da95ffc56220bed22.tar.gz
Fix up various errors with i18n of programs/*.c
Lots of not translated strings, some errors did not go to stderr, etc.
Diffstat (limited to 'programs')
-rw-r--r--programs/gvfs-cat.c98
-rw-r--r--programs/gvfs-copy.c53
-rw-r--r--programs/gvfs-info.c141
-rw-r--r--programs/gvfs-ls.c214
-rw-r--r--programs/gvfs-mkdir.c62
-rw-r--r--programs/gvfs-monitor-dir.c18
-rw-r--r--programs/gvfs-monitor-file.c18
-rw-r--r--programs/gvfs-mount.c313
-rw-r--r--programs/gvfs-move.c45
-rw-r--r--programs/gvfs-open.c18
-rw-r--r--programs/gvfs-rename.c15
-rw-r--r--programs/gvfs-save.c52
-rw-r--r--programs/gvfs-set-attribute.c8
-rw-r--r--programs/gvfs-tree.c270
14 files changed, 665 insertions, 660 deletions
diff --git a/programs/gvfs-cat.c b/programs/gvfs-cat.c
index bd3969f2..e879d3d1 100644
--- a/programs/gvfs-cat.c
+++ b/programs/gvfs-cat.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -34,7 +34,7 @@
static gchar **locations = NULL;
static GOptionEntry entries[] = {
- {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &locations, "locations", NULL},
+ {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &locations, N_("locations"), NULL},
{NULL}
};
@@ -55,7 +55,7 @@ cat (GFile * file)
/* Translators: the first %s is the program name, the second one */
/* is the URI of the file, the third is the error message. */
g_printerr (_("%s: %s: error opening file: %s\n"),
- g_get_prgname (), g_file_get_uri (file), error->message);
+ g_get_prgname (), g_file_get_uri (file), error->message);
g_error_free (error);
return;
}
@@ -63,41 +63,41 @@ cat (GFile * file)
while (1)
{
res =
- g_input_stream_read (in, buffer, sizeof (buffer) - 1, NULL, &error);
+ g_input_stream_read (in, buffer, sizeof (buffer) - 1, NULL, &error);
if (res > 0)
- {
- ssize_t written;
-
- p = buffer;
- while (res > 0)
- {
- written = write (STDOUT_FILENO, p, res);
-
- if (written == -1 && errno != EINTR)
- {
- /* Translators: the first %s is the program name, the */
- /* second one is the URI of the file. */
- g_printerr (_("%s: %s, error writing to stdout"),
- g_get_prgname (), g_file_get_uri (file));
- goto out;
- }
- res -= written;
- p += written;
- }
- }
+ {
+ ssize_t written;
+
+ p = buffer;
+ while (res > 0)
+ {
+ written = write (STDOUT_FILENO, p, res);
+
+ if (written == -1 && errno != EINTR)
+ {
+ /* Translators: the first %s is the program name, the */
+ /* second one is the URI of the file. */
+ g_printerr (_("%s: %s, error writing to stdout"),
+ g_get_prgname (), g_file_get_uri (file));
+ goto out;
+ }
+ res -= written;
+ p += written;
+ }
+ }
else if (res < 0)
- {
- /* Translators: the first %s is the program name, the second one */
- /* is the URI of the file, the third is the error message. */
- g_printerr (_("%s: %s: error reading: %s\n"),
- g_get_prgname (), g_file_get_uri (file),
- error->message);
- g_error_free (error);
- error = NULL;
- break;
- }
+ {
+ /* Translators: the first %s is the program name, the second one */
+ /* is the URI of the file, the third is the error message. */
+ g_printerr (_("%s: %s: error reading: %s\n"),
+ g_get_prgname (), g_file_get_uri (file),
+ error->message);
+ g_error_free (error);
+ error = NULL;
+ break;
+ }
else if (res == 0)
- break;
+ break;
}
out:
@@ -108,7 +108,7 @@ cat (GFile * file)
/* Translators: the first %s is the program name, the second one */
/* is the URI of the file, the third is the error message. */
g_printerr (_("%s: %s:error closing: %s\n"),
- g_get_prgname (), g_file_get_uri (file), error->message);
+ g_get_prgname (), g_file_get_uri (file), error->message);
g_error_free (error);
}
}
@@ -134,19 +134,19 @@ main (int argc, char *argv[])
/* usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE> */
context =
g_option_context_new (_("LOCATION... - concatenate LOCATIONS "
- "to standard output."));
+ "to standard output."));
/* Translators: this message will appear after the usage string */
/* and before the list of options. */
summary = g_strconcat (_("Concatenate files at locations and print to the "
- "standard output. Works just like the traditional "
- "cat utility, but using gvfs location instead "
- "local files: for example you can use something "
- "like smb://server/resource/file.txt as location "
- "to concatenate."),
- "\n\n",
- _("Note: just pipe through cat if you need its "
- "formatting option like -n, -T or other."), NULL);
+ "standard output. Works just like the traditional "
+ "cat utility, but using gvfs location instead "
+ "local files: for example you can use something "
+ "like smb://server/resource/file.txt as location "
+ "to concatenate."),
+ "\n\n",
+ _("Note: just pipe through cat if you need its "
+ "formatting option like -n, -T or other."), NULL);
g_option_context_set_summary (context, summary);
@@ -155,13 +155,13 @@ main (int argc, char *argv[])
g_option_context_free (context);
g_free (summary);
-
+
if (error != NULL)
{
- g_printerr ("Error parsing commandline options: %s\n", error->message);
+ g_printerr (_("Error parsing commandline options: %s\n"), error->message);
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
- g_get_prgname ());
+ g_get_prgname ());
g_printerr ("\n");
g_error_free(error);
return 1;
@@ -174,7 +174,7 @@ main (int argc, char *argv[])
g_printerr (_("%s: missing locations"), g_get_prgname ());
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
- g_get_prgname ());
+ g_get_prgname ());
g_printerr ("\n");
return 1;
}
diff --git a/programs/gvfs-copy.c b/programs/gvfs-copy.c
index e88b8e67..40f43e01 100644
--- a/programs/gvfs-copy.c
+++ b/programs/gvfs-copy.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -39,15 +39,15 @@ static gboolean backup = FALSE;
static gboolean preserve = FALSE;
static gboolean no_target_directory = FALSE;
-static GOptionEntry entries[] =
+static GOptionEntry entries[] =
{
- { "no-target-directory", 'T', 0, G_OPTION_ARG_NONE, &no_target_directory, "no target directory", NULL },
- { "progress", 'p', 0, G_OPTION_ARG_NONE, &progress, "show progress", NULL },
- { "interactive", 'i', 0, G_OPTION_ARG_NONE, &interactive, "prompt before overwrite", NULL },
- { "preserve", 'p', 0, G_OPTION_ARG_NONE, &preserve, "preserve all attributes", NULL },
- { "backup", 'b', 0, G_OPTION_ARG_NONE, &backup, "backup existing destination files", NULL },
- { "no-dereference", 'P', 0, G_OPTION_ARG_NONE, &no_dereference, "never follow symbolic links", NULL },
- { NULL }
+ { "no-target-directory", 'T', 0, G_OPTION_ARG_NONE, &no_target_directory, N_("no target directory"), NULL },
+ { "progress", 'p', 0, G_OPTION_ARG_NONE, &progress, N_("show progress"), NULL },
+ { "interactive", 'i', 0, G_OPTION_ARG_NONE, &interactive, N_("prompt before overwrite"), NULL },
+ { "preserve", 'p', 0, G_OPTION_ARG_NONE, &preserve, N_("preserve all attributes"), NULL },
+ { "backup", 'b', 0, G_OPTION_ARG_NONE, &backup, N_("backup existing destination files"), NULL },
+ { "no-dereference", 'P', 0, G_OPTION_ARG_NONE, &no_dereference, N_("never follow symbolic links"), NULL },
+ { NULL }
};
static gboolean
@@ -55,7 +55,7 @@ is_dir (GFile *file)
{
GFileInfo *info;
gboolean res;
-
+
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE, 0, NULL, NULL);
res = info && g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY;
if (info)
@@ -75,7 +75,8 @@ show_progress (goffset current_num_bytes,
g_get_current_time (&tv);
size = g_format_size_for_display (current_num_bytes / MAX (tv.tv_sec - start_time.tv_sec, 1));
- g_print ("progress %"G_GINT64_FORMAT"/%"G_GINT64_FORMAT" (%s/s)\n",
+ g_print (_("progress"));
+ g_print (" %"G_GINT64_FORMAT"/%"G_GINT64_FORMAT" (%s/s)\n",
current_num_bytes, total_num_bytes, size);
g_free (size);
}
@@ -91,23 +92,23 @@ main (int argc, char *argv[])
char *basename;
int i;
GFileCopyFlags flags;
-
+
setlocale (LC_ALL, "");
g_type_init ();
-
+
error = NULL;
- context = g_option_context_new ("- output files at <location>");
+ context = g_option_context_new (_("- output files at <location>"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
-
+
if (error != NULL)
{
- g_printerr ("Error parsing commandline options: %s\n", error->message);
+ g_printerr (_("Error parsing commandline options: %s\n"), error->message);
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
- g_get_prgname ());
+ g_get_prgname ());
g_printerr ("\n");
g_error_free(error);
return 1;
@@ -115,7 +116,7 @@ main (int argc, char *argv[])
if (argc <= 2)
{
- g_printerr ("Missing operand\n");
+ g_printerr (_("Missing operand\n"));
return 1;
}
@@ -123,16 +124,16 @@ main (int argc, char *argv[])
if (no_target_directory && argc > 3)
{
- g_printerr ("Too many arguments\n");
+ g_printerr (_("Too many arguments\n"));
g_object_unref (dest);
return 1;
}
-
+
dest_is_dir = is_dir (dest);
if (!dest_is_dir && argc > 3)
{
- g_printerr ("Target %s is not a directory\n", argv[argc-1]);
+ g_printerr (_("Target %s is not a directory\n"), argv[argc-1]);
g_object_unref (dest);
return 1;
}
@@ -159,8 +160,8 @@ main (int argc, char *argv[])
flags |= G_FILE_COPY_NOFOLLOW_SYMLINKS;
if (preserve)
flags |= G_FILE_COPY_ALL_METADATA;
-
-
+
+
error = NULL;
g_get_current_time (&start_time);
if (!g_file_copy (source, target, flags, NULL, progress?show_progress:NULL, NULL, &error))
@@ -168,12 +169,12 @@ main (int argc, char *argv[])
if (interactive && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS))
{
char line[16];
-
+
g_error_free (error);
error = NULL;
basename = g_file_get_basename (target);
- g_print ("overwrite %s?", basename);
+ g_print (_("overwrite %s?"), basename);
g_free (basename);
if (fgets(line, sizeof (line), stdin) &&
@@ -187,7 +188,7 @@ main (int argc, char *argv[])
else
{
copy_failed:
- g_printerr ("Error copying file %s: %s\n", argv[i], error->message);
+ g_printerr (_("Error copying file %s: %s\n"), argv[i], error->message);
g_error_free (error);
}
}
diff --git a/programs/gvfs-info.c b/programs/gvfs-info.c
index 8c74441c..f9273c84 100644
--- a/programs/gvfs-info.c
+++ b/programs/gvfs-info.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -32,13 +32,13 @@ static gboolean nofollow_symlinks = FALSE;
static gboolean filesystem = FALSE;
static gboolean writable = FALSE;
-static GOptionEntry entries[] =
+static GOptionEntry entries[] =
{
- { "query-writable", 'w', 0, G_OPTION_ARG_NONE, &writable, "List writable attributes", NULL },
- { "filesystem", 'f', 0, G_OPTION_ARG_NONE, &filesystem, "Get filesystem info", NULL },
- { "attributes", 'a', 0, G_OPTION_ARG_STRING, &attributes, "The attributes to get", NULL },
- { "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, "Don't follow symlinks", NULL },
- { NULL }
+ { "query-writable", 'w', 0, G_OPTION_ARG_NONE, &writable, N_("List writable attributes"), NULL },
+ { "filesystem", 'f', 0, G_OPTION_ARG_NONE, &filesystem, N_("Get filesystem info"), NULL },
+ { "attributes", 'a', 0, G_OPTION_ARG_STRING, &attributes, N_("The attributes to get"), NULL },
+ { "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, N_("Don't follow symlinks"), NULL },
+ { NULL }
};
static const char *
@@ -47,28 +47,28 @@ type_to_string (GFileType type)
switch (type)
{
default:
- return "invalid type";
-
+ return _("invalid type");
+
case G_FILE_TYPE_UNKNOWN:
- return "unknown";
-
+ return _("unknown");
+
case G_FILE_TYPE_REGULAR:
- return "regular";
-
+ return _("regular");
+
case G_FILE_TYPE_DIRECTORY:
- return "directory";
-
+ return _("directory");
+
case G_FILE_TYPE_SYMBOLIC_LINK:
- return "symlink";
+ return _("symlink");
case G_FILE_TYPE_SPECIAL:
- return "special";
+ return _("special");
case G_FILE_TYPE_SHORTCUT:
- return "shortcut";
+ return _("shortcut");
case G_FILE_TYPE_MOUNTABLE:
- return "mountable";
+ return _("mountable");
}
}
@@ -78,7 +78,7 @@ escape_string (const char *in)
GString *str;
static char *hex_digits = "0123456789abcdef";
char c;
-
+
str = g_string_new ("");
@@ -103,42 +103,42 @@ show_attributes (GFileInfo *info)
char **attributes;
char *s;
int i;
-
+
attributes = g_file_info_list_attributes (info, NULL);
-
- g_print ("attributes:\n");
+
+ g_print (_("attributes:\n"));
for (i = 0; attributes[i] != NULL; i++)
{
/* list the icons in order rather than displaying "GThemedIcon:0x8df7200" */
if (strcmp (attributes[i], "standard::icon") == 0)
- {
- GIcon *icon;
- int j;
- const char * const *names = NULL;
- icon = g_file_info_get_icon (info);
-
- /* only look up names if GThemedIcon */
- if (G_IS_THEMED_ICON(icon))
- {
+ {
+ GIcon *icon;
+ int j;
+ const char * const *names = NULL;
+ icon = g_file_info_get_icon (info);
+
+ /* only look up names if GThemedIcon */
+ if (G_IS_THEMED_ICON(icon))
+ {
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
g_print (" %s: ", attributes[i]);
- for (j = 0; names[j] != NULL; j++)
+ for (j = 0; names[j] != NULL; j++)
g_print ("%s%s", names[j], (names[j+1] == NULL)?"":", ");
g_print ("\n");
- }
- else
- {
- s = g_file_info_get_attribute_as_string (info, attributes[i]);
- g_print (" %s: %s\n", attributes[i], s);
- g_free (s);
- }
- }
+ }
+ else
+ {
+ s = g_file_info_get_attribute_as_string (info, attributes[i]);
+ g_print (" %s: %s\n", attributes[i], s);
+ g_free (s);
+ }
+ }
else
- {
- s = g_file_info_get_attribute_as_string (info, attributes[i]);
- g_print (" %s: %s\n", attributes[i], s);
- g_free (s);
- }
+ {
+ s = g_file_info_get_attribute_as_string (info, attributes[i]);
+ g_print (" %s: %s\n", attributes[i], s);
+ g_free (s);
+ }
}
g_strfreev (attributes);
}
@@ -152,34 +152,35 @@ show_info (GFileInfo *info)
name = g_file_info_get_display_name (info);
if (name)
- g_print ("display name: %s\n", name);
+ g_print (_("display name: %s\n"), name);
name = g_file_info_get_edit_name (info);
if (name)
- g_print ("edit name: %s\n", name);
+ g_print (_("edit name: %s\n"), name);
name = g_file_info_get_name (info);
if (name)
{
escaped = escape_string (name);
- g_print ("name: %s\n", escaped);
+ g_print (_("name: %s\n"), escaped);
g_free (escaped);
}
if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_TYPE))
{
type = type_to_string (g_file_info_get_file_type (info));
- g_print ("type: %s\n", type);
+ g_print (_("type: %s\n"), type);
}
if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SIZE))
{
size = g_file_info_get_size (info);
- g_print ("size: %"G_GUINT64_FORMAT"\n", (guint64)size);
+ g_print (_("size: "));
+ g_print (" %"G_GUINT64_FORMAT"\n", (guint64)size);
}
if (g_file_info_get_is_hidden (info))
- g_print ("hidden\n");
+ g_print (_("hidden\n"));
show_attributes (info);
}
@@ -200,7 +201,7 @@ query_info (GFile *file)
flags = 0;
if (nofollow_symlinks)
flags |= G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS;
-
+
error = NULL;
if (filesystem)
info = g_file_query_filesystem_info (file, attributes, NULL, &error);
@@ -262,16 +263,16 @@ attribute_flags_to_string (GFileAttributeInfoFlags flags)
} flag_descr[] = {
{
G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE,
- "Copy with file"
+ N_("Copy with file")
},
{
G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED,
- "Keep with file when moved"
+ N_("Keep with file when moved")
}
};
first = TRUE;
-
+
s = g_string_new ("");
for (i = 0; i < G_N_ELEMENTS (flag_descr); i++)
{
@@ -279,7 +280,7 @@ attribute_flags_to_string (GFileAttributeInfoFlags flags)
{
if (!first)
g_string_append (s, ", ");
- g_string_append (s, flag_descr[i].descr);
+ g_string_append (s, gettext (flag_descr[i].descr));
first = FALSE;
}
}
@@ -303,12 +304,12 @@ get_writable_info (GFile *file)
list = g_file_query_settable_attributes (file, NULL, &error);
if (list == NULL)
{
- g_printerr ("Error getting writable attributes: %s\n", error->message);
+ g_printerr (_("Error getting writable attributes: %s\n"), error->message);
g_error_free (error);
return;
}
- g_print ("Settable attributes:\n");
+ g_print (_("Settable attributes:\n"));
for (i = 0; i < list->n_infos; i++)
{
flags = attribute_flags_to_string (list->infos[i].flags);
@@ -320,7 +321,7 @@ get_writable_info (GFile *file)
}
g_file_attribute_info_list_unref (list);
-
+
list = g_file_query_writable_namespaces (file, NULL, &error);
if (list == NULL)
{
@@ -331,7 +332,7 @@ get_writable_info (GFile *file)
if (list->n_infos > 0)
{
- g_print ("Writable attribute namespaces:\n");
+ g_print (_("Writable attribute namespaces:\n"));
for (i = 0; i < list->n_infos; i++)
{
flags = attribute_flags_to_string (list->infos[i].flags);
@@ -341,7 +342,7 @@ get_writable_info (GFile *file)
(*flags != 0)?", ":"", flags);
}
}
-
+
g_file_attribute_info_list_unref (list);
}
@@ -352,32 +353,32 @@ main (int argc, char *argv[])
GError *error;
GOptionContext *context;
GFile *file;
-
+
setlocale (LC_ALL, "");
g_type_init ();
-
+
error = NULL;
- context = g_option_context_new ("- show info for <location>");
+ context = g_option_context_new (_("- show info for <location>"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
-
+
if (error != NULL)
{
- g_printerr ("Error parsing commandline options: %s\n", error->message);
+ g_printerr (_("Error parsing commandline options: %s\n"), error->message);
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
- g_get_prgname ());
+ g_get_prgname ());
g_printerr ("\n");
g_error_free(error);
return 1;
}
-
+
if (argc > 1)
{
int i;
-
+
for (i = 1; i < argc; i++) {
file = g_file_new_for_commandline_arg (argv[i]);
if (writable)
diff --git a/programs/gvfs-ls.c b/programs/gvfs-ls.c
index f817e63b..13791f7c 100644
--- a/programs/gvfs-ls.c
+++ b/programs/gvfs-ls.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -34,14 +34,14 @@ static gboolean show_long = FALSE;
static gboolean nofollow_symlinks = FALSE;
static char *show_completions = NULL;
-static GOptionEntry entries[] =
+static GOptionEntry entries[] =
{
- { "attributes", 'a', 0, G_OPTION_ARG_STRING, &attributes, "The attributes to get", NULL },
- { "hidden", 'h', 0, G_OPTION_ARG_NONE, &show_hidden, "Show hidden files", NULL },
- { "long", 'l', 0, G_OPTION_ARG_NONE, &show_long, "Use a long listing format", NULL },
- { "show-completions", 'c', 0, G_OPTION_ARG_STRING, &show_completions, "Show completions", NULL},
- { "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, "Don't follow symlinks", NULL},
- { NULL }
+ { "attributes", 'a', 0, G_OPTION_ARG_STRING, &attributes, N_("The attributes to get"), NULL },
+ { "hidden", 'h', 0, G_OPTION_ARG_NONE, &show_hidden, N_("Show hidden files"), NULL },
+ { "long", 'l', 0, G_OPTION_ARG_NONE, &show_long, N_("Use a long listing format"), NULL },
+ { "show-completions", 'c', 0, G_OPTION_ARG_STRING, &show_completions, N_("Show completions"), NULL},
+ { "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, N_("Don't follow symlinks"), NULL},
+ { NULL }
};
static const char *
@@ -51,16 +51,16 @@ type_to_string (GFileType type)
{
default:
return "invalid type";
-
+
case G_FILE_TYPE_UNKNOWN:
return "unknown";
-
+
case G_FILE_TYPE_REGULAR:
return "regular";
-
+
case G_FILE_TYPE_DIRECTORY:
return "directory";
-
+
case G_FILE_TYPE_SYMBOLIC_LINK:
return "symlink";
@@ -86,7 +86,7 @@ show_info (GFileInfo *info)
if ((g_file_info_get_is_hidden (info)) && !show_hidden)
return;
-
+
name = g_file_info_get_name (info);
if (name == NULL)
name = "";
@@ -105,7 +105,7 @@ show_info (GFileInfo *info)
char *val_as_string;
if (!show_long ||
- strcmp (attributes[i], G_FILE_ATTRIBUTE_STANDARD_NAME) == 0 ||
+ strcmp (attributes[i], G_FILE_ATTRIBUTE_STANDARD_NAME) == 0 ||
strcmp (attributes[i], G_FILE_ATTRIBUTE_STANDARD_SIZE) == 0 ||
strcmp (attributes[i], G_FILE_ATTRIBUTE_STANDARD_TYPE) == 0 ||
strcmp (attributes[i], G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN) == 0)
@@ -122,9 +122,9 @@ show_info (GFileInfo *info)
g_print ("%s=%s", attributes[i], val_as_string);
g_free (val_as_string);
}
-
+
g_strfreev (attributes);
-
+
g_print ("\n");
}
@@ -134,16 +134,16 @@ list (GFile *file)
GFileEnumerator *enumerator;
GFileInfo *info;
GError *error;
-
+
if (file == NULL)
return;
error = NULL;
enumerator = g_file_enumerate_children (file,
- attributes,
- nofollow_symlinks ? G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS : 0,
- NULL,
- &error);
+ attributes,
+ nofollow_symlinks ? G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS : 0,
+ NULL,
+ &error);
if (enumerator == NULL)
{
g_printerr ("Error: %s\n", error->message);
@@ -151,24 +151,24 @@ list (GFile *file)
error = NULL;
return;
}
-
+
while ((info = g_file_enumerator_next_file (enumerator, NULL, &error)) != NULL)
{
show_info (info);
-
+
g_object_unref (info);
}
if (error)
{
- g_printerr ("Error: %s\n", error->message);
+ g_printerr (_("Error: %s\n"), error->message);
g_error_free (error);
error = NULL;
}
-
+
if (!g_file_enumerator_close (enumerator, NULL, &error))
{
- g_printerr ("Error closing enumerator: %s\n", error->message);
+ g_printerr (_("Error: %s\n"), error->message);
g_error_free (error);
error = NULL;
}
@@ -182,25 +182,25 @@ print_mounts (const char *prefix)
GVolumeMonitor *volume_monitor;
volume_monitor = g_volume_monitor_get ();
-
+
mounts = g_volume_monitor_get_mounts (volume_monitor);
if (mounts != NULL)
{
for (l = mounts; l != NULL; l = l->next)
- {
- GMount *mount = l->data;
- GFile *mount_root;
- char *uri;
-
- mount_root = g_mount_get_root (mount);
- uri = g_file_get_uri (mount_root);
- if (prefix == NULL ||
- g_str_has_prefix (uri, prefix))
- g_print ("%s\n", uri);
- g_free (uri);
- g_object_unref (mount_root);
- g_object_unref (mount);
- }
+ {
+ GMount *mount = l->data;
+ GFile *mount_root;
+ char *uri;
+
+ mount_root = g_mount_get_root (mount);
+ uri = g_file_get_uri (mount_root);
+ if (prefix == NULL ||
+ g_str_has_prefix (uri, prefix))
+ g_print ("%s\n", uri);
+ g_free (uri);
+ g_object_unref (mount_root);
+ g_object_unref (mount);
+ }
g_list_free (mounts);
}
g_object_unref (volume_monitor);
@@ -222,17 +222,17 @@ shell_quote (const gchar *unquoted_string)
while (*p)
{
if (*p == ' ')
- g_string_append (dest, "\\ ");
+ g_string_append (dest, "\\ ");
else if (*p == '\n')
- g_string_append (dest, "^J");
+ g_string_append (dest, "^J");
else if (*p == '\\')
- g_string_append (dest, "\\\\");
+ g_string_append (dest, "\\\\");
else if (*p == '\'')
- g_string_append (dest, "\\'");
+ g_string_append (dest, "\\'");
else if (*p == '"')
- g_string_append (dest, "\\\"");
+ g_string_append (dest, "\\\"");
else
- g_string_append_c (dest, *p);
+ g_string_append_c (dest, *p);
++p;
}
@@ -242,13 +242,13 @@ shell_quote (const gchar *unquoted_string)
static void
show_completed_file (GFile *hit,
- gboolean is_dir,
- const char *arg)
+ gboolean is_dir,
+ const char *arg)
{
char *path, *cwd, *display, *t;
GFile *cwd_f;
GFile *home;
-
+
if (g_file_is_native (hit))
{
cwd = g_get_current_dir ();
@@ -258,28 +258,28 @@ show_completed_file (GFile *hit,
home = g_file_new_for_path (g_get_home_dir ());
if ((g_file_has_prefix (hit, home) ||
- g_file_equal (hit, home)) &&
- arg[0] == '~')
- {
- t = g_file_get_relative_path (home, hit);
- path = g_strconcat ("~", (t != NULL) ? "/": "", t, NULL);
- g_free (t);
- }
+ g_file_equal (hit, home)) &&
+ arg[0] == '~')
+ {
+ t = g_file_get_relative_path (home, hit);
+ path = g_strconcat ("~", (t != NULL) ? "/": "", t, NULL);
+ g_free (t);
+ }
else if (g_file_has_prefix (hit, cwd_f) &&
- !g_path_is_absolute (arg))
- path = g_file_get_relative_path (cwd_f, hit);
+ !g_path_is_absolute (arg))
+ path = g_file_get_relative_path (cwd_f, hit);
else
- path = g_file_get_path (hit);
+ path = g_file_get_path (hit);
g_object_unref (cwd_f);
g_object_unref (home);
-
+
display = shell_quote (path);
g_free (path);
}
else
display = g_file_get_uri (hit);
-
+
g_print ("%s%s\n", display, (is_dir)?"/":"");
g_free (display);
}
@@ -291,20 +291,20 @@ print_completions (const char *arg)
GFile *parent;
char *basename;
char *unescaped, *t;
-
+
unescaped = g_shell_unquote (arg, NULL);
if (unescaped == NULL)
unescaped = g_strdup (arg);
-
+
if (*unescaped == '~')
{
t = unescaped;
unescaped = g_strconcat (g_get_home_dir(), t+1, NULL);
g_free (t);
}
-
+
f = g_file_new_for_commandline_arg (unescaped);
-
+
if (g_str_has_suffix (arg, "/") || *arg == 0)
{
parent = g_object_ref (f);
@@ -323,43 +323,43 @@ print_completions (const char *arg)
GMount *mount;
mount = g_file_find_enclosing_mount (f, NULL, NULL);
if (mount == NULL)
- print_mounts (unescaped);
+ print_mounts (unescaped);
else
- g_object_unref (mount);
+ g_object_unref (mount);
}
-
+
if (parent != NULL)
{
GFileEnumerator *enumerator;
- enumerator = g_file_enumerate_children (parent,
- G_FILE_ATTRIBUTE_STANDARD_NAME ","
- G_FILE_ATTRIBUTE_STANDARD_TYPE,
- nofollow_symlinks ? G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS : 0,
- NULL,
- NULL);
+ enumerator = g_file_enumerate_children (parent,
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ nofollow_symlinks ? G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS : 0,
+ NULL,
+ NULL);
if (enumerator != NULL)
- {
- GFileInfo *info;
-
- while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL)
- {
- const char *name;
- GFileType type;
-
- name = g_file_info_get_name (info);
- type = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE);
- if (name != NULL && g_str_has_prefix (name, basename))
- {
- GFile *entry;
-
- entry = g_file_get_child (parent, name);
- show_completed_file (entry, type == G_FILE_TYPE_DIRECTORY, arg);
- g_object_unref (entry);
- }
- g_object_unref (info);
- }
- g_file_enumerator_close (enumerator, NULL, NULL);
- }
+ {
+ GFileInfo *info;
+
+ while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL)
+ {
+ const char *name;
+ GFileType type;
+
+ name = g_file_info_get_name (info);
+ type = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE);
+ if (name != NULL && g_str_has_prefix (name, basename))
+ {
+ GFile *entry;
+
+ entry = g_file_get_child (parent, name);
+ show_completed_file (entry, type == G_FILE_TYPE_DIRECTORY, arg);
+ g_object_unref (entry);
+ }
+ g_object_unref (info);
+ }
+ g_file_enumerator_close (enumerator, NULL, NULL);
+ }
g_object_unref (parent);
}
@@ -374,23 +374,23 @@ main (int argc, char *argv[])
GError *error;
GOptionContext *context;
GFile *file;
-
+
setlocale (LC_ALL, "");
g_type_init ();
-
+
error = NULL;
- context = g_option_context_new ("- list files at <location>");
+ context = g_option_context_new (_("- list files at <location>"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
-
+
if (error != NULL)
{
- g_printerr ("Error parsing commandline options: %s\n", error->message);
+ g_printerr (_("Error parsing commandline options: %s\n"), error->message);
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
- g_get_prgname ());
+ g_get_prgname ());
g_printerr ("\n");
g_error_free(error);
return 1;
@@ -415,11 +415,11 @@ main (int argc, char *argv[])
print_completions (show_completions);
return 0;
}
-
+
if (argc > 1)
{
int i;
-
+
for (i = 1; i < argc; i++) {
file = g_file_new_for_commandline_arg (argv[i]);
list (file);
@@ -429,7 +429,7 @@ main (int argc, char *argv[])
else
{
char *cwd;
-
+
cwd = g_get_current_dir ();
file = g_file_new_for_path (cwd);
g_free (cwd);
@@ -438,6 +438,6 @@ main (int argc, char *argv[])
}
g_free (attributes);
-
+
return 0;
}
diff --git a/programs/gvfs-mkdir.c b/programs/gvfs-mkdir.c
index 483ebd87..a031dab7 100644
--- a/programs/gvfs-mkdir.c
+++ b/programs/gvfs-mkdir.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -28,10 +28,10 @@
#include <gio/gio.h>
static gboolean parent = FALSE;
-static GOptionEntry entries[] =
+static GOptionEntry entries[] =
{
- { "parent", 'p', 0, G_OPTION_ARG_NONE, &parent, "create parent directories", NULL },
- { NULL }
+ { "parent", 'p', 0, G_OPTION_ARG_NONE, &parent, N_("create parent directories"), NULL },
+ { NULL }
};
@@ -41,54 +41,54 @@ main (int argc, char *argv[])
GError *error;
GOptionContext *context;
GFile *file;
-
+
setlocale (LC_ALL, "");
g_type_init ();
-
+
error = NULL;
- context = g_option_context_new ("- delete files");
+ context = g_option_context_new (_("- delete files"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
if (error != NULL)
{
- g_printerr ("Error parsing commandline options: %s\n", error->message);
+ g_printerr (_("Error parsing commandline options: %s\n"), error->message);
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
- g_get_prgname ());
+ g_get_prgname ());
g_printerr ("\n");
g_error_free(error);
return 1;
}
-
+
if (argc > 1)
{
int i;
-
- for (i = 1; i < argc; i++)
- {
+
+ for (i = 1; i < argc; i++)
+ {
file = g_file_new_for_commandline_arg (argv[i]);
- error = NULL;
- if (parent)
- {
- if (!g_file_make_directory_with_parents (file, NULL, &error))
- {
- g_print ("Error creating directory: %s\n", error->message);
- g_error_free (error);
- }
- }
- else
- {
+ error = NULL;
+ if (parent)
+ {
+ if (!g_file_make_directory_with_parents (file, NULL, &error))
+ {
+ g_printerr (_("Error creating directory: %s\n"), error->message);
+ g_error_free (error);
+ }
+ }
+ else
+ {
if (!g_file_make_directory (file, NULL, &error))
- {
- g_print ("Error creating directory: %s\n", error->message);
- g_error_free (error);
- }
- g_object_unref (file);
- }
- }
+ {
+ g_printerr (_("Error creating directory: %s\n"), error->message);
+ g_error_free (error);
+ }
+ g_object_unref (file);
+ }
+ }
}
return 0;
diff --git a/programs/gvfs-monitor-dir.c b/programs/gvfs-monitor-dir.c
index bf2f6288..ef5a1335 100644
--- a/programs/gvfs-monitor-dir.c
+++ b/programs/gvfs-monitor-dir.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -73,7 +73,7 @@ dir_monitor_callback (GFileMonitor* monitor,
g_print ("Event = ATTRIB CHANGED\n");
break;
}
-
+
return TRUE;
}
@@ -84,17 +84,17 @@ main (int argc, char *argv[])
GError *error;
GOptionContext *context;
GFile *file;
-
+
setlocale (LC_ALL, "");
-
+
g_type_init ();
-
+
error = NULL;
context = g_option_context_new ("- monitor directory <location>");
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
-
+
if (argc > 1)
{
file = g_file_new_for_commandline_arg (argv[1]);
@@ -107,10 +107,10 @@ main (int argc, char *argv[])
return 1;
}
}
-
+
main_loop = g_main_loop_new (NULL, FALSE);
-
+
g_main_loop_run (main_loop);
-
+
return 0;
}
diff --git a/programs/gvfs-monitor-file.c b/programs/gvfs-monitor-file.c
index 842ed938..731a0d0c 100644
--- a/programs/gvfs-monitor-file.c
+++ b/programs/gvfs-monitor-file.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -68,7 +68,7 @@ file_monitor_callback (GFileMonitor* monitor,
g_print ("Event = ATTRIB CHANGED\n");
break;
}
-
+
return TRUE;
}
@@ -79,27 +79,27 @@ main (int argc, char *argv[])
GError *error;
GOptionContext *context;
GFile *file;
-
+
setlocale (LC_ALL, "");
-
+
g_type_init ();
-
+
error = NULL;
context = g_option_context_new ("- monitor file <location>");
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
-
+
if (argc > 1)
{
file = g_file_new_for_commandline_arg (argv[1]);
fmonitor = g_file_monitor_file (file, G_FILE_MONITOR_WATCH_MOUNTS, NULL, NULL);
g_signal_connect (fmonitor, "changed", (GCallback)file_monitor_callback, NULL);
}
-
+
main_loop = g_main_loop_new (NULL, FALSE);
-
+
g_main_loop_run (main_loop);
-
+
return 0;
}
diff --git a/programs/gvfs-mount.c b/programs/gvfs-mount.c
index 91a451d7..740fac4f 100644
--- a/programs/gvfs-mount.c
+++ b/programs/gvfs-mount.c
@@ -1,6 +1,6 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -28,6 +28,7 @@
#include <glib.h>
#include <locale.h>
+#include <glib/gi18n.h>
#include <gio/gio.h>
#ifdef HAVE_TERMIOS_H
@@ -48,15 +49,15 @@ static gboolean mount_monitor = FALSE;
static const char *unmount_scheme = NULL;
static const char *mount_device_file = NULL;
-static const GOptionEntry entries[] =
+static const GOptionEntry entries[] =
{
- { "mountable", 'm', 0, G_OPTION_ARG_NONE, &mount_mountable, "Mount as mountable", NULL },
- { "device", 'd', 0, G_OPTION_ARG_STRING, &mount_device_file, "Mount volume with device file", NULL},
- { "unmount", 'u', 0, G_OPTION_ARG_NONE, &mount_unmount, "Unmount", NULL},
- { "unmount-scheme", 's', 0, G_OPTION_ARG_STRING, &unmount_scheme, "Unmount all mounts with the given scheme", NULL},
- { "list", 'l', 0, G_OPTION_ARG_NONE, &mount_list, "List", NULL},
- { "detail", 'i', 0, G_OPTION_ARG_NONE, &extra_detail, "Show extra information for List and Monitor", NULL},
- { "monitor", 'o', 0, G_OPTION_ARG_NONE, &mount_monitor, "Monitor events", NULL},
+ { "mountable", 'm', 0, G_OPTION_ARG_NONE, &mount_mountable, N_("Mount as mountable"), NULL },
+ { "device", 'd', 0, G_OPTION_ARG_STRING, &mount_device_file, N_("Mount volume with device file"), NULL},
+ { "unmount", 'u', 0, G_OPTION_ARG_NONE, &mount_unmount, N_("Unmount"), NULL},
+ { "unmount-scheme", 's', 0, G_OPTION_ARG_STRING, &unmount_scheme, N_("Unmount all mounts with the given scheme"), NULL},
+ { "list", 'l', 0, G_OPTION_ARG_NONE, &mount_list, N_("List"), NULL},
+ { "detail", 'i', 0, G_OPTION_ARG_NONE, &extra_detail, N_("Show extra information for List and Monitor"), NULL},
+ { "monitor", 'o', 0, G_OPTION_ARG_NONE, &mount_monitor, N_("Monitor events"), NULL},
{ NULL }
};
@@ -64,7 +65,7 @@ static char *
prompt_for (const char *prompt, const char *default_value, gboolean echo)
{
#ifdef HAVE_TERMIOS_H
- struct termios term_attr;
+ struct termios term_attr;
int old_flags;
gboolean restore_flags;
#endif
@@ -82,10 +83,10 @@ prompt_for (const char *prompt, const char *default_value, gboolean echo)
restore_flags = FALSE;
if (!echo && tcgetattr (STDIN_FILENO, &term_attr) == 0)
{
- old_flags = term_attr.c_lflag;
+ old_flags = term_attr.c_lflag;
term_attr.c_lflag &= ~ECHO;
restore_flags = TRUE;
-
+
if (tcsetattr (STDIN_FILENO, TCSAFLUSH, &term_attr) != 0)
g_print ("Warning! Password will be echoed");
}
@@ -93,7 +94,7 @@ prompt_for (const char *prompt, const char *default_value, gboolean echo)
#endif
fgets(data, sizeof (data), stdin);
-
+
#ifdef HAVE_TERMIOS_H
if (restore_flags)
{
@@ -108,7 +109,7 @@ prompt_for (const char *prompt, const char *default_value, gboolean echo)
if (!echo)
g_print ("\n");
-
+
if (*data == 0 && default_value)
return g_strdup (default_value);
return g_strdup (data);
@@ -116,10 +117,10 @@ prompt_for (const char *prompt, const char *default_value, gboolean echo)
static void
ask_password_cb (GMountOperation *op,
- const char *message,
- const char *default_user,
- const char *default_domain,
- GAskPasswordFlags flags)
+ const char *message,
+ const char *default_user,
+ const char *default_domain,
+ GAskPasswordFlags flags)
{
char *s;
g_print ("%s\n", message);
@@ -130,14 +131,14 @@ ask_password_cb (GMountOperation *op,
g_mount_operation_set_username (op, s);
g_free (s);
}
-
+
if (flags & G_ASK_PASSWORD_NEED_DOMAIN)
{
s = prompt_for ("Domain", default_domain, TRUE);
g_mount_operation_set_domain (op, s);
g_free (s);
}
-
+
if (flags & G_ASK_PASSWORD_NEED_PASSWORD)
{
s = prompt_for ("Password", NULL, FALSE);
@@ -150,29 +151,29 @@ ask_password_cb (GMountOperation *op,
static void
mount_mountable_done_cb (GObject *object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
GFile *target;
GError *error = NULL;
-
+
target = g_file_mount_mountable_finish (G_FILE (object), res, &error);
if (target == NULL)
- g_print ("Error mounting location: %s\n", error->message);
+ g_printerr (_("Error mounting location: %s\n"), error->message);
else
g_object_unref (target);
-
+
outstanding_mounts--;
-
+
if (outstanding_mounts == 0)
g_main_loop_quit (main_loop);
}
static void
mount_done_cb (GObject *object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
gboolean succeeded;
GError *error = NULL;
@@ -180,10 +181,10 @@ mount_done_cb (GObject *object,
succeeded = g_file_mount_enclosing_volume_finish (G_FILE (object), res, &error);
if (!succeeded)
- g_print ("Error mounting location: %s\n", error->message);
-
+ g_printerr (_("Error mounting location: %s\n"), error->message);
+
outstanding_mounts--;
-
+
if (outstanding_mounts == 0)
g_main_loop_quit (main_loop);
}
@@ -192,7 +193,7 @@ static GMountOperation *
new_mount_op (void)
{
GMountOperation *op;
-
+
op = g_mount_operation_new ();
g_signal_connect (op, "ask_password", G_CALLBACK (ask_password_cb), NULL);
@@ -220,7 +221,7 @@ mount (GFile *file)
g_file_mount_mountable (file, 0, op, NULL, mount_mountable_done_cb, op);
else
g_file_mount_enclosing_volume (file, 0, op, NULL, mount_done_cb, op);
-
+
outstanding_mounts++;
}
@@ -237,10 +238,10 @@ unmount_done_cb (GObject *object,
g_object_unref (G_MOUNT (object));
if (!succeeded)
- g_print ("Error unmounting mount: %s\n", error->message);
-
+ g_printerr (_("Error unmounting mount: %s\n"), error->message);
+
outstanding_mounts--;
-
+
if (outstanding_mounts == 0)
g_main_loop_quit (main_loop);
}
@@ -258,7 +259,7 @@ unmount (GFile *file)
mount = g_file_find_enclosing_mount (file, NULL, &error);
if (mount == NULL)
{
- g_print ("Error finding enclosing mount: %s\n", error->message);
+ g_printerr (_("Error finding enclosing mount: %s\n"), error->message);
return;
}
@@ -281,7 +282,7 @@ iterate_gmain_timeout_function (gpointer data)
static void
iterate_gmain(void)
{
- g_timeout_add (500, iterate_gmain_timeout_function, NULL);
+ g_timeout_add (500, iterate_gmain_timeout_function, NULL);
g_main_loop_run (main_loop);
}
@@ -350,8 +351,8 @@ get_type_name (gpointer object)
static void
list_mounts (GList *mounts,
- int indent,
- gboolean only_with_no_volume)
+ int indent,
+ gboolean only_with_no_volume)
{
GList *l;
int c;
@@ -362,25 +363,25 @@ list_mounts (GList *mounts,
GIcon *icon;
char **x_content_types;
char *type_name;
-
+
for (c = 0, l = mounts; l != NULL; l = l->next, c++)
{
mount = (GMount *) l->data;
-
+
if (only_with_no_volume)
- {
- volume = g_mount_get_volume (mount);
- if (volume != NULL)
- {
+ {
+ volume = g_mount_get_volume (mount);
+ if (volume != NULL)
+ {
g_object_unref (volume);
- continue;
- }
- }
+ continue;
+ }
+ }
name = g_mount_get_name (mount);
root = g_mount_get_root (mount);
uri = g_file_get_uri (root);
-
+
g_print ("%*sMount(%d): %s -> %s\n", indent, "", c, name, uri);
type_name = get_type_name (mount);
@@ -388,17 +389,17 @@ list_mounts (GList *mounts,
g_free (type_name);
if (extra_detail)
- {
- uuid = g_mount_get_uuid (mount);
- if (uuid)
- g_print ("%*suuid=%s\n", indent + 2, "", uuid);
+ {
+ uuid = g_mount_get_uuid (mount);
+ if (uuid)
+ g_print ("%*suuid=%s\n", indent + 2, "", uuid);
icon = g_mount_get_icon (mount);
if (icon)
{
if (G_IS_THEMED_ICON (icon))
show_themed_icon_names (G_THEMED_ICON (icon), indent + 2);
-
+
g_object_unref (icon);
}
@@ -413,22 +414,22 @@ list_mounts (GList *mounts,
}
g_strfreev (x_content_types);
- g_print ("%*scan_unmount=%d\n", indent + 2, "", g_mount_can_unmount (mount));
- g_print ("%*scan_eject=%d\n", indent + 2, "", g_mount_can_eject (mount));
- g_print ("%*sis_shadowed=%d\n", indent + 2, "", g_mount_is_shadowed (mount));
- g_free (uuid);
- }
-
+ g_print ("%*scan_unmount=%d\n", indent + 2, "", g_mount_can_unmount (mount));
+ g_print ("%*scan_eject=%d\n", indent + 2, "", g_mount_can_eject (mount));
+ g_print ("%*sis_shadowed=%d\n", indent + 2, "", g_mount_is_shadowed (mount));
+ g_free (uuid);
+ }
+
g_object_unref (root);
g_free (name);
g_free (uri);
- }
+ }
}
static void
list_volumes (GList *volumes,
- int indent,
- gboolean only_with_no_drive)
+ int indent,
+ gboolean only_with_no_drive)
{
GList *l, *mounts;
int c, i;
@@ -441,23 +442,23 @@ list_volumes (GList *volumes,
char **ids;
GIcon *icon;
char *type_name;
-
+
for (c = 0, l = volumes; l != NULL; l = l->next, c++)
{
volume = (GVolume *) l->data;
-
+
if (only_with_no_drive)
- {
- drive = g_volume_get_drive (volume);
- if (drive != NULL)
- {
- g_object_unref (drive);
- continue;
- }
- }
-
+ {
+ drive = g_volume_get_drive (volume);
+ if (drive != NULL)
+ {
+ g_object_unref (drive);
+ continue;
+ }
+ }
+
name = g_volume_get_name (volume);
-
+
g_print ("%*sVolume(%d): %s\n", indent, "", c, name);
g_free (name);
@@ -466,26 +467,26 @@ list_volumes (GList *volumes,
g_free (type_name);
if (extra_detail)
- {
- ids = g_volume_enumerate_identifiers (volume);
- if (ids && ids[0] != NULL)
- {
- g_print ("%*sids:\n", indent+2, "");
- for (i = 0; ids[i] != NULL; i++)
- {
- char *id = g_volume_get_identifier (volume,
- ids[i]);
- g_print ("%*s %s: '%s'\n", indent+2, "", ids[i], id);
- g_free (id);
- }
- }
- g_strfreev (ids);
-
- uuid = g_volume_get_uuid (volume);
- if (uuid)
- g_print ("%*suuid=%s\n", indent + 2, "", uuid);
- activation_root = g_volume_get_activation_root (volume);
- if (activation_root)
+ {
+ ids = g_volume_enumerate_identifiers (volume);
+ if (ids && ids[0] != NULL)
+ {
+ g_print ("%*sids:\n", indent+2, "");
+ for (i = 0; ids[i] != NULL; i++)
+ {
+ char *id = g_volume_get_identifier (volume,
+ ids[i]);
+ g_print ("%*s %s: '%s'\n", indent+2, "", ids[i], id);
+ g_free (id);
+ }
+ }
+ g_strfreev (ids);
+
+ uuid = g_volume_get_uuid (volume);
+ if (uuid)
+ g_print ("%*suuid=%s\n", indent + 2, "", uuid);
+ activation_root = g_volume_get_activation_root (volume);
+ if (activation_root)
{
char *uri;
uri = g_file_get_uri (activation_root);
@@ -502,26 +503,26 @@ list_volumes (GList *volumes,
g_object_unref (icon);
}
- g_print ("%*scan_mount=%d\n", indent + 2, "", g_volume_can_mount (volume));
- g_print ("%*scan_eject=%d\n", indent + 2, "", g_volume_can_eject (volume));
- g_print ("%*sshould_automount=%d\n", indent + 2, "", g_volume_should_automount (volume));
- g_free (uuid);
- }
-
+ g_print ("%*scan_mount=%d\n", indent + 2, "", g_volume_can_mount (volume));
+ g_print ("%*scan_eject=%d\n", indent + 2, "", g_volume_can_eject (volume));
+ g_print ("%*sshould_automount=%d\n", indent + 2, "", g_volume_should_automount (volume));
+ g_free (uuid);
+ }
+
mount = g_volume_get_mount (volume);
if (mount)
- {
- mounts = g_list_prepend (NULL, mount);
- list_mounts (mounts, indent + 2, FALSE);
- g_list_free (mounts);
- g_object_unref (mount);
- }
- }
+ {
+ mounts = g_list_prepend (NULL, mount);
+ list_mounts (mounts, indent + 2, FALSE);
+ g_list_free (mounts);
+ g_object_unref (mount);
+ }
+ }
}
static void
list_drives (GList *drives,
- int indent)
+ int indent)
{
GList *volumes, *l;
int c, i;
@@ -530,37 +531,37 @@ list_drives (GList *drives,
char **ids;
GIcon *icon;
char *type_name;
-
+
for (c = 0, l = drives; l != NULL; l = l->next, c++)
{
drive = (GDrive *) l->data;
name = g_drive_get_name (drive);
-
+
g_print ("%*sDrive(%d): %s\n", indent, "", c, name);
g_free (name);
type_name = get_type_name (drive);
g_print ("%*sType: %s\n", indent+2, "", type_name);
g_free (type_name);
-
+
if (extra_detail)
- {
+ {
GEnumValue *enum_value;
gpointer klass;
- ids = g_drive_enumerate_identifiers (drive);
- if (ids && ids[0] != NULL)
- {
- g_print ("%*sids:\n", indent+2, "");
- for (i = 0; ids[i] != NULL; i++)
- {
- char *id = g_drive_get_identifier (drive,
- ids[i]);
- g_print ("%*s %s: '%s'\n", indent+2, "", ids[i], id);
- g_free (id);
- }
- }
- g_strfreev (ids);
+ ids = g_drive_enumerate_identifiers (drive);
+ if (ids && ids[0] != NULL)
+ {
+ g_print ("%*sids:\n", indent+2, "");
+ for (i = 0; ids[i] != NULL; i++)
+ {
+ char *id = g_drive_get_identifier (drive,
+ ids[i]);
+ g_print ("%*s %s: '%s'\n", indent+2, "", ids[i], id);
+ g_free (id);
+ }
+ }
+ g_strfreev (ids);
icon = g_drive_get_icon (drive);
if (icon)
@@ -570,13 +571,13 @@ list_drives (GList *drives,
g_object_unref (icon);
}
- g_print ("%*sis_media_removable=%d\n", indent + 2, "", g_drive_is_media_removable (drive));
- g_print ("%*shas_media=%d\n", indent + 2, "", g_drive_has_media (drive));
- g_print ("%*sis_media_check_automatic=%d\n", indent + 2, "", g_drive_is_media_check_automatic (drive));
- g_print ("%*scan_poll_for_media=%d\n", indent + 2, "", g_drive_can_poll_for_media (drive));
- g_print ("%*scan_eject=%d\n", indent + 2, "", g_drive_can_eject (drive));
- g_print ("%*scan_start=%d\n", indent + 2, "", g_drive_can_start (drive));
- g_print ("%*scan_stop=%d\n", indent + 2, "", g_drive_can_stop (drive));
+ g_print ("%*sis_media_removable=%d\n", indent + 2, "", g_drive_is_media_removable (drive));
+ g_print ("%*shas_media=%d\n", indent + 2, "", g_drive_has_media (drive));
+ g_print ("%*sis_media_check_automatic=%d\n", indent + 2, "", g_drive_is_media_check_automatic (drive));
+ g_print ("%*scan_poll_for_media=%d\n", indent + 2, "", g_drive_can_poll_for_media (drive));
+ g_print ("%*scan_eject=%d\n", indent + 2, "", g_drive_can_eject (drive));
+ g_print ("%*scan_start=%d\n", indent + 2, "", g_drive_can_start (drive));
+ g_print ("%*scan_stop=%d\n", indent + 2, "", g_drive_can_stop (drive));
enum_value = NULL;
klass = g_type_class_ref (G_TYPE_DRIVE_START_STOP_TYPE);
@@ -587,7 +588,7 @@ list_drives (GList *drives,
enum_value != NULL ? enum_value->value_nick : "UNKNOWN");
g_type_class_unref (klass);
}
- }
+ }
volumes = g_drive_get_volumes (drive);
list_volumes (volumes, indent + 2, FALSE);
g_list_foreach (volumes, (GFunc)g_object_unref, NULL);
@@ -603,7 +604,7 @@ list_monitor_items(void)
GList *drives, *volumes, *mounts;
volume_monitor = g_volume_monitor_get();
-
+
/* populate gvfs network mounts */
iterate_gmain();
@@ -611,12 +612,12 @@ list_monitor_items(void)
list_drives (drives, 0);
g_list_foreach (drives, (GFunc)g_object_unref, NULL);
g_list_free (drives);
-
+
volumes = g_volume_monitor_get_volumes (volume_monitor);
list_volumes (volumes, 0, TRUE);
g_list_foreach (volumes, (GFunc)g_object_unref, NULL);
g_list_free (volumes);
-
+
mounts = g_volume_monitor_get_mounts (volume_monitor);
list_mounts (mounts, 0, TRUE);
g_list_foreach (mounts, (GFunc)g_object_unref, NULL);
@@ -669,9 +670,9 @@ mount_with_device_file_cb (GObject *object,
if (!succeeded)
{
- g_print ("Error mounting %s: %s\n",
- g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE),
- error->message);
+ g_printerr (_("Error mounting %s: %s\n"),
+ g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE),
+ error->message);
}
else
{
@@ -683,7 +684,7 @@ mount_with_device_file_cb (GObject *object,
root = g_mount_get_root (mount);
mount_path = g_file_get_path (root);
- g_print ("Mounted %s at %s\n",
+ g_print (_("Mounted %s at %s\n"),
g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE),
mount_path);
@@ -734,7 +735,7 @@ mount_with_device_file (const char *device_file)
if (outstanding_mounts == 0)
{
- g_print ("No volume for device file %s\n", device_file);
+ g_print (_("No volume for device file %s\n"), device_file);
return;
}
@@ -921,19 +922,19 @@ main (int argc, char *argv[])
GOptionContext *context;
GError *error;
GFile *file;
-
+
setlocale (LC_ALL, "");
g_type_init ();
-
+
error = NULL;
- context = g_option_context_new ("- mount <location>");
+ context = g_option_context_new (_("- mount <location>"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
main_loop = g_main_loop_new (NULL, FALSE);
-
+
if (mount_list)
list_monitor_items ();
else if (mount_device_file != NULL)
@@ -951,19 +952,19 @@ main (int argc, char *argv[])
else if (argc > 1)
{
int i;
-
+
for (i = 1; i < argc; i++) {
- file = g_file_new_for_commandline_arg (argv[i]);
- if (mount_unmount)
- unmount (file);
- else
- mount (file);
- g_object_unref (file);
+ file = g_file_new_for_commandline_arg (argv[i]);
+ if (mount_unmount)
+ unmount (file);
+ else
+ mount (file);
+ g_object_unref (file);
}
}
-
+
if (outstanding_mounts > 0)
g_main_loop_run (main_loop);
-
+
return 0;
}
diff --git a/programs/gvfs-move.c b/programs/gvfs-move.c
index 7fab61ca..ae8a3fe6 100644
--- a/programs/gvfs-move.c
+++ b/programs/gvfs-move.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -37,13 +37,13 @@ static gboolean interactive = FALSE;
static gboolean backup = FALSE;
static gboolean no_target_directory = FALSE;
-static GOptionEntry entries[] =
+static GOptionEntry entries[] =
{
- { "no-target-directory", 'T', 0, G_OPTION_ARG_NONE, &no_target_directory, "no target directory", NULL },
- { "progress", 'p', 0, G_OPTION_ARG_NONE, &progress, "show progress", NULL },
- { "interactive", 'i', 0, G_OPTION_ARG_NONE, &interactive, "prompt before overwrite", NULL },
- { "backup", 'b', 0, G_OPTION_ARG_NONE, &backup, "backup existing destination files", NULL },
- { NULL }
+ { "no-target-directory", 'T', 0, G_OPTION_ARG_NONE, &no_target_directory, N_("no target directory"), NULL },
+ { "progress", 'p', 0, G_OPTION_ARG_NONE, &progress, N_("show progress"), NULL },
+ { "interactive", 'i', 0, G_OPTION_ARG_NONE, &interactive, N_("prompt before overwrite"), NULL },
+ { "backup", 'b', 0, G_OPTION_ARG_NONE, &backup, N_("backup existing destination files"), NULL },
+ { NULL }
};
static gboolean
@@ -51,7 +51,7 @@ is_dir (GFile *file)
{
GFileInfo *info;
gboolean res;
-
+
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE, 0, NULL, NULL);
res = info && g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY;
if (info)
@@ -64,7 +64,8 @@ show_progress (goffset current_num_bytes,
goffset total_num_bytes,
gpointer user_data)
{
- g_print ("progress %"G_GINT64_FORMAT"/%"G_GINT64_FORMAT"\n",
+ g_print (_("progress"));
+ g_print (" %"G_GINT64_FORMAT"/%"G_GINT64_FORMAT"\n",
current_num_bytes, total_num_bytes);
}
@@ -79,23 +80,23 @@ main (int argc, char *argv[])
char *basename;
int i;
GFileCopyFlags flags;
-
+
setlocale (LC_ALL, "");
g_type_init ();
-
+
error = NULL;
- context = g_option_context_new ("- output files at <location>");
+ context = g_option_context_new (_("- output files at <location>"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
-
+
if (error != NULL)
{
- g_printerr ("Error parsing commandline options: %s\n", error->message);
+ g_printerr (_("Error parsing commandline options: %s\n"), error->message);
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
- g_get_prgname ());
+ g_get_prgname ());
g_printerr ("\n");
g_error_free(error);
return 1;
@@ -103,7 +104,7 @@ main (int argc, char *argv[])
if (argc <= 2)
{
- g_printerr ("Missing operand\n");
+ g_printerr (_("Missing operand\n"));
return 1;
}
@@ -111,16 +112,16 @@ main (int argc, char *argv[])
if (no_target_directory && argc > 3)
{
- g_printerr ("Too many arguments\n");
+ g_printerr (_("Too many arguments\n"));
g_object_unref (dest);
return 1;
}
-
+
dest_is_dir = is_dir (dest);
if (!dest_is_dir && argc > 3)
{
- g_printerr ("Target %s is not a directory\n", argv[argc-1]);
+ g_printerr (_("Target %s is not a directory\n"), argv[argc-1]);
g_object_unref (dest);
return 1;
}
@@ -143,14 +144,14 @@ main (int argc, char *argv[])
flags |= G_FILE_COPY_BACKUP;
if (!interactive)
flags |= G_FILE_COPY_OVERWRITE;
-
+
error = NULL;
if (!g_file_move (source, target, flags, NULL, progress?show_progress:NULL, NULL, &error))
{
if (interactive && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS))
{
char line[16];
-
+
g_error_free (error);
error = NULL;
@@ -169,7 +170,7 @@ main (int argc, char *argv[])
else
{
move_failed:
- g_printerr ("Error moving file %s: %s\n", argv[i], error->message);
+ g_printerr (_("Error moving file %s: %s\n"), argv[i], error->message);
g_error_free (error);
}
}
diff --git a/programs/gvfs-open.c b/programs/gvfs-open.c
index 1f734b8c..7e197d81 100644
--- a/programs/gvfs-open.c
+++ b/programs/gvfs-open.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -34,7 +34,7 @@
static gchar **locations = NULL;
static GOptionEntry entries[] = {
- {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &locations, "files", NULL},
+ {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &locations, N_("files"), NULL},
{NULL}
};
@@ -63,7 +63,7 @@ open (GFile *file, char *arg_string)
/* Translators: the first %s is the program name, the second one */
/* is the URI of the file, the third is the error message. */
g_printerr (_("%s: %s: error opening location: %s\n"),
- g_get_prgname (), g_file_get_uri (file), error->message);
+ g_get_prgname (), g_file_get_uri (file), error->message);
g_error_free (error);
return;
}
@@ -84,7 +84,7 @@ open (GFile *file, char *arg_string)
res = g_app_info_launch_uris (app, &l,
NULL, &error);
}
-
+
if (!res)
{
/* Translators: the first %s is the program name, the second one */
@@ -93,7 +93,7 @@ open (GFile *file, char *arg_string)
g_get_prgname (), g_file_get_uri (file), error->message);
g_error_free (error);
}
-
+
g_object_unref (app);
return;
@@ -132,13 +132,13 @@ main (int argc, char *argv[])
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
-
+
if (error != NULL)
{
- g_printerr ("Error parsing commandline options: %s\n", error->message);
+ g_printerr (_("Error parsing commandline options: %s\n"), error->message);
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
- g_get_prgname ());
+ g_get_prgname ());
g_printerr ("\n");
g_error_free(error);
return 1;
@@ -151,7 +151,7 @@ main (int argc, char *argv[])
g_printerr (_("%s: missing locations"), g_get_prgname ());
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
- g_get_prgname ());
+ g_get_prgname ());
g_printerr ("\n");
return 1;
}
diff --git a/programs/gvfs-rename.c b/programs/gvfs-rename.c
index cb2a0638..94933b23 100644
--- a/programs/gvfs-rename.c
+++ b/programs/gvfs-rename.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2008 Christian Kellner <gicmo@gnome.org>
*
* This library is free software; you can redistribute it and/or
@@ -24,9 +24,10 @@
#include <glib.h>
#include <locale.h>
+#include <glib/gi18n.h>
#include <gio/gio.h>
-static GOptionEntry entries[] =
+static GOptionEntry entries[] =
{
{ NULL }
};
@@ -45,7 +46,7 @@ main (int argc, char *argv[])
g_type_init ();
error = NULL;
- context = g_option_context_new ("- rename file");
+ context = g_option_context_new (_("- rename file"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
@@ -53,24 +54,24 @@ main (int argc, char *argv[])
if (argc < 3)
{
g_printerr ("Usage: %s location new_name\n",
- g_get_prgname ());
+ g_get_prgname ());
return 1;
}
file = g_file_new_for_commandline_arg (argv[1]);
new_file = g_file_set_display_name (file, argv[2],
- NULL, &error);
+ NULL, &error);
if (new_file == NULL)
{
- g_print ("Error: %s\n", error->message);
+ g_printerr (_("Error: %s\n"), error->message);
g_error_free (error);
}
else
{
char *uri = g_file_get_uri (new_file);
- g_print ("Rename successful. New uri: %s\n", uri);
+ g_print (_("Rename successful. New uri: %s\n"), uri);
g_object_unref (new_file);
g_free (uri);
}
diff --git a/programs/gvfs-save.c b/programs/gvfs-save.c
index ffe21bad..1b9ca43c 100644
--- a/programs/gvfs-save.c
+++ b/programs/gvfs-save.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -38,15 +38,15 @@ static gboolean append = FALSE;
static gboolean priv = FALSE;
static gboolean print_etag = FALSE;
-static GOptionEntry entries[] =
+static GOptionEntry entries[] =
{
- { "backup", 'b', 0, G_OPTION_ARG_NONE, &backup, "Create backup", NULL },
- { "create", 'c', 0, G_OPTION_ARG_NONE, &create, "Only create if not existing", NULL },
- { "append", 'a', 0, G_OPTION_ARG_NONE, &append, "Append to end of file", NULL },
- { "private", 'p', 0, G_OPTION_ARG_NONE, &priv, "When creating a file, restrict access to the current user only", NULL },
- { "print_etag", 'v', 0, G_OPTION_ARG_NONE, &print_etag, "Print new etag at end", NULL },
- { "etag", 'e', 0, G_OPTION_ARG_STRING, &etag, "The etag of the file being overwritten", NULL },
- { NULL }
+ { "backup", 'b', 0, G_OPTION_ARG_NONE, &backup, N_("Create backup"), NULL },
+ { "create", 'c', 0, G_OPTION_ARG_NONE, &create, N_("Only create if not existing"), NULL },
+ { "append", 'a', 0, G_OPTION_ARG_NONE, &append, N_("Append to end of file"), NULL },
+ { "private", 'p', 0, G_OPTION_ARG_NONE, &priv, N_("When creating a file, restrict access to the current user only"), NULL },
+ { "print_etag", 'v', 0, G_OPTION_ARG_NONE, &print_etag, N_("Print new etag at end"), NULL },
+ { "etag", 'e', 0, G_OPTION_ARG_STRING, &etag, N_("The etag of the file being overwritten"), NULL },
+ { NULL }
};
static gboolean
@@ -73,20 +73,20 @@ save (GFile *file)
out = (GOutputStream *)g_file_replace (file, etag, backup, flags, NULL, &error);
if (out == NULL)
{
- g_printerr ("Error opening file: %s\n", error->message);
+ g_printerr (_("Error opening file: %s\n"), error->message);
g_error_free (error);
return FALSE;
}
-
+
save_res = TRUE;
-
+
while (1)
{
res = read (STDIN_FILENO, buffer, 1024);
if (res > 0)
{
ssize_t written;
-
+
p = buffer;
while (res > 0)
{
@@ -106,7 +106,7 @@ save (GFile *file)
else if (res < 0)
{
save_res = FALSE;
- perror ("Error reading stdin");
+ perror (_("Error reading stdin"));
break;
}
else if (res == 0)
@@ -114,12 +114,12 @@ save (GFile *file)
}
out:
-
+
close_res = g_output_stream_close (out, NULL, &error);
if (!close_res)
{
save_res = FALSE;
- g_printerr ("Error closing: %s\n", error->message);
+ g_printerr (_("Error closing: %s\n"), error->message);
g_error_free (error);
}
@@ -131,12 +131,12 @@ save (GFile *file)
if (etag)
g_print ("Etag: %s\n", etag);
else
- g_print ("Etag not available\n");
+ g_print (_("Etag not available\n"));
g_free (etag);
}
-
+
g_object_unref (out);
-
+
return save_res;
}
@@ -147,30 +147,30 @@ main (int argc, char *argv[])
GOptionContext *context;
GFile *file;
gboolean res;
-
+
setlocale (LC_ALL, "");
g_type_init ();
-
+
error = NULL;
- context = g_option_context_new ("- output files at <location>");
+ context = g_option_context_new (_("- output files at <location>"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
-
+
if (error != NULL)
{
- g_printerr ("Error parsing commandline options: %s\n", error->message);
+ g_printerr (_("Error parsing commandline options: %s\n"), error->message);
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
- g_get_prgname ());
+ g_get_prgname ());
g_printerr ("\n");
g_error_free(error);
return 1;
}
res = FALSE;
-
+
if (argc > 1)
{
file = g_file_new_for_commandline_arg (argv[1]);
diff --git a/programs/gvfs-set-attribute.c b/programs/gvfs-set-attribute.c
index 95048629..e5bdf376 100644
--- a/programs/gvfs-set-attribute.c
+++ b/programs/gvfs-set-attribute.c
@@ -33,8 +33,8 @@ static gboolean nofollow_symlinks = FALSE;
static GOptionEntry entries[] =
{
- { "type", 't', 0, G_OPTION_ARG_STRING, &attr_type, "attribute type [string, bytestring, boolean, uint32, int32, uint64, int64, stringv]", NULL },
- { "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, "Don't follow symlinks", NULL },
+ { "type", 't', 0, G_OPTION_ARG_STRING, &attr_type, N_("attribute type [string, bytestring, boolean, uint32, int32, uint64, int64, stringv]"), NULL },
+ { "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, N_("Don't follow symlinks"), NULL },
{ NULL }
};
@@ -116,14 +116,14 @@ main (int argc, char *argv[])
g_type_init ();
error = NULL;
- context = g_option_context_new (" <location> <attribute> <values> - set attribute");
+ context = g_option_context_new (_(" <location> <attribute> <values> - set attribute"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
if (error != NULL)
{
- g_printerr ("Error parsing commandline options: %s\n", error->message);
+ g_printerr (_("Error parsing commandline options: %s\n"), error->message);
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
g_get_prgname ());
diff --git a/programs/gvfs-tree.c b/programs/gvfs-tree.c
index a9ff3b06..652fa706 100644
--- a/programs/gvfs-tree.c
+++ b/programs/gvfs-tree.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -31,10 +31,10 @@
static gboolean show_hidden = FALSE;
static gboolean follow_symlinks = FALSE;
-static GOptionEntry entries[] =
+static GOptionEntry entries[] =
{
- { "hidden", 'h', 0, G_OPTION_ARG_NONE, &show_hidden, "Show hidden files", NULL },
- { "follow-symlinks", 'l', 0, G_OPTION_ARG_NONE, &follow_symlinks, "Follow symlinks, mounts and shortcuts like dirs", NULL },
+ { "hidden", 'h', 0, G_OPTION_ARG_NONE, &show_hidden, N_("Show hidden files"), NULL },
+ { "follow-symlinks", 'l', 0, G_OPTION_ARG_NONE, &follow_symlinks, N_("Follow symlinks, mounts and shortcuts like dirs"), NULL },
};
static gint
@@ -62,32 +62,32 @@ do_tree (GFile *f, int level, guint64 pattern)
unsigned int n;
GFileInfo *info;
- info = g_file_query_info (f,
- G_FILE_ATTRIBUTE_STANDARD_TYPE ","
- G_FILE_ATTRIBUTE_STANDARD_TARGET_URI,
- 0,
- NULL, NULL);
+ info = g_file_query_info (f,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_TARGET_URI,
+ 0,
+ NULL, NULL);
if (info != NULL)
{
if (g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_MOUNTABLE)
- {
- /* don't process mountables; we avoid these by getting the target_uri below */
- g_object_unref (info);
- return;
- }
+ {
+ /* don't process mountables; we avoid these by getting the target_uri below */
+ g_object_unref (info);
+ return;
+ }
g_object_unref (info);
}
- enumerator = g_file_enumerate_children (f,
- G_FILE_ATTRIBUTE_STANDARD_NAME ","
- G_FILE_ATTRIBUTE_STANDARD_TYPE ","
- G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN ","
- G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK ","
- G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
- G_FILE_ATTRIBUTE_STANDARD_TARGET_URI,
- 0,
- NULL,
- &error);
+ enumerator = g_file_enumerate_children (f,
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN ","
+ G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK ","
+ G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
+ G_FILE_ATTRIBUTE_STANDARD_TARGET_URI,
+ 0,
+ NULL,
+ &error);
if (enumerator != NULL)
{
GList *l;
@@ -95,119 +95,119 @@ do_tree (GFile *f, int level, guint64 pattern)
info_list = NULL;
while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL)
- {
- if (g_file_info_get_is_hidden (info) && !show_hidden)
- {
- g_object_unref (info);
- }
- else
- {
- info_list = g_list_prepend (info_list, info);
- }
- }
+ {
+ if (g_file_info_get_is_hidden (info) && !show_hidden)
+ {
+ g_object_unref (info);
+ }
+ else
+ {
+ info_list = g_list_prepend (info_list, info);
+ }
+ }
g_file_enumerator_close (enumerator, NULL, NULL);
info_list = g_list_sort (info_list, (GCompareFunc) sort_info_by_name);
for (l = info_list; l != NULL; l = l->next)
- {
- const char *name;
- const char *target_uri;
- GFileType type;
- gboolean is_last_item;
-
- info = l->data;
- is_last_item = (l->next == NULL);
-
- name = g_file_info_get_name (info);
- type = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE);
- if (name != NULL)
- {
-
- for (n = 0; n < level; n++)
- {
- if (pattern & (1<<n))
- {
- g_print ("| ");
- }
- else
- {
- g_print (" ");
- }
- }
-
- if (is_last_item)
- {
- g_print ("`-- %s", name);
- }
- else
- {
- g_print ("|-- %s", name);
- }
-
- target_uri = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI);
- if (target_uri != NULL)
- {
- g_print (" -> %s", target_uri);
- }
- else
- {
- if (g_file_info_get_is_symlink (info))
- {
- const char *target;
- target = g_file_info_get_symlink_target (info);
- g_print (" -> %s", target);
- }
- }
-
- g_print ("\n");
-
- if ((type & G_FILE_TYPE_DIRECTORY) &&
- (follow_symlinks || !g_file_info_get_is_symlink (info)))
- {
- guint64 new_pattern;
- GFile *child;
-
- if (is_last_item)
- new_pattern = pattern;
- else
- new_pattern = pattern | (1<<level);
-
- child = NULL;
- if (target_uri != NULL)
- {
- if (follow_symlinks)
- child = g_file_new_for_uri (target_uri);
- }
- else
- {
- child = g_file_get_child (f, name);
- }
-
- if (child != NULL)
- {
- do_tree (child, level + 1, new_pattern);
- g_object_unref (child);
- }
- }
- }
- g_object_unref (info);
- }
+ {
+ const char *name;
+ const char *target_uri;
+ GFileType type;
+ gboolean is_last_item;
+
+ info = l->data;
+ is_last_item = (l->next == NULL);
+
+ name = g_file_info_get_name (info);
+ type = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_STANDARD_TYPE);
+ if (name != NULL)
+ {
+
+ for (n = 0; n < level; n++)
+ {
+ if (pattern & (1<<n))
+ {
+ g_print ("| ");
+ }
+ else
+ {
+ g_print (" ");
+ }
+ }
+
+ if (is_last_item)
+ {
+ g_print ("`-- %s", name);
+ }
+ else
+ {
+ g_print ("|-- %s", name);
+ }
+
+ target_uri = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI);
+ if (target_uri != NULL)
+ {
+ g_print (" -> %s", target_uri);
+ }
+ else
+ {
+ if (g_file_info_get_is_symlink (info))
+ {
+ const char *target;
+ target = g_file_info_get_symlink_target (info);
+ g_print (" -> %s", target);
+ }
+ }
+
+ g_print ("\n");
+
+ if ((type & G_FILE_TYPE_DIRECTORY) &&
+ (follow_symlinks || !g_file_info_get_is_symlink (info)))
+ {
+ guint64 new_pattern;
+ GFile *child;
+
+ if (is_last_item)
+ new_pattern = pattern;
+ else
+ new_pattern = pattern | (1<<level);
+
+ child = NULL;
+ if (target_uri != NULL)
+ {
+ if (follow_symlinks)
+ child = g_file_new_for_uri (target_uri);
+ }
+ else
+ {
+ child = g_file_get_child (f, name);
+ }
+
+ if (child != NULL)
+ {
+ do_tree (child, level + 1, new_pattern);
+ g_object_unref (child);
+ }
+ }
+ }
+ g_object_unref (info);
+ }
g_list_free (info_list);
}
else
{
for (n = 0; n < level; n++)
- {
- if (pattern & (1<<n))
- {
- g_print ("| ");
- }
- else
- {
- g_print (" ");
- }
- }
+ {
+ if (pattern & (1<<n))
+ {
+ g_print ("| ");
+ }
+ else
+ {
+ g_print (" ");
+ }
+ }
g_print (" [%s]\n", error->message);
@@ -233,23 +233,23 @@ main (int argc, char *argv[])
GError *error;
GOptionContext *context;
GFile *file;
-
+
setlocale (LC_ALL, "");
g_type_init ();
-
+
error = NULL;
- context = g_option_context_new ("- list contents of directories in a tree-like format");
+ context = g_option_context_new (_("- list contents of directories in a tree-like format"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
-
+
if (error != NULL)
{
- g_printerr ("Error parsing commandline options: %s\n", error->message);
+ g_printerr (_("Error parsing commandline options: %s\n"), error->message);
g_printerr ("\n");
g_printerr (_("Try \"%s --help\" for more information."),
- g_get_prgname ());
+ g_get_prgname ());
g_printerr ("\n");
g_error_free(error);
return 1;
@@ -258,7 +258,7 @@ main (int argc, char *argv[])
if (argc > 1)
{
int i;
-
+
for (i = 1; i < argc; i++) {
file = g_file_new_for_commandline_arg (argv[i]);
tree (file);
@@ -268,7 +268,7 @@ main (int argc, char *argv[])
else
{
char *cwd;
-
+
cwd = g_get_current_dir ();
file = g_file_new_for_path (cwd);
g_free (cwd);