Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_fm.c e_int_menus.c e_sys_main.c 


Log Message:


font upsize with more outlining/contrast by default for soem modules.
sysactions more comprehensive and able to handle multiple groups a user
is a member of - config modified to handle common ones i find on debian
and ubuntu that "console" users tend to be added to. add divider in config
menu. work a tad more on fm2 dnd.

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_fm.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -3 -r1.77 -r1.78
--- e_fm.c      25 Sep 2006 13:35:59 -0000      1.77
+++ e_fm.c      28 Sep 2006 06:07:15 -0000      1.78
@@ -22,6 +22,8 @@
    Evas_Object      *clip;
    Evas_Object      *underlay;
    Evas_Object      *overlay;
+   Evas_Object      *drop;
+   Evas_Object      *drop_in;
    const char       *dev;
    const char       *path;
    const char       *realpath;
@@ -75,6 +77,12 @@
    
    E_Object           *eobj;
    E_Drop_Handler     *drop_handler;
+   E_Fm2_Icon         *drop_icon;
+   char                drop_after;
+   unsigned char       drop_show : 1;
+   unsigned char       drop_in_show : 1;
+   unsigned char       drop_all : 1;
+   unsigned char       drag : 1;
 };
  
 struct _E_Fm2_Region
@@ -216,8 +224,9 @@
 static void _e_fm2_file_delete_no_cb(void *data, E_Dialog *dialog);
 static void _e_fm2_refresh_job_cb(void *data);
 
-static char *_meta_path = NULL;
+static char *_e_fm2_meta_path = NULL;
 static Evas_Smart *_e_fm2_smart = NULL;
+static Evas_List *_e_fm2_list = NULL;
 
 /* externally accessible functions */
 EAPI int
@@ -229,7 +238,7 @@
    homedir = e_user_homedir_get();
    snprintf(path, sizeof(path), "%s/.e/e/fileman/metadata", homedir);
    ecore_file_mkpath(path);
