Beispiel #1
0
        public void OnNewItemActionActivated(object sender, EventArgs e)
        {
            expand = true;
            var dialog = new NewTemplateDialog(_controller.Templates.GetEnumerator());

            dialog.TransientFor = this;

            if (dialog.Run() == (int)ResponseType.Ok)
            {
                List <TreeIter>   iters;
                List <Gdk.Pixbuf> icons;
                string[]          paths = projectview1.GetSelectedTreePath(out iters, out icons);

                string location;

                if (paths.Length == 1)
                {
                    if (icons [0] == projectview1.ICON_FOLDER)
                    {
                        location = paths [0];
                    }
                    else if (icons[0] == projectview1.ICON_BASE)
                    {
                        location = _controller.GetFullPath("");
                    }
                    else
                    {
                        location = System.IO.Path.GetDirectoryName(paths [0]);
                    }
                }
                else
                {
                    location = _controller.GetFullPath("");
                }

                _controller.NewItem(dialog.name, location, dialog.templateFile);
                UpdateMenus();
            }
            expand = false;
        }
Beispiel #2
0
        public void OnNewItemActionActivated (object sender, EventArgs e)
        {
            expand = true;
            var dialog = new NewTemplateDialog(_controller.Templates.GetEnumerator ());
            dialog.TransientFor = this;

            if (dialog.Run () == (int)ResponseType.Ok) {

                List<TreeIter> iters;
                List<Gdk.Pixbuf> icons;
                string[] paths = projectview1.GetSelectedTreePath (out iters, out icons);

                string location;

                if (paths.Length == 1) {
                    if (icons [0] == projectview1.ICON_FOLDER)
                        location = paths [0];
                    else if (icons[0] == projectview1.ICON_BASE)
                        location = _controller.GetFullPath ("");
                    else
                        location = System.IO.Path.GetDirectoryName (paths [0]);
                }
                else
                    location = _controller.GetFullPath ("");

                _controller.NewItem(dialog.name, location, dialog.templateFile);
                UpdateMenus();
            }
            expand = false;
        }