Enlightenment CVS committal

Author  : chaos
Project : e17
Module  : proto

Dir     : e17/proto/entropy/src/plugins


Modified Files:
        etk_trackback.c 


Log Message:
* OK - Trackback is in.  Play around with it - not 100% correct behaviour, i 
think

===================================================================
RCS file: /cvs/e/e17/proto/entropy/src/plugins/etk_trackback.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- etk_trackback.c     23 Apr 2006 11:16:31 -0000      1.1
+++ etk_trackback.c     24 Apr 2006 14:26:36 -0000      1.2
@@ -9,6 +9,9 @@
 
 typedef struct entropy_etk_trackback {
        Etk_Widget* label;
+       entropy_generic_file* base_file;
+       Etk_Widget* hbox;
+       Ecore_List* levels;
 } entropy_etk_trackback;
 
 
@@ -62,10 +65,22 @@
                parent_dir = entropy_core_parent_folder_file_get(parent_dir);
                if (parent_dir) {
                        entropy_event_action_file(parent_dir, comp);
+                       trackback->base_file = parent_dir;
                }
        }
-       
-       
+
+}
+
+void _entropy_etk_trackback_combo_cb(Etk_Object *object, void *data)
+{
+   entropy_gui_component_instance* comp = NULL;
+   entropy_generic_file* file;
+   
+   file = etk_combobox_item_data_get(ETK_COMBOBOX_ITEM(object));
+   comp  = 
etk_object_data_get(ETK_OBJECT(ETK_COMBOBOX_ITEM(object)->combobox), "COMP");
+
+   printf("Item activated, file: %p, %s/%s, comp: %p\n", file, file->path, 
file->filename, comp);
+   if (file && comp) entropy_event_action_file(file, comp);
 }
 
 void
@@ -81,8 +96,111 @@
                ((entropy_file_request *) eevent->data)->file;
                                                       
                char buf[PATH_MAX];
