fix some buglets

SVN revision: 25412
This commit is contained in:
Carsten Haitzler 2006-09-03 15:11:04 +00:00
parent d3e842122b
commit cdb0a473d3
4 changed files with 171 additions and 99 deletions

2
TODO
View File

@ -8,8 +8,6 @@ Some of the things (in very short form) that need to be done to E17...
BUGS / FIXES
-------------------------------------------------------------------------------
* BUG: right click remove icon from ibar deletes the original file - not the
ibar link to it in .order
* BUG: "add aplication" in applicatiosn dialog shoudl be disabled if no
app is selected in the fm view above it
* BUG: "create new application" from "applications main config dialog when

View File

@ -3,22 +3,6 @@
*/
#include "e.h"
typedef struct _E_App_Edit E_App_Edit;
struct _E_App_Edit
{
E_App *eap;
Evas *evas;
Evas_Object *img;
Evas_Object *img_widget;
Evas_Object *fsel;
E_Dialog *fsel_dia;
int img_set;
E_Config_Dialog *cfd;
};
struct _E_Config_Dialog_Data
{
E_App eap;
@ -46,6 +30,7 @@ struct _E_Config_Dialog_Data
/* local subsystem functions */
static void _e_eap_edit_free(E_App_Edit *editor);
static void _e_eap_edit_fill_data(E_Config_Dialog_Data *cdfata);
static void *_e_eap_edit_create_data(E_Config_Dialog *cfd);
static void _e_eap_edit_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *data);
@ -64,7 +49,7 @@ static void _e_eap_edit_cb_icon_select_cancel(void *data, E_Dialog *di
/* externally accessible functions */
EAPI void
EAPI E_App_Edit *
e_eap_edit_show(E_Container *con, E_App *a)
{
E_Config_Dialog_View *v;
@ -72,13 +57,13 @@ e_eap_edit_show(E_Container *con, E_App *a)
if (!con) return;
editor = E_NEW(E_App_Edit, 1);
if (!editor) return;
editor = E_OBJECT_ALLOC(E_App_Edit, E_EAP_EDIT_TYPE, _e_eap_edit_free);
if (!editor) return NULL;;
v = E_NEW(E_Config_Dialog_View, 1);
if (!v)
{
free(editor);
return;
return NULL;
}
editor->img = NULL;
@ -97,9 +82,34 @@ e_eap_edit_show(E_Container *con, E_App *a)
_("Application Editor"),
"E", "_eap_editor_dialog",
NULL, 0, v, editor);
return editor;
}
/* local subsystem functions */
static void
_e_eap_edit_free(E_App_Edit *editor)
{
if (!editor) return;
if (editor->cfd)
{
E_Object *obj;
obj = E_OBJECT(editor->cfd);
editor->cfd = NULL;
e_object_del(obj);
}
if (editor->eap->tmpfile) ecore_file_unlink(editor->eap->image);
editor->eap->tmpfile = 0;
if (editor->eap->image) evas_stringshare_del(editor->eap->image);
editor->eap->width = 0;
editor->eap->height = 0;
e_object_unref(E_OBJECT(editor->eap));
// if (editor->img) evas_object_del(editor->img);
// if (editor->img_widget) evas_object_del(editor->img_widget);
// if (editor->fsel) evas_object_del(editor->fsel);
// if (editor->fsel_dia) e_object_del(E_OBJECT(editor->fsel_dia));
free(editor);
}
static void
_e_eap_edit_fill_data(E_Config_Dialog_Data *cfdata)
@ -127,7 +137,6 @@ _e_eap_edit_fill_data(E_Config_Dialog_Data *cfdata)
IFDUP(cfdata->editor->eap->path, cfdata->eap.path);
IFDUP(cfdata->editor->eap->icon_class, cfdata->eap.icon_class);
IFDUP(cfdata->editor->eap->icon_path, cfdata->eap.icon_path);
}
static void *
@ -158,27 +167,19 @@ _e_eap_edit_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *data)
E_FREE(data->ipath);
E_FREE(data->image);
if (data->eap.path)
free((char *) data->eap.path);
if (data->eap.icon_class)
free((char *) data->eap.icon_class);
if (data->eap.icon_path)
free((char *) data->eap.icon_path);
if (data->editor->eap->tmpfile) ecore_file_unlink(data->editor->eap->image);
data->editor->eap->tmpfile = 0;
if (data->editor->eap->image) evas_stringshare_del(data->editor->eap->image);
data->editor->eap->width = 0;
data->editor->eap->height = 0;
if (data->eap.path) free((char *) data->eap.path);
if (data->eap.icon_class) free((char *) data->eap.icon_class);
if (data->eap.icon_path) free((char *) data->eap.icon_path);
if (data->editor)
{
e_object_unref(E_OBJECT(data->editor->eap));
// if (data->editor->img) evas_object_del(data->editor->img);
// if (data->editor->img_widget) evas_object_del(data->editor->img_widget);
// if (data->editor->fsel) evas_object_del(data->editor->fsel);
// if (data->editor->fsel_dia) e_object_del(E_OBJECT(data->editor->fsel_dia));
free(data->editor);
E_Object *obj;
obj = E_OBJECT(data->editor);
data->editor = NULL;
e_object_del(obj);
}
free(data);
}

