Exemple #1
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.Days == 0)
            {
                day = GettextCatalog.GetString("Today");
            }
            else if (age.Days == 1)
            {
                day = GettextCatalog.GetString("Yesterday");
            }
            else
            {
                day = rev.Time.ToShortDateString();
            }
            string time = rev.Time.ToString("HH:MM");

            renderer.Text = day + " " + time;
        }
Exemple #2
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)
            {
                textRenderer.Text = "";
                return;
            }

            string tmpPath  = "";
            string fileName = "";

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

            SetText(textRenderer, model, iter, task, fileName);
        }
Exemple #3
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;
 
 }
Exemple #4
0
        static 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 (((ListStore)model).IterIsValid(iter))
                    {
                        model.EmitRowChanged(model.GetPath(iter), iter);
                    }
                };
            }
        }
        private void RenderCacheDistance(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Geocache cache = (Geocache)model.GetValue(iter, 0);

            if (cache == null)
            {
                return;
            }
            CellRendererText text = cell as CellRendererText;

            cell.CellBackground = null;
            if (m_app.AppConfig.ShowStaleCaches)
            {
                if ((DateTime.Now - cache.Updated) > (new TimeSpan(m_app.AppConfig.StaleCacheInterval, 0, 0, 0, 0)))
                {
                    cell.CellBackground = "gold";
                }
            }
            if (m_app.AppConfig.ShowNewCaches)
            {
                if ((DateTime.Now - cache.Time) <= (new TimeSpan(m_app.AppConfig.NewCacheInterval, 0, 0, 0, 0)))
                {
                    cell.CellBackground = "light green";
                }
            }
            try {
                double dist = cache.Distance;
                if (Config.ImperialUnits)
                {
                    dist = Utilities.KmToMiles(dist);
                }
                text.Text = dist.ToString("0.00");
            } catch (Exception e) {
                text.Text = "?";
                System.Console.WriteLine(e.Message);
            }
        }
        private void RenderTorrentDone(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            TorrentManager torrent = (TorrentManager)model.GetValue(iter, 0);

            if (torrent == null)
            {
                return;
            }
            if (torrent.State == TorrentState.Hashing)
            {
                (cell as Gtk.CellRendererProgress).Value = (int)torrentController.GetTorrentHashProgress(torrent);
            }
            else
            {
                if (torrent.Progress > int.MinValue && torrent.Progress < int.MaxValue)
                {
                    (cell as Gtk.CellRendererProgress).Value = (int)torrent.Progress;
                }
                else
                {
                    (cell as Gtk.CellRendererProgress).Value = 0;
                }
            }
        }
