[gnome-utils] Make sure to return if we have an error or no new lines (#588577).
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-utils] Make sure to return if we have an error or no new lines (#588577).
- Date: Tue, 20 Oct 2009 23:57:03 +0000 (UTC)
commit 93fb3a603eca412df6a5cb73deb964b329321ddf
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Oct 21 01:55:51 2009 +0200
Make sure to return if we have an error or no new lines (#588577).
logview/logview-window.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/logview/logview-window.c b/logview/logview-window.c
index d5bb3a8..ed21af1 100644
--- a/logview/logview-window.c
+++ b/logview/logview-window.c
@@ -82,7 +82,7 @@ static void findbar_close_cb (LogviewFindbar *findbar,
static void read_new_lines_cb (LogviewLog *log,
const char **lines,
GSList *new_days,
- GError **error,
+ GError *error,
gpointer user_data);
/* private functions */
@@ -998,7 +998,7 @@ static void
read_new_lines_cb (LogviewLog *log,
const char **lines,
GSList *new_days,
- GError **error,
+ GError *error,
gpointer user_data)
{
LogviewWindow *window = user_data;
@@ -1007,9 +1007,23 @@ read_new_lines_cb (LogviewLog *log,
int i, old_line_count, filter_start_line;
GtkTextIter iter, start;
GtkTextMark *mark;
- char *converted;
+ char *converted, *primary;
gsize len;
+ if (error != NULL) {
+ primary = g_strdup_printf (_("Can't read from \"%s\""),
+ logview_log_get_display_name (log));
+ logview_window_add_error (window, primary, error->message);
+ g_free (primary);
+
+ return;
+ }
+
+ if (lines == NULL) {
+ /* there's no error, but no lines have been read */
+ return;
+ }
+
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (window->priv->text_view));
old_line_count = gtk_text_buffer_get_line_count (buffer);
filter_start_line = old_line_count > 0 ? (old_line_count - 1) : 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]