E17: dont mix declaration and code

SVN revision: 71392
This commit is contained in:
Vincent Torri 2012-05-24 06:02:14 +00:00
parent f83cc6bb45
commit b9bd60aad8
2 changed files with 59 additions and 26 deletions

View File

@ -225,10 +225,18 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
Evas_Object *mainn = e_widget_toolbook_add(evas, 24, 24); Evas_Object *mainn = e_widget_toolbook_add(evas, 24, 24);
{ {
/* Holds the used layouts ilist and the button table */ /* Holds the used layouts ilist and the button table */
Evas_Object *layoutss = e_widget_list_add(evas, 0, 0); Evas_Object *layoutss;
Evas_Object *modelss;
Evas_Object *options;
layoutss = e_widget_list_add(evas, 0, 0);
{ {
/* Holds the used layouts */ /* Holds the used layouts */
Evas_Object *configs = e_widget_ilist_add(evas, 32, 32, NULL); Evas_Object *configs;
Evas_Object *buttons;
configs = e_widget_ilist_add(evas, 32, 32, NULL);
{ {
e_widget_size_min_set(configs, 220, 160); e_widget_size_min_set(configs, 220, 160);
e_widget_ilist_go(configs); e_widget_ilist_go(configs);
@ -238,7 +246,7 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
} }
/* Holds the buttons */ /* Holds the buttons */
Evas_Object *buttons = e_widget_table_add(evas, 1); buttons = e_widget_table_add(evas, 1);
{ {
cfdata->btn_up = e_widget_button_add(evas, _("Up"), "go-up", _cb_up, cfdata, NULL); cfdata->btn_up = e_widget_button_add(evas, _("Up"), "go-up", _cb_up, cfdata, NULL);
{ {
@ -270,7 +278,7 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
} }
/* Holds the default models */ /* Holds the default models */
Evas_Object *modelss = e_widget_ilist_add(evas, 32, 32, &cfdata->default_model); modelss = e_widget_ilist_add(evas, 32, 32, &cfdata->default_model);
{ {
e_widget_size_min_set(modelss, 220, 160); e_widget_size_min_set(modelss, 220, 160);
cfdata->dmodel_list = modelss; cfdata->dmodel_list = modelss;
@ -279,14 +287,16 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
} }
/* Holds the options */ /* Holds the options */
Evas_Object *options = e_widget_list_add(evas, 0, 0); options = e_widget_list_add(evas, 0, 0);
{ {
E_XKB_Option *option; E_XKB_Option *option;
E_XKB_Option_Group *group; E_XKB_Option_Group *group;
Eina_List *l, *ll, *lll; Eina_List *l, *ll, *lll;
Evas_Coord mw, mh; Evas_Coord mw, mh;
Evas_Object *general;
Evas_Object *scroller;
Evas_Object *general = e_widget_framelist_add(evas, _("Gadgets"), 0); general = e_widget_framelist_add(evas, _("Gadgets"), 0);
{ {
Evas_Object *only_label = e_widget_check_add(evas, _("Label only"), &(cfdata->only_label)); Evas_Object *only_label = e_widget_check_add(evas, _("Label only"), &(cfdata->only_label));
{ {
@ -319,7 +329,7 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
evas_object_resize(options, mw, mh); evas_object_resize(options, mw, mh);
Evas_Object *scroller = e_widget_scrollframe_simple_add(evas, options); scroller = e_widget_scrollframe_simple_add(evas, options);
e_widget_size_min_set(scroller, 220, 160); e_widget_size_min_set(scroller, 220, 160);
e_widget_toolbook_page_append(mainn, NULL, _("Options"), scroller, 1, 1, 1, 1, 0.5, 0.0); e_widget_toolbook_page_append(mainn, NULL, _("Options"), scroller, 1, 1, 1, 1, 0.5, 0.0);
@ -458,6 +468,7 @@ _dlg_add_new(E_Config_Dialog_Data *cfdata)
E_Dialog *dlg; E_Dialog *dlg;
Evas *evas; Evas *evas;
Evas_Coord mw, mh; Evas_Coord mw, mh;
Evas_Object *mainn;
if (!(dlg = e_dialog_new(_xkb.cfd->con, "E", "xkbswitch_config_add_dialog"))) return NULL; if (!(dlg = e_dialog_new(_xkb.cfd->con, "E", "xkbswitch_config_add_dialog"))) return NULL;
@ -470,10 +481,13 @@ _dlg_add_new(E_Config_Dialog_Data *cfdata)
e_dialog_title_set(dlg, _("Add New Configuration")); e_dialog_title_set(dlg, _("Add New Configuration"));
/* The main toolbook, holds the lists and tabs */ /* The main toolbook, holds the lists and tabs */
Evas_Object *mainn = e_widget_toolbook_add(evas, 24, 24); mainn = e_widget_toolbook_add(evas, 24, 24);
{ {
/* Holds the available layouts */ /* Holds the available layouts */
Evas_Object *available = e_widget_ilist_add(evas, 32, 32, NULL); Evas_Object *available = e_widget_ilist_add(evas, 32, 32, NULL);
Evas_Object *modelss;
Evas_Object *variants;
{ {
e_widget_size_min_set(available, 220, 160); e_widget_size_min_set(available, 220, 160);
e_widget_ilist_go(available); e_widget_ilist_go(available);
@ -482,14 +496,14 @@ _dlg_add_new(E_Config_Dialog_Data *cfdata)
} }
/* Holds the available models */ /* Holds the available models */
Evas_Object *modelss = e_widget_ilist_add(evas, 32, 32, NULL); modelss = e_widget_ilist_add(evas, 32, 32, NULL);
{ {
e_widget_toolbook_page_append(mainn, NULL, _("Model"), modelss, 1, 1, 1, 1, 0.5, 0.0); e_widget_toolbook_page_append(mainn, NULL, _("Model"), modelss, 1, 1, 1, 1, 0.5, 0.0);
cfdata->model_list = modelss; cfdata->model_list = modelss;
} }
/* Holds the available variants */ /* Holds the available variants */
Evas_Object *variants = e_widget_ilist_add(evas, 32, 32, NULL); variants = e_widget_ilist_add(evas, 32, 32, NULL);
{ {
e_widget_toolbook_page_append(mainn, NULL, _("Variant"), variants, 1, 1, 1, 1, 0.5, 0.0); e_widget_toolbook_page_append(mainn, NULL, _("Variant"), variants, 1, 1, 1, 1, 0.5, 0.0);
cfdata->variant_list = variants; cfdata->variant_list = variants;

View File

@ -38,19 +38,20 @@ find_rules(void)
int int
parse_rules(void) parse_rules(void)
{ {
char buf[4096];
E_XKB_Model *model = NULL; E_XKB_Model *model = NULL;
E_XKB_Layout *layout = NULL; E_XKB_Layout *layout = NULL;
E_XKB_Option *option = NULL; E_XKB_Option *option = NULL;
E_XKB_Variant *variant = NULL; E_XKB_Variant *variant = NULL;
E_XKB_Option_Group *group = NULL; E_XKB_Option_Group *group = NULL;
char buf[4096]; FILE *f;
if (!rules_file) return 0; if (!rules_file) return 0;
layouts = NULL; layouts = NULL;
models = NULL; models = NULL;
FILE *f = fopen(rules_file, "r"); f = fopen(rules_file, "r");
if (!f) return 0; if (!f) return 0;
/* move on to next line, the first one is useless */ /* move on to next line, the first one is useless */
@ -69,14 +70,18 @@ parse_rules(void)
{ {
if (fgets(buf, sizeof(buf), f)) if (fgets(buf, sizeof(buf), f))
{ {
char *n = strchr(buf, '\n'); char *n;
char *p;
char *tmp;
n = strchr(buf, '\n');
if (n) *n = '\0'; if (n) *n = '\0';
/* means end of section */ /* means end of section */
if (!buf[0]) break; if (!buf[0]) break;
/* get rid of initial 2 spaces here */ /* get rid of initial 2 spaces here */
char *p = buf + 2; p = buf + 2;
char *tmp = strdup(p); tmp = strdup(p);
model = E_NEW(E_XKB_Model, 1); model = E_NEW(E_XKB_Model, 1);
model->name = eina_stringshare_add(strtok(tmp, " ")); model->name = eina_stringshare_add(strtok(tmp, " "));
@ -102,13 +107,17 @@ parse_rules(void)
{ {
if (fgets(buf, sizeof(buf), f)) if (fgets(buf, sizeof(buf), f))
{ {
char *n = strchr(buf, '\n'); char *n;
char *p;
char *tmp;
n = strchr(buf, '\n');
if (n) *n = '\0'; if (n) *n = '\0';
if (!buf[0]) break; if (!buf[0]) break;
char *p = buf + 2; p = buf + 2;
char *tmp = strdup(p); tmp = strdup(p);
layout = E_NEW(E_XKB_Layout, 1); layout = E_NEW(E_XKB_Layout, 1);
layout->name = eina_stringshare_add(strtok(tmp, " ")); layout->name = eina_stringshare_add(strtok(tmp, " "));
@ -139,18 +148,23 @@ parse_rules(void)
{ {
if (fgets(buf, sizeof(buf), f)) if (fgets(buf, sizeof(buf), f))
{ {
char *n = strchr(buf, '\n'); char *n;
char *p;
char *tmp;
char *tok;
n = strchr(buf, '\n');
if (n) *n = '\0'; if (n) *n = '\0';
if (!buf[0]) break; if (!buf[0]) break;
char *p = buf + 2; p = buf + 2;
char *tmp = strdup(p); tmp = strdup(p);
variant = E_NEW(E_XKB_Variant, 1); variant = E_NEW(E_XKB_Variant, 1);
variant->name = eina_stringshare_add(strtok(tmp, " ")); variant->name = eina_stringshare_add(strtok(tmp, " "));
char *tok = strtok(NULL, " "); tok = strtok(NULL, " ");
*strchr(tok, ':') = '\0'; *strchr(tok, ':') = '\0';
layout = eina_list_search_unsorted(layouts, layout_sort_by_name_cb, tok); layout = eina_list_search_unsorted(layouts, layout_sort_by_name_cb, tok);
@ -177,14 +191,19 @@ parse_rules(void)
{ {
if (fgets(buf, sizeof(buf), f)) if (fgets(buf, sizeof(buf), f))
{ {
char *n = strchr(buf, '\n'); char *n;
char *p;
char *tmp;
char *name;
n = strchr(buf, '\n');
if (n) *n = '\0'; if (n) *n = '\0';
if (!buf[0]) break; if (!buf[0]) break;
char *p = buf + 2; p = buf + 2;
char *tmp = strdup(p); tmp = strdup(p);
char *name = strtok(tmp, " "); name = strtok(tmp, " ");
p += strlen(name); p += strlen(name);
while (p[0] == ' ') ++p; while (p[0] == ' ') ++p;