[gnome-latex/wip/misc] Use tepl_utils_create_parent_directories()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex/wip/misc] Use tepl_utils_create_parent_directories()
- Date: Tue, 31 Mar 2020 09:36:02 +0000 (UTC)
commit 6dac4e5933d96cdf844018875651bdcac01e1d34
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Mar 31 10:57:24 2020 +0200
Use tepl_utils_create_parent_directories()
latexila_utils_create_parent_directories() has been moved to Tepl, and
a GCancellable param has been added.
README | 2 +-
configure.ac | 2 +-
docs/reference/gnome-latex-sections.txt | 1 -
src/glatex_app.vala | 4 +-
src/liblatexila/latexila-build-tools-personal.c | 6 +--
src/liblatexila/latexila-templates-personal.c | 7 ++--
src/liblatexila/latexila-utils.c | 52 +------------------------
src/liblatexila/latexila-utils.h | 3 --
src/utils.vala | 4 +-
9 files changed, 15 insertions(+), 66 deletions(-)
---
diff --git a/README b/README
index bd8ab7e..943c541 100644
--- a/README
+++ b/README
@@ -21,7 +21,7 @@ Dependencies
* GLib >= 2.56
* GTK+ >= 3.22
* GtkSourceView >= 4.0
-* Tepl >= 4.3 - https://wiki.gnome.org/Projects/Tepl
+* Tepl >= 4.5 - https://wiki.gnome.org/Projects/Tepl
* gspell >= 1.8
* gee-0.8 >= 0.10
* gsettings-desktop-schemas
diff --git a/configure.ac b/configure.ac
index 3f4abbf..c3359e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ LT_INIT
GLIB_REQUIRED_VERSION="2.56"
GTK_REQUIRED_VERSION="3.22"
GTKSOURCEVIEW_REQUIRED_VERSION="4.0"
-TEPL_REQUIRED_VERSION="4.3"
+TEPL_REQUIRED_VERSION="4.5"
GSPELL_REQUIRED_VERSION="1.8"
VALA_REQUIRED_VERSION="0.46"
GEE_REQUIRED_VERSION="0.10"
diff --git a/docs/reference/gnome-latex-sections.txt b/docs/reference/gnome-latex-sections.txt
index 15c466f..78dbcf4 100644
--- a/docs/reference/gnome-latex-sections.txt
+++ b/docs/reference/gnome-latex-sections.txt
@@ -269,7 +269,6 @@ LATEXILA_TYPE_TEMPLATES_PERSONAL
<FILE>utils</FILE>
latexila_utils_file_query_exists_async
latexila_utils_file_query_exists_finish
-latexila_utils_create_parent_directories
latexila_utils_show_uri
latexila_utils_get_dialog_component
latexila_utils_join_widgets
diff --git a/src/glatex_app.vala b/src/glatex_app.vala
index 4c956db..d4f426b 100644
--- a/src/glatex_app.vala
+++ b/src/glatex_app.vala
@@ -1,7 +1,7 @@
/*
* This file is part of GNOME LaTeX.
*
- * Copyright © 2010-2015, 2017, 2018 Sébastien Wilmet
+ * Copyright © 2010-2020 Sébastien Wilmet
*
* GNOME LaTeX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -145,7 +145,7 @@ public class GlatexApp : Gtk.Application
File accel_file = File.new_for_path (accel_filename);
try
{
- Latexila.utils_create_parent_directories (accel_file);
+ Tepl.utils_create_parent_directories (accel_file, null);
Gtk.AccelMap.save (accel_filename);
}
catch (Error error)
diff --git a/src/liblatexila/latexila-build-tools-personal.c b/src/liblatexila/latexila-build-tools-personal.c
index 072e197..b58b6a7 100644
--- a/src/liblatexila/latexila-build-tools-personal.c
+++ b/src/liblatexila/latexila-build-tools-personal.c
@@ -1,7 +1,7 @@
/*
* This file is part of GNOME LaTeX.
*
- * Copyright (C) 2014 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2014-2020 - Sébastien Wilmet <swilmet gnome org>
*
* GNOME LaTeX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
*/
#include "latexila-build-tools-personal.h"
-#include <gio/gio.h>
+#include <tepl/tepl.h>
#include "latexila-build-tool.h"
#include "latexila-utils.h"
@@ -184,7 +184,7 @@ latexila_build_tools_personal_save (LatexilaBuildToolsPersonal *build_tools)
xml_file = get_xml_file ();
- latexila_utils_create_parent_directories (xml_file, &error);
+ tepl_utils_create_parent_directories (xml_file, NULL, &error);
if (error == NULL)
{
diff --git a/src/liblatexila/latexila-templates-personal.c b/src/liblatexila/latexila-templates-personal.c
index 6f61dd4..ccf52bc 100644
--- a/src/liblatexila/latexila-templates-personal.c
+++ b/src/liblatexila/latexila-templates-personal.c
@@ -1,7 +1,7 @@
/*
* This file is part of GNOME LaTeX.
*
- * Copyright (C) 2015 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2015-2020 - Sébastien Wilmet <swilmet gnome org>
*
* GNOME LaTeX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@
#include "latexila-templates-personal.h"
#include <string.h>
#include <stdlib.h>
+#include <tepl/tepl.h>
#include "latexila-templates-common.h"
#include "latexila-utils.h"
@@ -365,7 +366,7 @@ save_rc_file (LatexilaTemplatesPersonal *templates,
(const gchar * const *) files,
personal_templates_count);
- if (!latexila_utils_create_parent_directories (rc_file, error))
+ if (!tepl_utils_create_parent_directories (rc_file, NULL, error))
{
ret = FALSE;
goto out;
@@ -484,7 +485,7 @@ latexila_templates_personal_create (LatexilaTemplatesPersonal *templates,
template_file = get_personal_template_file_by_index (template_num);
- if (!latexila_utils_create_parent_directories (template_file, error))
+ if (!tepl_utils_create_parent_directories (template_file, NULL, error))
{
ret = FALSE;
goto out;
diff --git a/src/liblatexila/latexila-utils.c b/src/liblatexila/latexila-utils.c
index bec1866..ebdebfd 100644
--- a/src/liblatexila/latexila-utils.c
+++ b/src/liblatexila/latexila-utils.c
@@ -6,7 +6,7 @@
* Copyright (C) 2000, 2002 - Chema Celorio, Paolo Maggi
* Copyright (C) 2003-2005 - Paolo Maggi
*
- * Copyright (C) 2014, 2015, 2017, 2018 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2014-2020 - Sébastien Wilmet <swilmet gnome org>
*
* GNOME LaTeX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -264,54 +264,6 @@ latexila_utils_get_dialog_component (const gchar *title,
return GTK_WIDGET (grid);
}
-/**
- * latexila_utils_create_parent_directories:
- * @file: a file
- * @error: (out) (optional): a location to a %NULL #GError, or %NULL.
- *
- * Synchronously creates parent directories of @file, so that @file can be
- * saved.
- *
- * Returns: whether the directories are correctly created. %FALSE is returned on
- * error.
- */
-gboolean
-latexila_utils_create_parent_directories (GFile *file,
- GError **error)
-{
- GFile *parent;
- GError *my_error = NULL;
-
- g_return_val_if_fail (G_IS_FILE (file), FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- parent = g_file_get_parent (file);
-
- if (parent == NULL)
- {
- return TRUE;
- }
-
- g_file_make_directory_with_parents (parent, NULL, &my_error);
- g_object_unref (parent);
-
- if (my_error != NULL)
- {
- if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_EXISTS))
- {
- g_error_free (my_error);
- return TRUE;
- }
- else
- {
- g_propagate_error (error, my_error);
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
/**
* latexila_utils_join_widgets:
* @widget_top: the #GtkWidget at the top.
@@ -430,7 +382,7 @@ migrate_latexila_to_gnome_latex_copy_file (GFile *latexila_file,
{
GError *error = NULL;
- latexila_utils_create_parent_directories (glatex_file, &error);
+ tepl_utils_create_parent_directories (glatex_file, NULL, &error);
if (error != NULL)
{
goto out;
diff --git a/src/liblatexila/latexila-utils.h b/src/liblatexila/latexila-utils.h
index d23b9ef..d61320c 100644
--- a/src/liblatexila/latexila-utils.h
+++ b/src/liblatexila/latexila-utils.h
@@ -34,9 +34,6 @@ void latexila_utils_file_query_exists_async (GFile *file,
gboolean latexila_utils_file_query_exists_finish (GFile *file,
GAsyncResult *result);
-gboolean latexila_utils_create_parent_directories (GFile *file,
- GError **error);
-
void latexila_utils_show_uri (GtkWidget *widget,
const gchar *uri,
guint32 timestamp,
diff --git a/src/utils.vala b/src/utils.vala
index 970b85a..c9c1612 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -1,7 +1,7 @@
/*
* This file is part of GNOME LaTeX.
*
- * Copyright © 2010-2012 Sébastien Wilmet
+ * Copyright © 2010-2020 Sébastien Wilmet
*
* GNOME LaTeX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -125,7 +125,7 @@ namespace Utils
{
try
{
- Latexila.utils_create_parent_directories (file);
+ Tepl.utils_create_parent_directories (file, null);
file.replace_contents (contents.data, null, make_backup,
FileCreateFlags.NONE, null);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]