Ejemplo n.º 1
0
        public ItemIcons(Widget w)
        {
            // create a cache for item icons
            iconCache = new IconCache(w);

            bool useCustomMimeIcons = !string.IsNullOrEmpty(App.Settings.CustomThemeName);
            // create a cache for mime icons and add default and fallback icons
            // for platforms where mime icons are not implemented
            mimeIconCache = new MimeIconCache(w, useCustomMimeIcons, DEFAULT_ICON, new Dictionary<string, Icons.Icon>() {
                { "x-directory/normal", Icon.Stock_Directory }
            });
        }
Ejemplo n.º 2
0
        public ItemIcons(Widget w)
        {
            // create a cache for item icons
            iconCache = new IconCache(w);

            bool useCustomMimeIcons = !string.IsNullOrEmpty(App.Settings.CustomThemeName);

            // create a cache for mime icons and add default and fallback icons
            // for platforms where mime icons are not implemented
            mimeIconCache = new MimeIconCache(w, useCustomMimeIcons, DEFAULT_ICON, new Dictionary <string, Icons.Icon>()
            {
                { "x-directory/normal", Icon.Stock_Directory }
            });
        }
Ejemplo n.º 3
0
        public VolumeView()
        {
            iconCache = new IconCache(this);
            sortProperty = VolumeSortProperty.VolumeID;
            toggleColumn = false;

            //
            // init columns
            //
            TreeViewColumn col;

            col = new TreeViewColumn(string.Empty, new CellRendererPixbuf(), "pixbuf", 0);
            col.Expand = false;
            AppendColumn(col);

            col = new TreeViewColumn(string.Empty, new CellRendererText(), "markup", 1);
            col.Expand = true;
            AppendColumn(col);

            //
            // setup store
            //
            ListStore store = new Gtk.ListStore(typeof(Gdk.Pixbuf),
                                                typeof(string),
                                                /* Volume - not visible */
                                                typeof(Volume));

            // must be assignet before
            // assinging the sort func
            this.Model = store;

            Gtk.TreeIterCompareFunc sortfunc = delegate(TreeModel m, TreeIter a, TreeIter b) {
                Volume vol_a = GetVolume(a);
                Volume vol_b = GetVolume(b);

                if (vol_a == null || vol_b == null)
                    return 0;

                switch (sortProperty) {
                    case VolumeSortProperty.Added:
                        return Math.Sign(vol_a.Added.Subtract(vol_b.Added).Ticks);
                    case VolumeSortProperty.ArchiveNo:
                        return Sorting.NatCompare(vol_a.ArchiveNo, vol_b.ArchiveNo);
                    case VolumeSortProperty.Category:
                        return string.Compare(vol_a.Category, vol_b.Category);
                    case VolumeSortProperty.DriveType:
                        return Math.Sign(vol_a.DriveType - vol_b.DriveType);
                    case VolumeSortProperty.Title:
                        return string.Compare(vol_a.Title, vol_b.Title);
                    case VolumeSortProperty.VolumeID:
                        return Math.Sign(vol_a.VolumeID - vol_b.VolumeID);
                    default:
                        throw new ArgumentException("Invalid VolumeSortProperty");
                }

                return 0;
            };

            store.SetSortFunc(0, sortfunc);
            store.SetSortFunc(1, sortfunc);

            // set initial sorting
            /* Sort(sortProperty, true); */
        }