Enlightenment CVS committal

Author  : handyande
Project : misc
Module  : engage

Dir     : misc/engage/src/module


Modified Files:
        e_mod_main.c e_mod_main.h 


Log Message:
Update a lot of the engage icon ordering, removes 'duplicate icon' bug too
Am currently ignoring ORDER_CHANGE events, until I can get a good solution
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/module/e_mod_main.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -3 -r1.73 -r1.74
--- e_mod_main.c        1 Dec 2005 13:52:15 -0000       1.73
+++ e_mod_main.c        5 Dec 2005 21:00:35 -0000       1.74
@@ -394,19 +394,28 @@
           case E_APP_ADD:
             if (e_app_is_parent(e->apps, a))
               {
-                 Engage_Icon *ic;
+                 Engage_Icon *ic, *ic2;
 
                  e_box_freeze(eb->box_object);
-                 ic = _engage_icon_new(eb, a);
+                 ic = _engage_icon_find(eb, a);
                  if (ic)
                    {
-                      for (ll = e->apps->subapps; ll; ll = ll->next)
+                      ic->dotorder = 1;
+                   }
+                 else
+                   {
+                      ic = _engage_icon_new(eb, a);
+                      if (ic)
                         {
-                           E_App *a2;
-
-                           a2 = ll->data;
-                           ic = _engage_icon_find(eb, a2);
-                           if (ic) _engage_icon_reorder_after(ic, NULL);
+                           ic->dotorder = 1;
+                           for (ll = e->apps->subapps; ll; ll = ll->next)
+                             {
+                                E_App *a2;
+
+                                a2 = ll->data;
+                                ic2 = _engage_icon_find(eb, a2);
+                                if (ic2) _engage_icon_reorder_after(ic, ic2);
+                             }
                         }
                       _engage_bar_frame_resize(eb);
                    }
@@ -419,21 +428,29 @@
                  Engage_Icon *ic;
 
                  ic = _engage_icon_find(eb, a);
-                 if (ic) _engage_icon_free(ic);
+                 if (ic)
+                   {
+                      ic->dotorder = 0;
+                      if (!ic->extra_icons)
+                        _engage_icon_free(ic);
+                   }
                  _engage_bar_frame_resize(eb);
               }
             break;
           case E_APP_CHANGE:
             if (e_app_is_parent(e->apps, a))
               {
-                 Engage_Icon *ic;
-                 Evas_List *extras;
+                 Engage_Icon *ic, *ic2;
+                 Evas_List *extras = NULL;
 
                  e_box_freeze(eb->box_object);
                  ic = _engage_icon_find(eb, a);
-                 extras = ic->extra_icons;
-                 ic->extra_icons = NULL;
-                 if (ic) _engage_icon_free(ic);
+                 if (ic)
+                   {
+                      extras = ic->extra_icons;
+                      ic->extra_icons = NULL;
+                      _engage_icon_free(ic);
+                   }
                  evas_image_cache_flush(eb->evas);
                  evas_image_cache_reload(eb->evas);
                  ic = _engage_icon_new(eb, a);
@@ -445,8 +462,8 @@
                            E_App *a2;
 
                            a2 = ll->data;
-                           ic = _engage_icon_find(eb, a2);
-                           if (ic) _engage_icon_reorder_after(ic, NULL);
+                           ic2 = _engage_icon_find(eb, a2);
+                           if (ic2) _engage_icon_reorder_after(ic, ic2);
                         }
                       _engage_bar_frame_resize(eb);
                    }
@@ -456,6 +473,7 @@
           case E_APP_ORDER:
             if (a == e->apps)
               {
+/* FIXME - this is moving all .order icons to after the others - BAD
                  e_box_freeze(eb->box_object);
                  for (ll = e->apps->subapps; ll; ll = ll->next)
                    {
@@ -467,6 +485,7 @@
                       if (ic) _engage_icon_reorder_after(ic, NULL);
                    }
                  e_box_thaw(eb->box_object);
+*/
               }
             break;
           case E_APP_EXEC:
