Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : proto

Dir     : e17/proto/entropy/src/plugins


Modified Files:
        ewl_icon_local_viewer.c ewl_mime_dialog.c layout_ewl_simple.c 
        structure_viewer.c 


Log Message:
* More MIME-Action work.  The user can now add actions for particular MIME 
types.  This still needs to be saved, however.

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/ewl_icon_local_viewer.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- ewl_icon_local_viewer.c     22 Nov 2005 11:32:44 -0000      1.30
+++ ewl_icon_local_viewer.c     26 Nov 2005 11:50:42 -0000      1.31
@@ -84,6 +84,31 @@
 }
 
 
+void progress_window_create(entropy_file_progress_window* progress) {
+       Ewl_Widget* vbox;
+       
+       progress->progress_window = ewl_window_new();
+       ewl_window_title_set(EWL_WINDOW(progress->progress_window), "File 
Copy");
+       ewl_object_custom_size_set(EWL_OBJECT(progress->progress_window), 400, 
150);
+       
+       vbox = ewl_vbox_new();
+       ewl_container_child_append(EWL_CONTAINER(progress->progress_window), 
vbox);
+       ewl_widget_show(vbox);
+
+       progress->file_from = ewl_text_new();
+       ewl_container_child_append(EWL_CONTAINER(vbox), progress->file_from);
+       ewl_widget_show(progress->file_from);
+
+       progress->file_to = ewl_text_new();
+       ewl_container_child_append(EWL_CONTAINER(vbox), progress->file_to);
+       ewl_widget_show(progress->file_to);
+
+       progress->progressbar = ewl_progressbar_new();
+       ewl_container_child_append(EWL_CONTAINER(vbox), progress->progressbar);
+       ewl_progressbar_range_set(EWL_PROGRESSBAR(progress->progressbar), 100);
+       ewl_widget_show(progress->progressbar);
+
+}
 
 
 void ewl_icon_local_viewer_show_stat(entropy_file_stat* file_stat) {
@@ -483,7 +508,7 @@
 
 entropy_gui_component_instance* entropy_plugin_init(entropy_core* 
core,entropy_gui_component_instance* layout) {
        Ewl_Widget* context;
-       Ewl_Widget* vbox;
+
        entropy_gui_component_instance* instance = 
entropy_malloc(sizeof(entropy_gui_component_instance));
        entropy_icon_viewer* viewer = 
entropy_malloc(sizeof(entropy_icon_viewer));
 
@@ -501,30 +526,6 @@
 
        /*Initialise the progress window*/
        viewer->progress = entropy_malloc(sizeof(entropy_file_progress_window));
-       viewer->progress->progress_window = ewl_window_new();
-       ewl_window_title_set(EWL_WINDOW(viewer->progress->progress_window), 
"File Copy");
-       
ewl_object_custom_size_set(EWL_OBJECT(viewer->progress->progress_window), 400, 
150);
-       
-       vbox = ewl_vbox_new();
-       
ewl_container_child_append(EWL_CONTAINER(viewer->progress->progress_window), 
vbox);
-       ewl_widget_show(vbox);
-
-       viewer->progress->file_from = ewl_text_new();
-       ewl_container_child_append(EWL_CONTAINER(vbox), 
viewer->progress->file_from);
-       ewl_widget_show(viewer->progress->file_from);
-
-       viewer->progress->file_to = ewl_text_new();
-       ewl_container_child_append(EWL_CONTAINER(vbox), 
viewer->progress->file_to);
-       ewl_widget_show(viewer->progress->file_to);
-
-       viewer->progress->progressbar = ewl_progressbar_new();
-       ewl_container_child_append(EWL_CONTAINER(vbox), 
viewer->progress->progressbar);
-       
ewl_progressbar_range_set(EWL_PROGRESSBAR(viewer->progress->progressbar), 100);
-       ewl_widget_show(viewer->progress->progressbar);
-
-
-
-       
        
        
        /*Add some context menu items*/
@@ -958,19 +959,24 @@
                
                                                  
                printf("Received a file progress event..\n");
-               if (!VISIBLE(view->progress->progress_window)) {
+               if (!view->progress->progress_window) {
                        printf("Showing progressbar dialog..\n");
+
+                       progress_window_create(view->progress);
                        ewl_widget_show(view->progress->progress_window);
                }
 
-               ewl_text_text_set(EWL_TEXT(view->progress->file_from), 
progress->file_from);
-               ewl_text_text_set(EWL_TEXT(view->progress->file_to), 
progress->file_to);
-               
ewl_progressbar_value_set(EWL_PROGRESSBAR(view->progress->progressbar), 
progress->progress);
+               if (view->progress->progress_window) {
+                       ewl_text_text_set(EWL_TEXT(view->progress->file_from), 
progress->file_from);
+                       ewl_text_text_set(EWL_TEXT(view->progress->file_to), 
progress->file_to);
+                       
ewl_progressbar_value_set(EWL_PROGRESSBAR(view->progress->progressbar), 
progress->progress);
+               }
 
                /*Is it time to hide (i.e. end)*/
                if (progress->type == TYPE_END) {
                        printf("Hiding progressbar dialog..\n");
-                       ewl_widget_hide(view->progress->progress_window);
+                       ewl_widget_destroy(view->progress->progress_window);
+                       view->progress->progress_window = NULL;
                }
        
        }
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/ewl_mime_dialog.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ewl_mime_dialog.c   24 Nov 2005 04:03:13 -0000      1.1
+++ ewl_mime_dialog.c   26 Nov 2005 11:50:42 -0000      1.2
@@ -5,8 +5,167 @@
 #include <dlfcn.h>
 #include <time.h>
 
-void ewl_mime_dialog_display() {
+Ewl_Widget* mime_tree;
+Ewl_Widget* entry_type;
+Ewl_Widget* entry_action;
+
+void window_dismiss_cb(Ewl_Widget *item, void *ev_data, void *user_data) {
+       ewl_widget_destroy(EWL_WIDGET(user_data));
+}
+
+
+void mime_add_cb(Ewl_Widget *item, void *ev_data, void *user_data) {
+       char *entries[3];
+       char *type_text = ewl_text_text_get(EWL_TEXT(entry_type));
+       char *action_text = ewl_text_text_get(EWL_TEXT(entry_action));
+       
+       
+       entries[0] = type_text;
+       entries[1] = action_text;
+       entries[2] = NULL;
+
+       ewl_tree_text_row_add(EWL_TREE(mime_tree), NULL,entries);
+       entropy_core_mime_action_add(type_text, action_text);
+
+       /*free(type_text);
+       free(action_text);*/
+
+       ewl_widget_destroy(EWL_WIDGET(user_data));
+       
+}
+
+
+void entropy_ewl_mime_add_display_cb(Ewl_Widget *item, void *ev_data, void 
*user_data) {
+       Ewl_Widget* layout_box = ewl_vbox_new();
+       Ewl_Widget* window = ewl_window_new();
+       Ewl_Widget* hbox;
+       
+       Ewl_Widget* label;
+       Ewl_Widget* button;
+       
+       ewl_widget_show(layout_box);
+       ewl_object_custom_size_set(EWL_OBJECT(window), 300, 150);
+       ewl_container_child_append(EWL_CONTAINER(window), layout_box);
+
+
+       /*---*/
+       hbox = ewl_hbox_new();
+       ewl_widget_show(hbox);
+       ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);
+
+       label = ewl_label_new();
+       ewl_label_text_set(EWL_LABEL(label), "MIME Type");
+       ewl_widget_show(label);
+       ewl_container_child_append(EWL_CONTAINER(hbox), label);
+
+       entry_type = ewl_entry_new();
+       ewl_container_child_append(EWL_CONTAINER(hbox), entry_type);
+       ewl_widget_show(entry_type);
+       /*---*/
+
+       /*---*/
+       hbox = ewl_hbox_new();
+       ewl_widget_show(hbox);
+       ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);
+
+       label = ewl_label_new();
+       ewl_label_text_set(EWL_LABEL(label), "Action");
+       ewl_widget_show(label);
+       ewl_container_child_append(EWL_CONTAINER(hbox), label);
+
+       entry_action = ewl_entry_new();
+       ewl_container_child_append(EWL_CONTAINER(hbox), entry_action);
+       ewl_widget_show(entry_action);
+       /*---*/
+
+       
+       hbox = ewl_hbox_new();
+       ewl_widget_show(hbox);
+       ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);
+
+       button = ewl_button_new();
+       ewl_button_label_set(EWL_BUTTON(button), "Add");
+       ewl_object_maximum_h_set(EWL_OBJECT(button), 15);
+       ewl_callback_append(button, EWL_CALLBACK_CLICKED, mime_add_cb, window);
+       ewl_container_child_append(EWL_CONTAINER(hbox), button);
+       ewl_widget_show(button);
+
+       button = ewl_button_new();
+       ewl_button_label_set(EWL_BUTTON(button), "Cancel");
+       ewl_object_maximum_h_set(EWL_OBJECT(button), 15);
+       ewl_callback_append(button, EWL_CALLBACK_CLICKED, window_dismiss_cb, 
window);
+       ewl_container_child_append(EWL_CONTAINER(hbox), button);
+       ewl_widget_show(button);
+
+
+       
+       
+       ewl_widget_show(window);
+       
+}
+
+
+
+void entropy_ewl_mime_dialog_display() {
        Ewl_Widget* window = ewl_window_new();
-       ewl_object_custom_size_set(EWL_OBJECT(window), 250, 400);
+       Ewl_Widget* box = ewl_vbox_new();
+       Ewl_Widget* button = ewl_button_new();
+       Ewl_Widget* hbox;
+       
+       entropy_core* core = entropy_core_get_core();
+       char* entries[3];
+       char* key;
+       entropy_mime_action* action;
+       Ecore_List* keys;
+
+
+       /*Init the mime tree*/
+       mime_tree = ewl_tree_new(2);
+
+       ewl_tree_mode_set(EWL_TREE(mime_tree), EWL_TREE_MODE_SINGLE);
+       ewl_object_minimum_size_set(EWL_OBJECT(window), 300, 400);
+       ewl_window_title_set(EWL_WINDOW(window), "Edit MIME Actions..");
+       ewl_container_child_append(EWL_CONTAINER(window), box);
+       ewl_container_child_append(EWL_CONTAINER(box), mime_tree);
+       
+       ewl_widget_show(box);
+
+       keys = ecore_hash_keys(core->mime_action_hint);
+       while ((key = ecore_list_remove_first(keys))) {
+               entries[0] = key;
+               entries[1] = 
((entropy_mime_action*)ecore_hash_get(core->mime_action_hint, key))->executable;
+               entries[2] = NULL;
+
+               ewl_tree_text_row_add(EWL_TREE(mime_tree), NULL,entries);
+       }
+
+
+       hbox = ewl_hbox_new();
+       ewl_container_child_append(EWL_CONTAINER(box), hbox);
+       ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_SHRINK);
+       ewl_widget_show(hbox);
+
+
+       /*Add Button*/
+       ewl_button_label_set(EWL_BUTTON(button), "Add MIME Action");
+       ewl_object_maximum_h_set(EWL_OBJECT(button), 15);
+       ewl_callback_append(button, EWL_CALLBACK_CLICKED, 
entropy_ewl_mime_add_display_cb, NULL);
+       ewl_container_child_append(EWL_CONTAINER(hbox), button);
+       ewl_widget_show(button);
+
+       
+       /*OK Button*/
+       button = ewl_button_new();
+       ewl_button_label_set(EWL_BUTTON(button), "Close");
+       ewl_object_maximum_h_set(EWL_OBJECT(button), 15);
+       ewl_callback_append(button, EWL_CALLBACK_CLICKED, window_dismiss_cb, 
window);
+       ewl_container_child_append(EWL_CONTAINER(hbox), button);
+       ewl_widget_show(button);
+
+       
+       
+       
        ewl_widget_show(window);
+       ewl_widget_show(mime_tree);
+       
 }
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/layout_ewl_simple.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- layout_ewl_simple.c 24 Nov 2005 22:15:48 -0000      1.16
+++ layout_ewl_simple.c 26 Nov 2005 11:50:42 -0000      1.17
@@ -101,7 +101,7 @@
 }
 
 void mime_cb(Ewl_Widget *main_win, void *ev_data, void *user_data) {
-       ewl_mime_dialog_display();
+       entropy_ewl_mime_dialog_display();
 }
 
 
