Remove old config_apps code...it doesn't work anymore & we've added new
editors for favorites/ibar/restart/startup already. SVN revision: 29431
This commit is contained in:
parent
428c4209fa
commit
832bcba818
|
@ -1,955 +0,0 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#include "e.h"
|
||||
|
||||
/* TODO:
|
||||
* More filtering/sorting of left side to make managing thousands of apps easy.
|
||||
*
|
||||
* These things require support from e_fm -
|
||||
* Stop user from deleting standard directories on right side.
|
||||
* Stop user from creating new directories on left side.
|
||||
*/
|
||||
|
||||
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
#if 0
|
||||
static void _move_file_up_in_order(const char *order, const char *file);
|
||||
static void _move_file_down_in_order(const char *order, const char *file);
|
||||
#endif
|
||||
static void _append_to_order(const char *order, const char *file);
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Fm2_Icon_Info *info;
|
||||
char *selected;
|
||||
char path_all[PATH_MAX], path_menu[PATH_MAX], path_everything[PATH_MAX], path[PATH_MAX], *homedir;
|
||||
int sorted;
|
||||
struct {
|
||||
Evas_Object *o_fm_all;
|
||||
Evas_Object *o_fm;
|
||||
Evas_Object *o_frame;
|
||||
Evas_Object *o_up_button;
|
||||
Evas_Object *o_up_all_button;
|
||||
Evas_Object *o_add_button;
|
||||
#if 0
|
||||
Evas_Object *o_create_button;
|
||||
#endif
|
||||
Evas_Object *o_delete_left_button;
|
||||
Evas_Object *o_delete_right_button;
|
||||
Evas_Object *o_regen_button;
|
||||
Evas_Object *o_move_up_button;
|
||||
Evas_Object *o_move_down_button;
|
||||
} gui;
|
||||
#if 0
|
||||
E_App_Edit *editor;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _E_Config_Once
|
||||
{
|
||||
const char *title;
|
||||
const char *label;
|
||||
const char *path;
|
||||
int (*func) (void *data, const char *path);
|
||||
void *data;
|
||||
} E_Config_Once;
|
||||
|
||||
EAPI E_Config_Dialog *
|
||||
e_int_config_apps_once(E_Container *con, const char *title, const char *label, const char *path, int (*func) (void *data, const char *path), void *data)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
E_Config_Once *once = NULL;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.create_widgets = _basic_create_widgets;
|
||||
|
||||
if ((path) || (func))
|
||||
{
|
||||
once = E_NEW(E_Config_Once, 1);
|
||||
if (once)
|
||||
{
|
||||
once->title = title;
|
||||
once->label = label;
|
||||
once->path = path;
|
||||
once->func = func;
|
||||
once->data = data;
|
||||
}
|
||||
}
|
||||
|
||||
if (!path)
|
||||
{
|
||||
cfd = e_config_dialog_new(con,
|
||||
_("Applications"),
|
||||
"E", "_config_applications_dialog",
|
||||
"enlightenment/applications", 0, v, once);
|
||||
}
|
||||
else if (strstr(path, "bar"))
|
||||
{
|
||||
cfd = e_config_dialog_new(con,
|
||||
_("IBar Applications"),
|
||||
"E", "_config_applications_dialog",
|
||||
"enlightenment/ibar_applications", 0, v, once);
|
||||
}
|
||||
else if (strstr(path, "startup"))
|
||||
{
|
||||
cfd = e_config_dialog_new(con,
|
||||
_("Startup Applications"),
|
||||
"E", "_config_applications_dialog",
|
||||
"enlightenment/startup_applications", 0, v, once);
|
||||
}
|
||||
else if (strstr(path, "restart"))
|
||||
{
|
||||
cfd = e_config_dialog_new(con,
|
||||
_("Restart Applications"),
|
||||
"E", "_config_applications_dialog",
|
||||
"enlightenment/restart_applications", 0, v, once);
|
||||
}
|
||||
return cfd;
|
||||
}
|
||||
|
||||
EAPI E_Config_Dialog *
|
||||
e_int_config_apps(E_Container *con)
|
||||
{
|
||||
if (e_config_dialog_find("E", "_config_applications_dialog")) return NULL;
|
||||
return e_int_config_apps_once(con, NULL, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
EAPI E_Config_Dialog *
|
||||
e_int_config_apps_ibar(E_Container *con)
|
||||
{
|
||||
char path[4096];
|
||||
|
||||
if (e_config_dialog_find("E", "_config_applications_dialog")) return NULL;
|
||||
snprintf(path, sizeof(path), "%s/.e/e/applications/bar", e_user_homedir_get());
|
||||
return e_int_config_apps_once(con, _("IBar"), NULL, path, NULL, NULL);
|
||||
}
|
||||
|
||||
EAPI E_Config_Dialog *
|
||||
e_int_config_apps_restart(E_Container *con)
|
||||
{
|
||||
char path[4096];
|
||||
|
||||
if (e_config_dialog_find("E", "_config_applications_dialog")) return NULL;
|
||||
snprintf(path, sizeof(path), "%s/.e/e/applications/restart", e_user_homedir_get());
|
||||
return e_int_config_apps_once(con, _("Restart"), NULL, path, NULL, NULL);
|
||||
}
|
||||
|
||||
EAPI E_Config_Dialog *
|
||||
e_int_config_apps_startup(E_Container *con)
|
||||
{
|
||||
char path[4096];
|
||||
|
||||
if (e_config_dialog_find("E", "_config_applications_dialog")) return NULL;
|
||||
snprintf(path, sizeof(path), "%s/.e/e/applications/startup", e_user_homedir_get());
|
||||
return e_int_config_apps_once(con, _("Startup"), NULL, path, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
cfdata->homedir = strdup(e_user_homedir_get());
|
||||
if (!cfdata->homedir) return;
|
||||
|
||||
snprintf(cfdata->path_everything, sizeof(cfdata->path_everything), "%s/.e/e/applications/all", cfdata->homedir);
|
||||
snprintf(cfdata->path, sizeof(cfdata->path), "%s/.e/e/applications", cfdata->homedir);
|
||||
snprintf(cfdata->path_all, sizeof(cfdata->path_all), "%s/.e/e/applications/menu/all", cfdata->homedir);
|
||||
snprintf(cfdata->path_menu, sizeof(cfdata->path_all), "%s/.e/e/applications/menu", cfdata->homedir);
|
||||
return;
|
||||
}
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
cfdata->cfd = cfd;
|
||||
_fill_data(cfdata);
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (cfdata->selected) free(cfdata->selected);
|
||||
if (cfdata->cfd->data) free(cfdata->cfd->data);
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_button_up(void *data1, void *data2)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = data1;
|
||||
if (cfdata->gui.o_fm)
|
||||
e_fm2_parent_go(cfdata->gui.o_fm);
|
||||
if (cfdata->gui.o_frame)
|
||||
e_widget_scrollframe_child_pos_set(cfdata->gui.o_frame, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_button_up_all(void *data1, void *data2)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = data1;
|
||||
if (cfdata->gui.o_fm_all)
|
||||
e_fm2_parent_go(cfdata->gui.o_fm_all);
|
||||
if (cfdata->gui.o_frame)
|
||||
e_widget_scrollframe_child_pos_set(cfdata->gui.o_frame, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_files_dir_changed(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata->gui.o_fm) return;
|
||||
if (!e_fm2_has_parent_get(cfdata->gui.o_fm))
|
||||
{
|
||||
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);
|
||||
if (cfdata->selected) free(cfdata->selected);
|
||||
cfdata->selected = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_files_dir_changed_all(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata->gui.o_fm_all) return;
|
||||
if (!e_fm2_has_parent_get(cfdata->gui.o_fm_all))
|
||||
{
|
||||
if (cfdata->gui.o_up_all_button)
|
||||
e_widget_disabled_set(cfdata->gui.o_up_all_button, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cfdata->gui.o_up_all_button)
|
||||
e_widget_disabled_set(cfdata->gui.o_up_all_button, 0);
|
||||
}
|
||||
if (cfdata->gui.o_frame)
|
||||
e_widget_scrollframe_child_pos_set(cfdata->gui.o_frame, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_files_selection_change(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas_List *selected;
|
||||
E_Fm2_Icon_Info *ici = NULL;
|
||||
const char *realpath;
|
||||
char buf[4096];
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata->gui.o_fm) return;
|
||||
selected = e_fm2_selected_list_get(cfdata->gui.o_fm);
|
||||
if (selected) ici = selected->data;
|
||||
realpath = e_fm2_real_path_get(cfdata->gui.o_fm);
|
||||
snprintf(buf, sizeof(buf), "%s/.order", realpath);
|
||||
if (cfdata->selected) free(cfdata->selected);
|
||||
cfdata->selected = NULL;
|
||||
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);
|
||||
if ((ici) && (ici->file))
|
||||
cfdata->selected = strdup(ici->file);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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->selected)
|
||||
{
|
||||
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);
|
||||
e_fm2_select_set(cfdata->gui.o_fm, cfdata->selected, 1);
|
||||
}
|
||||
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 0
|
||||
static void
|
||||
_cb_editor_del(void *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);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void
|
||||
_cb_button_create(void *data1, void *data2)
|
||||
{
|
||||
E_App *a;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = data1;
|
||||
a = e_app_empty_new(NULL);
|
||||
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_selected_all(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas_List *selected;
|
||||
E_Fm2_Icon_Info *ici;
|
||||
const char *realpath;
|
||||
char buf[4096];
|
||||
E_App *a;
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata->gui.o_fm_all) return;
|
||||
selected = e_fm2_selected_list_get(cfdata->gui.o_fm_all);
|
||||
if (!selected) return;
|
||||
ici = selected->data;
|
||||
realpath = e_fm2_real_path_get(cfdata->gui.o_fm_all);
|
||||
if (!strcmp(realpath, "/"))
|
||||
snprintf(buf, sizeof(buf), "/%s", ici->file);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file);
|
||||
evas_list_free(selected);
|
||||
if (ecore_file_is_dir(buf)) return;
|
||||
a = e_app_new(buf, 0);
|
||||
if (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_selected_all2(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas_List *selected;
|
||||
E_Fm2_Icon_Info *ici;
|
||||
const char *realpath;
|
||||
char buf[4096];
|
||||
E_App *a;
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata->gui.o_fm) return;
|
||||
selected = e_fm2_selected_list_get(cfdata->gui.o_fm);
|
||||
if (!selected) return;
|
||||
ici = selected->data;
|
||||
realpath = e_fm2_real_path_get(cfdata->gui.o_fm);
|
||||
if (!strcmp(realpath, "/"))
|
||||
snprintf(buf, sizeof(buf), "/%s", ici->file);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file);
|
||||
evas_list_free(selected);
|
||||
if (ecore_file_is_dir(buf)) return;
|
||||
a = e_app_new(buf, 0);
|
||||
if (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);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
_cb_files_selection_change_all(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_changed_all(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);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
_cb_files_edited(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
E_Fm2_Icon_Info *info;
|
||||
const char *realpath;
|
||||
char buf[4096];
|
||||
E_App *a;
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata->gui.o_fm_all) return;
|
||||
if (!cfdata->info) return;
|
||||
info = cfdata->info;
|
||||
|
||||
realpath = e_fm2_real_path_get(cfdata->gui.o_fm_all);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/%s", realpath, info->file);
|
||||
|
||||
if (ecore_file_is_dir(buf)) return;
|
||||
a = e_app_new(buf, 0);
|
||||
if (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_add_edited(void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
E_Menu_Item *mi;
|
||||
|
||||
cfdata = data;
|
||||
if (!info) return;
|
||||
/* We need to get this info data to the menu callback, all this is created on the fly when user right clicks. */
|
||||
cfdata->info = info;
|
||||
mi = e_menu_item_new(m);
|
||||
e_menu_item_label_set(mi, _("Edit Application"));
|
||||
e_menu_item_callback_set(mi, _cb_files_edited, cfdata);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
_cb_files_sorted_changed(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = data;
|
||||
if (!cfdata->gui.o_fm_all) return;
|
||||
if (cfdata->sorted)
|
||||
e_fm2_path_set(cfdata->gui.o_fm_all, cfdata->path_everything, "/");
|
||||
else
|
||||
e_fm2_path_set(cfdata->gui.o_fm_all, cfdata->path_all, "/");
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_button_add(void *data1, void *data2)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas_List *selected;
|
||||
E_Fm2_Icon_Info *ici;
|
||||
const char *realpath;
|
||||
char buf[4096];
|
||||
int do_it = 1;
|
||||
|
||||
cfdata = data1;
|
||||
if (!cfdata->gui.o_fm_all) return;
|
||||
|
||||
selected = e_fm2_selected_list_get(cfdata->gui.o_fm_all);
|
||||
if (!selected) return;
|
||||
ici = selected->data;
|
||||
realpath = e_fm2_real_path_get(cfdata->gui.o_fm_all);
|
||||
if (cfdata->sorted)
|
||||
{
|
||||
if (!strcmp(realpath, "/"))
|
||||
snprintf(buf, sizeof(buf), "/%s", ici->file);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file);
|
||||
}
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s/%s", cfdata->path_everything, ici->file);
|
||||
evas_list_free(selected);
|
||||
if (ecore_file_is_dir(buf)) return;
|
||||
|
||||
if (cfdata->cfd->data)
|
||||
{
|
||||
E_Config_Once *once = NULL;
|
||||
|
||||
once = cfdata->cfd->data;
|
||||
if (once->func)
|
||||
{
|
||||
once->func(once->data, buf);
|
||||
do_it = 0;
|
||||
}
|
||||
}
|
||||
if (do_it)
|
||||
{
|
||||
if (!cfdata->gui.o_fm) return;
|
||||
|
||||
realpath = e_fm2_real_path_get(cfdata->gui.o_fm);
|
||||
_append_to_order(realpath, ecore_file_get_file(buf));
|
||||
}
|
||||
|
||||
/* FIXME: When fm is fixed to create the .order files for us, then we can remove this. */
|
||||
e_fm2_refresh(cfdata->gui.o_fm);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
_cb_button_move_up(void *data1, void *data2)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas_List *selected;
|
||||
E_Fm2_Icon_Info *ici;
|
||||
const char *realpath;
|
||||
|
||||
cfdata = data1;
|
||||
if (!cfdata->gui.o_fm) return;
|
||||
|
||||
selected = e_fm2_selected_list_get(cfdata->gui.o_fm);
|
||||
if (!selected) return;
|
||||
ici = selected->data;
|
||||
realpath = e_fm2_real_path_get(cfdata->gui.o_fm);
|
||||
evas_list_free(selected);
|
||||
_move_file_up_in_order(realpath, ici->file);
|
||||
e_fm2_refresh(cfdata->gui.o_fm);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_button_move_down(void *data1, void *data2)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
Evas_List *selected;
|
||||
E_Fm2_Icon_Info *ici;
|
||||
const char *realpath;
|
||||
|
||||
cfdata = data1;
|
||||
if (!cfdata->gui.o_fm) return;
|
||||
|
||||
selected = e_fm2_selected_list_get(cfdata->gui.o_fm);
|
||||
if (!selected) return;
|
||||
ici = selected->data;
|
||||
realpath = e_fm2_real_path_get(cfdata->gui.o_fm);
|
||||
evas_list_free(selected);
|
||||
_move_file_down_in_order(realpath, ici->file);
|
||||
e_fm2_refresh(cfdata->gui.o_fm);
|
||||
}
|
||||
#endif
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
E_Config_Once *once = NULL;
|
||||
Evas_Object *o, *of, *ob, *ot, *mt;
|
||||
E_Fm2_Config fmc_all, fmc;
|
||||
|
||||
if (cfdata->cfd->data)
|
||||
once = cfdata->cfd->data;
|
||||
|
||||
o = e_widget_list_add(evas, 1, 0);
|
||||
ot = e_widget_table_add(evas, 1);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Available Applications"), 0);
|
||||
|
||||
mt = e_widget_button_add(evas, _("Go up a Directory"), "widget/up_dir",
|
||||
_cb_button_up_all, cfdata, NULL);
|
||||
cfdata->gui.o_up_all_button = mt;
|
||||
e_widget_framelist_object_append(of, mt);
|
||||
|
||||
mt = e_fm2_add(evas);
|
||||
cfdata->gui.o_fm_all = mt;
|
||||
memset(&fmc_all, 0, sizeof(E_Fm2_Config));
|
||||
fmc_all.view.mode = E_FM2_VIEW_MODE_LIST;
|
||||
fmc_all.view.open_dirs_in_place = 1;
|
||||
fmc_all.view.selector = 1;
|
||||
fmc_all.view.single_click = 0;
|
||||
fmc_all.view.no_subdir_jump = 0;
|
||||
fmc_all.view.always_order = 1;
|
||||
fmc_all.icon.list.w = 24;
|
||||
fmc_all.icon.list.h = 24;
|
||||
fmc_all.icon.fixed.w = 1;
|
||||
fmc_all.icon.fixed.h = 1;
|
||||
fmc_all.icon.extension.show = 1;
|
||||
fmc_all.icon.key_hint = NULL;
|
||||
fmc_all.list.sort.no_case = 1;
|
||||
fmc_all.list.sort.dirs.first = 1;
|
||||
fmc_all.list.sort.dirs.last = 0;
|
||||
fmc_all.selection.single = 1;
|
||||
fmc_all.selection.windows_modifiers = 0;
|
||||
e_fm2_config_set(mt, &fmc_all);
|
||||
e_fm2_icon_menu_flags_set(mt, E_FM2_MENU_NO_SHOW_HIDDEN);
|
||||
evas_object_smart_callback_add(mt, "dir_changed",
|
||||
_cb_files_dir_changed_all, cfdata);
|
||||
#if 0
|
||||
evas_object_smart_callback_add(mt, "selected",
|
||||
_cb_files_selected_all, cfdata);
|
||||
#endif
|
||||
evas_object_smart_callback_add(mt, "selection_change",
|
||||
_cb_files_selection_change_all, cfdata);
|
||||
evas_object_smart_callback_add(mt, "changed",
|
||||
_cb_files_changed_all, cfdata);
|
||||
#if 0
|
||||
e_fm2_icon_menu_start_extend_callback_set(mt, _cb_files_add_edited, cfdata);
|
||||
#endif
|
||||
e_fm2_path_set(cfdata->gui.o_fm_all, cfdata->path_all, "/");
|
||||
e_fm2_window_object_set(mt, E_OBJECT(cfd->dia->win));
|
||||
ob = e_widget_scrollframe_pan_add(evas, mt,
|
||||
e_fm2_pan_set,
|
||||
e_fm2_pan_get,
|
||||
e_fm2_pan_max_get,
|
||||
e_fm2_pan_child_size_get);
|
||||
cfdata->gui.o_frame = ob;
|
||||
e_widget_min_size_set(ob, 150, 220);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_box_pack_options_set(ob,
|
||||
1, 1, /* fill */
|
||||
1, 1, /* expand */
|
||||
0.5, 0.5, /* align */
|
||||
150, 220, /* min */
|
||||
99999, 99999 /* max */
|
||||
);
|
||||
mt = e_widget_check_add(evas, _("All Applications"), &(cfdata->sorted));
|
||||
evas_object_smart_callback_add(mt, "changed",
|
||||
_cb_files_sorted_changed, cfdata);
|
||||
e_widget_framelist_object_append(of, mt);
|
||||
|
||||
mt = NULL;
|
||||
if ((once) && (once->label))
|
||||
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",
|
||||
_cb_button_add, cfdata, NULL);
|
||||
*/
|
||||
if (mt)
|
||||
{
|
||||
cfdata->gui.o_add_button = mt;
|
||||
e_widget_framelist_object_append(of, mt);
|
||||
e_widget_disabled_set(mt, 1);
|
||||
}
|
||||
|
||||
#if 0
|
||||
mt = e_widget_button_add(evas, _("Create a new Application"), "enlightenment/e",
|
||||
_cb_button_create, cfdata, NULL);
|
||||
cfdata->gui.o_create_button = mt;
|
||||
e_widget_framelist_object_append(of, mt);
|
||||
#endif
|
||||
|
||||
e_widget_table_object_append(ot, of, 0, 0, 2, 4, 1, 1, 1, 1);
|
||||
|
||||
if ((!once) || (once->path))
|
||||
{
|
||||
if ((once) && (once->title))
|
||||
of = e_widget_framelist_add(evas, (char *)once->title, 0);
|
||||
else
|
||||
of = e_widget_framelist_add(evas, _("Menus"), 0);
|
||||
|
||||
mt = e_widget_button_add(evas, _("Go up a Directory"), "widget/up_dir",
|
||||
_cb_button_up, cfdata, NULL);
|
||||
cfdata->gui.o_up_button = mt;
|
||||
e_widget_framelist_object_append(of, mt);
|
||||
|
||||
mt = e_fm2_add(evas);
|
||||
cfdata->gui.o_fm = mt;
|
||||
memset(&fmc, 0, sizeof(E_Fm2_Config));
|
||||
fmc.view.mode = E_FM2_VIEW_MODE_LIST;
|
||||
fmc.view.open_dirs_in_place = 1;
|
||||
fmc.view.selector = 1;
|
||||
fmc.view.single_click = 0;
|
||||
fmc.view.no_subdir_jump = 0;
|
||||
fmc.view.always_order = 1;
|
||||
fmc.view.link_drop = 1;
|
||||
fmc.icon.list.w = 24;
|
||||
fmc.icon.list.h = 24;
|
||||
fmc.icon.fixed.w = 1;
|
||||
fmc.icon.fixed.h = 1;
|
||||
fmc.icon.extension.show = 1;
|
||||
fmc.icon.key_hint = NULL;
|
||||
fmc.list.sort.no_case = 1;
|
||||
fmc.list.sort.dirs.first = 1;
|
||||
fmc.list.sort.dirs.last = 0;
|
||||
fmc.selection.single = 1;
|
||||
fmc.selection.windows_modifiers = 0;
|
||||
e_fm2_config_set(mt, &fmc);
|
||||
e_fm2_icon_menu_flags_set(mt, E_FM2_MENU_NO_SHOW_HIDDEN);
|
||||
evas_object_smart_callback_add(mt, "dir_changed",
|
||||
_cb_files_dir_changed, cfdata);
|
||||
#if 0
|
||||
evas_object_smart_callback_add(mt, "selected",
|
||||
_cb_files_selected_all2, cfdata);
|
||||
#endif
|
||||
evas_object_smart_callback_add(mt, "selection_change",
|
||||
_cb_files_selection_change, cfdata);
|
||||
evas_object_smart_callback_add(mt, "changed",
|
||||
_cb_files_changed, cfdata);
|
||||
#if 0
|
||||
e_fm2_icon_menu_start_extend_callback_set(mt, _cb_files_add_edited, cfdata);
|
||||
#endif
|
||||
if ((once) && (once->path))
|
||||
e_fm2_path_set(cfdata->gui.o_fm, once->path, "/");
|
||||
else
|
||||
e_fm2_path_set(cfdata->gui.o_fm, cfdata->path_menu, "/");
|
||||
e_fm2_window_object_set(cfdata->gui.o_fm, E_OBJECT(cfd->dia->win));
|
||||
|
||||
ob = e_widget_scrollframe_pan_add(evas, mt,
|
||||
e_fm2_pan_set,
|
||||
e_fm2_pan_get,
|
||||
e_fm2_pan_max_get,
|
||||
e_fm2_pan_child_size_get);
|
||||
cfdata->gui.o_frame = ob;
|
||||
e_widget_min_size_set(ob, 150, 220);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_box_pack_options_set(ob,
|
||||
1, 1, /* fill */
|
||||
1, 1, /* expand */
|
||||
0.5, 0.5, /* align */
|
||||
150, 220, /* min */
|
||||
99999, 99999 /* max */
|
||||
);
|
||||
/*
|
||||
mt = e_widget_button_add(evas, _("Move Application up"), "widget/up_arrow",
|
||||
_cb_button_move_up, cfdata, NULL);
|
||||
cfdata->gui.o_move_up_button = mt;
|
||||
e_widget_framelist_object_append(of, mt);
|
||||
e_widget_disabled_set(cfdata->gui.o_move_up_button, 1);
|
||||
|
||||
mt = e_widget_button_add(evas, _("Move Application down"), "widget/down_arrow",
|
||||
_cb_button_move_down, cfdata, NULL);
|
||||
cfdata->gui.o_move_down_button = mt;
|
||||
e_widget_framelist_object_append(of, mt);
|
||||
e_widget_disabled_set(cfdata->gui.o_move_down_button, 1);
|
||||
*/
|
||||
}
|
||||
|
||||
e_widget_list_object_append(o, ot, 1, 1, 0.5);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
_move_file_up_in_order(const char *order, const char *file)
|
||||
{
|
||||
char buf[4096];
|
||||
Evas_List *list = NULL, *l;
|
||||
FILE *f;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.order", order);
|
||||
if (!ecore_file_exists(buf)) return;
|
||||
f = fopen(buf, "rb");
|
||||
if (!f) return;
|
||||
|
||||
while (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
int len;
|
||||
|
||||
len = strlen(buf);
|
||||
if (len > 0)
|
||||
{
|
||||
if (buf[len - 1] == '\n')
|
||||
{
|
||||
buf[len - 1] = 0;
|
||||
len--;
|
||||
}
|
||||
if (strcmp(buf, file) != 0)
|
||||
list = evas_list_append(list, strdup(buf));
|
||||
else
|
||||
{
|
||||
l = evas_list_last(list);
|
||||
if (l)
|
||||
list = evas_list_prepend_relative_list(list, strdup(buf), l);
|
||||
else
|
||||
list = evas_list_append(list, strdup(buf));
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.order", order);
|
||||
ecore_file_unlink(buf);
|
||||
f = fopen(buf, "wb");
|
||||
if (!f) return;
|
||||
for (l = list; l; l = l->next)
|
||||
{
|
||||
char *text;
|
||||
|
||||
text = l->data;
|
||||
fprintf(f, "%s\n", text);
|
||||
free(text);
|
||||
}
|
||||
fclose(f);
|
||||
evas_list_free(list);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.eap.cache.cfg", order);
|
||||
ecore_file_unlink(buf);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
_move_file_down_in_order(const char *order, const char *file)
|
||||
{
|
||||
char buf[4096], *last;
|
||||
Evas_List *list = NULL, *l;
|
||||
FILE *f;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.order", order);
|
||||
if (!ecore_file_exists(buf)) return;
|
||||
f = fopen(buf, "rb");
|
||||
if (!f) return;
|
||||
|
||||
last = NULL;
|
||||
while (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
int len;
|
||||
|
||||
len = strlen(buf);
|
||||
if (len > 0)
|
||||
{
|
||||
if (buf[len - 1] == '\n')
|
||||
{
|
||||
buf[len - 1] = 0;
|
||||
len--;
|
||||
}
|
||||
if (strcmp(buf, file) != 0)
|
||||
{
|
||||
list = evas_list_append(list, strdup(buf));
|
||||
if (last)
|
||||
{
|
||||
list = evas_list_append(list, last);
|
||||
last = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
last = strdup(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (last)
|
||||
{
|
||||
list = evas_list_append(list, last);
|
||||
last = NULL;
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.order", order);
|
||||
ecore_file_unlink(buf);
|
||||
f = fopen(buf, "wb");
|
||||
if (!f) return;
|
||||
for (l = list; l; l = l->next)
|
||||
{
|
||||
char *text;
|
||||
|
||||
text = l->data;
|
||||
fprintf(f, "%s\n", text);
|
||||
free(text);
|
||||
}
|
||||
fclose(f);
|
||||
evas_list_free(list);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.eap.cache.cfg", order);
|
||||
ecore_file_unlink(buf);
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static void
|
||||
_append_to_order(const char *order, const char *file)
|
||||
{
|
||||
char buf[4096];
|
||||
Evas_List *list = NULL, *l;
|
||||
FILE *f;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.order", order);
|
||||
if (ecore_file_exists(buf))
|
||||
{
|
||||
f = fopen(buf, "r");
|
||||
if (f)
|
||||
{
|
||||
while (fgets(buf, sizeof(buf), f))
|
||||
{
|
||||
int len;
|
||||
|
||||
len = strlen(buf);
|
||||
if (len > 0)
|
||||
{
|
||||
if (buf[len - 1] == '\n')
|
||||
{
|
||||
buf[len - 1] = 0;
|
||||
len--;
|
||||
}
|
||||
list = evas_list_append(list, strdup(buf));
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s/.order", order);
|
||||
ecore_file_unlink(buf);
|
||||
}
|
||||
|
||||
list = evas_list_append(list, strdup(file));
|
||||
|
||||
f = fopen(buf, "w");
|
||||
if (!f) return;
|
||||
for (l = list; l; l = l->next)
|
||||
{
|
||||
char *text;
|
||||
|
||||
text = l->data;
|
||||
fprintf(f, "%s\n", text);
|
||||
free(text);
|
||||
}
|
||||
fclose(f);
|
||||
evas_list_free(list);
|
||||
|
||||
return;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
#ifdef E_TYPEDEFS
|
||||
#else
|
||||
#ifndef E_INT_CONFIG_APPS_H
|
||||
#define E_INT_CONFIG_APPS_H
|
||||
|
||||
EAPI E_Config_Dialog *e_int_config_apps(E_Container *con);
|
||||
EAPI E_Config_Dialog *e_int_config_apps_once(E_Container *con, const char *title, const char *label, const char *path, int (*func) (void *data, const char *path), void *data);
|
||||
EAPI E_Config_Dialog *e_int_config_apps_ibar(E_Container *con);
|
||||
EAPI E_Config_Dialog *e_int_config_apps_restart(E_Container *con);
|
||||
EAPI E_Config_Dialog *e_int_config_apps_startup(E_Container *con);
|
||||
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in New Issue