-   _meta_path = strdup(path);
+   _e_fm2_meta_path = strdup(path);
 
    _e_fm2_smart = evas_smart_new("e_fm",
                                 _e_fm2_smart_add, /* add */
@@ -251,7 +260,7 @@
 {
    evas_smart_free(_e_fm2_smart);
    _e_fm2_smart = NULL;
-   E_FREE(_meta_path);
+   E_FREE(_e_fm2_meta_path);
    return 1;
 }
 
@@ -657,7 +666,7 @@
       PRT("%s", path);
    }
    else if (CMP("~/")) {
-      s = e_user_homedir_get();
+      s = (char *)e_user_homedir_get();
       PRT("%s%s", s, path);
    }
    else if (dev[0] == '/') {
@@ -670,7 +679,7 @@
        .desktop files or symlinks (in fact anything
        * you like
        */
-      s = e_user_homedir_get();
+      s = (char *)e_user_homedir_get();
       PRT("%s/.e/e/fileman/favorites", s);
    }
    else if (CMP("dvd") || CMP("dvd-*"))  {
@@ -1419,6 +1428,11 @@
 _e_fm2_icon_free(E_Fm2_Icon *ic)
 {
    /* free icon, object data etc. etc. */
+   if (ic->sd->drop_icon == ic)
+     {
+       /* FIXME: call hide call */
+       ic->sd->drop_icon = NULL;
+     }
    _e_fm2_icon_unrealize(ic);
    if (ic->menu)
      {
@@ -1457,7 +1471,9 @@
    ic->obj = edje_object_add(evas_object_evas_get(ic->sd->obj));
    edje_object_freeze(ic->obj);
    evas_object_smart_member_add(ic->obj, ic->sd->obj);
-   evas_object_stack_below(ic->obj, ic->sd->overlay);
+   evas_object_stack_below(ic->obj, ic->sd->drop);
+//   evas_object_stack_below(ic->sd->drop, ic->sd->overlay);
+//   evas_object_stack_below(ic->sd->drop_in, ic->sd->overlay);
    /* FIXME: this is currently a hack just to get a display working - go back
     * and do proper icon stuff later */
    if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST)
@@ -1813,7 +1829,9 @@
      {
        edje_object_signal_emit(ic->obj, "e,state,selected", "e");
        edje_object_signal_emit(ic->obj_icon, "e,state,selected", "e");
-       evas_object_stack_below(ic->obj, ic->sd->overlay);
+       evas_object_stack_below(ic->obj, ic->sd->drop);
+//     evas_object_stack_below(ic->sd->drop, ic->sd->overlay);
+//     evas_object_stack_below(ic->sd->drop_in, ic->sd->overlay);
      }
 }
 
@@ -1951,7 +1969,8 @@
    for (l = rg->list; l; l = l->next)
      {
        ic = l->data;
-       if (ic->selected) evas_object_raise(ic->obj);
+       if (ic->selected)
+         evas_object_stack_below(ic->obj, ic->sd->drop);
      }
    edje_thaw();
 }
@@ -2331,26 +2350,159 @@
 
 /* FIXME: prototype + reposition + implement */
 static void
-_e_fm2_dnd_drop_into_show(E_Fm2_Icon *ic)
+_e_fm2_dnd_drop_configure(Evas_Object *obj)
 {
+   E_Fm2_Smart_Data *sd;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   if (!sd->drop_icon) return;
+   if (sd->drop_after == -1)
+     {
+       evas_object_move(sd->drop_in,
+                        sd->x + sd->drop_icon->x - sd->pos.x,
+                        sd->y + sd->drop_icon->y - sd->pos.y);
+       evas_object_resize(sd->drop_in, sd->drop_icon->w, sd->drop_icon->h);
+     }
+   else if (sd->drop_after)
+     {
+       evas_object_move(sd->drop,
+                        sd->x + sd->drop_icon->x - sd->pos.x,
+                        sd->y + sd->drop_icon->y - sd->pos.y + 
sd->drop_icon->h - 1);
+       evas_object_resize(sd->drop, sd->drop_icon->w, 2);
+     }
+   else
+     {
+       evas_object_move(sd->drop,
+                        sd->x + sd->drop_icon->x - sd->pos.x,
+                        sd->y + sd->drop_icon->y - sd->pos.y - 1);
+       evas_object_resize(sd->drop, sd->drop_icon->w, 2);
+     }
 }
 
 /* FIXME: prototype + reposition + implement */
 static void
-_e_fm2_dnd_drop_into_hide(Evas_Object *obj)
+_e_fm2_dnd_drop_all_show(Evas_Object *obj)
 {
+   E_Fm2_Smart_Data *sd;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   if (sd->drop_show)
+     {
+       edje_object_signal_emit(sd->drop, "e,state,unselected", "e");
+       sd->drop_show = 0;
+     }
+   if (sd->drop_in_show)
+     {
+       edje_object_signal_emit(sd->drop_in, "e,state,unselected", "e");
+       sd->drop_in_show = 0;
+     }
+   if (!sd->drop_all)
+     {
+       printf("DISP DROP ALL SHOW\n");
+       edje_object_signal_emit(sd->overlay, "e,state,drop,start", "e");
+       sd->drop_all = 1;
+     }
+   sd->drop_icon = NULL;
+   sd->drop_after = 0;
 }
 
 /* FIXME: prototype + reposition + implement */
 static void
-_e_fm2_dnd_drop_between_show(E_Fm2_Icon *ic, int after)
+_e_fm2_dnd_drop_all_hide(Evas_Object *obj)
 {
+   E_Fm2_Smart_Data *sd;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   if (sd->drop_all)
+     {
+       printf("DISP DROP ALL HIDE\n");
+       edje_object_signal_emit(sd->overlay, "e,state,drop,stop", "e");
+       sd->drop_all = 0;
+     }
 }
 
 /* FIXME: prototype + reposition + implement */
 static void
-_e_fm2_dnd_drop_between_hide(Evas_Object *obj)
+_e_fm2_dnd_drop_show(E_Fm2_Icon *ic, int after)
 {
+   int emit = 0;
+   
+   if ((ic->sd->drop_icon == ic) &&
+       (ic->sd->drop_after == after)) return;
+   if (((ic->sd->drop_icon) && (!ic)) ||
+       ((!ic->sd->drop_icon) && (ic)) ||
+       ((after < 0) && (ic->sd->drop_after >= 0)) ||
+       ((after >= 0) && (ic->sd->drop_after < 0)))
+     emit = 1;
+   ic->sd->drop_icon = ic;
+   ic->sd->drop_after = after;
+   if (emit)
+     {  
+       if (ic->sd->drop_after != -1)
+         {
+            printf("DISP DROP ON drop\n");
+            edje_object_signal_emit(ic->sd->drop_in, "e,state,unselected", 
"e");
+            edje_object_signal_emit(ic->sd->drop, "e,state,selected", "e");
+            ic->sd->drop_in_show = 0;
+            ic->sd->drop_show = 1;
+         }
+       else
+         {
+            printf("DISP DROP ON drop_in\n");
+            edje_object_signal_emit(ic->sd->drop, "e,state,unselected", "e");
+            edje_object_signal_emit(ic->sd->drop_in, "e,state,selected", "e");
+            ic->sd->drop_in_show = 1;
+            ic->sd->drop_show = 0;
+         }
+     }
+   _e_fm2_dnd_drop_all_hide(ic->sd->obj);
+   _e_fm2_dnd_drop_configure(ic->sd->obj);
+}
+
+/* FIXME: prototype + reposition + implement */
+static void
+_e_fm2_dnd_drop_hide(Evas_Object *obj)
+{
+   E_Fm2_Smart_Data *sd;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   printf("DISP DROP OFF BOTH\n");
+   if (sd->drop_show)
+     {
+       edje_object_signal_emit(sd->drop, "e,state,unselected", "e");
+       sd->drop_show = 0;
+     }
+   if (sd->drop_in_show)
+     {
+       edje_object_signal_emit(sd->drop_in, "e,state,unselected", "e");
+       sd->drop_in_show = 0;
+     }
+   sd->drop_icon = NULL;
+   sd->drop_after = 0;
+}
+
+/* FIXME: prototype + reposition + implement */
+static void
+_e_fm2_dnd_finish(Evas_Object *obj, int refresh)
+{
+   E_Fm2_Smart_Data *sd;
+   E_Fm2_Icon *ic;
+   Evas_List *l;
+   
+   sd = evas_object_smart_data_get(obj);
+   if (!sd) return;
+   if (!sd->drag) return;
+   sd->drag = 0;
+   for (l = sd->icons; l; l = l->next)
+     {
+       ic = l->data;
+       ic->drag.dnd = 0;
+     }
+   if (refresh) e_fm2_refresh(obj);
 }
 
 static void
@@ -2382,10 +2534,10 @@
    for (l = sd->icons; l; l = l->next)
      {
        ic = l->data;
-       if (ic->drag.dnd) continue;
        if (E_INSIDE(ev->x, ev->y, ic->x, ic->y, ic->w, ic->h))
          {
             printf("OVER %s\n", ic->info.file);
+            if (ic->drag.dnd) return;
             /* if list view */
             if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST)
               {
@@ -2398,34 +2550,19 @@
                            /* if bottom 25% or top 25% then insert between 
prev or next */
                            /* if in middle 50% then put in dir */
                            if (ev->y <= (ic->y + (ic->h / 4)))
-                             {
-                                _e_fm2_dnd_drop_into_hide(sd->obj);
-                                _e_fm2_dnd_drop_between_show(ic, 0);
-                             }
+                             _e_fm2_dnd_drop_show(ic, 0);
                            else if (ev->y > (ic->y + ((ic->h * 3) / 4)))
-                             {
-                                _e_fm2_dnd_drop_into_hide(sd->obj);
-                                _e_fm2_dnd_drop_between_show(ic, 1);
-                             }
+                             _e_fm2_dnd_drop_show(ic, 1);
                            else
-                             {
-                                _e_fm2_dnd_drop_between_hide(sd->obj);
-                                _e_fm2_dnd_drop_into_show(ic);
-                             }
+                             _e_fm2_dnd_drop_show(ic, -1);
                         }
                       else
                         {
                            /* if top 50% or bottom 50% then insert between 
prev or next */
                            if (ev->y <= (ic->y + (ic->h / 2)))
-                             {
-                                _e_fm2_dnd_drop_into_hide(sd->obj);
-                                _e_fm2_dnd_drop_between_show(ic, 0);
-                             }
+                             _e_fm2_dnd_drop_show(ic, 0);
                            else
-                             {
-                                _e_fm2_dnd_drop_into_hide(sd->obj);
-                                _e_fm2_dnd_drop_between_show(ic, 1);
-                             }
+                             _e_fm2_dnd_drop_show(ic, 1);
                         }
                    }
                  /* we can only drop into subdirs */
@@ -2433,15 +2570,9 @@
                    {
                       /* if it's over a dir - hilight as it will be dropped in 
*/
                        if (S_ISDIR(ic->info.statinfo.st_mode))
-                        {
-                           _e_fm2_dnd_drop_between_hide(sd->obj);
-                           _e_fm2_dnd_drop_into_show(ic);
-                        }
+                        _e_fm2_dnd_drop_show(ic, -1);
                       else
-                        {
-                           _e_fm2_dnd_drop_between_hide(sd->obj);
-                           _e_fm2_dnd_drop_into_hide(sd->obj);
-                        }
+                        _e_fm2_dnd_drop_hide(sd->obj);
                    }
               }
             else
@@ -2457,26 +2588,22 @@
        /* if listview - it is now after last file */
        if (sd->config->view.mode == E_FM2_VIEW_MODE_LIST)
          {
-            ic = evas_list_data(evas_list_last(sd->icons));
-            if (ic)
+            /* if there is a .order file - we can re-order files */
+            if (ic->sd->order_file)
               {
-                 if (!ic->drag.dnd)
+                 ic = evas_list_data(evas_list_last(sd->icons));
+                 if (ic)
                    {
-                      _e_fm2_dnd_drop_into_hide(sd->obj);
-                      _e_fm2_dnd_drop_between_show(ic, 1);
+                      if (!ic->drag.dnd)
+                        _e_fm2_dnd_drop_show(ic, 1);
+                      else
+                        _e_fm2_dnd_drop_all_show(sd->obj);
                    }
                  else
-                   {
-                      _e_fm2_dnd_drop_between_hide(sd->obj);
-                      _e_fm2_dnd_drop_into_hide(sd->obj);
-                   }
+                   _e_fm2_dnd_drop_all_show(sd->obj);
               }
             else
-              {
-                 /* no icons in dir - drop it in */
-                 _e_fm2_dnd_drop_between_hide(sd->obj);
-                 _e_fm2_dnd_drop_into_hide(sd->obj);
-              }
+              _e_fm2_dnd_drop_all_show(sd->obj);
          }
        else
          {
@@ -2485,8 +2612,7 @@
        return;
      }
    /* outside fm view */