@@ -596,7 +596,7 @@
        ewl_widget_show(menu);
 
        item = ewl_menu_item_new();
-       ewl_menu_item_text_set(EWL_MENU_ITEM(item), "Add Location...");
+       ewl_menu_item_text_set(EWL_MENU_ITEM(item), "About...");
        ewl_container_child_append(EWL_CONTAINER(menu), item);
        ewl_callback_append(EWL_WIDGET(item), EWL_CALLBACK_CLICKED, 
location_add_cb, layout);
        ewl_widget_show(item);
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/structure_viewer.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- structure_viewer.c  21 Nov 2005 11:50:54 -0000      1.14
+++ structure_viewer.c  26 Nov 2005 11:50:42 -0000      1.15
@@ -108,6 +108,23 @@
                /*ecore_list_destroy(el);*/
 
                ewl_tree_row_expand_set(row, EWL_TREE_NODE_EXPANDED);
+
+
+               /*Now change the gihtlight, if we got a row..*/
+               if (viewer->last_selected_label) {
+                       
ewl_text_cursor_position_set(EWL_TEXT(viewer->last_selected_label), 0);
+
+                       /*TODO theme this color stuff*/
+                       
ewl_text_color_apply(EWL_TEXT(viewer->last_selected_label), 
+                                       0, 0, 0, 255, 
ewl_text_length_get(EWL_TEXT(viewer->last_selected_label)));              
+               }
+
+               /*Highlight this row*/
+               /*TODO Find some way to cleanly find the text member of the 
row*/
+               /*ewl_text_cursor_position_set(EWL_TEXT(row->data), 0);
+               ewl_text_color_apply(EWL_TEXT(event->data), 0, 0, 255, 255, 
ewl_text_length_get(EWL_TEXT(event->data)));
+               viewer->last_selected_label = event->data;*/
+
                
        } else {
                /*printf("---------------------------------------------> This 
row already has children!!\n");*/




-------------------------------------------------------
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
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to