working on ma configuration panel biatches
authorCarsten Haitzler <raster@rasterman.com>
Sat, 12 Nov 2005 05:27:58 +0000 (05:27 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Sat, 12 Nov 2005 05:27:58 +0000 (05:27 +0000)
SVN revision: 18431

data/themes/default_configure.edc
src/bin/e_configure.c
src/bin/e_configure.h
src/bin/e_ilist.c
src/bin/e_ilist.h
src/bin/e_int_menus.c
src/bin/e_widget_ilist.c
src/bin/e_widget_ilist.h

index 7989f90..f4b2bcf 100644 (file)
@@ -1,11 +1,8 @@
 images {
    image: "e17_menu_bg_border.png" COMP;
    image: "e17_dialog_watermark.png" COMP;
-   image: "e17_ibar_bg_v.png" COMP;
-   image: "e17_about_over_v.png" COMP;
    image: "e17_logo.png" COMP;
    image: "e17_menu_bg.png" COMP;
-   image: "e17_ibar_over_v.png" COMP;
 }
 
 group {
@@ -29,25 +26,6 @@ group {
         }
       }
       part {
-        name:          "conf_bg";
-        mouse_events:  0;
-        description {
-           state:    "default" 0.0;
-           rel1 {
-              to:       "conf";
-              offset:   -7 -7;
-           }
-           rel2 {
-              to:       "conf";
-              offset:   6 6;
-           }
-           image {
-              normal: "e17_ibar_bg_v.png";
-              border: 7 7 7 7;
-           }
-        }
-      }
-      part {
         name:          "base3";
         mouse_events:  0;
         description {
@@ -63,25 +41,6 @@ group {
         }
       }
       part {
-        name:          "conf";
-        type:          RECT;
-        mouse_events:  0;
-        description {
-           state:    "default" 0.0;
-//         max: 1000 1000;
-           min: 400 100;
-           rel1 {
-              to_y: "logo";
-              relative: 0.0 1.0;
-              offset: 8 8;
-           }
-           rel2 {
-              relative: 1.0 1.0;
-              offset:   -9 -9;
-           }
-        }
-      }
-      part {
         name:          "watermark";
         mouse_events:  0;
         description {
@@ -104,23 +63,6 @@ group {
         }
       }
       part {
-        name:          "conf_over";
-        mouse_events:  0;
-        description {
-           state:    "default" 0.0;
-           rel1 {
-              to:       "conf_bg";
-           }
-           rel2 {
-              to:       "conf_bg";
-           }
-           image {
-              normal: "e17_ibar_over_v.png";
-              border: 13 13 13 13;
-           }
-        }
-      }
-      part {
         name:          "title";
         type:          TEXT;
         effect:        SOFT_SHADOW;
@@ -130,8 +72,8 @@ group {
            fixed:    0 1;
            align:    0.5 0.0;
            rel1 {
-              to_y: "logo";
-              relative: 0.0  0.0;
+              to: "logo";
+              relative: 1.0  0.0;
               offset:   6    0;
            }
            rel2 {
@@ -150,7 +92,6 @@ group {
            }
         }
       }
-
       part {
         name:          "logo";
         type:          IMAGE;
@@ -175,103 +116,23 @@ group {
         }
       }
       part {
-        name:          "icon_swallow";
+        name:          "item";
         type:          SWALLOW;
         description {
            state: "default" 0.0;
-           align: 0.0 0.5;
+           align: 0.5 0.5;
            color: 0 0 0 0;
+           min: 320 200;
            rel1 {
-              relative: 0.0 0.0;
-              offset:   11  11;
-              to: "conf_bg";
-           }
-           rel2 {
-              relative: 1.0 1.0;
-              offset:   -12  -12;
-              to: "conf_bg";
-           }
-        }
-      }           
-   }
-   programs {
-      
-
-
-   }
-}
-       
-group {
-   name: "widgets/configure/icon";
-   min:  24 24;
-   max:  128 128;
-   parts {
-      part {
-        name:          "icon_swallow";
-        type:          SWALLOW;
-        mouse_events:  0;
-        description {
-           state:      "default" 0.0;
-           rel1 {
-              relative: 0.0 0.0;
-              offset:   5 5;
-           }
-           rel2 {
-              relative: 1.0 1.0;
-              offset:   -6 -20;
-           }
-        }
-      }
-      part {
-        name:          "icon_event";
-        type:          RECT;
-        mouse_events:  1;
-        description {
-           state:      "default" 0.0;
-           rel1 {
-              relative: 0.0 0.0;
-              offset:   0 0;
-              to:       "icon_swallow";
-           }
-           rel2 {
-              relative: 1.0 1.0;
-              offset:   -1 -1;
-              to:       "icon_swallow";
-           }
-           color:      0 0 0 0;
-        }
-      }
-      part {
-        name:          "title";
-        type:          TEXT;
-        effect:        NONE;
-        description {
-           rel1 {
+              to_y: "logo";
               relative: 0.0 1.0;
-              offset:   5 -20;
+              offset: 16 16;
            }
            rel2 {
               relative: 1.0 1.0;
-              offset:   -6 -6;
-           }
-           color:      0 0 0 255;
-           //color3:     0 0 0 32;
-           text {
-              text:     "No Title";
-              align:    0.0 0.0;
-              size:     10;
-              font:     "Edje-Vera";
-              min: 1 1;
+              offset:   -17 -17;
            }
         }
-      }
-   }
-   programs {
-      program {
-        name:   "button_click";
-        signal: "mouse,down,1";
-        source: "icon_event";
-        action: SIGNAL_EMIT "clicked" "";
-      }
+      }           
    }
 }
index 13e667f..3fccf30 100644 (file)
@@ -1,17 +1,22 @@
 #include "e.h"
 
-static void _e_configure_gui_hide(E_Win *win);
-static void _e_configure_apps_load(E_Configure *app);
-static void _e_configure_apps_unload(E_Configure *app);
+typedef struct _E_Configure_CB E_Configure_CB;
+
+struct _E_Configure_CB
+{
+   E_Configure *eco;
+   E_Config_Dialog *(*func) (E_Container *con);   
+};
+
 static void _e_configure_free(E_Configure *app);
-static void _e_configure_apps_click(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _e_configure_cb_del_req(E_Win *win);
 static void _e_configure_cb_resize(E_Win *win);
+static void _e_configure_cb_standard(void *data);
     
-
 E_Configure *
 e_configure_show(E_Container *con)
 {
-   E_Configure *app;
+   E_Configure *eco;
    E_Manager *man;
    Evas_Coord w, h, ew, eh;   
    
@@ -23,185 +28,111 @@ e_configure_show(E_Container *con)
        if (!con) con = e_container_number_get(man, 0);
        if (!con) return NULL;
      }
-   app = E_OBJECT_ALLOC(E_Configure, E_CONFIGURE_TYPE, _e_configure_free);
-   if (!app) return NULL;
-   app->win = e_win_new(con);   
-   if (!app->win)
+   
+   eco = E_OBJECT_ALLOC(E_Configure, E_CONFIGURE_TYPE, _e_configure_free);
+   if (!eco) return NULL;
+   eco->win = e_win_new(con);   
+   if (!eco->win)
      {
-       free(app);
+       free(eco);
        return NULL;
      }
+   eco->win->data = eco;
    
-   app->con = con;
+   eco->con = con;
    
-   e_win_delete_callback_set(app->win, _e_configure_gui_hide);
-   e_win_title_set(app->win, _("Enlightenment Configuration"));
-   e_win_name_class_set(app->win, "E", "_configure");
-   app->evas = e_win_evas_get(app->win);
-   ecore_evas_data_set(app->win->ecore_evas, "App", app);              
-   e_win_resize_callback_set(app->win, _e_configure_cb_resize);   
-   e_win_centered_set(app->win, 1);
+   e_win_title_set(eco->win, _("Enlightenment Configuration"));
+   e_win_name_class_set(eco->win, "E", "_configure");
+   eco->evas = e_win_evas_get(eco->win);
+   e_win_delete_callback_set(eco->win, _e_configure_cb_del_req);
+   e_win_resize_callback_set(eco->win, _e_configure_cb_resize);   
+   e_win_centered_set(eco->win, 1);
       
-   app->edje = edje_object_add(app->evas);
-
-   e_theme_edje_object_set(app->edje, "base/theme/configure", "widgets/configure/main");
-
-   app->box = e_box_add(app->evas);
-       
-   e_box_homogenous_set (app->box, 0);
-       
-   app->apps = e_app_new(PACKAGE_DATA_DIR "/config-apps", 0);
-   app->icons = NULL;
-   app->app_ref = NULL;
-   _e_configure_apps_load(app);        
-
-   e_box_orientation_set(app->box, 1);
-   e_box_align_set(app->box, 0.0, 0.0);        
-
-   edje_object_size_min_calc (app->edje, &ew, &eh);
-   e_box_min_size_get(app->box, &w, &h);
-       
-   if (ew > w )
-     w = ew;
-   if (eh > h)
-     h = eh;
+   eco->edje = edje_object_add(eco->evas);
+   e_theme_edje_object_set(eco->edje, "base/theme/configure",
+                          "widgets/configure/main");
    
-   edje_extern_object_min_size_set(app->box, w, h);
-   e_win_size_base_set (app->win, w , h + eh);
-   e_win_size_min_set (app->win, w, h + eh);
-   e_win_resize(app->win, w, h + eh);
+   eco->ilist = e_widget_ilist_add(eco->evas, 48, 48, NULL);
+   e_widget_ilist_selector_set(eco->ilist, 1);
+   edje_object_part_swallow(eco->edje, "item", eco->ilist);
+   edje_object_part_text_set(eco->edje, "title", _("Configuration Panel"));
+
+   /* add items here */
+   e_configure_standard_item_add(eco, "enlightenment/e", _("Focus Settings"), e_int_config_focus);
+   /* FIXME: we should have a way for modules to hook in here and add their
+    * own entries
+    */
+
+   edje_object_size_min_calc(eco->edje, &ew, &eh);
+   e_win_resize(eco->win, ew, eh);
+   e_win_size_min_set(eco->win, ew, eh);
                
-   edje_object_part_swallow(app->edje, "icon_swallow", app->box);
-   evas_object_show(app->box);
-   
-   evas_object_show(app->edje);
-               
-   e_win_show(app->win);   
-   
+   evas_object_show(eco->ilist);
+   evas_object_show(eco->edje);
    
-   return app;
-}
-
-static void
-_e_configure_cb_resize(E_Win *win)
-{
-   Evas_Coord w, h;
-   E_Configure *app;
+   e_win_show(eco->win);
 
-   if (win)
-     {
-       ecore_evas_geometry_get(win->ecore_evas, NULL, NULL, &w, &h);
-       app = (E_Configure *)ecore_evas_data_get(win->ecore_evas, "App");
-       evas_object_resize(app->edje, w, h);
-     }
+   e_widget_focus_set(eco->ilist, 1);
+   e_widget_ilist_go(eco->ilist);
+   
+   return eco;
 }
 
-
-
-static void
-_e_configure_gui_hide(E_Win *win)
+void
+e_configure_standard_item_add(E_Configure *eco, char *icon, char *label, E_Config_Dialog *(*func) (E_Container *con))
 {
-   E_Configure *app;
-
-   app = (E_Configure *) ecore_evas_data_get(win->ecore_evas, "App");
-   if (app)
-     {
-       _e_configure_apps_unload(app);
-
-       edje_object_part_unswallow(app->edje, app->box);
-       evas_object_del(app->box);
-       evas_object_del(app->edje);
-       e_object_del(E_OBJECT(app->win));
-     }
+   Evas_Object *o;
+   E_Configure_CB *ecocb;
+   
+   o = edje_object_add(eco->evas);
+   e_util_edje_icon_set(o, icon);
+   ecocb = E_NEW(E_Configure_CB, 1);
+   ecocb->eco = eco;
+   ecocb->func = func;
+   eco->cblist = evas_list_append(eco->cblist, ecocb);
+   e_widget_ilist_append(eco->ilist, o, label, _e_configure_cb_standard, ecocb, NULL);
 }
 
+/* local subsystem functions */
 static void
-_e_configure_apps_load(E_Configure *app)
+_e_configure_free(E_Configure *eco)
 {
-   E_App     *a;
-   Evas_List *l;
-   Evas_Object *o, *icon;
-   Evas_Coord w, h;
-
-   if (!app->apps) return;
-   e_app_subdir_scan(app->apps, 0);
-   for (l = app->apps->subapps; l; l = l->next)
+   while (eco->cblist)
      {
-       a = l->data;
-       e_object_ref(E_OBJECT(a));
-       app->app_ref = evas_list_append(app->app_ref, a);
-       
-       o = edje_object_add(app->evas);
-       e_theme_edje_object_set(o, "base/theme/configure", "widgets/configure/icon");
-       icon = edje_object_add(app->evas);
-       edje_object_file_set(icon, a->path, "icon");
-                            
-       edje_extern_object_min_size_set(icon, 48, 48);
-            
-       edje_object_part_swallow(o, "icon_swallow", icon);           
-       edje_object_part_text_set(o, "title", a->name);
-       evas_object_show(icon);
-
-       edje_object_size_min_calc (o, &w, &h);       
-       edje_extern_object_min_size_set (o, w, h);
-       e_box_pack_end(app->box, o);
-       e_box_pack_options_set(o,
-                              1, 0, /* fill */
-                              1, 0, /* expand */
-                              0.0, 0.0, /* align */
-                              w, h, /* min */
-                              999, 999 //172, 72 /* max */
-                              );
-
-       evas_object_show(o);
-       app->icons = evas_list_append(app->icons, o);
-       edje_object_signal_callback_add(o, "clicked", "",
-                                       _e_configure_apps_click, a);
+       free(eco->cblist->data);
+       eco->cblist = evas_list_remove_list(eco->cblist, eco->cblist);
      }
+   evas_object_del(eco->edje);
+   evas_object_del(eco->ilist);
+   e_object_del(E_OBJECT(eco->win));
+   free(eco);
 }
 
 static void
-_e_configure_apps_unload(E_Configure *app)
+_e_configure_cb_del_req(E_Win *win)
 {
-   E_App       *a;
-
-/*   while(app->icons)
-     {
-       icon = evas_list_data(app->icons);
-// FIXME unswallow icon and free
+   E_Configure *eco;
 
-       app->icons = evas_list_remove(app->icons, icon);
-       evas_object_del(icon);
-     }*/
-   while (app->app_ref)
-     {
-       a = evas_list_data(app->app_ref);
-
-       app->app_ref = evas_list_remove(app->app_ref, a);
-       e_object_unref(E_OBJECT(a));
-     }
+   eco = win->data;
+   if (eco) e_object_del(E_OBJECT(eco));
 }
 
 static void
-_e_configure_apps_click(void *data, Evas_Object *obj, const char *emission, const char *source)
+_e_configure_cb_resize(E_Win *win)
 {
-   E_App *a;
-
-   a = data;
-   if (a)
-     {
-       Ecore_Exe *exe;
-
-       exe = ecore_exe_run(a->exe, NULL);
-       if (exe) ecore_exe_free(exe);
-     }
+   Evas_Coord w, h;
+   E_Configure *eco;
+   
+   ecore_evas_geometry_get(win->ecore_evas, NULL, NULL, &w, &h);
+   eco = win->data;
+   evas_object_resize(eco->edje, w, h);
 }
 
 static void
-_e_configure_free(E_Configure *app)
+_e_configure_cb_standard(void *data)
 {
-   _e_configure_apps_unload(app);
-   e_object_del(E_OBJECT(app->win));
-   free(app);
+   E_Configure_CB *ecocb;
+   
+   ecocb = data;
+   ecocb->func(ecocb->eco->con);
 }
index 6903994..3355ebe 100644 (file)
@@ -16,13 +16,13 @@ struct _E_Configure
    E_Win       *win;
    Evas        *evas;
    Evas_Object *edje;
-   Evas_Object *box;
-   E_App       *apps;
-   Evas_List   *icons;
-   Evas_List   *app_ref;
+   Evas_Object *ilist;
+   
+   Evas_List *cblist;
 };
 
