newt 0.9.4 → 0.9.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62d4f4ab5ac9d37c9ffdd82936f27bac82ab7814
4
- data.tar.gz: bbfaf4bcc9d527ec8904d7014f773ca6211b1605
3
+ metadata.gz: 8a0ef883790841be6725ffbd250dafc7d7613b80
4
+ data.tar.gz: 89db90156a33409c1728aebc3157e3f4c13d9c29
5
5
  SHA512:
6
- metadata.gz: cc85c88ef131060f1086f07eee53f579be123855e2455c76540f3dfd9c674daa2e2d6d638123d215e92f7da1fa292f180e2f04af4208f42cf1be729d96d7e5ed
7
- data.tar.gz: c6d172e3f6afbbe1e6e6e25a7321e71b666f71c0a95d96bfa3413861eb613c8bbb8807b891d28f8914602b0091d2de1b6b348b7d90711542353dc6fac6e4d435
6
+ metadata.gz: 8d96731853b713c625e6440cf8a28742903b6bd37b6c5d536855c56e5f16cf9b7d5840d15eb3cc3549a50212d648ea66c55606e5f80478269d6de4e060d1bcc2
7
+ data.tar.gz: 8669acff2137bce99ba0aaa3195b0f099e44363137407fb6c8031aaf7e1ac4f25507696a5d684601b7a23d127fd4c6e95699edcd06c8b320278a1b28e5ad1ab6
@@ -200,15 +200,16 @@ static VALUE rb_ext_Screen_WinMessage(VALUE self, VALUE args)
200
200
 
201
201
  static VALUE rb_ext_Screen_WinChoice(VALUE self, VALUE args)
202
202
  {
203
+ int result = 0;
204
+
203
205
  if (RARRAY_LEN(args) < 4) {
204
206
  rb_raise(rb_eArgError, "4 arguments required");
205
207
  } else {
206
-
207
- newtWinChoice(StringValuePtr(RARRAY_PTR(args)[0]), StringValuePtr(RARRAY_PTR(args)[1]),
208
+ result = newtWinChoice(StringValuePtr(RARRAY_PTR(args)[0]), StringValuePtr(RARRAY_PTR(args)[1]),
208
209
  StringValuePtr(RARRAY_PTR(args)[2]), StringValuePtr(RARRAY_PTR(args)[3]));
209
210
  }
210
211
 
211
- return Qnil;
212
+ return INT2NUM(result);
212
213
  }
213
214
 
214
215
  static VALUE rb_ext_Screen_WinMenu(VALUE self, VALUE args)
@@ -499,20 +500,20 @@ static VALUE rb_ext_Listbox_new(VALUE self, VALUE left, VALUE top, VALUE height,
499
500
  return Data_Wrap_Struct(self, 0, 0, co);
500
501
  }
501
502
 
502
- static VALUE rb_ext_Listbox_GetCurrent(VALUE self)
503
+ static VALUE rb_ext_Listbox_GetCurrentAsNumber(VALUE self)
503
504
  {
504
505
  newtComponent co;
505
- int i = 0;
506
- int *ip;
507
- char *p;
508
506
 
509
- ip = &i;
507
+ Data_Get_Struct(self, struct newtComponent_struct, co);
508
+ return INT2NUM((int *) newtListboxGetCurrent(co));
509
+ }
510
+
511
+ static VALUE rb_ext_Listbox_GetCurrentAsString(VALUE self)
512
+ {
513
+ newtComponent co;
510
514
 
511
515
  Data_Get_Struct(self, struct newtComponent_struct, co);
512
- /*p = (char *)newtListboxGetCurrent(co);*/
513
- ip = (int *)newtListboxGetCurrent(co);
514
- /*return rb_str_new2(p);*/
515
- return INT2NUM(i);
516
+ return rb_str_new2((char *) newtListboxGetCurrent(co));
516
517
  }
517
518
 
518
519
  static VALUE rb_ext_Listbox_SetCurrent(VALUE self, VALUE num)
@@ -1110,6 +1111,8 @@ void Init_ruby_newt(){
1110
1111
 
1111
1112
  cRadioButton = rb_define_class_under(mNewt, "RadioButton", cWidget);
1112
1113
  rb_define_singleton_method(cRadioButton, "new", rb_ext_RadioButton_new, 5);
1114
+ rb_define_method(cRadioButton, "get", rb_ext_Checkbox_GetValue, 0);
1115
+ rb_define_method(cRadioButton, "set", rb_ext_Checkbox_SetValue, 1);
1113
1116
 
1114
1117
  cLabel = rb_define_class_under(mNewt, "Label", cWidget);
1115
1118
  rb_define_singleton_method(cLabel, "new", rb_ext_Label_new, 3);
@@ -1117,7 +1120,9 @@ void Init_ruby_newt(){
1117
1120
 
1118
1121
  cListbox = rb_define_class_under(mNewt, "Listbox", cWidget);
1119
1122
  rb_define_singleton_method(cListbox, "new", rb_ext_Listbox_new, 4);
1120
- rb_define_method(cListbox, "get_current", rb_ext_Listbox_GetCurrent, 0);
1123
+ rb_define_method(cListbox, "get_current", rb_ext_Listbox_GetCurrentAsNumber, 0);
1124
+ rb_define_method(cListbox, "get_current_as_number", rb_ext_Listbox_GetCurrentAsNumber, 0);
1125
+ rb_define_method(cListbox, "get_current_as_string", rb_ext_Listbox_GetCurrentAsString, 0);
1121
1126
  rb_define_method(cListbox, "set_current", rb_ext_Listbox_SetCurrent, 1);
1122
1127
  rb_define_method(cListbox, "setCurrentByKey", rb_ext_Listbox_SetCurrentByKey, 1);
1123
1128
  rb_define_method(cListbox, "set_width", rb_ext_Listbox_SetWidth, 1);
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Newt
2
- VERSION = '0.9.4'
2
+ VERSION = '0.9.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noritsugu Nakamura
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-06-23 00:00:00.000000000 Z
13
+ date: 2015-08-04 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Ruby bindings for newt TUI library
16
16
  email: foreman-dev@googlegroups.com
@@ -20,11 +20,11 @@ extensions:
20
20
  extra_rdoc_files:
21
21
  - README.rdoc
22
22
  files:
23
- - README.rdoc
24
- - ext/ruby_newt/extconf.rb
25
- - ext/ruby_newt/ruby_newt.c
26
23
  - lib/newt.rb
27
24
  - lib/version.rb
25
+ - ext/ruby_newt/extconf.rb
26
+ - ext/ruby_newt/ruby_newt.c
27
+ - README.rdoc
28
28
  homepage: https://github.com/theforeman/ruby-newt
29
29
  licenses:
30
30
  - MIT
@@ -36,17 +36,17 @@ require_paths:
36
36
  - ext
37
37
  required_ruby_version: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  required_rubygems_version: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  requirements: []
48
48
  rubyforge_project:
49
- rubygems_version: 2.2.0
49
+ rubygems_version: 2.0.14
50
50
  signing_key:
51
51
  specification_version: 4
52
52
  summary: Ruby bindings for newt