118
convert_metadata (const gchar *metadata)
123
GFileAttributeInfoList *namespaces;
124
gboolean supported = FALSE;
125
GError *error = NULL;
128
/* If metadata is not supported for a local file
129
* is likely because and old gvfs version is running.
131
file = g_file_new_for_path (metadata);
132
namespaces = g_file_query_writable_namespaces (file, NULL, NULL);
136
for (i = 0; i < namespaces->n_infos; i++) {
137
if (strcmp (namespaces->infos[i].name, "metadata") == 0) {
142
g_file_attribute_info_list_unref (namespaces);
145
g_warning ("GVFS metadata not supported. "
146
"Evince will run without metadata support.\n");
147
g_object_unref (file);
150
g_object_unref (file);
152
argv[0] = g_build_filename (LIBEXECDIR, "evince-convert-metadata", NULL);
153
argv[1] = (char *) metadata;
156
retval = g_spawn_sync (NULL /* wd */, argv, NULL /* env */,
157
0, NULL, NULL, NULL, NULL,
158
&exit_status, &error);
162
g_printerr ("Error migrating metadata: %s\n", error->message);
163
g_error_free (error);
166
return retval && WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0;
170
ev_migrate_metadata (void)
175
const gchar *userdir;
177
userdir = g_getenv ("GNOME22_USER_DIR");
179
dot_dir = g_build_filename (userdir, "evince", NULL);
181
dot_dir = g_build_filename (g_get_home_dir (),
187
updated = g_build_filename (dot_dir, "migrated-to-gvfs", NULL);
188
if (g_file_test (updated, G_FILE_TEST_EXISTS)) {
189
/* Already migrated */
195
metadata = g_build_filename (dot_dir, "ev-metadata.xml", NULL);
196
if (g_file_test (metadata, G_FILE_TEST_EXISTS)) {
197
if (convert_metadata (metadata)) {
200
fd = g_creat (updated, 0600);
213
118
spawn_evince (const gchar *uri)