Made most symbols from mooutils-fs.h private

master
Yevgen Muntyan 2006-08-01 20:28:28 -05:00
parent 71d64d8245
commit 1685fa66b1
11 changed files with 70 additions and 70 deletions

View File

@ -660,7 +660,7 @@ moo_app_create_user_data_dir (MooApp *app)
if (g_file_test (dir, G_FILE_TEST_IS_DIR)) if (g_file_test (dir, G_FILE_TEST_IS_DIR))
return dir; return dir;
if (!moo_mkdir (dir, &error)) if (!_moo_mkdir (dir, &error))
{ {
g_warning ("%s: %s", G_STRLOC, error->message); g_warning ("%s: %s", G_STRLOC, error->message);
g_error_free (error); g_error_free (error);
@ -692,7 +692,7 @@ moo_app_python_execute_file (G_GNUC_UNUSED GtkWindow *parent_window)
if (!filename) if (!filename)
return; return;
file = m_fopen (filename, "r"); file = _m_fopen (filename, "r");
if (!file) if (!file)
{ {
@ -724,7 +724,7 @@ moo_app_python_run_file (MooApp *app,
g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (moo_python_running (), FALSE); g_return_val_if_fail (moo_python_running (), FALSE);
file = m_fopen (filename, "r"); file = _m_fopen (filename, "r");
g_return_val_if_fail (file != NULL, FALSE); g_return_val_if_fail (file != NULL, FALSE);
res = moo_python_run_file (file, filename); res = moo_python_run_file (file, filename);
@ -1126,7 +1126,7 @@ moo_app_quit_real (MooApp *app)
if (app->priv->tmpdir) if (app->priv->tmpdir)
{ {
GError *error = NULL; GError *error = NULL;
moo_rmdir (app->priv->tmpdir, TRUE, &error); _moo_rmdir (app->priv->tmpdir, TRUE, &error);
if (error) if (error)
{ {
@ -1613,7 +1613,7 @@ moo_app_tempnam (MooApp *app)
dirname = g_build_filename (g_get_tmp_dir (), basename, NULL); dirname = g_build_filename (g_get_tmp_dir (), basename, NULL);
g_free (basename); g_free (basename);
if (m_mkdir (dirname)) if (_m_mkdir (dirname))
{ {
g_free (dirname); g_free (dirname);
dirname = NULL; dirname = NULL;

View File

@ -843,7 +843,7 @@ window_list_find_file (MooEditor *editor,
MooEdit *edit; MooEdit *edit;
} data; } data;
data.filename = moo_normalize_file_path (filename); data.filename = _moo_normalize_file_path (filename);
data.edit = NULL; data.edit = NULL;
link = g_slist_find_custom (editor->priv->windows, &data, link = g_slist_find_custom (editor->priv->windows, &data,
(GCompareFunc) filename_and_doc_cmp); (GCompareFunc) filename_and_doc_cmp);
@ -1088,7 +1088,7 @@ moo_editor_open (MooEditor *editor,
MooEdit *doc = NULL; MooEdit *doc = NULL;
char *filename; char *filename;
filename = moo_normalize_file_path (info->filename); filename = _moo_normalize_file_path (info->filename);
if (window_list_find_file (editor, filename, &bring_to_front)) if (window_list_find_file (editor, filename, &bring_to_front))
{ {
@ -1672,7 +1672,7 @@ moo_editor_open_file_line (MooEditor *editor,
return doc; return doc;
} }
freeme = moo_normalize_file_path (filename); freeme = _moo_normalize_file_path (filename);
filename = freeme; filename = freeme;
if (!g_file_test (filename, G_FILE_TEST_EXISTS)) if (!g_file_test (filename, G_FILE_TEST_EXISTS))
@ -1714,7 +1714,7 @@ moo_editor_new_file (MooEditor *editor,
return moo_editor_open_file (editor, window, parent, return moo_editor_open_file (editor, window, parent,
filename, encoding); filename, encoding);
freeme = moo_normalize_file_path (filename); freeme = _moo_normalize_file_path (filename);
filename = freeme; filename = freeme;
if (!window) if (!window)

View File

@ -1139,7 +1139,7 @@ _as_plugin_save_config (MooConfig *config,
if (is_default) if (is_default)
result = moo_save_user_data_file (AS_FILE, string, -1, error); result = moo_save_user_data_file (AS_FILE, string, -1, error);
else else
result = moo_save_file_utf8 (file, string, -1, error); result = _moo_save_file_utf8 (file, string, -1, error);
g_free (string); g_free (string);
return result; return result;

View File

@ -975,7 +975,7 @@ doc_move (MooFileSelector *filesel,
{ {
if (moo_edit_save_as (doc, filename, moo_edit_get_encoding (doc), NULL)) if (moo_edit_save_as (doc, filename, moo_edit_get_encoding (doc), NULL))
{ {
m_unlink (old_filename); _m_unlink (old_filename);
select_file (filesel, filename, destdir); select_file (filesel, filename, destdir);
} }

View File

@ -455,7 +455,7 @@ create_folder (G_GNUC_UNUSED MooFileSystem *fs,
{ {
int saved_errno = errno; int saved_errno = errno;
g_set_error (error, MOO_FILE_ERROR, g_set_error (error, MOO_FILE_ERROR,
moo_file_error_from_errno (saved_errno), _moo_file_error_from_errno (saved_errno),
"%s", g_strerror (saved_errno)); "%s", g_strerror (saved_errno));
return FALSE; return FALSE;
} }
@ -594,14 +594,14 @@ delete_file (G_GNUC_UNUSED MooFileSystem *fs,
isdir = g_file_test (path, G_FILE_TEST_IS_DIR); isdir = g_file_test (path, G_FILE_TEST_IS_DIR);
if (isdir) if (isdir)
return moo_rmdir (path, recursive, error); return _moo_rmdir (path, recursive, error);
if (m_remove (path)) if (_m_remove (path))
{ {
int err = errno; int err = errno;
char *path_utf8 = g_filename_to_utf8 (path, -1, NULL, NULL, NULL); char *path_utf8 = g_filename_to_utf8 (path, -1, NULL, NULL, NULL);
g_set_error (error, MOO_FILE_ERROR, g_set_error (error, MOO_FILE_ERROR,
moo_file_error_from_errno (err), _moo_file_error_from_errno (err),
"Could not delete file '%s': %s", "Could not delete file '%s': %s",
path_utf8 ? path_utf8 : BROKEN_NAME, path_utf8 ? path_utf8 : BROKEN_NAME,
g_strerror (err)); g_strerror (err));
@ -637,11 +637,11 @@ move_file_unix (G_GNUC_UNUSED MooFileSystem *fs,
g_return_val_if_fail (g_path_is_absolute (new_path), FALSE); g_return_val_if_fail (g_path_is_absolute (new_path), FALSE);
/* XXX */ /* XXX */
if (m_rename (old_path, new_path)) if (_m_rename (old_path, new_path))
{ {
int saved_errno = errno; int saved_errno = errno;
g_set_error (error, MOO_FILE_ERROR, g_set_error (error, MOO_FILE_ERROR,
moo_file_error_from_errno (saved_errno), _moo_file_error_from_errno (saved_errno),
"%s", g_strerror (saved_errno)); "%s", g_strerror (saved_errno));
return FALSE; return FALSE;
} }

View File

@ -5715,7 +5715,7 @@ moo_file_view_drop_text (G_GNUC_UNUSED MooFileView *fileview,
goto out; goto out;
} }
if (!moo_save_file_utf8 (name, text, -1, &error)) if (!_moo_save_file_utf8 (name, text, -1, &error))
{ {
char *utf8_name = g_filename_display_name (name); char *utf8_name = g_filename_display_name (name);
char *err_text = g_strdup_printf ("Could not save file\n%s", utf8_name); char *err_text = g_strdup_printf ("Could not save file\n%s", utf8_name);

View File

@ -995,7 +995,7 @@ moo_markup_save (MooMarkupDoc *doc,
text = moo_markup_node_get_string (MOO_MARKUP_NODE (doc)); text = moo_markup_node_get_string (MOO_MARKUP_NODE (doc));
g_return_val_if_fail (text != NULL, FALSE); g_return_val_if_fail (text != NULL, FALSE);
result = moo_save_file_utf8 (filename, text, -1, error); result = _moo_save_file_utf8 (filename, text, -1, error);
g_free (text); g_free (text);
return result; return result;
} }
@ -1096,7 +1096,7 @@ moo_markup_save_pretty (MooMarkupDoc *doc,
if (MOO_MARKUP_IS_ELEMENT (child)) if (MOO_MARKUP_IS_ELEMENT (child))
format_pretty_element (MOO_MARKUP_ELEMENT (child), str, 0, indent); format_pretty_element (MOO_MARKUP_ELEMENT (child), str, 0, indent);
result = moo_save_file_utf8 (filename, str->str, -1, error); result = _moo_save_file_utf8 (filename, str->str, -1, error);
g_string_free (str, TRUE); g_string_free (str, TRUE);
return result; return result;
} }

View File

@ -1059,7 +1059,7 @@ moo_prefs_save (const char *file,
if (empty) if (empty)
{ {
if (g_file_test (file, G_FILE_TEST_EXISTS)) if (g_file_test (file, G_FILE_TEST_EXISTS))
if (m_unlink (file)) if (_m_unlink (file))
g_critical ("%s: %s", G_STRLOC, g_critical ("%s: %s", G_STRLOC,
g_strerror (errno)); g_strerror (errno));
return TRUE; return TRUE;

View File

@ -43,10 +43,10 @@
/* XXX fix this */ /* XXX fix this */
gboolean gboolean
moo_save_file_utf8 (const char *name, _moo_save_file_utf8 (const char *name,
const char *text, const char *text,
gssize len, gssize len,
GError **error) GError **error)
{ {
GIOChannel *file; GIOChannel *file;
GIOStatus status; GIOStatus status;
@ -150,7 +150,7 @@ rm_r (const char *path,
errno = 0; errno = 0;
if (m_remove (file_path)) if (_m_remove (file_path))
{ {
int err = errno; int err = errno;
@ -165,7 +165,7 @@ rm_r (const char *path,
default: default:
success = FALSE; success = FALSE;
g_set_error (error, MOO_FILE_ERROR, g_set_error (error, MOO_FILE_ERROR,
moo_file_error_from_errno (err), _moo_file_error_from_errno (err),
"Could not remove '%s': %s", file_path, "Could not remove '%s': %s", file_path,
g_strerror (err)); g_strerror (err));
} }
@ -180,12 +180,12 @@ rm_r (const char *path,
{ {
errno = 0; errno = 0;
if (m_remove (path) != 0) if (_m_remove (path) != 0)
{ {
int err = errno; int err = errno;
success = FALSE; success = FALSE;
g_set_error (error, MOO_FILE_ERROR, g_set_error (error, MOO_FILE_ERROR,
moo_file_error_from_errno (err), _moo_file_error_from_errno (err),
"Could not remove '%s': %s", path, "Could not remove '%s': %s", path,
g_strerror (err)); g_strerror (err));
} }
@ -197,9 +197,9 @@ rm_r (const char *path,
gboolean gboolean
moo_rmdir (const char *path, _moo_rmdir (const char *path,
gboolean recursive, gboolean recursive,
GError **error) GError **error)
{ {
g_return_val_if_fail (path != NULL, FALSE); g_return_val_if_fail (path != NULL, FALSE);
@ -207,12 +207,12 @@ moo_rmdir (const char *path,
{ {
errno = 0; errno = 0;
if (m_rmdir (path) != 0) if (_m_rmdir (path) != 0)
{ {
int err = errno; int err = errno;
char *path_utf8 = g_filename_to_utf8 (path, -1, NULL, NULL, NULL); char *path_utf8 = g_filename_to_utf8 (path, -1, NULL, NULL, NULL);
g_set_error (error, MOO_FILE_ERROR, g_set_error (error, MOO_FILE_ERROR,
moo_file_error_from_errno (err), _moo_file_error_from_errno (err),
"Could not remove '%s': %s", "Could not remove '%s': %s",
path_utf8 ? path_utf8 : BROKEN_NAME, path_utf8 ? path_utf8 : BROKEN_NAME,
g_strerror (err)); g_strerror (err));
@ -234,8 +234,8 @@ moo_rmdir (const char *path,
gboolean gboolean
moo_mkdir (const char *path, _moo_mkdir (const char *path,
GError **error) GError **error)
{ {
struct stat buf; struct stat buf;
char *utf8_path; char *utf8_path;
@ -251,7 +251,7 @@ moo_mkdir (const char *path,
g_set_error (error, g_set_error (error,
MOO_FILE_ERROR, MOO_FILE_ERROR,
moo_file_error_from_errno (err_code), _moo_file_error_from_errno (err_code),
"Could not create directory '%s': %s", "Could not create directory '%s': %s",
utf8_path ? utf8_path : BROKEN_NAME, utf8_path ? utf8_path : BROKEN_NAME,
g_strerror (err_code)); g_strerror (err_code));
@ -264,14 +264,14 @@ moo_mkdir (const char *path,
{ {
errno = 0; errno = 0;
if (m_mkdir (path) == -1) if (_m_mkdir (path) == -1)
{ {
int err_code = errno; int err_code = errno;
utf8_path = g_filename_to_utf8 (path, -1, NULL, NULL, NULL); utf8_path = g_filename_to_utf8 (path, -1, NULL, NULL, NULL);
g_set_error (error, g_set_error (error,
MOO_FILE_ERROR, MOO_FILE_ERROR,
moo_file_error_from_errno (err_code), _moo_file_error_from_errno (err_code),
"Could not create directory '%s': %s", "Could not create directory '%s': %s",
utf8_path ? utf8_path : BROKEN_NAME, utf8_path ? utf8_path : BROKEN_NAME,
g_strerror (err_code)); g_strerror (err_code));
@ -299,7 +299,7 @@ moo_mkdir (const char *path,
GQuark GQuark
moo_file_error_quark (void) _moo_file_error_quark (void)
{ {
static GQuark quark = 0; static GQuark quark = 0;
@ -311,7 +311,7 @@ moo_file_error_quark (void)
MooFileError MooFileError
moo_file_error_from_errno (int code) _moo_file_error_from_errno (int code)
{ {
switch (code) switch (code)
{ {
@ -376,7 +376,7 @@ moo_filename_from_locale (const char *file)
char * char *
moo_normalize_file_path (const char *filename) _moo_normalize_file_path (const char *filename)
{ {
char *freeme = NULL; char *freeme = NULL;
char *working_dir, *basename, *dirname; char *working_dir, *basename, *dirname;
@ -399,7 +399,7 @@ moo_normalize_file_path (const char *filename)
errno = 0; errno = 0;
if (m_chdir (dirname) != 0) if (_m_chdir (dirname) != 0)
{ {
int err = errno; int err = errno;
g_warning ("%s: %s", G_STRLOC, g_strerror (err)); g_warning ("%s: %s", G_STRLOC, g_strerror (err));
@ -412,7 +412,7 @@ moo_normalize_file_path (const char *filename)
errno = 0; errno = 0;
if (m_chdir (working_dir) != 0) if (_m_chdir (working_dir) != 0)
{ {
int err = errno; int err = errno;
g_warning ("%s: %s", G_STRLOC, g_strerror (err)); g_warning ("%s: %s", G_STRLOC, g_strerror (err));
@ -486,7 +486,7 @@ G_STMT_START { \
int int
m_unlink (const char *path) _m_unlink (const char *path)
{ {
#ifdef __WIN32__ #ifdef __WIN32__
CCALL_1 (unlink, _wunlink, path); CCALL_1 (unlink, _wunlink, path);
@ -497,7 +497,7 @@ m_unlink (const char *path)
int int
m_rmdir (const char *path) _m_rmdir (const char *path)
{ {
#ifdef __WIN32__ #ifdef __WIN32__
CCALL_1 (rmdir, _wrmdir, path); CCALL_1 (rmdir, _wrmdir, path);
@ -508,7 +508,7 @@ m_rmdir (const char *path)
int int
m_chdir (const char *path) _m_chdir (const char *path)
{ {
#ifdef __WIN32__ #ifdef __WIN32__
CCALL_1 (_chdir, _wchdir, path); CCALL_1 (_chdir, _wchdir, path);
@ -519,7 +519,7 @@ m_chdir (const char *path)
int int
m_mkdir (const char *path) _m_mkdir (const char *path)
{ {
#ifdef __WIN32__ #ifdef __WIN32__
CCALL_1 (mkdir, _wmkdir, path); CCALL_1 (mkdir, _wmkdir, path);
@ -530,7 +530,7 @@ m_mkdir (const char *path)
int int
m_remove (const char *path) _m_remove (const char *path)
{ {
#ifdef __WIN32__ #ifdef __WIN32__
gboolean use_wide_char_api; gboolean use_wide_char_api;
@ -573,8 +573,8 @@ m_remove (const char *path)
gpointer gpointer
m_fopen (const char *path, _m_fopen (const char *path,
const char *mode) const char *mode)
{ {
#ifdef __WIN32__ #ifdef __WIN32__
gboolean use_wide_char_api; gboolean use_wide_char_api;
@ -623,8 +623,8 @@ m_fopen (const char *path,
int int
m_rename (const char *old_name, _m_rename (const char *old_name,
const char *new_name) const char *new_name)
{ {
#ifdef __WIN32__ #ifdef __WIN32__
gboolean use_wide_char_api; gboolean use_wide_char_api;

View File

@ -28,7 +28,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define MOO_FILE_ERROR (moo_file_error_quark ()) #define MOO_FILE_ERROR (_moo_file_error_quark ())
typedef enum typedef enum
{ {
@ -43,37 +43,37 @@ typedef enum
MOO_FILE_ERROR_NOT_IMPLEMENTED MOO_FILE_ERROR_NOT_IMPLEMENTED
} MooFileError; } MooFileError;
GQuark moo_file_error_quark (void) G_GNUC_CONST; GQuark _moo_file_error_quark (void) G_GNUC_CONST;
MooFileError moo_file_error_from_errno (int err_code); MooFileError _moo_file_error_from_errno (int err_code);
gboolean moo_save_file_utf8 (const char *name, gboolean _moo_save_file_utf8 (const char *name,
const char *text, const char *text,
gssize len, gssize len,
GError **error); GError **error);
gboolean moo_rmdir (const char *path, gboolean _moo_rmdir (const char *path,
gboolean recursive, gboolean recursive,
GError **error); GError **error);
gboolean moo_mkdir (const char *path, gboolean _moo_mkdir (const char *path,
GError **error); GError **error);
char **moo_filenames_from_locale (char **files); char **moo_filenames_from_locale (char **files);
char *moo_filename_from_locale (const char *file); char *moo_filename_from_locale (const char *file);
char *moo_normalize_file_path (const char *filename); char *_moo_normalize_file_path (const char *filename);
/* /*
* C library and WinAPI functions wrappers analogous to glib/gstdio.h * C library and WinAPI functions wrappers analogous to glib/gstdio.h
*/ */
int m_unlink (const char *path); int _m_unlink (const char *path);
int m_mkdir (const char *path); /* S_IRWXU on unix */ int _m_mkdir (const char *path); /* S_IRWXU on unix */
int m_rmdir (const char *path); int _m_rmdir (const char *path);
int m_remove (const char *path); int _m_remove (const char *path);
gpointer m_fopen (const char *path, gpointer _m_fopen (const char *path,
const char *mode); const char *mode);
int m_rename (const char *old_name, int _m_rename (const char *old_name,
const char *new_name); const char *new_name);
int m_chdir (const char *path); int _m_chdir (const char *path);
G_END_DECLS G_END_DECLS

View File

@ -1242,7 +1242,7 @@ moo_make_user_data_dir (void)
if (!g_file_test (dir, G_FILE_TEST_IS_DIR)) if (!g_file_test (dir, G_FILE_TEST_IS_DIR))
{ {
result = m_mkdir (dir); result = _m_mkdir (dir);
if (result) if (result)
{ {
@ -1428,10 +1428,10 @@ moo_save_user_data_file (const char *basename,
file = moo_get_user_data_file (basename); file = moo_get_user_data_file (basename);
g_return_val_if_fail (dir && file, FALSE); g_return_val_if_fail (dir && file, FALSE);
if (!moo_mkdir (dir, error)) if (!_moo_mkdir (dir, error))
goto out; goto out;
if (!moo_save_file_utf8 (file, content, len, error)) if (!_moo_save_file_utf8 (file, content, len, error))
goto out; goto out;
result = TRUE; result = TRUE;