[gtksourceview/wip/loader-saver-2] FileSaver: get the GtkSourceFile's location if NULL
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/loader-saver-2] FileSaver: get the GtkSourceFile's location if NULL
- Date: Tue, 8 Jul 2014 15:21:41 +0000 (UTC)
commit c7627234748ef6a360358f1970345aab99a4cb4e
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Jul 8 17:18:35 2014 +0200
FileSaver: get the GtkSourceFile's location if NULL
gtksourceview/gtksourcefilesaver.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourcefilesaver.c b/gtksourceview/gtksourcefilesaver.c
index 115ea7d..aee9cb2 100644
--- a/gtksourceview/gtksourcefilesaver.c
+++ b/gtksourceview/gtksourcefilesaver.c
@@ -289,6 +289,20 @@ gtk_source_file_saver_constructed (GObject *object)
compression_type = gtk_source_file_get_compression_type (saver->priv->file);
gtk_source_file_saver_set_compression_type (saver, compression_type);
+
+ if (saver->priv->location == NULL)
+ {
+ saver->priv->location = gtk_source_file_get_location (saver->priv->file);
+
+ if (saver->priv->location != NULL)
+ {
+ g_object_ref (saver->priv->location);
+ }
+ else
+ {
+ g_warning ("FileSaver: GtkSourceFile's location is NULL.");
+ }
+ }
}
G_OBJECT_CLASS (gtk_source_file_saver_parent_class)->constructed (object);
@@ -992,7 +1006,7 @@ gtk_source_file_saver_new (GtkSourceBuffer *buffer,
{
g_return_val_if_fail (GTK_SOURCE_IS_BUFFER (buffer), NULL);
g_return_val_if_fail (GTK_SOURCE_IS_FILE (file), NULL);
- g_return_val_if_fail (G_IS_FILE (location), NULL);
+ g_return_val_if_fail (location == NULL || G_IS_FILE (location), NULL);
return g_object_new (GTK_SOURCE_TYPE_FILE_SAVER,
"buffer", buffer,
@@ -1247,7 +1261,8 @@ gtk_source_file_saver_save_async (GtkSourceFileSaver *saver,
g_return_if_fail (saver->priv->task == NULL);
if (saver->priv->source_buffer == NULL ||
- saver->priv->file == NULL)
+ saver->priv->file == NULL ||
+ saver->priv->location == NULL)
{
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]