Enlightenment CVS committal Author : rhapsodhy Project : e17 Module : proto
Dir : e17/proto/entrance_edit_gui/src/gui Modified Files: Egui.h Makefile.am egui_settings.c layout.c Log Message: Here's the implementation. Works well, test in layout.c =================================================================== RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/Egui.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- Egui.h 17 Aug 2006 00:26:37 -0000 1.7 +++ Egui.h 17 Aug 2006 19:42:12 -0000 1.8 @@ -1,10 +1,9 @@ #ifndef _EGUI_H #define _EGUI_H -#define BUTTON -#define ENTRY -#define LABEL -#define LIST +#define BUTTON 0 +#define ENTRY 1 +#define LIST 2 typedef struct _Egui_Graphics_Selector { char *name; @@ -19,16 +18,17 @@ } Egui_Graphics_Selector; typedef struct _Egui_Settings_Item { - Entrance_Widget *widget; + void *widget; char *entrance_edit_key; int type; /*BUTTON, ENTRY, LABEL, or LIST*/ } Egui_Settings_Item; typedef struct _Egui_Settings_Group { char *title; + int direction; - int *item_count; - Egui_Settings_Item items[]; + int item_count; + Egui_Settings_Item items[32]; /* It is assfucking nasty, and not good, but it works */ } Egui_Settings_Group; void egui_theme_dialog_show(void); =================================================================== RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- Makefile.am 15 Aug 2006 15:01:31 -0000 1.10 +++ Makefile.am 17 Aug 2006 19:42:12 -0000 1.11 @@ -10,6 +10,7 @@ theme.c \ x_settings.c \ egui_graphics_selector.c \ + egui_settings.c \ Egui.h entrance_edit_gui_CFLAGS = \ =================================================================== RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/egui_settings.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- egui_settings.c 16 Aug 2006 19:21:31 -0000 1.1 +++ egui_settings.c 17 Aug 2006 19:42:12 -0000 1.2 @@ -1,11 +1,110 @@ #include <limits.h> +#include <Evas.h> #include <Ecore_File.h> #include <Ecore_Data.h> #include <Entrance_Edit.h> #include <Entrance_Widgets.h> #include "Egui.h" +static void _ests_cb_response(void *, int, void *); +static void _ests_cb_apply(void); +static void _ests_cb_close(void); + +static void _ests_group_build(Egui_Settings_Group); +static Entrance_Widget _ests_item_build(Egui_Settings_Item); + +static Entrance_Dialog dialog; +static Evas_List *items; + void -egui_settings_dialog_show(char *title, int count, Egui_Settings_Group[] groups) { +egui_settings_dialog_show(char *title, int count, Egui_Settings_Group groups[]) { + int i = 0; + dialog = ew_notice_new(title); + items = NULL; + + for( ; i<count; i++) + _ests_group_build(groups[i]); + ew_notice_close_button_add(dialog, _ests_cb_response, NULL); + ew_notice_apply_button_add(dialog, NULL, NULL); + ew_notice_ok_button_add(dialog, NULL, NULL); + + ew_notice_show(dialog); +} + +/*private*/ +void +_ests_group_build(Egui_Settings_Group group) { + Entrance_Widget grp = ew_dialog_group_add(dialog, group.title, group.direction); + int i = 0; + + for( ; i<group.item_count; i++) + ew_group_add(grp, _ests_item_build(group.items[i])); +} + +Entrance_Widget +_ests_item_build(Egui_Settings_Item item) { + switch(item.type) { + case BUTTON: + ew_toggle_button_active_set(item.widget, entrance_edit_int_get(item.entrance_edit_key)); + break; + case ENTRY: + ew_entry_set(item.widget, entrance_edit_string_get(item.entrance_edit_key)); + break; + default: break; + } + evas_list_append(items, &item); + return item.widget; +} + +/*callbacks*/ +static void +_ests_cb_response(void *owner, int response, void *data) { + switch(response) { + case EW_NOTICE_OK_BUTTON: + _ests_cb_apply(); + _ests_cb_close(); + break; + case EW_NOTICE_APPLY_BUTTON: + _ests_cb_apply(); + break; + case EW_NOTICE_CLOSE_BUTTON: + _ests_cb_close(); + break; + default: break; + } +} + +void +_ests_cb_apply() { + char msg[PATH_MAX]; + Egui_Settings_Item *item; + Evas_List *last = items; + + while(last = evas_list_next(last)) { + item = evas_list_data(last); + + switch(item->type) { + case BUTTON: + entrance_edit_int_set(item->entrance_edit_key, ew_toggle_button_active_get(item->widget)); + break; + case ENTRY: + entrance_edit_string_set(item->entrance_edit_key, ew_entry_get(item->widget)); + break; + case LIST: + entrance_edit_string_set(item->entrance_edit_key, ew_list_selected_data_get(item->widget)); + default: break; + } + } + + if(!entrance_edit_save()) + { + snprintf(msg, PATH_MAX, "Can not set a value. Please check your permissions"); + ew_messagebox_ok("Entrance Config - Error", msg, EW_MESSAGEBOX_ICON_ERROR); + } +} + +void +_ests_cb_close() { + ew_dialog_destroy(dialog); } =================================================================== RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/layout.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- layout.c 16 Aug 2006 04:18:03 -0000 1.5 +++ layout.c 17 Aug 2006 19:42:12 -0000 1.6 @@ -1,5 +1,7 @@ #include <Entrance_Widgets.h> +#include <Entrance_Edit.h> #include <stdio.h> +#include "Egui.h" static Entrance_Widget group_display; static Entrance_Entry display_greeting_before; @@ -9,6 +11,33 @@ void egui_layout_dialog_show() { - ew_messagebox_ok("notice", "This is a message", EW_MESSAGEBOX_ICON_MESSAGE); +/* Egui_Settings_Item greeting_items[] = { + { ew_entry_new("Before", NULL, EW_FALSE), + ENTRANCE_EDIT_KEY_CLIENT_GREETING_BEFORE_STR, + ENTRY + }, + { ew_entry_new("After", NULL, EW_FALSE), + ENTRANCE_EDIT_KEY_CLIENT_GREETING_AFTER_STR, + ENTRY + } + };*/ + + Egui_Settings_Group greeting = { + "Greeting settings", + EW_GROUP_VERTICAL, + 2, + {{ ew_entry_new("Before", NULL, EW_FALSE), + ENTRANCE_EDIT_KEY_CLIENT_GREETING_BEFORE_STR, + ENTRY + }, + { ew_entry_new("After", NULL, EW_FALSE), + ENTRANCE_EDIT_KEY_CLIENT_GREETING_AFTER_STR, + ENTRY + }} + }; + + Egui_Settings_Group groups[] = { greeting }; + + egui_settings_dialog_show("Layout settings", 1, groups); } ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs