Skip to content

Instantly share code, notes, and snippets.

@Akkiesoft
Created September 12, 2021 10:38
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/755e3ea018602d5e33ac2f31d1a2e3c5 to your computer and use it in GitHub Desktop.
Save Akkiesoft/755e3ea018602d5e33ac2f31d1a2e3c5 to your computer and use it in GitHub Desktop.
diff --git a/core/mui/gtk_extension.rb b/core/mui/gtk_extension.rb
index 749aec85..3bd3f9fc 100644
--- a/core/mui/gtk_extension.rb
+++ b/core/mui/gtk_extension.rb
@@ -141,18 +141,18 @@ module Gtk
type, button, state = key
return NO_ACTION if key.empty? or type == 0 or not key.all?
r = ""
- r << PRESS_WITH_CONTROL if (state & Gdk::Window::CONTROL_MASK) != 0
- r << PRESS_WITH_SHIFT if (state & Gdk::Window::SHIFT_MASK) != 0
- r << PRESS_WITH_ALT if (state & Gdk::Window::MOD1_MASK) != 0
- r << PRESS_WITH_SUPER if (state & Gdk::Window::SUPER_MASK) != 0
- r << PRESS_WITH_HYPER if (state & Gdk::Window::HYPER_MASK) != 0
+ r << PRESS_WITH_CONTROL if (state & Gdk::ModifierType::CONTROL_MASK) != 0
+ r << PRESS_WITH_SHIFT if (state & Gdk::ModifierType::SHIFT_MASK) != 0
+ r << PRESS_WITH_ALT if (state & Gdk::ModifierType::MOD1_MASK) != 0
+ r << PRESS_WITH_SUPER if (state & Gdk::ModifierType::SUPER_MASK) != 0
+ r << PRESS_WITH_HYPER if (state & Gdk::ModifierType::HYPER_MASK) != 0
r << "Button #{button} "
case type
- when Gdk::Event::BUTTON_PRESS
+ when Gdk::EventType::BUTTON_PRESS
r << 'Click'.freeze
- when Gdk::Event::BUTTON2_PRESS
+ when Gdk::EventType::BUTTON2_PRESS
r << 'Double Click'.freeze
- when Gdk::Event::BUTTON3_PRESS
+ when Gdk::EventType::BUTTON3_PRESS
r << 'Triple Click'.freeze
else
return NO_ACTION end
diff --git a/core/mui/gtk_intelligent_textview.rb b/core/mui/gtk_intelligent_textview.rb
index 71484633..f38d6aa3 100644
--- a/core/mui/gtk_intelligent_textview.rb
+++ b/core/mui/gtk_intelligent_textview.rb
@@ -150,7 +150,7 @@ class Gtk::IntelligentTextview < Gtk::TextView
tag_shell.foreground_gdk = Gdk::Color.new(*UserConfig[fonts['foreground']]) end
false }
self.signal_connect('event'){
- set_cursor(self, Gdk::Cursor::XTERM)
+ set_cursor(self, Gdk::CursorType::XTERM)
false }
end
diff --git a/core/mui/gtk_postbox.rb b/core/mui/gtk_postbox.rb
index 811f0f70..c18f5974 100644
--- a/core/mui/gtk_postbox.rb
+++ b/core/mui/gtk_postbox.rb
@@ -380,7 +380,7 @@ module Gtk
def get_backgroundstyle(message)
style = Gtk::Style.new()
color = get_backgroundcolor(message)
- [Gtk::STATE_ACTIVE, Gtk::STATE_NORMAL, Gtk::STATE_SELECTED, Gtk::STATE_PRELIGHT, Gtk::STATE_INSENSITIVE].each{ |state|
+ [Gtk::StateType::ACTIVE, Gtk::StateType::NORMAL, Gtk::StateType::SELECTED, Gtk::StateType::PRELIGHT, Gtk::StateType::INSENSITIVE].each{ |state|
# FIXME: gtk3, find alternative method
#style.set_bg(state, *color)
}
diff --git a/plugin/bugreport/bugreport.rb b/plugin/bugreport/bugreport.rb
index c8106abe..18ed9300 100644
--- a/plugin/bugreport/bugreport.rb
+++ b/plugin/bugreport/bugreport.rb
@@ -19,9 +19,9 @@ Plugin.create :bugreport do
dialog.set_size_request(600, 400)
dialog.window_position = Gtk::Window::POS_CENTER
dialog.vbox.pack_start(main, true, true, 30)
- dialog.add_button(Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK)
- dialog.add_button(Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL)
- dialog.default_response = Gtk::Dialog::RESPONSE_OK
+ dialog.add_button(Gtk::Stock::OK, Gtk::ResponseType::OK)
+ dialog.add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL)
+ dialog.default_response = Gtk::ResponseType::OK
quit = lambda{
dialog.hide_all.destroy
Gtk.main_iteration_do(false)
@@ -31,7 +31,7 @@ Plugin.create :bugreport do
Gtk.main_quit
end }
dialog.signal_connect("response"){ |widget, response|
- if response == Gtk::Dialog::RESPONSE_OK
+ if response == Gtk::ResponseType::OK
send
else
File.delete(File.expand_path(File.join(Environment::TMPDIR, 'mikutter_error'))) rescue nil
diff --git a/plugin/extract_gtk/extract_tab_list.rb b/plugin/extract_gtk/extract_tab_list.rb
index 90e3b6c7..c521e9a5 100644
--- a/plugin/extract_gtk/extract_tab_list.rb
+++ b/plugin/extract_gtk/extract_tab_list.rb
@@ -94,7 +94,7 @@ class Plugin::ExtractGtk::ExtractTabList < ::Gtk::TreeView
def register_signal_handlers
# 項目をダブルクリックして設定を開く
ssc(:button_press_event) do |_, ev|
- next if ev.event_type != Gdk::Event::BUTTON2_PRESS
+ next if ev.event_type != Gdk::EventType::BUTTON2_PRESS
slug = selected_slug
if slug
Plugin.call(:extract_open_edit_dialog, slug)
diff --git a/plugin/openimg_gtk/window.rb b/plugin/openimg_gtk/window.rb
index 5d093a5b..1b49915b 100644
--- a/plugin/openimg_gtk/window.rb
+++ b/plugin/openimg_gtk/window.rb
@@ -143,7 +143,7 @@ module Plugin::OpenimgGtk
def w_browser
@w_browser ||= ::Gtk::ToolButton.new(
- Gtk::Image.new(Skin[:forward].pixbuf(width: 24, height: 24))
+ icon_widget: Gtk::Image.new(pixbuf: Skin[:forward].pixbuf(width: 24, height: 24))
).tap{|w|
w.ssc(:clicked, &gen_browser_clicked)
}
diff --git a/plugin/settings_gtk/menu.rb b/plugin/settings_gtk/menu.rb
index a26761fb..ccb02ac9 100644
--- a/plugin/settings_gtk/menu.rb
+++ b/plugin/settings_gtk/menu.rb
@@ -12,7 +12,7 @@ module Plugin::SettingsGtk
def initialize
super(Gtk::TreeStore.new(String, Record, Integer))
set_headers_visible(false)
- model.set_sort_column_id(COL_ORDER, Gtk::SORT_ASCENDING)
+ model.set_sort_column_id(COL_ORDER, Gtk::SortType::ASCENDING)
column = Gtk::TreeViewColumn.new("", ::Gtk::CellRendererText.new, text: 0)
self.append_column(column)
self.set_width_request(HYDE)
diff --git a/plugin/skin_setting_gtk/skin_setting_gtk.rb b/plugin/skin_setting_gtk/skin_setting_gtk.rb
index fecc0580..49b520d5 100644
--- a/plugin/skin_setting_gtk/skin_setting_gtk.rb
+++ b/plugin/skin_setting_gtk/skin_setting_gtk.rb
@@ -58,9 +58,9 @@ Plugin.create :skin do
skin_infos.each { |slug, info|
button = if current_radio
- Gtk::RadioButton.new(current_radio, info[:face])
+ Gtk::RadioButton.new(member: current_radio, label: info[:face])
else
- Gtk::RadioButton.new(info[:face])
+ Gtk::RadioButton.new(label: info[:face])
end
if slug == UserConfig[:skin_dir]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment