Debian Codegraph @

core/mui/gtk_dark_matter_prification.rb

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2
3 require 'gtk3'
4
5 module Gtk::InnerTLDarkMatterPurification
6 attr_accessor :collect_counter
7
8 def initialize(*)
9 @collect_counter = 256
10 super(*)
11 end
12 end
13
14 module Gtk::TimelineDarkMatterPurification
15 def initialize(*)
16 super(*)
17 refresh_timer
18 end
19
20 # InnerTLをすげ替える。
21 def refresh
22 notice 'timeline refresh'
23 scroll = @tl.vadjustment.value
24 oldtl = @tl
25 @tl = Gtk::TimeLine::InnerTL.new(oldtl)
26 remove(@shell)
27 @shell = init_tl
28 @tl.vadjustment.value = scroll
29 pack_start(@shell.show_all)
30 @exposing_miraclepainter = []
31 oldtl.destroy unless oldtl.destroyed?
32 end
33
34 # ある条件を満たしたらInnerTLを捨てて、全く同じ内容の新しいInnerTLにすげ替えるためのイベントを定義する。
35 def refresh_timer
36 Delayer.new(delay: 60) do
37 unless @tl.destroyed?
38 window_active = Plugin.filtering(:get_windows, []).first.any?(&:has_toplevel_focus?)
39 @tl.collect_counter -= 1 unless window_active
40 refresh if !((Gtk::TimeLine::InnerTL.current_tl == @tl) && window_active && (Plugin.filtering(:get_idle_time, nil).first < 3600)) && (@tl.collect_counter <= (window_active ? -HYDE : 0))
41 refresh_timer end
42 end
43 end
44
45 def tl_model_remove(iter)
46 iter[Gtk::TimeLine::InnerTL::MIRACLE_PAINTER].destroy
47 @tl.model.remove(iter)
48 @tl.collect_counter -= 1
49 end
50 end