Debian Codegraph @

plugin/settings/settings.rb

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2
3 require 'pathname'
4
5 require_relative 'phantom'
6 require_relative 'listener'
7
8 Plugin.create(:settings) do
9 # 設定の一覧をPhantomの配列で得る。
10 defevent :settings, prototype: [Pluggaloid::COLLECT]
11
12 command(:open_setting,
13 name: _('設定'),
14 condition: :itself.to_proc,
15 visible: true,
16 icon: Skin[:settings],
17 role: :window) do |_opt|
18 Plugin.call(:open_setting)
19 end
20
21 # 設定画面を作る
22 # ==== Args
23 # - String name タイトル
24 # - Proc &place 設定画面を作る無名関数
25 defdsl :settings do |name, &proc|
26 name = -name
27
28 collection(:settings) do |mutation|
29 mutation << Plugin::Settings::Phantom.new(
30 title: name,
31 plugin: self,
32 &proc
33 )
34 end
35
36 # 互換性のため
37 add_event_filter(:defined_settings) do |tabs|
38 [tabs.melt << [name, proc, self.name]]
39 end
40 end
41 end