Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-tweak.git;a=commitdiff;h=1e1252c23605ffb0028b5b3767426fc8612473bb

commit 1e1252c23605ffb0028b5b3767426fc8612473bb
Author: bouleetbil <bouleet...@frogdev.info>
Date:   Sat Nov 13 16:15:40 2010 +0100

*can remove/add group

diff --git a/frugal-mono-tools/Pictures/WID_Users.cs 
b/frugal-mono-tools/Pictures/WID_Users.cs
index fa42c17..d648654 100644
--- a/frugal-mono-tools/Pictures/WID_Users.cs
+++ b/frugal-mono-tools/Pictures/WID_Users.cs
@@ -26,6 +26,7 @@ namespace frugalmonotools
private const int columnSelected = 0;

private Gtk.TreeIter iter;
+               string GroupSelect="";
ListStore ListStoreUser = new Gtk.ListStore (typeof (string));
ListStore ListStoreUserGroup = new Gtk.ListStore (typeof (bool),typeof 
(string));
ListStore ListStoreGroup = new Gtk.ListStore (typeof (string));
@@ -92,6 +93,7 @@ namespace frugalmonotools
InitGroup();
TREE_Groups.Model=ListStoreGroup;

+                       TREE_Groups.Selection.Changed += OnSelectionGroup;
#endregion

}
@@ -104,7 +106,18 @@ namespace frugalmonotools
}
}

-
+               protected void OnSelectionGroup(object o, EventArgs args)
+           {
+                       try
+                       {
+                               TreeModel model;
+                                if (((TreeSelection)o).GetSelected(out model, 
out iter))
+                       {
+                           GroupSelect =(string)model.GetValue (iter, 0);
+                               }
+                       }
+                       catch{}
+               }
protected void OnSelectionUser (object o, EventArgs args)
{
try
@@ -139,7 +152,7 @@ namespace frugalmonotools
}
private void InitGroup()
{
-                       ListStoreUserGroup.Clear();
+                       ListStoreGroup.Clear();
List<GroupUser> groupsUser = Groups.GetGroup("");
foreach (GroupUser groupUser in groupsUser)
{
@@ -159,16 +172,18 @@ namespace frugalmonotools
protected virtual void OnBTNAddGroupClicked (object sender, System.EventArgs e)
{
//create group
+                       Outils.ExcecuteAsRoot("/usr/sbin/groupadd 
"+SAI_GroupName.Text,true);
+                       SAI_GroupName.Text="";
+                       InitGroup();
}

protected virtual void OnBTNRemoveGroupClicked (object sender, System.EventArgs 
e)
{
//remove group
+                       if(GroupSelect=="") return;
+                       Outils.ExcecuteAsRoot("/usr/sbin/groupdel 
"+GroupSelect,true);
+                       InitGroup();
}
-
-
-
-
}
}
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to