naksh 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. data/AUTHORS +1 -0
  2. data/COPYING +674 -0
  3. data/COPYING-DOCS +15 -0
  4. data/README.md +45 -0
  5. data/Rakefile +129 -0
  6. data/TODO +19 -0
  7. data/bin/naksh +2 -0
  8. data/data/default.mo +0 -0
  9. data/data/default.po +16 -0
  10. data/data/default2.mo +0 -0
  11. data/data/default2.po +27 -0
  12. data/data/starter.pot +29 -0
  13. data/docs/bash_flow.dia +0 -0
  14. data/docs/gtk_manual.txt +13 -0
  15. data/docs/master_plan.dia +0 -0
  16. data/docs/master_plan.png +0 -0
  17. data/docs/master_plan.svg +74 -0
  18. data/docs/master_plan.svgz +0 -0
  19. data/docs/userguide/en/about.xml +42 -0
  20. data/docs/userguide/en/gnu-fdl-1.2.xml +543 -0
  21. data/docs/userguide/en/naksh.xml +881 -0
  22. data/docs/userguide/en/naksh_start_window.png +0 -0
  23. data/docs/userguide/en/old_naksh.xml +180 -0
  24. data/docs/userguide/en/userguide-en.omf +37 -0
  25. data/lib/naksh.rb +165 -0
  26. data/lib/naksh/buffer.rb +153 -0
  27. data/lib/naksh/command_handling.rb +117 -0
  28. data/lib/naksh/commands/bash/README +2 -0
  29. data/lib/naksh/commands/bash/echo.nkc.rb +50 -0
  30. data/lib/naksh/commands/bsd.rb +25 -0
  31. data/lib/naksh/commands/dos.rb +25 -0
  32. data/lib/naksh/commands/fuse.rb +25 -0
  33. data/lib/naksh/commands/gnu.rb +30 -0
  34. data/lib/naksh/commands/gnu/README +2 -0
  35. data/lib/naksh/commands/gnu/cat.nkc.rb +50 -0
  36. data/lib/naksh/commands/gnu/cd.nkc.rb +11 -0
  37. data/lib/naksh/commands/gnu/echo.documentation.json +57 -0
  38. data/lib/naksh/commands/gnu/echo.documentation.rb +60 -0
  39. data/lib/naksh/commands/gnu/echo.nkc.rb +52 -0
  40. data/lib/naksh/commands/gnu/ls.nkc.rb +11 -0
  41. data/lib/naksh/commands/gnu/mv.nkc.rb +15 -0
  42. data/lib/naksh/commands/gnu/pwd.nkc.rb +11 -0
  43. data/lib/naksh/commands/naksh/addpath.nkc.rb +15 -0
  44. data/lib/naksh/commands/naksh/broken.nkc.rb +10 -0
  45. data/lib/naksh/commands/naksh/empty.nkc.rb +4 -0
  46. data/lib/naksh/commands/naksh/exit.nkc.rb +10 -0
  47. data/lib/naksh/commands/naksh/help.nkc.rb +21 -0
  48. data/lib/naksh/commands/naksh/man.nkc.rb +8 -0
  49. data/lib/naksh/commands/ruby.rb +31 -0
  50. data/lib/naksh/commands/unix.rb +131 -0
  51. data/lib/naksh/configuration/gconf.rb +51 -0
  52. data/lib/naksh/configuration/hash.rb +38 -0
  53. data/lib/naksh/defaults.rb +40 -0
  54. data/lib/naksh/history.rb +85 -0
  55. data/lib/naksh/interfaces.rb +59 -0
  56. data/lib/naksh/interfaces/fox.rb +49 -0
  57. data/lib/naksh/interfaces/gtk.rb +103 -0
  58. data/lib/naksh/interfaces/gtk/abtwin.rb +53 -0
  59. data/lib/naksh/interfaces/gtk/gnomeapp.rb +31 -0
  60. data/lib/naksh/interfaces/gtk/helpwin.rb +70 -0
  61. data/lib/naksh/interfaces/gtk/io.rb +94 -0
  62. data/lib/naksh/interfaces/gtk/mainwin.rb +56 -0
  63. data/lib/naksh/interfaces/gtk/mainwin/console.rb +121 -0
  64. data/lib/naksh/interfaces/gtk/mainwin/main_menu.rb +143 -0
  65. data/lib/naksh/interfaces/gtk/optwin.rb +78 -0
  66. data/lib/naksh/interfaces/tab.rb +58 -0
  67. data/lib/naksh/interfaces/wxw.rb +75 -0
  68. data/lib/naksh/interfaces/wxw/abtwin.rb +38 -0
  69. data/lib/naksh/interfaces/wxw/helpwin.rb +40 -0
  70. data/lib/naksh/interfaces/wxw/io.rb +61 -0
  71. data/lib/naksh/interfaces/wxw/mainwin.rb +42 -0
  72. data/lib/naksh/interfaces/wxw/mainwin/main_menu.rb +126 -0
  73. data/lib/naksh/interfaces/wxw/mainwin/sessions.rb +49 -0
  74. data/lib/naksh/interfaces/wxw/optwin.rb +37 -0
  75. data/lib/naksh/path_entry.rb +101 -0
  76. data/lib/naksh/regexp.rb +31 -0
  77. data/lib/naksh/session.rb +72 -0
  78. data/lib/naksh/stdlibext.rb +48 -0
  79. data/lib/naksh/syntax.rb +57 -0
  80. data/lib/naksh/syntax/bash.rb +219 -0
  81. data/lib/naksh/syntax/bash/antlr/bottomup.g +24 -0
  82. data/lib/naksh/syntax/bash/antlr/topdown.g +52 -0
  83. data/lib/naksh/syntax/bash/dhaka/evaluator.rb +353 -0
  84. data/lib/naksh/syntax/bash/dhaka/grammar.rb +71 -0
  85. data/lib/naksh/syntax/bash/dhaka/lexer.rb +52 -0
  86. data/lib/naksh/syntax/bash/treetop/bash.treetop +17 -0
  87. data/lib/old/abbr_call.rb +39 -0
  88. data/lib/old/autocomplete.rb +29 -0
  89. data/lib/old/command.rb +106 -0
  90. data/lib/old/command_holder.rb +75 -0
  91. data/lib/old/commands.rb +24 -0
  92. data/lib/old/old_executor.rb +95 -0
  93. data/lib/old/options.rb +31 -0
  94. data/lib/old/rush.rb +113 -0
  95. data/lib/old/sortissimo.rb +205 -0
  96. data/lib/old/systems.rb +25 -0
  97. data/lib/old/systems/ruby.rb +26 -0
  98. data/lib/old/un.rb +240 -0
  99. data/lib/rust/Rakefile +6 -0
  100. data/lib/rust/commands/builtins.rb +46 -0
  101. data/lib/rust/commands/builtins/cd.rb +17 -0
  102. data/lib/rust/commands/builtins/exit.rb +13 -0
  103. data/lib/rust/commands/builtins/help.rb +14 -0
  104. data/lib/rust/commands/builtins/parser.rb +13 -0
  105. data/lib/rust/commands/builtins/pwd.rb +13 -0
  106. data/lib/rust/commands/builtins/type.rb +13 -0
  107. data/lib/rust/commands/commands/ls.rb +13 -0
  108. data/lib/rust/commands/commands/read.rb +13 -0
  109. data/lib/rust/commands/commands/rm.rb +14 -0
  110. data/lib/rust/commands/commands/test.rb +20 -0
  111. data/lib/rust/helpers/array.rb +10 -0
  112. data/lib/rust/helpers/command_center.rb +78 -0
  113. data/lib/rust/helpers/constants.rb +58 -0
  114. data/lib/rust/helpers/io.rb +132 -0
  115. data/lib/rust/helpers/parser.rb +45 -0
  116. data/lib/rust/helpers/rush_control.rb +40 -0
  117. data/lib/rust/helpers/string.rb +50 -0
  118. data/lib/rust/helpers/trollop.rb +475 -0
  119. data/lib/rust/parsers/bash.rb +220 -0
  120. data/lib/rust/parsers/bash/stdlibext.rb +32 -0
  121. data/lib/rust/parsers/ren.rb +57 -0
  122. data/lib/rust/rust.rb +75 -0
  123. data/lib/rust/syntax/command.rb +23 -0
  124. data/lib/rust/syntax/paths.rb +31 -0
  125. data/lib/rust/syntax/pipes.rb +148 -0
  126. data/naksh.gemspec +55 -0
  127. data/test/naksh/arg_parser.rspec.rb +27 -0
  128. data/test/naksh/commands/bash/echo.rspec.rb +32 -0
  129. data/test/naksh/commands/sortlist +127 -0
  130. data/test/naksh/external_command.rspec.rb +46 -0
  131. data/test/naksh/send_error.rspec.rb +60 -0
  132. data/test/naksh/suggest.rspec.rb +38 -0
  133. data/test/naksh/syntax/bash.rspec.rb +69 -0
  134. data/test/naksh/syntax/bash/execute.rspec.rb +51 -0
  135. data/test/naksh/syntax/rspec.rb +63 -0
  136. data/test/run_rspecs.rb +20 -0
  137. metadata +217 -0
@@ -0,0 +1,94 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+
4
+ # This file is part of Naksh.
5
+ #
6
+ # Naksh is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Naksh is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Naksh. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'gtk2'
20
+
21
+ module Naksh
22
+ module Interfaces
23
+ module Rbgtk
24
+
25
+
26
+
27
+ # duplicate of the current input, modifications are ignored
28
+ # if the user pressed `return' right now, this is what would be
29
+ # sent to syntax.execute
30
+ def Rbgtk.in
31
+ @console.buffer.get_slice(@console.buffer.get_iter_at_mark(@console.buffer.get_mark('current_input_start')),@console.buffer.end_iter,true)
32
+ end
33
+
34
+
35
+ def Rbgtk.in= str
36
+ @console.buffer.delete @console.buffer.get_iter_at_mark(@console.buffer.get_mark('current_input_start')),@console.buffer.end_iter
37
+ @console.buffer.insert @console.buffer.end_iter,str.to_str
38
+ end
39
+
40
+
41
+
42
+
43
+ class GtkRuBuffer
44
+
45
+
46
+ def initialize gtk_text_buffer
47
+ @buffer=gtk_text_buffer
48
+ end
49
+
50
+
51
+
52
+ attr_accessor :buffer
53
+
54
+
55
+ def print *a
56
+ a.each do |str|
57
+ buffer.insert buffer.end_iter,str
58
+ end
59
+ true
60
+ end
61
+
62
+
63
+ def pp *a
64
+ a.each do |arg|
65
+ if arg.kind_of? Array
66
+ arg.each do |el|
67
+ buffer.insert(buffer.end_iter,(el[-1]=="\n" or el[-1].chr=="\n")? el : el+"\n")
68
+ end
69
+ elsif arg.kind_of? String
70
+ buffer.insert buffer.end_iter,arg
71
+ elsif arg.kind_of? Symbol
72
+ buffer.insert buffer.end_iter,":#{arg.to_s}:"
73
+ end
74
+ end
75
+ end
76
+
77
+ end
78
+
79
+
80
+ @out=GtkRuBuffer.new @console.buffer
81
+ @err=GtkRuBuffer.new @console.buffer
82
+
83
+
84
+ def Rbgtk.out
85
+ @out
86
+ end
87
+
88
+ def Rbgtk.err
89
+ @err
90
+ end
91
+
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,56 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+
4
+ # This file is part of Naksh.
5
+ #
6
+ # Naksh is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Naksh is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Naksh. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'gtk2'
20
+
21
+ module Naksh
22
+ module Interfaces
23
+ module Rbgtk
24
+
25
+ @mainwin=Gtk::Window.new 'Naksh Terminal Emulator'
26
+
27
+ @vb=Gtk::VBox.new
28
+ require 'naksh/interfaces/gtk/mainwin/main_menu.rb'
29
+ @tabs=Gtk::Notebook.new
30
+ require 'naksh/interfaces/gtk/mainwin/console.rb'
31
+ @vb<<@tabs
32
+
33
+ statusbar=Gtk::Statusbar.new
34
+ @vb.pack_start statusbar,false,true,0
35
+ @mainwin.add @vb
36
+
37
+ @mainwin.signal_connect 'destroy' do
38
+ Rbgtk.quit
39
+ false
40
+ end
41
+
42
+ @mainwin.set_size_request(640,420)
43
+
44
+ @mainwin.show_all
45
+
46
+
47
+
48
+ #the principal Terminal Emulator window
49
+ def Rbgtk.main
50
+ @mainwin
51
+ end
52
+
53
+
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,121 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+
4
+ # This file is part of Naksh.
5
+ #
6
+ # Naksh is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Naksh is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Naksh. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'gtk2'
20
+
21
+ module Naksh
22
+ module Interfaces
23
+ module Rbgtk
24
+
25
+
26
+ @console=Gtk::TextView.new
27
+ @console.cursor_visible= (Naksh.config['/interface/tty/cursor']!='hidden')
28
+ @console.accepts_tab= (Naksh.config['/interface/tty/keys/tab']=='character')? true : false
29
+ # @console.add_events(Gdk::Event::KEY_PRESS)
30
+ @console.signal_connect("key-press-event") do |w, e|
31
+ result=false
32
+ case e.keyval
33
+ when 65288
34
+ result= Rbgtk.back
35
+ when 65361
36
+ result= Rbgtk.back
37
+ when 65289
38
+ result=Rbgtk.potential_autocomplete_key('/interface/tty/keys/tab')
39
+ when 65056
40
+ result=Rbgtk.potential_autocomplete_key('/interface/tty/keys/alt_tab')
41
+ when 65293
42
+ result=Naksh.attempt_submit('/interface/tty/keys/return')
43
+ when 65362#up
44
+ Naksh.refresh_history
45
+ Rbgtk.in=Naksh.current_session.history.back!
46
+ result=true
47
+ when 65364#down
48
+ Naksh.refresh_history
49
+ Rbgtk.in=Naksh.current_session.history.forward!
50
+ result=true
51
+ when 65365#page_up
52
+ Naksh.refresh_history
53
+ Rbgtk.in=Naksh.current_session.history.first!
54
+ result=true
55
+ when 65366#page_down
56
+ Naksh.refresh_history
57
+ Rbgtk.in=Naksh.current_session.history.last!
58
+ when 65360#home
59
+ @console.buffer.place_cursor(@console.buffer.get_iter_at_mark(@console.buffer.get_mark('current_input_start')))
60
+ result=true
61
+ when 65367#end
62
+ @console.buffer.place_cursor(@console.buffer.end_iter)
63
+ #@console.buffer.move_mark(@console.buffer.get_mark('insert'),@console.buffer.end_iter)
64
+ result=true
65
+ when 65307#esc
66
+ Naksh.interface.in=''
67
+ end
68
+ #$stdout.puts "#{e.keyval}, Gdk::Keyval::GDK_#{Gdk::Keyval.to_name(e.keyval)}, result=#{result.to_s}" if e.keyval>200 and e.keyval
69
+ result
70
+ end
71
+
72
+
73
+
74
+ case Naksh.config['/interface/tty/wrap']
75
+ when 'none'
76
+ @console.wrap_mode=Gtk::TextTag::WRAP_NONE
77
+ when 'word'
78
+ @console.wrap_mode=Gtk::TextTag::WRAP_WORD
79
+ when 'char'
80
+ @console.wrap_mode=Gtk::TextTag::WRAP_CHAR
81
+ else
82
+ $stderr.puts _("Naksh.config['/interface/tty/wrap'] has unrecognized value: #{Naksh.config['/interface/tty/wrap'].inspect}")
83
+ end
84
+
85
+
86
+ context_menu=Gtk::Menu.new
87
+ context_menu.append(Gtk::MenuItem.new("Test1"))
88
+ context_menu.append(Gtk::MenuItem.new("Test2"))
89
+ context_menu.show_all
90
+ @mainwin.add_events(Gdk::Event::BUTTON_PRESS_MASK)
91
+ @console.signal_connect("button_press_event") do |w,event|
92
+ result=false
93
+ case event.button
94
+ when 1
95
+ iter=@console.get_iter_at_location(event.x,event.y)
96
+ if iter.offset>=@console.buffer.get_iter_at_mark(@console.buffer.get_mark('current_input_start')).offset
97
+ result=false
98
+ else
99
+ result=true
100
+ end
101
+ when 2
102
+ $stderr.puts _('I don\'t know what the middle button should do. If anyone has a middle button, and is therefore familiar with its functionality, please help.')
103
+ #yeah, I disable what I don't understand
104
+ result=true
105
+ when 3
106
+ context_menu.popup nil,nil,event.button,event.time
107
+ result=true
108
+ else
109
+ $stderr.puts _('You seem to have clicked a button I\'ve never heard of, for reference, its number is %d')%[event.button]
110
+ end
111
+ result
112
+ end
113
+ main_style=@console.buffer.create_tag 'main terminal style',:family=>'monospace',:background=>'#000000',:foreground=>'#FFFFFF'
114
+ @console.buffer.apply_tag main_style,@console.buffer.start_iter,@console.buffer.end_iter#bounds
115
+ scroller=Gtk::ScrolledWindow.new
116
+ scroller<<@console
117
+ @tabs<<scroller
118
+
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,143 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+
4
+ # This file is part of Naksh.
5
+ #
6
+ # Naksh is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Naksh is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Naksh. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'gtk2'
20
+
21
+ module Naksh
22
+ module Interfaces
23
+ module Rbgtk
24
+
25
+
26
+ menubar=Gtk::MenuBar.new
27
+ file_menu=Gtk::MenuItem.new('_File')
28
+ file_sm=Gtk::Menu.new
29
+ new_session=Gtk::ImageMenuItem.new(_('_New Session'),true)
30
+ new_session.image=Gtk::IconFactory.new.lookup('new')
31
+ new_session.signal_connect 'activate' do
32
+ Rbgtk.new_tab(Naksh::Session.new)
33
+ false
34
+ end
35
+ file_sm<<new_session
36
+
37
+ fork_session=Gtk::ImageMenuItem.new(_('_Fork Session'),true)
38
+ fork_session.signal_connect 'activate' do
39
+ Rbgtk.new_tab Naksh.current_session.fork
40
+ end
41
+ file_sm<<fork_session
42
+ file_sm<<Gtk::ImageMenuItem.new(Gtk::Stock::SAVE_AS)
43
+ quit_option=Gtk::ImageMenuItem.new(_('_Quit'),true)
44
+ quit_option.signal_connect 'activate' do
45
+ Rbgtk.quit
46
+ end
47
+ file_sm<<quit_option
48
+ file_sm.show_all
49
+ file_menu.submenu=file_sm
50
+ menubar<<file_menu
51
+ edit_menu=Gtk::MenuItem.new(_('_Edit'),true)
52
+ edit_sm=Gtk::Menu.new
53
+ cut_option=Gtk::ImageMenuItem.new(_('Cu_t'),true)
54
+ cut_option.signal_connect 'activate' do
55
+ $stderr.puts 'text editing functions are not yet implemented'
56
+ end
57
+ edit_sm<<cut_option
58
+ copy_option=Gtk::ImageMenuItem.new(_('_Copy'),true)
59
+ copy_option.signal_connect 'activate' do
60
+ $stderr.puts 'text editing functions are not yet implemented'
61
+ end
62
+ edit_sm<<copy_option
63
+ paste_option=Gtk::ImageMenuItem.new(_('_Paste'),true)
64
+ paste_option.signal_connect 'activate' do
65
+ $stderr.puts 'text editing functions are not yet implemented'
66
+ end
67
+ edit_sm<<paste_option
68
+ del_option=Gtk::ImageMenuItem.new(_('_Delete'),true)
69
+ del_option.signal_connect 'activate' do
70
+ $stderr.puts 'text editing functions are not yet implemented'
71
+ end
72
+ edit_sm<<del_option
73
+ sel_all_option=Gtk::ImageMenuItem.new(_('Select _All'),true)
74
+ sel_all_option.signal_connect 'activate' do
75
+ $stderr.puts 'text editing functions are not yet implemented'
76
+ end
77
+ edit_sm<<sel_all_option
78
+ edit_sm<<Gtk::SeparatorMenuItem.new
79
+ pref_option=Gtk::ImageMenuItem.new(_('_Preferences'),true)
80
+ pref_option.signal_connect 'activate' do
81
+ Rbgtk.options.show
82
+ false
83
+ end
84
+ edit_sm<<pref_option
85
+ edit_menu.submenu=edit_sm
86
+ menubar<<edit_menu
87
+ view_menu=Gtk::MenuItem.new(_('_View'),true)
88
+ view_sm=Gtk::Menu.new
89
+ stat_bar_opt=Gtk::ImageMenuItem.new(_('Status Bar'),true)
90
+ stat_bar_opt.signal_connect 'activate' do
91
+ Naksh.config['/interface/gui/statusbar']=(not Naksh.config['/interface/gui/statusbar'])
92
+ end
93
+ view_sm<<stat_bar_opt
94
+ view_sm<<Gtk::SeparatorMenuItem.new
95
+ tab_bar_opt_menu=Gtk::MenuItem.new(_('Tab Bar'),true)
96
+ tab_bar_opt_sm=Gtk::Menu.new
97
+ m29544=Gtk::MenuItem.new(_('Always Show'),true)
98
+ m29544.signal_connect 'activate' do
99
+ Naksh.config['/interface/gui/tabbar']='always'
100
+ end
101
+ tab_bar_opt_sm<<m29544
102
+ m26729=Gtk::MenuItem.new(_('Always Hide'),true)
103
+ m26729.signal_connect 'activate' do
104
+ Naksh.config['/interface/gui/tabbar']='never'
105
+ end
106
+ tab_bar_opt_sm<<m26729
107
+ m29549=Gtk::MenuItem.new(_('Sometimes Show'),true)
108
+ m29549.signal_connect 'activate' do
109
+ Naksh.config['/interface/gui/tabbar']='sometimes'
110
+ end
111
+ tab_bar_opt_sm<<m29549
112
+ tab_bar_opt_menu.submenu=tab_bar_opt_sm
113
+ view_sm<<tab_bar_opt_menu
114
+ view_menu.submenu=view_sm
115
+ menubar<<view_menu
116
+ search_menu=Gtk::MenuItem.new(_('_Search'),true)
117
+ search_sm=Gtk::Menu.new
118
+ m26217=Gtk::ImageMenuItem.new(_('_Find'),true)
119
+ search_sm<<m26217
120
+ m27753=Gtk::ImageMenuItem.new(_('Go To _Line'),true)
121
+ search_sm<<m27753
122
+ search_menu.submenu=search_sm
123
+ menubar<<search_menu
124
+ help_menu=Gtk::MenuItem.new(_('_Help'),true)
125
+ help_sm=Gtk::Menu.new
126
+ m26725=Gtk::ImageMenuItem.new(_('_Contents'),true)
127
+ m26725.signal_connect 'activate' do
128
+ Naksh.interface.help.show
129
+ end
130
+ help_sm<<m26725
131
+ m24930=Gtk::ImageMenuItem.new(_('_About'),true)
132
+ m24930.signal_connect 'activate' do
133
+ Naksh.interface.about.show
134
+ end
135
+ help_sm<<m24930
136
+ help_menu.submenu=help_sm
137
+ menubar<<help_menu
138
+ @vb.pack_start menubar,false,true,0
139
+
140
+
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,78 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+
4
+ # This file is part of Naksh.
5
+ #
6
+ # Naksh is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Naksh is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Naksh. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'gtk2'
20
+
21
+ module Naksh
22
+ module Interfaces
23
+ module Rbgtk
24
+
25
+
26
+ @optwin=Gtk::Window.new 'Naksh Options'
27
+ vp=Gtk::VBox.new
28
+ options_list=Gtk::VBox.new
29
+
30
+ prompt_section=Gtk::HPaned.new
31
+ prompt=Gtk::Entry.new
32
+ prompt.text=Naksh.config['/interface/tty/prompt']
33
+ prompt_label=Gtk::Label.new('_Prompt')
34
+ prompt_label.mnemonic_widget=prompt
35
+ prompt_section<<prompt_label
36
+ prompt_section<<prompt
37
+ options_list<<prompt_section
38
+
39
+ vp<<(Gtk::HBox.new<<options_list)
40
+
41
+
42
+ hbuttons=Gtk::HButtonBox.new
43
+
44
+ help_button= Gtk::Button.new(Gtk::Stock::HELP)
45
+ help_button.signal_connect 'clicked' do
46
+ $stderr.puts 'help button on preferences window is not yet implemented'
47
+ end
48
+ hbuttons<<help_button
49
+ apply_button= Gtk::Button.new(Gtk::Stock::APPLY)
50
+ apply_button.signal_connect 'clicked' do
51
+ Naksh.config['/interface/tty/prompt']=prompt.text
52
+ end
53
+ hbuttons<<apply_button
54
+ cancel_button=Gtk::Button.new(Gtk::Stock::CANCEL)
55
+ cancel_button.signal_connect 'clicked' do
56
+ @optwin.hide
57
+ end
58
+ hbuttons<<cancel_button
59
+ ok_button=Gtk::Button.new(Gtk::Stock::OK)
60
+ ok_button.signal_connect 'clicked' do
61
+ apply_button.clicked
62
+ @optwin.hide
63
+ end
64
+ hbuttons<<ok_button
65
+
66
+ vp<<hbuttons
67
+ @optwin<<vp
68
+ @optwin.show_all
69
+ @optwin.hide
70
+
71
+ def Rbgtk.options
72
+ @optwin
73
+ end
74
+
75
+
76
+ end
77
+ end
78
+ end