プロジェクト

全般

プロフィール

機能 #453 » change_account.rb.diff

Izumi Tsutsui, 2012-04-09 02:33

差分を表示:

/home/tsutsui/change_account.rb 2012-04-09 01:35:46.000000000 +0900
34 34
    main_windows = Plugin.filtering(:get_windows, Set.new).first
35 35
    alert_thread = if(Thread.main != Thread.current) then Thread.current end
36 36
    dialog = Gtk::Dialog.new(Environment::NAME + " ログイン")
37
    container, key, request_token = main(watch)
37
    container, key, request_token = main(watch, dialog)
38 38
    dialog.set_size_request(600, 400)
39 39
    dialog.window_position = Gtk::Window::POS_CENTER
40 40
    dialog.vbox.pack_start(container, true, true, 30)
......
89 89
    Gtk::VBox.new(false, 0).closeup(attention).closeup(decide)
90 90
  end
91 91

  
92
  def self.main(watch)
92
  def self.main(watch, dialog)
93 93
    goaisatsu = Gtk::VBox.new(false, 0)
94 94
    box = Gtk::VBox.new(false, 8)
95 95
    request_token = watch.request_oauth_token
......
97 97
#       w.add(Gtk::Mumble.new(Message.new(:message => hello(url), :system => true))).show_all
98 98
#     }
99 99
    goaisatsu.add(Gtk::IntelligentTextview.new(hello(request_token.authorize_url)))
100
    user, key_input = gen_input('暗証番号', true)
100
    user, key_input = gen_input('暗証番号', dialog, true)
101 101
    box.closeup(goaisatsu).closeup(user)
102 102
    return box, key_input, request_token
103 103
  end
104 104

  
105
  def self.gen_input(label, visibility=true, default="")
105
  def self.gen_input(label, dialog, visibility=true, default="")
106 106
    container = Gtk::HBox.new(false, 0)
107 107
    input = Gtk::Entry.new
108 108
    input.text = default
109 109
    input.visibility = visibility
110
    input.signal_connect('activate') { |elm|
111
      dialog.response(Gtk::Dialog::RESPONSE_OK) }
110 112
    container.pack_start(Gtk::Label.new(label), false, true, 0)
111 113
    container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
112 114
    return container, input
    (1-1/1)