class GerminalFontSelector
Copyright 2015-2016 Cédric LE MOIGNE, cedlemo@gmx.com This file is part of Germinal.
Germinal is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
Germinal is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Germinal. If not, see <www.gnu.org/licenses/>.
Attributes
font[R]
Public Class Methods
new(window)
click to toggle source
Calls superclass method
# File lib/font_selector.rb, line 18 def initialize(window) @window = window @font = @window.notebook.current.font super(:horizontal, 0) reset_button = Gtk::Button.new(:label => "Reset") reset_button.signal_connect "clicked" do font_desc = Pango::FontDescription.new(@font) @window.notebook.current.set_font(font_desc) end pack_start(reset_button, :expand => false, :fill => false, :padding => 0) font_button = Gtk::FontButton.new font_button.set_font(@font) font_button.set_show_style(true) font_button.set_show_size(true) font_button.set_use_font(true) font_button.set_use_size(false) font_button.signal_connect "font-set" do font_desc = Pango::FontDescription.new(font_button.font_name) @window.notebook.current.set_font(font_desc) end pack_start(font_button, :expand => false, :fill => false, :padding => 0) save_button = Gtk::Button.new(:label => "Save") save_button.signal_connect "clicked" do new_props = {} font = @window.notebook.current.font new_props["-GerminalTerminal-font"] = font.to_s toplevel.application.update_css(new_props) toplevel.notebook.each do |tab| tab.set_font(font) if tab.class == GerminalTerminal end toplevel.exit_overlay_mode end pack_start(save_button, :expand => false, :fill => false, :padding => 0) set_name("font_selector") show_all set_halign(:center) set_valign(:end) end