All Applications dialog can now delete applications, but the way I

remove them from .order files is a little drastic.  I'll change that
next to just rewrite the .order file and nuking the eap cache.


SVN revision: 25230
This commit is contained in:
David Walter Seikel 2006-08-31 00:50:57 +00:00
parent 2e467b5261
commit 5d928cc664
2 changed files with 66 additions and 37 deletions

View File

@ -2058,6 +2058,8 @@ _e_app_is_eapp(const char *path)
{ {
char *p; char *p;
if (!path)
return 0;
p = strrchr(path, '.'); p = strrchr(path, '.');
if (!p) if (!p)
return 0; return 0;

View File

@ -29,6 +29,8 @@ struct _E_Config_Dialog_Data
E_Config_Dialog *cfd; E_Config_Dialog *cfd;
E_Fm2_Icon_Info *info; E_Fm2_Icon_Info *info;
int state; int state;
E_App *parent;
E_App *parent_all;
struct { struct {
Evas_Object *o_fm_all; Evas_Object *o_fm_all;
Evas_Object *o_fm; Evas_Object *o_fm;
@ -91,6 +93,13 @@ e_int_config_apps(E_Container *con)
static void static void
_fill_data(E_Config_Dialog_Data *cfdata) _fill_data(E_Config_Dialog_Data *cfdata)
{ {
char path_all[4096], *homedir;
homedir = e_user_homedir_get();
if (!homedir) return;
snprintf(path_all, sizeof(path_all), "%s/.e/e/applications/all", homedir);
cfdata->parent_all = e_app_new(path_all, 1);
return; return;
} }
@ -133,11 +142,21 @@ _cb_files_changed(void *data, Evas_Object *obj, void *event_info)
if (!cfdata->gui.o_fm) return; if (!cfdata->gui.o_fm) return;
if (!e_fm2_has_parent_get(cfdata->gui.o_fm)) if (!e_fm2_has_parent_get(cfdata->gui.o_fm))
{ {
cfdata->parent = NULL;
if (cfdata->gui.o_up_button) if (cfdata->gui.o_up_button)
e_widget_disabled_set(cfdata->gui.o_up_button, 1); e_widget_disabled_set(cfdata->gui.o_up_button, 1);
} }
else else
{ {
const char *realpath;
char buf[4096];
realpath = e_fm2_real_path_get(cfdata->gui.o_fm_all);
snprintf(buf, sizeof(buf), "%s/.order", realpath);
if (ecore_file_exists(buf))
cfdata->parent = e_app_new(realpath, 1);
else
cfdata->parent = NULL;
if (cfdata->gui.o_up_button) if (cfdata->gui.o_up_button)
e_widget_disabled_set(cfdata->gui.o_up_button, 0); e_widget_disabled_set(cfdata->gui.o_up_button, 0);
} }
@ -228,59 +247,60 @@ static void
_cb_button_delete_left(void *data1, void *data2) _cb_button_delete_left(void *data1, void *data2)
{ {
E_Config_Dialog_Data *cfdata; E_Config_Dialog_Data *cfdata;
Evas_List *selected; Evas_List *l;
E_Fm2_Icon_Info *ici; E_Fm2_Icon_Info *ici;
const char *realpath;
char buf[4096];
E_App *a;
cfdata = data1; cfdata = data1;
if (!cfdata->gui.o_fm_all) return; if (!cfdata->gui.o_fm_all) return;
if (!cfdata->parent_all) return;
selected = e_fm2_selected_list_get(cfdata->gui.o_fm_all); l = e_fm2_selected_list_get(cfdata->gui.o_fm_all);
if (!selected) return; if (!l) return;
ici = selected->data; ici = l->data;
realpath = e_fm2_real_path_get(cfdata->gui.o_fm_all); evas_list_free(l);
if (!strcmp(realpath, "/")) for (l = cfdata->parent_all->subapps; l; l = l->next)
snprintf(buf, sizeof(buf), "/%s", ici->file); {
else E_App *a2;
snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file);
evas_list_free(selected); a2 = l->data;
if (ecore_file_is_dir(buf)) return; if ((a2->deleted) || ((a2->orig) && (a2->orig->deleted))) continue;
printf("DELETING LEFT APPLICATION %s\n", buf); if (!strcmp(ecore_file_get_file(a2->path), ecore_file_get_file(ici->file)))
// FIXME: find parent, so that e_app_remove can do the right thing. {
// a = e_app_new(buf, 0); e_app_remove(a2);
// if (a) e_fm2_refresh(cfdata->gui.o_fm_all);
// e_app_remove(a); break;
e_fm2_refresh(cfdata->gui.o_fm_all); }
}
} }
static void static void
_cb_button_delete_right(void *data1, void *data2) _cb_button_delete_right(void *data1, void *data2)
{ {
E_Config_Dialog_Data *cfdata; E_Config_Dialog_Data *cfdata;
Evas_List *selected; Evas_List *l;
E_Fm2_Icon_Info *ici; E_Fm2_Icon_Info *ici;
const char *realpath;
char buf[4096];
E_App *a;
cfdata = data1; cfdata = data1;
if (!cfdata->gui.o_fm) return; if (!cfdata->gui.o_fm) return;
if (!cfdata->parent) return;
selected = e_fm2_selected_list_get(cfdata->gui.o_fm); l = e_fm2_selected_list_get(cfdata->gui.o_fm);
if (!selected) return; if (!l) return;
ici = selected->data; ici = l->data;
realpath = e_fm2_real_path_get(cfdata->gui.o_fm); evas_list_free(l);
if (!strcmp(realpath, "/")) for (l = cfdata->parent->subapps; l; l = l->next)
snprintf(buf, sizeof(buf), "/%s", ici->file); {
else E_App *a2;
snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file);
evas_list_free(selected); a2 = l->data;
// if (ecore_file_is_dir(buf)) return; if ((a2->deleted) || ((a2->orig) && (a2->orig->deleted))) continue;
printf("DELETING RIGHT APPLICATION %s\n", buf); if (!strcmp(ecore_file_get_file(a2->path), ecore_file_get_file(ici->file)))
// FIXME: find parent .order, so that e_app_remove can do the right thing. {
e_fm2_refresh(cfdata->gui.o_fm); e_app_remove(a2);
e_fm2_refresh(cfdata->gui.o_fm);
break;
}
}
} }
static void static void
@ -324,6 +344,13 @@ _cb_button_add(void *data1, void *data2)
if ((a) && (parent)) if ((a) && (parent))
e_app_append(a, parent); e_app_append(a, parent);
} }
snprintf(buf, sizeof(buf), "%s/.order", realpath);
if (ecore_file_exists(buf))
cfdata->parent = e_app_new(realpath, 1);
else
cfdata->parent = NULL;
e_fm2_refresh(cfdata->gui.o_fm); e_fm2_refresh(cfdata->gui.o_fm);
} }