boot_panel* bootpanel_create(main_window *win) { boot_panel* pnl; Etk_Widget *scroll,*vbox, *hbox,*text,*frame; pnl = malloc(sizeof(boot_panel)); pnl->win = win; vbox = etk_vbox_new(ETK_FALSE, 5); hbox = etk_hbox_new(ETK_FALSE, 5); pnl->frame = hbox; etk_box_append(ETK_BOX(hbox), vbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); scroll = etk_scrolled_view_new (); etk_box_append(ETK_BOX(vbox), scroll, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_widget_show(scroll); pnl->eth_list = etk_tree_new(); pnl->eth_col0 = etk_tree_col_new(ETK_TREE(pnl->eth_list), _("Interfaces"), 80, 0.0); etk_tree_col_model_add(pnl->eth_col0, etk_tree_model_checkbox_new()); etk_tree_col_model_add(pnl->eth_col0, etk_tree_model_text_new()); etk_signal_connect_by_code(ETK_TREE_COL_CELL_VALUE_CHANGED_SIGNAL, ETK_OBJECT(pnl->eth_col0), ETK_CALLBACK(bootpanel_ethlist_checkbox_change_cb), pnl); etk_tree_mode_set(ETK_TREE(pnl->eth_list), ETK_TREE_MODE_LIST); etk_tree_build(ETK_TREE(pnl->eth_list)); etk_container_add(ETK_CONTAINER(scroll), pnl->eth_list); text = etk_text_view_new(); etk_widget_size_request_set(text, -1, 150); etk_object_properties_set(ETK_OBJECT(text), "focusable", ETK_FALSE, NULL); etk_textblock_text_set(ETK_TEXT_VIEW(text)->textblock, _("<p align=\"center\"><style effect=glow color1=#fa14 color2=#fe87><b>Help!</b></style>" "\n<p>When your computer boot, exalt starts and configure yours networks interfaces in the background. If you use the DHCP, your interface will get a IP address after a while.</p>" "\n<p>You can have a problem if you use a daemon as nfs-client. If the daemon need a network connection when it starts and your interface has no IP address, the daemon will not work. To avoid this problem Exalt can configure your interface in the foreground. If you select the interface in the list, Exalt will wait until your interface gets a IP address.</p>" "\n<p>If the interface doesn't get a IP address before the timeout, your computer will continue the boot process.</p>" ), ETK_TRUE); etk_box_append(ETK_BOX(hbox), text, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); frame=etk_frame_new(_("Timeout")); etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_FILL, 0); hbox = etk_hbox_new(ETK_FALSE, 5); etk_container_add(ETK_CONTAINER(frame), hbox); pnl->slider = etk_hslider_new(1,60,30,1,5); etk_box_append(ETK_BOX(hbox), pnl->slider, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_slider_label_set(ETK_SLIDER(pnl->slider), "%.0f"); etk_signal_connect_by_code(ETK_RANGE_VALUE_CHANGED_SIGNAL, ETK_OBJECT(pnl->slider), ETK_CALLBACK(bootpanel_slider_value_changed_cb), pnl); etk_slider_update_policy_set(ETK_SLIDER(pnl->slider), ETK_SLIDER_DELAYED); bootpanel_update_timeout(pnl); return pnl; }
void etk_file_cache_dialog_create() { Etk_Widget* window = NULL; Etk_Widget* tree = NULL; Etk_Tree_Col* tree_col; Etk_Widget* button; Etk_Widget* vbox; if (_etk_file_cache_dialog_running) return; _etk_file_cache_dialog_running = 1; window = etk_window_new(); etk_window_title_set(ETK_WINDOW(window), "File Cache"); etk_window_wmclass_set(ETK_WINDOW(window), "entropyfilecache", "entropyfilecache"); etk_widget_size_request_set(ETK_WIDGET(window), 450, 500); vbox = etk_vbox_new(ETK_FALSE,0); etk_container_add(ETK_CONTAINER(window), vbox); tree = etk_tree_new(); etk_box_append(ETK_BOX(vbox), tree, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_tree_mode_set(ETK_TREE(tree), ETK_TREE_MODE_LIST); tree_col = etk_tree_col_new(ETK_TREE(tree), _("Listeners"), 125,0.0); etk_tree_col_model_add(tree_col, etk_tree_model_text_new()); // Not yet implemented in Tree2 //etk_tree_col_sort_func_set(tree_col, _entropy_etk_file_cache_dialog_listener_compare_cb, NULL); tree_col = etk_tree_col_new(ETK_TREE(tree), _("Filename"), 150, 0.0); etk_tree_col_model_add(tree_col, etk_tree_model_text_new()); etk_tree_col_expand_set(tree_col, ETK_TRUE); etk_tree_build(ETK_TREE(tree)); etk_file_cache_dialog_refresh(tree); button = etk_button_new_with_label("Refresh"); etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(_etk_file_cache_dialog_refresh_cb), tree); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_END, ETK_BOX_NONE, 0); etk_signal_connect ("delete_event", ETK_OBJECT (window), ETK_CALLBACK (_etk_file_cache_debug_dialog_delete_cb), window); etk_widget_show_all(window); }
main_window* mainwindow_create() {/*{{{*/ Etk_Widget *hbox,*scroll; main_window* win; win=(main_window*)malloc((unsigned int)sizeof(main_window)); win->win = etk_window_new(); etk_window_title_set(ETK_WINDOW(win->win), _("Exalt: network manager")); etk_window_wmclass_set(ETK_WINDOW(win->win),"Exalt_network_manager","Exalt_network_manager"); etk_window_resize(ETK_WINDOW(win->win), 623,268); etk_signal_connect("delete-event", ETK_OBJECT(win->win), ETK_CALLBACK( mainWindow_close), win); hbox = etk_hbox_new(ETK_FALSE, 5); etk_container_add(ETK_CONTAINER(win->win), hbox); scroll = etk_scrolled_view_new (); etk_box_append(ETK_BOX(hbox), scroll, ETK_BOX_START, ETK_BOX_FILL, 0); etk_widget_show(scroll); win->eth_list = etk_tree_new(); etk_widget_size_request_set(win->eth_list, 120, 50); win->eth_col0 = etk_tree_col_new(ETK_TREE(win->eth_list), _("Interfaces"), 80, 0.0); etk_tree_col_model_add(win->eth_col0, etk_tree_model_image_new()); etk_tree_col_model_add(win->eth_col0, etk_tree_model_text_new()); etk_tree_rows_height_set(ETK_TREE(win->eth_list),40); etk_tree_mode_set(ETK_TREE(win->eth_list), ETK_TREE_MODE_LIST); etk_tree_build(ETK_TREE(win->eth_list)); etk_container_add(ETK_CONTAINER(scroll), win->eth_list); etk_signal_connect("row-clicked", ETK_OBJECT(win->eth_list),ETK_CALLBACK(mainWindow_ethList_row_clicked_cb), win); //add the general panel in the list etk_tree_row_append(ETK_TREE(win->eth_list), NULL, win->eth_col0,PACKAGE_DATA_DIR ICONS_NETWORK_CONFIG,NULL,_("General") , NULL); //attach the add callback function to exalt exalt_eth_set_cb(mainWindow_eth_cb, win); etk_widget_show_all(win->win); win->eth_panel = ethpanel_create(win); etk_box_append(ETK_BOX(hbox),win->eth_panel->frame , ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); win->wireless_panel = wirelesspanel_create(win); etk_box_append(ETK_BOX(hbox),win->wireless_panel->frame , ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); win->general_panel = generalpanel_create(); etk_box_append(ETK_BOX(hbox),win->general_panel->frame , ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //launch the timer to update the network state //win->eth_state_timer = ecore_timer_add(MAINWINDOW_ETH_STATE_TIME_MAX ,mainWindow_eth_state_timer,win); return win; }/*}}}*/
/*** Implementation ***/ Etk_Widget* tree_create(void) { //UI_GroupsComboBox UI_GroupsComboBox = etk_combobox_entry_new_default(); etk_combobox_entry_items_height_set(ETK_COMBOBOX_ENTRY(UI_GroupsComboBox), 18); etk_combobox_entry_autosearch_set(ETK_COMBOBOX_ENTRY(UI_GroupsComboBox), GROUP_COMBO_AUTOSEARCH_COL, strcasestr); etk_signal_connect("active-item-changed", ETK_OBJECT(UI_GroupsComboBox), ETK_CALLBACK(_tree_combobox_active_item_changed_cb), NULL); //UI_PartsTree Etk_Tree_Col *col; UI_PartsTree = etk_tree_new(); etk_widget_padding_set(UI_PartsTree,2,2,2,2); etk_tree_mode_set(ETK_TREE(UI_PartsTree), ETK_TREE_MODE_TREE); etk_tree_headers_visible_set(ETK_TREE(UI_PartsTree), ETK_FALSE); etk_widget_size_request_set(UI_PartsTree, 260, 300); //Main column col = etk_tree_col_new(ETK_TREE(UI_PartsTree), "File contents",100,0); etk_tree_col_model_add(col,etk_tree_model_image_new()); etk_tree_col_model_add(col,etk_tree_model_text_new()); etk_tree_col_resizable_set(col, ETK_FALSE); etk_tree_col_expand_set(col,ETK_TRUE); //Visibility column col = etk_tree_col_new(ETK_TREE(UI_PartsTree), "vis", 10,0); etk_tree_col_visible_set(col, DEBUG_MODE); etk_tree_col_model_add(col,etk_tree_model_checkbox_new()); etk_tree_col_resizable_set(col, ETK_FALSE); etk_tree_col_expand_set(col,ETK_FALSE); //RowType column col = etk_tree_col_new(ETK_TREE(UI_PartsTree), "type",10, 0); etk_tree_col_model_add(col,etk_tree_model_int_new()); etk_tree_col_visible_set(col, DEBUG_MODE); etk_tree_col_resizable_set(col, ETK_FALSE); etk_tree_col_expand_set(col,ETK_FALSE); //Parent part row col = etk_tree_col_new(ETK_TREE(UI_PartsTree), "parent",100, 0); etk_tree_col_model_add(col,etk_tree_model_text_new()); etk_tree_col_visible_set(col, DEBUG_MODE); etk_tree_col_resizable_set(col, ETK_FALSE); etk_tree_col_expand_set(col,ETK_FALSE); etk_tree_build(ETK_TREE(UI_PartsTree)); etk_signal_connect("row-selected", ETK_OBJECT(UI_PartsTree), ETK_CALLBACK(_tree_row_selected_cb), NULL); etk_signal_connect("row-clicked", ETK_OBJECT(UI_PartsTree), ETK_CALLBACK(_tree_click_cb), NULL); //vbox Etk_Widget *vbox; vbox = etk_vbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(vbox), UI_GroupsComboBox, ETK_BOX_START, ETK_BOX_NONE, 0); etk_box_append(ETK_BOX(vbox), UI_PartsTree, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); return vbox; }
static Etk_Widget *_etk_prefs_other_tab_create() { Eina_List *engines; Eina_List *l; char *engine; Etk_Widget *engine_list; Etk_Widget *frame; Etk_Widget *vbox; Etk_Tree_Col *col1; Etk_Tree_Row *row; /* main vbox */ vbox = etk_vbox_new(ETK_FALSE, 0); /* tree to hold the engines list */ engine_list = etk_tree_new(); etk_widget_size_request_set(engine_list, 180, 240); etk_tree_mode_set(ETK_TREE(engine_list), ETK_TREE_MODE_LIST); etk_tree_multiple_select_set(ETK_TREE(engine_list), ETK_FALSE); etk_tree_rows_height_set(ETK_TREE(engine_list), 45); etk_tree_headers_visible_set(ETK_TREE(engine_list), ETK_FALSE); etk_signal_connect("row-selected", ETK_OBJECT(engine_list), ETK_CALLBACK(_etk_prefs_engine_row_selected_cb), NULL); col1 = etk_tree_col_new(ETK_TREE(engine_list), "Engines", 150, 0.0); etk_tree_col_model_add(col1, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(engine_list)); /* scan for engines and add them to the list */ engines = etk_engine_list_get(); for(l = engines; l; l = l->next) { const char *engine_current = etk_config_engine_get(); engine = l->data; row = etk_tree_row_append(ETK_TREE(engine_list), NULL, col1, engine, NULL); if (engine_current) if (!strcmp(engine, engine_current)) etk_tree_row_select(row); } /* pack tree */ etk_box_append(ETK_BOX(vbox), engine_list, ETK_BOX_START, ETK_BOX_NONE, 0); etk_container_border_width_set(ETK_CONTAINER(vbox), 5); frame = etk_frame_new(_("Engines")); etk_container_add(ETK_CONTAINER(frame), vbox); return frame; }
void fill_tree_with_db(Etk_Tree *tree) { int num, i; char **entries; char *cover_path; Etk_Tree_Col *col; Etk_Tree_Row *row; Eet_File *ef; char *cover_db_path; asprintf(&cover_db_path, "%s/.e/apps/emphasis/cover.eet", getenv("HOME")); ef = eet_open(cover_db_path, EET_FILE_MODE_READ); if (!ef) { fprintf(stderr, "Can't open %s\n", cover_db_path); free(cover_db_path); exit(-1); } col = etk_tree_col_new(tree, "/artist/album", 0, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(tree); etk_tree_freeze(tree); entries = eet_list(ef, "*", &num); for (i=0; i<num; i++) { cover_path = eet_read(ef, entries[i], NULL); row = etk_tree_row_append(tree, NULL, col, entries[i], NULL); if (strcmp("not found", cover_path)) { etk_tree_row_data_set(row, cover_path); } else { etk_tree_row_data_set(row, NULL); } } eet_close(ef); free(cover_db_path); etk_tree_col_sort_set(etk_tree_nth_col_get(tree, 0), tree_sort, NULL); etk_tree_thaw(tree); }
/*** Implementation ***/ Etk_Widget* image_frame_create(void) { Etk_Widget *label; Etk_Widget *table; Etk_Tree_Col *col1; //table table = etk_table_new(6, 5, ETK_TABLE_NOT_HOMOGENEOUS); //AddImageButton UI_ImageAddButton = etk_button_new_from_stock(ETK_STOCK_IMAGE_X_GENERIC); etk_object_properties_set(ETK_OBJECT(UI_ImageAddButton), "label", "Choose Image", NULL); etk_table_attach_default(ETK_TABLE(table), UI_ImageAddButton, 0, 2, 0, 0); //ImageName UI_ImageNameLabel = etk_label_new("none"); etk_object_properties_set(ETK_OBJECT(UI_ImageNameLabel), "xalign", 0.5, NULL); etk_table_attach_default(ETK_TABLE(table), UI_ImageNameLabel, 3, 5, 0, 0); //ImageTweenVBox UI_ImageTweenVBox = etk_vbox_new(ETK_TRUE, 0); etk_table_attach_default(ETK_TABLE(table), UI_ImageTweenVBox, 0, 1, 1, 1); //AddTweenButton UI_AddTweenButton = etk_button_new_from_stock(ETK_STOCK_LIST_ADD); etk_button_style_set(ETK_BUTTON(UI_AddTweenButton), ETK_BUTTON_ICON); etk_signal_connect("clicked", ETK_OBJECT(UI_AddTweenButton), ETK_CALLBACK(_window_all_button_click_cb), (void*)IMAGE_TWEEN_ADD); etk_box_append(ETK_BOX(UI_ImageTweenVBox), UI_AddTweenButton, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //DeleteTweenButton UI_DeleteTweenButton = etk_button_new_from_stock(ETK_STOCK_LIST_REMOVE); etk_button_style_set(ETK_BUTTON(UI_DeleteTweenButton), ETK_BUTTON_ICON); etk_signal_connect("clicked", ETK_OBJECT(UI_DeleteTweenButton), ETK_CALLBACK(_window_all_button_click_cb), (void*)IMAGE_TWEEN_DELETE); etk_box_append(ETK_BOX(UI_ImageTweenVBox), UI_DeleteTweenButton, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //MoveUpTweenButton UI_MoveUpTweenButton = etk_button_new_from_stock(ETK_STOCK_GO_UP); etk_button_style_set(ETK_BUTTON(UI_MoveUpTweenButton), ETK_BUTTON_ICON); etk_signal_connect("clicked", ETK_OBJECT(UI_MoveUpTweenButton), ETK_CALLBACK(_window_all_button_click_cb), (void*)IMAGE_TWEEN_UP); etk_box_append(ETK_BOX(UI_ImageTweenVBox), UI_MoveUpTweenButton, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //MoveDownTweenButton UI_MoveDownTweenButton = etk_button_new_from_stock(ETK_STOCK_GO_DOWN); etk_button_style_set(ETK_BUTTON(UI_MoveDownTweenButton), ETK_BUTTON_ICON); etk_signal_connect("clicked", ETK_OBJECT(UI_MoveDownTweenButton), ETK_CALLBACK(_window_all_button_click_cb), (void*)IMAGE_TWEEN_DOWN); etk_box_append(ETK_BOX(UI_ImageTweenVBox), UI_MoveDownTweenButton, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //ImageTweenList UI_ImageTweenList = etk_tree_new(); etk_tree_mode_set(ETK_TREE(UI_ImageTweenList), ETK_TREE_MODE_LIST); etk_tree_headers_visible_set(ETK_TREE(UI_ImageTweenList), FALSE); // etk_tree_multiple_select_set(ETK_TREE(UI_ImageTweenList), ETK_TRUE); col1 = etk_tree_col_new(ETK_TREE(UI_ImageTweenList), "Tween", 130, 0.0); etk_tree_col_model_add(col1, etk_tree_model_image_new()); etk_tree_col_model_add(col1, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(UI_ImageTweenList)); etk_table_attach_default(ETK_TABLE(table),UI_ImageTweenList, 2, 5, 1, 1); label = etk_label_new("Alpha"); etk_table_attach_default(ETK_TABLE(table),label, 0, 0, 2, 2); //ImageAlphaSlider UI_ImageAlphaSlider = etk_hslider_new(0, 255, 15, 1,20); etk_slider_label_set(ETK_SLIDER(UI_ImageAlphaSlider), "%.0f"); etk_table_attach_default(ETK_TABLE(table),UI_ImageAlphaSlider, 1, 5, 2, 2); label = etk_label_new("Left"); etk_object_properties_set(ETK_OBJECT(label), "xalign",0.5,NULL); etk_table_attach_default(ETK_TABLE(table),label, 1, 1, 3, 3); label = etk_label_new("Right"); etk_object_properties_set(ETK_OBJECT(label), "xalign",0.5,NULL); etk_table_attach_default(ETK_TABLE(table),label, 2, 2, 3, 3); label = etk_label_new("Top"); etk_object_properties_set(ETK_OBJECT(label), "xalign",0.5,NULL); etk_table_attach_default(ETK_TABLE(table),label, 3, 3, 3, 3); label = etk_label_new("Bottom"); etk_object_properties_set(ETK_OBJECT(label), "xalign",0.5,NULL); etk_table_attach_default(ETK_TABLE(table),label, 4, 4, 3, 3); label = etk_label_new("Border"); //etk_object_properties_set(ETK_OBJECT(label), "xalign", 0.5, NULL); etk_table_attach_default(ETK_TABLE(table),label, 0, 0, 4, 4); //UI_BorderLeftSpinner UI_BorderLeftSpinner = etk_spinner_new(0, 500, 0, 1, 10); etk_widget_size_request_set(UI_BorderLeftSpinner,45, 20); etk_table_attach_default(ETK_TABLE(table),UI_BorderLeftSpinner, 1, 1, 4, 4); //UI_BorderRightSpinner UI_BorderRightSpinner = etk_spinner_new(0, 500, 0, 1, 10); etk_widget_size_request_set(UI_BorderRightSpinner,45, 20); etk_table_attach_default(ETK_TABLE(table),UI_BorderRightSpinner, 2, 2, 4, 4); //UI_BorderTopSpinner UI_BorderTopSpinner = etk_spinner_new(0, 500, 0, 1, 10); etk_widget_size_request_set(UI_BorderTopSpinner,45, 20); etk_table_attach_default(ETK_TABLE(table),UI_BorderTopSpinner, 3, 3, 4, 4); //UI_BorderBottomSpinner UI_BorderBottomSpinner = etk_spinner_new(0, 500, 0, 1, 10); etk_widget_size_request_set(UI_BorderBottomSpinner,45, 20); etk_table_attach_default(ETK_TABLE(table),UI_BorderBottomSpinner, 4, 4, 4, 4); //UI_BorderMiddleCheck UI_BorderMiddleCheck = etk_check_button_new_with_label("Mid"); etk_table_attach_default(ETK_TABLE(table),UI_BorderMiddleCheck, 5, 5, 4, 4); etk_signal_connect("row-selected", ETK_OBJECT(UI_ImageTweenList), ETK_CALLBACK(_image_TweenList_row_selected_cb), NULL); etk_signal_connect("clicked", ETK_OBJECT(UI_ImageAddButton), ETK_CALLBACK(_window_all_button_click_cb), (void*)IMAGE_BROWSER_SHOW); etk_signal_connect("value-changed", ETK_OBJECT(UI_ImageAlphaSlider), ETK_CALLBACK(_image_AlphaSlider_value_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_BorderLeftSpinner), ETK_CALLBACK(_image_border_spinners_value_changed_cb), (void *)BORDER_LEFT); etk_signal_connect("value-changed", ETK_OBJECT(UI_BorderRightSpinner), ETK_CALLBACK(_image_border_spinners_value_changed_cb), (void *)BORDER_RIGHT); etk_signal_connect("value-changed", ETK_OBJECT(UI_BorderTopSpinner), ETK_CALLBACK(_image_border_spinners_value_changed_cb), (void *)BORDER_TOP); etk_signal_connect("value-changed", ETK_OBJECT(UI_BorderBottomSpinner), ETK_CALLBACK(_image_border_spinners_value_changed_cb), (void *)BORDER_BOTTOM); etk_signal_connect("toggled", ETK_OBJECT(UI_BorderMiddleCheck), ETK_CALLBACK(_image_BorderMiddleCheck_toggled_cb), NULL); return table; }
/* theme page */ static Etk_Widget *_etk_prefs_theme_tab_create() { Eina_List *themes; Eina_List *l; char *theme; Etk_Widget *preview; Etk_Widget *theme_list; Etk_Widget *preview_hbox; Etk_Widget *frame; Etk_Widget *vbox; Etk_Tree_Col *col1; Etk_Tree_Row *row; /* main vbox */ vbox = etk_vbox_new(ETK_FALSE, 0); /* hbox to hold tree and preview */ preview_hbox = etk_hbox_new(ETK_FALSE, 5); etk_box_append(ETK_BOX(vbox), preview_hbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); /* the preview */ preview = etk_frame_new(_("Preview")); /* tree to hold the theme list */ theme_list = etk_tree_new(); etk_widget_size_request_set(theme_list, 180, 240); etk_tree_mode_set(ETK_TREE(theme_list), ETK_TREE_MODE_LIST); etk_tree_multiple_select_set(ETK_TREE(theme_list), ETK_FALSE); etk_tree_rows_height_set(ETK_TREE(theme_list), 45); etk_tree_headers_visible_set(ETK_TREE(theme_list), ETK_FALSE); etk_signal_connect("row-selected", ETK_OBJECT(theme_list), ETK_CALLBACK(_etk_prefs_theme_row_selected_cb), preview); col1 = etk_tree_col_new(ETK_TREE(theme_list), "Themes", 150, 0.0); etk_tree_col_model_add(col1, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(theme_list)); /* scan for themes and add them to the list */ themes = etk_theme_widget_available_themes_get(); for(l = themes; l; l = l->next) { const char *widget_theme = etk_config_widget_theme_get(); theme = l->data; row = etk_tree_row_append(ETK_TREE(theme_list), NULL, col1, theme, NULL); if (widget_theme) if (!strcmp(theme, widget_theme)) etk_tree_row_select(row); } /* pack tree + preview widget */ etk_box_append(ETK_BOX(preview_hbox), theme_list, ETK_BOX_START, ETK_BOX_NONE, 0); etk_box_append(ETK_BOX(preview_hbox), preview, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_container_border_width_set(ETK_CONTAINER(vbox), 5); /* add frame */ frame = etk_frame_new(_("Themes")); etk_container_add(ETK_CONTAINER(frame), vbox); return frame; }
entropy_gui_component_instance * entropy_plugin_layout_create (entropy_core * core) { Etk_Widget *window; entropy_layout_gui *gui; entropy_gui_component_instance *layout; void *(*local_plugin_init) (entropy_core * core, entropy_gui_component_instance *, void *data); entropy_plugin *local; entropy_plugin *meta; entropy_plugin *hover; entropy_plugin *trackback; entropy_gui_component_instance* meta_instance; entropy_gui_component_instance* hover_instance; Etk_Tree_Col* col; Etk_Widget* vbox; Etk_Widget* menubar; Etk_Widget* menu_item; Etk_Widget* menu; Eina_List* structures; Entropy_Config_Structure* structure; int local_viewer_selected = 0; /*Entropy related init */ layout = (entropy_gui_component_instance*)entropy_gui_component_instance_layout_new(); /*Create a component instance */ gui = entropy_malloc (sizeof (entropy_layout_gui)); layout->data = gui; layout->core = core; gui->progress_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); gui->properties_request_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); /*Global init for all layouts*/ if (!_etk_layout_global_init) { /*Request metadata groups from evfs*/ entropy_plugin_filesystem_metadata_groups_get(layout); _etk_layout_row_reference = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); _etk_layout_structure_plugin_reference = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); _etk_layout_global_init = 1; } /*Register this layout container with the core, so our children can get events */ entropy_core_layout_register (core, layout); /*Register this instance (the layout itself), to receive events that can be safely handled * by the layout (and reduce the clutter in the child plugins) * i.e. PROGRESS events, Stat for properties, Overwrite yes/no/etc events, etc*/ /*Handle progress events*/ entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_FILE_PROGRESS)); /*We want to know if the backend needs feedback */ entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_USER_INTERACTION_YES_NO_ABORT)); /*We want to know if a stat is an 'extended stat' - e.g. a properties dialog etc */ entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_EXTENDED_STAT)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_FILE_STAT)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_FILE_STAT_AVAILABLE)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_METADATA_GROUPS)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_PASTE_REQUEST)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_AUTH_REQUEST)); entropy_core_component_event_register (layout, entropy_core_gui_event_get (ENTROPY_GUI_EVENT_META_ALL_REQUEST)); /*Etk related init */ window = etk_window_new (); layout->gui_object = window; etk_signal_connect("key-down", ETK_OBJECT(window), ETK_CALLBACK(_entropy_etk_layout_key_down_cb), layout); gui->paned = etk_hpaned_new(); etk_signal_connect ("delete-event", ETK_OBJECT (window), ETK_CALLBACK (_etk_window_deleted_cb), layout); etk_window_title_set(ETK_WINDOW(window), "Entropy"); etk_window_wmclass_set(ETK_WINDOW(window), "entropy", "Entropy"); vbox = etk_vbox_new(ETK_FALSE,0); etk_container_add(ETK_CONTAINER(window), vbox); /*Tree init*/ gui->tree = etk_tree_new(); gui->tree_shell = etk_vbox_new(ETK_FALSE,0); etk_box_append(ETK_BOX(gui->tree_shell), gui->tree, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_paned_child1_set(ETK_PANED(gui->paned), gui->tree_shell, ETK_FALSE); etk_tree_mode_set(ETK_TREE(gui->tree), ETK_TREE_MODE_TREE); col = etk_tree_col_new(ETK_TREE(gui->tree), _("Folders"), 60,0.0); etk_tree_col_model_add(col, etk_tree_model_image_new()); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_col_expand_set(col, ETK_TRUE); etk_tree_build(ETK_TREE(gui->tree)); etk_widget_size_request_set(ETK_WIDGET(gui->tree), ENTROPY_ETK_WINDOW_PANE_DEFAULT_X, 50); /*Register to receive events related to the treeview config*/ entropy_config_misc_callback_register("general.treeviewer", _entropy_layout_etk_simple_config_cb, gui); /*If we're configured not to show tree on start, don't show*/ if (!entropy_config_misc_is_set("general.treeviewer")) { entropy_etk_layout_tree_show(gui,0); } else { etk_paned_position_set(ETK_PANED(gui->paned), ENTROPY_ETK_WINDOW_PANE_DEFAULT_X); } /*LocalShell Init*/ gui->localshell = etk_vbox_new(ETK_TRUE,0); etk_paned_child2_set(ETK_PANED(gui->paned), gui->localshell, ETK_TRUE); /*Trackback container init*/ gui->trackback_shell = etk_vbox_new(ETK_TRUE,0); /*Popup init*/ gui->popup = etk_menu_new(); etk_signal_connect("row-clicked", ETK_OBJECT( gui->tree ), ETK_CALLBACK(_etk_layout_row_clicked), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Delete this location"), ETK_STOCK_DOCUMENT_OPEN, ETK_MENU_SHELL(gui->popup),NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_etk_layout_location_delete_confirm_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Add a new location"), ETK_STOCK_DOCUMENT_OPEN, ETK_MENU_SHELL(gui->popup),NULL); for (structures = entropy_config_standard_structures_parse (layout, NULL); structures; ) { structure = structures->data; layout_etk_simple_add_header (layout,structure); structures = structures->next; } /*Initialise the list view*/ local = entropy_plugin_gui_get_by_name_toolkit(ENTROPY_TOOLKIT_ETK, "listviewer"); if (local) { local_plugin_init = dlsym (local->dl_ref, "entropy_plugin_gui_instance_new"); gui->list_viewer = (*local_plugin_init)(core, layout,NULL); gui->list_viewer->plugin = local; if (entropy_config_misc_is_set("general.listviewer")) { gui->list_viewer->active=1; local_viewer_selected = 1; etk_widget_show(gui->list_viewer->gui_object); etk_box_append(ETK_BOX(gui->localshell), gui->list_viewer->gui_object, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); } else { gui->list_viewer->active=0; etk_widget_show(gui->list_viewer->gui_object); } } /*Initialise the icon viewer*/ /*Initialise the list view*/ local = entropy_plugin_gui_get_by_name_toolkit(ENTROPY_TOOLKIT_ETK, "iconviewer"); if (local) { local_plugin_init = dlsym (local->dl_ref, "entropy_plugin_gui_instance_new"); gui->iconbox_viewer = (*local_plugin_init)(core, layout,NULL); gui->iconbox_viewer->plugin = local; if (entropy_config_misc_is_set("general.iconviewer")) { gui->iconbox_viewer->active=1; local_viewer_selected = 1; etk_widget_show(gui->iconbox_viewer->gui_object); etk_box_append(ETK_BOX(gui->localshell), gui->iconbox_viewer->gui_object, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); } else { gui->iconbox_viewer->active=0; etk_widget_show(gui->iconbox_viewer->gui_object); } } /*Initialise the metadata plugin*/ meta = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT, ENTROPY_PLUGIN_GUI_COMPONENT_INFO_PROVIDER); if (meta) { local_plugin_init = dlsym(meta->dl_ref, "entropy_plugin_gui_instance_new"); meta_instance = (*local_plugin_init)(core,layout,NULL); meta_instance->plugin = meta; } /*Initialise the hover viewer*/ hover = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT, ENTROPY_PLUGIN_GUI_COMPONENT_HOVER_PROVIDER); if (hover) { local_plugin_init = dlsym(hover->dl_ref, "entropy_plugin_gui_instance_new"); hover_instance = (*local_plugin_init)(core,layout,NULL); hover_instance->plugin = hover; } /*Initialise the trackback*/ trackback = entropy_plugin_gui_get_by_name_toolkit(ENTROPY_TOOLKIT_ETK, "trackback"); if (trackback) { local_plugin_init = dlsym (trackback->dl_ref, "entropy_plugin_gui_instance_new"); gui->trackback = (*local_plugin_init)(core, layout,NULL); gui->trackback->plugin = trackback; gui->trackback->active=1; if (entropy_config_misc_is_set("general.trackback")) { etk_box_append(ETK_BOX(gui->trackback_shell), gui->trackback->gui_object, ETK_BOX_START, ETK_BOX_NONE, 0); } entropy_config_misc_callback_register("general.trackback", _entropy_layout_etk_simple_config_cb, gui); } /*Menu setup*/ menubar = etk_menu_bar_new(); /*File menu*/ menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("File"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Exit"), ETK_STOCK_SYSTEM_SHUTDOWN, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_layout_simple_exit_cb), layout); /*Edit menu*/ menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Edit"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Cut"), ETK_STOCK_EDIT_CUT, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_layout_etk_cut_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Copy"), ETK_STOCK_EDIT_COPY, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_layout_etk_copy_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Paste"), ETK_STOCK_EDIT_PASTE, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_layout_etk_paste_cb), layout); /*Tools menu*/ menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Tools"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Add Location"), ETK_STOCK_ADDRESS_BOOK_NEW, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_location_add_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("eFolder Wizard.."), ETK_STOCK_ADDRESS_BOOK_NEW, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_etk_efolder_dialog_show_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Program Associations.."), ETK_STOCK_EMBLEM_SYMBOLIC_LINK, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_mime_dialog_cb), layout); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Options.."), ETK_STOCK_EMBLEM_SYMBOLIC_LINK, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(entropy_etk_options_dialog_cb), layout); /*View menu*/ menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("View"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); gui->tree_view_menu = _entropy_etk_menu_check_item_new(_("Tree View"), ETK_MENU_SHELL(menu)); if (entropy_config_misc_is_set("general.treeviewer")) { etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(gui->tree_view_menu),ETK_TRUE ); } etk_signal_connect("activated", ETK_OBJECT(gui->tree_view_menu), ETK_CALLBACK(entropy_etk_layout_tree_cb), layout); menu_item = _entropy_etk_menu_check_item_new(_("Trackback view"), ETK_MENU_SHELL(menu)); if (entropy_config_misc_is_set("general.trackback")) { etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(menu_item), ETK_TRUE); } etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(entropy_etk_layout_trackback_cb), layout); _entropy_etk_menu_item_new(ETK_MENU_ITEM_SEPARATOR, NULL, ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), NULL); menu_item = _entropy_etk_radio_item_new(_("List View (Alt-l)"), NULL, ETK_MENU_SHELL(menu)); etk_object_data_set(ETK_OBJECT(menu_item), "VISUAL", gui->list_viewer); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_local_viewer_cb), layout); if (entropy_config_misc_is_set("general.listviewer")) { etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(menu_item), ETK_TRUE); } menu_item = _entropy_etk_radio_item_new(_("Icon View (Alt-i)"), ETK_MENU_ITEM_RADIO(menu_item), ETK_MENU_SHELL(menu)); etk_object_data_set(ETK_OBJECT(menu_item), "VISUAL", gui->iconbox_viewer); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_local_viewer_cb), layout); if (entropy_config_misc_is_set("general.iconviewer")) { etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(menu_item), ETK_TRUE); } /*Debug menu*/ /*menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Debug"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("File Cache"), ETK_STOCK_PLACES_FOLDER_SAVED_SEARCH, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_file_cache_dialog_cb), layout);*/ /*Help menu*/ menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Help"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); menu = etk_menu_new(); etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu)); menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("About.."), ETK_STOCK_HELP_BROWSER, ETK_MENU_SHELL(menu), NULL); etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(entropy_etk_about_dialog_cb), layout); etk_box_append(ETK_BOX(vbox), menubar, ETK_BOX_START, ETK_BOX_NONE, 0); etk_box_append(ETK_BOX(vbox), gui->trackback_shell, ETK_BOX_START, ETK_BOX_NONE, 0); etk_box_append(ETK_BOX(vbox), gui->paned, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); /*---------------------------*/ gui->statusbar_box = etk_hbox_new(ETK_TRUE, 0); etk_box_append(ETK_BOX(vbox), gui->statusbar_box, ETK_BOX_START, ETK_BOX_NONE, 0); gui->statusbars[0] = etk_statusbar_new(); etk_statusbar_has_resize_grip_set(ETK_STATUSBAR(gui->statusbars[0]), ETK_FALSE); etk_box_append(ETK_BOX(gui->statusbar_box), gui->statusbars[0], ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); gui->statusbars[1] = etk_statusbar_new(); etk_statusbar_has_resize_grip_set(ETK_STATUSBAR(gui->statusbars[1]), ETK_FALSE); etk_box_append(ETK_BOX(gui->statusbar_box), gui->statusbars[1], ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); gui->statusbars[2] = etk_statusbar_new(); etk_statusbar_has_resize_grip_set(ETK_STATUSBAR(gui->statusbars[2]), ETK_TRUE); etk_box_append(ETK_BOX(gui->statusbar_box), gui->statusbars[2], ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_widget_show_all (window); /*Increment the window counter*/ _etk_layout_window_count++; etk_window_resize(ETK_WINDOW(window), ENTROPY_ETK_WINDOW_WIDTH, ENTROPY_ETK_WINDOW_HEIGHT); return layout; }
int main (int argc, char *argv[]) { Etk_Widget *window; Etk_Widget *hpaned, *vpaned; Etk_Widget *tree; Etk_Widget *list; Etk_Widget *pdf; Etk_Tree_Col *col; Etk_Tree_Row *row; Ecore_List *index; Epdf_Document *document; int page_count; int i; if (argc == 1) { printf ("Usage: %s pdf_file\n", argv[0]); return -1; } etk_init (argc, argv); /* We open the pdf file */ pdf = etk_pdf_new (); etk_pdf_file_set (ETK_PDF (pdf), argv[1]); document = ETK_PDF (pdf)->pdf_document; if (!document) { printf ("The file %s can't be opened\n", argv[1]); etk_shutdown (); return -1; } window = etk_window_new (); etk_window_title_set (ETK_WINDOW (window), "Etk Pdf Test Application"); etk_signal_connect ("delete-event", ETK_OBJECT (window), ETK_CALLBACK(_quit_cb), NULL); hpaned = etk_hpaned_new(); etk_container_add (ETK_CONTAINER (window), hpaned); etk_widget_show (hpaned); vpaned = etk_vpaned_new(); etk_paned_child1_set (ETK_PANED (hpaned), vpaned, 0); etk_widget_show (vpaned); index = etk_pdf_pdf_index_get (ETK_PDF (pdf)); if (index) { Etk_Tree_Col *col; tree = etk_tree_new (); etk_tree_mode_set (ETK_TREE (tree), ETK_TREE_MODE_TREE); etk_tree_multiple_select_set (ETK_TREE (tree), ETK_FALSE); /* column */ col = etk_tree_col_new (ETK_TREE (tree), "Index", 130, 0.0); etk_tree_col_model_add (col, etk_tree_model_text_new()); etk_tree_build (ETK_TREE (tree)); /* rows */ _tree_fill (ETK_PDF (pdf), ETK_TREE (tree), col, NULL, index); epdf_index_delete (index); /* change page */ etk_signal_connect ("row-clicked", ETK_OBJECT (tree), ETK_CALLBACK(_change_page_cb), pdf); /* we attach and show */ etk_paned_child1_set (ETK_PANED (vpaned), tree, 0); etk_widget_show (tree); } list = etk_tree_new (); etk_tree_headers_visible_set (ETK_TREE (list), ETK_FALSE); etk_tree_mode_set (ETK_TREE (list), ETK_TREE_MODE_LIST); etk_tree_multiple_select_set (ETK_TREE (list), ETK_FALSE); /* column */ col = etk_tree_col_new (ETK_TREE (list), "", 60, 0.0); etk_tree_col_model_add (col, etk_tree_model_int_new()); etk_tree_build (ETK_TREE (list)); /* rows */ page_count = epdf_document_page_count_get (ETK_PDF (pdf)->pdf_document); for (i = 0; i < page_count; i++) { int *num; row = etk_tree_row_append (ETK_TREE (list), NULL, col, i + 1, NULL); num = (int *)malloc (sizeof (int)); *num = i; etk_tree_row_data_set_full (row, num, free); } /* change page */ etk_signal_connect ("row-clicked", ETK_OBJECT (list), ETK_CALLBACK(_change_page_cb), pdf); /* we attach and show */ etk_paned_child2_set (ETK_PANED (vpaned), list, 0); etk_widget_show (list); etk_pdf_scale_set (ETK_PDF (pdf), 0.5, 0.5); etk_paned_child2_set (ETK_PANED (hpaned), pdf, 1); etk_widget_show (pdf); etk_widget_show (window); etk_main (); etk_shutdown (); return 0; }
static void frame_recipient_show(struct MessageNewViewData *data) { struct Window *win = data->win; window_layout_set(win, MESSAGE_FILE, "recipient_edit"); window_text_set(win, "title", D_("Define Recipients")); data->bt1 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt1, D_("Back")); evas_object_smart_callback_add(data->bt1, "clicked", frame_recipient_back_clicked, data); window_swallow(win, "button_back", data->bt1); evas_object_show(data->bt1); data->bt2 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt2, D_("Send")); evas_object_smart_callback_add(data->bt2, "clicked", frame_recipient_continue_clicked, data); window_swallow(win, "button_continue", data->bt2); evas_object_show(data->bt2); data->bt3 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt3, D_("Add Contact")); evas_object_smart_callback_add(data->bt3, "clicked", frame_recipient_contact_add_clicked, data); window_swallow(win, "button_contact_add", data->bt3); evas_object_show(data->bt3); data->bt4 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt4, D_("Add Number")); evas_object_smart_callback_add(data->bt4, "clicked", frame_recipient_number_add_clicked, data); window_swallow(win, "button_number_add", data->bt4); evas_object_show(data->bt4); data->bt5 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt5, D_("Remove")); evas_object_smart_callback_add(data->bt5, "clicked", frame_recipient_delete_clicked, data); window_swallow(win, "button_delete", data->bt5); evas_object_show(data->bt5); data->tree_recipients = etk_tree_new(); etk_tree_rows_height_set(ETK_TREE(data->tree_recipients), 80); etk_tree_mode_set(ETK_TREE(data->tree_recipients), ETK_TREE_MODE_LIST); etk_tree_headers_visible_set(ETK_TREE(data->tree_recipients), ETK_FALSE); etk_tree_multiple_select_set(ETK_TREE(data->tree_recipients), ETK_FALSE); data->col1_recipients = etk_tree_col_new(ETK_TREE(data->tree_recipients), "Title", 300, 0.0); etk_tree_col_model_add(data->col1_recipients, etk_tree_model_edje_new(CONTACTS_FILE, "row")); etk_tree_build(ETK_TREE(data->tree_recipients)); Etk_Scrolled_View *scrolled_view = etk_tree_scrolled_view_get(ETK_TREE(data->tree_recipients)); etk_scrolled_view_dragable_set(ETK_SCROLLED_VIEW(scrolled_view), ETK_TRUE); etk_scrolled_view_drag_bouncy_set(ETK_SCROLLED_VIEW(scrolled_view), ETK_FALSE); etk_scrolled_view_policy_set(ETK_SCROLLED_VIEW(scrolled_view), ETK_POLICY_HIDE, ETK_POLICY_HIDE); data->container_recipients = etk_embed_new(evas_object_evas_get (window_evas_object_get(win))); etk_container_add(ETK_CONTAINER(data->container_recipients), data->tree_recipients); etk_widget_show_all(data->container_recipients); data->container_recipients_eo = etk_embed_object_get(ETK_EMBED(data->container_recipients)); window_swallow(win, "list", data->container_recipients_eo); g_ptr_array_foreach(data->recipients, frame_recipient_process_recipient, data); }
/* Creates the window for the tree test */ void etk_test_tree_window_create(void *data) { static Etk_Widget *win = NULL; Etk_Widget *vbox; Etk_Widget *hbox; Etk_Widget *tree; Etk_Widget *button; Etk_Tree_Col *col1, *col2, *col3, *col4, *col5, *col6; Etk_Tree_Row *row; Etk_Widget *statusbar; Etk_Color c_warn; char row_name[128]; const char *stock_key; int i, j; if (win) { etk_widget_show(ETK_WIDGET(win)); return; } /* Create the window and the vbox where the widgets will be packed into */ win = etk_window_new(); etk_window_title_set(ETK_WINDOW(win), "Etk Tree Test"); etk_window_resize(ETK_WINDOW(win), 640, 500); etk_signal_connect_by_code(ETK_WINDOW_DELETE_EVENT_SIGNAL, ETK_OBJECT(win), ETK_CALLBACK(etk_window_hide_on_delete), NULL); vbox = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(win), vbox); /* Create the tree widget */ tree = etk_tree_new(); etk_tree_mode_set(ETK_TREE(tree), ETK_TREE_MODE_TREE); etk_scrolled_view_extra_vmargin_set(etk_tree_scrolled_view_get(ETK_TREE(tree)), 250); etk_scrolled_view_drag_bouncy_set(etk_tree_scrolled_view_get(ETK_TREE(tree)), ETK_BOUNCY_STOPTOOBJECT); etk_scrolled_view_dragable_set(etk_tree_scrolled_view_get(ETK_TREE(tree)), ETK_TRUE); etk_tree_multiple_select_set(ETK_TREE(tree), ETK_TRUE); etk_widget_padding_set(tree, 5, 5, 5, 5); etk_box_append(ETK_BOX(vbox), tree, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); /* We first create the columns of the tree, and then we "build" the tree with etk_tree_build() */ col1 = etk_tree_col_new(ETK_TREE(tree), "Column 1", 130, 0.0); etk_tree_col_model_add(col1, etk_tree_model_image_new()); etk_tree_col_model_add(col1, etk_tree_model_text_new()); col2 = etk_tree_col_new(ETK_TREE(tree), "Column 2", 60, 1.0); etk_tree_col_model_add(col2, etk_tree_model_double_new()); col3 = etk_tree_col_new(ETK_TREE(tree), "Column 3", 80, 0.75); etk_tree_col_model_add(col3, etk_tree_model_int_new()); col4 = etk_tree_col_new(ETK_TREE(tree), "Column 4", 60, 0.0); etk_tree_col_model_add(col4, etk_tree_model_image_new()); col5 = etk_tree_col_new(ETK_TREE(tree), "Column 5", 60, 0.5); etk_tree_col_model_add(col5, etk_tree_model_checkbox_new()); col6 = etk_tree_col_new(ETK_TREE(tree), "Column 6", 60, 0.0); etk_tree_col_model_add(col6, etk_tree_model_progress_bar_new()); etk_tree_build(ETK_TREE(tree)); /* Then we add the rows to the tree. etk_tree_freeze/thaw() is used to improve * the speed when you insert a lot of rows. It is not really important if you * insert only some thousands of rows (here, we insert 3000 rows) */ etk_tree_freeze(ETK_TREE(tree)); etk_theme_color_get(NULL, ETK_COLOR_WARNING_FG, &c_warn.r, &c_warn.g, &c_warn.b, &c_warn.a); for (i = 0; i < 1000; i++) { sprintf(row_name, "Row %d", (i * 3) + 1); stock_key = etk_stock_key_get(ETK_STOCK_PLACES_USER_HOME, ETK_STOCK_SMALL); row = etk_tree_row_append(ETK_TREE(tree), NULL, col1, etk_theme_icon_path_get(), stock_key, row_name, col2, 0.57, col3, rand(), col4, PACKAGE_DATA_DIR "/images/1star.png", NULL, col5, ETK_FALSE, col6, 0.57, "57 %", NULL); for (j = 0; j < 3; j++) { Etk_Tree_Row *current; sprintf(row_name, "Row %d", (i * 3) + 2); stock_key = etk_stock_key_get(ETK_STOCK_PLACES_FOLDER, ETK_STOCK_SMALL); current = etk_tree_row_append(ETK_TREE(tree), row, col1, etk_theme_icon_path_get(), stock_key, row_name, col2, 20.0, col3, rand(), col4, PACKAGE_DATA_DIR "/images/2stars.png", NULL, col5, ETK_TRUE, col6, 0.20, "20 %", NULL); if (j == 2) row = current; } sprintf(row_name, "<font color=#%.2X%.2X%.2X%.2X>Row %d</font>", c_warn.r, c_warn.g, c_warn.b, c_warn.a, (i * 3) + 3); stock_key = etk_stock_key_get(ETK_STOCK_TEXT_X_GENERIC, ETK_STOCK_SMALL); etk_tree_row_append(ETK_TREE(tree), row, col1, etk_theme_icon_path_get(), stock_key, row_name, col2, 300.0, col3, 257, col4, PACKAGE_DATA_DIR "/images/3stars.png", NULL, col5, ETK_TRUE, NULL); } etk_tree_thaw(ETK_TREE(tree)); etk_tree_col_sort_set(col3, _etk_test_tree_compare_cb, NULL); hbox = etk_hbox_new(ETK_TRUE, 0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_FILL, 0); button = etk_button_new_with_label("Sort the tree"); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0); etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_test_tree_sort_button_cb), col3); button = etk_button_new_with_label("Insert a sorted row"); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0); etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_test_tree_insert_sorted_button_cb), ETK_TREE(tree)); button = etk_button_new_with_label("Select all"); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0); etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_test_tree_select_all_cb), ETK_TREE(tree)); button = etk_button_new_with_label("Unselect all"); etk_box_append(ETK_BOX(hbox), button, ETK_BOX_START, ETK_BOX_EXPAND, 0); etk_signal_connect_by_code(ETK_BUTTON_CLICKED_SIGNAL, ETK_OBJECT(button), ETK_CALLBACK(_etk_test_tree_unselect_all_cb), ETK_TREE(tree)); /* Finally we create the statusbar used to display the events on the tree */ statusbar = etk_statusbar_new(); etk_box_append(ETK_BOX(vbox), statusbar, ETK_BOX_START, ETK_BOX_FILL, 0); etk_signal_connect_by_code(ETK_WIDGET_KEY_DOWN_SIGNAL, ETK_OBJECT(tree), ETK_CALLBACK(_etk_test_tree_key_down_cb), NULL); etk_signal_connect_by_code(ETK_TREE_ROW_CLICKED_SIGNAL, ETK_OBJECT(tree), ETK_CALLBACK(_etk_test_tree_row_clicked_cb), statusbar); etk_signal_connect_by_code(ETK_TREE_COL_CELL_VALUE_CHANGED_SIGNAL, ETK_OBJECT(col5), ETK_CALLBACK(_etk_test_tree_checkbox_toggled_cb), statusbar); etk_widget_show_all(win); }
Ex_Tab * _ex_tab_new(Exhibit *e, char *dir) { Ex_Tab *tab; Etk_Tree_Model *imodel; char *file; file = NULL; tab = calloc(1, sizeof(Ex_Tab)); //tab->num = eina_list_count(e->tabs); tab->dirs = NULL; if (!dir) { D(("NO DIR\n")); exit(-1); } D(("Creating new tab with %s\n", dir)); if (e->options->default_view == EX_IMAGE_FIT_TO_WINDOW) { tab->fit_window = ETK_TRUE; D(("Setting EX_IMAGE_FIT_TO_WINDOW\n")); } else tab->fit_window = ETK_FALSE; tab->comment.visible = ETK_FALSE; tab->image_loaded = ETK_FALSE; tab->dtree = etk_tree_new(); etk_widget_size_request_set(tab->dtree, 180, 120); etk_signal_connect("row-clicked", ETK_OBJECT(tab->dtree), ETK_CALLBACK(_ex_tab_dtree_item_clicked_cb), e); tab->dcol = etk_tree_col_new(ETK_TREE(tab->dtree), "Directories", 10, 0.0); etk_tree_col_model_add(tab->dcol, etk_tree_model_image_new()); etk_tree_col_model_add(tab->dcol, etk_tree_model_text_new()); etk_tree_headers_visible_set(ETK_TREE(tab->dtree), 0); etk_scrolled_view_policy_set(etk_tree_scrolled_view_get(ETK_TREE(tab->dtree)), ETK_POLICY_AUTO, ETK_POLICY_SHOW); etk_tree_build(ETK_TREE(tab->dtree)); tab->itree = etk_tree_new(); etk_scrolled_view_dragable_set(ETK_SCROLLED_VIEW(etk_tree_scrolled_view_get(ETK_TREE(tab->itree))), ETK_TRUE); etk_scrolled_view_drag_bouncy_set(ETK_SCROLLED_VIEW(etk_tree_scrolled_view_get(ETK_TREE(tab->itree))), ETK_FALSE); etk_scrolled_view_drag_damping_set(ETK_SCROLLED_VIEW(etk_tree_scrolled_view_get(ETK_TREE(tab->itree))), 300); etk_widget_dnd_source_set(ETK_WIDGET(tab->itree), ETK_TRUE); // etk_signal_connect("drag_begin", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_tab_tree_drag_begin_cb), tab); etk_widget_size_request_set(tab->itree, 180, 220); etk_tree_multiple_select_set(ETK_TREE(tab->itree), ETK_TRUE); etk_signal_connect("row-selected", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_tab_itree_item_clicked_cb), e); etk_signal_connect("key-down", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_tab_itree_key_down_cb), e); imodel = etk_tree_model_wobbly_new(); tab->imodel = imodel; //etk_tree_model_image_width_set(imodel, 80, 0.0); tab->icol = etk_tree_col_new(ETK_TREE(tab->itree), "Files", 10, 0.0); etk_tree_col_model_add(tab->icol, imodel); etk_tree_col_model_add(tab->icol, etk_tree_model_text_new()); etk_tree_headers_visible_set(ETK_TREE(tab->itree), 0); etk_tree_rows_height_set(ETK_TREE(tab->itree), 60); etk_scrolled_view_policy_set(etk_tree_scrolled_view_get(ETK_TREE(tab->itree)), ETK_POLICY_AUTO, ETK_POLICY_SHOW); etk_tree_build(ETK_TREE(tab->itree)); tab->dir = _ex_path_normalize(ecore_file_realpath(dir)); tab->alignment = etk_alignment_new(0.5, 0.5, 1.0, 1.0); tab->image = etk_image_new(); etk_widget_theme_file_set(tab->image, PACKAGE_DATA_DIR"/gui.edj"); etk_widget_theme_group_set(tab->image, "image_bg"); etk_signal_connect("mouse-down", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_down), e); etk_signal_connect("mouse-up", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_up), e); etk_signal_connect("mouse-move", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_move), e); etk_signal_connect("mouse-wheel", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_wheel), e); etk_image_keep_aspect_set(ETK_IMAGE(tab->image), ETK_TRUE); etk_container_add(ETK_CONTAINER(tab->alignment), tab->image); tab->scrolled_view = etk_scrolled_view_new(); etk_scrolled_view_policy_set(ETK_SCROLLED_VIEW(tab->scrolled_view), ETK_POLICY_HIDE, ETK_POLICY_HIDE); etk_scrolled_view_dragable_set(ETK_SCROLLED_VIEW(tab->scrolled_view), ETK_TRUE); etk_scrolled_view_drag_bouncy_set((ETK_SCROLLED_VIEW(tab->scrolled_view)), ETK_FALSE); etk_scrolled_view_add_with_viewport(ETK_SCROLLED_VIEW(tab->scrolled_view), tab->alignment); etk_widget_has_event_object_set(tab->scrolled_view, ETK_TRUE); etk_signal_connect("mouse-wheel", ETK_OBJECT(tab->scrolled_view), ETK_CALLBACK(_ex_image_mouse_wheel), e); return tab; }
struct MessageListViewData * message_list_view_show(struct Window *win, GHashTable * options) { g_debug("message_list_view_show()"); struct MessageListViewData *data = g_slice_alloc0(sizeof(struct MessageListViewData)); data->win = win; window_layout_set(win, MESSAGE_FILE, "list"); window_text_set(win, "title", D_("Inbox")); data->bt1 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt1, D_("New")); evas_object_smart_callback_add(data->bt1, "clicked", message_list_view_new_clicked, data); window_swallow(win, "button_new", data->bt1); evas_object_show(data->bt1); // Options button with hover data->hv = elm_hover_add(window_evas_object_get(win)); data->bt2 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt2, D_("Options")); evas_object_smart_callback_add(data->bt2, "clicked", my_hover_bt_1, data->hv); window_swallow(win, "button_options", data->bt2); evas_object_show(data->bt2); elm_hover_parent_set(data->hv, window_evas_object_get(win)); elm_hover_target_set(data->hv, data->bt2); data->bx = elm_box_add(window_evas_object_get(win)); elm_box_horizontal_set(data->bx, 0); elm_box_homogenous_set(data->bx, 1); evas_object_show(data->bx); data->button_answer = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->button_answer, D_("Answer")); evas_object_size_hint_min_set(data->button_answer, 130, 80); evas_object_smart_callback_add(data->button_answer, "clicked", message_list_view_answer_clicked, data); evas_object_show(data->button_answer); elm_box_pack_end(data->bx, data->button_answer); data->button_delete = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->button_delete, D_("Delete")); evas_object_size_hint_min_set(data->button_delete, 130, 80); evas_object_smart_callback_add(data->button_delete, "clicked", message_list_view_delete_clicked, data); evas_object_show(data->button_delete); elm_box_pack_end(data->bx, data->button_delete); elm_hover_content_set(data->hv, "top", data->bx); data->bt3 = elm_button_add(window_evas_object_get(win)); elm_button_label_set(data->bt3, D_("Show")); evas_object_smart_callback_add(data->bt3, "clicked", message_list_view_show_clicked, data); window_swallow(win, "button_show", data->bt3); evas_object_show(data->bt3); g_debug("tree init"); data->tree = etk_tree_new(); etk_tree_rows_height_set(ETK_TREE(data->tree), 80); etk_tree_mode_set(ETK_TREE(data->tree), ETK_TREE_MODE_LIST); etk_tree_headers_visible_set(ETK_TREE(data->tree), ETK_FALSE); etk_tree_multiple_select_set(ETK_TREE(data->tree), ETK_FALSE); data->col1 = etk_tree_col_new(ETK_TREE(data->tree), "Title", 300, 0.0); etk_tree_col_model_add(data->col1, etk_tree_model_edje_new(MESSAGE_FILE, "message_row")); etk_tree_build(ETK_TREE(data->tree)); Etk_Scrolled_View *scrolled_view = etk_tree_scrolled_view_get(ETK_TREE(data->tree)); etk_scrolled_view_dragable_set(ETK_SCROLLED_VIEW(scrolled_view), ETK_TRUE); etk_scrolled_view_drag_bouncy_set(ETK_SCROLLED_VIEW(scrolled_view), ETK_FALSE); etk_scrolled_view_policy_set(ETK_SCROLLED_VIEW(scrolled_view), ETK_POLICY_HIDE, ETK_POLICY_HIDE); data->container = etk_embed_new(evas_object_evas_get (window_evas_object_get(win))); etk_container_add(ETK_CONTAINER(data->container), data->tree); etk_widget_show_all(data->container); window_swallow(win, "list", etk_embed_object_get(ETK_EMBED(data->container))); ogsmd_sim_retrieve_messagebook("all", retrieve_messagebook_callback, data); window_show(win); return data; }
/*** Implementation ***/ Etk_Widget* data_window_create(void) { Etk_Widget *hbox, *vbox, *hbox2, *vbox2, *vbox3; Etk_Tree_Col *col; Etk_Widget *button; Etk_Widget *frame; Etk_Widget *label; //DataWin UI_DataWin = etk_window_new(); etk_window_title_set(ETK_WINDOW(UI_DataWin), "Data Browser"); etk_window_resize(ETK_WINDOW(UI_DataWin), 400, 370); etk_signal_connect("delete-event", ETK_OBJECT(UI_DataWin), ETK_CALLBACK(etk_window_hide_on_delete), NULL); etk_container_border_width_set(ETK_CONTAINER(UI_DataWin), 5); vbox = etk_vbox_new(ETK_FALSE, 5); etk_container_add(ETK_CONTAINER(UI_DataWin), vbox); //Description label label = etk_label_new("Data stored inside the edje file that can be accessed by the application."); etk_object_properties_set(ETK_OBJECT(label), "xalign", 0.5, NULL); etk_box_append(ETK_BOX(vbox), label, ETK_BOX_START, ETK_BOX_NONE, 7); hbox = etk_hbox_new(ETK_TRUE, 5); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); vbox2 = etk_vbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(hbox), vbox2, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //UI_DataList UI_DataList = etk_tree_new(); etk_tree_mode_set(ETK_TREE(UI_DataList), ETK_TREE_MODE_LIST); etk_widget_size_request_set(UI_DataList, 225, 200); etk_tree_headers_visible_set(ETK_TREE(UI_DataList), ETK_TRUE); etk_tree_column_separators_visible_set(ETK_TREE(UI_DataList), ETK_TRUE); etk_tree_alternating_row_colors_set(ETK_TREE(UI_DataList), ETK_TRUE); col = etk_tree_col_new(ETK_TREE(UI_DataList), "Name", 100, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(UI_DataList), "Value", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(UI_DataList)); etk_box_append(ETK_BOX(vbox2), UI_DataList, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_signal_connect("row-selected", ETK_OBJECT(UI_DataList), ETK_CALLBACK(_data_list_row_selected_cb), NULL); hbox2 = etk_hbox_new(ETK_TRUE, 0); etk_box_append(ETK_BOX(vbox2), hbox2, ETK_BOX_START, ETK_BOX_NONE, 0); //AddDataButton button = etk_button_new_from_stock(ETK_STOCK_LIST_ADD); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_ICON); etk_signal_connect("clicked", ETK_OBJECT(button), ETK_CALLBACK(_data_add_button_click_cb), NULL); etk_box_append(ETK_BOX(hbox2), button, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //DelDataButton button = etk_button_new_from_stock(ETK_STOCK_LIST_REMOVE); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_ICON); etk_signal_connect("clicked", ETK_OBJECT(button), ETK_CALLBACK(_data_del_button_click_cb), NULL); etk_box_append(ETK_BOX(hbox2), button, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); vbox2 = etk_vbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(hbox), vbox2, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //Data Editor frame = etk_frame_new("Data Editor"); etk_box_append(ETK_BOX(vbox2), frame, ETK_BOX_START, ETK_BOX_FILL, 0); vbox3 = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(frame), vbox3); //Name Entry label = etk_label_new("<b>Name</b>"); etk_box_append(ETK_BOX(vbox3), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_DataNameEntry = etk_entry_new(); //etk_widget_disabled_set(UI_DataNameEntry, ETK_TRUE); etk_box_append(ETK_BOX(vbox3), UI_DataNameEntry, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //Value Entry label = etk_label_new("<b>Value</b>"); etk_box_append(ETK_BOX(vbox3), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_DataValueEntry = etk_entry_new(); etk_box_append(ETK_BOX(vbox3), UI_DataValueEntry, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //Apply button UI_DataApplyButton =etk_button_new_from_stock(ETK_STOCK_DIALOG_APPLY); etk_signal_connect("clicked", ETK_OBJECT(UI_DataApplyButton), ETK_CALLBACK(_data_apply_button_click_cb), NULL); etk_box_append(ETK_BOX(vbox3), UI_DataApplyButton, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); return UI_DataWin; }
/* TODO : documentation */ void emphasis_init_player(Emphasis_Player_Gui *player) { Enhance *en; en = enhance_new(); player->en = en; if(!en) { fprintf(stderr, "Enhance new failed"); exit(1); } player->state = EMPHASIS_SMALL; /* TODO : state toggle full */ _emphasis_enhance_callbacks(player); enhance_file_load(en, "Emphasis", PACKAGE_DATA_DIR EMPHASIS_GLADE); /* TODO : check widget? */ EN_VAR_GET(en, player, window); etk_widget_hide(player->small.window); etk_widget_hide(player->full.window); EN_VAR_GET(en, player, root); player->small.ctr.root = enhance_var_get(en, "small_root_ctrl"); player->small.cov.root = enhance_var_get(en, "small_root_cover"); _emphasis_init_player_small(player); EN_VAR_GET(en, player, cover); EN_VAR_GET(en, player, stop); EN_VAR_GET(en, player, prev); EN_VAR_GET(en, player, play); EN_VAR_GET(en, player, next); EN_VAR_GET(en, player, info); EN_VAR_GET(en, player, progress); //EN_VAR_GET(en, player, time); player->full.time = enhance_var_get(en, "full_time"); EN_VAR_GET(en, player, sound_slider); EN_VAR_GET(en, player, sound_low); EN_VAR_GET(en, player, sound_high); EN_VAR_GET(en, player, random); EN_VAR_GET(en, player, repeat); EN_VAR_GET(en, player, full); player->small.media = enhance_var_get(en, "small_media"); player->media.window = enhance_var_get(en, "media_window"); player->media.root = enhance_var_get(en, "media_root"); player->media.notebook = enhance_var_get(en, "media_notebook"); player->media.paned = enhance_var_get(en, "media_paned"); player->media.pls = enhance_var_get(en, "media_pls"); player->media.artist = enhance_var_get(en, "media_artist"); player->media.album = enhance_var_get(en, "media_album"); player->media.track = enhance_var_get(en, "media_track"); player->media.search_root = enhance_var_get(en, "search_page_root"); player->media.search_combo = enhance_var_get(en, "search_page_combo"); player->media.search_tree = enhance_var_get(en, "search_page_tree"); player->media.pls_list = enhance_var_get(en, "media_pls_list"); player->media.pls_content = enhance_var_get(en, "media_pls_content"); player->media.pls_entry_save = enhance_var_get(en, "media_pls_entry_save"); /* Mediabox buttons init */ player->media.toolbar = enhance_var_get(en, "media_toolbar"); player->media.button_lib = enhance_var_get(en, "media_button_lib"); player->media.button_search = enhance_var_get(en, "media_button_search"); player->media.button_playlists = enhance_var_get(en, "media_button_pls"); player->media.button_stats = enhance_var_get(en, "media_button_stats"); /* enhance completion : col def */ etk_tree_multiple_select_set(ETK_TREE(player->media.artist), ETK_TRUE); etk_tree_multiple_select_set(ETK_TREE(player->media.album) , ETK_TRUE); etk_tree_multiple_select_set(ETK_TREE(player->media.track) , ETK_TRUE); etk_tree_multiple_select_set(ETK_TREE(player->media.pls) , ETK_TRUE); Etk_Tree_Col *col; col = etk_tree_col_new(ETK_TREE(player->media.artist), "Artist", 60, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.artist)); col = etk_tree_col_new(ETK_TREE(player->media.album), "Album", 60, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.album)); col = etk_tree_col_new(ETK_TREE(player->media.track), "Track", 60, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.track)); /* pls */ col = etk_tree_col_new(ETK_TREE(player->media.pls), "Title", 140, 0.0); etk_tree_col_model_add(col, etk_tree_model_image_new()); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.pls), "Time", 30, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.pls), "Artist", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.pls), "Album", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.pls)); /* search page */ etk_tree_multiple_select_set(ETK_TREE(player->media.search_tree), ETK_TRUE); col = etk_tree_col_new(ETK_TREE(player->media.search_tree), "Artist", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.search_tree), "Album", 100, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.search_tree), "Title", 200, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); col = etk_tree_col_new(ETK_TREE(player->media.search_tree), "Filename", 200, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.search_tree)); /* playlists page */ col = etk_tree_col_new(ETK_TREE(player->media.pls_list), "Playlists", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.pls_list)); col = etk_tree_col_new(ETK_TREE(player->media.pls_content), "Preview", 120, 0.0); etk_tree_col_model_add(col, etk_tree_model_text_new()); etk_tree_build(ETK_TREE(player->media.pls_content)); /**/ etk_object_data_set(ETK_OBJECT(player->media.artist), "title", "Artist"); etk_object_data_set(ETK_OBJECT(player->media.album) , "title", "Album" ); etk_object_data_set(ETK_OBJECT(player->media.track) , "title", "Track" ); etk_object_data_set(ETK_OBJECT(player->media.artist), "Emphasis_Type", (void*)EMPHASIS_ARTIST); etk_object_data_set(ETK_OBJECT(player->media.album), "Emphasis_Type", (void*)EMPHASIS_ALBUM); etk_object_data_set(ETK_OBJECT(player->media.track), "Emphasis_Type", (void*)EMPHASIS_TRACK); /* enhance completion : dnd */ etk_widget_dnd_source_set(ETK_WIDGET(player->media.artist), ETK_TRUE); etk_widget_dnd_source_set(ETK_WIDGET(player->media.album) , ETK_TRUE); etk_widget_dnd_source_set(ETK_WIDGET(player->media.track) , ETK_TRUE); etk_widget_dnd_dest_set(ETK_WIDGET(player->media.pls), ETK_TRUE); etk_signal_connect("row-clicked", ETK_OBJECT(player->media.artist), ETK_CALLBACK(cb_tree_mlib_clicked), player); etk_signal_connect("row-clicked", ETK_OBJECT(player->media.album ), ETK_CALLBACK(cb_tree_mlib_clicked), player); etk_signal_connect("row-clicked", ETK_OBJECT(player->media.track ), ETK_CALLBACK(cb_tree_mlib_clicked), player); etk_signal_connect("row-clicked", ETK_OBJECT(player->media.pls ), ETK_CALLBACK(cb_tree_pls_clicked), NULL); /* Media pls init */ etk_object_data_set(ETK_OBJECT(player->media.pls_content), "Emphasis_Type", (void*)EMPHASIS_TRACK); /* enhance complection : images */ emphasis_player_cover_set(player, NULL); emphasis_player_vol_image_set(player, 0, PACKAGE_DATA_DIR EMPHASIS_SOUNDL); emphasis_player_vol_image_set(player, 1, PACKAGE_DATA_DIR EMPHASIS_SOUNDR); player->small.cover_size_w = player->small.cover->requested_size.w; player->small.cover_size_h = player->small.cover->requested_size.h; player->full.cover_size_w = player->full.cover->requested_size.w; player->full.cover_size_h = player->full.cover->requested_size.h; /* TEMP configuration, need to add this to enhance */ etk_window_wmclass_set(ETK_WINDOW(player->full.window), "emphasis full", "Emphasis"); etk_window_wmclass_set(ETK_WINDOW(player->small.window), "emphasis small", "Emphasis"); etk_window_wmclass_set(ETK_WINDOW(player->media.window), "emphasis mlib", "Emphasis"); etk_container_border_width_set(ETK_CONTAINER(player->full.window), 5); }