-E_Configure *e_configure_show(E_Container *con);
-
+EAPI E_Configure *e_configure_show(E_Container *con);
+EAPI void         e_configure_standard_item_add(E_Configure *eco, char *icon, char *label, E_Config_Dialog *(*func) (E_Container *con));
+    
 #endif
 #endif
index f987fb3..6c7baee 100644 (file)
@@ -18,6 +18,7 @@ struct _E_Smart_Data
    Evas_List     *items;
    int            selected;
    Evas_Coord     icon_w, icon_h;
+   unsigned char  selector : 1;
 }; 
 
 struct _E_Smart_Item
@@ -32,6 +33,7 @@ struct _E_Smart_Item
 
 /* local subsystem functions */
 static void _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _e_smart_reconfigure(E_Smart_Data *sd);
 static void _e_smart_add(Evas_Object *obj);
@@ -125,13 +127,9 @@ e_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label,  void (*func) (
                          mw, mh, /* min */
                          99999, 99999 /* max */
                          );
-   if (sd->selected == (evas_list_count(sd->items) - 1))
-     {
-       edje_object_signal_emit(si->base_obj, "active", "");
-       if (si->func) si->func(si->data, si->data2);
-     }
    evas_object_lower(si->base_obj);
    evas_object_event_callback_add(si->base_obj, EVAS_CALLBACK_MOUSE_DOWN, _e_smart_event_mouse_down, si);
