'everything'
authorHannes Janetzek <hannes.janetzek@gmail.com>
Fri, 25 Sep 2009 00:27:36 +0000 (00:27 +0000)
committerHannes Janetzek <hannes.janetzek@gmail.com>
Fri, 25 Sep 2009 00:27:36 +0000 (00:27 +0000)
added simpler history sort modes

SVN revision: 42687

src/modules/everything/e_mod_main.c
src/modules/everything/e_mod_main.h
src/modules/everything/evry_config.c
src/modules/everything/evry_history.c

index d6fd5ef..cb2f141 100644 (file)
@@ -191,6 +191,7 @@ _config_init()
    E_CONFIG_VAL(D, T, view_mode, INT);
    E_CONFIG_VAL(D, T, view_zoom, INT);
    E_CONFIG_VAL(D, T, cycle_mode, INT);
+   E_CONFIG_VAL(D, T, history_sort_mode, INT);
    E_CONFIG_LIST(D, T, conf_subjects, conf_item_edd);
    E_CONFIG_LIST(D, T, conf_actions, conf_item_edd);
    E_CONFIG_LIST(D, T, conf_objects, conf_item_edd);
@@ -227,6 +228,7 @@ _config_init()
        evry_conf->view_mode = 0;
        evry_conf->view_zoom = 0;
        evry_conf->cycle_mode = 0;
+       evry_conf->history_sort_mode = 0;
      }
 
    /* TODO: remove - fix old configs */
index bfe8c4c..da1abd2 100644 (file)
@@ -39,6 +39,8 @@ struct _Config
   int view_mode;
   int view_zoom;
 
+  int history_sort_mode;
+  
   /* use up/down keys for prev/next in thumb view */
   int cycle_mode;
 
index a574957..bab66d5 100644 (file)
@@ -23,6 +23,8 @@ struct _E_Config_Dialog_Data
   int view_mode;
   int view_zoom;
   int cycle_mode;
+
+  int history_sort_mode;
   
   Evas_Object *l_subject;
   Evas_Object *l_action;
@@ -73,6 +75,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
    C(view_mode);
    C(view_zoom);
    C(cycle_mode);
+   C(history_sort_mode);
 #undef C
    
    EINA_LIST_FOREACH(evry_conf->plugins, l, p)
@@ -134,6 +137,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
   C(view_mode);
   C(view_zoom);
   C(cycle_mode);
+  C(history_sort_mode);
 #undef C
 
    evry_conf->plugins = eina_list_sort(evry_conf->plugins, -1,
@@ -254,7 +258,19 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
    ob = e_widget_check_add(evas, _("Up/Down select next item in icon view"),
                           &(cfdata->cycle_mode));
    e_widget_framelist_object_append(of, ob);
-   
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+
+   of = e_widget_framelist_add(evas, _("History Sort"), 0);
+   rg = e_widget_radio_group_new(&cfdata->history_sort_mode); 
+   ob = e_widget_radio_add(evas, "By usage", 0, rg);
+   e_widget_radio_toggle_set(ob, (cfdata->history_sort_mode == 0));
+   e_widget_framelist_object_append(of, ob);
+   ob = e_widget_radio_add(evas, "Most used", 1, rg);
+   e_widget_radio_toggle_set(ob, (cfdata->history_sort_mode == 1));
+   e_widget_framelist_object_append(of, ob);
+   ob = e_widget_radio_add(evas, "Last used", 2, rg);
+   e_widget_radio_toggle_set(ob, (cfdata->history_sort_mode == 2));
+   e_widget_framelist_object_append(of, ob);
    e_widget_list_object_append(o, of, 1, 1, 0.5);
    
    of = e_widget_framelist_add(evas, _("Commands"), 0);
index 6092cf9..0c70e74 100644 (file)
@@ -275,7 +275,9 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, c
      {
        if (hi->plugin != it->plugin->name)
          continue;
-
+       if (evry_conf->history_sort_mode == 0)
+         {
+            
        if (!input || !hi->input)
          {
             it->usage += hi->usage * hi->count;
@@ -297,6 +299,16 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, c
             if (hi->context == ctxt)
               it->usage += hi->usage * hi->count * 2;
          }
+         }
+       else if (evry_conf->history_sort_mode == 1)
+         {
+            it->usage = hi->count * (hi->last_used / 10000000000.0);
+            
+         }
+       else if (evry_conf->history_sort_mode == 2)
+         {
+            it->usage = hi->last_used;
+         }
      }
    
    if (it->usage > 0.0)