Ejemplo n.º 1
0
        void RenderPropertyName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            bool   selected     = (bool)store.GetValue(iter, colCheckedIndex);
            string propertyName = (string)store.GetValue(iter, colPropertyNameIndex);
            string error;

            CellRendererText cellRendererText = (CellRendererText)cell;

            if (!selected || IsValidPropertyName(propertyName, out error))
            {
                cellRendererText.Foreground = "black";
            }
            else
            {
                cellRendererText.Foreground = "red";
            }

            cellRendererText.Text = propertyName;
        }
Ejemplo n.º 2
0
        void GroupData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererPropertyGroup rc = (CellRendererPropertyGroup)cell;

            rc.IsGroup = (bool)model.GetValue(iter, 2);
            rc.Text    = (string)model.GetValue(iter, 0);

            PropertyDescriptor prop = (PropertyDescriptor)model.GetValue(iter, 1);

            if (prop != null)
            {
                InstanceData idata = (InstanceData)model.GetValue(iter, 3);
                rc.SensitiveProperty = prop.EnabledFor(idata.Instance) && prop.VisibleFor(idata.Instance);
            }
            else
            {
                rc.SensitiveProperty = true;
            }
        }
Ejemplo n.º 3
0
		void AuthorIconFunc (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
		{
			CellRendererPixbuf renderer = (CellRendererPixbuf)cell;
			var rev = (Revision)model.GetValue (iter, 0);
			if (string.IsNullOrEmpty (rev.Email))
				return;
			ImageLoader img = ImageService.GetUserIcon (rev.Email, 16);
			if (img.LoadOperation.IsCompleted)
				renderer.Pixbuf = img.Pixbuf;
			else {
				renderer.Pixbuf = null;
				img.LoadOperation.Completed += delegate {
					Gtk.Application.Invoke (delegate {
						if (logstore.IterIsValid (iter))
							model.EmitRowChanged (model.GetPath (iter), iter);
					});
				};
			}
		}
        void SetDiffCellData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            try {
                CellRendererDiff cellRendererDiff = (CellRendererDiff)cell;
                Change           change           = store.GetValue(iter, objColumn) as Change;
                cellRendererDiff.Visible = !(bool)store.GetValue(iter, statusVisibleColumn);
                if (change == null || !cellRendererDiff.Visible)
                {
                    cellRendererDiff.InitCell(treeviewPreview, false, "", "");
                    return;
                }
                TextReplaceChange replaceChange = change as TextReplaceChange;
                if (replaceChange == null)
                {
                    return;
                }

                Mono.TextEditor.Document doc = new Mono.TextEditor.Document();
                doc.Text = System.IO.File.ReadAllText(replaceChange.FileName);
                List <string> before = new List <string> ();
                foreach (var line in doc.Lines)
                {
                    before.Add(doc.GetTextAt(line.Offset, line.EditableLength));
                }

                ((Mono.TextEditor.IBuffer)doc).Replace(replaceChange.Offset, replaceChange.RemovedChars, replaceChange.InsertedText);

                List <string> after = new List <string> ();
                foreach (var line in doc.Lines)
                {
                    after.Add(doc.GetTextAt(line.Offset, line.EditableLength));
                }

                Diff diff = new Diff(before.ToArray(), after.ToArray(), true, true);

                System.IO.StringWriter w = new System.IO.StringWriter();
                UnifiedDiff.WriteUnifiedDiff(diff, w, replaceChange.FileName, replaceChange.FileName, 2);
                cellRendererDiff.InitCell(treeviewPreview, true, w.ToString().Trim(), replaceChange.FileName);
            } catch (Exception e) {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 5
0
        void SetDiffCellData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            try {
                CellRendererDiff cellRendererDiff = (CellRendererDiff)cell;
                Change           change           = store.GetValue(iter, objColumn) as Change;
                cellRendererDiff.Visible = !(bool)store.GetValue(iter, statusVisibleColumn);
                if (change == null || !cellRendererDiff.Visible)
                {
                    cellRendererDiff.InitCell(treeviewPreview, false, "", "");
                    return;
                }
                TextReplaceChange replaceChange = change as TextReplaceChange;
                if (replaceChange == null)
                {
                    return;
                }

                var openDocument     = IdeApp.Workbench.GetDocument(replaceChange.FileName);
                var originalDocument = TextEditorFactory.CreateNewDocument();
                originalDocument.FileName = replaceChange.FileName;
                if (openDocument == null)
                {
                    originalDocument.Text = TextFileUtility.ReadAllText(replaceChange.FileName);
                }
                else
                {
                    originalDocument.Text = openDocument.Editor.Text;
                }

                var changedDocument = TextEditorFactory.CreateNewDocument();
                changedDocument.FileName = replaceChange.FileName;
                changedDocument.Text     = originalDocument.Text;

                changedDocument.ReplaceText(replaceChange.Offset, replaceChange.RemovedChars, replaceChange.InsertedText);

                string diffString = originalDocument.GetDiffAsString(changedDocument);

                cellRendererDiff.InitCell(treeviewPreview, true, diffString, replaceChange.FileName);
            } catch (Exception e) {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 6
0
        int CompareNodes(Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
        {
            int      col, val = 0;
            SortType type;

            filestore.GetSortColumnId(out col, out type);

            switch (col)
            {
            case 0: val = ColStatus; break;

            case 1: val = ColCommit; break;

            case 2: val = ColPath; break;
            }
            object o1 = filestore.GetValue(a, val);
            object o2 = filestore.GetValue(b, val);

            if (o1 is string[])
            {
                o1 = ((string[])o1)[0];
            }
            if (o2 is string[])
            {
                o2 = ((string[])o2)[0];
            }

            if (o1 == null && o2 == null)
            {
                return(0);
            }
            else if (o1 == null)
            {
                return(1);
            }
            else if (o2 == null)
            {
                return(-1);
            }

            return(((IComparable)o1).CompareTo(o2));
        }
Ejemplo n.º 7
0
        void AuthorFunc(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererText renderer = (CellRendererText)cell;
            var    rev    = (Revision)model.GetValue(iter, 0);
            string author = rev.Author;
            int    idx    = author.IndexOf("<");

            if (idx >= 0 && idx < author.IndexOf(">"))
            {
                author = author.Substring(0, idx).Trim();
            }
            if (string.IsNullOrEmpty(currentFilter))
            {
                renderer.Text = author;
            }
            else
            {
                renderer.Markup = EscapeWithFilterMarker(author);
            }
        }
Ejemplo n.º 8
0
        void SetDiffCellData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            if (disposed)
            {
                return;
            }
            CellRendererDiff rc = (CellRendererDiff)cell;

            string[] lines = (string[])filestore.GetValue(iter, ColPath);
            TreePath path  = filestore.GetPath(iter);

            if (filestore.IterDepth(iter) == 0)
            {
                rc.InitCell(filelist, false, lines, path);
            }
            else
            {
                rc.InitCell(filelist, true, lines, path);
            }
        }
Ejemplo n.º 9
0
        private void RenderTypProject(CellLayout column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            string text  = (string)model.GetValue(iter, 0);
            string text2 = (string)model.GetValue(iter, 1);


            Pango.FontDescription fd = new Pango.FontDescription();

            (cell as Gtk.CellRendererText).FontDesc = fd;
            (cell as Gtk.CellRendererText).Markup   = "<b >" + text + "</b>" + Environment.NewLine + "<small>" + text2 + "</small>";

            /*string pathTemplates = (string) model.GetValue (iter, 3);
             * if(!string.IsNullOrEmpty(pathTemplates)){
             *      string[] templates =  System.IO.Directory.GetDirectories(pathTemplates);
             *      if(templates.Length<1)
             *              (cell as Gtk.CellRendererText).Sensitive = false;
             *      else
             *              (cell as Gtk.CellRendererText).Sensitive = true;
             * }*/
        }
Ejemplo n.º 10
0
        private bool FilterTree(Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            string PlayerName = model.GetValue(iter, 1).ToString();

            PlayerName = PlayerName.ToLower();

            if (txtFilter.Text == "")
            {
                return(true);
            }

            if (PlayerName.IndexOf(txtFilter.Text.ToLower()) > -1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 11
0
        void ResultLineDataFunc(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            if (TreeIter.Zero.Equals(iter))
            {
                return;
            }
            CellRendererText lineRenderer = (CellRendererText)cell;
            SearchResult     searchResult = (SearchResult)store.GetValue(iter, SearchResultColumn);

            if (searchResult == null)
            {
                return;
            }

            Mono.TextEditor.Document doc = GetDocument(searchResult);
            int  lineNr     = doc.OffsetToLineNumber(searchResult.Offset) + 1;
            bool didRead    = (bool)store.GetValue(iter, DidReadColumn);
            bool isSelected = treeviewSearchResults.Selection.IterIsSelected(iter);

            lineRenderer.Markup = MarkupText(lineNr.ToString(), didRead, isSelected);
        }
Ejemplo n.º 12
0
        private void StatusCellTextDataFunc(Gtk.TreeViewColumn tree_column,
                                            Gtk.CellRenderer cell, Gtk.TreeModel tree_model,
                                            Gtk.TreeIter iter)
        {
            string id     = (string)tree_model.GetValue(iter, 0);
            string status = GetEncryptionStatus(id);

            if (status == null)
            {
                status = Util.GS("Not encrypted");
            }
            else if (status == "BLWF")
            {
                status = Util.GS("Encrypted");
            }
            else
            {
                status = Util.GS("Not encrypted");
            }
            ((CellRendererText)cell).Text = status;
        }
Ejemplo n.º 13
0
        static void FileDataFunc(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Gtk.CellRendererText textRenderer = (Gtk.CellRendererText)cell;
            Task task = model.GetValue(iter, DataColumns.Task) as Task;

            if (task == null)
            {
                return;
            }

            string tmpPath = GetPath(task);
            string fileName;

            try {
                fileName = Path.GetFileName(tmpPath);
            } catch (Exception) {
                fileName = tmpPath;
            }

            SetText(textRenderer, model, iter, task, fileName);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Filter out tasks that don't fit within the group's date range
        /// </summary>
        protected virtual bool FilterTasks(Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            ITask task = model.GetValue(iter, 0) as ITask;

            if (task == null || task.State == TaskState.Deleted)
            {
                return(false);
            }

            // Do something special when task.DueDate == DateTime.MinValue since
            // these tasks should always be in the very last category.
            if (task.DueDate == DateTime.MinValue)
            {
                if (timeRangeEnd == DateTime.MaxValue)
                {
                    if (!ShowCompletedTask(task))
                    {
                        return(false);
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            if (task.DueDate < timeRangeStart || task.DueDate > timeRangeEnd)
            {
                return(false);
            }

            if (!ShowCompletedTask(task))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 15
0
        private bool FilterTree(Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            ProjectDescription project = (ProjectDescription)model.GetValue(iter, 0);

            if (project == null)
            {
                return(true);
            }

            if (filterEntry.Text == "")
            {
                return(true);
            }

            if (project.Title.IndexOf(filterEntry.Text) > -1)
            {
                return(true);
            }
            else if (project.Season.IndexOf(filterEntry.Text) > -1)
            {
                return(true);
            }
            else if (project.Competition.IndexOf(filterEntry.Text) > -1)
            {
                return(true);
            }
            else if (project.LocalName.IndexOf(filterEntry.Text) > -1)
            {
                return(true);
            }
            else if (project.VisitorName.IndexOf(filterEntry.Text) > -1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 16
0
        private void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            PlayListPlay tNode = (PlayListPlay)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = Catalog.GetString("Title") + ": " + tNode.Name + "\n" +
                                                  Catalog.GetString("Start") + ": " + tNode.Start.ToMSecondsString() + Catalog.GetString(" sec") + "\n" +
                                                  Catalog.GetString("Duration") + ": " + tNode.Duration.ToMSecondsString() + Catalog.GetString(" sec") + "\n" +
                                                  Catalog.GetString("Play Rate") + ": " + tNode.Rate.ToString();
            if (!tNode.Valid)
            {
                (cell as Gtk.CellRendererText).Foreground = "red";
                (cell as Gtk.CellRendererText).Text      += "\n" + Catalog.GetString("File not found") + ": " + tNode.MediaFile.FilePath;
            }
            else if (tNode == loadedPlay)
            {
                (cell as Gtk.CellRendererText).Foreground = "blue";
            }
            else
            {
                (cell as Gtk.CellRendererText).Foreground = "black";
            }
        }
Ejemplo n.º 17
0
        private bool FilterTree(Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            if (entryFilter.Text == "")
            {
                return(true);
            }

            string Str;

            for (int i = 0; i < Columns.Count; i++)
            {
                if (Columns[i].Search)
                {
                    Str = model.GetValue(iter, i).ToString();
                    if (Str.IndexOf(entryFilter.Text, StringComparison.CurrentCultureIgnoreCase) > -1)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
        void RenderTemplateName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CodeTemplate template = (CodeTemplate)templateStore.GetValue(iter, 0);

            if (template == null)
            {
                templateCellRenderer.Markup = (string)templateStore.GetValue(iter, 2);
                return;
            }

            if (treeviewCodeTemplates.Selection.IterIsSelected(iter))
            {
                templateCellRenderer.Markup = GLib.Markup.EscapeText(template.Shortcut) + " (" +
                                              GLib.Markup.EscapeText(GettextCatalog.GetString(template.Description)) + ")";
            }
            else
            {
                templateCellRenderer.Markup = GLib.Markup.EscapeText(template.Shortcut) + " <span foreground=\"" +
                                              GetColorString(Style.Text(StateType.Insensitive)) + "\">("
                                              + GLib.Markup.EscapeText(GettextCatalog.GetString(template.Description)) + ")</span>";
            }
        }
Ejemplo n.º 19
0
        private void UserCellTextDataFunc(Gtk.TreeViewColumn tree_column,
                                          Gtk.CellRenderer cell, Gtk.TreeModel tree_model,
                                          Gtk.TreeIter iter)
        {
            MemberInfo member = (MemberInfo)tree_model.GetValue(iter, 0);

            if ((member.FullName != null) && (member.FullName.Length > 0))
            {
                if (memberListModel.IsDuplicateFullName(member.FullName))
                {
                    ((CellRendererText)cell).Text = string.Format("{0} ({1})", member.FullName, member.Name);
                }
                else
                {
                    ((CellRendererText)cell).Text = member.FullName;
                }
            }
            else
            {
                ((CellRendererText)cell).Text = member.Name;
            }
        }
Ejemplo n.º 20
0
        private void RenderType(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CacheLog           log  = (CacheLog)model.GetValue(iter, 0);
            CellRendererPixbuf icon = cell as CellRendererPixbuf;

            if (log.LogStatus == "Found it")
            {
                icon.Pixbuf = IconManager.FOUNDICON_S;
            }
            else if (log.LogStatus == "Didn't find it")
            {
                icon.Pixbuf = IconManager.DNF_S;
            }
            else if (log.LogStatus == "Needs Maintenance")
            {
                icon.Pixbuf = IconManager.NEEDS_MAINT_S;
            }
            else
            {
                icon.Pixbuf = IconManager.WRITENOTE_S;
            }
        }
Ejemplo n.º 21
0
        private void UserCellTextDataFunc(Gtk.TreeViewColumn tree_column,
                                          Gtk.CellRenderer cell, Gtk.TreeModel tree_model,
                                          Gtk.TreeIter iter)
        {
            iFolderUser user = (iFolderUser)tree_model.GetValue(iter, 0);

            if ((user.FN != null) && (user.FN.Length > 0))
            {
                if (duplicateMembers.Contains(user.FN))
                {
                    ((CellRendererText)cell).Text = string.Format("{0} ({1})", user.FN, user.Name);
                }
                else
                {
                    ((CellRendererText)cell).Text = user.FN;
                }
            }
            else
            {
                ((CellRendererText)cell).Text = user.Name;
            }
        }
Ejemplo n.º 22
0
        private bool FilterTree(Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            object fileObj = model.GetValue(iter, PATH_ROW);

            if (fileObj != null)
            {
                string filePath      = fileObj.ToString();
                string fileExtension = System.IO.Path.GetExtension(filePath);

                if (activetFilter == null)
                {
                    return(true);
                }
                else
                {
                    FileAttributes fa = File.GetAttributes(filePath);
                    if ((fa & FileAttributes.Directory) == FileAttributes.Directory)
                    {
                        return(true);
                    }

                    if (fileExtension.ToLower() == ".app")
                    {
                        return(true);
                    }

                    int indx = activetFilter.Mask.FindIndex(x => x.ToLower() == fileExtension.ToLower());
                    if (indx > -1)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 23
0
        private void TaskTimerCellDataFunc(Gtk.TreeViewColumn treeColumn,
                                           Gtk.CellRenderer renderer, Gtk.TreeModel model,
                                           Gtk.TreeIter iter)
        {
            Gtk.CellRendererPixbuf crp = renderer as Gtk.CellRendererPixbuf;
            ITask task = model.GetValue(iter, 0) as ITask;

            if (task == null)
            {
                return;
            }

            if (task.State != TaskState.Inactive)
            {
                // The task is not in the inactive state so don't show any icon
                crp.Pixbuf = null;
                return;
            }

            Preferences prefs        = Application.Preferences;
            int         timerSeconds = prefs.GetInt(Preferences.InactivateTimeoutKey);
            // convert to milliseconds for more granularity
            long timeout = timerSeconds * 1000;

            //Logger.Debug ("TaskTimerCellDataFunc ()\n\tNow.Ticks: {0}\n\tCompletionDate.Ticks: {1}",
            //				DateTime.Now.Ticks, task.CompletionDate.Ticks);
            long elapsedTicks = DateTime.Now.Ticks - task.CompletionDate.Ticks;
            //Logger.Debug ("\tElapsed Ticks: {0}", elapsedTicks);
            long elapsedMillis = elapsedTicks / 10000;
            //Logger.Debug ("\tElapsed Milliseconds: {0}", elapsedMillis);

            double percentComplete = (double)elapsedMillis / (double)timeout;

            //Logger.Debug ("\tPercent Complete: {0}", percentComplete);

            Gdk.Pixbuf pixbuf = GetIconForPercentage(percentComplete * 100);
            crp.Pixbuf = pixbuf;
        }
Ejemplo n.º 24
0
        void RenderTemplateName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CodeTemplate template = (CodeTemplate)model.GetValue(iter, 0);
            var          crt      = (CellRendererText)cell;

            if (template == null)
            {
                crt.Markup = (string)model.GetValue(iter, 2);
                return;
            }

            if (((TreeView)column.TreeView).Selection.IterIsSelected(iter))
            {
                crt.Markup = GLib.Markup.EscapeText(template.Shortcut) + " (" +
                             GLib.Markup.EscapeText(GettextCatalog.GetString(template.Description)) + ")";
            }
            else
            {
                crt.Markup = GLib.Markup.EscapeText(template.Shortcut) + " <span foreground=\"" +
                             Styles.SecondaryTextColorHexString + "\">("
                             + GLib.Markup.EscapeText(GettextCatalog.GetString(template.Description)) + ")</span>";
            }
        }
Ejemplo n.º 25
0
 protected void BtnOk_Click(object sender, EventArgs e)
 {
     Gtk.TreeModel model = nodeView.Model;
     Gtk.TreeIter  iter;
     if (model.GetIterFirst(out iter))
     {
         do
         {
             if ((bool)nodeView.Model.GetValue(iter, 0))
             {
                 ResourceLocation rl = new ResourceLocation();
                 rl.URL = nodeView.Model.GetValue(iter, 1).ToString();
                 Downloader download = DownloadManager.Instance.Add(
                     rl,
                     new ResourceLocation[0],
                     System.IO.Path.Combine(MonoDM.Core.Settings.Default.DownloadFolder, PathHelper.GetFileNameFromUrl(rl.URL)),
                     MonoDM.Core.Settings.Default.MaxSegments,
                     cbStartNow.Active);
             }
         } while (model.IterNext(ref iter));
     }
     Destroy();
 }
Ejemplo n.º 26
0
        static void DateFunc(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererText renderer = (CellRendererText)cell;
            var    rev = (Revision)model.GetValue(iter, 0);
            string day;
            var    age = rev.Time - DateTime.Now;

            if (age.TotalDays == 0)
            {
                day = GettextCatalog.GetString("Today");
            }
            else if (age.TotalDays == 1)
            {
                day = GettextCatalog.GetString("Yesterday");
            }
            else
            {
                day = rev.Time.ToShortDateString();
            }
            string time = rev.Time.ToString("HH:MM");

            renderer.Text = day + " " + time;
        }
Ejemplo n.º 27
0
        void PropertyData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererProperty rc = (CellRendererProperty)cell;
            bool group = (bool)model.GetValue(iter, 2);

            if (group)
            {
                rc.SetData(null, null, null);
            }
            else
            {
                PropertyDescriptor prop     = (PropertyDescriptor)model.GetValue(iter, 1);
                PropertyEditorCell propCell = editorManager.GetEditor(prop);

                // HERZUM SPRINT 5.0: TLAB-238 TLAB-243
                propCell.DataRoot = DataRoot;
                // END HERZUM SPRINT 5.0: TLAB-238 TLAB-243

                InstanceData idata = (InstanceData)model.GetValue(iter, 3);
                propCell.Initialize(tree, editorManager, prop, idata.Instance);
                rc.SetData(idata.Instance, prop, propCell);
            }
        }
Ejemplo n.º 28
0
        void AuthorIconFunc(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererImage renderer = (CellRendererImage)cell;
            var rev = (Revision)model.GetValue(iter, 0);

            if (string.IsNullOrEmpty(rev.Email))
            {
                return;
            }
            ImageLoader img = ImageService.GetUserIcon(rev.Email, 16);

            renderer.Image = img.Image;
            if (img.Downloading)
            {
                img.Completed += (sender, e) => {
                    renderer.Image = img.Image;
                    if (logstore.IterIsValid(iter))
                    {
                        model.EmitRowChanged(model.GetPath(iter), iter);
                    }
                };
            }
        }
Ejemplo n.º 29
0
 private bool FilterTree (Gtk.TreeModel model, Gtk.TreeIter iter)
 
 {
 
     string contactname = model.GetValue (iter, 0).ToString ();
 
 
 
     if (filterEntry.Text == "")
 
         return true;
 
 
 
     if (contactname.IndexOf (filterEntry.Text) > -1)
 
         return true;
 
     else
 
         return false;
 
 }
Ejemplo n.º 30
0
        // Find the height position within the tree
        public int GetIterPos(Gtk.TreeIter iter)
        {
            Gtk.TreePath  path = treeView.Model.GetPath(iter);
            Gdk.Rectangle rect =
                treeView.GetBackgroundArea(path, treeView.GetColumn(0));
            int height = rect.Height;

            int pos = 0;

            Gtk.TreeIter  tempIter;
            Gtk.TreeModel model = treeView.Model;
            ITask         task  = model.GetValue(iter, 0) as ITask;

            if (!model.GetIterFirst(out tempIter))
            {
                return(0);
            }

            // This is ugly, but figure out what position the specified iter is
            // at so we can return a value accordingly.
            do
            {
                ITask tempTask = model.GetValue(tempIter, 0) as ITask;
                if (tempTask == task)
                {
                    break;
                }

                pos++;
            } while (model.IterNext(ref tempIter));

//Logger.Debug ("pos: {0}", pos);
//Logger.Debug ("height: {0}", height);
//Logger.Debug ("returning: {0}", pos * height + header.Requisition.Height + 10);
            // + 10 is for the spacing added on when packing the header
            return(pos * height + header.Requisition.Height);
        }