Beispiel #1
0
        void PixbufDataFunc(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
        {
            var renderer = cell as CellRendererPixbuf;

            string stock;
            var    uri = folder_tree_model.GetUriByIter(iter);

            if (uri == null)
            {
                return;
            }
            var file = FileFactory.NewForUri(uri);

            try {
                var info = file.QueryInfo("standard::icon", FileQueryInfoFlags.None, null);

                if (info.Icon is ThemedIcon themed_icon && themed_icon.Names.Length > 0)
                {
                    stock = themed_icon.Names[0];
                }
                else
                {
                    stock = "gtk-directory";
                }
            } catch (Exception) {
Beispiel #2
0
        void PixbufDataFunc(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
        {
            var renderer = cell as CellRendererPixbuf;

            string stock;
            var    uri = folder_tree_model.GetUriByIter(iter);

            if (uri == null)
            {
                return;
            }
            File file = FileFactory.NewForUri(uri);

            try {
                FileInfo info =
                    file.QueryInfo("standard::icon", FileQueryInfoFlags.None, null);

                ThemedIcon themed_icon = info.Icon as ThemedIcon;
                if (themed_icon != null && themed_icon.Names.Length > 0)
                {
                    stock = themed_icon.Names[0];
                }
                else
                {
                    stock = "gtk-directory";
                }
            } catch (Exception) {
                stock = "gtk-directory";
            }

            TreeIter tmp;

            if (tree_model.IterParent(out tmp, iter))
            {
                renderer.IconName       = stock;
                renderer.CellBackground = null;
            }
            else
            {
                renderer.IconName          = stock;
                renderer.CellBackgroundGdk = Style.Background(StateType.Selected);
            }
        }