Beispiel #1
0
        TreeIter AppendFileInfo(VersionInfo info)
        {
            Xwt.Drawing.Image statusicon = VersionControlService.LoadIconForStatus(info.Status);
            string            lstatus    = VersionControlService.GetStatusLabel(info.Status);
            string            localpath;

            if (info.IsDirectory)
            {
                localpath = (!info.LocalPath.IsChildPathOf(changeSet.BaseLocalPath) ?
                             "." :
                             (string)info.LocalPath.ToRelative(changeSet.BaseLocalPath));
            }
            else
            {
                localpath = System.IO.Path.GetFileName((string)info.LocalPath);
            }

            if (localpath.Length > 0 && localpath [0] == System.IO.Path.DirectorySeparatorChar)
            {
                localpath = localpath.Substring(1);
            }
            if (localpath == "")
            {
                localpath = ".";
            }

            TreeIter it = store.AppendValues(statusicon, lstatus, localpath, true, info);

            return(it);
        }
Beispiel #2
0
        TreeIter AppendFileInfo(VersionInfo n)
        {
            Gdk.Pixbuf statusicon = VersionControlService.LoadIconForStatus(n.Status);
            string     lstatus    = VersionControlService.GetStatusLabel(n.Status);

            Gdk.Pixbuf rstatusicon = VersionControlService.LoadIconForStatus(n.RemoteStatus);
            string     rstatus     = VersionControlService.GetStatusLabel(n.RemoteStatus);

            string scolor = n.HasLocalChanges && n.HasRemoteChanges ? "red" : null;

            string localpath = n.LocalPath.ToRelative(filepath);

            if (localpath.Length > 0 && localpath[0] == Path.DirectorySeparatorChar)
            {
                localpath = localpath.Substring(1);
            }
            if (localpath == "")
            {
                localpath = ".";
            }                                                     // not sure if this happens

            bool hasComment = GetCommitMessage(n.LocalPath).Length > 0;
            bool commit     = changeSet.ContainsFile(n.LocalPath);

            Gdk.Pixbuf fileIcon;
            if (n.IsDirectory)
            {
                fileIcon = ImageService.GetPixbuf(MonoDevelop.Ide.Gui.Stock.ClosedFolder, Gtk.IconSize.Menu);
            }
            else
            {
                fileIcon = DesktopService.GetPixbufForFile(n.LocalPath, Gtk.IconSize.Menu);
            }



            TreeIter it = filestore.AppendValues(statusicon, lstatus, GLib.Markup.EscapeText(localpath).Split('\n'), rstatus, commit, false, n.LocalPath.ToString(), true, hasComment, fileIcon, n.HasLocalChanges, rstatusicon, scolor, n.HasRemoteChange(VersionStatus.Modified));

            if (!n.IsDirectory)
            {
                filestore.AppendValues(it, statusicon, "", new string[0], "", false, true, n.LocalPath.ToString(), false, false, fileIcon, false, null, null, false);
            }
            return(it);
        }
Beispiel #3
0
        TreeIter AppendFileInfo(ChangeSetItem n)
        {
            Xwt.Drawing.Image statusicon = VersionControlService.LoadIconForStatus(n.Status);
            string            lstatus    = VersionControlService.GetStatusLabel(n.Status);

            string scolor = null;

            string localpath = n.LocalPath.ToRelative(changeSet.BaseLocalPath);

            if (localpath.Length > 0 && localpath[0] == System.IO.Path.DirectorySeparatorChar)
            {
                localpath = localpath.Substring(1);
            }
            if (localpath == "")
            {
                localpath = ".";
            }                               // not sure if this happens

            bool hasComment = false;        //GetCommitMessage (n.LocalPath).Length > 0;
            bool commit     = true;         //changeSet.ContainsFile (n.LocalPath);

            Xwt.Drawing.Image fileIcon;
            if (n.IsDirectory)
            {
                fileIcon = ImageService.GetIcon(MonoDevelop.Ide.Gui.Stock.ClosedFolder, Gtk.IconSize.Menu);
            }
            else
            {
                fileIcon = DesktopService.GetIconForFile(n.LocalPath, Gtk.IconSize.Menu);
            }

            TreeIter it = filestore.AppendValues(statusicon, lstatus, GLib.Markup.EscapeText(localpath).Split('\n'), commit, false, n.LocalPath.ToString(), true, hasComment, fileIcon, n.HasLocalChanges, scolor);

            if (!n.IsDirectory)
            {
                filestore.AppendValues(it, statusicon, "", new string[0], false, true, n.LocalPath.ToString(), false, false, fileIcon, false, null);
            }
            return(it);
        }
