[gnome-latex/wip/tepl-5: 2/2] Use tepl_utils_file_query_exists_async()/finish()



commit b1e82756e49fdbabffd289ca193c6c9af715af38
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Apr 16 12:48:35 2020 +0200

    Use tepl_utils_file_query_exists_async()/finish()

 docs/reference/gnome-latex-sections.txt |  2 --
 src/liblatexila/latexila-build-tool.c   | 10 +++----
 src/liblatexila/latexila-synctex.c      | 20 ++++++-------
 src/liblatexila/latexila-utils.c        | 53 ---------------------------------
 src/liblatexila/latexila-utils.h        |  8 -----
 5 files changed, 15 insertions(+), 78 deletions(-)
---
diff --git a/docs/reference/gnome-latex-sections.txt b/docs/reference/gnome-latex-sections.txt
index 78dbcf4..4506187 100644
--- a/docs/reference/gnome-latex-sections.txt
+++ b/docs/reference/gnome-latex-sections.txt
@@ -267,8 +267,6 @@ LATEXILA_TYPE_TEMPLATES_PERSONAL
 
 <SECTION>
 <FILE>utils</FILE>
-latexila_utils_file_query_exists_async
-latexila_utils_file_query_exists_finish
 latexila_utils_show_uri
 latexila_utils_get_dialog_component
 latexila_utils_join_widgets
