Class: VimMate::Icons

Inherits:
Object
  • Object
show all
Includes:
NiceSingleton
Defined in:
lib/vimmatelib/icons.rb

Overview

Manages the icons that can be loaded from the disk

Constant Summary collapse

WINDOW_ICON_FILENAME =

The filenames for the icons of the windows

'vimmate%d.png'.freeze
WINDOW_ICON_SIZES =

The size for the icons of the windows

[16, 32, 48].freeze
ICONS_NAME =

Name of the icons to load. Will create methods named after the icon’s name, with _icon: folder_icon for example.

[:folder, :file].collect do |f|
  ["", :green, :orange, :red].collect do |c|
    if c.to_s.empty?
      f.to_sym
    else
      "#{f}_#{c}".to_sym
    end
  end
end.flatten.freeze

Instance Method Summary collapse

Methods included from NiceSingleton

included

Constructor Details

#initializeIcons

Create the Icons class. Cannot be called directly



50
51
52
# File 'lib/vimmatelib/icons.rb', line 50

def initialize
  @gtk_window_icons = []
end

Instance Method Details

#window_iconsObject

Get an array of icons for the windows



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vimmatelib/icons.rb', line 55

def window_icons
  # Load them
  load_window_icons
  @gtk_window_icons.freeze
  # Once loaded, we only need a reader
  self.class.send(:define_method, :window_icons) do
    @gtk_window_icons
  end
  # Return the value
  window_icons
end