gimdb 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -23
- data/Gemfile +4 -0
- data/README.rdoc +20 -1
- data/Rakefile +21 -37
- data/TODO +1 -0
- data/bin/gimdb +5 -5
- data/data/{gimdb.glade → gimdb.ui} +273 -280
- data/data/locale/it/LC_MESSAGES/gimdb.mo +0 -0
- data/gimdb.gemspec +20 -67
- data/{src → lib/gimdb}/controller.rb +14 -11
- data/{src → lib/gimdb}/gimdb.rb +153 -116
- data/{src → lib/gimdb}/manager_box.rb +1 -5
- data/{src → lib/gimdb}/model.rb +15 -15
- data/{src → lib/gimdb}/movie_box.rb +27 -11
- data/lib/gimdb/version.rb +3 -0
- data/lib/imdb.rb +18 -12
- data/po/gimdb.pot +110 -73
- data/po/it/gimdb.po +149 -128
- metadata +83 -69
- data/VERSION +0 -1
Binary file
|
data/gimdb.gemspec
CHANGED
@@ -1,74 +1,27 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "gimdb/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
9
|
-
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.default_executable = %q{gimdb}
|
6
|
+
s.name = "gimdb"
|
7
|
+
s.version = Gimdb::VERSION
|
8
|
+
s.authors = ["Enrico Pilotto"]
|
9
|
+
s.email = ["enrico@megiston.it"]
|
10
|
+
s.homepage = "https://github.com/pioz/gimdb"
|
11
|
+
s.summary = %q{GTK graphical interface for Internet Movie DataBase}
|
14
12
|
s.description = %q{GTK graphical interface for Internet Movie DataBase. You can create users and save for each of them the movies to see, movies seen and favourites movies in a sqlite3 database.}
|
15
|
-
s.email = %q{enrico@megiston.it}
|
16
|
-
s.executables = ["gimdb"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE",
|
19
|
-
"README.rdoc"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".gitignore",
|
23
|
-
"LICENSE",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"bin/gimdb",
|
28
|
-
"data/gimdb.glade",
|
29
|
-
"data/icons/favourites.png",
|
30
|
-
"data/icons/gimdb.png",
|
31
|
-
"data/icons/imdb.png",
|
32
|
-
"data/icons/no_poster.png",
|
33
|
-
"data/icons/seen.png",
|
34
|
-
"data/icons/spinner16x16.gif",
|
35
|
-
"data/icons/to_see.png",
|
36
|
-
"data/icons/users.png",
|
37
|
-
"data/icons/users_edit.png",
|
38
|
-
"data/locale/it/LC_MESSAGES/gimdb.mo",
|
39
|
-
"gimdb.gemspec",
|
40
|
-
"lib/imdb.rb",
|
41
|
-
"po/gimdb.pot",
|
42
|
-
"po/it/gimdb.po",
|
43
|
-
"src/controller.rb",
|
44
|
-
"src/gimdb.rb",
|
45
|
-
"src/manager_box.rb",
|
46
|
-
"src/model.rb",
|
47
|
-
"src/movie_box.rb"
|
48
|
-
]
|
49
|
-
s.homepage = %q{http://github.com/pioz/gimdb}
|
50
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
51
|
-
s.require_paths = ["lib"]
|
52
|
-
s.rubygems_version = %q{1.3.5}
|
53
|
-
s.summary = %q{GTK graphical interface for Internet Movie DataBase}
|
54
13
|
|
55
|
-
|
56
|
-
|
57
|
-
|
14
|
+
s.add_dependency('nokogiri')
|
15
|
+
s.add_dependency('activerecord')
|
16
|
+
s.add_dependency('sqlite3-ruby')
|
17
|
+
s.add_dependency('gtk2')
|
58
18
|
|
59
|
-
|
60
|
-
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
61
|
-
s.add_runtime_dependency(%q<activerecord>, [">= 0"])
|
62
|
-
s.add_runtime_dependency(%q<sqlite3-ruby>, [">= 0"])
|
63
|
-
else
|
64
|
-
s.add_dependency(%q<nokogiri>, [">= 0"])
|
65
|
-
s.add_dependency(%q<activerecord>, [">= 0"])
|
66
|
-
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
67
|
-
end
|
68
|
-
else
|
69
|
-
s.add_dependency(%q<nokogiri>, [">= 0"])
|
70
|
-
s.add_dependency(%q<activerecord>, [">= 0"])
|
71
|
-
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
72
|
-
end
|
73
|
-
end
|
19
|
+
s.requirements = ['ruby-gnome2 package version >= 0.19.3 - Debian package name: ruby-gnome2 - Mac port package name: rb-gnome']
|
74
20
|
|
21
|
+
s.rubyforge_project = "gimdb"
|
22
|
+
|
23
|
+
s.files = `git ls-files`.split("\n")
|
24
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
26
|
+
s.require_paths = ["lib"]
|
27
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require "#{$
|
2
|
-
require "#{$
|
1
|
+
require "#{$APP_PATH}/lib/imdb"
|
2
|
+
require "#{$APP_PATH}/lib/gimdb/model"
|
3
3
|
|
4
4
|
|
5
5
|
module Controller
|
@@ -21,20 +21,14 @@ module Controller
|
|
21
21
|
i = 0
|
22
22
|
res.sort{|x,y| x[0] <=> y[0]}.each do |k,v|
|
23
23
|
if block_given?
|
24
|
-
yield(i, res.size, '
|
25
|
-
i
|
24
|
+
yield(i, res.size, 'Updating database')
|
25
|
+
i += 1
|
26
26
|
end
|
27
27
|
record = Movie.find(:first, :conditions => "code = '#{v[:code]}'")
|
28
28
|
if record.nil?
|
29
29
|
record = Movie.new(v)
|
30
|
-
options[:path] ||= "#{$GIMDB_LOCAL_PATH}/posters/"
|
31
|
-
image_path = "#{options[:path]}#{record.code}.jpg"
|
32
|
-
if imdb.get_image(record.image_url, image_path)
|
33
|
-
record.image_path = image_path
|
34
|
-
end
|
35
30
|
record.save!
|
36
31
|
else
|
37
|
-
imdb.get_image(record.image_url, record.image_path) if !record.image_path.nil? && !File.exists?(record.image_path)
|
38
32
|
if (Time.now - record.updated_at) > 1.day
|
39
33
|
record.update_attributes(v.merge(:updated_at => Time.now))
|
40
34
|
record.save!
|
@@ -46,5 +40,14 @@ module Controller
|
|
46
40
|
return movies
|
47
41
|
end
|
48
42
|
end
|
43
|
+
|
44
|
+
def self.get_poster(imdb, record, options = {})
|
45
|
+
options[:path] ||= "#{$APP_LOCAL_PATH}/posters/"
|
46
|
+
image_path = "#{options[:path]}#{record.code}.jpg"
|
47
|
+
if imdb.get_image(record.image_url, image_path)
|
48
|
+
record.image_path = image_path
|
49
|
+
record.save!
|
50
|
+
end
|
51
|
+
end
|
49
52
|
|
50
|
-
end
|
53
|
+
end
|
data/{src → lib/gimdb}/gimdb.rb
RENAMED
@@ -1,78 +1,66 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
puts "If you are using Debian/GNU Linux you can install it with:"
|
8
|
-
puts ""
|
9
|
-
puts " apt-get install libgtk2-ruby"
|
10
|
-
puts ""
|
11
|
-
exit -1
|
12
|
-
end
|
13
|
-
begin
|
14
|
-
require 'libglade2'
|
15
|
-
rescue LoadError => e
|
16
|
-
puts "Error: #{e.to_s}"
|
17
|
-
puts ""
|
18
|
-
puts "You must install 'libglade2' to run this program."
|
19
|
-
puts "If you are using Debian/GNU Linux you can install it with:"
|
20
|
-
puts ""
|
21
|
-
puts " apt-get install libglade2-ruby"
|
22
|
-
puts ""
|
23
|
-
exit -1
|
24
|
-
end
|
25
|
-
require "#{$GIMDB_PATH}/lib/imdb"
|
26
|
-
require "#{$GIMDB_PATH}/src/controller"
|
27
|
-
require "#{$GIMDB_PATH}/src/movie_box"
|
28
|
-
require "#{$GIMDB_PATH}/src/manager_box"
|
1
|
+
require 'gtk2'
|
2
|
+
|
3
|
+
require "#{$APP_PATH}/lib/imdb"
|
4
|
+
require "#{$APP_PATH}/lib/gimdb/controller"
|
5
|
+
require "#{$APP_PATH}/lib/gimdb/movie_box"
|
6
|
+
require "#{$APP_PATH}/lib/gimdb/manager_box"
|
29
7
|
|
30
8
|
|
31
|
-
class
|
9
|
+
class Gimdb
|
32
10
|
include GetText
|
33
11
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
@
|
12
|
+
def initialize(ui_file_path)
|
13
|
+
bindtextdomain($DOMAIN, :path => $LOCALEDIR)
|
14
|
+
@builder = Gtk::Builder.new
|
15
|
+
@builder << ui_file_path
|
16
|
+
@builder.translation_domain = $DOMAIN
|
17
|
+
@builder.connect_signals { |handler| method(handler) }
|
39
18
|
@searcher = IMDB.new
|
40
19
|
@movies = []
|
41
20
|
setting_up
|
42
21
|
end
|
43
|
-
|
22
|
+
|
44
23
|
|
45
24
|
private
|
46
25
|
|
47
26
|
|
48
27
|
def setting_up
|
49
28
|
# Get widgets from glade xml file
|
50
|
-
@window = @
|
51
|
-
@sidebar = @
|
52
|
-
@users_menu_item = @
|
53
|
-
@entry_title = @
|
54
|
-
@spin_year_from = @
|
55
|
-
@spin_year_to = @
|
56
|
-
@combo_rating_from = @
|
57
|
-
@combo_rating_to = @
|
58
|
-
@b_search = @
|
59
|
-
@
|
60
|
-
@
|
61
|
-
@
|
62
|
-
@
|
63
|
-
@
|
64
|
-
@
|
65
|
-
@
|
66
|
-
@
|
67
|
-
@
|
29
|
+
@window = @builder['window']
|
30
|
+
@sidebar = @builder['sidebar']
|
31
|
+
@users_menu_item = @builder['users_menu_item']
|
32
|
+
@entry_title = @builder['entry_title']
|
33
|
+
@spin_year_from = @builder['spin_year_from']
|
34
|
+
@spin_year_to = @builder['spin_year_to']
|
35
|
+
@combo_rating_from = @builder['combo_rating_from']
|
36
|
+
@combo_rating_to = @builder['combo_rating_to']
|
37
|
+
@b_search = @builder['b_search']
|
38
|
+
@b_search.image = Gtk::Image.new(Gtk::Stock::ADD, Gtk::IconSize::BUTTON).show
|
39
|
+
@b_cancel = @builder['b_cancel']
|
40
|
+
@combo_sort = @builder['combo_sort']
|
41
|
+
@toggle_sort = @builder['toggle_sort']
|
42
|
+
@check_hide_seen = @builder['check_hide_seen']
|
43
|
+
@check_only_see = @builder['check_only_see']
|
44
|
+
@label_status = @builder['label_status']
|
45
|
+
@progress = @builder['progress']
|
46
|
+
@image_connection = @builder['image_connection']
|
47
|
+
@image_spinner = @builder['image_spinner']
|
48
|
+
@scrolled = @builder['scrolled']
|
68
49
|
@vbox_movies = Gtk::VBox.new
|
69
|
-
@dialog_users = @
|
70
|
-
@dialog_users_box = @
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
@check_genres_all = @
|
50
|
+
@dialog_users = @builder['dialog_users']
|
51
|
+
@dialog_users_box = @builder['dialog_users_box'].pack_start(GtkGimdb::ManagerBox.new(:users, :name) do |t|
|
52
|
+
@label_status.text = _(t)
|
53
|
+
@label_status.show
|
54
|
+
build_users_menu
|
55
|
+
end)
|
56
|
+
@check_genres_all = @builder['check_genres_all']
|
57
|
+
@check_genres_all.signal_connect('clicked') do
|
58
|
+
if @check_genres_all.active?
|
59
|
+
@genres.each do |genre|
|
60
|
+
instance_variable_get("@check_genres_#{genre}").active = false
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
76
64
|
|
77
65
|
@genres = [
|
78
66
|
:action,:adventure,:animation,:biography,:comedy,
|
@@ -81,26 +69,49 @@ class GimdbGlade
|
|
81
69
|
:romance,:sci_fi,:sport,:thriller,:war,:western
|
82
70
|
]
|
83
71
|
@genres.each do |genre|
|
84
|
-
instance_variable_set("@check_genres_#{genre}", @
|
85
|
-
@check_genres_all.active = false
|
72
|
+
instance_variable_set("@check_genres_#{genre}", @builder["check_genres_#{genre}"]).signal_connect('clicked') do
|
73
|
+
@check_genres_all.active = false if instance_variable_get("@check_genres_#{genre}").active?
|
86
74
|
end
|
87
75
|
end
|
88
76
|
|
89
77
|
# Some stuffs
|
90
78
|
@users = User.find(:all, :conditions => 'selected = 1')
|
91
79
|
build_users_menu
|
80
|
+
@spin_year_from.adjustment = Gtk::Adjustment.new(0, 1978, Time.now.year.to_i + 10, 1, 1, 0)
|
81
|
+
@spin_year_from.value = 1978
|
82
|
+
@spin_year_to.adjustment = Gtk::Adjustment.new(0, 1978, Time.now.year.to_i + 10, 1, 1, 0)
|
92
83
|
@spin_year_to.value = Time.now.year.to_i
|
84
|
+
model = Gtk::ListStore.new(String)
|
85
|
+
renderer = Gtk::CellRendererText.new
|
86
|
+
(1..10).each do |val|
|
87
|
+
iter = model.append
|
88
|
+
iter[0] = val.to_s
|
89
|
+
end
|
90
|
+
@combo_rating_from.model = model
|
91
|
+
@combo_rating_from.pack_start(renderer, true)
|
92
|
+
@combo_rating_from.set_attributes(renderer, :text => 0)
|
93
93
|
@combo_rating_from.active = 0
|
94
|
+
@combo_rating_to.model = model
|
95
|
+
@combo_rating_to.pack_start(renderer, true)
|
96
|
+
@combo_rating_to.set_attributes(renderer, :text => 0)
|
94
97
|
@combo_rating_to.active = 9
|
98
|
+
model = Gtk::ListStore.new(String)
|
99
|
+
[_('Movie meter'), _('A-Z'), _('Rating'), _('Number of votes'), _('Runtime'), _('Year')].each do |val|
|
100
|
+
iter = model.append
|
101
|
+
iter[0] = val
|
102
|
+
end
|
103
|
+
@combo_sort.model = model
|
104
|
+
@combo_sort.pack_start(renderer, true)
|
105
|
+
@combo_sort.set_attributes(renderer, :text => 0)
|
95
106
|
@combo_sort.active = 0
|
96
|
-
|
107
|
+
|
108
|
+
@image_spinner.pixbuf_animation = Gdk::PixbufAnimation.new("#{$APP_PATH}/data/icons/spinner16x16.gif")
|
97
109
|
@scrolled.add_with_viewport(@vbox_movies)
|
98
110
|
@scrolled.vscrollbar.signal_connect('value-changed') do |s|
|
99
111
|
x = (s.adjustment.upper * 90.0)/100.0
|
100
112
|
vadj = s.value + s.adjustment.page_size
|
101
|
-
if (vadj > x && vadj > @vadj
|
102
|
-
|
103
|
-
#get_more_movies if @b_search.sensitive?
|
113
|
+
if (vadj > x && vadj > @vadj)
|
114
|
+
run_thread{get_more_movies} if @thread.nil? || !@thread.alive?
|
104
115
|
end
|
105
116
|
@vadj = vadj
|
106
117
|
end
|
@@ -124,7 +135,7 @@ class GimdbGlade
|
|
124
135
|
options[:release_date] = "#{@spin_year_from.value.to_i},#{@spin_year_to.value.to_i}"
|
125
136
|
rating_from = @combo_rating_from.active_text
|
126
137
|
rating_to = @combo_rating_to.active_text
|
127
|
-
if rating_from != '1'
|
138
|
+
if rating_from != '1' || rating_to != '10'
|
128
139
|
options[:user_rating] = "#{rating_from},#{rating_to}"
|
129
140
|
end
|
130
141
|
unless @check_genres_all.active?
|
@@ -147,28 +158,43 @@ class GimdbGlade
|
|
147
158
|
sort = 'runtime'
|
148
159
|
when 5
|
149
160
|
sort = 'year'
|
161
|
+
else
|
162
|
+
sort = 'moviemeter'
|
150
163
|
end
|
151
164
|
options[:sort] = sort + (@toggle_sort.active? ? ',DESC' : '')
|
152
165
|
return options
|
153
166
|
end
|
154
167
|
|
155
168
|
|
169
|
+
def run_thread
|
170
|
+
@searcher_backup = @searcher.clone
|
171
|
+
@thread.kill if @thread
|
172
|
+
@thread = Thread.new{yield}
|
173
|
+
end
|
174
|
+
|
175
|
+
def stop_thread
|
176
|
+
if @thread && @thread.alive?
|
177
|
+
@thread.kill
|
178
|
+
@searcher = @searcher_backup if @searcher_backup
|
179
|
+
end
|
180
|
+
searching(false)
|
181
|
+
end
|
182
|
+
|
156
183
|
def searching(state)
|
157
184
|
if state
|
158
|
-
@b_search.sensitive = false
|
159
185
|
update_progress_bar(0.0, 0.0, _('Searching'))
|
186
|
+
@b_cancel.sensitive = true
|
160
187
|
@progress.show
|
161
188
|
@label_status.show
|
162
189
|
@image_spinner.show
|
163
190
|
else
|
164
|
-
@
|
191
|
+
@b_cancel.sensitive = false
|
165
192
|
@progress.hide
|
166
193
|
@label_status.hide
|
167
194
|
@image_spinner.hide
|
168
195
|
end
|
169
196
|
end
|
170
197
|
|
171
|
-
|
172
198
|
def update_progress_bar(step, max, text = nil)
|
173
199
|
max = 80000 if max.nil? || max == 0
|
174
200
|
fraction = step.to_f / max.to_f
|
@@ -177,64 +203,67 @@ class GimdbGlade
|
|
177
203
|
@label_status.text = _(text) + '...' unless text.nil?
|
178
204
|
end
|
179
205
|
|
180
|
-
|
181
206
|
def get_movies(kind = nil)
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
@movies = Controller::process_info(@searcher, build_options) do |step, max, text|
|
187
|
-
update_progress_bar(step, max, text)
|
188
|
-
end
|
189
|
-
else
|
190
|
-
@movies = Movie.get_kind(@users, kind)
|
207
|
+
searching(true)
|
208
|
+
if kind.nil?
|
209
|
+
@movies = Controller::process_info(@searcher, build_options) do |step, max, text|
|
210
|
+
update_progress_bar(step, max, text)
|
191
211
|
end
|
192
|
-
|
193
|
-
|
194
|
-
searching(false)
|
212
|
+
else
|
213
|
+
@movies = Movie.get_kind(@users, kind)
|
195
214
|
end
|
215
|
+
clear_movies_list
|
216
|
+
update_movies_list
|
217
|
+
searching(false)
|
196
218
|
end
|
197
219
|
|
198
|
-
|
199
220
|
def get_more_movies
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
update_progress_bar(step, max, text)
|
204
|
-
end
|
205
|
-
update_movies_list
|
206
|
-
searching(false)
|
221
|
+
searching(true)
|
222
|
+
@movies += Controller::process_info(@searcher, :next => true, :offline => @offline) do |step, max, text|
|
223
|
+
update_progress_bar(step, max, text)
|
207
224
|
end
|
225
|
+
update_movies_list
|
226
|
+
searching(false)
|
208
227
|
end
|
209
228
|
|
210
|
-
|
211
229
|
def clear_movies_list
|
230
|
+
@movie_index = 0
|
231
|
+
@movie_box_index = 0
|
212
232
|
@scrolled.each { |child| @scrolled.remove(child) }
|
213
233
|
@vbox_movies = Gtk::VBox.new
|
214
234
|
@vbox_movies.border_width = 10
|
215
|
-
@vbox_movies.spacing = 10
|
235
|
+
@vbox_movies.spacing = 10
|
216
236
|
@scrolled.add_with_viewport(@vbox_movies)
|
217
237
|
@scrolled.vscrollbar.adjustment.value = 0
|
238
|
+
@vbox_movies.show_all
|
218
239
|
end
|
219
240
|
|
220
|
-
|
221
241
|
def update_movies_list
|
222
242
|
@progress.fraction = 0
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
end
|
231
|
-
update_progress_bar(i, display_movies.size - 1, 'Building movie boxes')
|
243
|
+
display_movies = @movies[@movie_index..-1]
|
244
|
+
poster_from = @movie_box_index
|
245
|
+
display_movies.each_with_index do |m, i|
|
246
|
+
if ((!@check_hide_seen.active? || (m.get_users(:seen) & @users).empty?) &&
|
247
|
+
(!@check_only_see.active? || !(m.get_users(:to_see) & @users).empty?))
|
248
|
+
@vbox_movies.pack_start(GtkGimdb::MovieBox.new(m, @users), false)
|
249
|
+
@movie_box_index += 1
|
232
250
|
end
|
233
|
-
|
234
|
-
@vbox_movies.show_all
|
251
|
+
update_progress_bar(i, display_movies.size - 1, 'Building movie boxes')
|
235
252
|
end
|
253
|
+
@movie_index = @movies.size
|
254
|
+
set_posters(poster_from) unless @offline
|
236
255
|
end
|
237
256
|
|
257
|
+
def set_posters(from = 0)
|
258
|
+
Thread.new do
|
259
|
+
@vbox_movies.children[from..-1].each do |movie_box|
|
260
|
+
unless movie_box.has_poster?
|
261
|
+
Controller::get_poster(@searcher, movie_box.movie)
|
262
|
+
movie_box.set_poster
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
238
267
|
|
239
268
|
def build_users_menu
|
240
269
|
@users = User.find(:all, :conditions => 'selected = 1')
|
@@ -267,8 +296,8 @@ class GimdbGlade
|
|
267
296
|
|
268
297
|
|
269
298
|
def on_search_clicked(widget, arg = nil)
|
270
|
-
|
271
|
-
#get_movies
|
299
|
+
run_thread{get_movies}
|
300
|
+
#get_movies
|
272
301
|
end
|
273
302
|
|
274
303
|
def on_key_press(widget, arg = nil)
|
@@ -276,20 +305,23 @@ class GimdbGlade
|
|
276
305
|
end
|
277
306
|
|
278
307
|
def on_get_more_movies_clicked(widget, arg = nil)
|
279
|
-
|
280
|
-
#get_more_movies if @b_search.sensitive?
|
308
|
+
run_thread{get_more_movies}
|
281
309
|
end
|
282
310
|
|
283
311
|
def on_show_to_see_clicked(widget, arg = nil)
|
284
|
-
|
312
|
+
run_thread{get_movies(:to_see)}
|
285
313
|
end
|
286
314
|
|
287
315
|
def on_show_seen_clicked(widget, arg = nil)
|
288
|
-
|
316
|
+
run_thread{get_movies(:seen)}
|
289
317
|
end
|
290
318
|
|
291
319
|
def on_show_favourites_clicked(widget, arg = nil)
|
292
|
-
|
320
|
+
run_thread{get_movies(:favourites)}
|
321
|
+
end
|
322
|
+
|
323
|
+
def on_cancel_clicked(widget, arg = nil)
|
324
|
+
stop_thread
|
293
325
|
end
|
294
326
|
|
295
327
|
def on_clean_clicked(widget, arg = nil)
|
@@ -310,9 +342,13 @@ class GimdbGlade
|
|
310
342
|
if @offline
|
311
343
|
@window.title += ' (offline)'
|
312
344
|
@image_connection.show
|
345
|
+
@combo_sort.sensitive = false
|
346
|
+
@toggle_sort.sensitive = false
|
313
347
|
else
|
314
348
|
@window.title = @window.title.gsub(' (offline)', '')
|
315
349
|
@image_connection.hide
|
350
|
+
@combo_sort.sensitive = true
|
351
|
+
@toggle_sort.sensitive = true
|
316
352
|
end
|
317
353
|
end
|
318
354
|
|
@@ -344,7 +380,7 @@ class GimdbGlade
|
|
344
380
|
def on_about_clicked(widget, arg = nil)
|
345
381
|
@dialog_about = Gtk::AboutDialog.new
|
346
382
|
begin
|
347
|
-
f = File.open("#{$
|
383
|
+
f = File.open("#{$APP_PATH}/VERSION", 'r')
|
348
384
|
version = ''
|
349
385
|
f.each_line { |line| version += line }
|
350
386
|
@dialog_about.version = version
|
@@ -352,7 +388,7 @@ class GimdbGlade
|
|
352
388
|
nil
|
353
389
|
end
|
354
390
|
begin
|
355
|
-
f = File.open("#{$
|
391
|
+
f = File.open("#{$APP_PATH}/LICENSE", 'r')
|
356
392
|
license = ''
|
357
393
|
f.each_line { |line| license += line }
|
358
394
|
@dialog_about.license = license
|
@@ -360,9 +396,9 @@ class GimdbGlade
|
|
360
396
|
nil
|
361
397
|
end
|
362
398
|
@dialog_about.program_name = 'GIMDB'
|
363
|
-
@dialog_about.logo = Gdk::Pixbuf.new("#{$
|
399
|
+
@dialog_about.logo = Gdk::Pixbuf.new("#{$APP_PATH}/data/icons/imdb.png")
|
364
400
|
@dialog_about.comments = 'GTK graphical interface for the Internet Movie DataBase.'
|
365
|
-
@dialog_about.copyright = "Copyright
|
401
|
+
@dialog_about.copyright = "Copyright (c) #{Time.now.year} Enrico Pilotto"
|
366
402
|
@dialog_about.website = 'http://github.com/pioz/gimdb'
|
367
403
|
@dialog_about.website_label = 'Website'
|
368
404
|
@dialog_about.authors = ['Enrico Pilotto <enrico@megiston.it>']
|
@@ -374,3 +410,4 @@ class GimdbGlade
|
|
374
410
|
end
|
375
411
|
|
376
412
|
end
|
413
|
+
|