// OnSelect reacts when a row is selected. // Set preview data and set installed and active buttons state. // func (widget *MenuDownload) OnSelect(pack datatype.Appleter) { widget.current = pack // Set installed button state. widget.installed.SetSensitive(pack.CanUninstall()) // Disable uninstall button if it's a user special applet. widget.SetInstalledState(pack.IsInstalled()) // Set installed button state and disable it if the package isn't installed yet. widget.active.SetSensitive(pack.IsInstalled()) widget.SetActiveState(pack.IsActive()) }
// 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()) }