added Plugin_Selected event
authorHannes Janetzek <hannes.janetzek@gmail.com>
Wed, 2 Jun 2010 23:19:02 +0000 (23:19 +0000)
committerHannes Janetzek <hannes.janetzek@gmail.com>
Wed, 2 Jun 2010 23:19:02 +0000 (23:19 +0000)
SVN revision: 49403

src/modules/everything/e_mod_main.c
src/modules/everything/e_mod_main.h
src/modules/everything/evry.c
src/modules/everything/evry_api.h
src/modules/everything/evry_gadget.c
src/modules/everything/evry_view.c

index 116e74c..5b4e158 100644 (file)
@@ -26,7 +26,7 @@ static E_Config_DD *plugin_conf_edd = NULL;
 static E_Config_DD *collection_conf_edd = NULL;
 
 Evry_Config *evry_conf = NULL;
-int _evry_events[4];
+int _evry_events[NUM_EVRY_EVENTS];
 int _e_module_evry_log_dom = -1;
 
 
@@ -102,6 +102,7 @@ e_modapi_init(E_Module *m)
    _evry_events[EVRY_EVENT_ITEM_SELECTED]    = ecore_event_type_new();
    _evry_events[EVRY_EVENT_ITEM_CHANGED]     = ecore_event_type_new();
    _evry_events[EVRY_EVENT_ACTION_PERFORMED] = ecore_event_type_new();
+   _evry_events[EVRY_EVENT_PLUGIN_SELECTED]  = ecore_event_type_new();
 
    e_module_delayed_set(m, 0);
 
@@ -216,11 +217,8 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
 
 #ifdef CHECK_REFS
    Evry_Item *it;
-   printf("___________________________________________\n");
-
    EINA_LIST_FREE(_refd, it)
      printf("%d %s\n", it->ref, it->label);
-
 #endif
 
    return 1;
@@ -417,8 +415,8 @@ _config_init()
    evry_conf->view_zoom = 0;
    evry_conf->cycle_mode = 0;
    evry_conf->history_sort_mode = 0;
-   evry_conf->edge_width = 370;
-   evry_conf->edge_height = 435;
+   evry_conf->edge_width = 340;
+   evry_conf->edge_height = 385;
    evry_conf->first_run = EINA_TRUE;
 
    pcc = E_NEW(Plugin_Config, 1);
index 0f9abc6..0d9ca53 100644 (file)
@@ -322,12 +322,11 @@ int   evry_view_toggle(Evry_State *s, const char *trigger);
 int evry_gadget_init(void);
 void evry_gadget_shutdown(void);
 
-
 Ecore_Event_Handler *evry_event_handler_add(int type, int (*func) (void *data, int type, void *event), const void *data);
 
 extern Evry_History *evry_hist;
 extern Evry_Config  *evry_conf;
