[gnome-shell] extensionSystem: Replace Shell.write_soup_message_to_stream with GBytes usage



commit 96396163cf7f26f836489e49e0955b59c408d91d
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu May 24 12:25:26 2012 -0400

    extensionSystem: Replace Shell.write_soup_message_to_stream with GBytes usage
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676837

 js/ui/extensionSystem.js |    3 ++-
 src/shell-util.c         |   23 -----------------------
 src/shell-util.h         |    4 ----
 3 files changed, 2 insertions(+), 28 deletions(-)
---
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 2d64acd..cf7b39a 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -102,7 +102,8 @@ function gotExtensionZipFile(session, message, uuid) {
 
     let [file, stream] = Gio.File.new_tmp('XXXXXX.shell-extension.zip');
     let dir = ExtensionUtils.userExtensionsDir.get_child(uuid);
-    Shell.write_soup_message_to_stream(stream.output_stream, message);
+    let contents = message.response_body.flatten().as_bytes();
+    stream.output_stream.write_bytes(contents, null);
     stream.close(null);
     let [success, pid] = GLib.spawn_async(null,
                                           ['unzip', '-uod', dir.get_path(), '--', file.get_path()],
diff --git a/src/shell-util.c b/src/shell-util.c
index 0a1baab..bd211f0 100644
--- a/src/shell-util.c
+++ b/src/shell-util.c
@@ -593,29 +593,6 @@ shell_util_get_week_start ()
 }
 
 /**
- * shell_write_soup_message_to_stream:
- * @stream: a #GOutputStream
- * @message: a #SoupMessage
- * @error: location to store GError
- *
- * Write a string to a GOutputStream as binary data. This is a
- * workaround for the lack of proper binary strings in GJS.
- */
-void
-shell_write_soup_message_to_stream (GOutputStream *stream,
-                                    SoupMessage   *message,
-                                    GError       **error)
-{
-  SoupMessageBody *body;
-
-  body = message->response_body;
-
-  g_output_stream_write_all (stream,
-                             body->data, body->length,
-                             NULL, NULL, error);
-}
-
-/**
  * shell_write_string_to_stream:
  * @stream: a #GOutputStream
  * @str: a UTF-8 string to write to @stream
diff --git a/src/shell-util.h b/src/shell-util.h
index 9208099..fbb8a27 100644
--- a/src/shell-util.h
+++ b/src/shell-util.h
@@ -25,10 +25,6 @@ char    *shell_util_normalize_and_casefold     (const char       *str);
 char    *shell_util_format_date                (const char       *format,
                                                 gint64            time_ms);
 
-void     shell_write_soup_message_to_stream    (GOutputStream    *stream,
-                                                SoupMessage      *message,
-                                                GError          **error);
-
 gboolean shell_write_string_to_stream          (GOutputStream    *stream,
                                                 const char       *str,
                                                 GError          **error);



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