Add a simple search path configuration dialog, plus:

* Add some widget API used by new dialog
 * Fix typo


SVN revision: 21983
devs/princeamd/enlightenment-0.17-elive
Stafford Mitchell Horne 17 years ago
parent 222d049ac8
commit 30cdc91f0c
  1. 4
      src/bin/Makefile.am
  2. 3
      src/bin/e_configure.c
  3. 1
      src/bin/e_includes.h
  4. 2
      src/bin/e_int_config_fonts.c
  5. 235
      src/bin/e_int_config_paths.c
  6. 12
      src/bin/e_int_config_paths.h
  7. 2
      src/bin/e_ipc_handlers.h
  8. 14
      src/bin/e_path.c
  9. 1
      src/bin/e_path.h
  10. 18
      src/bin/e_widget_config_list.c
  11. 3
      src/bin/e_widget_config_list.h

@ -150,7 +150,8 @@ e_apps_error.h \
e_stolen.h \
e_gadcon.h \
e_shelf.h \
e_widget_preview.h
e_widget_preview.h \
e_int_config_paths.h
enlightenment_src = \
e_user.c \
@ -282,6 +283,7 @@ e_stolen.c \
e_gadcon.c \
e_shelf.c \
e_widget_preview.c \
e_int_config_paths.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \

@ -95,7 +95,8 @@ e_configure_show(E_Container *con)
e_configure_standard_item_add(eco, "enlightenment/windows", _("Window List Settings"), e_int_config_winlist);
e_configure_standard_item_add(eco, "enlightenment/windows", _("Window Manipulation Settings"), e_int_config_window_manipulation);
e_configure_standard_item_add(eco, "enlightenment/run", _("Run Command Settings"), e_int_config_exebuf);
e_configure_standard_item_add(eco, "enlightenment/e", _("Search Paths"), e_int_config_paths);
/* FIXME: we should have a way for modules to hook in here and add their
* own entries
*/

@ -130,3 +130,4 @@
#include "e_shelf.h"
#include "e_tlist.h"
#include "e_widget_preview.h"
#include "e_int_config_paths.h"

@ -359,7 +359,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
of = e_widget_framelist_add(evas, _("Font Fallbacks"), 0);
e_widget_framelist_content_align_set(of, 0.5, 0.5);
ob = e_widget_config_list_add(evas, e_widget_entry_add, _("Fallback Name"));
ob = e_widget_config_list_add(evas, e_widget_entry_add, _("Fallback Name"), 1);
cfdata->gui.fallback_list = ob;
e_widget_framelist_object_append(of, ob);