-   _e_fm2_dnd_drop_between_hide(sd->obj);
-   _e_fm2_dnd_drop_into_hide(sd->obj);
+   _e_fm2_dnd_drop_hide(sd->obj);
 }
 
 static void
@@ -2500,8 +2626,8 @@
    if (strcmp(type, "text/uri-list")) return;
    ev = (E_Event_Dnd_Leave *)event;
    printf("DND LEAVE %i %i\n", ev->x, ev->y);
-   _e_fm2_dnd_drop_between_hide(sd->obj);
-   _e_fm2_dnd_drop_into_hide(sd->obj);
+   _e_fm2_dnd_drop_hide(sd->obj);
+   _e_fm2_dnd_drop_all_hide(sd->obj);
 }
  
 static void
@@ -2509,21 +2635,68 @@
 {
    E_Fm2_Smart_Data *sd;
    E_Event_Dnd_Drop *ev;
-   char **selected, *f;
-   int i;
+   Evas_List *fsel, *l;
+   char *f;
+   int i, refresh = 0;
    
    sd = data;
    if (!type) return;
    if (strcmp(type, "text/uri-list")) return;
    ev = (E_Event_Dnd_Drop *)event;
-   selected = ev->data;
+   fsel = ev->data;
    printf("DROP: %i %i\n", ev->x, ev->y);
-   for (i = 0, f = selected[i]; f; i++, f = selected[i]) printf("  %s\n", f);
-   /* FIXME: record the descision where to drop it in the dnd move callback
-    * then fix list, rewrite .order or move into dir (and if drag icon is
-    * from this dir, then refresh) */
-   _e_fm2_dnd_drop_between_hide(sd->obj);
-   _e_fm2_dnd_drop_into_hide(sd->obj);
+   for (l = fsel; l; l = l->next)
+     {
+       f = l->data;
+       printf("  %s\n", f);
+     }
+   /* note - logic.
+    * if drop file prefix path matches extra_file_source then it can be
+    * and indirect link - dont MOVE the file just add filename to list.
+    * if not literally move the file in. if move can't work - try a copy.
+    * on a literal move find any fm views for the dir of the dropped file
+    * and refresh those, as well as refresh current target fm dir
+    */
+   if (sd->drop_all) /* drop arbitarily into the dir */
+     {
+       /* move file into this fm dir */
+       refresh  = 1; /* refresh src fm */
+       e_fm2_refresh(sd->obj); /* refresh dst fm */
+     }
+   else if (sd->drop_icon) /* inot or before/after an icon */
+     {
+       if (sd->drop_after == -1) /* put into subdir in icon */
+         {
+            /* move file into dir that this icon is for */
+            /* FIXME: mv file */
+            refresh  = 1; /* refresh src fm */
+            e_fm2_refresh(sd->obj); /* refresh dst fm */
+         }
+       else
+         {
+            if (sd->config->view.mode == E_FM2_VIEW_MODE_LIST) /* list */
+              {
+                 if (sd->order_file) /* there is an order file */
+                   {
+                      /* write order file with all files up to drop_icon
+                       * that are not being dragged, then insert list of
+                       * dropped files, then everything after that is not
+                       * being dragged then refresh view
+                       */
+                      refresh  = 1; /* refresh src fm */
+                      e_fm2_refresh(sd->obj); /* refresh dst fm */
+                   }
+                 else /* no order file */
+                   {
+                      /* shouldnt happen */
+                   }
+              }
+         }
+     }
+   _e_fm2_dnd_drop_hide(sd->obj);
+   _e_fm2_dnd_drop_all_hide(sd->obj);
+   for (l = _e_fm2_list; l; l = l->next)
+     _e_fm2_dnd_finish(l->data, refresh);
 }
  
 static void