@@ -766,42 +785,25 @@
 
    mn = e_menu_new();
    eb->icon_menu = mn;
-   
-   //check if selected_ic is in .order
-   
-   int indotorder = 0;
-   if (eb->engage->apps && eb->selected_ic)
-     {
-       Evas_List *ll;
-       for (ll = eb->engage->apps->subapps; ll; ll = ll->next)
-         {
-            E_App *a;
-            Engage_Icon *ic;
 
-            a = ll->data;
-            if (eb->selected_ic->app == a)
-              {
-                 indotorder = 1;
-                 break;
-              }
-         }
-     }
-   
-   mi = e_menu_item_new(mn);
-   e_menu_item_label_set(mi, "Edit Icon");
-   e_menu_item_callback_set(mi, _engage_bar_cb_menu_edit_icon, eb);
-   
-   if (!indotorder)
-     {
-       mi = e_menu_item_new(mn);
-       e_menu_item_label_set(mi, "Keep Icon");
-       e_menu_item_callback_set(mi, _engage_bar_cb_menu_keep_icon, eb);
-     }
-   else
+   if (eb->selected_ic)
      {
        mi = e_menu_item_new(mn);
-       e_menu_item_label_set(mi, "Remove Icon");
-       e_menu_item_callback_set(mi, _engage_bar_cb_menu_remove_icon, eb);
+       e_menu_item_label_set(mi, "Edit Icon");
+       e_menu_item_callback_set(mi, _engage_bar_cb_menu_edit_icon, eb);
+
+       if (!eb->selected_ic->dotorder)
+         {
+            mi = e_menu_item_new(mn);
+            e_menu_item_label_set(mi, "Keep Icon");
+            e_menu_item_callback_set(mi, _engage_bar_cb_menu_keep_icon, eb);
+         }
+       else
+         {
+            mi = e_menu_item_new(mn);
+            e_menu_item_label_set(mi, "Remove Icon");
+            e_menu_item_callback_set(mi, _engage_bar_cb_menu_remove_icon, eb);
+         }
      }
 
    mn = e_menu_new();
@@ -921,7 +923,7 @@
    ic->eb = eb;
    ic->app = a;
    ic->scale = 1.0;
-   ic->temp = 0;
+   ic->dotorder = 0;
    ic->selected_app = NULL;
    e_object_ref(E_OBJECT(a));
    eb->icons = evas_list_append(eb->icons, ic);
@@ -1010,6 +1012,10 @@
        ic = l->data;
        if (ic->app == a) return ic;
        if (((E_App *)ic->app)->orig == a) return ic;
+
+/* FIXME - this could be slow - is there a reason we need to check the path -
+ * why would the other two fail if we are referencing the same eap? */
+       if (!strcmp(((E_App *)ic->app)->path, a->path)) return ic;
      }
    return NULL;
 }
@@ -1233,7 +1239,7 @@
        ic = _engage_icon_new(eb, app);
        if (ic)
          {
-            ic->temp = 1;
+            ic->dotorder = 0;
             _engage_bar_frame_resize(eb);
          }
      }
@@ -1298,7 +1304,7 @@
        if (ai->border == e->border)
          {
              _engage_app_icon_free(ai);
-             if (!ic->extra_icons && ic->temp == 1)
+             if (!ic->extra_icons && ic->dotorder == 0)
                {
                   _engage_icon_free(ic);
                   _engage_bar_frame_resize(eb);
@@ -1340,7 +1346,7 @@
        ic = _engage_icon_new(eb, app);
        if (ic)
          {
-            ic->temp = 1;
+            ic->dotorder = 0;
             _engage_bar_frame_resize(eb);
          }
      }
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/module/e_mod_main.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- e_mod_main.h        24 Sep 2005 14:03:47 -0000      1.20
+++ e_mod_main.h        5 Dec 2005 21:00:35 -0000       1.21
@@ -101,7 +101,7 @@
    Evas_List     *extra_icons, *selected_app;
 
    double         scale;
-   int            temp;
+   int            dotorder;
 };
 
 struct _Engage_App_Icon




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