致命的 #525 » a.diff
core/mui/gtk_intelligent_textview.rb (作業コピー) | ||
---|---|---|
167 | 167 | |
168 | 168 |
Plugin.create :gtk_intelligent_textview do |
169 | 169 |
on_entity_linkrule_added do |rule| |
170 |
Gtk::IntelligentTextview.addlinkrule(rule[:regexp], lambda{ |seg, tv| rule[:callback].call(face: seg, url: seg, textview: tv) }) if rule[:regexp] |
|
170 |
::Gtk::IntelligentTextview.addlinkrule(rule[:regexp], lambda{ |seg, tv| rule[:callback].call(face: seg, url: seg, textview: tv) }) if rule[:regexp]
|
|
171 | 171 |
end |
172 | 172 |
end |
core/mui/cairo_sub_parts_retweet.rb (作業コピー) | ||
---|---|---|
27 | 27 |
begin |
28 | 28 |
mp.subparts.find{ |sp| sp.class == Gdk::SubPartsRetweet }.add(retweet[:user]) |
29 | 29 |
mp.on_modify |
30 |
rescue Gtk::MiraclePainter::DestroyedError |
|
30 |
rescue ::Gtk::MiraclePainter::DestroyedError
|
|
31 | 31 |
nil end end } }.terminate("retweet error") } end |
32 | 32 | |
33 | 33 |
on_retweet_destroyed do |source, user, retweet_id| |
... | ... | |
37 | 37 |
begin |
38 | 38 |
mp.subparts.find{ |sp| sp.class == Gdk::SubPartsRetweet }.delete(user) |
39 | 39 |
mp.on_modify |
40 |
rescue Gtk::MiraclePainter::DestroyedError |
|
40 |
rescue ::Gtk::MiraclePainter::DestroyedError
|
|
41 | 41 |
nil end end }.terminate("retweet destroy error") |
42 | 42 |
} |
43 | 43 |
end |
core/plugin/proxy/proxy.rb (作業コピー) | ||
---|---|---|
58 | 58 |
end |
59 | 59 | |
60 | 60 |
# def settings |
61 |
# box = Gtk::VBox.new(false, 8) |
|
61 |
# box = ::Gtk::VBox.new(false, 8)
|
|
62 | 62 | |
63 |
# radio_tag = radio_specify = Gtk::RadioButton.new('自分で設定する') |
|
64 |
# radio_envval = Gtk::RadioButton.new(radio_tag, '環境変数の設定を使う') |
|
65 |
# radio_disable = Gtk::RadioButton.new(radio_tag, 'プロキシを使わない') |
|
63 |
# radio_tag = radio_specify = ::Gtk::RadioButton.new('自分で設定する')
|
|
64 |
# radio_envval = ::Gtk::RadioButton.new(radio_tag, '環境変数の設定を使う')
|
|
65 |
# radio_disable = ::Gtk::RadioButton.new(radio_tag, 'プロキシを使わない')
|
|
66 | 66 | |
67 | 67 |
# case UserConfig[:proxy_enabled] |
68 | 68 |
# when :specify |
... | ... | |
104 | 104 |
# UserConfig.connect(:proxy_cert){ |key, new_val, before_val, id| |
105 | 105 |
# us.sensitive = pw.sensitive = new_val } |
106 | 106 | |
107 |
# Gtk::EventBox.new.add(Gtk::VBox.new(false, 8).closeup(sv).closeup(pt).closeup(auth_group))
|
|
107 |
# ::Gtk::EventBox.new.add(::Gtk::VBox.new(false, 8).closeup(sv).closeup(pt).closeup(auth_group))
|
|
108 | 108 |
# end |
109 | 109 | |
110 | 110 |
# def gen_envval_ev |
... | ... | |
114 | 114 |
# pt = Mtk.input(env_getter[1], "ポート"){|c,i|i.sensitive = false} |
115 | 115 |
# us = Mtk.input(env_getter[2], "ユーザ"){|c,i|i.sensitive = false} |
116 | 116 |
# pw = Mtk.input(env_getter[3], "パスワード"){|c,i|i.sensitive = false} |
117 |
# Gtk::EventBox.new.add(Gtk::VBox.new(false, 8).closeup(sv).closeup(pt).closeup(us).closeup(pw))
|
|
117 |
# ::Gtk::EventBox.new.add(::Gtk::VBox.new(false, 8).closeup(sv).closeup(pt).closeup(us).closeup(pw))
|
|
118 | 118 |
# end |
119 | 119 | |
120 | 120 |
# end |
core/plugin/shortcutkey/shortcutkey.rb (作業コピー) | ||
---|---|---|
1 | 1 |
# -*- coding:utf-8 -*- |
2 | 2 | |
3 | 3 |
Plugin.create :shortcutkey do |
4 |
class ShortcutKeyListView < Gtk::CRUD |
|
4 |
class ShortcutKeyListView < ::Gtk::CRUD
|
|
5 | 5 | |
6 | 6 |
COLUMN_KEYBIND = 0 |
7 | 7 |
COLUMN_COMMAND = 1 |
core/plugin/gtk/gtk.rb (作業コピー) | ||
---|---|---|
8 | 8 |
require File.expand_path File.join(File.dirname(__FILE__), 'delayer') |
9 | 9 | |
10 | 10 |
Plugin.create :gtk do |
11 |
@windows_by_slug = {} # slug => Gtk::MikutterWindow |
|
12 |
@panes_by_slug = {} # slug => Gtk::NoteBook |
|
13 |
@tabs_by_slug = {} # slug => Gtk::EventBox |
|
14 |
@timelines_by_slug = {} # slug => Gtk::TimeLine |
|
15 |
@profiles_by_slug = {} # slug => Gtk::NoteBook |
|
16 |
@profiletabs_by_slug = {} # slug => Gtk::EventBox |
|
17 |
@tabchildwidget_by_slug = {} # slug => Gtk::TabChildWidget |
|
18 |
@postboxes_by_slug = {} # slug => Gtk::Postbox |
|
11 |
@windows_by_slug = {} # slug => ::Gtk::MikutterWindow
|
|
12 |
@panes_by_slug = {} # slug => ::Gtk::NoteBook
|
|
13 |
@tabs_by_slug = {} # slug => ::Gtk::EventBox
|
|
14 |
@timelines_by_slug = {} # slug => ::Gtk::TimeLine
|
|
15 |
@profiles_by_slug = {} # slug => ::Gtk::NoteBook
|
|
16 |
@profiletabs_by_slug = {} # slug => ::Gtk::EventBox
|
|
17 |
@tabchildwidget_by_slug = {} # slug => ::Gtk::TabChildWidget
|
|
18 |
@postboxes_by_slug = {} # slug => ::Gtk::Postbox
|
|
19 | 19 |
@tabs_promise = {} # slug => Deferred |
20 | 20 | |
21 |
TABPOS = [Gtk::POS_TOP, Gtk::POS_BOTTOM, Gtk::POS_LEFT, Gtk::POS_RIGHT]
|
|
21 |
TABPOS = [::Gtk::POS_TOP, ::Gtk::POS_BOTTOM, ::Gtk::POS_LEFT, ::Gtk::POS_RIGHT]
|
|
22 | 22 | |
23 | 23 |
# ウィンドウ作成。 |
24 |
# PostBoxとか複数のペインを持つための処理が入るので、Gtk::MikutterWindowクラスを新設してそれを使う |
|
24 |
# PostBoxとか複数のペインを持つための処理が入るので、::Gtk::MikutterWindowクラスを新設してそれを使う
|
|
25 | 25 |
on_window_created do |i_window| |
26 | 26 |
notice "create window #{i_window.slug.inspect}" |
27 |
window = Gtk::MikutterWindow.new |
|
27 |
window = ::Gtk::MikutterWindow.new
|
|
28 | 28 |
@windows_by_slug[i_window.slug] = window |
29 | 29 |
window.title = i_window.name |
30 | 30 |
window.set_size_request(240, 240) |
... | ... | |
53 | 53 |
window.ssc("destroy"){ |
54 | 54 |
Delayer.freeze |
55 | 55 |
window.destroy |
56 |
Gtk::Object.main_quit |
|
56 |
::Gtk::Object.main_quit
|
|
57 | 57 |
# Gtk.main_quit |
58 | 58 |
false } |
59 | 59 |
window.ssc(:focus_in_event) { |
... | ... | |
61 | 61 |
false |
62 | 62 |
} |
63 | 63 |
window.ssc('key_press_event'){ |widget, event| |
64 |
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_window) } |
|
64 |
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_window) }
|
|
65 | 65 |
window.show_all |
66 | 66 |
end |
67 | 67 | |
... | ... | |
71 | 71 |
window.icon = Gdk::Pixbuf.new(icon, 256, 256) end end |
72 | 72 | |
73 | 73 |
# ペイン作成。 |
74 |
# ペインはGtk::NoteBook |
|
74 |
# ペインは::Gtk::NoteBook
|
|
75 | 75 |
on_pane_created do |i_pane| |
76 | 76 |
pane = create_pane(i_pane) |
77 | 77 |
pane.set_tab_border(0).set_group_id(0).set_scrollable(true) |
... | ... | |
93 | 93 |
else |
94 | 94 |
notice "switch_page: pagenum(#{pagenum}) != pane.page(#{pane.page})" end } |
95 | 95 |
pane.signal_connect(:page_added){ |this, tabcontainer, index| |
96 |
type_strict tabcontainer => Gtk::TabContainer |
|
96 |
type_strict tabcontainer => ::Gtk::TabContainer
|
|
97 | 97 |
notice "on_pane_created: page_added: #{i_pane.inspect}" |
98 | 98 |
window_order_save_request(i_pane.parent) if i_pane.parent |
99 | 99 |
i_tab = tabcontainer.i_tab |
... | ... | |
113 | 113 |
end |
114 | 114 | |
115 | 115 |
# タブ作成。 |
116 |
# タブには実体が無いので、タブのアイコンのところをGtk::EventBoxにしておいて、それを実体ということにしておく |
|
116 |
# タブには実体が無いので、タブのアイコンのところを::Gtk::EventBoxにしておいて、それを実体ということにしておく
|
|
117 | 117 |
on_tab_created do |i_tab| |
118 | 118 |
tab = create_tab(i_tab) |
119 | 119 |
if @tabs_promise[i_tab.slug] |
... | ... | |
130 | 130 |
# ==== Args |
131 | 131 |
# [i_tab] タブ |
132 | 132 |
# ==== Return |
133 |
# Tab(Gtk::EventBox) |
|
133 |
# Tab(::Gtk::EventBox)
|
|
134 | 134 |
def create_tab(i_tab) |
135 | 135 |
notice "create tab #{i_tab.slug.inspect}" |
136 |
tab = Gtk::EventBox.new.tooltip(i_tab.name) |
|
136 |
tab = ::Gtk::EventBox.new.tooltip(i_tab.name)
|
|
137 | 137 |
if i_tab.is_a? Plugin::GUI::Tab |
138 | 138 |
@tabs_by_slug[i_tab.slug] = tab |
139 | 139 |
elsif i_tab.is_a? Plugin::GUI::ProfileTab |
... | ... | |
144 | 144 |
false |
145 | 145 |
} |
146 | 146 |
tab.ssc(:key_press_event){ |widget, event| |
147 |
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_tab) } |
|
147 |
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_tab) }
|
|
148 | 148 |
tab.ssc(:button_press_event) { |this, e| |
149 | 149 |
if e.button == 3 |
150 | 150 |
Plugin::GUI::Command.menu_pop(i_tab) end |
... | ... | |
155 | 155 |
tab.show_all end |
156 | 156 | |
157 | 157 |
# タイムライン作成。 |
158 |
# Gtk::TimeLine |
|
158 |
# ::Gtk::TimeLine
|
|
159 | 159 |
on_timeline_created do |i_timeline| |
160 | 160 |
notice "create timeline #{i_timeline.slug.inspect}" |
161 |
timeline = Gtk::TimeLine.new(i_timeline) |
|
161 |
timeline = ::Gtk::TimeLine.new(i_timeline)
|
|
162 | 162 |
@timelines_by_slug[i_timeline.slug] = timeline |
163 | 163 |
focus_in_event = lambda { |this, event| |
164 | 164 |
if this.focus? |
... | ... | |
174 | 174 |
timeline.tl.ssc(:focus_in_event, &focus_in_event) |
175 | 175 |
timeline.tl.ssc(:destroy, &destroy_event) |
176 | 176 |
timeline.ssc('key_press_event'){ |widget, event| |
177 |
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_timeline) } |
|
177 |
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_timeline) }
|
|
178 | 178 |
timeline.ssc(:destroy){ |
179 | 179 |
i_timeline.destroy |
180 | 180 |
false } |
... | ... | |
208 | 208 |
next if not widget |
209 | 209 |
tab = widgetof(i_tab) |
210 | 210 |
pane = widgetof(i_pane) |
211 |
old_pane = widget.get_ancestor(Gtk::Notebook) |
|
211 |
old_pane = widget.get_ancestor(::Gtk::Notebook)
|
|
212 | 212 |
notice "pane: #{pane}, old_pane: #{old_pane}" |
213 | 213 |
if tab and pane and old_pane and pane != old_pane |
214 | 214 |
notice "#{widget} removes by #{old_pane}" |
... | ... | |
217 | 217 |
if page_num |
218 | 218 |
tab.parent.remove_page(page_num) |
219 | 219 |
else |
220 |
raise Plugin::Gtk::GtkError, "#{tab} not found in #{tab.parent}" end end
|
|
220 |
raise ::Gtk::GtkError, "#{tab} not found in #{tab.parent}" end end |
|
221 | 221 |
notice "#{widget} pack to #{tab}" |
222 | 222 |
i_tab.children.each{ |i_child| |
223 | 223 |
w_child = widgetof(i_child) |
... | ... | |
251 | 251 |
i_postbox.active!(true, true) |
252 | 252 |
false } |
253 | 253 |
postbox.post.ssc('key_press_event'){ |widget, event| |
254 |
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_postbox) } |
|
254 |
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_postbox) }
|
|
255 | 255 |
postbox.post.ssc(:destroy){ |
256 | 256 |
i_postbox.destroy |
257 | 257 |
false } |
... | ... | |
263 | 263 |
on_gui_contextmenu do |event, contextmenu| |
264 | 264 |
widget = widgetof(event.widget) |
265 | 265 |
if widget |
266 |
Gtk::ContextMenu.new(*contextmenu).popup(widget, event) end end |
|
266 |
::Gtk::ContextMenu.new(*contextmenu).popup(widget, event) end end
|
|
267 | 267 | |
268 | 268 |
on_gui_timeline_clear do |i_timeline| |
269 | 269 |
timeline = widgetof(i_timeline) |
... | ... | |
434 | 434 |
if container |
435 | 435 |
return container.pack_start(widget, i_tab.pack_rule[container.children.size]) end end |
436 | 436 |
if tab.parent |
437 |
raise Plugin::Gtk::GtkError, "Gtk Widget #{tab.inspect} of Tab(#{i_tab.slug.inspect}) has parent Gtk Widget #{tab.parent.inspect}" end
|
|
438 |
container = Gtk::TabContainer.new(i_tab).show_all |
|
437 |
raise ::Gtk::GtkError, "Gtk Widget #{tab.inspect} of Tab(#{i_tab.slug.inspect}) has parent Gtk Widget #{tab.parent.inspect}" end |
|
438 |
container = ::Gtk::TabContainer.new(i_tab).show_all
|
|
439 | 439 |
container.ssc(:key_press_event){ |w, event| |
440 |
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_tab) } |
|
440 |
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_tab) }
|
|
441 | 441 |
container.pack_start(widget, i_tab.pack_rule[container.children.size]) |
442 | 442 |
pane.insert_page_menu(where_should_insert_it(i_tab, pane.children.map(&:i_tab), i_pane.children), container, tab) |
443 | 443 |
pane.set_tab_reorderable(container, true).set_tab_detachable(container, true) |
... | ... | |
449 | 449 |
if tab |
450 | 450 |
tab.remove(tab.child) if tab.child |
451 | 451 |
if i_tab.icon.is_a?(String) |
452 |
tab.add(Gtk::WebIcon.new(i_tab.icon, 24, 24).show) |
|
452 |
tab.add(::Gtk::WebIcon.new(i_tab.icon, 24, 24).show)
|
|
453 | 453 |
else |
454 |
tab.add(Gtk::Label.new(i_tab.name).show) end end |
|
454 |
tab.add(::Gtk::Label.new(i_tab.name).show) end end
|
|
455 | 455 |
self end |
456 | 456 | |
457 | 457 |
def get_window_geometry(slug) |
... | ... | |
468 | 468 |
# ==== Args |
469 | 469 |
# [i_pane] ペイン |
470 | 470 |
# ==== Return |
471 |
# ペイン(Gtk::Notebook) |
|
471 |
# ペイン(::Gtk::Notebook)
|
|
472 | 472 |
def create_pane(i_pane) |
473 | 473 |
notice "create pane #{i_pane.slug.inspect}" |
474 |
pane = Gtk::Notebook.new |
|
474 |
pane = ::Gtk::Notebook.new
|
|
475 | 475 |
if i_pane.is_a? Plugin::GUI::Pane |
476 | 476 |
@panes_by_slug[i_pane.slug] = pane |
477 | 477 |
elsif i_pane.is_a? Plugin::GUI::Profile |
478 | 478 |
@profiles_by_slug[i_pane.slug] = pane end |
479 | 479 |
pane.ssc('key_press_event'){ |widget, event| |
480 |
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_pane) } |
|
480 |
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_pane) }
|
|
481 | 481 |
pane.ssc(:destroy){ |
482 | 482 |
i_pane.destroy if i_pane.destroyed? |
483 | 483 |
false } |
... | ... | |
552 | 552 |
# ==== Return |
553 | 553 |
# _widget_ に対応するウィジェットオブジェクトまたは偽 |
554 | 554 |
def find_implement_widget_by_gtkwidget(widget) |
555 |
type_strict widget => Gtk::Widget |
|
555 |
type_strict widget => ::Gtk::Widget
|
|
556 | 556 |
[ |
557 | 557 |
[@windows_by_slug, Plugin::GUI::Window], |
558 | 558 |
[@panes_by_slug, Plugin::GUI::Pane], |
core/plugin/gtk/mikutter_window.rb (作業コピー) | ||
---|---|---|
2 | 2 | |
3 | 3 |
require "gtk2" |
4 | 4 | |
5 |
class Gtk::MikutterWindow < Gtk::Window
|
|
5 |
class ::Gtk::MikutterWindow < ::Gtk::Window
|
|
6 | 6 | |
7 | 7 |
attr_reader :panes, :statusbar |
8 | 8 | |
9 | 9 |
def initialize(*args) |
10 | 10 |
super |
11 |
@container = Gtk::VBox.new(false, 0) |
|
12 |
@panes = Gtk::HBox.new(true, 0) |
|
13 |
@postboxes = Gtk::VBox.new(false, 0) |
|
11 |
@container = ::Gtk::VBox.new(false, 0)
|
|
12 |
@panes = ::Gtk::HBox.new(true, 0)
|
|
13 |
@postboxes = ::Gtk::VBox.new(false, 0)
|
|
14 | 14 |
add(@container.closeup(@postboxes).pack_start(@panes).closeup(create_statusbar)) |
15 | 15 |
end |
16 | 16 | |
17 | 17 |
def add_postbox(i_postbox) |
18 |
postbox = Gtk::PostBox.new(i_postbox.poster || Service.primary, {postboxstorage: @postboxes, delegate_other: true}.merge(i_postbox.options||{})) |
|
18 |
postbox = ::Gtk::PostBox.new(i_postbox.poster || Service.primary, {postboxstorage: @postboxes, delegate_other: true}.merge(i_postbox.options||{}))
|
|
19 | 19 |
@postboxes.pack_start(postbox) |
20 | 20 |
set_focus(postbox.post) |
21 | 21 |
postbox.show_all end |
22 | 22 | |
23 | 23 |
# def set_focus(widget) |
24 |
# if widget.is_a? Gtk::TimeLine |
|
24 |
# if widget.is_a? ::Gtk::TimeLine
|
|
25 | 25 |
|
26 | 26 |
# end |
27 | 27 |
# end |
... | ... | |
30 | 30 | |
31 | 31 |
# ステータスバーを返す |
32 | 32 |
# ==== Return |
33 |
# Gtk::Statusbar |
|
33 |
# ::Gtk::Statusbar
|
|
34 | 34 |
def create_statusbar |
35 |
statusbar = Gtk::Statusbar.new |
|
35 |
statusbar = ::Gtk::Statusbar.new
|
|
36 | 36 |
notice "statusbar: context id: #{statusbar.get_context_id("system")}" |
37 | 37 |
statusbar.push(statusbar.get_context_id("system"), "mikutterの誕生以来、最も大きな驚きを") |
38 |
status_button = Gtk::Button.new.add(Gtk::WebIcon.new(MUI::Skin.get("settings.png"), 16, 16))
|
|
39 |
status_button.relief = Gtk::RELIEF_NONE |
|
38 |
status_button = ::Gtk::Button.new.add(::Gtk::WebIcon.new(MUI::Skin.get("settings.png"), 16, 16))
|
|
39 |
status_button.relief = ::Gtk::RELIEF_NONE
|
|
40 | 40 |
status_button.ssc(:clicked) { |
41 | 41 |
Plugin.call(:gui_setting) } |
42 | 42 |
@statusbar = statusbar.closeup(status_button) end |
core/plugin/activity/activity.rb (作業コピー) | ||
---|---|---|
51 | 51 |
end |
52 | 52 | |
53 | 53 |
Plugin.create(:activity) do |
54 |
class ActivityView < Gtk::CRUD |
|
55 |
include Gtk::TreeViewPrettyScroll |
|
54 |
class ActivityView < ::Gtk::CRUD
|
|
55 |
include ::Gtk::TreeViewPrettyScroll
|
|
56 | 56 | |
57 | 57 |
ICON = 0 |
58 | 58 |
KIND = 1 |
... | ... | |
111 | 111 |
not result.all?(&ret_nth) end |
112 | 112 | |
113 | 113 |
activity_view = ActivityView.new |
114 |
activity_vscrollbar = Gtk::VScrollbar.new(activity_view.vadjustment) |
|
115 |
activity_hscrollbar = Gtk::HScrollbar.new(activity_view.hadjustment) |
|
116 |
activity_shell = Gtk::Table.new(2, 2) |
|
117 |
activity_description = Gtk::IntelligentTextview.new |
|
118 |
activity_status = Gtk::Label.new |
|
119 |
activity_container = Gtk::VBox.new |
|
114 |
activity_vscrollbar = ::Gtk::VScrollbar.new(activity_view.vadjustment)
|
|
115 |
activity_hscrollbar = ::Gtk::HScrollbar.new(activity_view.hadjustment)
|
|
116 |
activity_shell = ::Gtk::Table.new(2, 2)
|
|
117 |
activity_description = ::Gtk::IntelligentTextview.new
|
|
118 |
activity_status = ::Gtk::Label.new
|
|
119 |
activity_container = ::Gtk::VBox.new
|
|
120 | 120 | |
121 | 121 |
activity_container. |
122 | 122 |
pack_start(activity_shell. |
123 |
attach(activity_view, 0, 1, 0, 1, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND).
|
|
124 |
attach(activity_vscrollbar, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK|Gtk::FILL).
|
|
125 |
attach(activity_hscrollbar, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::FILL)).
|
|
123 |
attach(activity_view, 0, 1, 0, 1, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND).
|
|
124 |
attach(activity_vscrollbar, 1, 2, 0, 1, ::Gtk::FILL, ::Gtk::SHRINK|::Gtk::FILL).
|
|
125 |
attach(activity_hscrollbar, 0, 1, 1, 2, ::Gtk::SHRINK|::Gtk::FILL, ::Gtk::FILL)).
|
|
126 | 126 |
closeup(activity_description). |
127 | 127 |
closeup(activity_status.right) |
128 | 128 |
core/plugin/openimg/openimg.rb (作業コピー) | ||
---|---|---|
14 | 14 |
def changesize(eb, w, url) |
15 | 15 |
eb.remove(eb.children.first) |
16 | 16 |
@size = w.window.geometry[2,2].freeze |
17 |
eb.add(Gtk::WebIcon.new(url, *@size).show_all) |
|
17 |
eb.add(::Gtk::WebIcon.new(url, *@size).show_all)
|
|
18 | 18 |
@size end |
19 | 19 | |
20 | 20 |
def redraw(eb, pb) |
... | ... | |
25 | 25 |
eb.window.draw_pixbuf(nil, pb, 0, 0, (ew - pb.width)/2, (eh - pb.height)/2, -1, -1, Gdk::RGB::DITHER_NORMAL, 0, 0) end |
26 | 26 | |
27 | 27 |
def display(url, cancel = nil) |
28 |
w = Gtk::Window.new.set_title("(読み込み中)") |
|
28 |
w = ::Gtk::Window.new.set_title("(読み込み中)")
|
|
29 | 29 |
w.set_size_request(320, 240) |
30 | 30 |
w.set_default_size(*@size).move(*@position) |
31 | 31 |
w.signal_connect(:destroy){ w.destroy } |
32 |
eventbox = Gtk::EventBox.new |
|
32 |
eventbox = ::Gtk::EventBox.new
|
|
33 | 33 |
w.add(eventbox) |
34 | 34 |
size = DEFAULT_SIZE |
35 | 35 |
Thread.new{ |
... | ... | |
150 | 150 |
def addsupport(cond, element_rule = {}, &block) |
151 | 151 |
element_rule.freeze |
152 | 152 |
if block == nil |
153 |
Gtk::TimeLine.addopenway(cond){ |shrinked_url, cancel| |
|
153 |
::Gtk::TimeLine.addopenway(cond){ |shrinked_url, cancel|
|
|
154 | 154 |
url = MessageConverters.expand_url_one(shrinked_url) |
155 | 155 |
Delayer.new(Delayer::NORMAL, Thread.new{ imgurlresolver(url, element_rule) }){ |url| |
156 | 156 |
display(url, cancel) |
157 | 157 |
} |
158 | 158 |
} |
159 | 159 |
else |
160 |
Gtk::TimeLine.addopenway(cond){ |shrinked_url, cancel| |
|
160 |
::Gtk::TimeLine.addopenway(cond){ |shrinked_url, cancel|
|
|
161 | 161 |
url = MessageConverters.expand_url_one(shrinked_url) |
162 | 162 |
Delayer.new(Delayer::NORMAL, Thread.new{ |
163 | 163 |
imgurlresolver(url, element_rule){ |url| block.call(url, cancel) } |
... | ... | |
185 | 185 |
end |
186 | 186 |
} |
187 | 187 | |
188 |
Gtk::TimeLine.addopenway(/.*\.(?:jpg|png|gif|)$/) { |shrinked_url, cancel| |
|
188 |
::Gtk::TimeLine.addopenway(/.*\.(?:jpg|png|gif|)$/) { |shrinked_url, cancel|
|
|
189 | 189 |
url = MessageConverters.expand_url_one(shrinked_url) |
190 | 190 |
Delayer.new(Delayer::NORMAL) { display(url, cancel) } |
191 | 191 |
} |
core/plugin/settings/select.rb (作業コピー) | ||
---|---|---|
34 | 34 |
# ウィジェット |
35 | 35 |
def build(label, config) |
36 | 36 |
if has_widget? |
37 |
group = Gtk::Frame.new.set_border_width(8) |
|
37 |
group = ::Gtk::Frame.new.set_border_width(8)
|
|
38 | 38 |
group.set_label(label) |
39 | 39 |
group.add(build_box(Plugin::Settings::Listener[config])) |
40 | 40 |
group |
41 | 41 |
else |
42 |
Gtk::HBox.new(false, 0).add(Gtk::Label.new(label).left).closeup(build_combobox(Plugin::Settings::Listener[config])) end end
|
|
42 |
::Gtk::HBox.new(false, 0).add(::Gtk::Label.new(label).left).closeup(build_combobox(Plugin::Settings::Listener[config])) end end
|
|
43 | 43 | |
44 | 44 |
private |
45 | 45 | |
46 | 46 |
def build_box(listener) |
47 |
box = Gtk::VBox.new |
|
48 |
group = Gtk::RadioButton.new |
|
47 |
box = ::Gtk::VBox.new
|
|
48 |
group = ::Gtk::RadioButton.new
|
|
49 | 49 | |
50 | 50 |
options = @options |
51 | 51 |
box.instance_eval{ |
52 | 52 |
options.each{ |value, face, setting| |
53 | 53 |
radio = nil |
54 | 54 |
if (not setting) and face.is_a? String |
55 |
closeup radio = Gtk::RadioButton.new(group, face) |
|
55 |
closeup radio = ::Gtk::RadioButton.new(group, face)
|
|
56 | 56 |
elsif setting.is_a? Plugin::Settings |
57 | 57 |
if face.is_a? String |
58 |
container = Gtk::Table.new(2, 2) |
|
59 |
radio = Gtk::RadioButton.new(group) |
|
60 |
container.attach(radio, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL)
|
|
61 |
container.attach(Gtk::Label.new(face).left, 1, 2, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::FILL)
|
|
62 |
container.attach(setting, 1, 2, 1, 2, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND)
|
|
58 |
container = ::Gtk::Table.new(2, 2)
|
|
59 |
radio = ::Gtk::RadioButton.new(group)
|
|
60 |
container.attach(radio, 0, 1, 0, 1, ::Gtk::FILL, ::Gtk::FILL)
|
|
61 |
container.attach(::Gtk::Label.new(face).left, 1, 2, 0, 1, ::Gtk::SHRINK|::Gtk::FILL, ::Gtk::FILL)
|
|
62 |
container.attach(setting, 1, 2, 1, 2, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND)
|
|
63 | 63 |
closeup container |
64 | 64 |
else |
65 |
container = Gtk::HBox.new |
|
66 |
radio = Gtk::RadioButton.new(group) |
|
65 |
container = ::Gtk::HBox.new
|
|
66 |
radio = ::Gtk::RadioButton.new(group)
|
|
67 | 67 |
closeup container.closeup(radio).add(setting) end |
68 | 68 |
end |
69 | 69 |
radio.signal_connect('toggled'){ |widget| |
70 | 70 |
listener.set value if widget.active? |
71 |
setting.sensitive = widget.active? if setting.is_a? Gtk::Widget } |
|
71 |
setting.sensitive = widget.active? if setting.is_a? ::Gtk::Widget }
|
|
72 | 72 |
notice "#{listener.get.inspect} == #{value.inspect}" |
73 | 73 |
radio.active = listener.get == value |
74 |
face.sensitive = radio.active? if face.is_a? Gtk::Widget } } |
|
74 |
face.sensitive = radio.active? if face.is_a? ::Gtk::Widget } }
|
|
75 | 75 |
box end |
76 | 76 | |
77 | 77 |
# すべてテキストなら、コンボボックスで要素を描画する |
78 | 78 |
def build_combobox(listener) |
79 |
input = Gtk::ComboBox.new(true) |
|
79 |
input = ::Gtk::ComboBox.new(true)
|
|
80 | 80 |
sorted = @options.map{ |o| o.first }.sort_by(&:to_s).freeze |
81 | 81 |
sorted.each{ |x| |
82 | 82 |
input.append_text(@options.assoc(x).last) } |
core/plugin/settings/settings.rb (作業コピー) | ||
---|---|---|
8 | 8 |
def setting_window |
9 | 9 |
return @window if defined?(@window) and @window |
10 | 10 |
record_order = UserConfig[:settings_menu_order] || ["基本設定", "入力", "表示", "通知", "ショートカットキー", "アクティビティ", "アカウント情報"] |
11 |
@window = window = Gtk::Window.new("設定") |
|
11 |
@window = window = ::Gtk::Window.new("設定")
|
|
12 | 12 |
window.set_size_request(320, 240) |
13 | 13 |
window.set_default_size(640, 480) |
14 | 14 |
widgets_dict = {} |
15 | 15 |
menu = menu_widget(widgets_dict) |
16 |
settings = Gtk::VBox.new.set_no_show_all(true).show |
|
17 |
scrolled = Gtk::ScrolledWindow.new.set_hscrollbar_policy(Gtk::POLICY_NEVER)
|
|
16 |
settings = ::Gtk::VBox.new.set_no_show_all(true).show
|
|
17 |
scrolled = ::Gtk::ScrolledWindow.new.set_hscrollbar_policy(::Gtk::POLICY_NEVER)
|
|
18 | 18 |
Plugin.filtering(:defined_settings, []).first.each{ |title, definition, plugin| |
19 | 19 |
iter = menu.model.append |
20 | 20 |
iter[0] = title |
... | ... | |
26 | 26 |
@window = nil |
27 | 27 |
false } |
28 | 28 | |
29 |
window.add(Gtk::HPaned.new.add1(menu).add2(scrolled.add_with_viewport(settings))) end |
|
29 |
window.add(::Gtk::HPaned.new.add1(menu).add2(scrolled.add_with_viewport(settings))) end
|
|
30 | 30 | |
31 | 31 |
def menu_widget(widgets_dict) |
32 |
column = Gtk::TreeViewColumn.new("", Gtk::CellRendererText.new, text: 0)
|
|
33 |
menumodel = Gtk::ListStore.new(String, Integer) |
|
34 |
menumodel.set_sort_column_id(1, order = Gtk::SORT_ASCENDING) |
|
35 |
menu = Gtk::TreeView.new(menumodel).set_headers_visible(false) |
|
32 |
column = ::Gtk::TreeViewColumn.new("", ::Gtk::CellRendererText.new, text: 0)
|
|
33 |
menumodel = ::Gtk::ListStore.new(String, Integer)
|
|
34 |
menumodel.set_sort_column_id(1, order = ::Gtk::SORT_ASCENDING)
|
|
35 |
menu = ::Gtk::TreeView.new(menumodel).set_headers_visible(false)
|
|
36 | 36 |
menu.append_column(column) |
37 | 37 |
menu.signal_connect(:cursor_changed) { |
38 | 38 |
if menu.selection.selected |
core/plugin/settings/builder.rb (作業コピー) | ||
---|---|---|
19 | 19 |
(チェックボックス)。明確にウィジェットを設定できるわけではなくて、値の意味を定義するだけなので、 |
20 | 20 |
前後関係などに影響されてウィジェットが変わる場合があるかも。 |
21 | 21 |
=end |
22 |
class Plugin::Settings < Gtk::VBox |
|
22 |
class Plugin::Settings < ::Gtk::VBox
|
|
23 | 23 | |
24 | 24 |
# 複数行テキスト |
25 | 25 |
# ==== Args |
26 | 26 |
# [label] ラベル |
27 | 27 |
# [config] 設定のキー |
28 | 28 |
def multitext(label, config) |
29 |
container = Gtk::HBox.new(false, 0) |
|
30 |
input = Gtk::TextView.new |
|
31 |
input.wrap_mode = Gtk::TextTag::WRAP_CHAR |
|
29 |
container = ::Gtk::HBox.new(false, 0)
|
|
30 |
input = ::Gtk::TextView.new
|
|
31 |
input.wrap_mode = ::Gtk::TextTag::WRAP_CHAR
|
|
32 | 32 |
input.border_width = 2 |
33 | 33 |
input.accepts_tab = false |
34 | 34 |
input.editable = true |
35 | 35 |
input.width_request = HYDE |
36 | 36 |
input.buffer.text = Listener[config].get || '' |
37 |
container.pack_start(Gtk::Label.new(label), false, true, 0) if label |
|
38 |
container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0) |
|
37 |
container.pack_start(::Gtk::Label.new(label), false, true, 0) if label
|
|
38 |
container.pack_start(::Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
|
39 | 39 |
input.buffer.ssc('changed'){ |widget| |
40 | 40 |
Listener[config].set widget.text } |
41 | 41 |
closeup container |
... | ... | |
49 | 49 |
# [min] 最低値。これより小さい数字は入力できないようになる |
50 | 50 |
# [max] 最高値。これより大きい数字は入力できないようになる |
51 | 51 |
def adjustment(name, config, min, max) |
52 |
container = Gtk::HBox.new(false, 0) |
|
53 |
container.pack_start(Gtk::Label.new(name), false, true, 0) |
|
54 |
adj = Gtk::Adjustment.new((Listener[config].get or min).to_f, min.to_f, max.to_f, 1.0, 5.0, 0.0) |
|
55 |
spinner = Gtk::SpinButton.new(adj, 0, 0) |
|
52 |
container = ::Gtk::HBox.new(false, 0)
|
|
53 |
container.pack_start(::Gtk::Label.new(name), false, true, 0)
|
|
54 |
adj = ::Gtk::Adjustment.new((Listener[config].get or min).to_f, min.to_f, max.to_f, 1.0, 5.0, 0.0)
|
|
55 |
spinner = ::Gtk::SpinButton.new(adj, 0, 0)
|
|
56 | 56 |
adj.signal_connect('value-changed'){ |widget, e| |
57 | 57 |
Listener[config].set widget.value.to_i |
58 | 58 |
false |
59 | 59 |
} |
60 |
closeup container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(spinner), true, true, 0) |
|
60 |
closeup container.pack_start(::Gtk::Alignment.new(1.0, 0.5, 0, 0).add(spinner), true, true, 0)
|
|
61 | 61 |
container |
62 | 62 |
end |
63 | 63 | |
... | ... | |
66 | 66 |
# [label] ラベル |
67 | 67 |
# [config] 設定のキー |
68 | 68 |
def boolean(label, config) |
69 |
input = Gtk::CheckButton.new(label) |
|
69 |
input = ::Gtk::CheckButton.new(label)
|
|
70 | 70 |
input.active = Listener[config].get |
71 | 71 |
input.signal_connect('toggled'){ |widget| |
72 | 72 |
Listener[config].set widget.active? } |
... | ... | |
81 | 81 |
def fileselect(label, config, current=Dir.pwd) |
82 | 82 |
container = input(label, config) |
83 | 83 |
input = container.children.last.children.first |
84 |
button = Gtk::Button.new('参照') |
|
84 |
button = ::Gtk::Button.new('参照')
|
|
85 | 85 |
container.pack_start(button, false) |
86 | 86 |
button.signal_connect('clicked'){ |widget| |
87 |
dialog = Gtk::FileChooserDialog.new("Open File", |
|
88 |
widget.get_ancestor(Gtk::Window), |
|
89 |
Gtk::FileChooser::ACTION_OPEN, |
|
87 |
dialog = ::Gtk::FileChooserDialog.new("Open File",
|
|
88 |
widget.get_ancestor(::Gtk::Window),
|
|
89 |
::Gtk::FileChooser::ACTION_OPEN,
|
|
90 | 90 |
nil, |
91 |
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
|
|
92 |
[Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT])
|
|
91 |
[::Gtk::Stock::CANCEL, ::Gtk::Dialog::RESPONSE_CANCEL],
|
|
92 |
[::Gtk::Stock::OPEN, ::Gtk::Dialog::RESPONSE_ACCEPT])
|
|
93 | 93 |
dialog.current_folder = File.expand_path(current) |
94 |
if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT |
|
94 |
if dialog.run == ::Gtk::Dialog::RESPONSE_ACCEPT
|
|
95 | 95 |
Listener[config].set dialog.filename |
96 | 96 |
input.text = dialog.filename |
97 | 97 |
end |
... | ... | |
105 | 105 |
# [label] ラベル |
106 | 106 |
# [config] 設定のキー |
107 | 107 |
def input(label, config) |
108 |
container = Gtk::HBox.new(false, 0) |
|
109 |
input = Gtk::Entry.new |
|
108 |
container = ::Gtk::HBox.new(false, 0)
|
|
109 |
input = ::Gtk::Entry.new
|
|
110 | 110 |
input.text = Listener[config].get || "" |
111 |
container.pack_start(Gtk::Label.new(label), false, true, 0) if label |
|
112 |
container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0) |
|
111 |
container.pack_start(::Gtk::Label.new(label), false, true, 0) if label
|
|
112 |
container.pack_start(::Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
|
113 | 113 |
input.signal_connect('changed'){ |widget| |
114 | 114 |
Listener[config].set widget.text } |
115 | 115 |
closeup container |
... | ... | |
121 | 121 |
# [label] ラベル |
122 | 122 |
# [config] 設定のキー |
123 | 123 |
def inputpass(label, config) |
124 |
container = Gtk::HBox.new(false, 0) |
|
125 |
input = Gtk::Entry.new |
|
124 |
container = ::Gtk::HBox.new(false, 0)
|
|
125 |
input = ::Gtk::Entry.new
|
|
126 | 126 |
input.visibility = false |
127 | 127 |
input.text = Listener[config].get |
128 |
container.pack_start(Gtk::Label.new(label), false, true, 0) if label |
|
129 |
container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0) |
|
128 |
container.pack_start(::Gtk::Label.new(label), false, true, 0) if label
|
|
129 |
container.pack_start(::Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
|
130 | 130 |
input.signal_connect('changed'){ |widget| |
131 | 131 |
Listener[config].set widget.text } |
132 | 132 |
closeup container |
... | ... | |
140 | 140 |
# [config] 設定のキー |
141 | 141 |
def multi(label, config) |
142 | 142 |
settings(label) do |
143 |
container, box = Gtk::HBox.new(false, 0), Gtk::VBox.new(false, 0)
|
|
143 |
container, box = ::Gtk::HBox.new(false, 0), ::Gtk::VBox.new(false, 0)
|
|
144 | 144 |
input_ary = [] |
145 |
btn_add = Gtk::Button.new(Gtk::Stock::ADD)
|
|
145 |
btn_add = ::Gtk::Button.new(::Gtk::Stock::ADD)
|
|
146 | 146 |
array_converter = lambda { |
147 | 147 |
c = Listener[config].get || [] |
148 | 148 |
(c.is_a?(Array) ? c : [c]).select(&ret_nth) } |
149 | 149 |
add_button = lambda { |content| |
150 |
input = Gtk::Entry.new |
|
150 |
input = ::Gtk::Entry.new
|
|
151 | 151 |
input.text = content.to_s |
152 | 152 |
input.ssc(:changed) { |w| |
153 | 153 |
Listener[config].set w.parent.children.map(&:text).select(&ret_nth) } |
... | ... | |
158 | 158 |
input } |
159 | 159 |
input_ary = array_converter.call.each(&add_button) |
160 | 160 |
btn_add.ssc(:clicked) { |w| |
161 |
w.get_ancestor(Gtk::Window).set_focus(add_button.call("").show) |
|
161 |
w.get_ancestor(::Gtk::Window).set_focus(add_button.call("").show)
|
|
162 | 162 |
false } |
163 | 163 |
container.pack_start(box, true, true, 0) |
164 |
container.pack_start(Gtk::Alignment.new(1.0, 1.0, 0, 0).add(btn_add), false, true, 0) |
|
164 |
container.pack_start(::Gtk::Alignment.new(1.0, 1.0, 0, 0).add(btn_add), false, true, 0)
|
|
165 | 165 |
closeup container |
166 | 166 |
container |
167 | 167 |
end |
... | ... | |
172 | 172 |
# [title] ラベル |
173 | 173 |
# [&block] ブロック |
174 | 174 |
def settings(title) |
175 |
group = Gtk::Frame.new.set_border_width(8) |
|
176 |
if(title.is_a?(Gtk::Widget)) |
|
175 |
group = ::Gtk::Frame.new.set_border_width(8)
|
|
176 |
if(title.is_a?(::Gtk::Widget))
|
|
177 | 177 |
group.set_label_widget(title) |
178 | 178 |
else |
179 | 179 |
group.set_label(title) end |
... | ... | |
199 | 199 |
# _:artists_ :: デザイナとかの名前。通常Twitter screen name(Array) |
200 | 200 |
# _:documenters_ :: ドキュメントかいた人とかの名前。通常Twitter screen name(Array) |
201 | 201 |
def about(label, options={}) |
202 |
about = Gtk::Button.new("#{Environment::NAME} について") |
|
202 |
about = ::Gtk::Button.new("#{Environment::NAME} について")
|
|
203 | 203 |
about.signal_connect("clicked"){ |
204 |
dialog = Gtk::AboutDialog.new.show |
|
204 |
dialog = ::Gtk::AboutDialog.new.show
|
|
205 | 205 |
options.each { |key, value| |
206 | 206 |
dialog.__send__("#{key}=", about_converter[key][value]) } |
207 | 207 |
dialog.signal_connect('response') { dialog.destroy } } |
... | ... | |
213 | 213 |
# [label] ラベル |
214 | 214 |
# [config] 設定のキー |
215 | 215 |
def font(label, config) |
216 |
closeup container = Gtk::HBox.new(false, 0).add(Gtk::Label.new(label).left).closeup(fontselect(label, config))
|
|
216 |
closeup container = ::Gtk::HBox.new(false, 0).add(::Gtk::Label.new(label).left).closeup(fontselect(label, config))
|
|
217 | 217 |
container end |
218 | 218 | |
219 | 219 |
# 色を決定させる。押すと色を設定するダイアログが出てくる。 |
... | ... | |
221 | 221 |
# [label] ラベル |
222 | 222 |
# [config] 設定のキー |
223 | 223 |
def color(label, config) |
224 |
closeup container = Gtk::HBox.new(false, 0).add(Gtk::Label.new(label).left).closeup(colorselect(label, config))
|
|
224 |
closeup container = ::Gtk::HBox.new(false, 0).add(::Gtk::Label.new(label).left).closeup(colorselect(label, config))
|
|
225 | 225 |
container end |
226 | 226 | |
227 | 227 |
# フォントと色を決定させる。 |
... | ... | |
263 | 263 | |
264 | 264 |
private |
265 | 265 |
def about_converter |
266 |
Hash.new(ret_nth).merge!( :logo => lambda{ |value| Gtk::WebIcon.new(value).pixbuf rescue nil } ) end |
|
266 |
Hash.new(ret_nth).merge!( :logo => lambda{ |value| ::Gtk::WebIcon.new(value).pixbuf rescue nil } ) end
|
|
267 | 267 |
memoize :about_converter |
268 | 268 | |
269 | 269 |
def colorselect(label, config) |
270 | 270 |
color = Listener[config].get |
271 |
button = Gtk::ColorButton.new((color and Gdk::Color.new(*color))) |
|
271 |
button = ::Gtk::ColorButton.new((color and Gdk::Color.new(*color)))
|
|
272 | 272 |
button.title = label |
273 | 273 |
button.signal_connect('color-set'){ |w| |
274 | 274 |
Listener[config].set w.color.to_a } |
275 | 275 |
button end |
276 | 276 | |
277 | 277 |
def fontselect(label, config) |
278 |
button = Gtk::FontButton.new(Listener[config].get) |
|
278 |
button = ::Gtk::FontButton.new(Listener[config].get)
|
|
279 | 279 |
button.title = label |
280 | 280 |
button.signal_connect('font-set'){ |w| |
281 | 281 |
Listener[config].set w.font_name } |
core/plugin/settings/multiselect.rb (作業コピー) | ||
---|---|---|
12 | 12 |
# ウィジェット |
13 | 13 |
def build(label, config) |
14 | 14 |
if has_widget? |
15 |
group = Gtk::Frame.new.set_border_width(8) |
|
15 |
group = ::Gtk::Frame.new.set_border_width(8)
|
|
16 | 16 |
group.set_label(label) |
17 | 17 |
group.add(build_box(Plugin::Settings::Listener[config])) |
18 | 18 |
group |
19 | 19 |
else |
20 |
group = Gtk::Frame.new.set_border_width(8). |
|
20 |
group = ::Gtk::Frame.new.set_border_width(8).
|
|
21 | 21 |
set_label(label) |
22 | 22 |
box = Plugin::Settings.new.set_border_width(4). |
23 | 23 |
closeup(build_combobox(Plugin::Settings::Listener[config])) |
... | ... | |
27 | 27 |
private |
28 | 28 | |
29 | 29 |
def build_box(listener) |
30 |
box = Gtk::VBox.new |
|
30 |
box = ::Gtk::VBox.new
|
|
31 | 31 | |
32 | 32 |
options = @options |
33 | 33 |
box.instance_eval{ |
34 | 34 |
options.each{ |value, face| |
35 | 35 |
if face.is_a? String |
36 |
closeup check = Gtk::CheckButton.new(face) |
|
36 |
closeup check = ::Gtk::CheckButton.new(face)
|
|
37 | 37 |
elsif face.is_a? Plugin::Settings |
38 |
container = Gtk::HBox.new |
|
39 |
check = Gtk::CheckButton.new |
|
38 |
container = ::Gtk::HBox.new
|
|
39 |
check = ::Gtk::CheckButton.new
|
|
40 | 40 |
closeup container.closeup(check).add(face) |
41 | 41 |
else |
42 | 42 |
raise ArgumentError, "multiselect option value should be instance of String or Plugin::Settings. but #{face.class} given (#{face.inspect})" |
... | ... | |
46 | 46 |
listener.set((listener.get || []) + [value]) |
47 | 47 |
else |
48 | 48 |
listener.set((listener.get || []) - [value]) end |
49 |
face.sensitive = widget.active? if face.is_a? Gtk::Widget } |
|
49 |
face.sensitive = widget.active? if face.is_a? ::Gtk::Widget }
|
|
50 | 50 |
check.active = (listener.get || []).include? value |
51 |
face.sensitive = check.active? if face.is_a? Gtk::Widget } } |
|
51 |
face.sensitive = check.active? if face.is_a? ::Gtk::Widget } }
|
|
52 | 52 |
box end |
53 | 53 | |
54 | 54 |
# すべてテキストなら、コンボボックスで要素を描画する |
55 | 55 |
def build_combobox(listener) |
56 |
container = Gtk::VBox.new |
|
56 |
container = ::Gtk::VBox.new
|
|
57 | 57 |
state = listener.get || [] |
58 | 58 |
@options.each{ |pair| |
59 | 59 |
node, value = *pair |
60 |
check = Gtk::CheckButton.new(value) |
|
60 |
check = ::Gtk::CheckButton.new(value)
|
|
61 | 61 |
check.active = state.include?(node) |
62 | 62 |
check.signal_connect('toggled'){ |widget| |
63 | 63 |
if widget.active? |
core/plugin/search/search.rb (作業コピー) | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 | |
3 | 3 |
Plugin.create :search do |
4 |
querybox = Gtk::Entry.new() |
|
5 |
querycont = Gtk::VBox.new(false, 0) |
|
6 |
searchbtn = Gtk::Button.new('検索') |
|
7 |
savebtn = Gtk::Button.new('保存') |
|
4 |
querybox = ::Gtk::Entry.new()
|
|
5 |
querycont = ::Gtk::VBox.new(false, 0)
|
|
6 |
searchbtn = ::Gtk::Button.new('検索')
|
|
7 |
savebtn = ::Gtk::Button.new('保存')
|
|
8 | 8 | |
9 | 9 |
querycont. |
10 |
closeup(Gtk::HBox.new(false, 0). |
|
10 |
closeup(::Gtk::HBox.new(false, 0).
|
|
11 | 11 |
pack_start(querybox). |
12 | 12 |
closeup(searchbtn)). |
13 |
closeup(Gtk::HBox.new(false, 0). |
|
13 |
closeup(::Gtk::HBox.new(false, 0).
|
|
14 | 14 |
closeup(savebtn)) |
15 | 15 | |
16 | 16 |
tab(:search, "検索") do |
core/plugin/extract/extract.rb (作業コピー) | ||
---|---|---|
70 | 70 |
tabs.each{ |record| |
71 | 71 |
timeline(record[:slug]) << message if miku(record[:sexp], table) } } end |
72 | 72 | |
73 |
class ExtractTab < Gtk::CRUD |
|
73 |
class ExtractTab < ::Gtk::CRUD
|
|
74 | 74 |
ITER_NAME = 0 |
75 | 75 |
ITER_SOURCE = 1 |
76 | 76 |
ITER_SEXP = 2 |
core/plugin/list/list.rb (作業コピー) | ||
---|---|---|
12 | 12 | |
13 | 13 |
profiletab :list, "リスト" do |
14 | 14 |
set_icon MUI::Skin.get("list.png") |
15 |
bio = Gtk::IntelligentTextview.new(user[:detail]) |
|
15 |
bio = ::Gtk::IntelligentTextview.new(user[:detail])
|
|
16 | 16 |
ago = (Time.now - (user[:created] or 1)).to_i / (60 * 60 * 24) |
17 | 17 |
container = ProfileTab.new(Plugin.create(:list), user) |
18 | 18 |
nativewidget container.show_all end |
... | ... | |
257 | 257 | |
258 | 258 |
class IDs < TypedArray(Integer); end |
259 | 259 | |
260 |
class Tab < Gtk::ListList |
|
260 |
class Tab < ::Gtk::ListList
|
|
261 | 261 |
attr_accessor :plugin |
262 | 262 | |
263 | 263 |
VISIBILITY = 0 |
... | ... | |
317 | 317 | |
318 | 318 |
end |
319 | 319 | |
320 |
class ProfileTab < Gtk::ListList |
|
320 |
class ProfileTab < ::Gtk::ListList
|
|
321 | 321 |
MEMBER = 0 |
322 | 322 |
SLUG = 1 |
323 | 323 |
LIST = 2 |
core/plugin/command/command.rb (作業コピー) | ||
---|---|---|
13 | 13 |
condition: Plugin::Command[:HasOneMessage, :TimelineTextSelected], |
14 | 14 |
visible: true, |
15 | 15 |
role: :timeline) do |opt| |
16 |
Gtk::Clipboard.copy(opt.widget.selected_text(opt.messages.first)) end |
|
16 |
::Gtk::Clipboard.copy(opt.widget.selected_text(opt.messages.first)) end
|
|
17 | 17 | |
18 | 18 |
command(:copy_description, |
19 | 19 |
name: '本文をコピー', |
20 | 20 |
condition: Plugin::Command[:HasOneMessage], |
21 | 21 |
visible: true, |
22 | 22 |
role: :timeline) do |opt| |
23 |
Gtk::Clipboard.copy(opt.messages.first.to_show) end |
|
23 |
::Gtk::Clipboard.copy(opt.messages.first.to_show) end
|
|
24 | 24 | |
25 | 25 |
command(:reply, |
26 | 26 |
name: '返信', |
... | ... | |
60 | 60 |
role: :timeline) do |opt| |
61 | 61 |
opt.messages.each { |m| |
62 | 62 |
retweet = m.retweeted_statuses.find(&:from_me?) |
63 |
retweet.destroy if retweet and Gtk::Dialog.confirm("このつぶやきのリツイートをキャンセルしますか?\n\n#{m.to_show}") } end |
|
63 |
retweet.destroy if retweet and ::Gtk::Dialog.confirm("このつぶやきのリツイートをキャンセルしますか?\n\n#{m.to_show}") } end
|
|
64 | 64 | |
65 | 65 |
command(:favorite, |
66 | 66 |
name: 'ふぁぼふぁぼする', |
... | ... | |
82 | 82 |
visible: true, |
83 | 83 |
role: :timeline) do |opt| |
84 | 84 |
opt.messages.each { |m| |
85 |
m.destroy if Gtk::Dialog.confirm("失った信頼はもう戻ってきませんが、本当にこのつぶやきを削除しますか?\n\n#{m.to_show}") } end |
|
85 |
m.destroy if ::Gtk::Dialog.confirm("失った信頼はもう戻ってきませんが、本当にこのつぶやきを削除しますか?\n\n#{m.to_show}") } end
|
|
86 | 86 | |
87 | 87 |
command(:select_prev, |
88 | 88 |
name: '一つ上のメッセージを選択', |
... | ... | |
110 | 110 |
condition: Plugin::Command[:HasOneMessage, :TimelineTextSelected], |
111 | 111 |
visible: true, |
112 | 112 |
role: :timeline) do |opt| |
113 |
Gtk::openurl("http://www.google.co.jp/search?q=" + URI.escape(opt.widget.selected_text(opt.messages.first)).to_s) end |
|
113 |
::Gtk::openurl("http://www.google.co.jp/search?q=" + URI.escape(opt.widget.selected_text(opt.messages.first)).to_s) end
|
|
114 | 114 | |
115 | 115 |
command(:open_link, |
116 | 116 |
name: 'リンクを開く', |
... | ... | |
119 | 119 |
visible: true, |
120 | 120 |
role: :timeline) do |opt| |
121 | 121 |
opt.messages[0].entity.to_a.each {|u| |
122 |
Gtk::TimeLine.openurl(u[:url]) if u[:slug] == :urls } end |
|
122 |
::Gtk::TimeLine.openurl(u[:url]) if u[:slug] == :urls } end
|
|
123 | 123 | |
124 | 124 |
command(:new_pane, |
125 | 125 |
name: '新規ペインに移動', |
core/plugin/direct_message/direct_message.rb (作業コピー) | ||
---|---|---|
70 | 70 |
end |
71 | 71 | |
72 | 72 |
def dm_list_widget(user) |
73 |
container = Gtk::VBox.new |
|
73 |
container = ::Gtk::VBox.new
|
|
74 | 74 |
tl = DirectMessage.new |
75 | 75 | |
76 |
scrollbar = Gtk::VScrollbar.new(tl.vadjustment) |
|
76 |
scrollbar = ::Gtk::VScrollbar.new(tl.vadjustment)
|
|
77 | 77 |
model = tl.model |
78 | 78 |
@dm_lock.synchronize do |
79 | 79 |
if @dm_store.has_key?(user[:id]) |
... | ... | |
107 | 107 |
tl.ssc(:destroy){ |
108 | 108 |
detach(:direct_message, event) |
109 | 109 |
} |
110 |
mumbles = Gtk::VBox.new(false, 0) |
|
111 |
postbox = Gtk::PostBox.new(Sender.new(Service.primary_service, user), :postboxstorage => mumbles, :delegate_other => true) |
|
110 |
mumbles = ::Gtk::VBox.new(false, 0)
|
|
111 |
postbox = ::Gtk::PostBox.new(Sender.new(Service.primary_service, user), :postboxstorage => mumbles, :delegate_other => true)
|
|
112 | 112 |
mumbles.pack_start(postbox) |
113 |
container.closeup(mumbles).add(Gtk::HBox.new.add(tl).closeup(scrollbar)) |
|
113 |
container.closeup(mumbles).add(::Gtk::HBox.new.add(tl).closeup(scrollbar))
|
|
114 | 114 |
container |
115 | 115 |
end |
116 | 116 |
core/plugin/direct_message/dmlistview.rb (作業コピー) | ||
---|---|---|
2 | 2 | |
3 | 3 |
# DM用のリストビュー |
4 | 4 |
module Plugin::DirectMessage |
5 |
class DirectMessage < Gtk::CRUD |
|
5 |
class DirectMessage < ::Gtk::CRUD
|
|
6 | 6 |
C_CREATED = 2 |
7 | 7 |
C_ICON = 0 |
8 | 8 |
C_TEXT = 1 |
... | ... | |
10 | 10 | |
11 | 11 |
def initialize |
12 | 12 |
super |
13 |
model.set_sort_column_id(DirectMessage::C_CREATED, Gtk::SORT_DESCENDING) |
|
13 |
model.set_sort_column_id(DirectMessage::C_CREATED, ::Gtk::SORT_DESCENDING)
|
|
14 | 14 |
@creatable = @updatable = false |
15 | 15 |
end |
16 | 16 | |
... | ... | |
31 | 31 |
false } |
32 | 32 |
[{:kind => :pixbuf, :type => Gdk::Pixbuf, :label => 'icon'}, |
33 | 33 |
{:kind => :text, :type => String, :label => '本文', :renderer => lambda{ |scheme, index| |
34 |
renderer = Gtk::CellRendererText.new |
|
34 |
renderer = ::Gtk::CellRendererText.new
|
|
35 | 35 |
Delayer.new{ |
36 | 36 |
if not destroyed? |
37 | 37 |
renderer.set_property "wrap-width", 10 |
core/plugin/direct_message/userlist.rb (作業コピー) | ||
---|---|---|
2 | 2 | |
3 | 3 |
# 最後にやりとりしたDMの日時でソートする機能のついたUserlist |
4 | 4 |
module Plugin::DirectMessage |
5 |
class UserList < Gtk::UserList |
|
5 |
class UserList < ::Gtk::UserList
|
|
6 | 6 | |
7 | 7 |
def initialize |
8 | 8 |
super |
9 |
@ul.set_sort_column_id(5, Gtk::SORT_DESCENDING) |
|
9 |
@ul.set_sort_column_id(5, ::Gtk::SORT_DESCENDING)
|
|
10 | 10 |
end |
11 | 11 | |
12 | 12 |
def block_add(user) |
core/plugin/profile/profile.rb (作業コピー) | ||
---|---|---|
49 | 49 | |
50 | 50 |
profiletab :aboutuser, "ユーザについて" do |
51 | 51 |
set_icon user[:profile_image_url] |
52 |
bio = Gtk::IntelligentTextview.new("") |
|
53 |
label_since = Gtk::Label.new |
|
54 |
container = Gtk::VBox.new. |
|
52 |
bio = ::Gtk::IntelligentTextview.new("")
|
|
53 |
label_since = ::Gtk::Label.new
|
|
54 |
container = ::Gtk::VBox.new.
|
|
55 | 55 |
closeup(bio). |
56 | 56 |
closeup(label_since.left). |
57 | 57 |
closeup(plugin.relation_bar(user)) |
58 | 58 |
container.closeup(plugin.mutebutton(user)) if not user.is_me? |
59 |
scrolledwindow = Gtk::ScrolledWindow.new |
|
60 |
scrolledwindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
|
59 |
scrolledwindow = ::Gtk::ScrolledWindow.new
|
|
60 |
scrolledwindow.set_policy(::Gtk::POLICY_AUTOMATIC, ::Gtk::POLICY_AUTOMATIC)
|
|
61 | 61 |
scrolledwindow.add_with_viewport(container) |
62 | 62 |
scrolledwindow.style = container.style |
63 | 63 |
nativewidget scrolledwindow.show_all |
... | ... | |
125 | 125 |
# ==== Args |
126 | 126 |
# [user] 対象となるユーザ |
127 | 127 |
# ==== Return |
128 |
# リレーションバーのウィジェット(Gtk::VBox) |
|
128 |
# リレーションバーのウィジェット(::Gtk::VBox)
|
|
129 | 129 |
def relation_bar(user) |
130 | 130 |
icon_size = Gdk::Rectangle.new(0, 0, 32, 32) |
131 | 131 |
arrow_size = Gdk::Rectangle.new(0, 0, 16, 16) |
132 |
container = Gtk::VBox.new(false, 4) |
|
132 |
container = ::Gtk::VBox.new(false, 4)
|
|
133 | 133 |
Service.all.each{ |me| |
134 | 134 |
following = followed = nil |
135 |
w_following_label = Gtk::Label.new("関係を取得中") |
|
136 |
w_followed_label = Gtk::Label.new("") |
|
137 |
w_eventbox_image_following = Gtk::EventBox.new |
|
138 |
w_eventbox_image_followed = Gtk::EventBox.new |
|
135 |
w_following_label = ::Gtk::Label.new("関係を取得中")
|
|
136 |
w_followed_label = ::Gtk::Label.new("")
|
|
137 |
w_eventbox_image_following = ::Gtk::EventBox.new
|
|
138 |
w_eventbox_image_followed = ::Gtk::EventBox.new
|
|
139 | 139 |
relation = if me.user_obj == user |
140 |
Gtk::Label.new("それはあなたです!") |
|
140 |
::Gtk::Label.new("それはあなたです!")
|
|
141 | 141 |
else |
142 |
Gtk::HBox.new. |
|
142 |
::Gtk::HBox.new.
|
|
143 | 143 |
closeup(w_eventbox_image_following). |
144 | 144 |
closeup(w_following_label) end |
145 |
relation_container = Gtk::HBox.new(false, icon_size.width/2) |
|
146 |
relation_container.closeup(Gtk::WebIcon.new(me.user_obj[:profile_image_url], icon_size).tooltip("#{me.user}(#{me.user_obj[:name]})")) |
|
147 |
relation_container.closeup(Gtk::VBox.new. |
|
145 |
relation_container = ::Gtk::HBox.new(false, icon_size.width/2)
|
|
146 |
relation_container.closeup(::Gtk::WebIcon.new(me.user_obj[:profile_image_url], icon_size).tooltip("#{me.user}(#{me.user_obj[:name]})"))
|
|
147 |
relation_container.closeup(::Gtk::VBox.new.
|
|
148 | 148 |
closeup(relation). |
149 |
closeup(Gtk::HBox.new. |
|
149 |
closeup(::Gtk::HBox.new.
|
|
150 | 150 |
closeup(w_eventbox_image_followed). |
151 | 151 |
closeup(w_followed_label))) |
152 |
relation_container.closeup(Gtk::WebIcon.new(user[:profile_image_url], icon_size).tooltip("#{user.idname}(#{user[:name]})")) |
|
152 |
relation_container.closeup(::Gtk::WebIcon.new(user[:profile_image_url], icon_size).tooltip("#{user.idname}(#{user[:name]})"))
|
|
153 | 153 |
if me.user_obj != user |
154 |
followbutton = Gtk::Button.new |
|
154 |
followbutton = ::Gtk::Button.new
|
|
155 | 155 |
followbutton.sensitive = false |
156 | 156 |
# フォローしている状態の更新 |
157 | 157 |
m_following_refresh = lambda { |new| |
... | ... | |
161 | 161 |
w_eventbox_image_following.remove(w_eventbox_image_following.children.first) end |
162 | 162 | |
163 | 163 |
w_eventbox_image_following.style = w_eventbox_image_following.parent.style |
164 |
w_eventbox_image_following.add(Gtk::WebIcon.new(MUI::Skin.get(new ? "arrow_following.png" : "arrow_notfollowing.png"), arrow_size).show_all) |
|
164 |
w_eventbox_image_following.add(::Gtk::WebIcon.new(MUI::Skin.get(new ? "arrow_following.png" : "arrow_notfollowing.png"), arrow_size).show_all)
|
|
165 | 165 |
w_following_label.text = new ? "フョローしている" : "フョローしていない" |
166 | 166 |
followbutton.label = new ? "解除" : "フョロー" end } |
167 | 167 |
# フォローされている状態の更新 |
... | ... | |
171 | 171 |
if not w_eventbox_image_followed.children.empty? |
172 | 172 |
w_eventbox_image_followed.remove(w_eventbox_image_followed.children.first) end |
173 | 173 |
w_eventbox_image_followed.style = w_eventbox_image_followed.parent.style |
174 |
w_eventbox_image_followed.add(Gtk::WebIcon.new(MUI::Skin.get(new ? "arrow_followed.png" : "arrow_notfollowed.png"), arrow_size).show_all) |
|
174 |
w_eventbox_image_followed.add(::Gtk::WebIcon.new(MUI::Skin.get(new ? "arrow_followed.png" : "arrow_notfollowed.png"), arrow_size).show_all)
|
|
175 | 175 |
w_followed_label.text = new ? "フョローされている" : "フョローされていない" end } |
176 | 176 |
Service.primary.friendship(target_id: user[:id], source_id: me.user_obj[:id]).next{ |rel| |
177 | 177 |
if rel and not(w_eventbox_image_following.destroyed?) |
... | ... | |
208 | 208 |
# ==== Return |
209 | 209 |
# ヘッダ部を表すGtkコンテナ |
210 | 210 |
def profile_head(user) |
211 |
eventbox = Gtk::EventBox.new |
|
211 |
eventbox = ::Gtk::EventBox.new
|
|
212 | 212 |
eventbox.ssc('visibility-notify-event'){ |
213 | 213 |
eventbox.style = background_color |
214 | 214 |
false } |
215 |
eventbox.add(Gtk::VBox.new(false, 0). |
|
216 |
add(Gtk::HBox.new(false, 16). |
|
217 |
closeup(Gtk::WebIcon.new(user.profile_image_url_large, 128, 128).top). |
|
218 |
closeup(Gtk::VBox.new.closeup(user_name(user)).closeup(profile_table(user))))) |
|
219 |
scrolledwindow = Gtk::ScrolledWindow.new |
|
215 |
eventbox.add(::Gtk::VBox.new(false, 0).
|
|
216 |
add(::Gtk::HBox.new(false, 16).
|
|
217 |
closeup(::Gtk::WebIcon.new(user.profile_image_url_large, 128, 128).top).
|
|
218 |
closeup(::Gtk::VBox.new.closeup(user_name(user)).closeup(profile_table(user)))))
|
|
219 |
scrolledwindow = ::Gtk::ScrolledWindow.new
|
|
220 | 220 |
scrolledwindow.height_request = 128 + 24 |
221 |
scrolledwindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER)
|
|
221 |
scrolledwindow.set_policy(::Gtk::POLICY_AUTOMATIC, ::Gtk::POLICY_NEVER)
|
|
222 | 222 |
scrolledwindow.add_with_viewport(eventbox) |
223 | 223 |
end |
224 | 224 | |
... | ... | |
228 | 228 |
# ==== Return |
229 | 229 |
# ユーザの名前の部分のGtkコンテナ |
230 | 230 |
def user_name(user) |
231 |
w_screen_name = Gtk::Label.new.set_markup("<b><u><span foreground=\"#0000ff\">#{Pango.escape(user[:idname])}</span></u></b>") |
|
232 |
w_ev = Gtk::EventBox.new |
|
233 |
w_ev.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.new(0xffff, 0xffff, 0xffff)) |
|
231 |
w_screen_name = ::Gtk::Label.new.set_markup("<b><u><span foreground=\"#0000ff\">#{Pango.escape(user[:idname])}</span></u></b>")
|
|
232 |
w_ev = ::Gtk::EventBox.new
|
|
233 |
w_ev.modify_bg(::Gtk::STATE_NORMAL, Gdk::Color.new(0xffff, 0xffff, 0xffff))
|
|
234 | 234 |
w_ev.ssc(:realize) { |
235 | 235 |
w_ev.window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::HAND2)) |
236 | 236 |
false } |
... | ... | |
238 | 238 |
if e.button == 1 |
239 | 239 |
Gtk.openurl("http://twitter.com/#{user[:idname]}") |
240 | 240 |
true end } |
241 |
Gtk::HBox.new(false, 16).closeup(w_ev.add(w_screen_name)).closeup(Gtk::Label.new(user[:name]))
|
|
241 |
::Gtk::HBox.new(false, 16).closeup(w_ev.add(w_screen_name)).closeup(::Gtk::Label.new(user[:name]))
|
|
242 | 242 |
end |
243 | 243 | |
244 | 244 |
# プロフィールの上のところの格子になってる奴をかえす |
... | ... | |
247 | 247 |
# ==== Return |
248 | 248 |
# プロフィールのステータス部を表すGtkコンテナ |
249 | 249 |
def profile_table(user) |
250 |
w_tweets = Gtk::Label.new(user[:statuses_count].to_s) |
|
251 |
w_favs = Gtk::Label.new(user[:favourites_count].to_s) |
|
252 |
w_faved = Gtk::Label.new("...") |
|
253 |
w_followings = Gtk::Label.new(user[:friends_count].to_s) |
|
254 |
w_followers = Gtk::Label.new(user[:followers_count].to_s) |
|
250 |
w_tweets = ::Gtk::Label.new(user[:statuses_count].to_s)
|
|
251 |
w_favs = ::Gtk::Label.new(user[:favourites_count].to_s)
|
|
252 |
w_faved = ::Gtk::Label.new("...")
|
|
253 |
w_followings = ::Gtk::Label.new(user[:friends_count].to_s)
|
|
254 |
w_followers = ::Gtk::Label.new(user[:followers_count].to_s)
|
|
255 | 255 |
user.count_favorite_by.next{ |favs| |
256 | 256 |
w_faved.text = favs.to_s |
257 | 257 |
}.terminate("ふぁぼが取得できませんでした").trap{ |
258 | 258 |
w_faved.text = '-' } |
259 |
Gtk::Table.new(2, 5). |
|
259 |
::Gtk::Table.new(2, 5).
|
|
260 | 260 |
attach(w_tweets.right, 0, 1, 0, 1). |
261 |
attach(Gtk::Label.new("tweets").left, 1, 2, 0, 1). |
|
261 |
attach(::Gtk::Label.new("tweets").left, 1, 2, 0, 1).
|
|
262 | 262 |
attach(w_favs.right, 0, 1, 1, 2). |
263 |
attach(Gtk::Label.new("favs").left, 1, 2, 1, 2). |
|
263 |
attach(::Gtk::Label.new("favs").left, 1, 2, 1, 2).
|
|
264 | 264 |
attach(w_faved.right, 0, 1, 2, 3). |
265 |
attach(Gtk::Label.new("faved").left, 1, 2, 2, 3). |
|
265 |
attach(::Gtk::Label.new("faved").left, 1, 2, 2, 3).
|
|
266 | 266 |
attach(w_followings.right, 0, 1, 3, 4). |
267 |
attach(Gtk::Label.new("followings").left, 1, 2, 3, 4). |
|
267 |
attach(::Gtk::Label.new("followings").left, 1, 2, 3, 4).
|
|
268 | 268 |
attach(w_followers.right, 0, 1, 4, 5). |
269 |
attach(Gtk::Label.new("followers").left, 1, 2, 4, 5). |
|
269 |
attach(::Gtk::Label.new("followers").left, 1, 2, 4, 5).
|
|
270 | 270 |
set_row_spacing(0, 4). |
271 | 271 |
set_row_spacing(1, 4). |
272 | 272 |
set_column_spacing(0, 16) |
273 | 273 |
end |
274 | 274 | |
275 | 275 |
def background_color |
276 |
style = Gtk::Style.new() |
|
277 |
style.set_bg(Gtk::STATE_NORMAL, 0xFF ** 2, 0xFF ** 2, 0xFF ** 2) |
|
276 |
style = ::Gtk::Style.new()
|
|
277 |
style.set_bg(::Gtk::STATE_NORMAL, 0xFF ** 2, 0xFF ** 2, 0xFF ** 2)
|
|
278 | 278 |
style end |
279 | 279 |
end |
core/plugin/followingcontrol/followingcontrol.rb (作業コピー) | ||
---|---|---|
28 | 28 |
end } end |
29 | 29 | |
30 | 30 |
def set_event(api, title) |
31 |
userlist = Gtk::UserList.new.show_all |
|
31 |
userlist = ::Gtk::UserList.new.show_all
|
|
32 | 32 |
proc = gen_relationship(api, userlist) |
33 | 33 |
Plugin.call(:mui_tab_regist, userlist, title, MUI::Skin.get("#{api}.png")) |
34 | 34 |
onperiod{ |service| |
... | ... | |
77 | 77 |
# end } end |
78 | 78 | |
79 | 79 |
# def self.set_event(api, title) |
80 |
# userlist = Gtk::UserList.new.show_all |
|
80 |
# userlist = ::Gtk::UserList.new.show_all
|
|
81 | 81 |
# proc = gen_relationship(api, userlist) |
82 | 82 |
# Plugin.call(:mui_tab_regist, userlist, title, MUI::Skin.get("#{api}.png")) |
83 | 83 |
# Plugin.create(:following_control).add_event(:period){ |service| |
core/plugin/console/console.rb (作業コピー) | ||
---|---|---|
11 | 11 |
if Plugin::GUI::Tab.cuscaded.has_key?(:console) |
12 | 12 |
Plugin::GUI::Tab.instance(:console).active! |
13 | 13 |
next end |
14 |
widget_result = Gtk::TextView.new |
|
14 |
widget_result = ::Gtk::TextView.new
|
|
15 | 15 |
scroll_result_v, scroll_result_h = gen_scrollbars(widget_result) |
16 |
widget_input = Gtk::TextView.new |
|
16 |
widget_input = ::Gtk::TextView.new
|
|
17 | 17 |
scroll_input_v, scroll_input_h = gen_scrollbars(widget_input) |
18 | 18 | |
19 | 19 |
widget_result.set_editable(false) |
... | ... | |
26 | 26 |
gen_tags(widget_result.buffer) |
27 | 27 | |
28 | 28 |
widget_input.ssc('key_press_event'){ |widget, event| |
29 |
notice "console key press #{Gtk::keyname([event.keyval ,event.state])}" |
|
30 |
if "Control + Return" == Gtk::keyname([event.keyval ,event.state]) |
|
29 |
notice "console key press #{::Gtk::keyname([event.keyval ,event.state])}"
|
|
30 |
if "Control + Return" == ::Gtk::keyname([event.keyval ,event.state])
|
|
31 | 31 |
notice "console eval #{widget.buffer.text}" |
32 | 32 |
iter = widget_result.buffer.end_iter |
33 | 33 |
begin |
... | ... | |
55 | 55 |
set_icon MUI::Skin.get('console.png') |
56 | 56 |
set_deletable true |
57 | 57 |
nativewidget Plugin::Console::ConsoleControl.new(). |
58 |
pack1(Gtk::Table.new(2, 3). |
|
59 |
attach(widget_result, 0, 1, 0, 1, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND).
|
|
60 |
attach(scroll_result_h, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::FILL).
|
|
61 |
attach(scroll_result_v, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK|Gtk::FILL),
|
|
58 |
pack1(::Gtk::Table.new(2, 3).
|
|
59 |
attach(widget_result, 0, 1, 0, 1, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND).
|
|
60 |
attach(scroll_result_h, 0, 1, 1, 2, ::Gtk::SHRINK|::Gtk::FILL, ::Gtk::FILL).
|
|
61 |
attach(scroll_result_v, 1, 2, 0, 1, ::Gtk::FILL, ::Gtk::SHRINK|::Gtk::FILL),
|
|
62 | 62 |
true, false). |
63 |
pack2(Gtk::Table.new(2, 3). |
|
64 |
attach(widget_input, 0, 1, 0, 1, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND).
|
|
65 |
attach(scroll_input_h, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::FILL).
|
|
66 |
attach(scroll_input_v, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK|Gtk::FILL),
|
|
63 |
pack2(::Gtk::Table.new(2, 3).
|
|
64 |
attach(widget_input, 0, 1, 0, 1, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND).
|
|
65 |
attach(scroll_input_h, 0, 1, 1, 2, ::Gtk::SHRINK|::Gtk::FILL, ::Gtk::FILL).
|
|
66 |
attach(scroll_input_v, 1, 2, 0, 1, ::Gtk::FILL, ::Gtk::SHRINK|::Gtk::FILL),
|
|
67 | 67 |
false, false) |
68 | 68 |
active! |
69 | 69 |
end |
... | ... | |
71 | 71 | |
72 | 72 |
# _widget_ のためのスクロールバーを作って返す |
73 | 73 |
# ==== Args |
74 |
# [widget] Gtk::TextView |
|
74 |
# [widget] ::Gtk::TextView
|
|
75 | 75 |
# ==== Return |
76 | 76 |
# 縦スクロールバーと横スクロールバー |
77 | 77 |
def gen_scrollbars(widget) |
78 |
scroll_v = Gtk::VScrollbar.new |
|
79 |
scroll_h = Gtk::HScrollbar.new |
|
78 |
scroll_v = ::Gtk::VScrollbar.new
|
|
79 |
scroll_h = ::Gtk::HScrollbar.new
|
|
80 | 80 |
widget.set_scroll_adjustment(scroll_h.adjustment, scroll_v.adjustment) |
81 | 81 |
return scroll_v, scroll_h |
82 | 82 |
end |
83 | 83 | |
84 | 84 |
# タグを作る |
85 | 85 |
# ==== Args |
86 |
# [buffer] Gtk::TextBuffer |
|
86 |
# [buffer] ::Gtk::TextBuffer
|
|
87 | 87 |
def gen_tags(buffer) |
88 |
type_strict buffer => Gtk::TextBuffer |
|
88 |
type_strict buffer => ::Gtk::TextBuffer
|
|
89 | 89 |
buffer.create_tag("prompt", |
90 | 90 |
foreground_gdk: Gdk::Color.new(0, 0x6666, 0)) |
91 | 91 |
buffer.create_tag("echo", |
core/plugin/change_account.rb (作業コピー) | ||
---|---|---|
26 | 26 |
result = [nil] |
27 | 27 |
main_windows = Plugin.filtering(:get_windows, Set.new).first |
28 | 28 |
alert_thread = if(Thread.main != Thread.current) then Thread.current end |
29 |
dialog = Gtk::Dialog.new(Environment::NAME + " ログイン") |
|
29 |
dialog = ::Gtk::Dialog.new(Environment::NAME + " ログイン")
|
|
30 | 30 |
container, key, request_token = main(watch, dialog) |
31 | 31 |
dialog.set_size_request(600, 400) |
32 |
dialog.window_position = Gtk::Window::POS_CENTER |
|
32 |
dialog.window_position = ::Gtk::Window::POS_CENTER
|
|
33 | 33 |
dialog.vbox.pack_start(container, true, true, 30) |
34 |
dialog.add_button(Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK)
|
|
35 |
dialog.default_response = Gtk::Dialog::RESPONSE_OK |
|
34 |
dialog.add_button(::Gtk::Stock::OK, ::Gtk::Dialog::RESPONSE_OK)
|
|
35 |
dialog.default_response = ::Gtk::Dialog::RESPONSE_OK
|
|
36 | 36 |
quit = lambda{ |
37 | 37 |
dialog.hide_all.destroy |
38 | 38 |
Gtk.main_iteration_do(false) |
... | ... | |
42 | 42 |
else |
43 | 43 |
Gtk.main_quit end } |
44 | 44 |
dialog.signal_connect("response") do |widget, response| |
45 |
if response == Gtk::Dialog::RESPONSE_OK |
|
45 |
if response == ::Gtk::Dialog::RESPONSE_OK
|
|
46 | 46 |
begin |
47 | 47 |
access_token = request_token.get_access_token(:oauth_token => request_token.token, |
48 | 48 |
:oauth_verifier => key.text) |
... | ... | |
64 | 64 |
if(alert_thread) |
65 | 65 |
Thread.stop |
66 | 66 |
else |
67 |
Gtk::main |
|
67 |
::Gtk::main
|
|
68 | 68 |
end |
69 | 69 |
return *result |
70 | 70 |
end |
71 | 71 | |
72 | 72 |
def main(watch, dialog) |
73 |
goaisatsu = Gtk::VBox.new(false, 0) |
|
74 |
box = Gtk::VBox.new(false, 8) |
|
73 |
goaisatsu = ::Gtk::VBox.new(false, 0)
|
|
74 |
box = ::Gtk::VBox.new(false, 8)
|
|
75 | 75 |
request_token = watch.request_oauth_token |
76 |
goaisatsu.add(Gtk::IntelligentTextview.new(hello(request_token.authorize_url))) |
|
76 |
goaisatsu.add(::Gtk::IntelligentTextview.new(hello(request_token.authorize_url)))
|
|
77 | 77 |
user, key_input = gen_input('暗証番号', dialog, true) |
78 | 78 |
box.closeup(goaisatsu).closeup(user) |
79 | 79 |
return box, key_input, request_token |
80 | 80 |
end |
81 | 81 | |
82 | 82 |
def gen_input(label, dialog, visibility=true, default="") |
83 |
container = Gtk::HBox.new(false, 0) |
|
84 |
input = Gtk::Entry.new |
|
83 |
container = ::Gtk::HBox.new(false, 0)
|
|
84 |
input = ::Gtk::Entry.new
|
|
85 | 85 |
input.text = default |
86 | 86 |
input.visibility = visibility |
87 | 87 |
input.signal_connect('activate') { |elm| |
88 |
dialog.response(Gtk::Dialog::RESPONSE_OK) } |
|
89 |
container.pack_start(Gtk::Label.new(label), false, true, 0) |
|
90 |
container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0) |
|
88 |
dialog.response(::Gtk::Dialog::RESPONSE_OK) }
|
|
89 |
container.pack_start(::Gtk::Label.new(label), false, true, 0)
|
|
90 |
container.pack_start(::Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
|
91 | 91 |
return container, input |
92 | 92 |
end |
93 | 93 | |
... | ... | |
109 | 109 | |
110 | 110 |
MikuTwitter::AuthenticationFailedAction.regist &method(:popup) |
111 | 111 |
settings 'アカウント情報' do |
112 |
closeup attention = Gtk::Label.new("変更後は、#{Environment::NAME}を再起動した方がいいと思うよ!") |
|
113 |
closeup decide = Gtk::Button.new('変更') |
|
112 |
closeup attention = ::Gtk::Label.new("変更後は、#{Environment::NAME}を再起動した方がいいと思うよ!")
|
|
113 |
closeup decide = ::Gtk::Button.new('変更')
|
|
114 | 114 |
attention.wrap = true |
115 | 115 |
decide.signal_connect("clicked"){ |
116 | 116 |
Plugin.call(:reauthentication_dialog, Service.primary) } |
core/plugin/bugreport.rb (作業コピー) | ||
---|---|---|
17 | 17 |
def self.popup |
18 | 18 |
Delayer.new{ |
19 | 19 |
alert_thread = if(Thread.main != Thread.current) then Thread.current end |
20 |
dialog = Gtk::Dialog.new("bug report") |
|
20 |
dialog = ::Gtk::Dialog.new("bug report")
|
|
21 | 21 |
dialog.set_size_request(600, 400) |
22 |
dialog.window_position = Gtk::Window::POS_CENTER |
|
22 |
dialog.window_position = ::Gtk::Window::POS_CENTER
|
|
23 | 23 |
dialog.vbox.pack_start(main, true, true, 30) |
24 |
dialog.add_button(Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK)
|
|
25 |
dialog.add_button(Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL)
|
|
26 |
dialog.default_response = Gtk::Dialog::RESPONSE_OK |
|
24 |
dialog.add_button(::Gtk::Stock::OK, ::Gtk::Dialog::RESPONSE_OK)
|
|
25 |
dialog.add_button(::Gtk::Stock::CANCEL, ::Gtk::Dialog::RESPONSE_CANCEL)
|
|
26 |
dialog.default_response = ::Gtk::Dialog::RESPONSE_OK
|
|
27 | 27 |
quit = lambda{ |
28 | 28 |
dialog.hide_all.destroy |
29 | 29 |
Gtk.main_iteration_do(false) |
... | ... | |
33 | 33 |
Gtk.main_quit |
34 | 34 |
end } |
35 | 35 |
dialog.signal_connect("response"){ |widget, response| |
36 |
if response == Gtk::Dialog::RESPONSE_OK |
|
36 |
if response == ::Gtk::Dialog::RESPONSE_OK
|
|
37 | 37 |
send |
38 | 38 |
else |
39 | 39 |
File.delete(File.expand_path(File.join(Environment::TMPDIR, 'mikutter_error'))) rescue nil |
... | ... | |
46 | 46 |
if(alert_thread) |
47 | 47 |
Thread.stop |
48 | 48 |
else |
49 |
Gtk::main |
|
49 |
::Gtk::main
|
|
50 | 50 |
end |
51 | 51 |
} |
52 | 52 |
end |
... | ... | |
58 | 58 |
end |
59 | 59 | |
60 | 60 |
def self.main |
61 |
Gtk::VBox.new(false, 0). |
|
62 |
closeup(Gtk::IntelligentTextview.new(imsorry)). |
|
63 |
pack_start(Gtk::ScrolledWindow. |
|
64 |
new.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS).
|
|
65 |
add(Gtk::IntelligentTextview.new(backtrace))) |
|
61 |
::Gtk::VBox.new(false, 0).
|
|
62 |
closeup(::Gtk::IntelligentTextview.new(imsorry)).
|
|
63 |
pack_start(::Gtk::ScrolledWindow.
|
|
64 |
new.set_policy(::Gtk::POLICY_NEVER, ::Gtk::POLICY_ALWAYS).
|
|
65 |
add(::Gtk::IntelligentTextview.new(backtrace)))
|
|
66 | 66 |
end |
67 | 67 | |
68 | 68 |
def self.send |
... | ... | |
80 | 80 |
'exception_class' => exception.class, |
81 | 81 |
'description' => exception.to_s, |
82 | 82 |
'ruby_version' => RUBY_VERSION, |
83 |
'rubygtk_version' => Gtk::BINDING_VERSION.join('.'), |
|
83 |
'rubygtk_version' => ::Gtk::BINDING_VERSION.join('.'),
|
|
84 | 84 |
'platform' => RUBY_PLATFORM, |
85 | 85 |
'url' => 'exception', |
86 | 86 |
'version' => Environment::VERSION } |