Skip to content

Instantly share code, notes, and snippets.

@Akkiesoft
Created September 19, 2021 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Akkiesoft/7b68412c66c14038eb0c9ec88c33f140 to your computer and use it in GitHub Desktop.
Save Akkiesoft/7b68412c66c14038eb0c9ec88c33f140 to your computer and use it in GitHub Desktop.
deprecated殺すマン
diff --git a/core/mui/gtk_compatlistview.rb b/core/mui/gtk_compatlistview.rb
index db87da14..85fa244b 100644
--- a/core/mui/gtk_compatlistview.rb
+++ b/core/mui/gtk_compatlistview.rb
@@ -27,7 +27,7 @@ class Gtk::CompatListView < Gtk::TreeView
scheme.each{ |cell|
if cell[:kind]
cell_renderer = get_render_by(cell, index)
- col.pack_start(cell_renderer, cell[:expand])
+ col.pack_start(cell_renderer, expand: cell[:expand])
col.add_attribute(cell_renderer, cell[:kind], index) end
index += 1 }
append_column(col)
diff --git a/core/mui/gtk_crud.rb b/core/mui/gtk_crud.rb
index 2592b121..ef0e5c8b 100644
--- a/core/mui/gtk_crud.rb
+++ b/core/mui/gtk_crud.rb
@@ -117,7 +117,7 @@ class Gtk::CRUD < Gtk::CompatListView
def record_delete(optional, widget)
if @deletable
- self.selection.selected_each {|model, path, iter|
+ self.selection.each {|model, path, iter|
if Gtk::Dialog.confirm("本当に削除しますか?\n" +
"一度削除するともうもどってこないよ。")
force_record_delete(iter) end } end end
@@ -136,7 +136,7 @@ class Gtk::CRUD < Gtk::CompatListView
Mtk.scrolled_dialog(dialog_title || "", input[:widget], self.toplevel || self, &input[:result]) end
def gen_popup_window_widget(results = [])
- widget = Gtk::VBox.new
+ widget = Gtk::Box.new(:vertical, 0)
column_schemer.flatten.each_with_index{ |scheme, index|
case scheme[:widget]
when :message_picker
diff --git a/core/mui/gtk_extension.rb b/core/mui/gtk_extension.rb
index f70709e7..cb8be845 100644
--- a/core/mui/gtk_extension.rb
+++ b/core/mui/gtk_extension.rb
@@ -233,7 +233,7 @@ class Gtk::Box
extend Gem::Deprecate
# _widget_ を詰めて配置する。closeupで配置されたウィジェットは無理に親の幅に合わせられることがない。
- # pack_start(_widget_, false)と等価。
+ # pack_start(_widget_, expand: false)と等価。
def closeup(widget)
pack_start(widget, expand: false)
end
@@ -277,14 +277,14 @@ class Gtk::Dialog
# YESボタンが押されたらtrue、それ以外が押されたらfalseを返す
def self.confirm(message)
Gtk::Lock.synchronize{
- dialog = Gtk::MessageDialog.new(nil,
- Gtk::Dialog::DESTROY_WITH_PARENT,
- Gtk::MessageDialog::QUESTION,
- Gtk::MessageDialog::BUTTONS_YES_NO,
- message)
+ dialog = Gtk::MessageDialog.new(parent: nil,
+ flags: Gtk::DialogFlags::DESTROY_WITH_PARENT,
+ type: Gtk::MessageType::QUESTION,
+ buttons: Gtk::ButtonsType::YES_NO,
+ message: message)
res = dialog.run
dialog.destroy
- res == Gtk::Dialog::RESPONSE_YES
+ res == Gtk::ResponseType::YES
}
end
end
diff --git a/core/mui/gtk_form_dsl.rb b/core/mui/gtk_form_dsl.rb
index d805ca7f..8b116090 100644
--- a/core/mui/gtk_form_dsl.rb
+++ b/core/mui/gtk_form_dsl.rb
@@ -645,9 +645,9 @@ module Gtk::FormDSL
def keybind(title, config)
keyconfig = Gtk::KeyConfig.new(title, self[config] || "")
- container = Gtk::HBox.new(false, 0)
- container.pack_start(Gtk::Label.new(title), false, true, 0)
- container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(keyconfig), true, true, 0)
+ container = Gtk::Box.new(:horizontal, 0)
+ container.pack_start(Gtk::Label.new(title), expand: false, fill: true, padding: 0)
+ container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(keyconfig), expand: true, fill: true, padding: 0)
keyconfig.change_hook = ->(modify) { self[config] = modify }
closeup(container)
container
@@ -696,7 +696,7 @@ module Gtk::FormDSL
add button
when Diva::Model
button = Gtk::Button.new
- box = Gtk::HBox.new
+ box = Gtk::Box.new(:horizontal, 0)
if target.respond_to?(:icon)
icon = Gtk::WebIcon.new(target.icon, 48, 48)
box.closeup(icon)
diff --git a/core/mui/gtk_form_dsl_listview.rb b/core/mui/gtk_form_dsl_listview.rb
index 2f4dba0a..15adcc9a 100644
--- a/core/mui/gtk_form_dsl_listview.rb
+++ b/core/mui/gtk_form_dsl_listview.rb
@@ -89,7 +89,7 @@ class Gtk::FormDSL::ListView < Gtk::TreeView
@columns.each do |label, *fields|
col = Gtk::TreeViewColumn.new(label)
fields.each do |field|
- col.pack_start(field.renderer, false)
+ col.pack_start(field.renderer, expand: false)
col.add_attribute(field.renderer, field.type, index)
#col.resizable = scheme[:resizable]
append_column(col)
diff --git a/core/mui/gtk_keyconfig.rb b/core/mui/gtk_keyconfig.rb
index 39f1fe83..8b568380 100644
--- a/core/mui/gtk_keyconfig.rb
+++ b/core/mui/gtk_keyconfig.rb
@@ -23,11 +23,12 @@ class Gtk::KeyConfig < Gtk::Button
private
def clicked_event(event)
- box = Gtk::VBox.new
+ box = Gtk::Box.new(:vertical)
label = Gtk::Label.new
button = Gtk::Button.new
- dialog = Gtk::Dialog.new(title, self.get_ancestor(Gtk::Window), Gtk::Dialog::MODAL,
- [ Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK])
+ dialog = Gtk::Dialog.new(title: title, parent: self.get_ancestor(Gtk::Window),
+ flags: Gtk::DialogFlags::MODAL,
+ buttons: [[ Gtk::Stock::OK, Gtk::ResponseType::OK]])
label.text = keycode
box.border_width = 20
button.add(label)
@@ -35,7 +36,7 @@ class Gtk::KeyConfig < Gtk::Button
box.pack_start(button)
button.signal_connect(:key_press_event, &key_set(label))
button.signal_connect(:button_press_event, &button_set(label))
- dialog.vbox.add(box)
+ dialog.child.add(box)
dialog.show_all
dialog.run
dialog.destroy
diff --git a/core/mui/gtk_message_picker.rb b/core/mui/gtk_message_picker.rb
index 2d93c84b..f3d7f06c 100644
--- a/core/mui/gtk_message_picker.rb
+++ b/core/mui/gtk_message_picker.rb
@@ -98,10 +98,10 @@ class Gtk::MessagePicker < Gtk::Frame
def gen_add_button
container = Gtk::Grid.new
- btn = Gtk::Button.new('条件を追加')
+ btn = Gtk::Button.new(label: '条件を追加')
btn.signal_connect(:clicked){
add_condition.show_all }
- btn2 = Gtk::Button.new('サブフィルタを追加')
+ btn2 = Gtk::Button.new(label: 'サブフィルタを追加')
btn2.signal_connect(:clicked){
add_condition([:and, DEFAULT_CONDITION]).show_all }
container.add(btn).add(btn2) end
diff --git a/core/mui/gtk_mtk.rb b/core/mui/gtk_mtk.rb
index dbcf8bb0..737825c6 100644
--- a/core/mui/gtk_mtk.rb
+++ b/core/mui/gtk_mtk.rb
@@ -13,8 +13,8 @@ module Mtk
extend Gem::Deprecate
def adjustment(name, config, min, max)
- container = Gtk::HBox.new(false, 0)
- container.pack_start(Gtk::Label.new(name), false, true, 0)
+ container = Gtk::Box.new(:horizontal, 0)
+ container.pack_start(Gtk::Label.new(name), expand: false, fill: true, padding: 0)
adj = Gtk::Adjustment.new((UserConfig[config] or min), min*1.0, max*1.0, 1.0, 5.0, 0.0)
spinner = Gtk::SpinButton.new(adj, 0, 0)
spinner.wrap = true
@@ -22,7 +22,7 @@ module Mtk
UserConfig[config] = widget.value.to_i
false
}
- container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(spinner), true, true, 0)
+ container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(spinner), expand: true, fill: true, padding: 0)
end
deprecate :adjustment, :none, 2020, 8
@@ -37,7 +37,7 @@ module Mtk
UserConfig[key]
else
UserConfig[key] = new end } end
- container = Gtk::HBox.new(false, 0)
+ container = Gtk::Box.new(:horizontal, 0)
input = Gtk::ComboBoxText.new
sorted_keys = values.keys.freeze
sorted_keys.each{ |x|
@@ -48,8 +48,8 @@ module Mtk
proc.call(*[sorted_keys[widget.active], widget][0, proc.arity])
nil
}
- container.pack_start(Gtk::Label.new(label), false, true, 0) if label
- container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
+ container.pack_start(Gtk::Label.new(label), expand: false, fill: true, padding: 0) if label
+ container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), expand: true, fill: true, padding: 0)
end
def choosemany(key, label, values)
@@ -66,9 +66,9 @@ module Mtk
proc.call(*[selected, input][0, proc.arity])
}
if label
- Gtk::HBox.new(false, 0).
- pack_start(Gtk::Label.new(label), false, true, 0).
- pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
+ Gtk::Box.new(:horizontal, 0).
+ pack_start(Gtk::Label.new(label), expand: false, fill: true, padding: 0).
+ pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), expand: true, fill: true, padding: 0)
else
input end end
deprecate :choosemany, :none, 2020, 8
@@ -124,7 +124,7 @@ module Mtk
input.ssc(:changed){ |widget|
UserConfig[key] = widget.text
}
- self.group(title, default, Gtk::HBox.new(false, 0).add(custom).add(input))
+ self.group(title, default, Gtk::Box.new(:horizontal, 0).add(custom).add(input))
end
deprecate :default_or_custom, :none, 2020, 8
@@ -137,12 +137,12 @@ module Mtk
UserConfig[key] = new
else
UserConfig[key].to_s end } end
- container = Gtk::HBox.new(false, 0)
+ container = Gtk::Box.new(:horizontal, 0)
input = Gtk::Entry.new
input.text = proc.call(nil)
input.visibility = visibility
- container.pack_start(Gtk::Label.new(label), false, true, 0) if label
- container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
+ container.pack_start(Gtk::Label.new(label), expand: false, fill: true, padding: 0) if label
+ container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), expand: true, fill: true, padding: 0)
input.ssc(:changed){ |widget|
proc.call(widget.text) }
callback&.call(container, input)
@@ -160,8 +160,8 @@ module Mtk
else
UserConfig[key].to_s end } end
keyconfig = Gtk::KeyConfig.new(title, proc.call(nil))
- container = Gtk::HBox.new(false, 0)
- container.pack_start(Gtk::Label.new(title), false, true, 0)
+ container = Gtk::Box.new(:horizontal, 0)
+ container.pack_start(Gtk::Label.new(title), expand: false, fill: true, padding: 0)
container.closeup(keyconfig.right)
keyconfig.change_hook = proc
return container
@@ -174,10 +174,10 @@ module Mtk
group.set_label_widget(title)
else
group.set_label(title) end
- box = Gtk::VBox.new(false, 0).set_border_width(4)
+ box = Gtk::Box.new(:vertical, 0).set_border_width(4)
group.add(box)
children.each{ |w|
- box.pack_start(w, false)
+ box.pack_start(w, expand: false)
}
group
end
@@ -186,10 +186,10 @@ module Mtk
def expander(title, expanded, *children)
group = Gtk::Expander.new(title).set_border_width(8)
group.expanded = expanded
- box = Gtk::VBox.new(false, 0).set_border_width(4)
+ box = Gtk::Box.new(:vertical, 0).set_border_width(4)
group.add(box)
children.each{ |w|
- box.pack_start(w, false)
+ box.pack_start(w, expand: false)
}
group
end
@@ -216,12 +216,12 @@ module Mtk
button end
def fontselect(key, label)
- Gtk::HBox.new(false, 0).add(Gtk::Label.new(label).left).closeup(_fontselect(key, label))
+ Gtk::Box.new(:horizontal, 0).add(Gtk::Label.new(label).left).closeup(_fontselect(key, label))
end
deprecate :fontselect, :none, 2020, 8
def colorselect(key, label)
- Gtk::HBox.new(false, 0).add(Gtk::Label.new(label).left).closeup(_colorselect(key, label))
+ Gtk::Box.new(:horizontal, 0).add(Gtk::Label.new(label).left).closeup(_colorselect(key, label))
end
deprecate :colorselect, :none, 2020, 8
diff --git a/core/mui/gtk_userlist.rb b/core/mui/gtk_userlist.rb
index 6bd3974d..ceb4006c 100644
--- a/core/mui/gtk_userlist.rb
+++ b/core/mui/gtk_userlist.rb
@@ -26,7 +26,7 @@ class Gtk::UserList < Gtk::EventBox
super
@listview = Gtk::InnerUserList.new(self)
scrollbar = ::Gtk::VScrollbar.new(@listview.vadjustment)
- add Gtk::HBox.new(false, 0).add(@listview).closeup(scrollbar)
+ add Gtk::Box.new(:horizontal, 0).add(@listview).closeup(scrollbar)
@listview.ssc(:row_activated, &self.class.row_activated)
@listview.ssc(:expose_event){
emit_expose_user
diff --git a/plugin/extract_gtk/edit_window.rb b/plugin/extract_gtk/edit_window.rb
index 8ea71d3e..d1e34185 100644
--- a/plugin/extract_gtk/edit_window.rb
+++ b/plugin/extract_gtk/edit_window.rb
@@ -100,7 +100,7 @@ class Plugin::ExtractGtk::EditWindow < Gtk::Window
end
def ok_button
- Gtk::Button.new(_('閉じる')).tap{ |button|
+ Gtk::Button.new(label: _('閉じる')).tap{ |button|
button.ssc(:clicked){
self.destroy } } end
diff --git a/plugin/mastodon_account_viewer/mastodon_account_viewer.rb b/plugin/mastodon_account_viewer/mastodon_account_viewer.rb
index 9be592cd..5d0b21e3 100644
--- a/plugin/mastodon_account_viewer/mastodon_account_viewer.rb
+++ b/plugin/mastodon_account_viewer/mastodon_account_viewer.rb
@@ -76,7 +76,7 @@ Plugin.create(:mastodon_account_viewer) do
# フォロー関係の表示・操作用ウィジェット
def relation_bar(user)
- container = ::Gtk::VBox.new(false, 4)
+ container = ::Gtk::Box.new(:vertical, 4)
Plugin.collect(:mastodon_worlds).each do |me|
container.closeup(Plugin::MastodonAccountViewer::RelationalContainer.new(me, user, self))
end
diff --git a/plugin/mastodon_account_viewer/relational_container.rb b/plugin/mastodon_account_viewer/relational_container.rb
index 25c3c119..fc25ed9e 100644
--- a/plugin/mastodon_account_viewer/relational_container.rb
+++ b/plugin/mastodon_account_viewer/relational_container.rb
@@ -115,7 +115,7 @@ module Plugin::MastodonAccountViewer
end
def gen_follow_relation
- Gtk::VBox.new
+ Gtk::Box.new(:vertical, 0)
.closeup(gen_following_relation)
.closeup(gen_followed_relation)
end
@@ -150,7 +150,7 @@ module Plugin::MastodonAccountViewer
end
def menubutton
- @menubutton ||= Gtk::Button.new(' … ').tap do |b|
+ @menubutton ||= Gtk::Button.new(label: ' … ').tap do |b|
b.sensitive = false
b.ssc(:clicked) do
Plugin::MastodonAccountViewer::RelationalMenu.new(self).show_all.popup(nil, nil, 0, 0)
diff --git a/plugin/shortcutkey/shortcutkey_listview.rb b/plugin/shortcutkey/shortcutkey_listview.rb
index 40341e31..62e82e1a 100644
--- a/plugin/shortcutkey/shortcutkey_listview.rb
+++ b/plugin/shortcutkey/shortcutkey_listview.rb
@@ -130,8 +130,8 @@ module Plugin::Shortcutkey
window.transient_for = toplevel
window.modal = true
window.destroy_with_parent = true
- btn_ok = ::Gtk::Button.new(@plugin._("OK"))
- btn_cancel = ::Gtk::Button.new(@plugin._("キャンセル"))
+ btn_ok = ::Gtk::Button.new(label: @plugin._("OK"))
+ btn_cancel = ::Gtk::Button.new(label: @plugin._("キャンセル"))
box = ::Gtk::ButtonBox.new :horizontal
box.layout_style = :end
box.spacing = 6
@@ -162,11 +162,11 @@ module Plugin::Shortcutkey
nil
}
if error
- dialog = ::Gtk::MessageDialog.new(window,
- ::Gtk::Dialog::DESTROY_WITH_PARENT,
- ::Gtk::MessageDialog::WARNING,
- ::Gtk::MessageDialog::BUTTONS_OK,
- error)
+ dialog = ::Gtk::MessageDialog.new(parent: window,
+ flags: ::Gtk::DialogFlags::DESTROY_WITH_PARENT,
+ type: ::Gtk::MessageType::WARNING,
+ buttons: ::Gtk::ButtonsType::OK,
+ message: error)
dialog.run
dialog.destroy end }
::Gtk::main
@@ -214,12 +214,12 @@ module Plugin::Shortcutkey
end
def key_box(results)
- container = ::Gtk::HBox.new(false, 0)
+ container = ::Gtk::Box.new(:horizontal, 0)
button = ::Gtk::KeyConfig.new(@plugin._('キーバインド'), results[COLUMN_KEYBIND])
button.width_request = HYDE
button.change_hook = lambda { |new| results[COLUMN_KEYBIND] = new }
- container.pack_start(::Gtk::Label.new(@plugin._('キーバインド')), false, true, 0)
- container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(button), true, true, 0) end
+ container.pack_start(::Gtk::Label.new(@plugin._('キーバインド')), expand: false, fill: true, padding: 0)
+ container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(button), expand: true, fill: true, padding: 0) end
def world_box(results)
faces = world_selections(value: :title)
@@ -274,7 +274,7 @@ module Plugin::Shortcutkey
def initialize(*args)
super
set_size_request(640, 480)
- self.window_position = ::Gtk::Window::POS_CENTER
+ self.window_position = ::Gtk::WindowPosition::CENTER
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment