diff options
Diffstat (limited to 'shell/ev-daemon.c')
-rw-r--r-- | shell/ev-daemon.c | 96 |
1 files changed, 1 insertions, 95 deletions
diff --git a/shell/ev-daemon.c b/shell/ev-daemon.c index 0448872e..897b16e7 100644 --- a/shell/ev-daemon.c +++ b/shell/ev-daemon.c @@ -1,4 +1,4 @@ -/* ev-metadata.c +/* ev-daemon.c * this file is part of atril, a mate document viewer * * Copyright (C) 2009 Carlos Garcia Campos <[email protected]> @@ -115,98 +115,6 @@ ev_daemon_maybe_start_killtimer (gpointer data) } static gboolean -convert_metadata (const gchar *metadata) -{ - GFile *file; - char *argv[3]; - gint exit_status; - GFileAttributeInfoList *namespaces; - gboolean supported = FALSE; - GError *error = NULL; - gboolean retval; - - /* If metadata is not supported for a local file - * is likely because and old gvfs version is running. - */ - file = g_file_new_for_path (metadata); - namespaces = g_file_query_writable_namespaces (file, NULL, NULL); - if (namespaces) { - gint i; - - for (i = 0; i < namespaces->n_infos; i++) { - if (strcmp (namespaces->infos[i].name, "metadata") == 0) { - supported = TRUE; - break; - } - } - g_file_attribute_info_list_unref (namespaces); - } - if (!supported) { - g_warning ("GVFS metadata not supported. " - "Atril will run without metadata support.\n"); - g_object_unref (file); - return FALSE; - } - g_object_unref (file); - - argv[0] = g_build_filename (LIBEXECDIR, "atril-convert-metadata", NULL); - argv[1] = (char *) metadata; - argv[2] = NULL; - - retval = g_spawn_sync (NULL /* wd */, argv, NULL /* env */, - 0, NULL, NULL, NULL, NULL, - &exit_status, &error); - g_free (argv[0]); - - if (!retval) { - g_printerr ("Error migrating metadata: %s\n", error->message); - g_error_free (error); - } - - return retval && WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0; -} - -static void -ev_migrate_metadata (void) -{ - gchar *updated; - gchar *metadata; - gchar *dot_dir; - const gchar *userdir; - - userdir = g_getenv ("MATE22_USER_DIR"); - if (userdir) { - dot_dir = g_build_filename (userdir, "atril", NULL); - } else { - dot_dir = g_build_filename(g_get_user_config_dir(), "atril", NULL); - } - - updated = g_build_filename (dot_dir, "migrated-to-gvfs", NULL); - if (g_file_test (updated, G_FILE_TEST_EXISTS)) { - /* Already migrated */ - g_free (updated); - g_free (dot_dir); - return; - } - - metadata = g_build_filename (dot_dir, "ev-metadata.xml", NULL); - if (g_file_test (metadata, G_FILE_TEST_EXISTS)) { - if (convert_metadata (metadata)) { - gint fd; - - fd = g_creat (updated, 0600); - if (fd != -1) { - close (fd); - } - } - } - - g_free (dot_dir); - g_free (updated); - g_free (metadata); -} - -static gboolean spawn_atril (const gchar *uri) { gchar *argv[3]; @@ -492,8 +400,6 @@ name_acquired_cb (GDBusConnection *connection, const gchar *name, gpointer user_data) { - ev_migrate_metadata (); - ev_daemon_maybe_start_killtimer (user_data); } |