+   evas_object_event_callback_add(si->base_obj, EVAS_CALLBACK_MOUSE_UP, _e_smart_event_mouse_up, si);
    evas_object_show(si->base_obj);
 }
 
@@ -153,7 +151,10 @@ e_ilist_select_set(Evas_Object *obj, int n)
      {
        evas_object_raise(si->base_obj);
        edje_object_signal_emit(si->base_obj, "active", "");
-       if (si->func) si->func(si->data, si->data2);
+       if (!sd->selector)
+         {
+            if (si->func) si->func(si->data, si->data2);
+         }
      }
 }
 
@@ -211,6 +212,20 @@ e_ilist_min_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
    e_box_min_size_get(sd->box_obj, w, h);
 }
 
+void
+e_ilist_selector_set(Evas_Object *obj, int selector)
+{
+   API_ENTRY return;
+   sd->selector = selector;
+}
+
+int
+e_ilist_selector_get(Evas_Object *obj)
+{
+   API_ENTRY return 0;
+   return sd->selector;
+}
+
 /* local subsystem functions */
 static void 
 _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
@@ -232,6 +247,24 @@ _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf
      }
 }
 
+static void 
+_e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Mouse_Up *ev;
+   E_Smart_Item *si;
+   
+   si = data;
+   ev = event_info;
+   if (si->sd->selector)
+     {
+       si = evas_list_nth(si->sd->items, si->sd->selected);
+       if (si)
+         {
+            if (si->func) si->func(si->data, si->data2);
+         }
+     }
+}
+
 static void
 _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
