'everything'
authorHannes Janetzek <hannes.janetzek@gmail.com>
Thu, 24 Sep 2009 21:09:25 +0000 (21:09 +0000)
committerHannes Janetzek <hannes.janetzek@gmail.com>
Thu, 24 Sep 2009 21:09:25 +0000 (21:09 +0000)
- added option for default view mode

SVN revision: 42684

src/modules/everything/e_mod_main.c
src/modules/everything/e_mod_main.h
src/modules/everything/evry.c
src/modules/everything/evry_config.c
src/modules/everything/views/evry_plug_view_thumb.c

index f637611..d6fd5ef 100644 (file)
@@ -188,6 +188,9 @@ _config_init()
    E_CONFIG_VAL(D, T, quick_nav, INT);
    E_CONFIG_VAL(D, T, cmd_terminal, STR);
    E_CONFIG_VAL(D, T, cmd_sudo, STR);
+   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_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);
@@ -221,8 +224,12 @@ _config_init()
        evry_conf->conf_views   = NULL;
        evry_conf->cmd_terminal = eina_stringshare_add("/usr/bin/xterm");
        evry_conf->cmd_sudo = eina_stringshare_add("/usr/bin/gksudo --preserve-env");
+       evry_conf->view_mode = 0;
+       evry_conf->view_zoom = 0;
+       evry_conf->cycle_mode = 0;
      }
 
+   /* TODO: remove - fix old configs */
    if ((evry_conf->rel_x > 1.0) ||
        (evry_conf->rel_x < 0.0))
      evry_conf->rel_x = 0.5;
index b7ae908..bfe8c4c 100644 (file)
@@ -36,6 +36,12 @@ struct _Config
   const char *cmd_terminal;
   const char *cmd_sudo;
 
+  int view_mode;
+  int view_zoom;
+
+  /* use up/down keys for prev/next in thumb view */
+  int cycle_mode;
+
   /* not saved data */
   Eina_List *plugins;
   Eina_List *actions;
index 5c9b402..65f9b88 100644 (file)
@@ -171,9 +171,6 @@ evry_show(E_Zone *zone, const char *params)
       (ECORE_X_EVENT_SELECTION_NOTIFY,
        _evry_cb_selection_notify, win));
 
-   /* e_popup_move(win->popup,  win->popup->x,  win->popup->y  - list->popup->h/2);
-    * e_popup_move(list->popup, list->popup->x, list->popup->y - list->popup->h/2); */
-
    e_popup_layer_set(list->popup, 255);
    e_popup_layer_set(win->popup, 255);
    e_popup_show(win->popup);
index a85c96e..a574957 100644 (file)
@@ -1,14 +1,9 @@
 #include "e_mod_main.h"
 