-extern int  _evry_events[4];
+extern int  _evry_events[NUM_EVRY_EVENTS];
 
 #define EVRY_ITEM_NEW(_base, _plugin, _label, _icon_get, _free)                \
   (_base *) evry_item_new(EVRY_ITEM(E_NEW(_base, 1)), EVRY_PLUGIN(_plugin), \
index 495361f..7ee5563 100644 (file)
@@ -1452,9 +1452,10 @@ _evry_selector_update(Evry_Selector *sel)
    if ((it = s->cur_item))
      {
        if (!s->plugin || !eina_list_data_find_list(s->plugin->items, it))
-         _evry_item_desel(s);
-
-       item_changed = EINA_TRUE;
+         {
+            _evry_item_desel(s);
+            item_changed = EINA_TRUE;
+         }
      }
 
    /* get first item */
@@ -1462,9 +1463,10 @@ _evry_selector_update(Evry_Selector *sel)
      {
        it = eina_list_data_get(s->plugin->items);
        s->item_auto_selected = EINA_TRUE;
+       if (!s->cur_plugins || (it != s->cur_item))
+         item_changed = EINA_TRUE;
+       
        _evry_item_sel(s, it);
-
-       item_changed = EINA_TRUE;
      }
 
    _evry_selector_item_update(sel);
@@ -1543,19 +1545,17 @@ _evry_selector_objects_get(Evry_Action *act)
    Eina_List *l, *plugins = NULL;
    Evry_Plugin *p, *pp;
    Evry_Selector *sel = OBJ_SEL;
-   Evry_Item *it;
 
    while (sel->state)
      _evry_state_pop(sel, 1);
 
-   it = (ACTN_SEL)->state->cur_item;
-
    EINA_LIST_FOREACH(sel->plugins, l, p)
      {
+       /* plugin provides items matching object for action*/
        if (!CHECK_SUBTYPE(p, act->it2.type))
          continue;
 
-       if (p->begin && (pp = p->begin(p, it)))
+       if (p->begin && (pp = p->begin(p, EVRY_ITEM(act))))
          plugins = eina_list_append(plugins, pp);
 
        if (!p->begin)
@@ -2942,9 +2942,20 @@ _evry_plugin_select(Evry_State *s, Evry_Plugin *p)
    s->plugin = p;
 }
 
+static void
+_evry_cb_free_plugin_selected(void *data, void *event)
+{
+   Evry_Event_Item_Selected *ev = event;
+
+   evry_item_free(ev->item);
+   E_FREE(ev);
+}
+
 void
 evry_plugin_select(Evry_Plugin *p)
 {
+   Evry_Event_Item_Selected *ev;
+   
    if (!p) return;
 
    if (!p->state)
@@ -2954,8 +2965,13 @@ evry_plugin_select(Evry_Plugin *p)
      }
 
    _evry_plugin_select(p->state, p);
-
    _evry_selector_update(p->state->selector);
+
+   ev = E_NEW(Evry_Event_Item_Selected, 1);
+   ev->item = EVRY_ITEM(p);
+   EVRY_ITEM_REF(p);
+   ecore_event_add(_evry_events[EVRY_EVENT_PLUGIN_SELECTED], ev,
+                  _evry_cb_free_plugin_selected, NULL);
 }
 
 static void
index ba98658..127919b 100644 (file)
 #define EVRY_EVENT_ITEM_CHANGED                1
 #define EVRY_EVENT_ITEMS_UPDATE                2
 #define EVRY_EVENT_ACTION_PERFORMED    3
+#define EVRY_EVENT_PLUGIN_SELECTED     4
+#define NUM_EVRY_EVENTS                        5
 
 typedef struct _Evry_API Evry_API;
 typedef struct _Evry_Module Evry_Module;
 
 typedef struct _Evry_Event_Item_Changed     Evry_Event_Item_Changed;
+typedef struct _Evry_Event_Item_Selected    Evry_Event_Item_Selected;
 typedef struct _Evry_Event_Action_Performed Evry_Event_Action_Performed;
 
 
@@ -129,6 +132,11 @@ struct _Evry_Event_Item_Changed
   int changed_icon;
 };
 
+struct _Evry_Event_Item_Selected
+{
+  Evry_Item *item;
+};
+
 struct _Evry_Event_Action_Performed
 {
   const char *action;
index 258c805..b7e4504 100644 (file)
@@ -154,6 +154,14 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
                                          &cx, &cy, NULL, NULL);
        x += cx;
        y += cy;
+       /* evas_object_resize(win->o_main,
+        *                 evry_conf->edge_width,
+        *                 evry_conf->edge_height);
+        * 
+        * e_popup_resize(win->popup,
+        *             evry_conf->edge_width,
+        *             evry_conf->edge_height); */
+
        pw = win->popup->w;
        ph = win->popup->h;
 
index e3abfc4..f3a8d44 100644 (file)
@@ -370,7 +370,7 @@ _e_smart_reconfigure_do(void *data)
             col = 2;
             aspect_w = width * 2;
          }
-       else if ((cnt < 9) && (sd->w < (double)sd->h * 1.5))
+       else if ((cnt < 9) && (sd->w < (double)sd->h * 1.2))
          {
             col = 2;
             aspect_w = width * 3;