Example #1
0
// Load loads the applet list into the widget.
//
func (widget *ListThemes) Load(list map[string]datatype.Appleter) {
	for key, pack := range list {
		iter := widget.newIter(key, pack)
		widget.model.SetCols(iter, gtk.Cols{
			RowKey:  key,
			RowName: pack.GetName(),
		})

		img := pack.GetIconFilePath()
		if pix, e := common.PixbufNewFromFile(img, iconSize); !widget.log.Err(e, "Load icon") {
			widget.model.SetValue(iter, RowIcon, pix)
		}
	}
}
Example #2
0
// AddRow adds a row for the applet in the applet list.
//
func (widget *ListAdd) AddRow(name string, app datatype.Appleter) {
	iter := widget.newIter(name, app)
	widget.model.SetCols(iter, gtk.Cols{
		RowKey:      name,
		RowName:     app.GetTitle(),
		RowCategory: app.FormatCategory(),
	})

	// 	int iSize = cairo_dock_search_icon_size (GTK_ICON_SIZE_LARGE_TOOLBAR);
	// 	gchar *cIcon = cairo_dock_search_icon_s_path (pModule->pVisitCard->cIconFilePath, iSize);

	img := app.GetIconFilePath()
	if pix, e := common.PixbufNewFromFile(img, iconSize); !widget.log.Err(e, "Load icon") {
		widget.model.SetValue(iter, RowIcon, pix)
	}

	widget.setActiveIter(iter, app.IsActive())
}
Example #3
0
File: others.go Project: sqp/godock
// modelAddField adds one field to the model and can save reference of fields+iter.
//
func modelAddField(key *cftype.Key, model *gtk.ListStore, field datatype.Field, ro indexiter.ByString) *gtk.TreeIter {
	iter := model.Append()
	model.SetCols(iter, gtk.Cols{
		RowKey:  field.Key,
		RowName: field.Name,
		RowDesc: "none",
	})
	if field.Icon != "" {
		pix, e := common.PixbufNewFromFile(field.Icon, iconSizeCombo)
		if !key.Log().Err(e, "Load icon") {
			model.SetValue(iter, RowIcon, pix)
		}
	}

	if ro != nil {
		ro.Append(iter, field.Key)
	}
	return iter
}
Example #4
0
// Load loads the list of dock shortkeys in the widget.
//
func (widget *Shortkeys) Load() {
	widget.Clear()

	for _, sk := range widget.control.ListShortkeys() {
		iter := widget.model.Append()
		widget.rows[iter] = sk

		widget.model.SetCols(iter, gtk.Cols{
			rowDemander:    sk.Demander(),
			rowDescription: sk.Description(),
			rowShortkey:    sk.KeyString(),
			rowColor:       getColor(sk),
			rowEditable:    true}) // Editable forced for all shortkey cells.

		img := sk.IconFilePath()
		if pix, e := common.PixbufNewFromFile(img, 24); !widget.log.Err(e, "Load icon") {
			widget.model.SetValue(iter, rowIcon, pix)
		}
	}
}
Example #5
0
// Load loads the widget fields.
//
func (widget *List) Load(shareData string) {
	for _, item := range coreItems {
		iter := widget.model.Append()
		widget.rows[item.Key] = &row{iter, item}

		args := gtk.Cols{
			rowKey:     item.Key,
			rowName:    tran.Slate(item.Title),
			rowTooltip: item.Tooltip,
		}
		widget.model.SetCols(iter, args)

		if item.Icon != "" {
			path := filepath.Join(shareData, item.Icon)
			if pix, e := common.PixbufNewFromFile(path, iconSize); !widget.log.Err(e, "Load icon") {
				widget.model.SetValue(iter, rowIcon, pix)
			}
		}
	}
}
Example #6
0
// Load loads the applet list into the widget.
//
func (widget *ListExternal) Load(list map[string]datatype.Appleter) {
	for key, pack := range list {
		iter := widget.newIter(key, pack)
		// iter := widget.model.Append()
		widget.model.SetCols(iter, gtk.Cols{
			RowKey:      key,
			RowName:     pack.GetName(),
			RowCategory: pack.FormatCategory(),
		})

		if pack.IsInstalled() { // local packages.
			widget.setActiveIter(iter, true)

			img := pack.GetIconFilePath()
			if pix, e := common.PixbufNewFromFile(img, iconSize); !widget.log.Err(e, "Load icon") {
				widget.model.SetValue(iter, RowIcon, pix)
			}
		} else {
			widget.setActiveIter(iter, false)
			// icon missing, can't set.
		}
	}
}