/* theme preview widget */ static Etk_Widget *_etk_prefs_theme_preview_get(const char *theme) { char file[PATH_MAX]; static Etk_Widget *box = NULL; Etk_Widget *widget; Etk_Widget *vbox; Etk_Widget *frame; snprintf(file, sizeof(file), PACKAGE_DATA_DIR"/themes/%s.edj", theme); if (!ecore_file_exists(file)) { char *home; home = getenv("HOME"); if (!home) return NULL; snprintf(file, sizeof(file), "%s/.e/etk/themes/%s.edj", home, theme); if (!ecore_file_exists(file)) return NULL; } free(_etk_prefs_widget_theme); _etk_prefs_widget_theme = strdup(theme); if (box) { etk_widget_theme_file_set(box, file); return box; } box = etk_vbox_new(ETK_FALSE, 0); etk_widget_theme_file_set(box, file); frame = etk_frame_new(_("Buttons")); etk_box_append(ETK_BOX(box), frame, ETK_BOX_START, ETK_BOX_NONE, 0); vbox = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(frame), vbox); widget = etk_button_new_with_label(_("Regular Button")); etk_box_append(ETK_BOX(vbox), widget, ETK_BOX_START, ETK_BOX_NONE, 0); widget = etk_check_button_new_with_label(_("Check Button")); etk_box_append(ETK_BOX(vbox), widget, ETK_BOX_START, ETK_BOX_NONE, 0); widget = etk_radio_button_new_with_label(_("Radio Button"), NULL); etk_box_append(ETK_BOX(vbox), widget, ETK_BOX_START, ETK_BOX_NONE, 0); frame = etk_frame_new(_("Text")); etk_box_append(ETK_BOX(box), frame, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); vbox = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(frame), vbox); widget = etk_entry_new(); etk_entry_text_set(ETK_ENTRY(widget), _("Sample text...")); etk_box_append(ETK_BOX(vbox), widget, ETK_BOX_START, ETK_BOX_NONE, 0); widget = etk_text_view_new(); etk_textblock_text_set(etk_text_view_textblock_get(ETK_TEXT_VIEW(widget)), _("Multi-line text widget!\nHow about that! (="), ETK_TRUE); etk_widget_size_request_set(widget, 320, 50); etk_box_append(ETK_BOX(vbox), widget, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); return box; }
static E_Widget * _e_widget_radio_button_handle(Enhance *en, EXML_Node *node) { E_Widget *button; Etk_Widget *w = NULL; char *label = NULL; char *group = NULL; char *id; Ecore_List *props; EXML_Node *prop; id = ecore_hash_get(node->attributes, "id"); if(!id) return NULL; props = node->children; ecore_list_first_goto(props); prop = ecore_list_current(props); while(prop != NULL) { if(!strcmp(prop->tag, "property")) { char *name; name = ecore_hash_get(prop->attributes, "name"); if(!name) { prop = ecore_list_next(props); continue; } if(!strcmp(name, "label")) { if(prop->value) label = strdup(prop->value); } else if(!strcmp(name, "group")) { if(prop->value) group = strdup(prop->value); } } prop = ecore_list_next(props); } ecore_list_first_goto(props); if(group) w = eina_hash_find(en->radio_groups, group); if(label) { if(w) button = _e_widget_new(en, node, etk_radio_button_new_with_label_from_widget(label, ETK_RADIO_BUTTON(w)), id); else button = _e_widget_new(en, node, etk_radio_button_new_with_label(label, NULL), id); } else { if(w) button = _e_widget_new(en, node, etk_radio_button_new_from_widget(ETK_RADIO_BUTTON(w)), id); else button = _e_widget_new(en, node, etk_radio_button_new(NULL), id); } if(!group) eina_hash_add(en->radio_groups, id, button->wid); E_FREE(label); E_FREE(group); return button; }