Exemple #7
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;

            // Grab today's day and the start of tomorrow's day to make Today/Yesterday calculations.
            var now = DateTime.Now;
            var age = new DateTime(now.Year, now.Month, now.Day).AddDays(1) - rev.Time;

            if (age.Days >= 0 && age.Days < 1)               // Check whether it's a commit that's less than a day away. Also discard future commits.
            {
                day = GettextCatalog.GetString("Today");
            }
            else if (age.Days < 2)                 // Check whether it's a commit from yesterday.
            {
                day = GettextCatalog.GetString("Yesterday");
            }
            else
            {
                day = rev.Time.ToShortDateString();
            }
            renderer.Text = string.Format("{0} {1:HH:mm}", day, rev.Time);
        }
        private void RenderTorrentRatio(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            TorrentManager torrent = (TorrentManager)model.GetValue(iter, 0);

            if (torrent == null)
            {
                return;
            }

            double totalDown;
            double totalUp;

            totalDown = torrentController.GetPreviousDownload(torrent) + torrent.Monitor.DataBytesDownloaded;
            totalUp   = torrentController.GetPreviousUpload(torrent) + torrent.Monitor.DataBytesUploaded;

            if (totalDown > 0 || ((totalDown / 1024f) > torrent.Torrent.Size))
            {
                (cell as Gtk.CellRendererText).Text = (totalUp / (double)totalDown).ToString("0.00");
            }
            else
            {
                (cell as Gtk.CellRendererText).Text = (totalUp / (torrent.Torrent.Size / 1024f)).ToString("0.00");
            }
        }
        private void RenderCondition(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            FilterList       list           = (FilterList)model.GetValue(iter, 0);
            CellRendererText condition_cell = cell as CellRendererText;

            StringBuilder builder = new StringBuilder();

            builder.Append("<u>Filter Condition</u>\n");
            RenderCacheTypes(list, builder);
            RenderCacheDiff(list, builder);
            RenderCacheTerr(list, builder);
            RenderContainer(list, builder);
            RenderDescription(list, builder);
            RenderPlacedBy(list, builder);
            RenderPlacedBefore(list, builder);
            RenderPlacedAfter(list, builder);
            RenderInfoBefore(list, builder);
            RenderInfoAfter(list, builder);
            RenderInfoWithin(list, builder);
            RenderInfoNotWithin(list, builder);
            RenderFoundAfter(list, builder);
            RenderFoundBefore(list, builder);
            RenderFoundOn(list, builder);
            RenderCountry(list, builder);
            RenderState(list, builder);
            RenderNotes(list, builder);
            RenderChildren(list, builder);
            RenderNoChildren(list, builder);
            RenderCorrected(list, builder);
            RenderNoCorrected(list, builder);
            RenderMustHaveAttributes(list, builder);
            RenderMustNotHaveAttributes(list, builder);
            RenderUserData(list, builder);
            RenderFTF(list, builder);
            RenderDNF(list, builder);
            RenderStatus(list, builder);
            RenderCacheSource(list, builder);
            if (list.Contains(FilterList.KEY_DIST))
            {
                builder.Append(Catalog.GetString("<b>Distance: </b>"));
                string op = list.GetCriteria(FilterList.KEY_DIST_OP) as string;
                if (op == "<=")
                {
                    builder.Append("Less than ");
                }
                else if (op == ">=")
                {
                    builder.Append("Greater than ");
                }
                else
                {
                    builder.Append("Equal to ");
                }
                builder.Append(((double)list.GetCriteria(FilterList.KEY_DIST)).ToString());
                if (m_Win.App.AppConfig.ImperialUnits)
                {
                    builder.Append(Catalog.GetString(" mi"));
                }
                else
                {
                    builder.Append(Catalog.GetString(" km"));
                }

                if (list.Contains(FilterList.KEY_DIST_LAT))
                {
                    double lat = (double)list.GetCriteria(FilterList.KEY_DIST_LAT);
                    double lon = (double)list.GetCriteria(FilterList.KEY_DIST_LON);
                    builder.Append(" From: ");
                    builder.Append(Utilities.getCoordString(lat, lon));
                }
                builder.Append("\n");
            }
            condition_cell.Markup = builder.ToString();
        }
        private void RenderStartTime(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Category tNode = (Category)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = tNode.Start.Seconds.ToString();
        }
        private void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Category tNode = (Category)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = tNode.Name;
        }
        private void RenderColor(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Category tNode = (Category)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).CellBackgroundGdk = Helpers.Misc.ToGdkColor(tNode.Color);
        }
        private void RenderPosition(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Player player = (Player)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = player.Position;
        }
        void HandleCellLayoutDataFunc(Gtk.CellLayout cell_layout, CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
        {
            string text = DomainHelper.GetTitle(tree_model.GetValue(iter, 0));

            (cell as CellRendererText).Text = text;
        }
Exemple #15
0
    private void RenderText(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
    {
        Task task = (Task)model.GetValue(iter, 0);

        (cell as Gtk.CellRendererText).Text = task.Name;
    }
Exemple #16
0
        private void RenderSize(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Piece blockEvent = (Piece)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = ByteConverter.ConvertSize(blockEvent[0].RequestLength * blockEvent.BlockCount);
        }
Exemple #17
0
        private void RenderBlock(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Piece blockEvent = (Piece)model.GetValue(iter, 0);

            (cell as CellRendererPiece).Piece = blockEvent;
        }
        private void RenderFilename(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            TorrentFile torrentFile = (TorrentFile)model.GetValue(iter, 1);

            (cell as Gtk.CellRendererText).Text = torrentFile.Path;
        }
        private void RenderWeight(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Player player = (Player)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = player.Weight.ToString();
        }
        private void RenderNumBlocks(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            BlockEventArgs blockEvent = (BlockEventArgs)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = blockEvent.Piece.BlockCount.ToString();
        }
        private void RenderSize(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            BlockEventArgs blockEvent = (BlockEventArgs)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = ByteConverter.Convert(blockEvent.Block.RequestLength / 1024);
        }
Exemple #22
0
    private void RenderSection(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
    {
        TexString sec = (TexString)model.GetValue(iter, 0);

        (cell as Gtk.CellRendererText).Text = sec.Text;
    }
Exemple #23
0
        private void RenderPriceColumn(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            double Price = (double)model.GetValue(iter, 3);

            (cell as Gtk.CellRendererSpin).Text = String.Format("{0:0.00}", Price);
        }
        private void RenderBirthday(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Player player = (Player)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = player.Birthday.ToShortDateString();
        }
Exemple #25
0
        private void RenderNumber(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Piece blockEvent = (Piece)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = blockEvent.Index.ToString();
        }
Exemple #26
0
        //serve per linkare le linee della treeview con la lista degli oggetti e visualizzare solo il nome nella treeview
        private void RenderItem(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Item item = (Item)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = item.ItemName;
        }
Exemple #27
0
    private void RenderDate(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
    {
        Task task = (Task)model.GetValue(iter, 0);

        (cell as Gtk.CellRendererText).Text = task.Date.ToString("g");
    }
Exemple #28
0
        //serve per linkare le linee della treeview con la lista degli oggetti e visualizzare solo il nome nella treeview
        private void RenderContainer(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Container container = (Container)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = container.ContainerName;
        }
Exemple #29
0
    private void RenderDurration(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
    {
        Task task = (Task)model.GetValue(iter, 0);

        (cell as Gtk.CellRendererText).Text = task.Duration.ToString("HH:mm:ss");
    }
Exemple #30
0
        //serve per linkare le linee della treeview con la lista degli oggetti e visualizzare solo il nome nella treeview
        private void RenderLocation(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Location location = (Location)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = location.LocationName;
        }