fix action deletion on exit. cleanups
authorHannes Janetzek <hannes.janetzek@gmail.com>
Wed, 28 Apr 2010 11:28:45 +0000 (11:28 +0000)
committerHannes Janetzek <hannes.janetzek@gmail.com>
Wed, 28 Apr 2010 11:28:45 +0000 (11:28 +0000)
SVN revision: 48388

src/modules/everything/e_mod_main.c
src/modules/everything/e_mod_main.h
src/modules/everything/evry.c
src/modules/everything/evry_plug_actions.c
src/modules/everything/evry_plug_aggregator.c
src/modules/everything/evry_plug_view_thumb.c

index cf60c4c..832be9f 100644 (file)
@@ -112,49 +112,43 @@ EAPI int
 e_modapi_shutdown(E_Module *m __UNUSED__)
 {
    E_Config_Dialog *cfd;
-   Evry_Action *a;
+   printf("________________________________________________\n");
 
    evry_shutdown();
 
-   /* remove module-supplied menu additions */
-   if (maug)
-     {
-       e_int_menus_menu_augmentation_del("main/1", maug);
-       maug = NULL;
-     }
-   /* remove module-supplied action */
-   if (act)
-     {
-       e_action_predef_name_del(_("Everything Launcher"), _("Show Everything Dialog"));
-       e_action_del("everything");
-     }
-
    view_thumb_shutdown();
    view_help_shutdown();
    evry_plug_clipboard_shutdown();
    evry_plug_text_shutdown();
    evry_plug_actions_shutdown();
-   /* EINA_LIST_FREE(evry_conf->plugins, p)
-    *   evry_plugin_free(p, 1);  */
 
-   EINA_LIST_FREE(evry_conf->actions, a)
-     evry_action_free(a);
+   _config_free();
+   evry_history_free();
+
+   e_configure_registry_item_del("extensions/run_everything");
+   e_configure_registry_category_del("extensions");
 
    while ((cfd = e_config_dialog_get("E", "_config_everything_dialog")))
      e_object_del(E_OBJECT(cfd));
 
-   e_configure_registry_item_del("extensions/run_everything");
-   e_configure_registry_category_del("extensions");
+   if (act)
+     {
+       e_action_predef_name_del(_("Everything Launcher"), _("Show Everything Dialog"));
+       e_action_del("everything");
+     }
 
-   _config_free();
-   evry_history_free();
+   if (maug)
+     {
+       e_int_menus_menu_augmentation_del("main/1", maug);
+       maug = NULL;
+     }
 
    /* Clean EET */
    E_CONFIG_DD_FREE(conf_edd);
    E_CONFIG_DD_FREE(plugin_conf_edd);
    E_CONFIG_DD_FREE(plugin_setting_edd);
    e_datastore_del("everything_loaded");
-
+   printf("________________________________________________\n");
    return 1;
 }
 
@@ -296,29 +290,34 @@ static void
 _config_free(void)
 {
    Plugin_Config *pc;
-   int i;
-   Eina_List *conf[3];
-
-   conf[0] = evry_conf->conf_subjects;
-   conf[1] = evry_conf->conf_actions;
-   conf[2] = evry_conf->conf_objects;
 
-   for (i = 0; i < 3; i++)
+   EINA_LIST_FREE(evry_conf->conf_subjects, pc)
      {
-       EINA_LIST_FREE(conf[i], pc)
-         {
-            if (pc->name) eina_stringshare_del(pc->name);
-            if (pc->trigger) eina_stringshare_del(pc->trigger);
-            if (pc->plugin) evry_plugin_free(pc->plugin);
-            E_FREE(pc);
-         }
+       if (pc->name) eina_stringshare_del(pc->name);
+       if (pc->trigger) eina_stringshare_del(pc->trigger);
+       if (pc->plugin) evry_plugin_free(pc->plugin);
+       E_FREE(pc);
+     }
+   EINA_LIST_FREE(evry_conf->conf_actions, pc)
+     {
+       if (pc->name) eina_stringshare_del(pc->name);
+       if (pc->trigger) eina_stringshare_del(pc->trigger);
+       if (pc->plugin) evry_plugin_free(pc->plugin);
+       E_FREE(pc);
+     }
+   EINA_LIST_FREE(evry_conf->conf_objects, pc)
+     {
+       if (pc->name) eina_stringshare_del(pc->name);
+       if (pc->trigger) eina_stringshare_del(pc->trigger);
+       if (pc->plugin) evry_plugin_free(pc->plugin);
+       E_FREE(pc);
      }
 
    if (evry_conf->cmd_terminal)
      eina_stringshare_del(evry_conf->cmd_terminal);
    if (evry_conf->cmd_sudo)
      eina_stringshare_del(evry_conf->cmd_sudo);
-
+   
    E_FREE(evry_conf);
 }
 