@@ -2690,12 +2863,16 @@
 static void
 _e_fm2_cb_drag_finished(E_Drag *drag, int dropped)
 {
-   char **selected, *f;
-   int i;
+   Evas_List *fsel;
+   char *f;
    
-   selected = drag->data;
-   for (i = 0, f = selected[i]; f; i++, f = selected[i]) free(f);
-   free(selected);
+   fsel = drag->data;
+   while (fsel)
+     {
+       f = fsel->data;
+       free(f);
+       fsel = evas_list_remove_list(fsel, fsel);
+     }
 }
 
 static void
@@ -2719,10 +2896,9 @@
             Evas_Object *o, *o2;
             Evas_Coord x, y, w, h;
             const char *drag_types[] = { "text/uri-list" }, *realpath;
-            char **selected = NULL;
             char buf[4096];
             E_Container *con = NULL;
-            Evas_List *l, *sl;
+            Evas_List *l, *sl, *fsel = NULL;
             int i;
             
             switch (ic->sd->eobj->type)
@@ -2744,24 +2920,25 @@
                  break;
               }
             if (!con) return;
+            ic->sd->drag = 1;
             ic->drag.dnd = 1;
             ic->drag.start = 0;
             evas_object_geometry_get(ic->obj, &x, &y, &w, &h);
             realpath = e_fm2_real_path_get(ic->sd->obj);
             sl = e_fm2_selected_list_get(ic->sd->obj);
