Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_apps.c e_apps.h e_exebuf.c e_utils.c e_utils.h e_winlist.c 


Log Message:


exebuf is ... well.. a bit better now

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -3 -r1.105 -r1.106
--- e_apps.c    2 Dec 2005 09:08:58 -0000       1.105
+++ e_apps.c    14 Dec 2005 15:54:51 -0000      1.106
@@ -848,6 +848,96 @@
    return NULL;
 }
 
+
+
+Evas_List *
+e_app_name_glob_list(char *name)
+{
+   Evas_List *l, *list = NULL;
+   
+   if (!name) return NULL;
+
+   for (l = _e_apps_list; l; l = l->next)
+     {
+       E_App *a;
+       
+       a = l->data;
+       if (a->name)
+         {
+            if (e_util_glob_case_match(a->name, name))
+              list = evas_list_append(list, a);
+         }
+     }
+   return list;
+}
+
+Evas_List *
+e_app_generic_glob_list(char *generic)
+{
+   Evas_List *l, *list = NULL;
+   
+   if (!generic) return NULL;
+
+   for (l = _e_apps_list; l; l = l->next)
+     {
+       E_App *a;
+       
+       a = l->data;
+       if (a->generic)
+         {
+            if (e_util_glob_case_match(a->generic, generic))
+              list = evas_list_append(list, a);
+         }
+     }
+   return list;
+}
+
+Evas_List *
+e_app_exe_glob_list(char *exe)
+{
+   Evas_List *l, *list = NULL;
+   
+   if (!exe) return NULL;
+
+   for (l = _e_apps_list; l; l = l->next)
+     {
+       E_App *a;
+       
+       a = l->data;
+       if (a->exe)
+         {
+            if (e_util_glob_match(a->exe, exe))
+              list = evas_list_append(list, a);
+         }
+     }
+   return list;
+}
+
+Evas_List *
+e_app_comment_glob_list(char *comment)
+{
+   Evas_List *l, *list = NULL;
+   
+   if (!comment) return NULL;
+
+   for (l = _e_apps_list; l; l = l->next)
+     {
+       E_App *a;
+       
+       a = l->data;
+       if (a->comment)
+         {
+            if (e_util_glob_case_match(a->comment, comment))
+              list = evas_list_append(list, a);
+         }
+     }
+   return list;
+}
+
+
+
+
+
 void
 e_app_fields_fill(E_App *a, const char *path)
 {
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- e_apps.h    24 Oct 2005 21:52:31 -0000      1.24
+++ e_apps.h    14 Dec 2005 15:54:51 -0000      1.25
@@ -101,6 +101,11 @@
 EAPI E_App      *e_app_generic_find                      (char *generic);
 EAPI E_App      *e_app_exe_find                          (char *exe);
 
+EAPI Evas_List  *e_app_name_glob_list                    (char *name);
+EAPI Evas_List  *e_app_generic_glob_list                 (char *generic);
+EAPI Evas_List  *e_app_exe_glob_list                     (char *exe);
+EAPI Evas_List  *e_app_comment_glob_list                 (char *comment);
+    
 EAPI void        e_app_fields_fill                       (E_App *a, const char 
*path);
 EAPI void        e_app_fields_save                       (E_App *a);
 EAPI E_App      *e_app_raw_new                           (void);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_exebuf.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_exebuf.c  7 Dec 2005 13:24:58 -0000       1.2
+++ e_exebuf.c  14 Dec 2005 15:54:51 -0000      1.3
@@ -6,6 +6,15 @@
 /* currently default bind is alt+` buf alt+space has been suggested */
 
 /* local subsystem functions */
+typedef struct _E_Exebuf_Exe E_Exebuf_Exe;
+   
+struct _E_Exebuf_Exe
+{
+   Evas_Object *bg_object;
+   Evas_Object *icon_object;
+   E_App       *app;
+   char        *file;
+};
 
 static void _e_exebuf_matches_clear(void);
 static void _e_exebuf_update(void);
@@ -19,18 +28,39 @@
 static int _e_exebuf_cb_mouse_down(void *data, int type, void *event);
 static int _e_exebuf_cb_mouse_up(void *data, int type, void *event);
 static int _e_exebuf_cb_mouse_wheel(void *data, int type, void *event);
+static int _e_exebuf_exe_scroll_timer(void *data);
+static int _e_exebuf_eap_scroll_timer(void *data);
+static int _e_exebuf_animator(void *data);
 
 /* local subsystem globals */
 static E_Popup *exebuf = NULL;
 static Evas_Object *bg_object = NULL;
+static Evas_Object *icon_object = NULL;
+static Evas_Object *exe_list_object = NULL;
+static Evas_Object *eap_list_object = NULL;
 static Evas_List *handlers = NULL;
 static Ecore_X_Window input_window = 0;
 static char *cmd_buf = NULL;
 static Evas_List *eap_matches = NULL;
 static Evas_List *exe_matches = NULL;
-static E_App *eap_sel = NULL;
 static Ecore_List *exe_list = NULL;
-
+static Evas_List *exes = NULL;
+static Evas_List *eaps = NULL;
+#define NO_LIST 0
+#define EAP_LIST 1
+#define EXE_LIST 2
+static int which_list = NO_LIST;
+static E_Exebuf_Exe *exe_sel = NULL;
+static int exe_scroll_to = 0;
+static double exe_scroll_align_to = 0.0;
+static double exe_scroll_align = 0.0;
+static Ecore_Timer *exe_scroll_timer = NULL;
+static int eap_scroll_to = 0;
+static double eap_scroll_align_to = 0.0;
+static double eap_scroll_align = 0.0;
+static Ecore_Timer *eap_scroll_timer = NULL;
+static Ecore_Timer *animator = NULL;
+ 
 #define EXEBUFLEN 2048
 
 /* externally accessible functions */
@@ -56,7 +86,8 @@
    
    E_OBJECT_CHECK_RETURN(zone, 0);
    E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
-   
+
+   if (e_winlist_active_get()) return 0;
    if (exebuf) return 0;
 
    input_window = ecore_x_window_input_new(zone->container->win, 0, 0, 1, 1);
@@ -86,19 +117,45 @@
    e_theme_edje_object_set(o, "base/theme/exebuf",
                           "widgets/exebuf/main");
    edje_object_part_text_set(o, "label", cmd_buf);
+   
+   o = e_box_add(exebuf->evas);
+   exe_list_object = o;
+   e_box_align_set(o, 0.5, 1.0);
+   e_box_orientation_set(o, 0);
+   e_box_homogenous_set(o, 1);
+   edje_object_part_swallow(bg_object, "exe_list_swallow", o);
+   evas_object_show(o);
+   
+   o = e_box_add(exebuf->evas);
+   eap_list_object = o;
+   e_box_align_set(o, 0.5, 0.0);
+   e_box_orientation_set(o, 0);
+   e_box_homogenous_set(o, 1);
+   edje_object_part_swallow(bg_object, "eap_list_swallow", o);
+   evas_object_show(o);
+   
+   o = bg_object;
    edje_object_size_min_calc(o, &mw, &mh);
    
-   x = zone->x + 20;
-   y = zone->y + 20 + ((zone->h - 20 - 20 - mh) / 2);
-   w = zone->w - 20 - 20;
-   h = mh;
+   w = (double)zone->w * e_config->winlist_pos_size_w;
+   if (w > e_config->winlist_pos_max_w) w = e_config->winlist_pos_max_w;
+   else if (w < e_config->winlist_pos_min_w) w = e_config->winlist_pos_min_w;
+   if (w < mw) w = mw;
+   if (w > zone->w) w = zone->w;
+   x = (double)(zone->w - w) * e_config->winlist_pos_align_x;
+   
+   h = (double)zone->h * e_config->winlist_pos_size_h;
+   if (h > e_config->winlist_pos_max_h) h = e_config->winlist_pos_max_h;
+   else if (h < e_config->winlist_pos_min_h) h = e_config->winlist_pos_min_h;
+   if (h < mh) h = mh;
+   if (h > zone->h) h = zone->h;
+   y = (double)(zone->h - h) * e_config->winlist_pos_align_y;
    
    e_popup_move_resize(exebuf, x, y, w, h);
    evas_object_move(o, 0, 0);
    evas_object_resize(o, w, h);
    evas_object_show(o);
    e_popup_edje_bg_object_set(exebuf, o);
-   
 
    evas_event_thaw(exebuf->evas);
 
@@ -126,8 +183,19 @@
 {
    if (!exebuf) return;
    
+   _e_exebuf_matches_clear();
    evas_event_freeze(exebuf->evas);
    e_popup_hide(exebuf);
+   if (exe_scroll_timer) ecore_timer_del(exe_scroll_timer);
+   exe_scroll_timer = NULL;
+   if (eap_scroll_timer) ecore_timer_del(eap_scroll_timer);
+   eap_scroll_timer = NULL;
+   if (animator) ecore_animator_del(animator);
+   animator = NULL;
+   evas_object_del(eap_list_object);
+   eap_list_object = NULL;
+   evas_object_del(exe_list_object);
+   exe_list_object = NULL;
    evas_object_del(bg_object);
    bg_object = NULL;
    evas_event_thaw(exebuf->evas);
@@ -148,7 +216,8 @@
        ecore_list_destroy(exe_list);
        exe_list = NULL;
      }
-   _e_exebuf_matches_clear();
+   which_list = NO_LIST;
+   exe_sel = NULL;
 }
 
 /* local subsystem functions */
