private void InitializeWidgets()
 {
     this.SetDefaultSize (500, 400);
        this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolderuser.png"));
        VBox dialogBox = new VBox();
        dialogBox.Spacing = 10;
        dialogBox.BorderWidth = 10;
        this.VBox.PackStart(dialogBox, true, true, 0);
        Table findTable = new Table(2, 3, false);
        dialogBox.PackStart(findTable, false, false, 0);
        findTable.ColumnSpacing = 20;
        findTable.RowSpacing = 5;
        Label findLabel = new Label(Util.GS("Find:"));
        findLabel.Xalign = 0;
        findTable.Attach(findLabel, 0, 1, 0, 1,
     AttachOptions.Shrink, 0, 0, 0);
        SearchAttribComboBox = ComboBox.NewText();
        SearchAttribComboBox.AppendText(Util.GS("First Name"));
        SearchAttribComboBox.AppendText(Util.GS("Last Name"));
        SearchAttribComboBox.AppendText(Util.GS("Full Name"));
        SearchAttribComboBox.Active = 2;
        SearchAttribComboBox.Changed += new EventHandler(OnSearchAttribComboBoxChanged);
        findTable.Attach(SearchAttribComboBox, 1, 2, 0, 1,
     AttachOptions.Shrink, 0, 0, 0);
        SearchEntry = new Gtk.Entry(Util.GS("<Enter text to find a user>"));
        SearchEntry.SelectRegion(0, -1);
        SearchEntry.CanFocus = true;
        SearchEntry.Changed += new EventHandler(OnSearchEntryChanged);
        findTable.Attach(SearchEntry, 2, 3, 0, 1,
     AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);
        Label findHelpTextLabel = new Label(Util.GS("(Full or partial name)"));
        findHelpTextLabel.Xalign = 0;
        findTable.Attach(findHelpTextLabel, 2,3,1,2,
     AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);
        HBox selBox = new HBox();
        selBox.Spacing = 10;
        dialogBox.PackStart(selBox, true, true, 0);
        memberListModel = new MemberListModel(domainID, simws);
        memberList = new BigList(memberListModel);
        ScrolledWindow sw = new ScrolledWindow(memberList.HAdjustment, memberList.VAdjustment);
        sw.ShadowType = Gtk.ShadowType.EtchedIn;
        sw.Add(memberList);
        selBox.PackStart(sw, true, true, 0);
        memberList.ItemSelected += new ItemSelected(OnMemberIndexSelected);
        memberList.ItemActivated += new ItemActivated(OnMemberIndexActivated);
        VBox btnBox = new VBox();
        btnBox.Spacing = 10;
        selBox.PackStart(btnBox, false, true, 0);
        UserAddButton = new Button(Util.GS("_Add >>"));
        btnBox.PackStart(UserAddButton, false, true, 0);
        UserAddButton.Clicked += new EventHandler(OnAddButtonClicked);
        UserDelButton = new Button(Util.GS("_Remove"));
        btnBox.PackStart(UserDelButton, false, true, 0);
        UserDelButton.Clicked += new EventHandler(OnRemoveButtonClicked);
        SelTreeView = new TreeView();
        ScrolledWindow ssw = new ScrolledWindow();
        ssw.ShadowType = Gtk.ShadowType.EtchedIn;
        ssw.Add(SelTreeView);
        selBox.PackStart(ssw, true, true, 0);
        SelTreeStore = new ListStore(typeof(MemberInfo));
        SelTreeView.Model = SelTreeStore;
        CellRendererPixbuf smcrp = new CellRendererPixbuf();
        TreeViewColumn selmemberColumn = new TreeViewColumn();
        selmemberColumn.PackStart(smcrp, false);
        selmemberColumn.SetCellDataFunc(smcrp, new TreeCellDataFunc(
       UserCellPixbufDataFunc));
        CellRendererText smcrt = new CellRendererText();
        selmemberColumn.PackStart(smcrt, false);
        selmemberColumn.SetCellDataFunc(smcrt, new TreeCellDataFunc(
       UserCellTextDataFunc));
        selmemberColumn.Title = Util.GS("Selected Users");
        selmemberColumn.Resizable = true;
        SelTreeView.AppendColumn(selmemberColumn);
        SelTreeView.Selection.Mode = SelectionMode.Multiple;
        SelTreeView.Selection.Changed += new EventHandler(
       OnSelUserSelectionChanged);
        UserPixBuf =
     new Gdk.Pixbuf(Util.ImagesPath("ifolderuser.png"));
        this.AddButton(Stock.Cancel, ResponseType.Cancel);
        this.AddButton(Stock.Ok, ResponseType.Ok);
        this.AddButton(Stock.Help, ResponseType.Help);
        SearchiFolderUsers();
 }
 private void InitializeWidgets()
 {
     this.SetDefaultSize (500, 400);
        this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolder16.png"));
        VBox dialogBox = new VBox();
        dialogBox.Spacing = 10;
        dialogBox.BorderWidth = 10;
        this.VBox.PackStart(dialogBox, true, true, 0);
        Label l = new Label(
     string.Format("<span size=\"large\" weight=\"bold\">{0}</span>",
     Util.GS("Add users to this iFolder")));
        l.Xalign = 0;
        l.UseMarkup = true;
        dialogBox.PackStart(l, false, false, 0);
        HBox selBox = new HBox(false, 10);
        dialogBox.PackStart(selBox, true, true, 0);
        VBox vbox = new VBox(false, 0);
        selBox.PackStart(vbox, false, false, 0);
        HBox searchHBox = new HBox(false, 4);
        vbox.PackStart(searchHBox, false, false, 0);
        Label findLabel = new Label(Util.GS("_Find:"));
        searchHBox.PackStart(findLabel, false, false, 0);
        findLabel.Xalign = 0;
        SearchEntry = new Entry();
        searchHBox.PackStart(SearchEntry, true, true, 0);
        findLabel.MnemonicWidget = SearchEntry;
        SearchEntry.SelectRegion(0, -1);
        SearchEntry.CanFocus = true;
        SearchEntry.Changed +=
     new EventHandler(OnSearchEntryChanged);
        Image stopImage = new Image(Stock.Stop, Gtk.IconSize.Menu);
        stopImage.SetAlignment(0.5F, 0F);
        CancelSearchButton = new Button(stopImage);
        searchHBox.PackEnd(CancelSearchButton, false, false, 0);
        CancelSearchButton.Relief = ReliefStyle.None;
        CancelSearchButton.Sensitive = false;
        CancelSearchButton.Clicked +=
     new EventHandler(OnCancelSearchButton);
        memberListModel = new MemberListModel(domainID, simws);
        memberList = new BigList(memberListModel);
        ScrolledWindow sw = new ScrolledWindow(memberList.HAdjustment, memberList.VAdjustment);
        sw.ShadowType = Gtk.ShadowType.EtchedIn;
        sw.Add(memberList);
        vbox.PackStart(sw, true, true, 0);
        memberList.ItemSelected += new ItemSelected(OnMemberIndexSelected);
        memberList.ItemActivated += new ItemActivated(OnMemberIndexActivated);
        VBox btnBox = new VBox();
        btnBox.Spacing = 10;
        selBox.PackStart(btnBox, false, false, 0);
        Label spacer = new Label("");
        btnBox.PackStart(spacer, true, true, 0);
        HBox buttonHBox = new HBox(false, 4);
        spacer = new Label("");
        buttonHBox.PackStart(spacer, true, true, 0);
        Label buttonLabel = new Label(Util.GS("_Add"));
        buttonHBox.PackStart(buttonLabel, false, false, 0);
        Image buttonImage = new Image(Stock.GoForward, IconSize.Button);
        buttonHBox.PackStart(buttonImage, false, false, 0);
        spacer = new Label("");
        buttonHBox.PackStart(spacer, true, true, 0);
        UserAddButton = new Button(buttonHBox);
        btnBox.PackStart(UserAddButton, false, true, 0);
        UserAddButton.Clicked += new EventHandler(OnAddButtonClicked);
        buttonHBox = new HBox(false, 4);
        spacer = new Label("");
        buttonHBox.PackStart(spacer, true, true, 0);
        buttonImage = new Image(Stock.GoBack, IconSize.Button);
        buttonHBox.PackStart(buttonImage, false, false, 0);
        buttonLabel = new Label(Util.GS("_Remove"));
        buttonHBox.PackStart(buttonLabel, false, false, 0);
        spacer = new Label("");
        buttonHBox.PackStart(spacer, true, true, 0);
        UserDelButton = new Button(buttonHBox);
        btnBox.PackStart(UserDelButton, false, true, 0);
        UserDelButton.Clicked += new EventHandler(OnRemoveButtonClicked);
        spacer = new Label("");
        btnBox.PackStart(spacer, true, true, 0);
        vbox = new VBox(false, 0);
        selBox.PackStart(vbox, true, true, 0);
        l = new Label(Util.GS("_Users to add:"));
        l.Xalign = 0;
        vbox.PackStart(l, false, false, 0);
        SelTreeView = new TreeView();
        ScrolledWindow ssw = new ScrolledWindow();
        ssw.ShadowType = Gtk.ShadowType.EtchedIn;
        ssw.Add(SelTreeView);
        vbox.PackStart(ssw, true, true, 0);
        ssw.WidthRequest = 200;
        l.MnemonicWidget = SelTreeView;
        SelTreeStore = new ListStore(typeof(MemberInfo));
        SelTreeStore.SetSortFunc(
     0,
     new TreeIterCompareFunc(SelTreeStoreSortFunction));
        SelTreeStore.SetSortColumnId(0, SortType.Ascending);
        SelTreeView.Model = SelTreeStore;
        SelTreeView.HeadersVisible = false;
        TreeViewColumn selmemberColumn = new TreeViewColumn();
        CellRendererText smcrt = new CellRendererText();
        selmemberColumn.PackStart(smcrt, false);
        selmemberColumn.SetCellDataFunc(smcrt, new TreeCellDataFunc(
       UserCellTextDataFunc));
        selmemberColumn.Title = Util.GS("Users to Add...");
        SelTreeView.AppendColumn(selmemberColumn);
        SelTreeView.Selection.Mode = SelectionMode.Multiple;
        SelTreeView.Selection.Changed += new EventHandler(
       OnSelUserSelectionChanged);
        this.AddButton(Stock.Cancel, ResponseType.Cancel);
        this.AddButton(Stock.Ok, ResponseType.Ok);
        this.AddButton(Stock.Help, ResponseType.Help);
        SetResponseSensitive(ResponseType.Ok, false);
        SearchiFolderUsers();
 }
