func initializeLibs() error { var err error upower, err = libupower.NewUpower(UPOWER_BUS_NAME, "/org/freedesktop/UPower") if err != nil { logger.Warning("create dbus upower failed:", err) return err } login1, err = liblogin1.NewManager("org.freedesktop.login1", "/org/freedesktop/login1") if err != nil { logger.Warning("create dbus login1 failed:", err) finalizeLibs() return err } mediaKey, err = libkeybinding.NewMediaKey("com.deepin.daemon.KeyBinding", "/com/deepin/daemon/MediaKey") if err != nil { logger.Warning("create dbus mediaKey failed:", err) finalizeLibs() return err } notifier, err = libnotifications.NewNotifier("org.freedesktop.Notifications", "/org/freedesktop/Notifications") if err != nil { logger.Warning("Can't build org.freedesktop.Notficaations:", err) finalizeLibs() return err } player, err = libsound.NewSound("com.deepin.api.Sound", "/com/deepin/api/Sound") if err != nil { logger.Warning("Can't build com.deepin.api.Sound:", err) finalizeLibs() return err } power = NewPower() return nil }
func initDBusIFC() error { var err error dbusObj, err = libdbus.NewDBusDaemon("org.freedesktop.DBus", "/") if err != nil { logger.Error("New DBusDaemon Failed: ", err) return err } mediaKeyObj, err = libkeybind.NewMediaKey( "com.deepin.daemon.KeyBinding", "/com/deepin/daemon/MediaKey") if err != nil { logger.Error("New MediaKey Object Failed: ", err) return err } loginObj, err = liblogin1.NewManager("org.freedesktop.login1", "/org/freedesktop/login1") if err != nil { logger.Error("New Login1 Manager Failed: ", err) return err } return nil }
func initDbusObjects() { var err error if nmManager, err = nm.NewManager(dbusNmDest, dbusNmPath); err != nil { logger.Error(err) } if nmSettings, err = nm.NewSettings(dbusNmDest, dbusNmSettingPath); err != nil { logger.Error(err) } if loginManager, err = login1.NewManager(dbusLoginDest, dbusLoginPath); err != nil { logger.Error(err) } }