Move config menu to config panel as planned

frees need more work :(
icon texts are getting cropped, not knowledgable enough to fix I think


SVN revision: 16769
This commit is contained in:
handyande 2005-09-19 15:25:23 +00:00 committed by handyande
parent 039595690b
commit 35fb0c7192
6 changed files with 389 additions and 13 deletions

View File

@ -40,6 +40,7 @@ collections {
#include "default_winlist.edc"
#include "default_transitions.edc"
#include "default_dialog.edc"
#include "default_configure.edc"
#include "default_icons.edc"
#include "default_randr.edc"
#include "default_pointer.edc"

View File

@ -0,0 +1,188 @@
images {
image: "e17_menu_bg.png" COMP;
image: "e17_logo.png" COMP;
}
group {
name: "configure/main";
parts {
part {
name: "base";
mouse_events: 0;
type: RECT;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
color: 221 221 221 255;
}
}
part {
name: "base2";
mouse_events: 0;
type: IMAGE;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
image {
normal: "e17_menu_bg.png";
border: 1 1 1 1;
middle: 0;
}
fill {
smooth: 0;
}
color: 255 255 255 255;
}
}
part {
name: "logo";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: -50 -80;
}
rel2 {
relative: 0.0 0.0;
offset: 110 80;
}
image {
normal: "e17_logo.png";
}
color: 255 255 255 64;
}
}
part {
name: "title";
type: TEXT;
effect: SHADOW;
description {
state: "default" 0.0;
align: 0.0 0.0;
color: 255 255 255 128;
color3: 0 0 0 255;
rel1 {
relative: 0.0 0.0;
offset: 16 12;
}
rel2 {
relative: 1.0 0.0;
offset: -17 34;
}
text {
text: "Enlightenment Configuration";
size: 22;
font: "Edje-Vera";
align: 0.0 0.0;
}
}
}
part {
name: "icon_swallow";
type: SWALLOW;
description {
state: "default" 0.0;
align: 0.0 0.5;
color: 0 0 0 0;
rel1 {
relative: 0.0 0.0;
offset: 16 44;
}
rel2 {
relative: 1.0 1.0;
offset: -16 -16;
}
}
}
}
}
group {
name: "configure/icon";
min: 24 24;
max: 128 128;
parts {
part {
name: "icon_swallow";
type: SWALLOW;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -15;
}
}
}
part {
name: "icon_event";
type: RECT;
mouse_events: 1;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
to: "icon_swallow";
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
to: "icon_swallow";
}
color: 0 0 0 0;
}
}
part {
name: "title";
type: TEXT;
effect: SHADOW;
description {
rel1 {
relative: 0.0 1.0;
offset: 0 -15;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
color: 255 255 255 128;
color3: 0 0 0 255;
text {
text: "No Title";
align: 0.0 0.0;
size: 14;
font: "Edje-Vera";
}
}
}
}
programs {
program {
name: "button_click";
signal: "mouse,down,1";
source: "icon_event";
action: SIGNAL_EMIT "clicked" "";
}
}
}

View File

@ -69,7 +69,8 @@ e_bg.h \
e_remember.h \
e_win.h \
e_pan.h \
e_dialog.h
e_dialog.h \
e_configure.h
enlightenment_SOURCES = \
e_main.c \
@ -127,6 +128,7 @@ e_remember.c \
e_win.c \
e_pan.c \
e_dialog.c \
e_configure.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_LDFLAGS = -export-dynamic @e_libs@ @x_libs@ @dlopen_libs@ @cf_libs@

178
src/bin/e_configure.c Normal file
View File

