module GerminalHeaderBar
Copyright 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/>.
Public Class Methods
generate_current_label(window)
click to toggle source
# File lib/headerbar.rb, line 51 def self.generate_current_label(window) label = Gtk::Entry.new label.has_frame = false label.width_chars = 35 label.set_icon_from_icon_name(:secondary, "edit-clear") generate_current_label_tooltips(label) generate_current_label_signals(label, window) label end
generate_current_label_signals(label, window)
click to toggle source
# File lib/headerbar.rb, line 38 def self.generate_current_label_signals(label, window) label.signal_connect "activate" do |entry| window.notebook.current.tab_label = entry.text end label.signal_connect "icon-release" do |entry, position| if position == :secondary window.notebook.current.tab_label = nil entry.text = window.notebook.current.window_title end end end
generate_current_label_tooltips(label)
click to toggle source
# File lib/headerbar.rb, line 27 def self.generate_current_label_tooltips(label) label.tooltip_text = <<-TOOLTIP Change the name of the tab and hit enter in order to validate TOOLTIP label.set_icon_tooltip_text(:secondary, <<-SECTOOLTIP) Reset your changes and use the default label for the current tab SECTOOLTIP end
generate_current_tab()
click to toggle source
# File lib/headerbar.rb, line 68 def self.generate_current_tab Gtk::Label.new("1/1") end
generate_header_bar(window)
click to toggle source
# File lib/headerbar.rb, line 18 def self.generate_header_bar(window) bar = Gtk::HeaderBar.new bar.title = "Germinal" bar.has_subtitle = false bar.show_close_button = true window.set_titlebar(bar) bar end