lib/grumblr/ui.rb in grumblr-2.0.0 vs lib/grumblr/ui.rb in grumblr-2.0.1

- old
+ new

@@ -1,10 +1,12 @@ require 'gtk2' module Grumblr - DATA_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'data')) + APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) + DATA_ROOT = File.join(APP_ROOT, 'data') + VERSION = File.open(File.join(APP_ROOT,'VERSION')) { |f| f.read } class UI < Gtk::Window attr_accessor :logo @@ -262,14 +264,18 @@ submit_button = Gtk::Button.new 'Send' submit_button.signal_connect(:released) do |widget| post end + @tags = Gtk::Entry.new + button_box = Gtk::HBox.new false, 4 button_box.pack_start clear_button, false button_box.pack_start @private_button, false - button_box.pack_start submit_button + button_box.pack_start Gtk::Label.new('Tags'), false + button_box.pack_start @tags, true + button_box.pack_start submit_button, true ## ### Layout ## pack_start toolbar, false @@ -296,17 +302,20 @@ raise "None of fields %s is set!" % Ppds::Tumblr::CONCURENT_FIELDS[message_type].join(", ") if concurent_data.empty? end optional_data.delete_if { |x,y| y == "" or y.nil? } + tags = @tags.get_value.gsub(/\s+/,',').split(',').uniq.sort - [''] + data = { :generator => 'Grumblr', :email => $cfg.get(:email), :password => $cfg.get(:password), :channel_id => $app.blog.name, :group => $app.blog.name + '.tumblr.com', :type => message_type, + :tags => tags.join(','), :format => @format.active? ? 'markdown' : 'html', :private => @private_button.active? ? 1 : 0 } data.merge! mandatory_data @@ -375,10 +384,11 @@ [ Ppds::Tumblr::MANDATORY_FIELDS, Ppds::Tumblr::CONCURENT_FIELDS, Ppds::Tumblr::OPTIONAL_FIELDS ].each do |fieldset| reset_fields_for(fieldset, message_type) end + @tags.clear end end class MessageDialog < Gtk::Dialog def initialize(text, stock = Gtk::Stock::DIALOG_ERROR) @@ -425,11 +435,11 @@ button.signal_connect(:released) { login } hbox.pack_start button header = Gtk::Label.new header.set_alignment 0.0, 0.8 - header.set_markup '<big><big><b>Grumblr 2.0</b></big></big>' + header.set_markup '<big><big><b>Grumblr 2</b></big></big>' vbox = Gtk::VBox.new false, 4 vbox.pack_start header vbox.pack_with_label '_Email', @text_e vbox.pack_with_label '_Password', @text_p @@ -470,10 +480,10 @@ system("xdg-open #{url}") end super self.logo = $gui.logo self.program_name = 'Grumblr' - self.version = '2.0.0' + self.version = Grumblr::VERSION self.copyright = "Copyright (c)2009, Paul Philippov" self.comments = "Tumblr companion for GNOME" self.license = "New BSD License.\nhttp://creativecommons.org/licenses/BSD/" self.website = "http://themactep.com/grumblr/" self.authors = ['Paul Philippov <themactep@gmail.com>']