### Home Classes Methods

### In Files

- lib/dbus/bus.rb

### Parent

DBus::Connection

### Methods

- ::new
- #address_from_file

### Files

- README

### Class/Module Index

Quicksearch

- DBus
- DBus::ASessionBus
- DBus::ASystemBus
- DBus::AuthenticationFailed
- DBus::Authenticator
- DBus::Client
- DBus::Connection
- DBus::Connection::NameRequestError
- DBus::DBusCookieSHA1
- DBus::Error
- DBus::ErrorMessage
- DBus::External
- DBus::FormalParameter
- DBus::IncompleteBufferException
- DBus::Interface
- DBus::InterfaceElement
- DBus::IntrospectXMLParser
- DBus::InvalidClassDefinition
- DBus::InvalidDestinationName
- DBus::InvalidIntrospectionData
- DBus::InvalidMethodName
- DBus::InvalidPacketException
- DBus::InvalidParameters
- DBus::Main
- DBus::MatchRule
- DBus::MatchRuleException
- DBus::Message
- DBus::Method
- DBus::MethodNotImplemented
- DBus::MethodReturnMessage
- DBus::Node
- DBus::Object
- DBus::Object::UndefinedInterface
- DBus::PacketMarshaller
- DBus::PacketUnmarshaller
- DBus::ProxyObject
- DBus::ProxyObjectFactory
- DBus::ProxyObjectInterface
- DBus::RemoteBus
- DBus::Service
- DBus::SessionBus
- DBus::Signal
- DBus::SystemBus
- DBus::Type
- DBus::Type::Parser
- DBus::Type::SignatureException
- DBus::Type::Type
- DBus::TypeException
- DBus::UnknownSignal
- Integer

No matching classes.

# DBus::ASessionBus

# D-Bus session bus class

The session bus is a session specific bus (mostly for desktop use).

Use SessionBus, the non-singleton ASessionBus is for the test suite.

### Public Class Methods

new() click to toggle source

Get the the default session bus.

    # File lib/dbus/bus.rb, line 721
    def initialize
      super(ENV["DBUS_SESSION_BUS_ADDRESS"] || address_from_file)
      connect
      send_hello
    end

### Public Instance Methods

address_from_file() click to toggle source

    # File lib/dbus/bus.rb, line 727
    def address_from_file
      f = File.new("/var/lib/dbus/machine-id")
      machine_id = f.readline.chomp
      f.close
      display = ENV["DISPLAY"].gsub(/.*:([0-9]*).*/, '\1')
      File.open(ENV["HOME"] + "/.dbus/session-bus/#{machine_id}-#{display}").each do |line|
        if line =~ /^DBUS_SESSION_BUS_ADDRESS=(.*)/
          return $1
        end
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.