Sha256: ed203e0a36cb3d2365281e5097b3b9b1afdf4f9a875117aec0227a7b72b3ac39

Contents?: true

Size: 1.68 KB

Versions: 46

Compression:

Stored size: 1.68 KB

Contents

# Copyright (C) 2015-2019  Ruby-GNOME2 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_screen_raw, :add_provider_for_screen
      def add_provider_for_screen(screen, provider, priority=nil)
        priority = resolve_priority(priority)
        add_provider_for_screen_raw(screen, provider, priority)
      end

      alias_method :reset_widgets_raw, :reset_widgets
      def reset_widgets(screen=nil)
        reset_widgets_raw(screen || Gdk::Screen.default)
      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

46 entries across 46 versions & 1 rubygems

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