-            selected = E_NEW(char *, evas_list_count(sl) + 1);
             for (l = sl, i = 0; l; l = l->next, i++)
               {
+                 /* FIXME: URI - needs to be file:/..... (can't remember 1 or 
2 /'s) */
                  if (!strcmp(realpath, "/"))
                    snprintf(buf, sizeof(buf), "/%s", ic->info.file);
                  else
                    snprintf(buf, sizeof(buf), "%s/%s", realpath, 
ic->info.file);
-                 selected[i] = strdup(buf);
+                 fsel = evas_list_append(fsel, strdup(buf));
               }
             evas_list_free(sl);
             d = e_drag_new(con,
                            x, y, drag_types, 1,
-                           selected, -1, _e_fm2_cb_drag_finished);
+                           fsel, -1, _e_fm2_cb_drag_finished);
             o = edje_object_add(e_drag_evas_get(d));
             if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST)
               {
@@ -3347,9 +3524,24 @@
    evas_object_smart_member_add(sd->overlay, obj);
    evas_object_show(sd->overlay);
    
+   sd->drop = edje_object_add(evas_object_evas_get(obj));
+   evas_object_clip_set(sd->drop, sd->clip);
+   e_theme_edje_object_set(sd->drop, "base/theme/fileman",
+                          "e/fileman/list/drop_between");
+   evas_object_smart_member_add(sd->drop, obj);
+   evas_object_show(sd->drop);
+   
+   sd->drop_in = edje_object_add(evas_object_evas_get(obj));
+   evas_object_clip_set(sd->drop_in, sd->clip);
+   e_theme_edje_object_set(sd->drop_in, "base/theme/fileman",
+                          "e/fileman/list/drop_in");
+   evas_object_smart_member_add(sd->drop_in, obj);
+   evas_object_show(sd->drop_in);
+   
    evas_object_smart_data_set(obj, sd);
    evas_object_move(obj, 0, 0);
    evas_object_resize(obj, 0, 0);
+   _e_fm2_list = evas_list_append(_e_fm2_list, sd->obj);
 }
 
 static void
@@ -3388,8 +3580,11 @@
 
    evas_object_del(sd->underlay);
    evas_object_del(sd->overlay);
+   evas_object_del(sd->drop);
+   evas_object_del(sd->drop_in);
    evas_object_del(sd->clip);
    if (sd->drop_handler) e_drop_handler_del(sd->drop_handler);
+   _e_fm2_list = evas_list_remove(_e_fm2_list, sd->obj);
    free(sd);
 }
 
@@ -3405,6 +3600,7 @@
    sd->y = y;
    evas_object_move(sd->underlay, sd->x, sd->y);
    evas_object_move(sd->overlay, sd->x, sd->y);
+   _e_fm2_dnd_drop_configure(sd->obj);
    evas_object_move(sd->clip, sd->x - OVERCLIP, sd->y - OVERCLIP);
    _e_fm2_obj_icons_place(sd);
    if (sd->drop_handler)
@@ -3426,6 +3622,7 @@
    sd->h = h;
    evas_object_resize(sd->underlay, sd->w, sd->h);
    evas_object_resize(sd->overlay, sd->w, sd->h);
+   _e_fm2_dnd_drop_configure(sd->obj);
    evas_object_resize(sd->clip, sd->w + (OVERCLIP * 2), sd->h + (OVERCLIP * 
2));
 
    /* for automatic layout - do this - NB; we could put this on a timer delay 
*/
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_menus.c,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -3 -r1.166 -r1.167
--- e_int_menus.c       24 Sep 2006 23:08:36 -0000      1.166
+++ e_int_menus.c       28 Sep 2006 06:07:15 -0000      1.167
@@ -668,6 +668,9 @@
    e_menu_item_callback_set(mi, _e_int_menus_config_item_cb, NULL);
 
    mi = e_menu_item_new(m);
+   e_menu_item_separator_set(mi, 1);
+
+   mi = e_menu_item_new(m);
    e_menu_item_label_set(mi, _("Wallpaper"));
    e_util_menu_item_edje_icon_set(mi, "enlightenment/background");
    e_menu_item_callback_set(mi, _e_int_menus_background_item_cb, NULL);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_sys_main.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_sys_main.c        3 Sep 2006 23:14:01 -0000       1.4
+++ e_sys_main.c        28 Sep 2006 06:07:15 -0000      1.5
@@ -1,6 +1,8 @@
 /*
  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
  */
+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -9,11 +11,14 @@
 #include <pwd.h>
 #include <grp.h>
 #include <fnmatch.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
 #include <Evas.h>
 
 /* local subsystem functions */
 static int auth_action_ok(char *a, uid_t uid, gid_t gid);
-static int auth_etc_enlightenment_sysactions(char *a, char *u, char *g);
+static int auth_etc_enlightenment_sysactions(char *a, char *u, char **g);
 static char *get_word(char *s, char *d);
 
 /* local subsystem globals */
@@ -98,15 +103,37 @@
 {
    struct passwd *pw;
    struct group *gp;
-   char *usr = NULL, *grp;
-   int ret;
+   char *usr = NULL, **grp;
+   int ret, gn, i, j;
+   gid_t gl[1024], egid;
 
    pw = getpwuid(uid);
    if (!pw) return 0;
    usr = pw->pw_name;
    if (!usr) return 0;
+   egid = getegid();
+   gn = getgroups(1024, gl);
+   grp = alloca(sizeof(char *) * (gn + 1 + 1));
+   j = 0;
    gp = getgrgid(gid);
-   if (gp) grp = gp->gr_name;
+   if (gp)
+     {
+       grp[j] = gp->gr_name;
+       j++;
+     }
+   for (i = 0; i < gn; i++)
+     {
+       if (gl[i] != egid)
+         {
+            gp = getgrgid(gl[i]);
+            if (gp)
+              {
+                 grp[j] = gp->gr_name;
+                 j++;
+              }
+         }
+     }
+   grp[j] = NULL;
    /* first stage - check:
     * PREFIX/etc/enlightenment/sysactions.conf
     */
@@ -118,11 +145,11 @@
 }
 
 static int
-auth_etc_enlightenment_sysactions(char *a, char *u, char *g)
+auth_etc_enlightenment_sysactions(char *a, char *u, char **g)
 {
    FILE *f;
    char file[4096], buf[4096], id[4096], ugname[4096], perm[4096], act[4096];
-   char *p, *pp, *s;
+   char *p, *pp, *s, **gp;
    int len, line = 0, ok = 0;
    int allow = 0;
    int deny = 0;
@@ -169,15 +196,21 @@
          }
        else if (!strcmp(id, "group:"))
          {
-            if (!fnmatch(ugname, g, 0))
+            int matched;
+            
+            matched = 0;
+            for (gp = g; *gp; gp++)
               {
-                 if (!strcmp(perm, "allow:")) allow = 1;
-                 else if (!strcmp(perm, "deny:")) deny = 1;
-                 else
-                   goto malformed;
+                 if (!fnmatch(ugname, *gp, 0))
+                   {
+                      matched = 1;
+                      if (!strcmp(perm, "allow:")) allow = 1;
+                      else if (!strcmp(perm, "deny:")) deny = 1;
+                      else
+                        goto malformed;
+                   }
               }
-            else
-              continue;
+            if (matched) continue;
          }
        else if (!strcmp(id, "action:"))
          {



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to