Enlightenment CVS committal
Author : lordchaos
Project : e17
Module : proto
Dir : e17/proto/entropy/src/plugins
Modified Files:
ewl_icon_local_viewer.c ewl_list_viewer.c filesystem.c
layout_ewl_simple.c
Log Message:
* Entropy list view actually works. Also added a 'view' menu so you can pick
your layout. Beware of warnings on directory change in list view.
===================================================================
RCS file:
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/ewl_icon_local_viewer.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- ewl_icon_local_viewer.c 29 Dec 2005 19:38:07 -0000 1.43
+++ ewl_icon_local_viewer.c 30 Dec 2005 06:47:31 -0000 1.44
@@ -239,7 +239,7 @@
}
char* entropy_plugin_identify() {
- return (char*)"EWL local viewer";
+ return (char*)"Icon View";
}
void gui_object_destroy_and_free(entropy_gui_component_instance* comp,
Ecore_Hash* gui_hash) {
===================================================================
RCS file:
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/ewl_list_viewer.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ewl_list_viewer.c 30 Dec 2005 00:43:20 -0000 1.1
+++ ewl_list_viewer.c 30 Dec 2005 06:47:31 -0000 1.2
@@ -197,7 +197,7 @@
}
char* entropy_plugin_identify() {
- return (char*)"EWL local viewer";
+ return (char*)"List View";
}
void gui_object_destroy_and_free(entropy_gui_component_instance* comp,
Ecore_Hash* gui_hash) {
@@ -383,6 +383,7 @@
entropy_gui_component_instance* entropy_plugin_init(entropy_core*
core,entropy_gui_component_instance* layout) {
Ewl_Widget* context;
+ char* headers[4];
entropy_gui_component_instance* instance =
entropy_gui_component_instance_new();
entropy_icon_viewer* viewer =
entropy_malloc(sizeof(entropy_icon_viewer));
@@ -394,6 +395,15 @@
instance->layout_parent = layout;
viewer->list = ewl_tree_new(3);
+
+ headers[0] = "Filename";
+ headers[1] = "Size";
+ headers[2] = "Date Modified";
+ headers[3] = NULL;
+ ewl_tree_headers_set(EWL_TREE(viewer->list), headers);
+
+
+
viewer->default_bg = 0;
instance->gui_object = viewer->list;
ewl_widget_show(EWL_WIDGET(viewer->list));
@@ -449,16 +459,20 @@
gui_file* ewl_icon_local_viewer_add_icon(entropy_gui_component_instance* comp,
entropy_generic_file* list_item, int do_mime) {
entropy_icon_viewer* view = comp->data;
+ char* text[4];
- Ewl_Iconbox_Icon* icon;
+ Ewl_Tree_Node* icon;
gui_file* gui_object;
if (!ecore_hash_get(view->gui_hash, list_item)) {
entropy_core_file_cache_add_reference(list_item->md5);
-
- //FIXME
- //icon = ewl_list_icon_add(EWL_ICONBOX(view->list),
list_item->filename, PACKAGE_DATA_DIR "/icons/default.png");
+
+ text[0] = list_item->filename;
+ text[1] = NULL;
+ text[2] = NULL;
+
+ icon = ewl_tree_text_row_add(EWL_TREE(view->list),
NULL, text);
ewl_callback_append(EWL_WIDGET(icon),
EWL_CALLBACK_MOUSE_DOWN, icon_click_cb, view);
@@ -650,6 +664,8 @@
gui_object_destroy_and_free(comp, tmp_gui_hash);
ecore_hash_destroy(tmp_icon_hash);
+ ewl_container_reset(EWL_CONTAINER(view->list));
+
}
break;
@@ -670,7 +686,9 @@
/*printf("Received callback notify from notify
event..\n");*/
/*Make sure the icon still exists*/
/*if (obj->icon) {*/
-
ewl_list_icon_image_set(EWL_ICONBOX_ICON(obj->icon),
obj->thumbnail->thumbnail_filename);
+
+ //FIXME
+
//ewl_list_icon_image_set(EWL_ICONBOX_ICON(obj->icon),
obj->thumbnail->thumbnail_filename);
/*FIXME This is inefficient as all hell - find
a better way to do this*/
//ewl_list_icon_arrange(EWL_ICONBOX(view->list));
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/plugins/filesystem.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- filesystem.c 28 Dec 2005 22:23:17 -0000 1.29
+++ filesystem.c 30 Dec 2005 06:47:31 -0000 1.30
@@ -219,7 +219,8 @@
filename = strdup(pos+1);
- /*If we are the root dir (i.e. we only
have one "/", replace it (so we can use it below),
+ /*If we are the root dir (i.e. we only
have
+ * one "/", replace it (so we can use
it below),
* and assume this filename has length
(BAD). */
if (!strlen(folder)) {
*pos = '/';
===================================================================
RCS file:
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/layout_ewl_simple.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- layout_ewl_simple.c 28 Dec 2005 22:38:58 -0000 1.22
+++ layout_ewl_simple.c 30 Dec 2005 06:47:31 -0000 1.23
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "ewl_mime_dialog.h"
+#include "entropy_gui.h"
static Ewl_Widget* win;
static Ecore_List* components;
@@ -19,7 +20,11 @@
entropy_gui_component_instance* iconbox_viewer;
entropy_gui_component_instance* structure_viewer;
Ewl_Widget* tree;
+ Ewl_Widget* paned;
+ Ewl_Widget* local_container;
+
Ecore_List* current_folder;
+ Ecore_List* local_components;
/*Tmp*/
@@ -401,6 +406,42 @@
ewl_object_maximum_w_set(EWL_OBJECT(box), 15);
}
+
+void
+layout_ewl_simple_local_view_cb
+(Ewl_Widget *main_win, void *ev_data, void *user_data) {
+
+ entropy_gui_component_instance* instance = user_data;
+ entropy_layout_gui* layout = instance->layout_parent->data;
+ entropy_gui_component_instance* iter;
+
+ entropy_gui_component_instance_enable(instance);
+ ewl_widget_show(EWL_WIDGET(instance->gui_object));
+ if (!EWL_WIDGET(instance->gui_object)->parent)
+
ewl_container_child_append(EWL_CONTAINER(layout->local_container),
EWL_WIDGET(instance->gui_object));
+
+ /*Hide all the other local viewers, and disable them*/
+ ecore_list_goto_first(layout->local_components);
+ while ((iter = ecore_list_next(layout->local_components))) {
+ if (iter != instance) {
+ entropy_gui_component_instance_disable(iter);
+
+ if (EWL_WIDGET(iter->gui_object)->parent &&
EWL_WIDGET(iter->gui_object)->parent == layout->local_container) {
+
//ewl_container_child_remove(EWL_CONTAINER(layout->paned),
EWL_WIDGET(iter->gui_object));
+ printf("Removed a local view..\n");
+
+ ewl_widget_hide(EWL_WIDGET(iter->gui_object));
+ }
+ }
+
+
+ }
+
+
+
+}
+
+
void
expand_cb(Ewl_Widget *main_win, void *ev_data, void *user_data) {
Ewl_Box* box = EWL_BOX(user_data);
@@ -450,9 +491,7 @@
/*EWL Stuff -----------------*/
void* (*entropy_plugin_init)(entropy_core* core,
entropy_gui_component_instance*);
- void* (*structure_plugin_init)(entropy_core* core,
entropy_gui_component_instance*, void* data);
- Ewl_Widget* paned;
Ewl_Widget* box;
Ewl_Widget* tree;
Ewl_Widget* vbox;
@@ -460,32 +499,49 @@
Ewl_Widget* contract_button;
Ewl_Widget* expand_button;
Ewl_Widget* scrollpane;
- Ewl_Widget* add_button;
Ewl_Widget* menubar;
Ewl_Widget* menu;
Ewl_Widget* item;
+ Ecore_List* local_plugins;
+ entropy_gui_component_instance* instance;
entropy_plugin* plugin;
- Ewl_Widget* iconbox;
+ Ewl_Widget* iconbox = NULL;
layout = entropy_malloc(sizeof(entropy_gui_component_instance));
gui = entropy_malloc(sizeof(entropy_layout_gui));
gui->current_folder = NULL;
layout->data = gui;
layout->core = core;
+ gui->local_components = ecore_list_new();
/*Register this layout container with the core, so our children can get
events*/
entropy_core_layout_register(core, layout);
/*---------------------------*/
/*HACK - get the iconbox - this should be configurable */
- plugin = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT,
ENTROPY_PLUGIN_GUI_COMPONENT_LOCAL_VIEW);
- if (plugin) {
+ local_plugins = entropy_plugins_type_get(ENTROPY_PLUGIN_GUI_COMPONENT,
ENTROPY_PLUGIN_GUI_COMPONENT_LOCAL_VIEW);
+
+ if (local_plugins) {
//printf("Plugin: %s\n", plugin->filename);
- entropy_plugin_init = dlsym(plugin->dl_ref,
"entropy_plugin_init");
- gui->iconbox_viewer = (*entropy_plugin_init)(core,layout);
- gui->iconbox_viewer->plugin = plugin;
- iconbox = EWL_WIDGET(gui->iconbox_viewer->gui_object);
+ //
+ while ((plugin = ecore_list_remove_first(local_plugins))) {
+ entropy_gui_component_instance* instance;
+
+ entropy_plugin_init = dlsym(plugin->dl_ref,
"entropy_plugin_init");
+ instance = (*entropy_plugin_init)(core,layout);
+ gui->iconbox_viewer = instance;
+
+ gui->iconbox_viewer->plugin = plugin;
+ instance->plugin = plugin;
+
+ iconbox = EWL_WIDGET(gui->iconbox_viewer->gui_object);
+
+ printf("Loaded '%s'...\n",
entropy_plugin_plugin_identify(plugin));
+
+ /*Add this plugin to the local viewers list*/
+ ecore_list_append(gui->local_components, instance);
+ }
} else {
fprintf(stderr, "No visual component found! *****\n");
return NULL;
@@ -511,7 +567,9 @@
ewl_box_spacing_set(EWL_BOX(EWL_SCROLLPANE(tree)->box), 5);
gui->tree = tree;
- paned = ewl_hpaned_new();
+ gui->paned = ewl_hpaned_new();
+ gui->local_container = ewl_cell_new();
+
ewl_window_title_set(EWL_WINDOW(win), "Entropy");
ewl_window_name_set(EWL_WINDOW(win), "Entropy");
ewl_window_class_set(EWL_WINDOW(win), "Entropy");
@@ -554,6 +612,24 @@
ewl_container_child_append(EWL_CONTAINER(menu), item);
ewl_callback_append(EWL_WIDGET(item), EWL_CALLBACK_CLICKED, mime_cb,
layout);
ewl_widget_show(item);
+
+ menu = ewl_menu_new();
+ ewl_menu_item_text_set(EWL_MENU_ITEM(menu), "View");
+ ewl_container_child_append(EWL_CONTAINER(menubar), menu);
+ ewl_widget_show(menu);
+
+ ecore_list_goto_first(gui->local_components);
+ while ( (instance = ecore_list_next(gui->local_components))) {
+ char* name = entropy_plugin_plugin_identify(instance->plugin);
+
+ item = ewl_menu_item_new();
+ ewl_menu_item_text_set(EWL_MENU_ITEM(item), name);
+ ewl_container_child_append(EWL_CONTAINER(menu), item);
+ ewl_callback_append(EWL_WIDGET(item), EWL_CALLBACK_CLICKED,
layout_ewl_simple_local_view_cb, instance);
+ ewl_widget_show(item);
+ }
+
+
menu = ewl_menu_new();
@@ -579,35 +655,15 @@
ewl_container_child_append(EWL_CONTAINER(hbox), expand_button);
ewl_container_child_append(EWL_CONTAINER(hbox), contract_button);
- //ewl_callback_append(EWL_WIDGET(contract_button),
EWL_CALLBACK_CLICKED, contract_cb, EWL_PANED(paned)->first);
- //ewl_callback_append(EWL_WIDGET(expand_button), EWL_CALLBACK_CLICKED,
expand_cb, EWL_PANED(paned)->first);
-
-
- /*Set up the paned*/
-
- /*Button to add locations*/
- //ewl_paned_active_area_set(EWL_PANED(paned), EWL_POSITION_LEFT);
- //add_button = ewl_button_new();
- //ewl_button_label_set(EWL_BUTTON(add_button), "Add Location");
- //ewl_container_child_append(EWL_CONTAINER(paned), add_button);
-
- //ewl_object_maximum_h_set(EWL_OBJECT(add_button), 20);
- //ewl_object_minimum_w_set(EWL_OBJECT(add_button), 250);
-
-
- //ewl_callback_append(EWL_WIDGET(add_button), EWL_CALLBACK_CLICKED,
location_add_cb, layout);
- /*--------------------------*/
-
ewl_container_child_append(EWL_CONTAINER(box), menubar);
- ewl_container_child_append(EWL_CONTAINER(box),paned);
- ewl_container_child_append(EWL_CONTAINER(paned), tree);
- //ewl_paned_active_area_set(EWL_PANED(paned), EWL_POSITION_RIGHT);
- ewl_container_child_append(EWL_CONTAINER(paned), iconbox);
+ ewl_container_child_append(EWL_CONTAINER(box),gui->paned);
+ ewl_container_child_append(EWL_CONTAINER(gui->paned), tree);
+
+ ewl_container_child_append(EWL_CONTAINER(gui->paned),
gui->local_container);
+ ewl_container_child_append(EWL_CONTAINER(gui->local_container),
iconbox);
if (!(tmp = entropy_config_str_get("layout_ewl_simple",
"structure_bar"))) {
- //printf ("Creating initial view for ewl_simple layout..\n");
layout_ewl_simple_config_create(core);
-
tmp = entropy_config_str_get("layout_ewl_simple",
"structure_bar");
}
@@ -621,7 +677,8 @@
ewl_widget_show(contract_button);
ewl_widget_show(expand_button);
ewl_widget_show(scrollpane);
- ewl_widget_show(paned);
+ ewl_widget_show(gui->paned);
+ ewl_widget_show(gui->local_container);
ewl_widget_show(tree);
ewl_container_child_append(EWL_CONTAINER(win), box);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs