forked from enlightenment/enlightenment
*All applications dialog can now be called in a special way as an
application selector. *IBar calls it in that special way to add applications. SVN revision: 25205
This commit is contained in:
parent
d093a5aedd
commit
f5391cf9d6
|
@ -41,11 +41,20 @@ struct _E_Config_Dialog_Data
|
||||||
} gui;
|
} gui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _E_Config_Once
|
||||||
|
{
|
||||||
|
const char *label;
|
||||||
|
int (*func) (void *data, const char *path);
|
||||||
|
void *data;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
EAPI E_Config_Dialog *
|
EAPI E_Config_Dialog *
|
||||||
e_int_config_apps(E_Container *con)
|
e_int_config_apps_once(E_Container *con, const char *label, int (*func) (void *data, const char *path), void *data)
|
||||||
{
|
{
|
||||||
E_Config_Dialog *cfd;
|
E_Config_Dialog *cfd;
|
||||||
E_Config_Dialog_View *v;
|
E_Config_Dialog_View *v;
|
||||||
|
struct _E_Config_Once *once = NULL;
|
||||||
|
|
||||||
v = E_NEW(E_Config_Dialog_View, 1);
|
v = E_NEW(E_Config_Dialog_View, 1);
|
||||||
|
|
||||||
|
@ -53,13 +62,31 @@ e_int_config_apps(E_Container *con)
|
||||||
v->free_cfdata = _free_data;
|
v->free_cfdata = _free_data;
|
||||||
v->basic.create_widgets = _basic_create_widgets;
|
v->basic.create_widgets = _basic_create_widgets;
|
||||||
|
|
||||||
|
if (func)
|
||||||
|
{
|
||||||
|
/* FIXME: figure out some way of freeing this once we have finished with it. */
|
||||||
|
once = E_NEW(struct _E_Config_Once, 1);
|
||||||
|
if (once)
|
||||||
|
{
|
||||||
|
once->label = label;
|
||||||
|
once->func = func;
|
||||||
|
once->data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cfd = e_config_dialog_new(con,
|
cfd = e_config_dialog_new(con,
|
||||||
_("All Applications"),
|
_("All Applications"),
|
||||||
"E", "_config_applications_dialog",
|
"E", "_config_applications_dialog",
|
||||||
"enlightenment/applications", 0, v, NULL);
|
"enlightenment/applications", 0, v, once);
|
||||||
return cfd;
|
return cfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI E_Config_Dialog *
|
||||||
|
e_int_config_apps(E_Container *con)
|
||||||
|
{
|
||||||
|
return e_int_config_apps_once(con, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
|
@ -176,8 +203,8 @@ _cb_button_add(void *data1, void *data2)
|
||||||
E_App *a, *parent;
|
E_App *a, *parent;
|
||||||
|
|
||||||
cfdata = data1;
|
cfdata = data1;
|
||||||
if (!cfdata->gui.o_fm) return;
|
|
||||||
if (!cfdata->gui.o_fm_all) return;
|
if (!cfdata->gui.o_fm_all) return;
|
||||||
|
|
||||||
selected = e_fm2_selected_list_get(cfdata->gui.o_fm_all);
|
selected = e_fm2_selected_list_get(cfdata->gui.o_fm_all);
|
||||||
if (!selected) return;
|
if (!selected) return;
|
||||||
ici = selected->data;
|
ici = selected->data;
|
||||||
|
@ -188,11 +215,24 @@ _cb_button_add(void *data1, void *data2)
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file);
|
snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file);
|
||||||
evas_list_free(selected);
|
evas_list_free(selected);
|
||||||
if (ecore_file_is_dir(buf)) return;
|
if (ecore_file_is_dir(buf)) return;
|
||||||
a = e_app_new(buf, 0);
|
|
||||||
realpath = e_fm2_real_path_get(cfdata->gui.o_fm);
|
if (cfdata->cfd->data)
|
||||||
parent = e_app_new(realpath, 0);
|
{
|
||||||
if ((a) && (parent))
|
struct _E_Config_Once *once = NULL;
|
||||||
e_app_append(a, parent);
|
|
||||||
|
once = cfdata->cfd->data;
|
||||||
|
once->func(once->data, buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!cfdata->gui.o_fm) return;
|
||||||
|
|
||||||
|
a = e_app_new(buf, 0);
|
||||||
|
realpath = e_fm2_real_path_get(cfdata->gui.o_fm);
|
||||||
|
parent = e_app_new(realpath, 0);
|
||||||
|
if ((a) && (parent))
|
||||||
|
e_app_append(a, parent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -205,6 +245,7 @@ _cb_button_regen(void *data1, void *data2)
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
|
struct _E_Config_Once *once = NULL;
|
||||||
Evas_Object *o, *of, *ob, *ot, *ilist, *mt;
|
Evas_Object *o, *of, *ob, *ot, *ilist, *mt;
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
E_Fm2_Config fmc_all, fmc;
|
E_Fm2_Config fmc_all, fmc;
|
||||||
|
@ -213,6 +254,9 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
|
|
||||||
homedir = e_user_homedir_get();
|
homedir = e_user_homedir_get();
|
||||||
if (!homedir) return NULL;
|
if (!homedir) return NULL;
|
||||||
|
|
||||||
|
if (cfdata->cfd->data)
|
||||||
|
once = cfdata->cfd->data;
|
||||||
|
|
||||||
o = e_widget_list_add(evas, 1, 0);
|
o = e_widget_list_add(evas, 1, 0);
|
||||||
ot = e_widget_table_add(evas, 1);
|
ot = e_widget_table_add(evas, 1);
|
||||||
|
@ -258,7 +302,11 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
e_widget_min_size_set(ob, 150, 220);
|
e_widget_min_size_set(ob, 150, 220);
|
||||||
e_widget_framelist_object_append(of, ob);
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
|
||||||
mt = e_widget_button_add(evas, _("Add application ->"), "enlightenment/e",
|
if (once)
|
||||||
|
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);
|
_cb_button_add, cfdata, NULL);
|
||||||
cfdata->gui.o_add_button = mt;
|
cfdata->gui.o_add_button = mt;
|
||||||
e_widget_framelist_object_append(of, mt);
|
e_widget_framelist_object_append(of, mt);
|
||||||
|
@ -270,59 +318,61 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
|
|
||||||
e_widget_table_object_append(ot, of, 0, 0, 2, 4, 1, 1, 1, 1);
|
e_widget_table_object_append(ot, of, 0, 0, 2, 4, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
if (!once)
|
||||||
|
{
|
||||||
|
of = e_widget_framelist_add(evas, _("Bars, Menus, etc."), 0);
|
||||||
|
|
||||||
of = e_widget_framelist_add(evas, _("Bars, Menus, etc."), 0);
|
mt = e_widget_button_add(evas, _("Go up a Directory"), "widget/up_dir",
|
||||||
|
|
||||||
mt = e_widget_button_add(evas, _("Go up a Directory"), "widget/up_dir",
|
|
||||||
_cb_button_up, cfdata, NULL);
|
_cb_button_up, cfdata, NULL);
|
||||||
cfdata->gui.o_up_button = mt;
|
cfdata->gui.o_up_button = mt;
|
||||||
e_widget_framelist_object_append(of, mt);
|
e_widget_framelist_object_append(of, mt);
|
||||||
|
|
||||||
mt = e_fm2_add(evas);
|
mt = e_fm2_add(evas);
|
||||||
cfdata->gui.o_fm = mt;
|
cfdata->gui.o_fm = mt;
|
||||||
memset(&fmc, 0, sizeof(E_Fm2_Config));
|
memset(&fmc, 0, sizeof(E_Fm2_Config));
|
||||||
fmc.view.mode = E_FM2_VIEW_MODE_LIST;
|
fmc.view.mode = E_FM2_VIEW_MODE_LIST;
|
||||||
fmc.view.open_dirs_in_place = 1;
|
fmc.view.open_dirs_in_place = 1;
|
||||||
fmc.view.selector = 1;
|
fmc.view.selector = 1;
|
||||||
fmc.view.single_click = 0;
|
fmc.view.single_click = 0;
|
||||||
fmc.view.no_subdir_jump = 0;
|
fmc.view.no_subdir_jump = 0;
|
||||||
fmc.icon.list.w = 24;
|
fmc.icon.list.w = 24;
|
||||||
fmc.icon.list.h = 24;
|
fmc.icon.list.h = 24;
|
||||||
fmc.icon.fixed.w = 1;
|
fmc.icon.fixed.w = 1;
|
||||||
fmc.icon.fixed.h = 1;
|
fmc.icon.fixed.h = 1;
|
||||||
fmc.icon.extension.show = 1;
|
fmc.icon.extension.show = 1;
|
||||||
fmc.icon.key_hint = NULL;
|
fmc.icon.key_hint = NULL;
|
||||||
fmc.list.sort.no_case = 1;
|
fmc.list.sort.no_case = 1;
|
||||||
fmc.list.sort.dirs.first = 1;
|
fmc.list.sort.dirs.first = 1;
|
||||||
fmc.list.sort.dirs.last = 0;
|
fmc.list.sort.dirs.last = 0;
|
||||||
fmc.selection.single = 1;
|
fmc.selection.single = 1;
|
||||||
fmc.selection.windows_modifiers = 0;
|
fmc.selection.windows_modifiers = 0;
|
||||||
e_fm2_config_set(mt, &fmc);
|
e_fm2_config_set(mt, &fmc);
|
||||||
evas_object_smart_callback_add(mt, "dir_changed",
|
evas_object_smart_callback_add(mt, "dir_changed",
|
||||||
_cb_files_changed, cfdata);
|
_cb_files_changed, cfdata);
|
||||||
snprintf(path, sizeof(path), "%s/.e/e/applications", homedir);
|
snprintf(path, sizeof(path), "%s/.e/e/applications", homedir);
|
||||||
e_fm2_path_set(cfdata->gui.o_fm, path, "/");
|
e_fm2_path_set(cfdata->gui.o_fm, path, "/");
|
||||||
|
|
||||||
ob = e_widget_scrollframe_pan_add(evas, mt,
|
ob = e_widget_scrollframe_pan_add(evas, mt,
|
||||||
e_fm2_pan_set,
|
e_fm2_pan_set,
|
||||||
e_fm2_pan_get,
|
e_fm2_pan_get,
|
||||||
e_fm2_pan_max_get,
|
e_fm2_pan_max_get,
|
||||||
e_fm2_pan_child_size_get);
|
e_fm2_pan_child_size_get);
|
||||||
cfdata->gui.o_frame = ob;
|
cfdata->gui.o_frame = ob;
|
||||||
e_widget_min_size_set(ob, 150, 220);
|
e_widget_min_size_set(ob, 150, 220);
|
||||||
e_widget_framelist_object_append(of, ob);
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
|
||||||
mt = e_widget_button_add(evas, _("Remove application"), "enlightenment/e",
|
mt = e_widget_button_add(evas, _("Remove application"), "enlightenment/e",
|
||||||
_cb_button_delete_right, cfdata, NULL);
|
_cb_button_delete_right, cfdata, NULL);
|
||||||
cfdata->gui.o_delete_right_button = mt;
|
cfdata->gui.o_delete_right_button = mt;
|
||||||
e_widget_framelist_object_append(of, mt);
|
e_widget_framelist_object_append(of, mt);
|
||||||
|
|
||||||
mt = e_widget_button_add(evas, _("Regenerate \"All Applications\" Menu"), "enlightenment/e",
|
mt = e_widget_button_add(evas, _("Regenerate \"All Applications\" Menu"), "enlightenment/e",
|
||||||
_cb_button_regen, cfdata, NULL);
|
_cb_button_regen, cfdata, NULL);
|
||||||
cfdata->gui.o_regen_button = mt;
|
cfdata->gui.o_regen_button = mt;
|
||||||
e_widget_framelist_object_append(of, mt);
|
e_widget_framelist_object_append(of, mt);
|
||||||
|
|
||||||
e_widget_table_object_append(ot, of, 2, 0, 2, 4, 1, 1, 1, 1);
|
e_widget_table_object_append(ot, of, 2, 0, 2, 4, 1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
e_widget_list_object_append(o, ot, 1, 1, 0.5);
|
e_widget_list_object_append(o, ot, 1, 1, 0.5);
|
||||||
e_dialog_resizable_set(cfd->dia, 1);
|
e_dialog_resizable_set(cfd->dia, 1);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#define 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(E_Container *con);
|
||||||
|
EAPI E_Config_Dialog *e_int_config_apps_once(E_Container *con, const char *label, int (*func) (void *data, const char *path), void *data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -834,6 +834,33 @@ _ibar_cb_menu_configuration(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
_config_ibar_module(ci);
|
_config_ibar_module(ci);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_ibar_cb_menu_add_application_cb(void *data, const char *path)
|
||||||
|
{
|
||||||
|
IBar *b;
|
||||||
|
IBar_Icon *ic;
|
||||||
|
E_App *a;
|
||||||
|
|
||||||
|
b = data;
|
||||||
|
a = e_app_new(path, 0);
|
||||||
|
ic = _ibar_icon_new(b, a);
|
||||||
|
b->icons = evas_list_append(b->icons, ic);
|
||||||
|
e_box_pack_end(b->o_box, ic->o_holder);
|
||||||
|
_ibar_empty_handle(b);
|
||||||
|
_ibar_resize_handle(b);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ibar_cb_menu_add(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
|
{
|
||||||
|
IBar *b;
|
||||||
|
|
||||||
|
b = data;
|
||||||
|
e_int_config_apps_once(b->inst->gcc->gadcon->zone->container, "Add to IBar", _ibar_cb_menu_add_application_cb, b);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ibar_cb_menu_post(void *data, E_Menu *m)
|
_ibar_cb_menu_post(void *data, E_Menu *m)
|
||||||
{
|
{
|
||||||
|
@ -903,15 +930,20 @@ _ibar_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info
|
||||||
e_menu_item_label_set(mi, _("Remove Icon"));
|
e_menu_item_label_set(mi, _("Remove Icon"));
|
||||||
e_util_menu_item_edje_icon_set(mi, "enlightenment/delete");
|
e_util_menu_item_edje_icon_set(mi, "enlightenment/delete");
|
||||||
e_menu_item_callback_set(mi, _ibar_cb_menu_icon_remove, ic);
|
e_menu_item_callback_set(mi, _ibar_cb_menu_icon_remove, ic);
|
||||||
|
|
||||||
mi = e_menu_item_new(mn);
|
mi = e_menu_item_new(mn);
|
||||||
e_menu_item_separator_set(mi, 1);
|
e_menu_item_separator_set(mi, 1);
|
||||||
|
|
||||||
mi = e_menu_item_new(mn);
|
mi = e_menu_item_new(mn);
|
||||||
e_menu_item_label_set(mi, _("Configuration"));
|
e_menu_item_label_set(mi, _("Configuration"));
|
||||||
e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
|
e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
|
||||||
e_menu_item_callback_set(mi, _ibar_cb_menu_configuration, ic->ibar);
|
e_menu_item_callback_set(mi, _ibar_cb_menu_configuration, ic->ibar);
|
||||||
|
|
||||||
|
mi = e_menu_item_new(mn);
|
||||||
|
e_menu_item_label_set(mi, _("Add Application"));
|
||||||
|
e_util_menu_item_edje_icon_set(mi, "enlightenment/add");
|
||||||
|
e_menu_item_callback_set(mi, _ibar_cb_menu_add, ic->ibar);
|
||||||
|
|
||||||
e_gadcon_client_util_menu_items_append(ic->ibar->inst->gcc, mn, 0);
|
e_gadcon_client_util_menu_items_append(ic->ibar->inst->gcc, mn, 0);
|
||||||
|
|
||||||
e_gadcon_canvas_zone_geometry_get(ic->ibar->inst->gcc->gadcon,
|
e_gadcon_canvas_zone_geometry_get(ic->ibar->inst->gcc->gadcon,
|
||||||
|
|
Loading…
Reference in New Issue