[gnome-initial-setup] eula: Clean up code



commit ae16b8cc31b2f3ca76f1e7fb0b28f18fea16a0d3
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Dec 14 15:06:15 2012 -0500

    eula: Clean up code
    
    Make splice_buffer return a boolean.

 gnome-initial-setup/pages/eulas/gis-eula-pages.c |    3 +--
 gnome-initial-setup/pages/eulas/utils.c          |    4 +++-
 gnome-initial-setup/pages/eulas/utils.h          |    6 +++---
 3 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/gnome-initial-setup/pages/eulas/gis-eula-pages.c b/gnome-initial-setup/pages/eulas/gis-eula-pages.c
index 2bf31c5..ce390e9 100644
--- a/gnome-initial-setup/pages/eulas/gis-eula-pages.c
+++ b/gnome-initial-setup/pages/eulas/gis-eula-pages.c
@@ -102,8 +102,7 @@ build_eula_text_buffer_plain_text (GFile   *file,
     goto error_out;
 
   buffer = gtk_text_buffer_new (NULL);
-  splice_buffer (input_stream, buffer, &error);
-  if (error != NULL)
+  if (!splice_buffer (input_stream, buffer, &error))
     goto error_out;
 
   /* monospace the text */
diff --git a/gnome-initial-setup/pages/eulas/utils.c b/gnome-initial-setup/pages/eulas/utils.c
index 4987431..4adda59 100644
--- a/gnome-initial-setup/pages/eulas/utils.c
+++ b/gnome-initial-setup/pages/eulas/utils.c
@@ -7,7 +7,7 @@
 #include <pango/pango.h>
 
 /* lifted from g_output_stream_splice */
-void
+gboolean
 splice_buffer (GInputStream  *stream,
                GtkTextBuffer *buffer,
                GError       **error)
@@ -26,6 +26,8 @@ splice_buffer (GInputStream  *stream,
     gtk_text_buffer_get_end_iter (buffer, &iter);
     gtk_text_buffer_insert (buffer, &iter, contents, n_read);
   }
+
+  return (*error == NULL);
 }
 
 /* remove when this is landed in GTK+ itself */
diff --git a/gnome-initial-setup/pages/eulas/utils.h b/gnome-initial-setup/pages/eulas/utils.h
index 4afd080..dba5d2b 100644
--- a/gnome-initial-setup/pages/eulas/utils.h
+++ b/gnome-initial-setup/pages/eulas/utils.h
@@ -7,9 +7,9 @@
 
 G_BEGIN_DECLS
 
-void splice_buffer (GInputStream  *stream,
-                    GtkTextBuffer *buffer,
-                    GError       **error);
+gboolean splice_buffer (GInputStream  *stream,
+                        GtkTextBuffer *buffer,
+                        GError       **error);
 
 void text_buffer_insert_pango_text (GtkTextBuffer *buffer,
                                     GtkTextIter *iter,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]