diff options
author | Ondrej Holy <oholy@redhat.com> | 2016-12-16 14:32:29 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2017-04-10 10:14:04 +0200 |
commit | 0beeeb2ec9f2a934fee8c7aa40c4d4c415d0d187 (patch) | |
tree | 6c7e1cbcd6248e8f2627e5f5a9d306265efba5c0 /gio/gio-tool-monitor.c | |
parent | a83ccc535f73128fe4880d19d34375f9fdcd5113 (diff) |
gio-tool: Various fixes related to error messages
This patch contains the following changes:
- Print all errors with "gio: " prefix
- Print file uri in error for each tool allowing multiple locations
- Mark all error messages translatable
- Do not leak strings used in error messages
- Always start error messages with capital letter
- Unify some error messages across various tools
- Fix addional/missing new line characters
https://bugzilla.gnome.org/show_bug.cgi?id=776169
Diffstat (limited to 'gio/gio-tool-monitor.c')
-rw-r--r-- | gio/gio-tool-monitor.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/gio/gio-tool-monitor.c b/gio/gio-tool-monitor.c index 9e43d99a6..c8ab04f7c 100644 --- a/gio/gio-tool-monitor.c +++ b/gio/gio-tool-monitor.c @@ -180,7 +180,7 @@ add_watch (const gchar *cmdline, return TRUE; err: - g_printerr ("error: %s: %s", cmdline, error->message); + print_file_error (file, error->message); g_error_free (error); return FALSE; @@ -193,7 +193,6 @@ handle_monitor (int argc, gchar *argv[], gboolean do_help) gchar *param; GError *error = NULL; GFileMonitorFlags flags; - guint total = 0; guint i; g_set_prgname ("gio monitor"); @@ -220,6 +219,12 @@ handle_monitor (int argc, gchar *argv[], gboolean do_help) return 1; } + if (!watch_dirs || !watch_files || !watch_direct || !watch_silent || !watch_default) + { + show_help (context, _("No locations given")); + return 1; + } + g_option_context_free (context); flags = (no_moves ? 0 : G_FILE_MONITOR_WATCH_MOVES) | @@ -230,7 +235,6 @@ handle_monitor (int argc, gchar *argv[], gboolean do_help) for (i = 0; watch_dirs[i]; i++) if (!add_watch (watch_dirs[i], WATCH_DIR, flags, TRUE)) return 1; - total++; } if (watch_files) @@ -238,7 +242,6 @@ handle_monitor (int argc, gchar *argv[], gboolean do_help) for (i = 0; watch_files[i]; i++) if (!add_watch (watch_files[i], WATCH_FILE, flags, TRUE)) return 1; - total++; } if (watch_direct) @@ -246,7 +249,6 @@ handle_monitor (int argc, gchar *argv[], gboolean do_help) for (i = 0; watch_direct[i]; i++) if (!add_watch (watch_direct[i], WATCH_FILE, flags | G_FILE_MONITOR_WATCH_HARD_LINKS, TRUE)) return 1; - total++; } if (watch_silent) @@ -254,7 +256,6 @@ handle_monitor (int argc, gchar *argv[], gboolean do_help) for (i = 0; watch_silent[i]; i++) if (!add_watch (watch_silent[i], WATCH_FILE, flags | G_FILE_MONITOR_WATCH_HARD_LINKS, FALSE)) return 1; - total++; } if (watch_default) @@ -262,13 +263,6 @@ handle_monitor (int argc, gchar *argv[], gboolean do_help) for (i = 0; watch_default[i]; i++) if (!add_watch (watch_default[i], WATCH_AUTO, flags, TRUE)) return 1; - total++; - } - - if (!total) - { - g_printerr ("gio: Must give at least one file to monitor\n"); - return 1; } while (TRUE) |