@@ -166,25 +235,75 @@
        free(exe_matches->data);
        exe_matches = evas_list_remove_list(exe_matches, exe_matches);
      }
-   eap_sel = NULL;
+   
+   e_box_freeze(exe_list_object);
+   while (exes)
+     {
+        E_Exebuf_Exe *exe;
+       
+       exe = exes->data;
+       if (exe->app) e_object_unref(E_OBJECT(exe->app));
+       evas_object_del(exe->bg_object);
+       if (exe->icon_object)
+         evas_object_del(exe->icon_object);
+       free(exe);
+       exes = evas_list_remove_list(exes, exes);
+     }
+   e_box_thaw(exe_list_object);
+   
+   e_box_freeze(eap_list_object);
+   while (eaps)
+     {
+        E_Exebuf_Exe *exe;
+       
+       exe = eaps->data;
+       if (exe->app) e_object_unref(E_OBJECT(exe->app));
+       evas_object_del(exe->bg_object);
+       if (exe->icon_object)
+         evas_object_del(exe->icon_object);
+       free(exe);
+       eaps = evas_list_remove_list(eaps, eaps);
+     }
+   e_box_thaw(eap_list_object);
+   
+   e_box_align_set(eap_list_object, 0.5, 0.0);
+   e_box_align_set(exe_list_object, 0.5, 1.0);
+   exe_sel = NULL;
+   which_list = NO_LIST;
 }
 
 static void
 _e_exebuf_update(void)
 {
+   E_App *a;
+   Evas_Object *o;
+   
    edje_object_part_text_set(bg_object, "label", cmd_buf);
-   /* FIXME: if cmd_buf is an exact match for an eap or exe display an icon
-    * to show it is */
-   /* FIXME: display match lists. if match is exat match for cmd_buf dont
-    * list it as it will be matched and indicated
-    */
+   if (icon_object) evas_object_del(icon_object);
+   icon_object == NULL;
+   a = e_app_exe_find(cmd_buf);
+   if (!a) a = e_app_name_find(cmd_buf);
+   if (!a) a = e_app_generic_find(cmd_buf);
+   if (a)
+     {
+       o = edje_object_add(exebuf->evas);
+       edje_object_file_set(o, a->path, "icon");
+       icon_object = o;
+       edje_object_part_swallow(bg_object, "icon_swallow", o);
+       evas_object_show(o);
+     }
 }
 
 static void
 _e_exebuf_exec(void)
 {
-   if (eap_sel)
-     e_zone_app_exec(exebuf->zone, eap_sel);
+   if (exe_sel)
+     {
+       if (exe_sel->app)
+         e_zone_app_exec(exebuf->zone, exe_sel->app);
+       else
+         e_zone_exec(exebuf->zone, exe_sel->file);
+     }
    else
      e_zone_exec(exebuf->zone, cmd_buf);
    
@@ -194,15 +313,108 @@
 static void
 _e_exebuf_next(void)
 {
-   char *exe = NULL;
+   E_Exebuf_Exe *exe;
+   Evas_List *l;
+   int i, n;
    
-   if (exe_matches) exe = exe_matches->data;
-   if (exe)
+   if (which_list == NO_LIST)
      {
-       if (strlen(exe < (EXEBUFLEN - 1)))
+       if (exes)
          {
-            strcpy(cmd_buf, exe);
-            _e_exebuf_update();
+            exe_sel = exes->data;
+            which_list = EXE_LIST;
+            if (exe_sel)
+              {
+                 edje_object_signal_emit(exe_sel->bg_object, "active", "");
+                 if (exe_sel->icon_object)
+                   edje_object_signal_emit(exe_sel->icon_object, "active", "");
+                 e_box_align_set(exe_list_object, 0.5, 1.0);
+              }
+         }
+     }
+   else
+     {
+       if (which_list == EXE_LIST)
+         {
+            if (exe_sel)
+              {
+                 n = evas_list_count(exes);
+                 for (i = 0, l = exes; l; l = l->next, i++)
+                   {
+                      if (l->data == exe_sel)
+                        {
+                           if (l->next)
+                             {
+                                edje_object_signal_emit(exe_sel->bg_object, 
"passive", "");
+                                if (exe_sel->icon_object)
+                                  
edje_object_signal_emit(exe_sel->icon_object, "passive", "");
+                                exe_sel = l->next->data;
+                                edje_object_signal_emit(exe_sel->bg_object, 
"active", "");
+                                if (exe_sel->icon_object)
+                                  
edje_object_signal_emit(exe_sel->icon_object, "active", "");
+                                if (n > 1)
+                                  {
+                                     exe_scroll_align_to = (double)(i + 1) / 
(double)(n - 1);
+                                     if (e_config->winlist_scroll_animate)
+                                       {       
+                                          exe_scroll_to = 1;
+                                          if (!exe_scroll_timer)
+                                            exe_scroll_timer = 
ecore_timer_add(0.01, _e_exebuf_exe_scroll_timer, NULL);
+                                          if (!animator)
+                                            animator = 
ecore_animator_add(_e_exebuf_animator, NULL);
+                                       }
+                                     else
+                                       {
+                                          exe_scroll_align = 
exe_scroll_align_to;
+                                          e_box_align_set(exe_list_object, 
0.5, exe_scroll_align);
+                                       }
+                                  }
+                             }
+                           break;
+                        }
+                   }
+              }
+         }
+       else if (which_list == EAP_LIST)
+         {
+            if (exe_sel)
+              {
+                 n = evas_list_count(eaps);
+                 for (i = 0, l = eaps; l; l = l->next, i++)
+                   {
+                      if (l->data == exe_sel)
+                        {
+                           if (l->prev)
+                             {
+                                edje_object_signal_emit(exe_sel->bg_object, 
"passive", "");
+                                if (exe_sel->icon_object)
+                                  
edje_object_signal_emit(exe_sel->icon_object, "passive", "");
+                                exe_sel = l->prev->data;
+                                edje_object_signal_emit(exe_sel->bg_object, 
"active", "");
+                                if (exe_sel->icon_object)
+                                  
edje_object_signal_emit(exe_sel->icon_object, "active", "");
+                                if (n > 1)
+                                  {
+                                     eap_scroll_align_to = (double)(i - 1) / 
(double)(n - 1);
+                                     if (e_config->winlist_scroll_animate)
+                                       {       
+                                          eap_scroll_to = 1;
+                                          if (!eap_scroll_timer)
+                                            eap_scroll_timer = 
ecore_timer_add(0.01, _e_exebuf_eap_scroll_timer, NULL);
+                                          if (!animator)
+                                            animator = 
ecore_animator_add(_e_exebuf_animator, NULL);
+                                       }
+                                     else
+                                       {
+                                          eap_scroll_align = 
eap_scroll_align_to;
+                                          e_box_align_set(eap_list_object, 
0.5, eap_scroll_align);
+                                       }
+                                  }
+                             }
+                           break;
+                        }
+                   }
+              }
          }
      }
 }
@@ -210,54 +422,174 @@
 static void
 _e_exebuf_prev(void)
 {
+   E_Exebuf_Exe *exe;
+   Evas_List *l;
+   int i, n;
+
+   if (which_list == NO_LIST)
+     {
+       if (eaps)
+         {
+            exe_sel = eaps->data;
+            which_list = EAP_LIST;
+            if (exe_sel)
+              {
+                 edje_object_signal_emit(exe_sel->bg_object, "active", "");
+                 if (exe_sel->icon_object)
+                   edje_object_signal_emit(exe_sel->icon_object, "active", "");
+                 e_box_align_set(eap_list_object, 0.5, 0.0);
+              }
+         }
+     }
+   else
+     {
+       if (which_list == EXE_LIST)
+         {
+            if (exe_sel)
+              {
+                 n = evas_list_count(exes);
+                 for (i = 0, l = exes; l; l = l->next, i++)
+                   {
+                      if (l->data == exe_sel)
+                        {
+                           if (l->prev)
+                             {
+                                edje_object_signal_emit(exe_sel->bg_object, 
"passive", "");
+                                if (exe_sel->icon_object)
+                                  
edje_object_signal_emit(exe_sel->icon_object, "passive", "");
+                                exe_sel = l->prev->data;
+                                edje_object_signal_emit(exe_sel->bg_object, 
"active", "");
+                                if (exe_sel->icon_object)
+                                  
edje_object_signal_emit(exe_sel->icon_object, "active", "");
+                                if (n > 1)
+                                  {
+                                     exe_scroll_align_to = (double)(i - 1) / 
(double)(n - 1);
+                                     if (e_config->winlist_scroll_animate)
+                                       {       
+                                          exe_scroll_to = 1;
+                                          if (!exe_scroll_timer)
+                                            exe_scroll_timer = 
ecore_timer_add(0.01, _e_exebuf_exe_scroll_timer, NULL);
+                                          if (!animator)
+                                            animator = 
ecore_animator_add(_e_exebuf_animator, NULL);
+                                       }
+                                     else
+                                       {
+                                          exe_scroll_align = 
exe_scroll_align_to;
+                                          e_box_align_set(exe_list_object, 
0.5, exe_scroll_align);
+                                       }
+                                  }
+                             }
+                           break;
+                        }
+                   }
+              }
+         }
+       else if (which_list == EAP_LIST)
+         {
+            if (exe_sel)
+              {
+                 n = evas_list_count(eaps);
+                 for (i = 0, l = eaps; l; l = l->next, i++)
+                   {
+                      if (l->data == exe_sel)
+                        {
+                           if (l->next)
+                             {
+                                edje_object_signal_emit(exe_sel->bg_object, 
"passive", "");
+                                if (exe_sel->icon_object)
+                                  
edje_object_signal_emit(exe_sel->icon_object, "passive", "");
+                                exe_sel = l->next->data;
+                                edje_object_signal_emit(exe_sel->bg_object, 
"active", "");
+                                if (exe_sel->icon_object)
+                                  
edje_object_signal_emit(exe_sel->icon_object, "active", "");
+                                if (n > 1)
+                                  {
+                                     eap_scroll_align_to = (double)(i + 1) / 
(double)(n - 1);
+                                     if (e_config->winlist_scroll_animate)
+                                       {       
+                                          eap_scroll_to = 1;
+                                          if (!eap_scroll_timer)
+                                            eap_scroll_timer = 
ecore_timer_add(0.01, _e_exebuf_eap_scroll_timer, NULL);
+                                          if (!animator)
+                                            animator = 
ecore_animator_add(_e_exebuf_animator, NULL);
+                                       }
+                                     else
+                                       {
+                                          eap_scroll_align = 
eap_scroll_align_to;
+                                          e_box_align_set(eap_list_object, 
0.5, eap_scroll_align);
+                                       }
+                                  }
+                             }
+                           break;
+                        }
+                   }
+              }
+         }
+     }
 }
 
 static void
 _e_exebuf_complete(void)
 {
-   char common[EXEBUFLEN], *exe;
+   char common[EXEBUFLEN], *exe = NULL;
    Evas_List *l;
-   int orig_len, common_len, exe_len, next_char, val, pos, matches;
+   int orig_len = 0, common_len = 0, exe_len, next_char, val, pos, matches;
    
-   strcpy(common, cmd_buf);
-   orig_len = common_len = strlen(common);
-   matches = 1;
-   while (matches)
-     {
-       next_char = 0;
-       matches = 0;
-       for (l = exe_matches; l; l = l->next)
-         {
-            matches = 1;
-            exe = l->data;
-            exe_len = strlen(exe);
-            if (exe_len > common_len)
-              {
-                 val = 0;
-                 pos = evas_string_char_next_get(exe, common_len, &val);
-                 if (!next_char)
-                   next_char = val;
-                 else if (next_char != val)
+   if (exe_sel)
+     {
+       if (exe_sel->app)
+         {
+            strncpy(cmd_buf, exe_sel->app->name, EXEBUFLEN - 1);
+            cmd_buf[EXEBUFLEN - 1] = 0;
+         }
+       else if (exe_sel->file)
+         {
+            strncpy(cmd_buf, exe_sel->file, EXEBUFLEN - 1);
+            cmd_buf[EXEBUFLEN - 1] = 0;
+         }
+     }
+   else
+     {
+       strcpy(common, cmd_buf);
+       orig_len = common_len = strlen(common);
+       matches = 1;
+       while (matches)
+         {
+            next_char = 0;
+            matches = 0;
+            for (l = exe_matches; l; l = l->next)
+              {
+                 matches = 1;
+                 exe = l->data;
+                 exe_len = strlen(exe);
+                 if (exe_len > common_len)
+                   {
+                      val = 0;
+                      pos = evas_string_char_next_get(exe, common_len, &val);
+                      if (!next_char)
+                        next_char = val;
+                      else if (next_char != val)
+                        {
+                           matches = 0;
+                           break;
+                        }
+                   }
+                 else
                    {
                       matches = 0;
                       break;
                    }
               }
-            else
-              {
-                 matches = 0;
-                 break;
-              }
+            if (matches) common_len++;
          }
-       if (matches) common_len++;
      }
    if ((exe) && (orig_len < common_len) && (common_len < (EXEBUFLEN - 1)))
      {
        strncpy(cmd_buf, exe, common_len);
        cmd_buf[common_len] = 0;
-       _e_exebuf_update();
-       _e_exebuf_matches_update();
      }
+   _e_exebuf_update();
+   _e_exebuf_matches_update();
 }
 
 static void
@@ -273,6 +605,7 @@
          {
             cmd_buf[pos] = 0;
             _e_exebuf_update();
+            _e_exebuf_matches_update();
          }
      }
 }
@@ -282,6 +615,8 @@
 {
    char *path, *file, buf[4096];
    Evas_Hash *added = NULL;
+   Evas_List *l, *list;
+   int i, max;
    
    /* how to match:
     * 
@@ -295,13 +630,89 @@
     * match cmd_buf* for all executables in $PATH (exclude duplicates in 
eap_matches)
     */
    _e_exebuf_matches_clear();
+   if (strlen(cmd_buf) == 0) return;
+   
+   snprintf(buf, sizeof(buf), "%s*", cmd_buf);
+   list = e_app_name_glob_list(buf);
+   for (l = list; l; l = l->next)
+     {
+       E_App *a;
+       
+       a = l->data;
+       if (a->exe)
+         {
+            if (!evas_hash_find(added, a->exe))
+              {
+                 eap_matches = evas_list_append(eap_matches, a);
+                 added = evas_hash_direct_add(added, a->exe, a->exe);
+              }
+         }
+     }
+   evas_list_free(list);
+   snprintf(buf, sizeof(buf), "%s*", cmd_buf);
+   list = e_app_exe_glob_list(buf);
+   for (l = list; l; l = l->next)
+     {
+       E_App *a;
+       
+       a = l->data;
+       if (a->exe)
+         {
+            if (!evas_hash_find(added, a->exe))
+              {
+                 eap_matches = evas_list_append(eap_matches, a);
+                 added = evas_hash_direct_add(added, a->exe, a->exe);
+              }
+         }
+     }
+   evas_list_free(list);
+   
+   snprintf(buf, sizeof(buf), "*%s*", cmd_buf);
+   list = e_app_generic_glob_list(buf);
+   for (l = list; l; l = l->next)
+     {
+       E_App *a;
+       
+       a = l->data;
+       if (a->exe)
+         {
+            if (!evas_hash_find(added, a->exe))
+              {
+                 eap_matches = evas_list_append(eap_matches, a);
+                 added = evas_hash_direct_add(added, a->exe, a->exe);
+              }
+         }
+     }
+   evas_list_free(list);
+   
+   snprintf(buf, sizeof(buf), "*%s*", cmd_buf);
+   list = e_app_comment_glob_list(buf);
+   for (l = list; l; l = l->next)
+     {
+       E_App *a;
+       
+       a = l->data;
+       if (a->exe)
+         {
+            if (!evas_hash_find(added, a->exe))
+              {
+                 eap_matches = evas_list_append(eap_matches, a);
+                 added = evas_hash_direct_add(added, a->exe, a->exe);
+              }
+         }
+     }
+   evas_list_free(list);
+
+   if (added) evas_hash_free(added);
+   added = NULL;
+   
    snprintf(buf, sizeof(buf), "%s*", cmd_buf);
    if (exe_list)
      {
        ecore_list_goto_first(exe_list);
        while ((path = ecore_list_next(exe_list)) != NULL)
          {
-            file = ecore_file_get_file(path);
+            file = (char *)ecore_file_get_file(path);
             if (file)
               {
                  if (e_util_glob_match(file, buf))
@@ -316,6 +727,94 @@
          }
      }
    if (added) evas_hash_free(added);
+   added = NULL;
+   
+   max = 20;
+   e_box_freeze(eap_list_object);
+   for (i = 0, l = eap_matches; l && (i < max); l = l->next, i++)
+     {
+       E_Exebuf_Exe *exe;
+       Evas_Coord mw, mh;
+       Evas_Object *o;
+       
+       exe = calloc(1, sizeof(E_Exebuf_Exe));
+        eaps = evas_list_append(eaps, exe);
+       exe->app = l->data;
+       /* no this is not a mistake - reference it twice */
+       e_object_ref(E_OBJECT(exe->app));
+       e_object_ref(E_OBJECT(exe->app));
+       o = edje_object_add(exebuf->evas);
+        exe->bg_object = o;
+       e_theme_edje_object_set(o, "base/theme/exebuf",
+                               "widgets/exebuf/item");
+       edje_object_part_text_set(o, "title_text", exe->app->name);
+       evas_object_show(o);
+       if (edje_object_part_exists(exe->bg_object, "icon_swallow"))
+         {
+            o = edje_object_add(exebuf->evas);
+            edje_object_file_set(o, exe->app->path, "icon");
+            exe->icon_object = o;
+            edje_object_part_swallow(exe->bg_object, "icon_swallow", o);
+            evas_object_show(o);
+         }
+       edje_object_size_min_calc(exe->bg_object, &mw, &mh);
+       e_box_pack_start(eap_list_object, exe->bg_object);
+       e_box_pack_options_set(exe->bg_object,
+                              1, 1, /* fill */
+                              1, 0, /* expand */
+                              0.5, 0.5, /* align */
+                              mw, mh, /* min */
+                              9999, mh /* max */
+                              );
+     }
+   e_box_thaw(eap_list_object);
+   /* FIXME: sort exe_matches and eap_matches in order of most recently used
+    * first, then shortest completions first
+    */
+   max = 20;
+   e_box_freeze(exe_list_object);
+   for (i = 0, l = exe_matches; l && (i < max); l = l->next, i++)
+     {
+       E_Exebuf_Exe *exe;
+       Evas_Coord mw, mh;
+       Evas_Object *o;
+       
+       exe = calloc(1, sizeof(E_Exebuf_Exe));
+       exe->file = l->data;
+        exes = evas_list_append(exes, exe);
+       o = edje_object_add(exebuf->evas);
+        exe->bg_object = o;
+       e_theme_edje_object_set(o, "base/theme/exebuf",
+                               "widgets/exebuf/item");
+       edje_object_part_text_set(o, "title_text", exe->file);
+       evas_object_show(o);
+       if (edje_object_part_exists(exe->bg_object, "icon_swallow"))
+         {
+            E_App *a;
+            
+            a = e_app_exe_find(exe->file);
+            if (a)
+              {
+                 o = edje_object_add(exebuf->evas);
+                 edje_object_file_set(o, a->path, "icon");
+                 exe->icon_object = o;
+                 edje_object_part_swallow(exe->bg_object, "icon_swallow", o);
+                 evas_object_show(o);
+                 exe->app = a;
+                 e_object_ref(E_OBJECT(exe->app));
+              }
+         }
+       edje_object_size_min_calc(exe->bg_object, &mw, &mh);
+       e_box_pack_end(exe_list_object, exe->bg_object);
+       e_box_pack_options_set(exe->bg_object,
+                              1, 1, /* fill */
+                              1, 0, /* expand */
+                              0.5, 0.5, /* align */
+                              mw, mh, /* min */
+                              9999, mh /* max */
+                              );
+     }
+   e_box_thaw(exe_list_object);
 }
 
 static int
@@ -395,13 +894,77 @@
      {
        int i;
        
-       for (i = ev->z; i < 0; i++) e_exebuf_hide();
+       for (i = ev->z; i < 0; i++) _e_exebuf_prev();
      }
    else if (ev->z > 0) /* down */
      {
        int i;
        
-       for (i = ev->z; i > 0; i--) e_exebuf_hide();
+       for (i = ev->z; i > 0; i--) _e_exebuf_next();
      }
    return 1;
 }
+
+static int
+_e_exebuf_exe_scroll_timer(void *data)
+{
+   if (exe_scroll_to)
+     {
+       double spd;
+
+       spd = e_config->winlist_scroll_speed;
+       exe_scroll_align = (exe_scroll_align * (1.0 - spd)) + 
(exe_scroll_align_to * spd);
+       return 1;
+     }
+   exe_scroll_timer = NULL;
+   return 0;
+}
+
+static int
+_e_exebuf_eap_scroll_timer(void *data)
+{
+   if (eap_scroll_to)
+     {
+       double spd;
+
+       spd = e_config->winlist_scroll_speed;
+       eap_scroll_align = (eap_scroll_align * (1.0 - spd)) + 
(eap_scroll_align_to * spd);
+       return 1;
+     }
+   eap_scroll_timer = NULL;
+   return 0;
+}
+
+static int
+_e_exebuf_animator(void *data)
+{
+   if (exe_scroll_to)
+     {
+       double da;
+       
+       da = exe_scroll_align - exe_scroll_align_to;
+       if (da < 0.0) da = -da;
+       if (da < 0.01)
+         {
+            exe_scroll_align = exe_scroll_align_to;
+            exe_scroll_to = 0;
+         }
+       e_box_align_set(exe_list_object, 0.5, 1.0 - exe_scroll_align);
+     }
+   if (eap_scroll_to)
+     {
+       double da;
+       
+       da = eap_scroll_align - eap_scroll_align_to;
+       if (da < 0.0) da = -da;
+       if (da < 0.01)
+         {
+            eap_scroll_align = eap_scroll_align_to;
+            eap_scroll_to = 0;
+         }
+       e_box_align_set(eap_list_object, 0.5, eap_scroll_align);
+     }
+   if ((exe_scroll_to) || (eap_scroll_to)) return 1;
+   animator = NULL;
+   return 0;
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_utils.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- e_utils.c   22 Nov 2005 13:28:10 -0000      1.31
+++ e_utils.c   14 Dec 2005 15:54:51 -0000      1.32
@@ -156,6 +156,27 @@
    return 0;
 }
 
+int
+e_util_glob_case_match(const char *str, const char *glob)
+{
+   char *tstr, *tglob, *p, *tp;
+   
+   if (glob[0] == 0)
+     {
+       if (str[0] == 0) return 1;
+       return 0;
+     }
+   if (!strcmp(glob, "*")) return 1;
+   tstr = alloca(strlen(str) + 1);
+   for (tp = tstr, p = str; *p != 0; p++, tp++) *tp = tolower(*p);
+   *tp = 0;
+   tglob = alloca(strlen(glob) + 1);
+   for (tp = tglob, p = glob; *p != 0; p++, tp++) *tp = tolower(*p);
+   *tp = 0;
+   if (!fnmatch(tglob, tstr, 0)) return 1;
+   return 0;
+}
+
 E_Container *
 e_util_container_number_get(int num)
 {
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_utils.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- e_utils.h   21 Sep 2005 18:02:04 -0000      1.18
+++ e_utils.h   14 Dec 2005 15:54:51 -0000      1.19
@@ -14,6 +14,7 @@
 EAPI int          e_util_utils_installed(void);
 EAPI int          e_util_app_installed(char *app);
 EAPI int          e_util_glob_match(const char *str, const char *glob);
+EAPI int          e_util_glob_case_match(const char *str, const char *glob);
 EAPI E_Container *e_util_container_number_get(int num);
 EAPI E_Zone      *e_util_container_zone_number_get(int con_num, int zone_num);
 EAPI int          e_util_head_exec(int head, char *cmd);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_winlist.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- e_winlist.c 19 Oct 2005 09:31:35 -0000      1.35
+++ e_winlist.c 14 Dec 2005 15:54:51 -0000      1.36
@@ -514,6 +514,7 @@
    if (!win_selected) return;
    ww = win_selected->data;
    edje_object_signal_emit(ww->bg_object, "active", "");
+   if (ww->icon_object) edje_object_signal_emit(ww->icon_object, "active", "");
    ok = 0;
 
    if ((ww->border->iconic) &&
@@ -608,6 +609,7 @@
      }
    edje_object_part_text_set(bg_object, "title_text", "");
    edje_object_signal_emit(ww->bg_object, "passive", "");
+   if (ww->icon_object) edje_object_signal_emit(ww->icon_object, "passive", 
"");
    if (!ww->border->lock_focus_in)
      e_border_focus_set(ww->border, 0, 0);
 }
@@ -636,6 +638,7 @@
      }
    else
      {
+       scroll_align = scroll_align_to;
        e_box_align_set(list_object, 0.5, scroll_align);
      }
 }




-------------------------------------------------------
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