Sha256: 01ec99afa65906282d651a52b2dec708f46534f67836a9b6a2d9366e7e902bcf

Contents?: true

Size: 1.79 KB

Versions: 44

Compression:

Stored size: 1.79 KB

Contents

# Copyright (C) 2016  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 Gio
  class Settings
    alias_method :initialize_raw, :initialize

    def initialize(*args)
      if args.size == 1
        initialize_raw(args[0])
      elsif args.size == 2
        schema_id = args[0]
        options = args[1]
        path = options[:path] || nil
        backend = options[:backend] || nil
        if path && backend
          initialize_new_with_backend_and_path(schema_id, backend, path)
        elsif path
          initialize_new_with_path(schema_id, path)
        elsif backend
          initialize_new_with_backend(schema_id, backend)
        end
      elsif args.size == 3
        initialize_new_full(*args)
      else
        $stderr.puts "Arguments error for Gio::Settings#new"
      end
    end

    alias_method :set_value_raw, :set_value
    def set_value(key, value)
      schema_key = settings_schema.get_key(key)
      variant_value = GLib::Variant.new(value, schema_key.value_type)
      set_value_raw(key, variant_value)
    end

    alias_method :[], :get_value
    alias_method :[]=, :set_value
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
gio2-3.2.5-x64-mingw32 lib/gio2/settings.rb
gio2-3.2.5-x86-mingw32 lib/gio2/settings.rb
gio2-3.2.5 lib/gio2/settings.rb
gio2-3.2.4-x64-mingw32 lib/gio2/settings.rb
gio2-3.2.4-x86-mingw32 lib/gio2/settings.rb
gio2-3.2.4 lib/gio2/settings.rb
gio2-3.2.3-x64-mingw32 lib/gio2/settings.rb
gio2-3.2.3-x86-mingw32 lib/gio2/settings.rb
gio2-3.2.3 lib/gio2/settings.rb
gio2-3.2.2 lib/gio2/settings.rb
gio2-3.2.2-x64-mingw32 lib/gio2/settings.rb
gio2-3.2.2-x86-mingw32 lib/gio2/settings.rb
gio2-3.2.1-x64-mingw32 lib/gio2/settings.rb
gio2-3.2.1-x86-mingw32 lib/gio2/settings.rb
gio2-3.2.1 lib/gio2/settings.rb
gio2-3.2.0-x64-mingw32 lib/gio2/settings.rb
gio2-3.2.0-x86-mingw32 lib/gio2/settings.rb
gio2-3.2.0 lib/gio2/settings.rb
gio2-3.1.9-x64-mingw32 lib/gio2/settings.rb
gio2-3.1.9-x86-mingw32 lib/gio2/settings.rb