Esempio n. 1
0
func NewTheme(info PathInfo, handler func(string)) *Theme {
	if handler == nil {
		logger.Error("Event Handler nil")
		return nil
	}

	t := &Theme{}

	t.eventHandler = handler
	t.Type = info.FileFlag
	t.filePath = info.FilePath

	t.setPropsFromFile()
	t.setPropPreview(t.getPreviewList())
	t.objectPath = themeDBusPath + t.Name

	if t.Type == FileFlagUserOwned {
		t.watcher = dutils.NewWatchProxy()
		if t.watcher != nil {
			t.watcher.SetFileList(t.getDirList())
			t.watcher.SetEventHandler(t.handleEvent)
			go t.watcher.StartWatch()
		}
	}

	return t
}
Esempio n. 2
0
func NewManager() *Manager {
	var m = &Manager{}

	m.usersMap = make(map[string]*User)

	m.setPropGuestIcon(userIconGuest)
	m.setPropAllowGuest(isGuestUserEnabled())
	m.newUsers(getUserPaths())

	m.watcher = dutils.NewWatchProxy()
	if m.watcher != nil {
		m.watcher.SetFileList(m.getWatchFiles())
		m.watcher.SetEventHandler(m.handleFileChanged)
		go m.watcher.StartWatch()
	}

	return m
}
Esempio n. 3
0
func NewSoundTheme(handler func([]string)) *SoundTheme {
	if handler == nil {
		return nil
	}
	sound := &SoundTheme{}

	sysDirs, userDirs := getDirInfoList()
	sound.infoList = getThemeList(sysDirs, userDirs)
	sound.eventHandler = handler
	sound.watcher = dutils.NewWatchProxy()
	if sound.watcher != nil {
		sound.watcher.SetFileList(getDirList())
		sound.watcher.SetEventHandler(sound.handleEvent)
		go sound.watcher.StartWatch()
	}

	return sound
}
Esempio n. 4
0
func NewDefaultApps() *DefaultApps {
	defer func() {
		if err := recover(); err != nil {
			logger.Errorf("Recover Error in NewDefaultApps: %v",
				err)
		}
	}()

	dapp := &DefaultApps{}

	dapp.watcher = dutils.NewWatchProxy()
	if dapp.watcher != nil {
		dapp.watcher.SetFileList(getWatchFiles())
		dapp.watcher.SetEventHandler(dapp.handleMimeFileChanged)
		go dapp.watcher.StartWatch()
	}

	return dapp
}
Esempio n. 5
0
func NewGreeterTheme(handler func([]string)) *GreeterTheme {
	if handler == nil {
		return nil
	}

	greeter := &GreeterTheme{}

	sysDirs, userDirs := getDirInfoList()
	greeter.infoList = getThemeList(sysDirs, userDirs)
	greeter.eventHandler = handler

	greeter.watcher = dutils.NewWatchProxy()
	if greeter.watcher != nil {
		greeter.watcher.SetFileList(getDirList())
		greeter.watcher.SetEventHandler(greeter.handleEvent)
		go greeter.watcher.StartWatch()
	}

	return greeter
}
Esempio n. 6
0
func NewIconTheme(handler func([]string)) *IconTheme {
	if handler == nil {
		return nil
	}

	icon := &IconTheme{}

	icon.eventHandler = handler
	sysDirs, userDirs := getDirInfoList()
	icon.infoList = getThemeList(sysDirs, userDirs)

	icon.watcher = dutils.NewWatchProxy()
	if icon.watcher != nil {
		icon.watcher.SetFileList(getDirList())
		icon.watcher.SetEventHandler(icon.handleEvent)
		go icon.watcher.StartWatch()
	}

	return icon
}
Esempio n. 7
0
func NewGtkTheme(handler func([]string)) *GtkTheme {
	if handler == nil {
		return nil
	}

	gtk := &GtkTheme{}

	gtk.eventHandler = handler
	sysDirs, userDirs := getDirInfoList()
	gtk.infoList = getThemeList(sysDirs, userDirs)

	gtk.watcher = dutils.NewWatchProxy()
	if gtk.watcher != nil {
		gtk.watcher.SetFileList(getDirList())
		gtk.watcher.SetEventHandler(gtk.handleEvent)
		go gtk.watcher.StartWatch()
	}

	return gtk
}
Esempio n. 8
0
func NewBackground(handler func([]string)) *Background {
	if handler == nil {
		return nil
	}

	bg := &Background{}

	bg.eventHandler = handler
	sysList, userList := getDirInfoList()
	bg.infoList = getBackgroundInfoList(sysList, userList)

	bg.watcher = dutils.NewWatchProxy()
	if bg.watcher != nil {
		bg.watcher.SetFileList(getBgDirList(bg.infoList))
		bg.watcher.SetEventHandler(bg.handleEvent)
		go bg.watcher.StartWatch()
	}

	return bg
}
Esempio n. 9
0
func NewCursorTheme(handler func([]string)) *CursorTheme {
	if handler == nil {
		return nil
	}

	cursor := &CursorTheme{}

	cursor.eventHandler = handler
	sysDirs, userDirs := getDirInfoList()
	cursor.infoList = getThemeList(sysDirs, userDirs)

	cursor.watcher = dutils.NewWatchProxy()
	if cursor.watcher != nil {
		cursor.watcher.SetFileList(getDirList())
		cursor.watcher.SetEventHandler(cursor.handleEvent)
		go cursor.watcher.StartWatch()
	}
	// handle cursor changed by gtk+
	C.handle_cursor_changed()

	return cursor
}