-/* typedef struct _E_Config_Dialog_Data E_Config_Dialog_Data; */
-
 static void        *_create_data             (E_Config_Dialog *cfd);
 static void         _free_data               (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
 static int          _basic_apply_data        (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
 static Evas_Object *_basic_create_widgets    (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
-/* static int _subject = type_subject;
- * static int _action  = type_action;
- * static int _object  = type_object; */
 
 
 struct _E_Config_Dialog_Data
@@ -25,6 +20,10 @@ struct _E_Config_Dialog_Data
   char *cmd_terminal;
   char *cmd_sudo;
 
+  int view_mode;
+  int view_zoom;
+  int cycle_mode;
+  
   Evas_Object *l_subject;
   Evas_Object *l_action;
   Evas_Object *l_object;
@@ -63,14 +62,18 @@ _fill_data(E_Config_Dialog_Data *cfdata)
    Eina_List *l;
    Evry_Plugin *p;
 
-   /* cfdata->scroll_animate = evry_conf->scroll_animate; */
-   cfdata->height = evry_conf->height;
-   cfdata->width = evry_conf->width;
-   cfdata->hide_list = evry_conf->hide_list;
-   cfdata->hide_input = evry_conf->hide_input;
-   cfdata->quick_nav = evry_conf->quick_nav;
-   cfdata->rel_x = evry_conf->rel_x;
-   cfdata->rel_y = evry_conf->rel_y;
+#define C(_name) cfdata->_name = evry_conf->_name
+   C(height);
+   C(width);
+   C(hide_list);
+   C(hide_input);
+   C(quick_nav);
+   C(rel_x);
+   C(rel_y);
+   C(view_mode);
+   C(view_zoom);
+   C(cycle_mode);
+#undef C
    
    EINA_LIST_FOREACH(evry_conf->plugins, l, p)
      if (p->type == type_subject)
@@ -119,17 +122,21 @@ _evry_cb_plugin_sort(const void *data1, const void *data2)
 static int
 _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
 {
-   /* evry_conf->scroll_animate = cfdata->scroll_animate; */
-   evry_conf->width = cfdata->width;
-   evry_conf->height = cfdata->height;
-   evry_conf->hide_input = cfdata->hide_input;
-   evry_conf->hide_list = cfdata->hide_list;
-   evry_conf->quick_nav = cfdata->quick_nav;
-   evry_conf->rel_x = cfdata->rel_x;
-   evry_conf->rel_y = cfdata->rel_y;
-
-   evry_conf->plugins = eina_list_sort(evry_conf->plugins,
-                                      eina_list_count(evry_conf->plugins),
+
+#define C(_name) evry_conf->_name = cfdata->_name
+  C(height);
+  C(width);
+  C(hide_list);
+  C(hide_input);
+  C(quick_nav);
+  C(rel_x);
+  C(rel_y);
+  C(view_mode);
+  C(view_zoom);
+  C(cycle_mode);
+#undef C
+
+   evry_conf->plugins = eina_list_sort(evry_conf->plugins, -1,
                                       _evry_cb_plugin_sort);
 
    if (evry_conf->cmd_terminal)
@@ -214,7 +221,8 @@ static Evas_Object *
 _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
 {
    Evas_Object *o, *of, *ob, *otb;
-
+   E_Radio_Group *rg;
+   
    otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
 
    o = e_widget_list_add(evas, 0, 0);
@@ -232,7 +240,24 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
    ob = e_widget_check_add(evas, _("Quick Navigation (ALT + h,j,k,l,n,p,m,i)"),
                           &(cfdata->quick_nav));
    e_widget_framelist_object_append(of, ob);
-
+   e_widget_list_object_append(o, of, 1, 1, 0.5);
+   
+   of = e_widget_framelist_add(evas, _("Default View"), 0);
+   rg = e_widget_radio_group_new(&cfdata->view_mode); 
+   ob = e_widget_radio_add(evas, "List", 0, rg);
+   e_widget_radio_toggle_set(ob, (cfdata->view_mode == 0));
+   e_widget_framelist_object_append(of, ob);
+   ob = e_widget_radio_add(evas, "Icons", 1, rg);
+   e_widget_radio_toggle_set(ob, (cfdata->view_mode == 1));
+   e_widget_framelist_object_append(of, ob);
+   
+   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, _("Commands"), 0);
    ob = e_widget_label_add(evas, _("Terminal Command"));
    e_widget_framelist_object_append(of, ob);
    ob = e_widget_entry_add(evas, &(cfdata->cmd_terminal), NULL, NULL, NULL);
index 54072c9..28fc443 100644 (file)
@@ -16,7 +16,7 @@ struct _View
   Evas_Object *bg, *sframe, *span;
   int          iw, ih;
   int          zoom;
-  Eina_Bool    list_mode : 1;
+  int         list_mode;
 };
 
 /* smart object based on wallpaper module */
@@ -834,7 +834,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
    if (sd->items)
      l = eina_list_data_find_list(sd->items, sd->cur_item);
 
-   if (!v->list_mode)
+   if (!v->list_mode && !evry_conf->cycle_mode)
      {
        if (!strcmp(ev->key, "Right"))
          {
@@ -867,11 +867,14 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
      {
        if (!sd->items) return 1;
 
-       EINA_LIST_FOREACH(l, ll, it)
+       if (!evry_conf->cycle_mode)
          {
-            if (it->y > sd->cur_item->y &&
-                it->x >= sd->cur_item->x)
-              break;
+            EINA_LIST_FOREACH(l, ll, it)
+              {
+                 if (it->y > sd->cur_item->y &&
+                     it->x >= sd->cur_item->x)
+                   break;
+              }
          }
 
        if (!it && l && l->next)
@@ -888,11 +891,16 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
      {
        if (!sd->items) return 1;
 
-       EINA_LIST_REVERSE_FOREACH(l, ll, it)
+       if (!evry_conf->cycle_mode)
          {
-            if (it->y < sd->cur_item->y &&
-                it->x <= sd->cur_item->x)
-              break;
+            for(ll = l; ll; ll = ll->prev)
+              {
+                 it = ll->data;
+                 
+                 if (it->y < sd->cur_item->y &&
+                     it->x <= sd->cur_item->x)
+                   break;
+              }
          }
 
        if (!it && l && l->prev)
@@ -909,8 +917,8 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
      {
        if (!v->list_mode)
          {
-            evry_browse_item(NULL); 
-            goto end;
+            if (evry_browse_item(NULL))
+              goto end;
          }
      }
    
@@ -935,10 +943,15 @@ _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
    v->state = s;
    v->evas = evas_object_evas_get(swallow);
 
-   v->list_mode = parent->list_mode;
+   printf("%d ---- %d\n", evry_conf->view_mode, parent->list_mode);
+
+   if (parent->list_mode < 0)
+     v->list_mode = evry_conf->view_mode;
+   else
+     v->list_mode = parent->list_mode;
+
    v->zoom = parent->zoom;
    
-   
    v->bg = edje_object_add(v->evas);
    e_theme_edje_object_set(v->bg, "base/theme/widgets",
                            "e/modules/everything/thumbview/main/window");
@@ -992,8 +1005,7 @@ _init(void)
    v->view.clear = &_view_clear;
    v->view.cb_key_down = &_cb_key_down;
 
-   /* TODO config option*/
-   v->list_mode = EINA_TRUE;
+   v->list_mode = -1;
    
    evry_view_register(EVRY_VIEW(v), 1);