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