Debian Codegraph @

plugin/openimg_gtk/openimg_gtk.rb

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2
3 require 'gtk3'
4 require 'cairo'
5
6 module Plugin::OpenimgGtk; end
7
8 require_relative 'window'
9
10 Plugin.create(:openimg_gtk) do
11 UserConfig[:openimg_window_size_width_percent] ||= 70
12 UserConfig[:openimg_window_size_height_percent] ||= 70
13 UserConfig[:openimg_window_size_reference] ||= :mainwindow
14 UserConfig[:openimg_window_size_reference_manual_num] ||= 0
15
16 filter_openimg_pixbuf_from_display_url do |photo, _, _|
17 loader = GdkPixbuf::PixbufLoader.new
18 [photo, loader, photo.download { |partial| loader.write partial }]
19 end
20
21 intent Plugin::Openimg::Photo do |intent_token|
22 Plugin::OpenimgGtk::Window.new(intent_token.model, intent_token).start_loading.show_all
23 end
24
25 intent :photo do |intent_token|
26 Plugin::OpenimgGtk::Window.new(intent_token.model, intent_token).start_loading.show_all
27 end
28
29 settings('画像ビューア') do
30 settings('ウィンドウサイズ') do
31 adjustment('幅 (%)', :openimg_window_size_width_percent, 1, 100)
32 adjustment('高さ (%)', :openimg_window_size_height_percent, 1, 100)
33 select('サイズの基準', :openimg_window_size_reference) do
34 option(:mainwindow, 'メインウィンドウがあるディスプレイ')
35 option(:full, 'デスクトップ全体')
36 option(:manual, 'ディスプレイ番号を指定') do
37 adjustment('ディスプレイ番号', :openimg_window_size_reference_manual_num, 0, 99)
38 end
39 end
40 end
41 end
42 end