Example #3
0
        /// <summary>
        /// Set up the UI inside the Window
        /// </summary>
        private void InitializeWidgets()
        {
            this.SetDefaultSize(500, 400);
            this.Icon = new Gdk.Pixbuf(Util.ImagesPath("ifolder16.png"));

            VBox dialogBox = new VBox();

            dialogBox.Spacing     = 10;
            dialogBox.BorderWidth = 10;
            this.VBox.PackStart(dialogBox, true, true, 0);

            Label l = new Label(
                string.Format("<span size=\"large\" weight=\"bold\">{0}</span>",
                              Util.GS("Add users to this iFolder")));

            l.Xalign    = 0;
            l.UseMarkup = true;
            dialogBox.PackStart(l, false, false, 0);



            //------------------------------
            // Selection Area
            //------------------------------
            HBox selBox = new HBox(false, 10);

            dialogBox.PackStart(selBox, true, true, 0);

            //------------------------------
            // All Users tree
            //------------------------------
            VBox vbox = new VBox(false, 0);

            selBox.PackStart(vbox, false, false, 0);

            //------------------------------
            // Find Entry
            //------------------------------
            HBox searchHBox = new HBox(false, 4);

            vbox.PackStart(searchHBox, false, false, 0);

            Label findLabel = new Label(Util.GS("_Find:"));

            searchHBox.PackStart(findLabel, false, false, 0);
            findLabel.Xalign = 0;

            SearchEntry = new Entry();
            searchHBox.PackStart(SearchEntry, true, true, 0);
            findLabel.MnemonicWidget = SearchEntry;
            SearchEntry.SelectRegion(0, -1);
            SearchEntry.CanFocus = true;
            SearchEntry.Changed +=
                new EventHandler(OnSearchEntryChanged);

            Image stopImage = new Image(Stock.Stop, Gtk.IconSize.Menu);

            stopImage.SetAlignment(0.5F, 0F);

            CancelSearchButton = new Button(stopImage);
            searchHBox.PackEnd(CancelSearchButton, false, false, 0);
            CancelSearchButton.Relief    = ReliefStyle.None;
            CancelSearchButton.Sensitive = false;

            CancelSearchButton.Clicked +=
                new EventHandler(OnCancelSearchButton);

            memberListModel = new MemberListModel(domainID, simws);

            memberList = new BigList(memberListModel);

            // FIXME: Fix up the BigList class to support both horizontal and vertical scrolling and then use the scroll adjustments to construct the ScrolledWindow
            ScrolledWindow sw = new ScrolledWindow(memberList.HAdjustment, memberList.VAdjustment);

            sw.ShadowType = Gtk.ShadowType.EtchedIn;
            sw.Add(memberList);
            vbox.PackStart(sw, true, true, 0);
            memberList.ItemSelected  += new ItemSelected(OnMemberIndexSelected);
            memberList.ItemActivated += new ItemActivated(OnMemberIndexActivated);


            //------------------------------
            // Buttons
            //------------------------------
            VBox btnBox = new VBox();

            btnBox.Spacing = 10;
            selBox.PackStart(btnBox, false, false, 0);

            Label spacer = new Label("");

            btnBox.PackStart(spacer, true, true, 0);

            HBox buttonHBox = new HBox(false, 4);

            spacer = new Label("");
            buttonHBox.PackStart(spacer, true, true, 0);
            Label buttonLabel = new Label(Util.GS("_Add"));

            buttonHBox.PackStart(buttonLabel, false, false, 0);
            Image buttonImage = new Image(Stock.GoForward, IconSize.Button);

            buttonHBox.PackStart(buttonImage, false, false, 0);
            spacer = new Label("");
            buttonHBox.PackStart(spacer, true, true, 0);
            UserAddButton = new Button(buttonHBox);
            btnBox.PackStart(UserAddButton, false, true, 0);
            UserAddButton.Clicked += new EventHandler(OnAddButtonClicked);

            buttonHBox = new HBox(false, 4);
            spacer     = new Label("");
            buttonHBox.PackStart(spacer, true, true, 0);
            buttonImage = new Image(Stock.GoBack, IconSize.Button);
            buttonHBox.PackStart(buttonImage, false, false, 0);
            buttonLabel = new Label(Util.GS("_Remove"));
            buttonHBox.PackStart(buttonLabel, false, false, 0);
            spacer = new Label("");
            buttonHBox.PackStart(spacer, true, true, 0);
            UserDelButton = new Button(buttonHBox);
            btnBox.PackStart(UserDelButton, false, true, 0);
            UserDelButton.Clicked += new EventHandler(OnRemoveButtonClicked);

            spacer = new Label("");
            btnBox.PackStart(spacer, true, true, 0);

            //------------------------------
            // Selected Users tree
            //------------------------------
            vbox = new VBox(false, 0);
            selBox.PackStart(vbox, true, true, 0);

            l        = new Label(Util.GS("_Users to add:"));
            l.Xalign = 0;
            vbox.PackStart(l, false, false, 0);

            SelTreeView = new TreeView();
            ScrolledWindow ssw = new ScrolledWindow();

            ssw.ShadowType = Gtk.ShadowType.EtchedIn;
            ssw.Add(SelTreeView);
            vbox.PackStart(ssw, true, true, 0);
            ssw.WidthRequest = 200;
            l.MnemonicWidget = SelTreeView;

            // Set up the iFolder TreeView
            SelTreeStore = new ListStore(typeof(MemberInfo));
            SelTreeStore.SetSortFunc(
                0,
                new TreeIterCompareFunc(SelTreeStoreSortFunction));
            SelTreeStore.SetSortColumnId(0, SortType.Ascending);
            SelTreeView.Model          = SelTreeStore;
            SelTreeView.HeadersVisible = false;

            // Set up Pixbuf and Text Rendering for "iFolder Users" column
            TreeViewColumn   selmemberColumn = new TreeViewColumn();
            CellRendererText smcrt           = new CellRendererText();

            selmemberColumn.PackStart(smcrt, false);
            selmemberColumn.SetCellDataFunc(smcrt, new TreeCellDataFunc(
                                                UserCellTextDataFunc));
            selmemberColumn.Title = Util.GS("Users to Add...");
            SelTreeView.AppendColumn(selmemberColumn);
            SelTreeView.Selection.Mode = SelectionMode.Multiple;

            SelTreeView.Selection.Changed += new EventHandler(
                OnSelUserSelectionChanged);

            this.AddButton(Stock.Cancel, ResponseType.Cancel);
            this.AddButton(Stock.Ok, ResponseType.Ok);
            this.AddButton(Stock.Help, ResponseType.Help);

            SetResponseSensitive(ResponseType.Ok, false);

            SearchiFolderUsers();
        }