@ -0,0 +1,235 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
typedef struct _E_Path_Pair E_Path_Pair;
typedef struct _CFPath_Change_Data CFPath_Change_Data;
static void *_create_data(E_Config_Dialog *cfd);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static int _basic_apply_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);
static void _ilist_update(Evas_Object *obj, E_Path *old, E_Path *new);
static void _ilist_path_cb_change(void *data);
struct _E_Path_Pair
{
E_Path *path;
const char *path_description;
};
struct _CFPath_Change_Data
{
E_Path *path;
E_Config_Dialog_Data *cfdata;
};
struct _E_Config_Dialog_Data
{
E_Config_Dialog *cfd;
/* Current data */
E_Path *cur_path;
Evas_List *pcd_list;
E_Path_Pair *paths_available;
struct
{
Evas_Object *path_list;
Evas_Object *default_list; /* Read Only */
Evas_Object *user_list; /* Editable */
}
gui;
};
EAPI E_Config_Dialog *
e_int_config_paths(E_Container *con)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
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;
v->basic.apply_cfdata = _basic_apply_data;
cfd = e_config_dialog_new(con, _("Search Path Configuration"), NULL, 0, v, NULL);
return cfd;
}
static void
_fill_data(E_Config_Dialog_Data *cfdata)
{
cfdata->paths_available = E_NEW(E_Path_Pair, 11);
cfdata->paths_available[0].path = path_data;
cfdata->paths_available[0].path_description = "Data";
cfdata->paths_available[1].path = path_images;
cfdata->paths_available[1].path_description = "Images";
cfdata->paths_available[2].path = path_fonts;
cfdata->paths_available[2].path_description = "Fonts";
cfdata->paths_available[3].path = path_themes;
cfdata->paths_available[3].path_description = "Themes";
cfdata->paths_available[4].path = path_init;
cfdata->paths_available[4].path_description = "Init";
cfdata->paths_available[5].path = path_icons;
cfdata->paths_available[5].path_description = "Icons";
cfdata->paths_available[6].path = path_modules;
cfdata->paths_available[6].path_description = "Modules";
cfdata->paths_available[7].path = path_backgrounds;
cfdata->paths_available[7].path_description = "Backgrounds";
cfdata->paths_available[8].path = path_input_methods;
cfdata->paths_available[8].path_description = "Input Methods";
cfdata->paths_available[9].path = path_messages;
cfdata->paths_available[9].path_description = "Messages";
cfdata->paths_available[10].path = NULL;
cfdata->paths_available[10].path_description = NULL;
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)
{
while (cfdata->pcd_list)
{
free(cfdata->pcd_list->data);
cfdata->pcd_list = evas_list_remove_list(cfdata->pcd_list, cfdata->pcd_list);
}
free(cfdata->paths_available);
free(cfdata);
}
static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
_ilist_update( cfdata->gui.user_list,
cfdata->cur_path,
NULL);
return 1;
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *o, *of, *ob;
int i;
o = e_widget_table_add(evas, 1);
of = e_widget_framelist_add(evas, _("E Paths"), 0);
ob = e_widget_ilist_add(evas, 0, 0, NULL);
cfdata->gui.path_list = ob;
e_widget_min_size_set(ob, 100, 100);
/* Fill In Ilist */
for (i = 0; cfdata->paths_available[i].path; i++)
{
CFPath_Change_Data *pcd;
pcd = E_NEW(CFPath_Change_Data, 1);
pcd->path = cfdata->paths_available[i].path;
pcd->cfdata = cfdata;
cfdata->pcd_list = evas_list_append(cfdata->pcd_list, pcd);
e_widget_ilist_append(ob, NULL, _(cfdata->paths_available[i].path_description), _ilist_path_cb_change, pcd, NULL);
}
e_widget_ilist_go(ob);
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(o, of, 0, 0, 1, 1, 1, 1, 1, 1);
of = e_widget_framelist_add(evas, _("Default Directories"), 0);
ob = e_widget_ilist_add(evas, 0, 0, NULL);
cfdata->gui.default_list = ob;
e_widget_min_size_set(ob, 100, 100);
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(o, of, 1, 0, 2, 1, 1, 1, 1, 1);
of = e_widget_framelist_add(evas, _("User Defined Directories"), 0);
e_widget_framelist_content_align_set(of, 0.5, 0.5);
ob = e_widget_config_list_add(evas, e_widget_entry_add, _("New Directory"), 2);
e_widget_disabled_set(ob, 1);
cfdata->gui.user_list = ob;
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(o, of, 0, 1, 3, 1, 1, 1, 1, 1);
return o;
}
static void
_ilist_path_cb_change(void *data)
{
CFPath_Change_Data *pcd;
Evas_List *default_list;
int i;
pcd = data;
default_list = pcd->path->default_dir_list;
/* Update Default List */
e_widget_ilist_clear(pcd->cfdata->gui.default_list);
for (i = 0; i < evas_list_count(default_list); i++)
{
const char *dir;
dir = ((E_Path_Dir *)evas_list_nth(default_list, i))->dir;
e_widget_ilist_append(pcd->cfdata->gui.default_list, NULL, dir, NULL, NULL, NULL);
}
e_widget_ilist_go(pcd->cfdata->gui.default_list);
_ilist_update( pcd->cfdata->gui.user_list,
pcd->cfdata->cur_path,
pcd->path);
pcd->cfdata->cur_path = pcd->path;
}
static void
_ilist_update(Evas_Object *obj, E_Path *old, E_Path *new)
{
/* Save current data to old path */
if (old)
{
int i;
e_path_user_path_clear(old);
for (i = 0; i < e_widget_config_list_count(obj); i++)
{
const char *dir;
dir = e_widget_config_list_nth_get(obj, i);
e_path_user_path_append(old, dir);
}
}
/* Fill list with selected data */
if (new)
{
Evas_List *l;
e_widget_disabled_set(obj, 0);
e_widget_config_list_clear(obj);
for (l = *(new->user_dir_list); l; l = l->next)
{
E_Path_Dir *epd;
epd = l->data;
e_widget_config_list_append(obj, epd->dir);
}
}
}

