Sha256: fbb8b17da241edac339818e2cb6656ff56d5ff901e1f1f7ab83f86df5576a6de

Contents?: true

Size: 1.53 KB

Versions: 28

Compression:

Stored size: 1.53 KB

Contents

# Copyright (C) 2015-2022  Ruby-GNOME Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

module Gtk
  class StyleContext
    class << self
      def resolve_priority(priority)
        case priority
        when Symbol, String
          StyleProvider.const_get("PRIORITY_#{priority.to_s.upcase}")
        else
          priority || StyleProvider::PRIORITY_APPLICATION
        end
      end

      alias_method :add_provider_for_display_raw, :add_provider_for_display
      def add_provider_for_display(display, provider, priority=nil)
        priority = resolve_priority(priority)
        add_provider_for_display_raw(display, provider, priority)
      end
    end

    alias_method :add_provider_raw, :add_provider
    def add_provider(provider, priority=nil)
      priority = self.class.resolve_priority(priority)
      add_provider_raw(provider, priority)
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
gtk4-4.2.7 lib/gtk4/style-context.rb
gtk4-4.2.6 lib/gtk4/style-context.rb
gtk4-4.2.5 lib/gtk4/style-context.rb
gtk4-4.2.4 lib/gtk4/style-context.rb
gtk4-4.2.3 lib/gtk4/style-context.rb
gtk4-4.2.2 lib/gtk4/style-context.rb
gtk4-4.2.1 lib/gtk4/style-context.rb
gtk4-4.2.0 lib/gtk4/style-context.rb
gtk4-4.1.9 lib/gtk4/style-context.rb
gtk4-4.1.8 lib/gtk4/style-context.rb
gtk4-4.1.7 lib/gtk4/style-context.rb
gtk4-4.1.6 lib/gtk4/style-context.rb
gtk4-4.1.5 lib/gtk4/style-context.rb
gtk4-4.1.4 lib/gtk4/style-context.rb
gtk4-4.1.3 lib/gtk4/style-context.rb
gtk4-4.1.2 lib/gtk4/style-context.rb
gtk4-4.1.1 lib/gtk4/style-context.rb
gtk4-4.1.0 lib/gtk4/style-context.rb
gtk4-4.0.9 lib/gtk4/style-context.rb
gtk4-4.0.8 lib/gtk4/style-context.rb