View File

@ -1,9 +1,33 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
typedef struct _E_App_Edit E_App_Edit;
#else
#ifndef E_EAP_EDIT_H
#define E_EAP_EDIT_H
EAPI void e_eap_edit_show(E_Container *con, E_App *a);
#define E_EAP_EDIT_TYPE 0xE0b01019
struct _E_App_Edit
{
E_Object e_obj_inherit;
E_App *eap;
Evas *evas;
Evas_Object *img;
Evas_Object *img_widget;
Evas_Object *fsel;
E_Dialog *fsel_dia;
int img_set;
E_Config_Dialog *cfd;
};
EAPI E_App_Edit *e_eap_edit_show(E_Container *con, E_App *a);
#endif
#endif

View File

@ -44,6 +44,7 @@ struct _E_Config_Dialog_Data
Evas_Object *o_move_up_button;
Evas_Object *o_move_down_button;
} gui;
E_App_Edit *editor;
};
struct _E_Config_Once
@ -135,7 +136,7 @@ _cb_button_up(void *data1, void *data2)
}
static void
_cb_files_changed(void *data, Evas_Object *obj, void *event_info)
_cb_files_dir_changed(void *data, Evas_Object *obj, void *event_info)
{
E_Config_Dialog_Data *cfdata;
@ -145,37 +146,71 @@ _cb_files_changed(void *data, Evas_Object *obj, void *event_info)
{
if (cfdata->gui.o_up_button)
e_widget_disabled_set(cfdata->gui.o_up_button, 1);
}
else
{
if (cfdata->gui.o_up_button)
e_widget_disabled_set(cfdata->gui.o_up_button, 0);
}
if (cfdata->gui.o_move_up_button)
e_widget_disabled_set(cfdata->gui.o_move_up_button, 1);
if (cfdata->gui.o_move_down_button)
e_widget_disabled_set(cfdata->gui.o_move_down_button, 1);
if (cfdata->gui.o_frame)
e_widget_scrollframe_child_pos_set(cfdata->gui.o_frame, 0, 0);
}
static void
_cb_files_sel_changed(void *data, Evas_Object *obj, void *event_info)
{
E_Config_Dialog_Data *cfdata;
const char *realpath;
char buf[4096];
cfdata = data;
if (!cfdata->gui.o_fm) return;
realpath = e_fm2_real_path_get(cfdata->gui.o_fm);
snprintf(buf, sizeof(buf), "%s/.order", realpath);
if (ecore_file_exists(buf))
{
if (cfdata->gui.o_move_up_button)
e_widget_disabled_set(cfdata->gui.o_move_up_button, 0);
if (cfdata->gui.o_move_down_button)
e_widget_disabled_set(cfdata->gui.o_move_down_button, 0);
}
else
{
if (cfdata->gui.o_move_up_button)
e_widget_disabled_set(cfdata->gui.o_move_up_button, 1);
if (cfdata->gui.o_move_down_button)
e_widget_disabled_set(cfdata->gui.o_move_down_button, 1);
}
else
{
const char *realpath;
char buf[4096];
}
realpath = e_fm2_real_path_get(cfdata->gui.o_fm);
snprintf(buf, sizeof(buf), "%s/.order", realpath);
if (ecore_file_exists(buf))
{
if (cfdata->gui.o_move_up_button)
e_widget_disabled_set(cfdata->gui.o_move_up_button, 0);
if (cfdata->gui.o_move_down_button)
e_widget_disabled_set(cfdata->gui.o_move_down_button, 0);
}
else
{
if (cfdata->gui.o_move_up_button)
e_widget_disabled_set(cfdata->gui.o_move_up_button, 1);
if (cfdata->gui.o_move_down_button)
e_widget_disabled_set(cfdata->gui.o_move_down_button, 1);
}
if (cfdata->gui.o_up_button)
e_widget_disabled_set(cfdata->gui.o_up_button, 0);
}
if (cfdata->gui.o_frame)
e_widget_scrollframe_child_pos_set(cfdata->gui.o_frame, 0, 0);
static void
_cb_files_changed(void *data, Evas_Object *obj, void *event_info)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
if (!cfdata->gui.o_fm) return;
if (cfdata->gui.o_move_up_button)
e_widget_disabled_set(cfdata->gui.o_move_up_button, 1);
if (cfdata->gui.o_move_down_button)
e_widget_disabled_set(cfdata->gui.o_move_down_button, 1);
}
static void
_cb_editor_del(E_Object *obj)
{
E_Config_Dialog_Data *cfdata;
cfdata = e_object_data_get(obj);
cfdata->editor = NULL;
e_object_del_attach_func_set(obj, NULL);
e_object_data_set(obj, NULL);
e_fm2_refresh(cfdata->gui.o_fm);
e_fm2_refresh(cfdata->gui.o_fm_all);
}
static void
@ -183,31 +218,13 @@ _cb_button_create(void *data1, void *data2)
{
E_App *a;
E_Config_Dialog_Data *cfdata;
cfdata = data1;
a = e_app_empty_new(NULL);
e_eap_edit_show(cfdata->cfd->con, a);
}
static void
_cb_files_selection_changed_all(void *data, Evas_Object *obj, void *event_info)
{
E_Config_Dialog_Data *cfdata;
Evas_List *selected;
cfdata = data;
if (!cfdata->gui.o_fm_all) return;
selected = e_fm2_selected_list_get(cfdata->gui.o_fm_all);
if (selected)
{
if (cfdata->gui.o_add_button)
e_widget_disabled_set(cfdata->gui.o_add_button, 0);
}
else
{
if (cfdata->gui.o_add_button)
e_widget_disabled_set(cfdata->gui.o_add_button, 1);
}
if (cfdata->editor) e_object_del(E_OBJECT(cfdata->editor));
cfdata->editor = e_eap_edit_show(cfdata->cfd->con, a);
e_object_data_set(E_OBJECT(cfdata->editor), cfdata);
e_object_del_attach_func_set(E_OBJECT(cfdata->editor), _cb_editor_del);
}
static void
@ -234,7 +251,30 @@ _cb_files_selected(void *data, Evas_Object *obj, void *event_info)
if (ecore_file_is_dir(buf)) return;
a = e_app_new(buf, 0);
if (a)
e_eap_edit_show(cfdata->cfd->con, a);
{
if (cfdata->editor) e_object_del(E_OBJECT(cfdata->editor));
cfdata->editor = e_eap_edit_show(cfdata->cfd->con, a);
e_object_data_set(E_OBJECT(cfdata->editor), cfdata);
e_object_del_attach_func_set(E_OBJECT(cfdata->editor), _cb_editor_del);
}
}
static void
_cb_files_selection_change(void *data, Evas_Object *obj, void *event_info)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
e_widget_disabled_set(cfdata->gui.o_add_button, 0);
}
static void
_cb_files_files_changed(void *data, Evas_Object *obj, void *event_info)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
e_widget_disabled_set(cfdata->gui.o_add_button, 1);
}
static void
@ -261,7 +301,12 @@ _cb_files_edited(void *data, E_Menu *m, E_Menu_Item *mi)
if (ecore_file_is_dir(buf)) return;
a = e_app_new(buf, 0);
if (a)
e_eap_edit_show(cfdata->cfd->con, a);
{
if (cfdata->editor) e_object_del(E_OBJECT(cfdata->editor));
cfdata->editor = e_eap_edit_show(cfdata->cfd->con, a);
e_object_data_set(E_OBJECT(cfdata->editor), cfdata);
e_object_del_attach_func_set(E_OBJECT(cfdata->editor), _cb_editor_del);
}
}
static void
@ -426,12 +471,12 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
fmc_all.selection.single = 1;
fmc_all.selection.windows_modifiers = 0;
e_fm2_config_set(mt, &fmc_all);
evas_object_smart_callback_add(mt, "changed",
_cb_files_selection_changed_all, cfdata);
evas_object_smart_callback_add(mt, "selected",
_cb_files_selected, cfdata);
evas_object_smart_callback_add(mt, "selection_change",
_cb_files_selection_changed_all, cfdata);
_cb_files_selection_change, cfdata);
evas_object_smart_callback_add(mt, "changed",
_cb_files_files_changed, cfdata);
e_fm2_icon_menu_start_extend_callback_set(mt, _cb_files_add_edited, cfdata);
snprintf(path_all, sizeof(path_all), "%s/.e/e/applications/all", homedir);
e_fm2_path_set(cfdata->gui.o_fm_all, path_all, "/");
@ -449,11 +494,11 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
mt = e_widget_button_add(evas, _(once->label), "enlightenment/e",
_cb_button_add, cfdata, NULL);
else
mt = e_widget_button_add(evas, _("Add application ->"), "enlightenment/e",
mt = e_widget_button_add(evas, _("Add application..."), "enlightenment/e",
_cb_button_add, cfdata, NULL);
cfdata->gui.o_add_button = mt;
e_widget_framelist_object_append(of, mt);
e_widget_disabled_set(cfdata->gui.o_add_button, 1);
e_widget_disabled_set(mt, 1);
if (!once)
{
@ -496,7 +541,11 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
fmc.selection.windows_modifiers = 0;
e_fm2_config_set(mt, &fmc);
evas_object_smart_callback_add(mt, "dir_changed",
_cb_files_changed, cfdata);
_cb_files_dir_changed, cfdata);
evas_object_smart_callback_add(mt, "selection_change",
_cb_files_sel_changed, cfdata);
evas_object_smart_callback_add(mt, "changed",
_cb_files_changed, cfdata);
snprintf(path, sizeof(path), "%s/.e/e/applications", homedir);
e_fm2_path_set(cfdata->gui.o_fm, path, "/");