/*
* Copyright (C) 2006-2007 Eskil Bylund
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using Gtk;
using Mono.Unix;
using DCSharp.Backend.Objects;
namespace DCSharp.GUI{
public class UploadView : TransferView
{
public UploadView(TreeModel model) : base(model)
{
// Columns
TreeViewColumn column;
CellRendererText textRenderer;
// Started
textRenderer = new CellRendererText();
InsertColumn(0, Catalog.GetString("Started"), textRenderer,
"text", (int)UploadStore.Column.Started);
column = GetColumn(0);
column.SortColumnId = (int)UploadStore.Column.Started;
column.SetCellDataFunc(textRenderer, SetTextStyle);
// Directory
textRenderer = new CellRendererText();
textRenderer.Ellipsize = Pango.EllipsizeMode.Middle;
InsertColumn(2, Catalog.GetString("Directory"), textRenderer,
"text", (int)UploadStore.Column.Path);
column = GetColumn(2);
column.Expand = true;
column.Resizable = true;
column.SortColumnId = (int)TransferStoreColumn.Directory;
column.SetCellDataFunc(textRenderer, SetTextStyle);
// User
textRenderer = new CellRendererText();
InsertColumn(3, Catalog.GetString("User"), textRenderer,
"text", (int)UploadStore.Column.User);
column = GetColumn(3);
column.Resizable = true;
column.SortColumnId = (int)UploadStore.Column.User;
column.SetCellDataFunc(textRenderer, SetTextStyle);
}
#region Methods
public UploadFileInfo[] GetSelectedUploads(bool recurse)
{
return base.GetSelectedTransfers<UploadFileInfo>(recurse);
}
private void SetTextStyle(TreeViewColumn column, CellRenderer renderer,
TreeModel model, TreeIter iter)
{
object obj = model.GetValue(iter, (int)UploadStore.Column.Object);
SetTextStyle(column, (CellRendererText)renderer, model, iter, obj);
}
#endregion
}
}
|