[gnome-utils/gnome-2-28] Make sure to return if we have an error or no new lines (#588577).



commit d2c2365ff880459bce7b4c6c6f78c094e1470e37
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 |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/logview/logview-window.c b/logview/logview-window.c
index d5bb3a8..05fe7bc 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,26 @@ 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) {
+    /* no new strings in the primary error message,
+     * as we're string frozen
+     */
+    primary = g_strdup_printf ("\"%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]