gtk2_treeview_settings 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
@@ -0,0 +1,63 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{gtk2_treeview_settings}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Kasper Johansen"]
12
+ s.date = %q{2012-08-22}
13
+ s.description = %q{A gem that helps with ordering of columns and more.}
14
+ s.email = %q{k@spernj.org}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "gtk2_treeview_settings.gemspec",
29
+ "lib/gtk2_treeview_settings.rb",
30
+ "spec/gtk2_treeview_settings_spec.rb",
31
+ "spec/spec_helper.rb"
32
+ ]
33
+ s.homepage = %q{http://github.com/kaspernj/gtk2_treeview_settings}
34
+ s.licenses = ["MIT"]
35
+ s.require_paths = ["lib"]
36
+ s.rubygems_version = %q{1.6.2}
37
+ s.summary = %q{A gem that helps with ordering of columns and more.}
38
+
39
+ if s.respond_to? :specification_version then
40
+ s.specification_version = 3
41
+
42
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
+ s.add_runtime_dependency(%q<gtk2>, [">= 0"])
44
+ s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
45
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
46
+ s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
48
+ else
49
+ s.add_dependency(%q<gtk2>, [">= 0"])
50
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
51
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
52
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
53
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
54
+ end
55
+ else
56
+ s.add_dependency(%q<gtk2>, [">= 0"])
57
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
58
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
59
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
60
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
61
+ end
62
+ end
63
+
@@ -58,7 +58,11 @@ class Gtk2_treeview_settings
58
58
  end
59
59
 
60
60
  def append(data)
61
- iter = tv.model.append
61
+ if @tv.model.is_a?(Gtk::TreeStore)
62
+ iter = @tv.model.append(nil)
63
+ else
64
+ iter = @tv.model.append
65
+ end
62
66
 
63
67
  data.each do |key, val|
64
68
  col_no = self.col_no_for_id(key)
@@ -79,4 +83,31 @@ class Gtk2_treeview_settings
79
83
 
80
84
  return {:iter => iter}
81
85
  end
86
+
87
+ def append_adv(args)
88
+ if @tv.model.is_a?(Gtk::TreeStore)
89
+ iter = @tv.model.append(args[:parent])
90
+ else
91
+ iter = @tv.model.append
92
+ end
93
+
94
+ args[:data].each do |key, val|
95
+ col_no = self.col_no_for_id(key)
96
+ col_no_orig = self.col_orig_no_for_id(key)
97
+ col = tv.columns[col_no]
98
+ renderer = col.cell_renderers.first
99
+
100
+ if renderer.is_a?(Gtk::CellRendererText)
101
+ iter[col_no_orig] = val.to_s
102
+ elsif renderer.is_a?(Gtk::CellRendererToggle)
103
+ iter[col_no_orig] = Knj::Strings.yn_str(val, 1, 0)
104
+ elsif renderer.is_a?(Gtk::CellRendererCombo)
105
+ iter[col_no_orig] = val.to_s
106
+ else
107
+ raise "Unknown renderer: '#{renderer.class.name}'."
108
+ end
109
+ end
110
+
111
+ return {:iter => iter}
112
+ end
82
113
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gtk2_treeview_settings
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.0
5
+ version: 0.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kasper Johansen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-08-08 00:00:00 +02:00
13
+ date: 2012-08-22 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -86,6 +86,7 @@ files:
86
86
  - README.rdoc
87
87
  - Rakefile
88
88
  - VERSION
89
+ - gtk2_treeview_settings.gemspec
89
90
  - lib/gtk2_treeview_settings.rb
90
91
  - spec/gtk2_treeview_settings_spec.rb
91
92
  - spec/spec_helper.rb
@@ -103,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
104
  requirements:
104
105
  - - ">="
105
106
  - !ruby/object:Gem::Version
106
- hash: 784482569017263521
107
+ hash: -2671215643587821271
107
108
  segments:
108
109
  - 0
109
110
  version: "0"