[gtk/wip/ottie/print: 2/2] fantastic: Implement saving
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/ottie/print: 2/2] fantastic: Implement saving
- Date: Mon, 28 Dec 2020 03:31:01 +0000 (UTC)
commit e96b69647ae86b10663bf2811141305cd970ffa9
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Dec 27 18:48:38 2020 -0500
fantastic: Implement saving
Use ottie_creation_to_bytes to save the current
creation to a file. Currently, this is not very
interesting, since there is no way to modify a
loaded creation.
ottie/fantastic/fantasticwindow.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/ottie/fantastic/fantasticwindow.c b/ottie/fantastic/fantasticwindow.c
index 68690b93b0..c579811e91 100644
--- a/ottie/fantastic/fantasticwindow.c
+++ b/ottie/fantastic/fantasticwindow.c
@@ -172,23 +172,23 @@ save_response_cb (GtkWidget *dialog,
if (response == GTK_RESPONSE_ACCEPT)
{
-#if 0
GFile *file;
- char *text;
-#endif
+ GBytes *bytes;
+ const char *text;
+ gsize length;
+
GError *error = NULL;
-#if 0
- text = get_current_text (self->text_buffer);
+ bytes = ottie_creation_to_bytes (self->creation);
+ text = g_bytes_get_data (bytes, &length);
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
- g_file_replace_contents (file, text, strlen (text),
+ g_file_replace_contents (file, text, length,
NULL, FALSE,
G_FILE_CREATE_NONE,
NULL,
NULL,
&error);
-#endif
if (error != NULL)
{
@@ -206,10 +206,8 @@ save_response_cb (GtkWidget *dialog,
g_error_free (error);
}
-#if 0
- g_free (text);
+ g_bytes_unref (bytes);
g_object_unref (file);
-#endif
}
gtk_window_destroy (GTK_WINDOW (dialog));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]