lib/grumblr/ui.rb in grumblr-2.4.1 vs lib/grumblr/ui.rb in grumblr-2.4.2

- old
+ new

@@ -1,5 +1,7 @@ +# encoding: utf-8 + require 'gtk2' require 'open-uri' require 'fileutils' module Grumblr @@ -309,11 +311,11 @@ show_all end def post - page = @notebook.get_nth_page @notebook.page + page = @notebook.get_nth_page(@notebook.page) message_type = @notebook.get_menu_label_text(page).downcase mandatory_data = collect_data_for(Ppds::Tumblr::MANDATORY_FIELDS, message_type) concurent_data = collect_data_for(Ppds::Tumblr::CONCURENT_FIELDS, message_type) optional_data = collect_data_for(Ppds::Tumblr::OPTIONAL_FIELDS, message_type) @@ -357,10 +359,12 @@ data.merge! mandatory_data data.merge! concurent_data data.merge! optional_data - data.update({:data => File.read(data[:data])}) if data.has_key?(:data) and data[:data] != '' + data.update({ + :data => File.open(data[:data], 'rb') { |f| f.read } + }) if data.has_key?(:data) and data[:data] != '' dump(data) if $DEBUG $api.query 'write', data MessageDialog.new("Message posted", Gtk::Stock::DIALOG_INFO)