@ -0,0 +1,178 @@
#include "e.h"
typedef struct E_Configure
{
E_Container *con;
E_Win *win;
Evas *evas;
Evas_Object *edje;
Evas_Object *box;
E_App *apps;
Evas_List *icons;
Evas_List *app_ref;
} E_Configure;
static void _e_configure_gui_show(E_Configure *app);
static void _e_configure_gui_hide(E_Win *win);
static void _e_configure_apps_load(E_Configure *app);
static void _e_configure_apps_unload(E_Configure *app);
static void _e_configure_apps_click(void *data, Evas_Object *obj, const char *emission, const char *source);
E_Path *path_themes;
E_Configure *
e_configure_show(E_Container *con)
{
E_Configure *app;
app = malloc(sizeof(E_Configure));
app->con = con;
_e_configure_gui_show(app);
app->apps = e_app_new(PACKAGE_DATA_DIR "/config-apps", 0);
app->icons = NULL;
app->app_ref = NULL;
_e_configure_apps_load(app);
return app;
}
static void
_e_configure_cb_resize(E_Win *win)
{
Evas_Coord w, h;
E_Configure *app;
if (win)
{
ecore_evas_geometry_get(win->ecore_evas, NULL, NULL, &w, &h);
app = (E_Configure *) ecore_evas_data_get(win->ecore_evas, "App");
evas_object_resize(app->edje, w, h);
}
}
static void
_e_configure_gui_show(E_Configure *app)
{
app->win = e_win_new(app->con);
e_win_delete_callback_set(app->win, _e_configure_gui_hide);
e_win_title_set(app->win, "Enlightenment Configuration");
e_win_name_class_set(app->win, "EConfigure", "EConfigure");
app->evas = e_win_evas_get(app->win);
ecore_evas_data_set(app->win->ecore_evas, "App", app);
e_win_resize_callback_set(app->win, _e_configure_cb_resize);
e_win_resize(app->win, 370, 200);
app->edje = edje_object_add(app->evas);
e_theme_edje_object_set(app->edje, "base/theme/configure", "configure/main");
app->box = e_box_add(app->evas);
e_box_orientation_set(app->box, 1);
e_box_align_set(app->box, 0.0, 0.0);
edje_object_part_swallow(app->edje, "icon_swallow", app->box);
evas_object_show(app->box);
evas_object_show(app->edje);
e_win_show(app->win);
}
static void
_e_configure_gui_hide(E_Win *win)
{
E_Configure *app;
app = (E_Configure *) ecore_evas_data_get(win->ecore_evas, "App");
if (app)
{
_e_configure_apps_unload(app);
edje_object_part_unswallow(app->edje, app->box);
evas_object_free(app->box);
evas_object_free(app->edje);
e_object_del(E_OBJECT(app->win));
}
}
static void
_e_configure_apps_load(E_Configure *app)
{
E_App *a;
Evas_List *l;
Evas_Object *o, *icon;
e_app_subdir_scan(app->apps, 0);
for (l = app->apps->subapps; l; l = l->next)
{
a = l->data;
e_object_ref(E_OBJECT(a));
app->app_ref = evas_list_append(app->app_ref, a);
o = edje_object_add(app->evas);
e_theme_edje_object_set(o, "base/theme/configure", "configure/icon");
icon = edje_object_add(app->evas);
edje_object_file_set(icon, a->path, "icon");
edje_object_part_swallow(o, "icon_swallow", icon);
edje_object_part_text_set(o, "title", a->name);
evas_object_show(icon);
e_box_pack_end(app->box, o);
e_box_pack_options_set(o,
1, 0, /* fill */
1, 0, /* expand */
0.0, 0.0, /* align */
72, 72, /* min */
999, 999 //172, 72 /* max */
);
// evas_object_resize(o, 172, 72);
evas_object_show(o);
app->icons = evas_list_append(app->icons, o);
edje_object_signal_callback_add(o, "clicked", "",
_e_configure_apps_click, a);
}
}
static void
_e_configure_apps_unload(E_Configure *app)
{
Evas_List *l;
E_App *a;
Evas_Object *icon;
/* while(app->icons)
{
icon = evas_list_data(app->icons);
// FIXME unswallow icon and free
app->icons = evas_list_remove(app->icons, icon);
evas_object_free(icon);
}*/
while(app->app_ref)
{
a = evas_list_data(app->app_ref);
app->app_ref = evas_list_remove(app->app_ref, a);
e_object_unref(E_OBJECT(a));
}
}
static void
_e_configure_apps_click(void *data, Evas_Object *obj, const char *emission, const char *source)
{
E_App *a;
a = data;
if (a)
{
Ecore_Exe *exe;
exe = ecore_exe_run(a->exe, NULL);
if (exe) ecore_exe_free(exe);
}
}

9
src/bin/e_configure.h Normal file
View File

@ -0,0 +1,9 @@
#ifdef E_TYPEDEFS
#ifndef E_WIN_H
#define E_WIN_H
E_Configure *e_configure_show(E_Container *con);
#endif
#endif

View File

@ -34,6 +34,7 @@ static void _e_int_menus_apps_free_hook (void *obj);
static void _e_int_menus_apps_run (void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_int_menus_config_pre_cb (void *data, E_Menu *m);
static void _e_int_menus_config_free_hook (void *obj);
static void _e_int_menus_config_item_cb (void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_int_menus_clients_pre_cb (void *data, E_Menu *m);
static void _e_int_menus_clients_free_hook (void *obj);
static void _e_int_menus_clients_item_cb (void *data, E_Menu *m, E_Menu_Item *mi);
@ -573,19 +574,14 @@ _e_int_menus_desktops_item_cb(void *data, E_Menu *m, E_Menu_Item *mi)
static void
_e_int_menus_config_pre_cb(void *data, E_Menu *m)
{
E_Menu *subm;
E_Menu_Item *mi;
Evas_List *l;
char buf[4096];
e_menu_pre_activate_callback_set(m, NULL, NULL);
snprintf(buf, sizeof(buf), "%s/config-apps", e_prefix_data_get());
subm = e_int_menus_apps_new(buf);
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Applications"));
e_menu_item_submenu_set(mi, subm);
e_menu_item_label_set(mi, _("Configuration Panel"));
e_menu_item_callback_set(mi, _e_int_menus_config_item_cb, NULL);
l = evas_hash_find(_e_int_menus_augmentation, "config");
if (l)
@ -597,22 +593,24 @@ _e_int_menus_config_pre_cb(void *data, E_Menu *m)
}
e_object_free_attach_func_set(E_OBJECT(m), _e_int_menus_config_free_hook);
e_object_data_set(E_OBJECT(m), subm);
}
static void
_e_int_menus_config_free_hook(void *obj)
{
E_Menu *m, *subm;
E_Menu *m;
m = obj;
subm = e_object_data_get(E_OBJECT(obj));
if (subm)
e_object_del(E_OBJECT(subm));
_e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "config"));
}
static void
_e_int_menus_config_item_cb(void *data, E_Menu *m, E_Menu_Item *mi)
{
e_configure_show(m->zone->container);
}
static void
_e_int_menus_clients_pre_cb(void *data, E_Menu *m)
{