diff --git a/src/liblatexila/latexila-build-tool.c b/src/liblatexila/latexila-build-tool.c
index ab3120b..3975b86 100644
--- a/src/liblatexila/latexila-build-tool.c
+++ b/src/liblatexila/latexila-build-tool.c
@@ -530,7 +530,7 @@ query_exists_cb (GFile        *file,
        gchar *uri = NULL;
        GError *error = NULL;
 
-       file_exists = latexila_utils_file_query_exists_finish (file, result);
+       file_exists = tepl_utils_file_query_exists_finish (file, result);
 
        cancellable = g_task_get_cancellable (task);
        if (g_cancellable_is_cancelled (cancellable))
@@ -697,10 +697,10 @@ open_file (GTask *task)
 
        file = g_file_new_for_uri (uri);
 
-       latexila_utils_file_query_exists_async (file,
-                                               g_task_get_cancellable (task),
-                                               (GAsyncReadyCallback) query_exists_cb,
-                                               task);
+       tepl_utils_file_query_exists_async (file,
+                                           g_task_get_cancellable (task),
+                                           (GAsyncReadyCallback) query_exists_cb,
+                                           task);
 
        g_free (filename);
        g_free (filename_for_display);
diff --git a/src/liblatexila/latexila-synctex.c b/src/liblatexila/latexila-synctex.c
index cd56850..a6cef9c 100644
--- a/src/liblatexila/latexila-synctex.c
+++ b/src/liblatexila/latexila-synctex.c
@@ -562,7 +562,7 @@ synctex_file_query_exists_cb (GFile             *synctex_file,
 {
        gboolean synctex_file_exists;
 
-       synctex_file_exists = latexila_utils_file_query_exists_finish (synctex_file, result);
+       synctex_file_exists = tepl_utils_file_query_exists_finish (synctex_file, result);
 
        if (!synctex_file_exists)
        {
@@ -596,7 +596,7 @@ pdf_file_query_exists_cb (GFile             *pdf_file,
        gchar *synctex_uri;
        GFile *synctex_file;
 
-       pdf_file_exists = latexila_utils_file_query_exists_finish (pdf_file, result);
+       pdf_file_exists = tepl_utils_file_query_exists_finish (pdf_file, result);
        g_object_unref (pdf_file);
 
        if (!pdf_file_exists)
@@ -612,10 +612,10 @@ pdf_file_query_exists_cb (GFile             *pdf_file,
        g_free (short_uri);
        g_free (synctex_uri);
 
-       latexila_utils_file_query_exists_async (synctex_file,
-                                               NULL,
-                                               (GAsyncReadyCallback) synctex_file_query_exists_cb,
-                                               data);
+       tepl_utils_file_query_exists_async (synctex_file,
+                                           NULL,
+                                           (GAsyncReadyCallback) synctex_file_query_exists_cb,
+                                           data);
 }
 
 /**
@@ -666,8 +666,8 @@ latexila_synctex_forward_search (LatexilaSynctex *synctex,
 
        pdf_file = g_file_new_for_uri (data->pdf_uri);
 
-       latexila_utils_file_query_exists_async (pdf_file,
-                                               NULL,
-                                               (GAsyncReadyCallback) pdf_file_query_exists_cb,
-                                               data);
+       tepl_utils_file_query_exists_async (pdf_file,
+                                           NULL,
+                                           (GAsyncReadyCallback) pdf_file_query_exists_cb,
+                                           data);
 }
diff --git a/src/liblatexila/latexila-utils.c b/src/liblatexila/latexila-utils.c
index 47751be..7b69ecc 100644
--- a/src/liblatexila/latexila-utils.c
+++ b/src/liblatexila/latexila-utils.c
@@ -91,59 +91,6 @@ latexila_utils_get_pixbuf_from_icon_name (const gchar *icon_name,
        return pixbuf;
 }
 
-/**
- * latexila_utils_file_query_exists_async:
- * @file: a #GFile.
- * @cancellable: a #GCancellable.
- * @callback: the callback to call when the operation is finished.
- * @user_data: the data to pass to the callback function.
- *
- * The asynchronous version of g_file_query_exists(). When the operation is
- * finished, @callback will be called. You can then call
- * latexila_utils_file_query_exists_finish() to get the result of the operation.
- */
-void
-latexila_utils_file_query_exists_async (GFile               *file,
-                                       GCancellable        *cancellable,
-                                       GAsyncReadyCallback  callback,
-                                       gpointer             user_data)
-{
-       g_file_query_info_async (file,
-                                G_FILE_ATTRIBUTE_STANDARD_TYPE,
-                                G_FILE_QUERY_INFO_NONE,
-                                G_PRIORITY_DEFAULT,
-                                cancellable,
-                                callback,
-                                user_data);
-}
-
-/**
- * latexila_utils_file_query_exists_finish:
- * @file: a #GFile.
- * @result: a #GAsyncResult.
- *
- * Finishes the operation started with latexila_utils_file_query_exists_async().
- * There is no output #GError parameter, so you should check if the operation
- * has been cancelled (in which case %FALSE will be returned).
- *
- * Returns: %TRUE if the file exists and the operation hasn't been cancelled,
- * %FALSE otherwise.
- */
-gboolean
-latexila_utils_file_query_exists_finish (GFile        *file,
-                                        GAsyncResult *result)
-{
-       GFileInfo *info = g_file_query_info_finish (file, result, NULL);
-
-       if (info != NULL)
-       {
-               g_object_unref (info);
-               return TRUE;
-       }
-
-       return FALSE;
-}
-
 static gboolean
 default_document_viewer_is_evince (const gchar *uri)
 {
diff --git a/src/liblatexila/latexila-utils.h b/src/liblatexila/latexila-utils.h
index d61320c..552de23 100644
--- a/src/liblatexila/latexila-utils.h
+++ b/src/liblatexila/latexila-utils.h
@@ -26,14 +26,6 @@ G_BEGIN_DECLS
 
 /* File utilities */
 
-void           latexila_utils_file_query_exists_async          (GFile               *file,
-                                                                GCancellable        *cancellable,
-                                                                GAsyncReadyCallback  callback,
-                                                                gpointer             user_data);
-
-gboolean       latexila_utils_file_query_exists_finish         (GFile        *file,
-                                                                GAsyncResult *result);
-
 void           latexila_utils_show_uri                         (GtkWidget    *widget,
                                                                 const gchar  *uri,
                                                                 guint32       timestamp,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]