@@ -464,8 +463,6 @@ evry_plugin_new(Evry_Plugin *base, const char *name, const char *label,
 void
 evry_plugin_free(Evry_Plugin *p)
 {
-   evry_plugin_unregister(p);
-
    evry_item_free(EVRY_ITEM(p));
 }
 
@@ -530,13 +527,14 @@ void
 evry_plugin_unregister(Evry_Plugin *p)
 {
    DBG("%s", p->name);
+   Eina_List *l = evry_conf->conf_subjects;
 
-   if (eina_list_data_find_list(evry_conf->conf_subjects, p->config))
+   if (l && eina_list_data_find_list(l, p->config))
      {
-       char buf[256];
-       snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name);
-
-       e_action_predef_name_del(_("Everything"), buf);
+       /* char buf[256];
+        * snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name);
+        * 
+        * e_action_predef_name_del(_("Everything"), buf); */
      }
 }
 
index 7b36350..95ba4f8 100644 (file)
@@ -103,6 +103,5 @@ EAPI int evry_browse_item(Evry_Selector *sel);
 EAPI int evry_browse_back(Evry_Selector *sel);
 
 extern Evry_Selector **selectors;
-extern const char *action_selector;
 
 #endif
index f62d0b0..634dc70 100644 (file)
@@ -91,13 +91,11 @@ static Evry_Selector *selector = NULL;
 static const char *thumb_types = NULL;
 
 Evry_Selector **selectors = NULL;
-const char *action_selector;
 
 /* externally accessible functions */
 int
 evry_init(void)
 {
-   action_selector = eina_stringshare_add(_("Select Action"));
    thumb_types = eina_stringshare_add("FILE");
    return 1;
 }
@@ -108,7 +106,6 @@ evry_shutdown(void)
    evry_hide();
 
    eina_stringshare_del(thumb_types);
-   eina_stringshare_del(action_selector);
    return 1;
 }
 
@@ -446,8 +443,8 @@ _evry_selector_update_actions(Evry_Selector *sel)
    if (sel->update_timer)
      ecore_timer_del(sel->update_timer);
 
-   _evry_timer_cb_actions_get(it);
-   /* sel->update_timer = ecore_timer_add(0.1, _evry_timer_cb_actions_get, it); */
+   /* _evry_timer_cb_actions_get(it); */
+   sel->update_timer = ecore_timer_add(0.1, _evry_timer_cb_actions_get, it);
 }
 
 EAPI void
@@ -1142,8 +1139,6 @@ _evry_selector_objects_get(Evry_Action *act)
    Evry_Plugin *p, *pp;
    Evry_Selector *sel = selectors[2];
    Evry_Item *it;
-   /* required type */
-   /* const char *type_in = act->type_in2; */
 
    while (sel->state)
      _evry_state_pop(sel);
@@ -1152,8 +1147,6 @@ _evry_selector_objects_get(Evry_Action *act)
 
    EINA_LIST_FOREACH(sel->plugins, l, p)
      {
-       printf("check %s %s\n", EVRY_ITEM(p)->subtype, act->type_in2);
-
        if (!evry_item_type_check(EVRY_ITEM(p), NULL, act->type_in2))
          continue;
 
index 6474083..69030c7 100644 (file)
@@ -12,7 +12,6 @@ struct _Plugin
   Eina_List *actions;
   Eina_Bool parent;
   Evry_Action *action;
-
 };
 
 static Evry_Plugin *_base_plug = NULL;
