2008-09-07 00:15:07 -05:00
|
|
|
/*
|
|
|
|
* mooedit-fileops.h
|
|
|
|
*
|
2016-01-01 22:25:53 -08:00
|
|
|
* Copyright (C) 2004-2016 by Yevgen Muntyan <emuntyan@users.sourceforge.net>
|
2008-09-07 00:15:07 -05:00
|
|
|
*
|
|
|
|
* This file is part of medit. medit is free software; you can
|
|
|
|
* redistribute it and/or modify it under the terms of the
|
|
|
|
* GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2.1 of the License,
|
|
|
|
* or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-01-01 22:25:53 -08:00
|
|
|
#pragma once
|
2008-09-07 00:15:07 -05:00
|
|
|
|
|
|
|
#include "mooedit/mooedit.h"
|
2008-09-15 03:59:22 -05:00
|
|
|
#include <gio/gio.h>
|
2008-09-07 00:15:07 -05:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
|
|
|
const char *_moo_get_default_encodings (void);
|
|
|
|
|
|
|
|
typedef enum {
|
2015-07-15 02:22:11 -07:00
|
|
|
MOO_EDIT_SAVE_FLAGS_NONE = 0,
|
2008-09-07 00:15:07 -05:00
|
|
|
MOO_EDIT_SAVE_BACKUP = 1 << 0
|
|
|
|
} MooEditSaveFlags;
|
|
|
|
|
|
|
|
#define MOO_EDIT_FILE_ERROR (_moo_edit_file_error_quark ())
|
2010-12-12 02:29:20 -08:00
|
|
|
|
2008-09-15 03:59:22 -05:00
|
|
|
enum {
|
2010-12-12 02:29:20 -08:00
|
|
|
MOO_EDIT_FILE_ERROR_ENCODING = 1,
|
2008-09-15 03:59:22 -05:00
|
|
|
MOO_EDIT_FILE_ERROR_FAILED,
|
2010-12-12 02:29:20 -08:00
|
|
|
MOO_EDIT_FILE_ERROR_NOT_IMPLEMENTED,
|
2011-01-26 01:09:17 -08:00
|
|
|
MOO_EDIT_FILE_ERROR_NOENT,
|
|
|
|
MOO_EDIT_FILE_ERROR_CANCELLED
|
2008-09-15 03:59:22 -05:00
|
|
|
};
|
2008-09-07 00:15:07 -05:00
|
|
|
|
|
|
|
GQuark _moo_edit_file_error_quark (void) G_GNUC_CONST;
|
|
|
|
|
2011-01-26 01:09:17 -08:00
|
|
|
gboolean _moo_is_file_error_cancelled (GError *error);
|
|
|
|
|
2010-12-12 02:29:20 -08:00
|
|
|
gboolean _moo_edit_file_is_new (GFile *file);
|
2008-09-07 00:15:07 -05:00
|
|
|
gboolean _moo_edit_reload_file (MooEdit *edit,
|
|
|
|
const char *encoding,
|
|
|
|
GError **error);
|
|
|
|
gboolean _moo_edit_save_file (MooEdit *edit,
|
2010-11-23 21:54:39 -08:00
|
|
|
GFile *floc,
|
2008-09-07 00:15:07 -05:00
|
|
|
const char *encoding,
|
|
|
|
MooEditSaveFlags flags,
|
|
|
|
GError **error);
|
|
|
|
gboolean _moo_edit_save_file_copy (MooEdit *edit,
|
2008-09-15 03:59:22 -05:00
|
|
|
GFile *file,
|
2008-09-07 00:15:07 -05:00
|
|
|
const char *encoding,
|
2008-09-14 04:05:58 -05:00
|
|
|
MooEditSaveFlags flags,
|
2008-09-07 00:15:07 -05:00
|
|
|
GError **error);
|
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2015-07-15 02:22:11 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2015-12-29 19:47:55 -08:00
|
|
|
#include "moocpp/utils.h"
|
2016-01-01 22:25:53 -08:00
|
|
|
#include "moocpp/strutils.h"
|
2015-07-15 02:22:11 -07:00
|
|
|
|
|
|
|
MOO_DEFINE_FLAGS(MooEditSaveFlags)
|
|
|
|
|
2016-01-02 07:09:54 -08:00
|
|
|
bool _moo_edit_load_file (MooEdit* edit,
|
|
|
|
const moo::gobjref<GFile>& file,
|
2016-01-03 05:13:00 -08:00
|
|
|
const moo::gstr& init_encoding,
|
|
|
|
const moo::gstr& init_cached_encoding,
|
2016-01-02 07:09:54 -08:00
|
|
|
GError** error);
|
2015-07-15 02:22:11 -07:00
|
|
|
|
2016-01-01 22:25:53 -08:00
|
|
|
#endif // __cplusplus
|