Beispiel #4
0
        void LoadChangeset(IEnumerable <ChangeSetItem> items)
        {
            fileList.Model = null;
            store.Clear();

            foreach (ChangeSetItem info in items)
            {
                Xwt.Drawing.Image statusicon = VersionControlService.LoadIconForStatus(info.Status);
                string            lstatus    = VersionControlService.GetStatusLabel(info.Status);
                string            localpath;

                if (info.IsDirectory)
                {
                    localpath = (!info.LocalPath.IsChildPathOf(changeSet.BaseLocalPath) ?
                                 "." :
                                 (string)info.LocalPath.ToRelative(changeSet.BaseLocalPath));
                }
                else
                {
                    localpath = System.IO.Path.GetFileName((string)info.LocalPath);
                }

                if (localpath.Length > 0 && localpath [0] == System.IO.Path.DirectorySeparatorChar)
                {
                    localpath = localpath.Substring(1);
                }
                if (localpath == "")
                {
                    localpath = ".";
                }                                                         // not sure if this happens

                store.AppendValues(statusicon, lstatus, localpath, true, info);
                selected.Add(info.LocalPath);
            }

            fileList.Model = store;
        }
Beispiel #5
0
        public CommitDialog(ChangeSet changeSet)
        {
            Build();

            store          = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(bool), typeof(object));
            fileList.Model = store;
            this.changeSet = changeSet;
            oldMessage     = changeSet.GlobalComment;

            CellRendererText crt     = new CellRendererText();
            var            crp       = new CellRendererPixbuf();
            TreeViewColumn colStatus = new TreeViewColumn();

            colStatus.Title = GettextCatalog.GetString("Status");
            colStatus.PackStart(crp, false);
            colStatus.PackStart(crt, true);
            colStatus.Spacing = 2;
            colStatus.AddAttribute(crp, "pixbuf", 0);
            colStatus.AddAttribute(crt, "text", 1);
            CellRendererToggle cellToggle = new CellRendererToggle();

            cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler);
            TreeViewColumn colCommit = new TreeViewColumn("", cellToggle, "active", 3);
            TreeViewColumn colFile   = new TreeViewColumn(GettextCatalog.GetString("File"), new CellRendererText(), "text", 2);

            fileList.AppendColumn(colCommit);
            fileList.AppendColumn(colStatus);
            fileList.AppendColumn(colFile);

            colCommit.Visible = false;

            object[] exts = AddinManager.GetExtensionObjects("/MonoDevelop/VersionControl/CommitDialogExtensions", false);
            bool     separatorRequired = false;

            foreach (object ob in exts)
            {
                CommitDialogExtension ext = ob as CommitDialogExtension;
                if (ext == null)
                {
                    MessageService.ShowError("Commit extension type " + ob.GetType() + " must be a subclass of CommitDialogExtension");
                    continue;
                }
                if (ext.Initialize(changeSet))
                {
                    if (separatorRequired)
                    {
                        HSeparator sep = new HSeparator();
                        sep.Show();
                        vboxExtensions.PackEnd(sep, false, false, 0);
                    }
                    vboxExtensions.PackEnd(ext, false, false, 0);
                    extensions.Add(ext);
                    ext.AllowCommitChanged += HandleAllowCommitChanged;
                    separatorRequired       = true;
                }
                else
                {
                    ext.Destroy();
                }
            }
            HandleAllowCommitChanged(null, null);

            foreach (ChangeSetItem info in changeSet.Items)
            {
                Gdk.Pixbuf statusicon = VersionControlService.LoadIconForStatus(info.Status);
                string     lstatus    = VersionControlService.GetStatusLabel(info.Status);

                string localpath = (!info.LocalPath.IsChildPathOf(changeSet.BaseLocalPath)?
                                    ".":
                                    (string)info.LocalPath.ToRelative(changeSet.BaseLocalPath));
                if (localpath.Length > 0 && localpath[0] == System.IO.Path.DirectorySeparatorChar)
                {
                    localpath = localpath.Substring(1);
                }
                if (localpath == "")
                {
                    localpath = ".";
                }                                                         // not sure if this happens

                store.AppendValues(statusicon, lstatus, localpath, true, info);
                selected.Add(info.LocalPath);
            }

            if (string.IsNullOrEmpty(changeSet.GlobalComment))
            {
                AuthorInformation   aInfo;
                CommitMessageFormat fmt = VersionControlService.GetCommitMessageFormat(changeSet, out aInfo);
                Message = changeSet.GenerateGlobalComment(fmt, aInfo);
            }
            else
            {
                Message = changeSet.GlobalComment;
            }

            textview.Buffer.Changed += OnTextChanged;

            // Focus the text view and move the insert point to the begining. Makes it easier to insert
            // a comment header.
            textview.Buffer.MoveMark(textview.Buffer.InsertMark, textview.Buffer.StartIter);
            textview.Buffer.MoveMark(textview.Buffer.SelectionBound, textview.Buffer.StartIter);
            textview.GrabFocus();
        }