app/file_mgr: open warning box deferred way.
if envnetor opened menu or some other popups, edc modified warning box will be delayed to the editor has focus.
This commit is contained in:
parent
c39f46970c
commit
243d6a1330
|
@ -141,7 +141,6 @@ base_live_view_set(Evas_Object *live_view)
|
|||
void
|
||||
base_console_toggle()
|
||||
{
|
||||
base_data *bd = g_bd;
|
||||
panes_editors_full_view();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
typedef struct file_mgr_s {
|
||||
Evas_Object *enventor;
|
||||
Evas_Object *warning_layout;
|
||||
|
||||
Eina_Bool edc_modified : 1;
|
||||
int edc_modified; //1: edc is opened, 2: edc is changed
|
||||
} file_mgr_data;
|
||||
|
||||
static file_mgr_data *g_fmd = NULL;
|
||||
|
@ -104,6 +103,8 @@ warning_open(file_mgr_data *fmd)
|
|||
elm_object_part_content_set(layout, "elm.swallow.btn3", btn);
|
||||
|
||||
fmd->warning_layout = layout;
|
||||
|
||||
fmd->edc_modified = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -115,20 +116,34 @@ enventor_edc_modified_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
|
||||
if (modified->self_changed)
|
||||
{
|
||||
fmd->edc_modified = EINA_FALSE;
|
||||
fmd->edc_modified = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
//file is opened first time, we don't regard edc is modified, so skip here.
|
||||
if (!fmd->edc_modified)
|
||||
{
|
||||
fmd->edc_modified = EINA_TRUE;
|
||||
return;
|
||||
}
|
||||
fmd->edc_modified++;
|
||||
|
||||
if (fmd->edc_modified == 1) return;
|
||||
|
||||
/* FIXME: Here ignore edc changes, if any menu is closed,
|
||||
then we need to open warning box. */
|
||||
if (menu_activated_get()) return;
|
||||
|
||||
warning_open(fmd);
|
||||
}
|
||||
|
||||
fmd->edc_modified = EINA_FALSE;
|
||||
void
|
||||
file_mgr_reset(void)
|
||||
{
|
||||
file_mgr_data *fmd = g_fmd;
|
||||
fmd->edc_modified = 0;
|
||||
}
|
||||
|
||||
int
|
||||
file_mgr_edc_modified_get(void)
|
||||
{
|
||||
file_mgr_data *fmd = g_fmd;
|
||||
return ((fmd->edc_modified == 2) ? EINA_TRUE : EINA_FALSE);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
|
@ -138,6 +153,13 @@ file_mgr_warning_is_opened(void)
|
|||
return ((fmd && fmd->warning_layout) ? EINA_TRUE : EINA_FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
file_mgr_warning_open(void)
|
||||
{
|
||||
file_mgr_data *fmd = g_fmd;
|
||||
warning_open(fmd);
|
||||
}
|
||||
|
||||
void
|
||||
file_mgr_warning_close(void)
|
||||
{
|
||||
|
|
|
@ -413,6 +413,13 @@ enventor_ctxpopup_selected_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
|||
enventor_object_save(obj, config_edc_path_get());
|
||||
}
|
||||
|
||||
static void
|
||||
enventor_focused_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
if (file_mgr_edc_modified_get()) file_mgr_warning_open();
|
||||
}
|
||||
|
||||
static void
|
||||
enventor_setup(app_data *ad)
|
||||
{
|
||||
|
@ -431,6 +438,8 @@ enventor_setup(app_data *ad)
|
|||
enventor_program_run_cb, ad);
|
||||
evas_object_smart_callback_add(enventor, "ctxpopup,selected",
|
||||
enventor_ctxpopup_selected_cb, ad);
|
||||
evas_object_smart_callback_add(enventor, "focused",
|
||||
enventor_focused_cb, ad);
|
||||
|
||||
enventor_object_font_scale_set(enventor, config_font_scale_get());
|
||||
enventor_object_live_view_scale_set(enventor, config_view_scale_get());
|
||||
|
|
|
@ -446,6 +446,7 @@ fileselector_save_done_cb(void *data, Evas_Object *obj, void *event_info)
|
|||
config_apply();
|
||||
|
||||
base_title_set(selected);
|
||||
file_mgr_reset();
|
||||
fileselector_close(md);
|
||||
menu_close(md);
|
||||
}
|
||||
|
@ -510,6 +511,7 @@ fileselector_load_done_cb(void *data, Evas_Object *obj, void *event_info)
|
|||
base_title_set(selected);
|
||||
fileselector_close(md);
|
||||
menu_close(md);
|
||||
file_mgr_reset();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
#include <Elementary.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||
|
||||
#include <Enventor.h>
|
||||
#include "common.h"
|
||||
|
||||
typedef struct new_data_s {
|
||||
|
@ -45,6 +51,7 @@ newfile_set(Evas_Object *enventor, Eina_Bool template_new)
|
|||
}
|
||||
enventor_object_file_set(enventor, path);
|
||||
base_title_set(path);
|
||||
file_mgr_reset();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue