Enlightenment CVS committal Author : essiene Project : e17 Module : proto
Dir : e17/proto/entrance_edit_gui/src/gui Modified Files: Egui.h Makefile.am behavior.c egui_settings.c layout.c main.c x_settings.c Log Message: - Generally cleaned up egui_settings subsystem. Make if read like rest of the code. Use Dialogs not Notice widgets. - Extend egui_settings to handle entries that display ints. - Use extended egui_setting to build x_settings dialog. There is a saving bug in all dialogs that use egui_settings. The list is getting corrupt. I changed from evas_list to ecore_list, same problem. I'm too sleepy to see any problem. - etk_entry has new api. *UPDATE* your etk to build this. This fixes the entry bug we were having... MoOm rox! :) =================================================================== RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/Egui.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- Egui.h 17 Aug 2006 19:42:12 -0000 1.8 +++ Egui.h 18 Aug 2006 04:51:53 -0000 1.9 @@ -1,9 +1,10 @@ #ifndef _EGUI_H #define _EGUI_H -#define BUTTON 0 -#define ENTRY 1 -#define LIST 2 + +#include <Ecore_Data.h> + +#include "egui_settings.h" typedef struct _Egui_Graphics_Selector { char *name; @@ -17,19 +18,7 @@ int show_pointer_options; } Egui_Graphics_Selector; -typedef struct _Egui_Settings_Item { - 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[32]; /* It is assfucking nasty, and not good, but it works */ -} Egui_Settings_Group; void egui_theme_dialog_show(void); void egui_background_dialog_show(void); @@ -40,6 +29,5 @@ void egui_x_settings_dialog_show(void); void egui_gs_dialog_show(Egui_Graphics_Selector); -void egui_settings_dialog_show(char *title, int count, Egui_Settings_Group items[]); #endif =================================================================== RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/Makefile.am,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- Makefile.am 17 Aug 2006 19:42:12 -0000 1.11 +++ Makefile.am 18 Aug 2006 04:51:53 -0000 1.12 @@ -10,8 +10,10 @@ theme.c \ x_settings.c \ egui_graphics_selector.c \ - egui_settings.c \ - Egui.h + egui_settings.c \ + egui_settings.h \ + Egui.h + entrance_edit_gui_CFLAGS = \ -I$(top_srcdir)/src/widgets \ =================================================================== RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/behavior.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- behavior.c 17 Aug 2006 00:26:37 -0000 1.6 +++ behavior.c 18 Aug 2006 04:51:53 -0000 1.7 @@ -289,6 +289,7 @@ return 0; } +/*callbacks*/ static void _cb_close(void* sender, void* data) { @@ -314,6 +315,7 @@ { ew_dialog_destroy(win); } + static int _apply(void) =================================================================== RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/egui_settings.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- egui_settings.c 17 Aug 2006 19:42:12 -0000 1.2 +++ egui_settings.c 18 Aug 2006 04:51:53 -0000 1.3 @@ -6,105 +6,238 @@ #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 _cb_close(void*, void*); +static void _cb_apply(void*, void*); +static void _cb_ok(void *, void *); -static void _ests_group_build(Egui_Settings_Group); -static Entrance_Widget _ests_item_build(Egui_Settings_Item); +static void _cb_group_build(void*, void*); +static void _cb_item_build(void*, void*); -static Entrance_Dialog dialog; -static Evas_List *items; +static void _close(void); +static int _apply(void); +static void _save_to_file(void); -void -egui_settings_dialog_show(char *title, int count, Egui_Settings_Group groups[]) { - int i = 0; - dialog = ew_notice_new(title); - items = NULL; +static void _load_button(void *w, const char *key, int ktype); +static void _load_entry(void *w, const char *key, int ktype); +static void _load_checkbox(void *w, const char *key, int ktype); + +static void _save_button(void *w, const char *key, int ktype); +static void _save_entry(void *w, const char *key, int ktype); +static void _save_checkbox(void *w, const char *key, int ktype); +static void _save_list(void *w, const char *key, int ktype); + +static Entrance_Widget _item_build(Egui_Settings_Item); + +static Entrance_Dialog win; +static Ecore_List *items; - 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); +Egui_Settings_Group es_group_new(const char* name, int direction) +{ + Egui_Settings_Group esg = calloc(1, sizeof(*esg)); + if(esg) + { + esg->title = name; + esg->direction = direction; + esg->items = ecore_list_new(); + } + + return esg; } -/*private*/ void -_ests_group_build(Egui_Settings_Group group) { - Entrance_Widget grp = ew_dialog_group_add(dialog, group.title, group.direction); - int i = 0; +es_group_append(Egui_Settings_Group g, Egui_Settings_Item *i) +{ + ecore_list_append(g->items, i); +} + +void +es_dialog_show(char *title, Ecore_List *groups) +{ + win = ew_dialog_new(title, EW_FALSE); + items = ecore_list_new(); + + ecore_list_for_each(groups, _cb_group_build, NULL); - for( ; i<group.item_count; i++) - ew_group_add(grp, _ests_item_build(group.items[i])); + ew_dialog_close_button_add(win, _cb_close, NULL); + ew_dialog_apply_button_add(win, _cb_apply, NULL); + ew_dialog_ok_button_add(win, _cb_ok, NULL); + + ew_dialog_show(win); } +/*private*/ + 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)); +_item_build(Egui_Settings_Item item) +{ + switch(item.widget_type) + { + /*TODO: move widget builders from case body into _widget_build_button, _widget_build_checkbox, etc*/ + case EGUI_TYPE_BUTTON: + _load_button(item.widget, item.entrance_edit_key, item.key_type); break; - case ENTRY: - ew_entry_set(item.widget, entrance_edit_string_get(item.entrance_edit_key)); + case EGUI_TYPE_ENTRY: + _load_entry(item.widget, item.entrance_edit_key, item.key_type); + break; + case EGUI_TYPE_CHECKBOX: + _load_checkbox(item.widget, item.entrance_edit_key, item.key_type); 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; +_load_button(void *w, const char *key, int ktype) +{ + if(ktype == EGUI_TYPE_INT) + ew_toggle_button_active_set(w, entrance_edit_int_get(key)); +} + +static void +_load_entry(void *w, const char *key, int ktype) +{ + if(ktype == EGUI_TYPE_STR) + ew_entry_set(w, entrance_edit_string_get(key)); + else if(ktype == EGUI_TYPE_INT) + { + char msg[PATH_MAX]; + snprintf(msg, PATH_MAX, "%d", entrance_edit_int_get(key)); + ew_entry_set(w, msg); } } -void -_ests_cb_apply() { - char msg[PATH_MAX]; +static void +_load_checkbox(void *w, const char *key, int ktype) +{ + if(ktype == EGUI_TYPE_INT) + { + if(entrance_edit_int_get(key)) + ew_checkbox_toggle(w); + } +} + +static void +_save_button(void *w, const char *key, int ktype) +{ + if(ktype == EGUI_TYPE_INT) + entrance_edit_int_set(key, ew_toggle_button_active_get(w)); +} + +static void +_save_entry(void *w, const char *key, int ktype) +{ +/* printf("value of entry = %s, key = %s\n", ew_entry_get(w), key);*/ + if(ktype == EGUI_TYPE_STR) + entrance_edit_string_set(key, ew_entry_get(w)); + else if(ktype == EGUI_TYPE_INT) + entrance_edit_int_set(key, atoi(ew_entry_get(w))); +} + +static void +_save_list(void *w, const char *key, int ktype) +{ + if(ktype == EGUI_TYPE_STR) + entrance_edit_string_set(key, ew_list_selected_data_get(w)); + else if(ktype = EGUI_TYPE_INT) + { + char *s = ew_list_selected_data_get(w); + entrance_edit_int_set(key, atoi(s)); + } +} + +static void +_save_checkbox(void *w, const char *key, int ktype) +{ + if(ktype == EGUI_TYPE_INT) + entrance_edit_int_set(key, ew_checkbox_is_active(w)); +} + +static void +_close(void) +{ + ew_dialog_destroy(win); +} + + + +static int +_apply(void) +{ + /*printf("starting apply main\n");*/ Egui_Settings_Item *item; - Evas_List *last = items; + ecore_list_goto_first(items); - while(last = evas_list_next(last)) { - item = evas_list_data(last); + while(item = ecore_list_next(items)) { - switch(item->type) { - case BUTTON: - entrance_edit_int_set(item->entrance_edit_key, ew_toggle_button_active_get(item->widget)); + /*printf("first widget key = %s, type = %d\n", item->entrance_edit_key, item->widget_type);*/ + switch(item->widget_type) { + case EGUI_TYPE_BUTTON: + _save_button(item->widget, item->entrance_edit_key, item->key_type); break; - case ENTRY: - entrance_edit_string_set(item->entrance_edit_key, ew_entry_get(item->widget)); + case EGUI_TYPE_ENTRY: + _save_entry(item->widget, item->entrance_edit_key, item->key_type); + break; + case EGUI_TYPE_LIST: + _save_list(item->widget, item->entrance_edit_key, item->key_type); + break; + case EGUI_TYPE_CHECKBOX: + _save_checkbox(item->widget, item->entrance_edit_key, item->key_type); 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); + ew_messagebox_ok("Entrance Configuration - Error", "Can not save to config file. Please check your permissions", EW_MESSAGEBOX_ICON_ERROR); + return 0; } + + return 1; } -void -_ests_cb_close() { - ew_dialog_destroy(dialog); +/*callbacks*/ +static void +_cb_close(void* sender, void* data) +{ + _close(); +} + +static void +_cb_apply(void* sender, void* data) +{ + /*printf("calling on apply to apply me\n");*/ + _apply(); +} + +static void +_cb_ok(void* sender, void* data) +{ + if(_apply()) + _close(); +} + +static void +_cb_group_build(void *listdata, void* data) +{ + Egui_Settings_Group group = listdata; + Entrance_Widget grp = ew_dialog_group_add(win, group->title, group->direction); + + ecore_list_for_each(group->items, _cb_item_build, grp); +} + +static void +_cb_item_build(void * listdata, void* data) +{ + Egui_Settings_Item *itemp = listdata; + Egui_Settings_Item item = *itemp; + + Entrance_Widget group = data; + + ew_group_add(group, _item_build(item)); + + ecore_list_append(items, &item); } =================================================================== RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/layout.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- layout.c 17 Aug 2006 19:55:30 -0000 1.7 +++ layout.c 18 Aug 2006 04:51:53 -0000 1.8 @@ -3,44 +3,51 @@ #include <stdio.h> #include "Egui.h" -static Entrance_Widget group_display; -static Entrance_Entry display_greeting_before; -static Entrance_Entry display_greeting_after; -static Entrance_Entry display_date_format; -static Entrance_Entry display_time_format; - void -egui_layout_dialog_show() { - 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_layout_dialog_show() +{ + + Egui_Settings_Group group_greeting = es_group_new("Greetings", EW_GROUP_VERTICAL); + + Egui_Settings_Item before = { + ew_entry_new("Before", NULL, EW_FALSE), + EGUI_TYPE_ENTRY, + ENTRANCE_EDIT_KEY_CLIENT_GREETING_BEFORE_STR, + EGUI_TYPE_STR }; - Egui_Settings_Group time = { - "Time/Date format", - EW_GROUP_VERTICAL, - 2, - {{ ew_entry_new("Time format", NULL, EW_FALSE), - ENTRANCE_EDIT_KEY_CLIENT_TIME_FORMAT_STR, - ENTRY - }, - { ew_entry_new("Data format", NULL, EW_FALSE), - ENTRANCE_EDIT_KEY_CLIENT_TIME_FORMAT_STR, - ENTRY - }} + Egui_Settings_Item after = { + ew_entry_new("After", NULL, EW_FALSE), + EGUI_TYPE_ENTRY, + ENTRANCE_EDIT_KEY_CLIENT_GREETING_AFTER_STR, + EGUI_TYPE_STR }; + + es_group_append(group_greeting, &before); + es_group_append(group_greeting, &after); + + Egui_Settings_Group group_format = es_group_new("Time/Date Format", EW_GROUP_VERTICAL); + + Egui_Settings_Item time_format = { + ew_entry_new("Time format", NULL, EW_FALSE), + EGUI_TYPE_ENTRY, + ENTRANCE_EDIT_KEY_CLIENT_TIME_FORMAT_STR, + EGUI_TYPE_STR + }; + + Egui_Settings_Item date_format = { + ew_entry_new("Data format", NULL, EW_FALSE), + EGUI_TYPE_ENTRY, + ENTRANCE_EDIT_KEY_CLIENT_TIME_FORMAT_STR, + EGUI_TYPE_STR + }; + + es_group_append(group_format, &time_format); + es_group_append(group_format, &date_format); - Egui_Settings_Group groups[] = { greeting, time }; + Ecore_List *groups = ecore_list_new(); + ecore_list_append(groups, group_greeting); + ecore_list_append(groups, group_format); - egui_settings_dialog_show("Layout settings", 2, groups); + es_dialog_show("Layout settings", groups); } - =================================================================== RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/main.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- main.c 16 Aug 2006 04:18:03 -0000 1.10 +++ main.c 18 Aug 2006 04:51:53 -0000 1.11 @@ -12,6 +12,7 @@ int main(int argc, char **argv) { + ecore_init(); entrance_edit_init(NULL); ew_init(&argc, &argv); @@ -20,6 +21,7 @@ ew_main(); ew_shutdown(); entrance_edit_shutdown(); + ecore_shutdown(); return 0; } =================================================================== RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/gui/x_settings.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- x_settings.c 17 Aug 2006 00:26:37 -0000 1.5 +++ x_settings.c 18 Aug 2006 04:51:53 -0000 1.6 @@ -3,90 +3,50 @@ #include <strings.h> #include <Entrance_Widgets.h> #include <Entrance_Edit.h> +#include "Egui.h" #include <stdio.h> -static void _xs_cb_apply(void*, void*); -static void _xs_cb_close(void*, void*); -static void _xs_cb_ok(void*, void*); - -static void _get_default_values(void); - -void _gs_close(void); - -static Entrance_Dialog win; - -static Entrance_Widget group_daemon; -static Entrance_Widget group_client; - -static Entrance_Entry entry_attempts; -static Entrance_Entry entry_xserver; -static Entrance_Entry entry_xession; - -int val_attempts; -const char* val_xserver; -const char* val_xsession; void egui_x_settings_dialog_show() { - win = ew_dialog_new(_("Enligtenment Configuration - X Settings"), EW_FALSE); - - _get_default_values(); - - group_daemon = ew_dialog_group_add(win, _("Daemon Settings"), EW_GROUP_VERTICAL); - - char v[PATH_MAX]; - snprintf(v, PATH_MAX, "%d", val_attempts); - printf("attempts = %s\n", v); - entry_attempts = ew_entry_new("X Attempts", v, EW_FALSE); - - ew_group_add(group_daemon, entry_attempts); - - entry_xserver = ew_entry_new("X Commandline", val_xserver, EW_FALSE); - ew_group_add(group_daemon, entry_xserver); - - group_client = ew_dialog_group_add(win, _("Client Settings"), EW_GROUP_VERTICAL); - - entry_xession = ew_entry_new("X Session Path", val_xsession, EW_FALSE); - ew_group_add(group_client, entry_xession); + Egui_Settings_Group group_daemon = es_group_new("Daemon Settings", EW_GROUP_VERTICAL); - ew_dialog_close_button_add(win, _xs_cb_close, NULL); - ew_dialog_apply_button_add(win, _xs_cb_apply, NULL); - ew_dialog_ok_button_add(win, _xs_cb_ok, NULL); - - ew_dialog_show(win); - - ew_entry_bugfix_makeshow(entry_attempts); - ew_entry_bugfix_makeshow(entry_xession); - ew_entry_bugfix_makeshow(entry_xserver); -} - - -/*priates*/ - -static void -_xs_cb_close(void * sender, void *data) -{ - ew_dialog_destroy(win); -} - -static void -_xs_cb_apply(void* sender, void* data) -{ - ew_messagebox_ok("Debug", "Apply clicked!", EW_MESSAGEBOX_ICON_MESSAGE); -} - -static void -_xs_cb_ok(void *sender, void *data) -{ - ew_messagebox_ok("Debug", "Ok clicked", EW_MESSAGEBOX_ICON_MESSAGE); -} - -static void -_get_default_values(void) -{ - val_attempts = entrance_edit_int_get(ENTRANCE_EDIT_KEY_DAEMON_ATTEMPTS_INT); + Egui_Settings_Item item_attempts = { + ew_entry_new("X Attempts", NULL, EW_FALSE), + EGUI_TYPE_ENTRY, + ENTRANCE_EDIT_KEY_DAEMON_ATTEMPTS_INT, + EGUI_TYPE_INT + }; + + Egui_Settings_Item item_xserver = { + ew_entry_new("X Commandline", NULL, EW_FALSE), + EGUI_TYPE_ENTRY, + ENTRANCE_EDIT_KEY_DAEMON_XSERVER_STR, + EGUI_TYPE_STR + }; + + es_group_append(group_daemon, &item_attempts); + es_group_append(group_daemon, &item_xserver); + + + Egui_Settings_Group group_client = es_group_new("Client Settings", EW_GROUP_VERTICAL); + + Egui_Settings_Item item_xsession = { + ew_entry_new("X Session", NULL, EW_FALSE), + EGUI_TYPE_ENTRY, + ENTRANCE_EDIT_KEY_CLIENT_XSESSION_STR, + EGUI_TYPE_STR + }; + + es_group_append(group_client, &item_xsession); + + Ecore_List *groups = ecore_list_new(); + if(groups) + { + ecore_list_append(groups, group_daemon); + ecore_list_append(groups, group_client); - val_xserver = strdup(entrance_edit_string_get(ENTRANCE_EDIT_KEY_DAEMON_XSERVER_STR)); - val_xsession = strdup(entrance_edit_string_get(ENTRANCE_EDIT_KEY_CLIENT_XSESSION_STR)); + es_dialog_show("X Settings", 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