Skip to content

Commit

Permalink
added src/moonterm-menu.lua and removed src/moonterm-popover.lua
Browse files Browse the repository at this point in the history
removed headerbar popover
added new menu
  • Loading branch information
sodomon2 committed Jan 31, 2021
1 parent eaeac15 commit a41f471
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 39 deletions.
2 changes: 1 addition & 1 deletion moonterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ dir = ('%s/moonterm'):format(GLib.get_user_config_dir())
conf = inifile:load(('%s/moonterm.ini'):format(dir))

-- MoonTerm
require('src.moonterm-popover')
require('src.moonterm-app')
require('src.moonterm-menu')
require('src.moonterm-dialog')
require('src.moonterm-keybinds')

Expand Down
9 changes: 1 addition & 8 deletions src/moonterm-app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@ main_window = Gtk.Window {
headerbar = Gtk.HeaderBar {
title = 'MoonTerm',
subtitle = 'a minimalist and customizable terminal in lua',
show_close_button = true,
Gtk.MenuButton {
visible = true,
can_focus = false,
popover = popover_menu,
on_clicked = function () popover_menu:show_all() end,
Gtk.Image({icon_name = "gtk-justify-fill"})
}
show_close_button = true
}

interpreter = utils:path_name(conf.moonterm.interpreter)['name']
Expand Down
46 changes: 46 additions & 0 deletions src/moonterm-menu.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
--[[--
@package MoonTerm
@filename moonterm-menu.lua
@version 1.0
@autor Diaz Urbaneja Victor Diego Alejandro <sodomon2@gmail.com>
@date 30.01.2021 19:54:09 -04
]]

function main_window:on_button_press_event(event)
if (event.type == 'BUTTON_PRESS' and event.button == 3) then
menu = Gtk.Menu {
Gtk.ImageMenuItem {
label = "Preferences",
image = Gtk.Image {
stock = "gtk-preferences"
},
on_activate = function()
dialog_config:show_all()
end
},
Gtk.ImageMenuItem {
label = "About Moonterm",
image = Gtk.Image {
stock = "gtk-about"
},
on_activate = function()
about_window:run()
about_window:hide()
end
},
Gtk.SeparatorMenuItem {},
Gtk.ImageMenuItem {
label = "Quit",
image = Gtk.Image {
stock = "gtk-quit"
},
on_activate = function()
app:quit()
end
}
}
menu:attach_to_widget(main_window, null)
menu:show_all()
menu:popup(nil, nil, nil, event.button, event.time)
end
end
30 changes: 0 additions & 30 deletions src/moonterm-popover.lua

This file was deleted.

0 comments on commit a41f471

Please sign in to comment.