Sha256: cb367498af2e6b10199dd77299e1a6f31e46f78830d34140436a5f55fba9de22

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module SSHTunnel
  module UI
    module Helpers
      module Common
        module TreeViewHelper

          def add_text_column(treeview, label, attributes)
            renderer = Gtk::CellRendererText.new
            add_column(treeview, renderer, label, attributes)
          end


          def add_image_column(treeview, label, attributes)
            renderer = Gtk::CellRendererPixbuf.new
            add_column(treeview, renderer, label, attributes)
          end


          def add_column(treeview, renderer, label, attributes)
            visible  = attributes.delete(:visible) { true }
            sortable = attributes.delete(:sortable) { true }

            column = Gtk::TreeViewColumn.new(label, renderer, attributes)
            column.visible = visible

            if sortable
              column.clickable = true
              column.sort_column_id = attributes[:text] if attributes[:text]
            end

            treeview.append_column(column)
          end

        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ssh-hull-2.0 lib/ssh-hull/ui/helpers/common/tree_view_helper.rb
ssh-hull-1.0.0 lib/ssh-hull/ui/helpers/common/tree_view_helper.rb