예제 #1
0
파일: ItemIcons.cs 프로젝트: pulb/basenji
        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 }
            });
        }
예제 #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 }
            });
        }
예제 #3
0
파일: VolumeView.cs 프로젝트: pulb/basenji
        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); */
        }