Ejemplo n.º 1
0
        void FolderDataFunc(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
        {
            CellRendererTextProgress renderer = cell as CellRendererTextProgress;

            int progress_value = 0;
            int count          = (tree_model as FolderTreeModel).Count;

            if (count != 0)
            {
                progress_value = (int)((100.0 * folder_tree_model.GetPhotoCountByIter(iter)) / count);
            }

            renderer.Value = progress_value;

            string text = folder_tree_model.GetFolderNameByIter(iter);

            TreeIter tmp;

            if (tree_model.IterParent(out tmp, iter))
            {
                renderer.UseMarkup      = false;
                renderer.Text           = text;
                renderer.CellBackground = null;
            }
            else
            {
                renderer.UseMarkup = true;

                /* since import do not use GIO at the moment, no other prefix than file:/// is
                 * possible.
                 */
                if (text == Uri.UriSchemeFile)
                {
                    renderer.Text = string.Format("<b>{0}</b>", Catalog.GetString("Filesystem"));
                }
                else
                {
                    renderer.Text = string.Format("<b>{0}</b>", text);
                }

                renderer.CellBackgroundGdk = Style.Background(StateType.Selected);
            }
        }
Ejemplo n.º 2
0
        public FolderTreeView(FolderTreeModel tree_model)
            : base(tree_model)
        {
            folder_tree_model = tree_model;

            HeadersVisible = false;

            TreeViewColumn column = new TreeViewColumn ();

            CellRendererPixbuf pixbuf_renderer = new CellRendererPixbuf ();
            column.PackStart (pixbuf_renderer, false);
            column.SetCellDataFunc (pixbuf_renderer, PixbufDataFunc as TreeCellDataFunc);

            CellRendererTextProgress folder_renderer = new CellRendererTextProgress ();
            column.PackStart (folder_renderer, true);
            column.SetCellDataFunc (folder_renderer, FolderDataFunc as TreeCellDataFunc);

            AppendColumn (column);

            Gtk.Drag.SourceSet (this, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask,
                    folder_tree_source_target_table, Gdk.DragAction.Copy | Gdk.DragAction.Move);
        }
Ejemplo n.º 3
0
        public FolderTreeView(FolderTreeModel tree_model) : base(tree_model)
        {
            folder_tree_model = tree_model;

            HeadersVisible = false;

            var column = new TreeViewColumn();

            var pixbuf_renderer = new CellRendererPixbuf();

            column.PackStart(pixbuf_renderer, false);
            column.SetCellDataFunc(pixbuf_renderer, PixbufDataFunc);

            var folder_renderer = new CellRendererTextProgress();

            column.PackStart(folder_renderer, true);
            column.SetCellDataFunc(folder_renderer, FolderDataFunc);

            AppendColumn(column);

            Drag.SourceSet(this, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask,
                           (TargetEntry[])folderTreeSourceTargetList, Gdk.DragAction.Copy | Gdk.DragAction.Move);
        }