バグ #1548
closedgtk3: Gtk::ImageMenuItem.new の引数が適切でない
Description
題名のとおりですが
source:plugin/gtk3/widget/worldshifter.rb@f6025344 にあるImageMenuItem.new
の引数が意図通りになっていないようです。
Ruby-Gnome のマニュアル によればGtk::ImageMenuItem.new(label = nil, use_underline = true)
もしくはGtk::ImageMenuItem.new(stock_id, accel_group = nil)
という引数ですが、現状ではGtk::ImageMenuItem.new(label: world.title, accel_group: false)
およびGtk::ImageMenuItem.new(label: Plugin[:gtk3]._('Worldを追加'), accel_group: false)
と両者が混ざった記述になっています。(これが ruby 的にどう解釈されるのかよくわかってませんが)
なお https://noanoa07.livedoor.blog/archives/2136674.html によればuse_underline
は機能していない(?)らしいので実害はないようです。
Files
Updated by Izumi Tsutsui over 3 years ago
- File 0001-Gtk-ImageMenuItem.new.patch 0001-Gtk-ImageMenuItem.new.patch added
- Status changed from 分類待ち to パッチ適用待ち
とりあえず修正パッチです。
source:core/mui/gtk_contextmenu.rb@f6025344 にもGtk::ImageMenuItem.new
があってこちらは 2つ目の引数がない(≒デフォルトで true
になっている?)のですが、
チケット本文記載の通り use_underline
は機能していないので見た目としても問題になっていないようです。
Updated by Shibafu Midorino over 3 years ago
https://github.com/ruby-gnome/ruby-gnome/blob/3.4.9/gtk3/lib/gtk3/image-menu-item.rb と https://valadoc.org/gtk+-3.0/Gtk.ImageMenuItem.html を見る限り、label:
を渡す場合は他のキーワード引数には一切意味が無いようなのでこれ1つで良さそうです。
Updated by Shibafu Midorino over 3 years ago
いや意味がないことはないか、new_with_mnemonic を使うかどうかの分岐になってますね。ろくに読めていませんでした。
Updated by Izumi Tsutsui over 3 years ago
new_with_mnemonic
ってどこにあるんやと思ったら
https://valadoc.org/gtk+-3.0/Gtk.Label.Label.with_mnemonic.html とかなんですかね。
If characters in str are preceded by an underscore, they are underlined.
というのも ruby-gnome のドキュメント説明と合ってませんが、
アンダースコアつけても結局アンダーラインにならないような……。
Updated by toshi_a 初音 over 3 years ago
- Status changed from パッチ適用待ち to レビュー待ち
- Assignee set to Izumi Tsutsui
- ブランチ set to topic/1548-gtk-menu-item
確認お願いします
Updated by Izumi Tsutsui over 3 years ago
- Status changed from レビュー待ち to マージ待ち
git merge topic/1548-gtk-menu-item
して起動して
worldshifter 動作は特に問題なしです。