Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/modules/ibar


Modified Files:
        e_mod_main.c 


Log Message:


empty ibar now lets u click on it for config...

===================================================================
RCS file: /cvs/e/e17/apps/e/src/modules/ibar/e_mod_main.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -3 -r1.116 -r1.117
--- e_mod_main.c        10 May 2006 09:18:27 -0000      1.116
+++ e_mod_main.c        10 May 2006 11:58:20 -0000      1.117
@@ -49,6 +49,7 @@
    Evas_Object    *o_box;
    Evas_Object    *o_drop;
    Evas_Object    *o_drop_over;
+   Evas_Object    *o_empty;
    IBar_Icon      *ic_drop_before;
    int             drop_before;
    E_App          *apps;
@@ -74,6 +75,8 @@
 
 static IBar *_ibar_new(Evas *evas, char *dir);
 static void _ibar_free(IBar *b);
+static void _ibar_cb_empty_mouse_down(void *data, Evas *e, Evas_Object *obj, 
void *event_info);
+static void _ibar_empty_handle(IBar *b);
 static void _ibar_fill(IBar *b);
 static void _ibar_empty(IBar *b);
 static void _ibar_orient_set(IBar *b, int horizontal);
@@ -271,26 +274,104 @@
    evas_object_del(b->o_box);
    if (b->o_drop) evas_object_del(b->o_drop);
    if (b->o_drop_over) evas_object_del(b->o_drop_over);
+   if (b->o_empty) evas_object_del(b->o_empty);
    if (b->apps) e_object_unref(E_OBJECT(b->apps));
    e_app_change_callback_del(_ibar_cb_app_change, b);
    free(b);
 }
 
 static void
+_ibar_cb_empty_mouse_down(void *data, Evas *e, Evas_Object *obj, void 
*event_info)
+{
+   Evas_Event_Mouse_Down *ev;
+   IBar *b;
+   
+   ev = event_info;
+   b = data;
+   if (!ibar_config->menu)
+     {
+       E_Menu *mn;
+       E_Menu_Item *mi;
+       int cx, cy, cw, ch;
+       
+       mn = e_menu_new();
+       e_menu_post_deactivate_callback_set(mn, _ibar_cb_menu_post, NULL);
+       ibar_config->menu = mn;
+
+       mi = e_menu_item_new(mn);
+       e_menu_item_label_set(mi, _("Configuration"));
+       e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
+       e_menu_item_callback_set(mi, _ibar_cb_menu_configuration, b);
+       
+       mi = e_menu_item_new(mn);
+       e_menu_item_separator_set(mi, 1);
+       
+       e_gadcon_client_util_menu_items_append(b->inst->gcc, mn, 0);
+       
+       e_gadcon_canvas_zone_geometry_get(b->inst->gcc->gadcon,
+                                         &cx, &cy, &cw, &ch);
+       e_menu_activate_mouse(mn,
+                             e_util_zone_current_get(e_manager_current_get()),
+                             cx + ev->output.x, cy + ev->output.y, 1, 1,
+                             E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
+       evas_event_feed_mouse_up(b->inst->gcc->gadcon->evas, ev->button,
+                                EVAS_BUTTON_NONE, ev->timestamp, NULL);
+     }
+}
+
+static void
+_ibar_empty_handle(IBar *b)
+{
+   if (!b->icons)
+     {
+       if (!b->o_empty)
+         {
+            Evas_Coord w, h;
+            
+            b->o_empty = 
evas_object_rectangle_add(evas_object_evas_get(b->o_box));
+            evas_object_event_callback_add(b->o_empty, 
EVAS_CALLBACK_MOUSE_DOWN, _ibar_cb_empty_mouse_down, b);
+            evas_object_color_set(b->o_empty, 0, 0, 0, 0);
+            evas_object_show(b->o_empty);
+            e_box_pack_end(b->o_box, b->o_empty);
+            evas_object_geometry_get(b->o_box, NULL, NULL, &w, &h);
+            if (e_box_orientation_get(b->o_box))
+              w = h;
+            else
+              h = w;
+            e_box_pack_options_set(b->o_empty,
+                                   1, 1, /* fill */
+                                   1, 1, /* expand */
+                                   0.5, 0.5, /* align */
+                                   w, h, /* min */
+                                   w, h /* max */
+                                   );
+         }
+     }
+   else if (b->o_empty)
+     {
+       evas_object_del(b->o_empty);
+       b->o_empty = NULL;
+     }
+}
+
+static void
 _ibar_fill(IBar *b)
 {
    IBar_Icon *ic;
    Evas_List *l;
    E_App *a;
 
-   if (!b->apps) return;
-   for (l = b->apps->subapps; l; l = l->next)
+   if (b->apps)
      {
-       a = l->data;
-       ic = _ibar_icon_new(b, a);
-       b->icons = evas_list_append(b->icons, ic);
-       e_box_pack_end(b->o_box, ic->o_holder);
+       for (l = b->apps->subapps; l; l = l->next)
+         {
+            a = l->data;
+            ic = _ibar_icon_new(b, a);
+            b->icons = evas_list_append(b->icons, ic);
+            e_box_pack_end(b->o_box, ic->o_holder);
+         }
      }
+   _ibar_empty_handle(b);
    _ibar_resize_handle(b);
 }
 
@@ -302,6 +383,7 @@
        _ibar_icon_free(b->icons->data);
        b->icons = evas_list_remove_list(b->icons, b->icons);
      }
+   _ibar_empty_handle(b);
 }
 
 static void
@@ -570,6 +652,7 @@
                       b->icons = evas_list_append(b->icons, ic);
                       e_box_pack_end(b->o_box, ic->o_holder);
                    }
+                 _ibar_empty_handle(b);
                  _ibar_resize_handle(b);
                  _gc_orient(b->inst->gcc);
               }
@@ -590,6 +673,7 @@
                  b->icons = evas_list_remove(b->icons, ic);
                  _ibar_icon_free(ic);
               }
+            _ibar_empty_handle(b);
             _ibar_resize_handle(b);
             _gc_orient(b->inst->gcc);
          }
@@ -694,11 +778,11 @@
 static void
 _ibar_cb_menu_configuration(void *data, E_Menu *m, E_Menu_Item *mi)
 {
-   IBar_Icon *ic;
+   IBar *b;
    Config_Item *ci;
    
-   ic = data;
-   ci = _ibar_config_item_get(ic->ibar->inst->gcc->id);
+   b = data;
+   ci = _ibar_config_item_get(b->inst->gcc->id);
    _config_ibar_module(ci);
 }
 
@@ -778,7 +862,7 @@
        mi = e_menu_item_new(mn);
        e_menu_item_label_set(mi, _("Configuration"));
        e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration");
-       e_menu_item_callback_set(mi, _ibar_cb_menu_configuration, ic);
+       e_menu_item_callback_set(mi, _ibar_cb_menu_configuration, ic->ibar);
        
        e_gadcon_client_util_menu_items_append(ic->ibar->inst->gcc, mn, 0);
        




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