niklas-vimmate 0.8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.autotest +10 -0
- data/CHANGELOG +108 -0
- data/COPYING +20 -0
- data/README +221 -0
- data/Rakefile +97 -0
- data/TODO +21 -0
- data/bin/vimmate +95 -0
- data/config/environment.rb +33 -0
- data/controllers/file_filter_controller.rb +85 -0
- data/controllers/file_popup_menu_controller.rb +40 -0
- data/controllers/vim_controller.rb +28 -0
- data/controllers/vim_mate_controller.rb +76 -0
- data/images/file.png +0 -0
- data/images/file_green.png +0 -0
- data/images/file_orange.png +0 -0
- data/images/file_red.png +0 -0
- data/images/folder.png +0 -0
- data/images/folder_green.png +0 -0
- data/images/folder_orange.png +0 -0
- data/images/folder_red.png +0 -0
- data/images/processing.png +0 -0
- data/images/svn_added.png +0 -0
- data/images/svn_conflict.png +0 -0
- data/images/svn_deleted.png +0 -0
- data/images/svn_locked.png +0 -0
- data/images/svn_modified.png +0 -0
- data/images/svn_normal.png +0 -0
- data/images/svn_readonly.png +0 -0
- data/images/vimmate16.png +0 -0
- data/images/vimmate32.png +0 -0
- data/images/vimmate48.png +0 -0
- data/lib/active_window.rb +8 -0
- data/lib/active_window/active_column.rb +218 -0
- data/lib/active_window/active_tree_store.rb +13 -0
- data/lib/active_window/active_tree_store/columns.rb +88 -0
- data/lib/active_window/active_tree_store/extentions.rb +81 -0
- data/lib/active_window/active_tree_store/index.rb +53 -0
- data/lib/active_window/application.rb +133 -0
- data/lib/active_window/controller.rb +58 -0
- data/lib/active_window/dot_file.rb +29 -0
- data/lib/active_window/filtered_active_tree_store.rb +114 -0
- data/lib/active_window/listed_item.rb +127 -0
- data/lib/active_window/signal.rb +46 -0
- data/lib/config_window.rb +90 -0
- data/lib/file_tree_store.rb +73 -0
- data/lib/filtered_file_tree_store.rb +34 -0
- data/lib/gtk_thread_helper.rb +73 -0
- data/lib/listed_directory.rb +43 -0
- data/lib/listed_file.rb +67 -0
- data/lib/try.rb +9 -0
- data/lib/vim/buffers.rb +18 -0
- data/lib/vim/integration.rb +36 -0
- data/lib/vim/netbeans.rb +156 -0
- data/lib/vim/source.vim +18 -0
- data/lib/vim_mate/config.rb +132 -0
- data/lib/vim_mate/dummy_window.rb +14 -0
- data/lib/vim_mate/files_menu.rb +110 -0
- data/lib/vim_mate/icons.rb +156 -0
- data/lib/vim_mate/nice_singleton.rb +53 -0
- data/lib/vim_mate/plugins.rb +6 -0
- data/lib/vim_mate/plugins/inotify/init.rb +4 -0
- data/lib/vim_mate/plugins/inotify/lib/INotify.rb +206 -0
- data/lib/vim_mate/plugins/inotify/lib/directory.rb +58 -0
- data/lib/vim_mate/plugins/subversion/init.rb +7 -0
- data/lib/vim_mate/plugins/subversion/lib/file.rb +59 -0
- data/lib/vim_mate/plugins/subversion/lib/menu.rb +96 -0
- data/lib/vim_mate/plugins/subversion/lib/subversion.rb +157 -0
- data/lib/vim_mate/requirer.rb +68 -0
- data/lib/vim_mate/search_window.rb +227 -0
- data/lib/vim_mate/tags_window.rb +167 -0
- data/lib/vim_mate/terminals_window.rb +163 -0
- data/lib/vim_mate/version.rb +29 -0
- data/lib/vim_mate/vim_widget.rb +150 -0
- data/spec/active_window/active_column_spec.rb +41 -0
- data/spec/active_window/active_tree_store_spec.rb +312 -0
- data/spec/active_window/controller_spec.rb +6 -0
- data/spec/lib/file_tree_store_spec.rb +40 -0
- data/spec/lib/listed_directory_spec.rb +26 -0
- data/spec/lib/listed_file_spec.rb +53 -0
- data/spec/nice_singleton_spec.rb +23 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +10 -0
- data/views/vim_mate.glade +308 -0
- data/vimmate.gemspec +131 -0
- metadata +168 -0
data/lib/vim/source.vim
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
function! GetOpenBufferPaths()
|
2
|
+
let tablist = []
|
3
|
+
let pathlist = []
|
4
|
+
let cwd = getcwd()
|
5
|
+
for i in range(tabpagenr('$'))
|
6
|
+
call extend(tablist, tabpagebuflist(i + 1))
|
7
|
+
endfor
|
8
|
+
for i in tablist
|
9
|
+
let bufn = bufname(i)
|
10
|
+
if (bufn =~ '^/')==0
|
11
|
+
call add(pathlist, cwd . '/' . bufn)
|
12
|
+
else
|
13
|
+
call add(pathlist, bufn)
|
14
|
+
end
|
15
|
+
endfor
|
16
|
+
call filter(pathlist, "v:val != cwd.'/'" )
|
17
|
+
return pathlist
|
18
|
+
endfunction
|
@@ -0,0 +1,132 @@
|
|
1
|
+
=begin
|
2
|
+
= VimMate: Vim graphical add-on
|
3
|
+
Copyright (c) 2006 Guillaume Benny
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
10
|
+
so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'yaml'
|
25
|
+
|
26
|
+
module VimMate
|
27
|
+
|
28
|
+
# Holds the configurations for VimMate. Also read and write this
|
29
|
+
# configuration so the user can change it.
|
30
|
+
class Config
|
31
|
+
include NiceSingleton
|
32
|
+
|
33
|
+
BASE_FILENAME = '.vimmaterc'
|
34
|
+
DEFAULT_CONFIG = {
|
35
|
+
:window_title => 'VimMate',
|
36
|
+
:window_width => 950,
|
37
|
+
:window_height => 600,
|
38
|
+
:layout_big_terminals => false,
|
39
|
+
:files_opened_width => 250,
|
40
|
+
:files_closed_width => 25,
|
41
|
+
:files_expanded => true,
|
42
|
+
:file_headers_visible => false,
|
43
|
+
:file_hover_selection => false,
|
44
|
+
:file_directory_separator => true,
|
45
|
+
:files_filter_active => true,
|
46
|
+
:files_auto_expand_on_filter => false,
|
47
|
+
:files_refresh_interval => 10,
|
48
|
+
:files_default_open_in_tabs => true,
|
49
|
+
:files_use_ellipsis => true,
|
50
|
+
:files_use_search => true,
|
51
|
+
:files_search_ignore_case => true,
|
52
|
+
:files_search_separator_position => 400,
|
53
|
+
:files_warn_too_many_files => 300,
|
54
|
+
:files_warn_too_many_files_each_step => true,
|
55
|
+
:files_show_status => true,
|
56
|
+
:tags_refresh_interval => 5,
|
57
|
+
:terminals_enabled => true,
|
58
|
+
:terminals_height => 50,
|
59
|
+
:terminals_font => "10",
|
60
|
+
:terminals_foreground_color => "#000000",
|
61
|
+
:terminals_background_color => "#FFFFDD",
|
62
|
+
:terminals_audible_bell => false,
|
63
|
+
:terminals_visible_bell => false,
|
64
|
+
:terminals_autoexec => "",
|
65
|
+
:terminals_login_shell => false,
|
66
|
+
:subversion_enabled => true,
|
67
|
+
}.freeze
|
68
|
+
|
69
|
+
# Create the Config class. Cannot be called directly
|
70
|
+
def initialize
|
71
|
+
# Set the full path to the configuration file. In the user's
|
72
|
+
# HOME or the current directory
|
73
|
+
if ENV['HOME']
|
74
|
+
self.class.const_set(:FILENAME, File.join(ENV['HOME'], BASE_FILENAME))
|
75
|
+
else
|
76
|
+
self.class.const_set(:FILENAME, BASE_FILENAME)
|
77
|
+
end
|
78
|
+
@config = DEFAULT_CONFIG.dup
|
79
|
+
end
|
80
|
+
|
81
|
+
# Access the configuration hash
|
82
|
+
def config
|
83
|
+
read_config
|
84
|
+
#@config.freeze
|
85
|
+
# Once read, we only need a simple reader
|
86
|
+
self.class.send(:attr_reader, :config)
|
87
|
+
config
|
88
|
+
end
|
89
|
+
|
90
|
+
# Easy access to the configuration hash
|
91
|
+
def [](symbol)
|
92
|
+
config[symbol.to_sym]
|
93
|
+
end
|
94
|
+
|
95
|
+
# Get the lib path
|
96
|
+
def lib_path
|
97
|
+
File.dirname(File.expand_path(__FILE__))
|
98
|
+
end
|
99
|
+
|
100
|
+
def images_path
|
101
|
+
File.expand_path(File.dirname(__FILE__) + '/../../images')
|
102
|
+
end
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
# Read the configuration file
|
107
|
+
def read_config
|
108
|
+
# Write the default if it doesn't exist
|
109
|
+
unless File.exist? FILENAME
|
110
|
+
write_config
|
111
|
+
return
|
112
|
+
end
|
113
|
+
# Read the configuration file and merge it with the default
|
114
|
+
# so if the user doesn't specify an option, it's set to the default
|
115
|
+
@config.merge!(YAML.load_file(FILENAME))
|
116
|
+
write_config
|
117
|
+
rescue StandardError => e
|
118
|
+
$stderr.puts e.to_s
|
119
|
+
$stderr.puts "Problem reading config file #{FILENAME}, using default"
|
120
|
+
end
|
121
|
+
|
122
|
+
# Write the configuration file
|
123
|
+
def write_config
|
124
|
+
File.open(FILENAME, 'w') do |file|
|
125
|
+
YAML.dump(@config, file)
|
126
|
+
end
|
127
|
+
rescue StandardError => e
|
128
|
+
$stderr.puts e.to_s
|
129
|
+
$stderr.puts "Problem writing config file #{FILENAME}"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
=begin
|
2
|
+
= VimMate: Vim graphical add-on
|
3
|
+
Copyright (c) 2006 Guillaume Benny
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
10
|
+
so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'fileutils'
|
25
|
+
require 'set'
|
26
|
+
module VimMate
|
27
|
+
|
28
|
+
# The pop-up menu used in the file tree
|
29
|
+
class FilesMenu
|
30
|
+
|
31
|
+
# Open a dialog to enter a new folder name to create
|
32
|
+
def menu_new_folder
|
33
|
+
dialog = Gtk::FileChooserDialog.new("New folder",
|
34
|
+
@parent_window.gtk_window,
|
35
|
+
Gtk::FileChooser::ACTION_CREATE_FOLDER,
|
36
|
+
nil,
|
37
|
+
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
|
38
|
+
[Gtk::Stock::SAVE, Gtk::Dialog::RESPONSE_ACCEPT])
|
39
|
+
dialog.set_icon_list(Icons.window_icons)
|
40
|
+
dialog.current_folder = if File.directory? @last_path
|
41
|
+
@last_path
|
42
|
+
else
|
43
|
+
File.dirname(@last_path)
|
44
|
+
end
|
45
|
+
dialog.run
|
46
|
+
dialog.destroy
|
47
|
+
menu_refresh
|
48
|
+
end
|
49
|
+
|
50
|
+
# Open a dialog to enter a new name for a file or directory
|
51
|
+
def menu_rename
|
52
|
+
dialog = Gtk::FileChooserDialog.new("Rename #{File.basename(@last_path)}",
|
53
|
+
@parent_window.gtk_window,
|
54
|
+
Gtk::FileChooser::ACTION_SAVE,
|
55
|
+
nil,
|
56
|
+
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
|
57
|
+
[Gtk::Stock::SAVE, Gtk::Dialog::RESPONSE_ACCEPT])
|
58
|
+
dialog.set_icon_list(Icons.window_icons)
|
59
|
+
dialog.current_folder = File.dirname(@last_path)
|
60
|
+
if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
|
61
|
+
begin
|
62
|
+
File.rename(@last_path, dialog.filename)
|
63
|
+
rescue SystemCallError
|
64
|
+
$stderr.puts "Cannot rename from #{@last_path} to #{dialog.filename}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
dialog.destroy
|
68
|
+
menu_refresh
|
69
|
+
end
|
70
|
+
|
71
|
+
# Open a dialog and ask the user if he really wants to delete the target
|
72
|
+
# file or directory. Note that for safety, directories can only be removed
|
73
|
+
# if they are empty.
|
74
|
+
def menu_delete
|
75
|
+
name = File.basename(@last_path)
|
76
|
+
dialog = Gtk::MessageDialog.new(@parent_window.gtk_window,
|
77
|
+
Gtk::MessageDialog::Flags::MODAL,
|
78
|
+
Gtk::MessageDialog::Type::QUESTION,
|
79
|
+
Gtk::MessageDialog::ButtonsType::YES_NO,
|
80
|
+
if File.directory? @last_path
|
81
|
+
"Delete directory #{name} ?"
|
82
|
+
else
|
83
|
+
"Delete file #{name} ?"
|
84
|
+
end)
|
85
|
+
dialog.set_icon_list(Icons.window_icons)
|
86
|
+
if dialog.run == Gtk::Dialog::RESPONSE_YES
|
87
|
+
begin
|
88
|
+
if File.directory? @last_path
|
89
|
+
FileUtils.rmdir(@last_path)
|
90
|
+
else
|
91
|
+
FileUtils.rm(@last_path)
|
92
|
+
end
|
93
|
+
rescue
|
94
|
+
$stderr.puts "Cannot remove #{@last_path}"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
dialog.destroy
|
98
|
+
menu_refresh
|
99
|
+
end
|
100
|
+
|
101
|
+
# Signals that the file tree must be refreshed
|
102
|
+
def menu_refresh
|
103
|
+
@refresh_signals.each do |signal|
|
104
|
+
signal.call
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
@@ -0,0 +1,156 @@
|
|
1
|
+
=begin
|
2
|
+
= VimMate: Vim graphical add-on
|
3
|
+
Copyright (c) 2006 Guillaume Benny
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
10
|
+
so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
=end
|
23
|
+
|
24
|
+
module VimMate
|
25
|
+
|
26
|
+
# Manages the icons that can be loaded from the disk
|
27
|
+
class Icons
|
28
|
+
include NiceSingleton
|
29
|
+
|
30
|
+
# The filenames for the icons of the windows
|
31
|
+
WINDOW_ICON_FILENAME = 'vimmate%d.png'.freeze
|
32
|
+
# The size for the icons of the windows
|
33
|
+
WINDOW_ICON_SIZES = [16, 32, 48].freeze
|
34
|
+
|
35
|
+
Overlays = %w(scm progress type)
|
36
|
+
|
37
|
+
# Create the Icons class. Cannot be called directly
|
38
|
+
def initialize
|
39
|
+
@gtk_window_icons = []
|
40
|
+
end
|
41
|
+
|
42
|
+
# Get an array of icons for the windows
|
43
|
+
def window_icons
|
44
|
+
# Load them
|
45
|
+
load_window_icons
|
46
|
+
@gtk_window_icons.freeze
|
47
|
+
# Once loaded, we only need a reader
|
48
|
+
self.class.send(:define_method, :window_icons) do
|
49
|
+
@gtk_window_icons
|
50
|
+
end
|
51
|
+
# Return the value
|
52
|
+
window_icons
|
53
|
+
end
|
54
|
+
|
55
|
+
def method_missing(meth, *args, &block)
|
56
|
+
if meth.to_s =~ /_overlayed_with_/
|
57
|
+
overlay_icon(meth, *args)
|
58
|
+
elsif meth.to_s =~ /_icon$/
|
59
|
+
build_icon(meth)
|
60
|
+
else
|
61
|
+
raise NoMethodError, "method not found: #{meth}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def free_position
|
66
|
+
@free_overlays ||= Overlays.dup
|
67
|
+
@free_overlays.pop
|
68
|
+
end
|
69
|
+
|
70
|
+
def by_name(icon_name)
|
71
|
+
send (icon_name =~ /_icon$/) ? icon_name : "#{icon_name}_icon"
|
72
|
+
end
|
73
|
+
private
|
74
|
+
|
75
|
+
# Auto-define a method with _icon for each icon's name
|
76
|
+
def build_icon(meth)
|
77
|
+
if meth.to_s =~ /^(.*)_icon$/
|
78
|
+
name = $1
|
79
|
+
path = File.join(Config.images_path, "#{name}.png")
|
80
|
+
if File.exists? path
|
81
|
+
begin
|
82
|
+
icon = Gdk::Pixbuf.new(path)
|
83
|
+
icon.freeze
|
84
|
+
# Once loaded, we only need a reader
|
85
|
+
self.class.send(:define_method, meth) do
|
86
|
+
icon
|
87
|
+
end
|
88
|
+
return icon
|
89
|
+
rescue StandardError => e
|
90
|
+
$stderr.puts e.to_s
|
91
|
+
$stderr.puts "Problem loading #{name} icon #{path}"
|
92
|
+
raise e
|
93
|
+
end
|
94
|
+
else
|
95
|
+
raise "Icon not found: #{path}"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def overlay_with(original_name,overlay_name=nil,position='south')
|
101
|
+
if overlay_name.nil?
|
102
|
+
original_name
|
103
|
+
else
|
104
|
+
"#{original_name}_#{position}_overlayed_with_#{overlay_name}"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def overlay_icon(meth)
|
109
|
+
if meth.to_s =~ /^(.*)_(#{Overlays.join('|')})_overlayed_with_(.*)$/
|
110
|
+
original = $1
|
111
|
+
original_icon = by_name original
|
112
|
+
where = $2
|
113
|
+
overlay = $3
|
114
|
+
overlay_icon = by_name overlay
|
115
|
+
case where
|
116
|
+
when 'progress'
|
117
|
+
x = y = 1
|
118
|
+
when 'tr'
|
119
|
+
x = 7; y = 1
|
120
|
+
when 'scm'
|
121
|
+
x = 1; y = 7
|
122
|
+
when 'br'
|
123
|
+
x = y = 7
|
124
|
+
end
|
125
|
+
overlayed = original_icon.dup
|
126
|
+
overlayed.composite!(
|
127
|
+
overlay_icon,
|
128
|
+
x, y, # start region to render
|
129
|
+
8, 8, # width / height
|
130
|
+
x, y, # offset
|
131
|
+
0.5, 0.5, # scale
|
132
|
+
Gdk::Pixbuf::INTERP_BILINEAR, # interpolation
|
133
|
+
255 # alpha
|
134
|
+
)
|
135
|
+
self.class.send(:define_method, meth) do
|
136
|
+
overlayed
|
137
|
+
end
|
138
|
+
return overlayed
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# Load the icons for the windows
|
143
|
+
def load_window_icons
|
144
|
+
WINDOW_ICON_SIZES.each do |size|
|
145
|
+
file = File.join(Config.lib_path, WINDOW_ICON_FILENAME % [size])
|
146
|
+
begin
|
147
|
+
@gtk_window_icons << Gdk::Pixbuf.new(file) if File.exist? file
|
148
|
+
rescue StandardError => e
|
149
|
+
$stderr.puts e.to_s
|
150
|
+
$stderr.puts "Problem loading window icon #{file}"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
=begin
|
2
|
+
= VimMate: Vim graphical add-on
|
3
|
+
Copyright (c) 2006 Guillaume Benny
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
10
|
+
so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'singleton'
|
25
|
+
|
26
|
+
module VimMate
|
27
|
+
|
28
|
+
# A nicer singleton implementation. When a class mixes this module,
|
29
|
+
# it becomes a singleton and you don't have to use 'instance' to
|
30
|
+
# access the singleton's class method. For example:
|
31
|
+
# class Hello
|
32
|
+
# include VimMate::NiceSingleton
|
33
|
+
#
|
34
|
+
# def hello
|
35
|
+
# "hello"
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# Hello.hello # => "hello"
|
40
|
+
#
|
41
|
+
module NiceSingleton
|
42
|
+
def self.included(other)
|
43
|
+
if other.class == Class
|
44
|
+
other.send(:include, Singleton)
|
45
|
+
class << other
|
46
|
+
def method_missing(method, *args, &block)
|
47
|
+
self.instance.send(method, *args)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|