@ -0,0 +1,12 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
#else
#ifndef E_INT_CONFIG_PATHS_H
#define E_INT_CONFIG_PATHS_H
EAPI E_Config_Dialog *e_int_config_paths(E_Container *con);
#endif
#endif

@ -3,7 +3,7 @@
*/
/* NOTE:
*
* This is a very SPECIAL file. This servers as a kind of "auto code generator"
* This is a very SPECIAL file. This serves as a kind of "auto code generator"
* to handle the encoder, decoder etc. aspects of ipc requests. the aim here
* is to make writing support for a new opcode simple and compact. It intends
* to centralize the handling into 1 spot, instead of having ti spread around

@ -249,6 +249,20 @@ e_path_user_path_remove(E_Path *ep, const char *path)
}
}
EAPI void
e_path_user_path_clear(E_Path *ep)
{
while (*(ep->user_dir_list))
{
E_Path_Dir *epd;
epd = (*(ep->user_dir_list))->data;
*(ep->user_dir_list) = evas_list_remove_list(*(ep->user_dir_list), *(ep->user_dir_list));
evas_stringshare_del(epd->dir);
free(epd);
}
_e_path_cache_free(ep);
}
EAPI const char *
e_path_find(E_Path *ep, const char *file)
{

@ -38,6 +38,7 @@ EAPI void e_path_default_path_append(E_Path *ep, const char *path);
EAPI void e_path_user_path_append(E_Path *ep, const char *path);
EAPI void e_path_user_path_prepend(E_Path *ep, const char *path);
EAPI void e_path_user_path_remove(E_Path *ep, const char *path);
EAPI void e_path_user_path_clear(E_Path *ep);
EAPI const char *e_path_find(E_Path *ep, const char *file);
EAPI void e_path_evas_append(E_Path *ep, Evas *evas);
EAPI Evas_List *e_path_dir_list_get(E_Path *ep);

@ -38,7 +38,7 @@ struct _E_Widget_Data
/* Externally accessible functions */
EAPI Evas_Object *
e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas, char **val), const char *label)
e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas, char **val), const char *label, int listspan)
{
Evas_Object *obj, *o;
E_Widget_Data *wd;
@ -72,7 +72,7 @@ e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas,
1, 1, 1, 1);
o = e_widget_ilist_add(evas, 16, 16, NULL);
o = e_widget_ilist_add(evas, 0, 0, NULL);
wd->gui.list = o;
e_widget_disabled_set(o, 1);
e_widget_min_size_set(o, 100, 100);
@ -80,7 +80,7 @@ e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas,
e_widget_ilist_go(o);
e_widget_table_object_append( wd->gui.table,
o,
2, 0, 1, 4,
2, 0, listspan, 4,
1, 1, 1, 1);
o = e_widget_label_add(evas, label);
@ -130,6 +130,16 @@ e_widget_config_list_count(Evas_Object *obj)
return e_widget_ilist_count(wd->gui.list);
}
EAPI void
e_widget_config_list_clear(Evas_Object *obj)
{
E_Widget_Data *wd;
wd = e_widget_data_get(obj);
e_widget_ilist_clear(wd->gui.list);
_list_select_num(wd, -1);
}
EAPI const char *
e_widget_config_list_nth_get(Evas_Object *obj, int n)
{
@ -330,7 +340,7 @@ _e_wid_disable_hook(Evas_Object *obj)
if (!wd) return;
wd->cur_enabled = !e_widget_disabled_get(obj);
if (wd->cur_enabled)
{
e_widget_disabled_set(wd->gui.list, 0);

@ -6,11 +6,12 @@
#ifndef E_WIDGET_CONFIG_LIST_H
#define E_WIDGET_CONFIG_LIST_H
EAPI Evas_Object *e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas, char **val), const char *label);
EAPI Evas_Object *e_widget_config_list_add(Evas *evas, Evas_Object* (*func_entry_add) (Evas *evas, char **val), const char *label, int listspan);
EAPI int e_widget_config_list_count(Evas_Object *obj);
EAPI const char *e_widget_config_list_nth_get(Evas_Object *obj, int n);
EAPI void e_widget_config_list_append(Evas_Object *obj, const char *entry);
EAPI void e_widget_config_list_object_append(Evas_Object *obj, Evas_Object *sobj, int col, int row, int colspan, int rowspan, int fill_w, int fill_h, int expand_w, int expand_h);
EAPI void e_widget_config_list_clear(Evas_Object *obj);
#endif
#endif

Loading…
Cancel
Save