@@ -163,7 +162,12 @@ int evry_plug_actions_init()
 
 void evry_plug_actions_shutdown()
 {
+   Evry_Action *a;
+
    evry_plugin_free(_base_plug);
+
+   EINA_LIST_FREE(evry_conf->actions, a)
+     evry_action_free(a);
 }
 
 
@@ -208,8 +212,6 @@ evry_action_new(const char *name, const char *label,
    act->base.icon = icon;
    act->base.type = eina_stringshare_add("ACTION");
 
-   printf("icon %s\n", act->base.icon);
-
    act->name = eina_stringshare_add(name);
 
    act->type_in1 = (type_in1 ? eina_stringshare_add(type_in1) : NULL);
index bb307dc..2d74377 100644 (file)
@@ -10,11 +10,11 @@ struct _Plugin
   Evry_Selector *selector;
 };
 
-inline static int
-_is_action(const Evry_Item *it)
-{
-   return (it->plugin->name == action_selector);
-}
+/* inline static int
+ * _is_action(const Evry_Item *it)
+ * {
*    return (it->plugin->name == action_selector);
+ * } */
 
 static int
 _cb_sort_recent(const void *data1, const void *data2)
@@ -29,17 +29,17 @@ _cb_sort_recent(const void *data1, const void *data2)
    if (it2->usage && !it1->usage)
      return 1;
 
-   if (_is_action(it1) || _is_action(it2))
-     {
-       if (_is_action(it1) && _is_action(it2))
-         return (it1->priority - it2->priority);
-       else if (_is_action(it1))
-         return ((it1->plugin->config->priority + it1->priority) -
-                 (it2->plugin->config->priority));
-       else
-         return ((it1->plugin->config->priority) -
-                 (it2->plugin->config->priority + it2->priority));
-     }
+   /* if (_is_action(it1) || _is_action(it2))
+    *   {
+    *  if (_is_action(it1) && _is_action(it2))
+    *    return (it1->priority - it2->priority);
+    *  else if (_is_action(it1))
+    *    return ((it1->plugin->config->priority + it1->priority) -
+    *            (it2->plugin->config->priority));
+    *  else
+    *    return ((it1->plugin->config->priority) -
+    *            (it2->plugin->config->priority + it2->priority));
+    *   } */
 
    if (it1->plugin == it2->plugin)
      return (it1->priority - it2->priority);
@@ -62,17 +62,17 @@ _cb_sort(const void *data1, const void *data2)
    if (it2->usage && !it1->usage)
      return 1;
 
-   if (_is_action(it1) || _is_action(it2))
-     {
-       if (_is_action(it1) && _is_action(it2))
-         return (it1->priority - it2->priority);
-       else if (_is_action(it1))
-         return ((it1->plugin->config->priority + it1->priority)
-                 - it2->plugin->config->priority);
-       else
-         return (it1->plugin->config->priority -
-                 (it1->plugin->config->priority + it2->priority));
-     }
+   /* if (_is_action(it1) || _is_action(it2))
+    *   {
+    *  if (_is_action(it1) && _is_action(it2))
+    *    return (it1->priority - it2->priority);
+    *  else if (_is_action(it1))
+    *    return ((it1->plugin->config->priority + it1->priority)
+    *            - it2->plugin->config->priority);
+    *  else
+    *    return (it1->plugin->config->priority -
+    *            (it1->plugin->config->priority + it2->priority));
+    *   } */
 
    if ((it1->plugin == it2->plugin) &&
        (it1->priority - it2->priority))
index f41e148..19b3be5 100644 (file)
@@ -457,10 +457,10 @@ _e_smart_del(Evas_Object *obj)
        evry_item_free(it->item);
        free(it);
      }
+   evas_object_del(sd->selector);
+   
    free(sd);
    evas_object_smart_data_set(obj, NULL);
-
-   evas_object_del(sd->selector);
 }
 
 static void