@@ -254,6 +287,17 @@ _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
        n = e_ilist_select_get(sd->smart_obj);
        e_ilist_select_set(sd->smart_obj, n + 1);
      }
+   else if ((!strcmp(ev->keyname, "Return")) ||
+           (!strcmp(ev->keyname, "space")))
+     {
+       E_Smart_Item *si;
+
+       si = evas_list_nth(sd->items, sd->selected);
+       if (si)
+         {
+            if (si->func) si->func(si->data, si->data2);
+         }
+     }
 }
 
 static void
@@ -282,6 +326,8 @@ _e_smart_add(Evas_Object *obj)
    sd->icon_w = 24;
    sd->icon_h = 24;
    
+   sd->selected = -1;
+   
    sd->box_obj = e_box_add(evas_object_evas_get(obj));
    e_box_align_set(sd->box_obj, 0.0, 0.0);
    e_box_homogenous_set(sd->box_obj, 0);
index 92759d0..de6ea32 100644 (file)
@@ -15,6 +15,8 @@ EAPI void        *e_ilist_select_data_get       (Evas_Object *obj);
 EAPI void        *e_ilist_select_data2_get      (Evas_Object *obj);
 EAPI void         e_ilist_selected_geometry_get (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
 EAPI void         e_ilist_min_size_get          (Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
+EAPI void         e_ilist_selector_set          (Evas_Object *obj, int selector);
+EAPI int          e_ilist_selector_get          (Evas_Object *obj);
     
 #endif
 #endif
index 0ce1c3d..0513469 100644 (file)
@@ -36,7 +36,6 @@ static void _e_int_menus_main_fm(void *data, E_Menu *m, E_Menu_Item *mi);
 static void _e_int_menus_config_pre_cb       (void *data, E_Menu *m);
 static void _e_int_menus_config_free_hook    (void *obj);
 static void _e_int_menus_config_item_cb      (void *data, E_Menu *m, E_Menu_Item *mi);
-static void _e_int_menus_config_generic_cb   (void *data, E_Menu *m, E_Menu_Item *mi);
 static void _e_int_menus_clients_pre_cb      (void *data, E_Menu *m);
 static void _e_int_menus_clients_free_hook   (void *obj);
 static void _e_int_menus_clients_item_cb     (void *data, E_Menu *m, E_Menu_Item *mi);
@@ -633,10 +632,6 @@ _e_int_menus_config_pre_cb(void *data, E_Menu *m)
    e_menu_item_callback_set(mi, _e_int_menus_config_item_cb, NULL);
 
    mi = e_menu_item_new(m);
-   e_menu_item_label_set(mi, _("Focus Settings"));
-   e_menu_item_callback_set(mi, _e_int_menus_config_generic_cb, "focus");
-   
-   mi = e_menu_item_new(m);
    e_menu_item_label_set(mi, _("Eap Editor"));
    e_menu_item_callback_set(mi, _e_int_menus_eapedit_item_cb, NULL);   
 
@@ -669,12 +664,6 @@ _e_int_menus_config_item_cb(void *data, E_Menu *m, E_Menu_Item *mi)
 }
 
 static void
-_e_int_menus_config_generic_cb(void *data, E_Menu *m, E_Menu_Item *mi)
-{
-   if (!strcmp((char *)data, "focus")) e_int_config_focus(m->zone->container);
-}
-
-static void
 _e_int_menus_clients_pre_cb(void *data, E_Menu *m)
 {
    E_Menu_Item *mi;
index b22cd65..334e5b6 100644 (file)
@@ -99,6 +99,15 @@ e_widget_ilist_select_set(Evas_Object *obj, int n)
 }
 
 void
+e_widget_ilist_selector_set(Evas_Object *obj, int selector)
+{
+   E_Widget_Data *wd;
+   
+   wd = e_widget_data_get(obj);
+   e_ilist_selector_set(wd->o_ilist, selector);
+}
+
+void
 e_widget_ilist_go(Evas_Object *obj)
 {
    E_Widget_Data *wd;
index 45ea777..8ea132b 100644 (file)
@@ -9,6 +9,7 @@
 EAPI Evas_Object *e_widget_ilist_add(Evas *evas, int icon_w, int icon_h, char **value);
 EAPI void e_widget_ilist_append(Evas_Object *obj, Evas_Object *icon, char *label, void (*func) (void *data), void *data, char *val);
 EAPI void e_widget_ilist_select_set(Evas_Object *obj, int n);
+EAPI void e_widget_ilist_selector_set(Evas_Object *obj, int selector);
 EAPI void e_widget_ilist_go(Evas_Object *obj);
     
 #endif