Module: VimMate::Plugin::SubversionMenu::InstanceMethods
- Defined in:
- lib/vim_mate/plugins/subversion/lib/menu.rb
Instance Method Summary collapse
- #initialize_with_svn(*args) ⇒ Object
-
#menu_svn_add ⇒ Object
Add the selected file to subversion.
-
#menu_svn_delete ⇒ Object
Delete the selected file from subversion.
-
#menu_svn_rename ⇒ Object
Rename the selected file with subversion.
-
#menu_svn_revert ⇒ Object
Revert the selected file in subversion.
Instance Method Details
#initialize_with_svn(*args) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vim_mate/plugins/subversion/lib/menu.rb', line 12 def initialize_with_svn(*args) initialize_without_svn(*args) = Gtk::Menu.new .append(svn_add = Gtk::ImageMenuItem.new(Gtk::Stock::ADD)) svn_add.signal_connect("activate") do end .append(svn_rename = Gtk::MenuItem.new("R_ename")) svn_rename.signal_connect("activate") do end .append(svn_delete = Gtk::ImageMenuItem.new(Gtk::Stock::DELETE)) svn_delete.signal_connect("activate") do end .append(svn_revert = Gtk::ImageMenuItem.new(Gtk::Stock::REVERT_TO_SAVED)) svn_revert.signal_connect("activate") do end @gtk_menu.append(subversion = Gtk::MenuItem.new("S_ubversion")) subversion. = @gtk_menu.show_all end |
#menu_svn_add ⇒ Object
Add the selected file to subversion
41 42 43 44 |
# File 'lib/vim_mate/plugins/subversion/lib/menu.rb', line 41 def Subversion.add(@last_path) end |
#menu_svn_delete ⇒ Object
Delete the selected file from subversion
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/vim_mate/plugins/subversion/lib/menu.rb', line 79 def dialog = Gtk::MessageDialog.new(@parent_window.gtk_window, Gtk::MessageDialog::Flags::MODAL, Gtk::MessageDialog::Type::QUESTION, Gtk::MessageDialog::ButtonsType::YES_NO, "Do a Subversion Delete on #{File.basename(@last_path)} ?") dialog.set_icon_list(Icons.window_icons) if dialog.run == Gtk::Dialog::RESPONSE_YES Subversion.remove(@last_path) end dialog.destroy end |
#menu_svn_rename ⇒ Object
Rename the selected file with subversion
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/vim_mate/plugins/subversion/lib/menu.rb', line 47 def dialog = Gtk::FileChooserDialog.new("Rename #{File.basename(@last_path)}", @parent_window.gtk_window, Gtk::FileChooser::ACTION_SAVE, nil, [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL], [Gtk::Stock::SAVE, Gtk::Dialog::RESPONSE_ACCEPT]) dialog.set_icon_list(Icons.window_icons) dialog.current_folder = File.dirname(@last_path) if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT Subversion.move(@last_path, dialog.filename) end dialog.destroy end |
#menu_svn_revert ⇒ Object
Revert the selected file in subversion
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/vim_mate/plugins/subversion/lib/menu.rb', line 64 def dialog = Gtk::MessageDialog.new(@parent_window.gtk_window, Gtk::MessageDialog::Flags::MODAL, Gtk::MessageDialog::Type::QUESTION, Gtk::MessageDialog::ButtonsType::YES_NO, "Do a Subversion Revert on #{File.basename(@last_path)} ?") dialog.set_icon_list(Icons.window_icons) if dialog.run == Gtk::Dialog::RESPONSE_YES Subversion.revert(@last_path) end dialog.destroy end |