forked from enlightenment/ecrire
file_utils: important message here.
This commit is contained in:
parent
f9b319e59e
commit
1e57bfa326
|
@ -2,7 +2,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "file_utils.h"
|
||||
#include "mess_header.h"
|
||||
|
||||
static char *
|
||||
|
@ -22,7 +22,7 @@ _buf_append(char *buf, const char *str, int *len, int *alloc)
|
|||
}
|
||||
|
||||
char *
|
||||
_load_file(const char *file)
|
||||
file_load(const char *file)
|
||||
{
|
||||
FILE *f;
|
||||
size_t size;
|
||||
|
@ -44,11 +44,11 @@ _load_file(const char *file)
|
|||
}
|
||||
|
||||
char *
|
||||
_load_plain(const char *file)
|
||||
file_plain_load(const char *file)
|
||||
{
|
||||
char *text;
|
||||
|
||||
text = _load_file(file);
|
||||
text = file_load(file);
|
||||
if (text)
|
||||
{
|
||||
char *text2;
|
||||
|
@ -61,7 +61,7 @@ _load_plain(const char *file)
|
|||
}
|
||||
|
||||
Eina_Bool
|
||||
_save_markup_utf8(const char *file, const char *text)
|
||||
file_save(const char *file, const char *text)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
|
@ -84,14 +84,14 @@ _save_markup_utf8(const char *file, const char *text)
|
|||
}
|
||||
|
||||
Eina_Bool
|
||||
_save_plain_utf8(const char *file, const char *text)
|
||||
file_plain_save(const char *file, const char *text)
|
||||
{
|
||||
char *text2;
|
||||
|
||||
text2 = elm_entry_markup_to_utf8(text);
|
||||
if (!text2)
|
||||
return EINA_FALSE;
|
||||
_save_markup_utf8(file, text2);
|
||||
file_save(file, text2);
|
||||
free(text2);
|
||||
|
||||
return EINA_TRUE;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef FILE_UTILS_H
|
||||
#define FILE_UTILS_H
|
||||
|
||||
#include <Eina.h>
|
||||
|
||||
char *
|
||||
file_plain_load(const char *file);
|
||||
|
||||
char *
|
||||
file_load(const char *file);
|
||||
|
||||
Eina_Bool
|
||||
file_plain_save(const char *file, const char *text);
|
||||
|
||||
Eina_Bool
|
||||
file_save(const char *file, const char *text);
|
||||
|
||||
|
||||
#endif
|
|
@ -3,6 +3,7 @@
|
|||
#include <Elementary.h>
|
||||
|
||||
#include "mess_header.h"
|
||||
#include "file_utils.h"
|
||||
#include "cfg.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
|
@ -341,9 +342,9 @@ _load_to_entry(Ecrire_Entry *ent, const char *file)
|
|||
char *buf;
|
||||
|
||||
if (plain_utf8)
|
||||
buf = _load_plain(file);
|
||||
buf = file_plain_load(file);
|
||||
else
|
||||
buf = _load_file(file);
|
||||
buf = file_load(file);
|
||||
|
||||
elm_object_text_set(ent->entry, "");
|
||||
_init_entry(ent);
|
||||
|
@ -377,9 +378,9 @@ void
|
|||
save_do(const char *file, Ecrire_Entry *ent)
|
||||
{
|
||||
if (plain_utf8)
|
||||
_save_plain_utf8(file, elm_object_text_get(ent->entry));
|
||||
file_plain_save(file, elm_object_text_get(ent->entry));
|
||||
else
|
||||
_save_markup_utf8(file, elm_object_text_get(ent->entry));
|
||||
file_save(file, elm_object_text_get(ent->entry));
|
||||
|
||||
elm_object_item_disabled_set(ent->save_item, EINA_TRUE);
|
||||
ent->last_saved_stack_ptr = ent->undo_stack_ptr;
|
||||
|
|
|
@ -2,6 +2,7 @@ inc = include_directories('.', '../..')
|
|||
executable('ecrire', [
|
||||
'cfg.c', 'cfg.h',
|
||||
'file_utils.c',
|
||||
'file_utils.h',
|
||||
'main.c',
|
||||
'mess_header.h',
|
||||
'ui/alerts.c',
|
||||
|
|
|
@ -29,11 +29,6 @@ struct _Ecrire_Entry {
|
|||
|
||||
typedef struct _Ecrire_Entry Ecrire_Entry;
|
||||
|
||||
char *_load_plain(const char *file);
|
||||
char *_load_file(const char *file);
|
||||
Eina_Bool _save_markup_utf8(const char *file, const char *text);
|
||||
Eina_Bool _save_plain_utf8(const char *file, const char *text);
|
||||
|
||||
void editor_font_choose(Ecrire_Entry *ent, const char *font, int size);
|
||||
void editor_save(Ecrire_Entry *ent, void *callback_func);
|
||||
void save_do(const char *file, Ecrire_Entry *ent);
|
||||
|
|
Loading…
Reference in New Issue