/** * callback for open filedialog */ static EWL_CALLBACK_DEFN(open_cb) { char *filename; int *response = ev_data; if( response && *response == EWL_RESPONSE_OPEN ) { filename = ewl_filedialog_file_get(EWL_FILEDIALOG(w)); if( project_open(filename) < 0 ) /* issue a crazy warning */; } ewl_widget_destroy(open_project_win); open_project_win = NULL; }
/** * initialize this project manager. called from main */ int projects_init( char *filename ) { Ewl_Widget *vbox, *menu, *project_menu, *settings_menu, *windows_menu, *item; /* ui phase... kick on some phat window action */ project_win = ewl_window_new(); ewl_window_title_set(EWL_WINDOW(project_win), "Ewler"); ewl_object_size_request(EWL_OBJECT(project_win), 200, 320); ewl_callback_append(project_win, EWL_CALLBACK_DELETE_WINDOW, project_exit, NULL); ewl_callback_append(project_win, EWL_CALLBACK_KEY_DOWN, project_key_down, NULL); vbox = ewl_vbox_new(); ewl_container_child_append(EWL_CONTAINER(project_win), vbox); menu = ewl_hmenubar_new(); ewl_container_child_append(EWL_CONTAINER(vbox), menu); project_menu = ewl_menubar_menu_add(EWL_MENUBAR(menu), NULL, "Project"); item = ewl_menu_item_new(NULL, "New"); ewl_container_child_append(EWL_CONTAINER(project_menu), item); ewl_widget_show(item); item = ewl_menu_item_new(NULL, "New Form"); ewl_container_child_append(EWL_CONTAINER(project_menu), item); ewl_callback_append(item, EWL_CALLBACK_CLICKED, form_new, NULL); ewl_widget_show(item); item = ewl_menu_item_new(NULL, "Open..."); ewl_container_child_append(EWL_CONTAINER(project_menu), item); ewl_callback_append(item, EWL_CALLBACK_CLICKED, open, NULL); ewl_widget_show(item); item = ewl_menu_separator_new(); ewl_container_child_append(EWL_CONTAINER(project_menu), item); ewl_widget_show(item); item = ewl_menu_item_new(NULL, "Save"); ewl_callback_append(item, EWL_CALLBACK_CLICKED, save, NULL); ewl_container_child_append(EWL_CONTAINER(project_menu), item); ewl_widget_show(item); item = ewl_menu_separator_new(); ewl_container_child_append(EWL_CONTAINER(project_menu), item); ewl_widget_show(item); item = ewl_menu_item_new(NULL, "Exit"); ewl_callback_append(item, EWL_CALLBACK_CLICKED, project_exit, NULL); ewl_container_child_append(EWL_CONTAINER(project_menu), item); ewl_widget_show(item); ewl_widget_show(project_menu); settings_menu = ewl_menubar_menu_add(EWL_MENUBAR(menu), NULL, "Settings"); item = ewl_menu_item_new(NULL, "Options..."); ewl_container_child_append(EWL_CONTAINER(settings_menu), item); ewl_callback_append(item, EWL_CALLBACK_CLICKED, options, NULL); ewl_widget_show(item); ewl_widget_show(settings_menu); windows_menu = ewl_menubar_menu_add(EWL_MENUBAR(menu), NULL, "Windows"); item = ewl_menu_item_new(NULL, "Toolbar"); ewl_container_child_append(EWL_CONTAINER(windows_menu), item); ewl_callback_append(item, EWL_CALLBACK_CLICKED, tools_toggle, NULL); ewl_widget_show(item); item = ewl_menu_item_new(NULL, "Inspector"); ewl_container_child_append(EWL_CONTAINER(windows_menu), item); ewl_callback_append(item, EWL_CALLBACK_CLICKED, inspector_toggle, NULL); ewl_widget_show(item); item = ewl_menu_item_new(NULL, "Callbacks"); ewl_container_child_append(EWL_CONTAINER(windows_menu), item); ewl_callback_append(item, EWL_CALLBACK_CLICKED, callbacks_toggle, NULL); ewl_widget_show(item); ewl_widget_show(windows_menu); ewl_widget_show(menu); file_tree = ewl_tree_new(1); ewl_tree_mode_set(EWL_TREE(file_tree), EWL_TREE_MODE_SINGLE); ewl_container_child_append(EWL_CONTAINER(vbox), file_tree); ewl_widget_show(file_tree); ewl_widget_show(vbox); ewl_widget_show(project_win); /* end ui phase */ /* project phase */ active_project = NEW(Ewler_Project); if( !active_project ) { ewler_error("projects_init: out of memory!"); return -1; } active_project->files = ecore_hash_new(ecore_str_hash, ecore_str_compare); ecore_hash_free_key_cb_set(active_project->files, free); ecore_hash_free_value_cb_set(active_project->files, free); if( !filename || project_open(filename) < 0 ) { project_new(); } /* end project phase */ return 0; }
gboolean radare_project_open (const char* file) { #line 4 "project.vala" g_return_val_if_fail (file != NULL, FALSE); #line 6 "project.vala" return project_open (file); }