protected virtual void OnEditButtonClicked(object sender, System.EventArgs e) { Gtk.TreePath[] path_array = userTreeview.Selection.GetSelectedRows(); if (path_array.Length == 1) { Gtk.TreeIter iter; store.GetIter(out iter, path_array[0]); //Console.WriteLine(store.GetValue(iter,0)); LdapGroup return_group = null; foreach (LdapGroup grp in group_list) { if (grp.gid == (string)store.GetValue(iter, 0)) { return_group = grp; break; } } llum.Core core = llum.Core.getCore(); /* * core.edit_user_wid=new EditUser(return_user); * core.mw.setCurrentWidget(core.edit_user_wid); */ core.edit_group_wid = new EditGroupWidget(return_group); core.mw.setCurrentWidget(core.edit_group_wid); } }
public EditGroupWidget(LdapGroup grp) { this.Build(); applyPasswordButton.Sensitive = false; opened_group = grp; llum.Core core = llum.Core.getCore(); gidLabel.Text = grp.gid; gidNumberLabel.Text = grp.gid_number; descriptionEntry.Text = grp.description; group_list = core.xmlrpc.get_available_groups_info(); System.Collections.Generic.List <LdapUser> all_list = core.xmlrpc.light_get_user_list(); System.Collections.Generic.List <string> usr_name = new System.Collections.Generic.List <string>(); foreach (LdapUser u in all_list) { usr_name.Add(u.uid); } LdapGroup all_grp = new LdapGroup("[[ALL]]", "1", "1", usr_name, ""); group_list.Insert(0, all_grp); combo_store = new Gtk.ListStore(typeof(string), typeof(string)); combo_store.AppendValues(Mono.Unix.Catalog.GetString("All"), "%All%"); foreach (LdapGroup tmp_grp in group_list) { if (tmp_grp.gid_number != grp.gid_number) { combo_store.AppendValues(tmp_grp.gid, tmp_grp.gid_number); } } Gtk.TreeViewColumn users_in_group_column = new Gtk.TreeViewColumn(); users_in_group_column.Title = Mono.Unix.Catalog.GetString("Users in this group"); Gtk.CellRendererText users_in_group_cell = new Gtk.CellRendererText(); users_in_group_column.PackStart(users_in_group_cell, true); users_in_group_column.AddAttribute(users_in_group_cell, "text", 0); usersInGroupTreeview.AppendColumn(users_in_group_column); users_in_group_store = new Gtk.TreeStore(typeof(string)); usersInGroupTreeview.Model = users_in_group_store; usersInGroupTreeview.Selection.Mode = Gtk.SelectionMode.Multiple; populate_users_treeview(); Gtk.TreeViewColumn available_users_column = new Gtk.TreeViewColumn(); available_users_column.Title = Mono.Unix.Catalog.GetString("Available users"); Gtk.CellRendererText available_users_cell = new Gtk.CellRendererText(); available_users_column.PackStart(available_users_cell, true); available_users_column.AddAttribute(available_users_cell, "text", 0); otherUsersTreeview.AppendColumn(available_users_column); available_users_store = new Gtk.TreeStore(typeof(string)); otherUsersTreeview.Model = available_users_store; otherUsersTreeview.Selection.Mode = Gtk.SelectionMode.Multiple; populate_others_treeview(); }