-               snprintf(buf, PATH_MAX, "%s/%s", event_file->path, 
event_file->filename);
-               etk_label_set(ETK_LABEL(trackback->label), buf);
+               int do_combo_new = 0;
+
+               if (!trackback->base_file) {
+                       snprintf(buf, PATH_MAX, "%s/%s", event_file->path, 
event_file->filename);
+                       etk_label_set(ETK_LABEL(trackback->label), buf);
+                       trackback->base_file = event_file;
+                       do_combo_new = 1;
+               } else {
+                       /*If a base file already here, check if this new 
parent_dir 
+                        * is a child of the current base_dir.  If so, continue 
on,
+                        * if not, nuke all existing combos, and set as new 
base_dir*/
+                       int hit=0;
+                       entropy_generic_file* traverse_file = 
+                               entropy_core_parent_folder_file_get(event_file);
+
+                       ecore_list_goto_first(trackback->levels);
+                       while ( ecore_list_current(trackback->levels) ) {
+                                 entropy_generic_file* combo_file = 
+                                      
etk_object_data_get(ETK_OBJECT(ecore_list_current(trackback->levels)),"FILE");
+                               
+                                 //printf ("^^^^^^^^^^^ %s/%s is %s/%s?\n", 
traverse_file->path, traverse_file->filename,
+                                       //combo_file->path, 
combo_file->filename);
+
+                                 if (combo_file == traverse_file) {
+                                         //printf (" >>>>> YES\n");
+                                         
/*etk_object_destroy(ETK_OBJECT(ecore_list_current(trackback->levels)));
+                                         
ecore_list_remove(trackback->levels);*/
+
+                                 
+                                         hit = 1;
+                                         goto done;
+                                 } else {
+                                         //printf (" >>>>> NO\n");
+                                         
etk_object_destroy(ETK_OBJECT(ecore_list_current(trackback->levels)));
+                                         ecore_list_remove(trackback->levels);
+                                 }
+                       }
+       
+                       done:
+       
+                       /*Check if new dir is a direct descendent...*/
+                       if (hit == 1) {
+                               /*HACK - We access combobox internals here..*/
+                               ecore_list_goto_first(trackback->levels);
+                               Etk_Widget* last_combo;
+                               if (  (last_combo = 
ecore_list_current(trackback->levels))) {
+                                       Evas_List* l = 
ETK_COMBOBOX(last_combo)->items;
+                                       for (; l; ) {
+                                               Etk_Combobox_Item* item = 
l->data;
+
+                                               if 
(etk_combobox_item_data_get(item) == event_file) {
+                                                       
etk_combobox_item_activate(item);
+                                               }
+                                               
+                                               l = l->next;
+                                       }
+                                       
+                               }
+                               
+                               do_combo_new = 1;                       
+                       } else {
+                               snprintf(buf, PATH_MAX, "%s/%s", 
event_file->path, event_file->filename);
+                               etk_label_set(ETK_LABEL(trackback->label), buf);
+                               trackback->base_file = event_file;      
+                               do_combo_new = 1;
+                       }                               
+               }
+
+               if (do_combo_new) {
+                       Etk_Widget* combo;
+                       entropy_generic_file* file;
+                       Ecore_List* fl = el;
+
+                       if (!trackback->levels) 
+                               trackback->levels = ecore_list_new();
+
+                       //printf (" *** Event file is %s/%s\n", 
event_file->path, event_file->filename);
+                       
+                       combo = etk_combobox_new_default();
+                       
+                       ecore_list_goto_first(fl);
+                       while ( (file = ecore_list_next(fl) )) {
+                               Etk_Combobox_Item* item;
+                               
+                               if (!strcmp(file->mime_type, "file/folder")) {
+                                       snprintf(buf, PATH_MAX, "%s", 
file->filename);
+                                       item = 
etk_combobox_item_append(ETK_COMBOBOX(combo), buf);
+                                       etk_combobox_item_data_set(item, file);
+
+                                       etk_signal_connect("mouse_click", 
ETK_OBJECT(item),
+                                               
ETK_CALLBACK(_entropy_etk_trackback_combo_cb), comp);
+
+                                       //printf("      ** Added %s.%p.\n", 
file->filename, comp);
+                               }
+                       }
+                       etk_object_data_set(ETK_OBJECT(combo), "FILE", 
event_file);
+                       etk_object_data_set(ETK_OBJECT(combo), "COMP", comp);
+                       
+                       etk_widget_show_all(combo);
+                       etk_box_pack_start(ETK_BOX(trackback->hbox), combo, 
ETK_FALSE,ETK_FALSE,0);
+
+
+                       ecore_list_prepend(trackback->levels, combo);
+
+               }
           }
          break;
   }
@@ -95,23 +213,24 @@
 {      
   entropy_gui_component_instance *instance;
   entropy_etk_trackback* trackback;
-  Etk_Widget* hbox;
   Etk_Widget* button;
 
   instance = entropy_gui_component_instance_new ();
   trackback = calloc(1, sizeof(entropy_etk_trackback));
+  trackback->levels = NULL;
+  trackback->base_file = NULL;
   instance->data = trackback;
 
-  hbox = etk_hbox_new(ETK_FALSE,0);
+  trackback->hbox = etk_hbox_new(ETK_FALSE,0);
   button = etk_button_new_from_stock(ETK_STOCK_GO_UP);
   etk_signal_connect("pressed", ETK_OBJECT(button), 
ETK_CALLBACK(_entropy_etk_trackback_up_cb), instance);
   
   trackback->label = etk_label_new("");
-  etk_box_pack_start(ETK_BOX(hbox), button, ETK_FALSE,ETK_FALSE,0);
-  etk_box_pack_start(ETK_BOX(hbox), trackback->label, ETK_TRUE,ETK_TRUE,0);
+  etk_box_pack_start(ETK_BOX(trackback->hbox), button, ETK_FALSE,ETK_FALSE,0);
+  etk_box_pack_start(ETK_BOX(trackback->hbox), trackback->label, 
ETK_TRUE,ETK_TRUE,0);
   
   
-  instance->gui_object = hbox;
+  instance->gui_object = trackback->hbox;
   instance->core = core;
   instance->layout_parent = layout;
 




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to