Exemple #1
0
func main() {
	if !lib.UniqueOnSession(DBUS_DEST) {
		logger.Warning("There is an Search running")
		return
	}

	logger.BeginTracing()
	defer logger.EndTracing()
	logger.SetRestartCommand("/usr/lib/deepin-daemon/search")

	if err := dbus.InstallOnSession(GetManager()); err != nil {
		logger.Fatal("Search Install DBus Failed:", err)
		return
	}
	dbus.DealWithUnhandledMessage()

	dbus.SetAutoDestroyHandler(time.Second*5, func() bool {
		if GetManager().writeStart {
			select {
			case <-GetManager().writeEnd:
				return true
			}
		}

		return true
	})

	if err := dbus.Wait(); err != nil {
		logger.Warning("Search lost dbus:", err)
		os.Exit(-1)
	} else {
		os.Exit(0)
	}
}
Exemple #2
0
func main() {
	gettext.InitI18n()
	gettext.Textdomain("dde-daemon")

	lang := Start()
	if lang == nil {
		return
	}

	dbus.DealWithUnhandledMessage()

	dbus.SetAutoDestroyHandler(time.Second*5, func() bool {
		if lang.LocaleState == LocaleStateChanging {
			return false
		} else {
			return true
		}
	})

	if err := dbus.Wait(); err != nil {
		Stop()
		os.Exit(-1)
	}

	Stop()
	os.Exit(0)
}
Exemple #3
0
func main() {
	logger.BeginTracing()
	defer logger.EndTracing()

	if !lib.UniqueOnSystem(grub2.DbusGrub2ExtDest) {
		logger.Warning("There already has an Grub2 daemon running.")
		return
	}

	flag.BoolVar(&argDebug, "d", false, "debug mode")
	flag.BoolVar(&argDebug, "debug", false, "debug mode")
	flag.Parse()
	if argDebug {
		logger.Info("debug mode")
		logger.SetLogLevel(log.LevelDebug)
	}

	ge := grub2.NewGrub2Ext()
	err := dbus.InstallOnSystem(ge)
	if err != nil {
		logger.Errorf("register dbus interface failed: %v", err)
		os.Exit(1)
	}

	dbus.DealWithUnhandledMessage()
	dbus.SetAutoDestroyHandler(10*time.Second, nil)

	if err := dbus.Wait(); err != nil {
		logger.Error("lost dbus session:", err)
		os.Exit(1)
	}
}
Exemple #4
0
func main() {
	logger.BeginTracing()
	defer logger.EndTracing()

	if !lib.UniqueOnSystem("com.deepin.daemon") {
		logger.Warning("There already has an dde-daemon running.")
		return
	}

	InitI18n()
	Textdomain("dde-daemon")

	logger.SetRestartCommand("/usr/lib/deepin-daemon/dde-system-daemon")

	loader.StartAll()
	defer loader.StopAll()

	dbus.DealWithUnhandledMessage()

	if err := dbus.Wait(); err != nil {
		logger.Errorf("Lost dbus: %v", err)
		os.Exit(-1)
	} else {
		os.Exit(0)
	}
}
Exemple #5
0
func main() {
	err := dbus.InstallOnSystem(&LanguageSelector{})
	if err != nil {
		print("Can't Init LanguageSelector DBus Servier: " + err.Error())
		return
	}
	dbus.DealWithUnhandledMessage()
	dbus.Wait()
}
Exemple #6
0
func main() {
	helper := NewBacklightHelper()
	err := dbus.InstallOnSystem(helper)
	if err != nil {
		logger.Errorf("register dbus interface failed: %v", err)
		os.Exit(1)
	}

	dbus.SetAutoDestroyHandler(time.Second*1, nil)

	dbus.DealWithUnhandledMessage()
	if err := dbus.Wait(); err != nil {
		logger.Errorf("lost dbus session: %v", err)
		os.Exit(1)
	} else {
		os.Exit(0)
	}
}
Exemple #7
0
func runAsDaemon() {
	logger := log.NewLogger(grub2.DbusGrubDest + ".Runner")
	logger.BeginTracing()
	defer logger.EndTracing()

	if !lib.UniqueOnSession(grub2.DbusGrubDest) {
		logger.Error("dbus unique:", grub2.DbusGrubDest)
		return
	}
	grub2.Start()
	dbus.SetAutoDestroyHandler(60*time.Second, func() bool {
		return !grub2.IsUpdating()
	})
	dbus.DealWithUnhandledMessage()
	if err := dbus.Wait(); err != nil {
		logger.Error("lost dbus session:", err)
		os.Exit(1)
	}
}
Exemple #8
0
func main() {
	if !lib.UniqueOnSession(DEST) {
		Logger.Warning("There has an set-fonts running...")
		return
	}

	Logger.BeginTracing()
	defer Logger.EndTracing()
	Logger.SetRestartCommand("/usr/lib/deepin-daemon/personalization")

	StartFont()
	dbus.DealWithUnhandledMessage()

	dbus.SetAutoDestroyHandler(time.Second*5, nil)
	if err := dbus.Wait(); err != nil {
		Logger.Warning("Lost DBus:", err)
		os.Exit(-1)
	} else {
		os.Exit(0)
	}
}
Exemple #9
0
func main() {
	InitI18n()
	Textdomain("dde-daemon")

	if !lib.UniqueOnSession("com.deepin.daemon") {
		logger.Warning("There already has a dde-daemon running.")
		return
	}
	if len(os.Args) >= 2 {
		for _, disabledModuleName := range os.Args[1:] {
			loader.Enable(disabledModuleName, false)
		}
	}

	C.init()
	proxy.SetupProxy()

	initModules()
	listenDaemonSettings()

	loader.StartAll()
	defer loader.StopAll()

	go func() {
		if err := dbus.Wait(); err != nil {
			logger.Errorf("Lost dbus: %v", err)
			os.Exit(-1)
		} else {
			logger.Info("dbus connection is closed by user")
			os.Exit(0)
		}
	}()

	ddeSessionRegister()
	dbus.DealWithUnhandledMessage()
	glib.StartLoop()
}