diff options
author | raveit65 <[email protected]> | 2016-05-07 18:45:20 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2016-05-26 16:15:22 +0200 |
commit | f800ce9e483940f5969bf1b29506f149b4a0511e (patch) | |
tree | 7b62ebba9c95401e7bc53587c87d2e66300d5fac /shell/ev-metadata.c | |
parent | d7836989512d27a12c8300fca843bc97995cf65e (diff) | |
download | atril-f800ce9e483940f5969bf1b29506f149b4a0511e.tar.bz2 atril-f800ce9e483940f5969bf1b29506f149b4a0511e.tar.xz |
shell: Create metadata object even for temp files
Metadata won't be saved in those cases, but default settings will
applied.
https://bugzilla.gnome.org/show_bug.cgi?id=680145
taken from:
https://git.gnome.org/browse/evince/commit/shell/ev-window.c?h=gnome-3-6&id=6d25b93
Diffstat (limited to 'shell/ev-metadata.c')
-rw-r--r-- | shell/ev-metadata.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/shell/ev-metadata.c b/shell/ev-metadata.c index dba8e511..4bf49ae8 100644 --- a/shell/ev-metadata.c +++ b/shell/ev-metadata.c @@ -22,6 +22,7 @@ #include <string.h> #include "ev-metadata.h" +#include "ev-file-helpers.h" struct _EvMetadata { GObject base; @@ -129,9 +130,10 @@ ev_metadata_new (GFile *file) g_return_val_if_fail (G_IS_FILE (file), NULL); metadata = EV_METADATA (g_object_new (EV_TYPE_METADATA, NULL)); - metadata->file = g_object_ref (file); - - ev_metadata_load (metadata); + if (!ev_file_is_temp (file)) { + metadata->file = g_object_ref (file); + ev_metadata_load (metadata); + } return metadata; } @@ -178,6 +180,10 @@ ev_metadata_set_string (EvMetadata *metadata, GFileInfo *info; gchar *gio_key; + g_hash_table_insert (metadata->items, g_strdup (key), g_strdup (value)); + if (!metadata->file) + return TRUE; + info = g_file_info_new (); gio_key = g_strconcat (EV_METADATA_NAMESPACE"::", key, NULL); @@ -190,7 +196,6 @@ ev_metadata_set_string (EvMetadata *metadata, } g_free (gio_key); - g_hash_table_insert (metadata->items, g_strdup (key), g_strdup (value)); g_file_set_attributes_async (metadata->file, info, 0, |