alert: move the warning to alerts.
File selector has issues...
This commit is contained in:
parent
e0139c5da9
commit
221fc9dd50
|
@ -394,26 +394,6 @@ _cb_fs_open_done(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
ecrire_editor_open(selected, _ent_cfg->font.name, _ent_cfg->font.size);
|
||||
}
|
||||
|
||||
void
|
||||
ecrire_editor_save(Ecrire_Editor *inst, const char *file)
|
||||
{
|
||||
Eina_Bool ok;
|
||||
|
||||
if (plain_utf8)
|
||||
ok = file_plain_save(file, elm_object_text_get(inst->entry));
|
||||
else
|
||||
ok = file_save(file, elm_object_text_get(inst->entry));
|
||||
|
||||
if (ok)
|
||||
{
|
||||
elm_object_item_disabled_set(inst->menu.save, EINA_TRUE);
|
||||
elm_object_item_disabled_set(inst->toolbar.save, EINA_TRUE);
|
||||
inst->last_saved_stack_ptr = inst->undo_stack_ptr;
|
||||
_update_cur_file(file, inst);
|
||||
}
|
||||
else ERR("couldn't save %s", file);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_fs_ecrire_editor_save(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info)
|
||||
|
@ -425,6 +405,30 @@ _cb_fs_ecrire_editor_save(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
ecrire_editor_save(inst, filename);
|
||||
}
|
||||
|
||||
void
|
||||
ecrire_editor_save(Ecrire_Editor *inst, const char *file)
|
||||
{
|
||||
Eina_Bool ok;
|
||||
|
||||
if (plain_utf8)
|
||||
ok = file_plain_save(file, elm_object_text_get(inst->entry));
|
||||
else
|
||||
ok = file_save(file, elm_object_text_get(inst->entry));
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
ui_alert_warning_popup(inst->win, eina_slstr_printf("Unable to save to %s <br>(%s)", file, strerror(errno)));
|
||||
ui_file_open_save_dialog_open(inst->win, EINA_TRUE, _cb_fs_ecrire_editor_save, inst);
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_object_item_disabled_set(inst->menu.save, EINA_TRUE);
|
||||
elm_object_item_disabled_set(inst->toolbar.save, EINA_TRUE);
|
||||
inst->last_saved_stack_ptr = inst->undo_stack_ptr;
|
||||
_update_cur_file(file, inst);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_open_do(void *data)
|
||||
{
|
||||
|
|
|
@ -79,3 +79,29 @@ ui_alert_need_saving(Evas_Object *entry, void (*done)(void *data), void *data)
|
|||
elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
|
||||
evas_object_show(popup);
|
||||
}
|
||||
|
||||
static void
|
||||
_warning_popup_close_cb(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_del((Evas_Object *) data);
|
||||
}
|
||||
|
||||
void
|
||||
ui_alert_warning_popup(Evas_Object *parent, const char *msg)
|
||||
{
|
||||
Evas_Object *popup, *btn;
|
||||
|
||||
popup = elm_popup_add(parent);
|
||||
elm_object_part_text_set(popup, "title,text", _("Warning"));
|
||||
elm_object_text_set(popup, eina_slstr_printf("<align=center>%s.</>", msg));
|
||||
|
||||
btn = elm_button_add(popup);
|
||||
elm_object_text_set(btn, _("Close"));
|
||||
evas_object_show(btn);
|
||||
evas_object_smart_callback_add(btn, "clicked", _warning_popup_close_cb, popup);
|
||||
elm_object_part_content_set(popup, "button1", btn);
|
||||
|
||||
elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
|
||||
evas_object_show(popup);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,31 +12,6 @@ typedef struct _File_Selector_Data
|
|||
void *data;
|
||||
} File_Selector_Data;
|
||||
|
||||
static void
|
||||
_warning_popup_close_cb(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_del((Evas_Object *) data);
|
||||
}
|
||||
|
||||
static void
|
||||
_warning_popup(Evas_Object *parent, const char *msg)
|
||||
{
|
||||
Evas_Object *popup, *btn;
|
||||
|
||||
popup = elm_popup_add(parent);
|
||||
elm_object_part_text_set(popup, "title,text", _("Warning"));
|
||||
elm_object_text_set(popup, eina_slstr_printf("<align=center>%s.</>", msg));
|
||||
|
||||
btn = elm_button_add(popup);
|
||||
elm_object_text_set(btn, _("Close"));
|
||||
evas_object_show(btn);
|
||||
evas_object_smart_callback_add(btn, "clicked", _warning_popup_close_cb, popup);
|
||||
elm_object_part_content_set(popup, "button1", btn);
|
||||
|
||||
elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
|
||||
evas_object_show(popup);
|
||||
}
|
||||
|
||||
static void
|
||||
_cleaning_cb(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
|
@ -57,7 +32,7 @@ _cleaning_cb(void *data, Evas_Object *obj, void *event_info)
|
|||
}
|
||||
|
||||
if (error)
|
||||
_warning_popup(fsdata->parent, error);
|
||||
ui_alert_warning_popup(fsdata->parent, error);
|
||||
else
|
||||
{
|
||||
if (path)
|
||||
|
|
|
@ -3,12 +3,22 @@
|
|||
|
||||
#include "../Ecrire.h"
|
||||
|
||||
void ui_file_open_save_dialog_open(Evas_Object *parent, Eina_Bool save, Evas_Smart_Cb func, void *data);
|
||||
void
|
||||
ui_file_open_save_dialog_open(Evas_Object *parent, Eina_Bool save, Evas_Smart_Cb func, void *data);
|
||||
|
||||
Evas_Object *ui_find_dialog_open(Evas_Object *parent, Ecrire_Editor *inst);
|
||||
Evas_Object *ui_goto_dialog_open(Evas_Object *parent, Ecrire_Editor *inst);
|
||||
Evas_Object *ui_settings_open(Evas_Object *parent, Ecrire_Editor *inst);
|
||||
Evas_Object *
|
||||
ui_find_dialog_open(Evas_Object *parent, Ecrire_Editor *inst);
|
||||
|
||||
void ui_alert_need_saving(Evas_Object *entry, void (*done)(void *data), void *data);
|
||||
Evas_Object *
|
||||
ui_goto_dialog_open(Evas_Object *parent, Ecrire_Editor *inst);
|
||||
|
||||
Evas_Object *
|
||||
ui_settings_open(Evas_Object *parent, Ecrire_Editor *inst);
|
||||
|
||||
void
|
||||
ui_alert_need_saving(Evas_Object *entry, void (*done)(void *data), void *data);
|
||||
|
||||
void
|
||||
ui_alert_warning_popup(Evas_Object *parent, const char *msg);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue