Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-tweak.git;a=commitdiff;h=d3271f2764cd23e5d519556fc2f5e64890caf7aa
commit d3271f2764cd23e5d519556fc2f5e64890caf7aa Author: bouleetbil <bouleet...@frogdev.info> Date: Sat Nov 13 16:57:18 2010 +0100 *can remove user diff --git a/frugal-mono-tools/Pictures/WID_Users.cs b/frugal-mono-tools/Pictures/WID_Users.cs index d648654..837efd0 100644 --- a/frugal-mono-tools/Pictures/WID_Users.cs +++ b/frugal-mono-tools/Pictures/WID_Users.cs @@ -27,6 +27,7 @@ namespace frugalmonotools private Gtk.TreeIter iter; string GroupSelect=""; + string UserSelect=""; ListStore ListStoreUser = new Gtk.ListStore (typeof (string)); ListStore ListStoreUserGroup = new Gtk.ListStore (typeof (bool),typeof (string)); ListStore ListStoreGroup = new Gtk.ListStore (typeof (string)); @@ -47,11 +48,7 @@ namespace frugalmonotools TREE_Users.AppendColumn (ColumnUser); ColumnUser.AddAttribute (NameCellUser, "text", 0); - ListStoreUser.Clear(); - foreach (User user in Groups.GetAllUsers()) - { - ListStoreUser.AppendValues (user.Name); - } + _InitUsers(); TREE_Users.Model=ListStoreUser; // Event on treeview TREE_Users.Selection.Changed += OnSelectionUser; @@ -90,13 +87,21 @@ namespace frugalmonotools ColumnGroups.PackStart (NameCellGroups, true); TREE_Groups.AppendColumn (ColumnGroups); ColumnGroups.AddAttribute (NameCellGroups, "text", 0); - InitGroup(); + _InitGroup(); TREE_Groups.Model=ListStoreGroup; TREE_Groups.Selection.Changed += OnSelectionGroup; #endregion } + private void _InitUsers() + { + ListStoreUser.Clear(); + foreach (User user in Groups.GetAllUsers()) + { + ListStoreUser.AppendValues (user.Name); + } + } private void SelectToggled (object sender, ToggledArgs args) { TreeIter iter; @@ -126,6 +131,7 @@ namespace frugalmonotools if (((TreeSelection)o).GetSelected(out model, out iter)) { string T =(string)model.GetValue (iter, 0); + UserSelect=T; User user = new User(T); SAI_Name.Text=T; SAI_Comment.Text=user.Comment; @@ -150,7 +156,7 @@ namespace frugalmonotools } } - private void InitGroup() + private void _InitGroup() { ListStoreGroup.Clear(); List<GroupUser> groupsUser = Groups.GetGroup(""); @@ -174,7 +180,7 @@ namespace frugalmonotools //create group Outils.ExcecuteAsRoot("/usr/sbin/groupadd "+SAI_GroupName.Text,true); SAI_GroupName.Text=""; - InitGroup(); + _InitGroup(); } protected virtual void OnBTNRemoveGroupClicked (object sender, System.EventArgs e) @@ -182,8 +188,16 @@ namespace frugalmonotools //remove group if(GroupSelect=="") return; Outils.ExcecuteAsRoot("/usr/sbin/groupdel "+GroupSelect,true); - InitGroup(); + _InitGroup(); } + protected virtual void OnBTNRemoveClicked (object sender, System.EventArgs e) + { + if(UserSelect=="") return; + Outils.ExcecuteAsRoot("/usr/sbin/userdel "+GroupSelect,true); + _InitUsers(); + } + + } } diff --git a/frugal-mono-tools/gtk-gui/frugalmonotools.WID_Users.cs b/frugal-mono-tools/gtk-gui/frugalmonotools.WID_Users.cs index ac59875..cc54fe2 100644 --- a/frugal-mono-tools/gtk-gui/frugalmonotools.WID_Users.cs +++ b/frugal-mono-tools/gtk-gui/frugalmonotools.WID_Users.cs @@ -74,7 +74,7 @@ namespace frugalmonotools this.notebook1 = new global::Gtk.Notebook (); this.notebook1.CanFocus = true; this.notebook1.Name = "notebook1"; - this.notebook1.CurrentPage = 1; + this.notebook1.CurrentPage = 0; // Container child notebook1.Gtk.Notebook+NotebookChild this.vbox2 = new global::Gtk.VBox (); this.vbox2.Name = "vbox2"; @@ -405,6 +405,7 @@ namespace frugalmonotools } this.Hide (); this.BTN_AddUser.Clicked += new global::System.EventHandler (this.OnBTNAddUserClicked); + this.BTN_Remove.Clicked += new global::System.EventHandler (this.OnBTNRemoveClicked); this.BTN_AddGroup.Clicked += new global::System.EventHandler (this.OnBTNAddGroupClicked); this.BTN_RemoveGroup.Clicked += new global::System.EventHandler (this.OnBTNRemoveGroupClicked); } diff --git a/frugal-mono-tools/gtk-gui/gui.stetic b/frugal-mono-tools/gtk-gui/gui.stetic index d8bde7d..c4ef7b4 100644 --- a/frugal-mono-tools/gtk-gui/gui.stetic +++ b/frugal-mono-tools/gtk-gui/gui.stetic @@ -3479,7 +3479,7 @@ Public License instead of this License. <widget class="Gtk.Notebook" id="notebook1"> <property name="MemberName" /> <property name="CanFocus">True</property> - <property name="CurrentPage">1</property> + <property name="CurrentPage">0</property> <child> <widget class="Gtk.VBox" id="vbox2"> <property name="MemberName" /> @@ -3697,6 +3697,7 @@ Public License instead of this License. <property name="Icon">stock:gtk-delete Menu</property> <property name="Label" translatable="yes">Remove user</property> <property name="UseUnderline">True</property> + <signal name="Clicked" handler="OnBTNRemoveClicked" /> </widget> <packing> <property name="Position">1</property> _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git