本文整理匯總了Golang中github.com/sqp/godock/widgets/cfbuild/cftype.Key.Log方法的典型用法代碼示例。如果您正苦於以下問題:Golang Key.Log方法的具體用法?Golang Key.Log怎麽用?Golang Key.Log使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/sqp/godock/widgets/cfbuild/cftype.Key
的用法示例。
在下文中一共展示了Key.Log方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: findID
func findID(list []string, current string, key *cftype.Key) int {
for i, str := range list {
if current == str {
return i
}
}
if key != nil {
key.Log().NewErr("not found", "list findID", current, list)
}
return 0
}
示例2: IntegerSpin
// IntegerSpin adds an integer scale widget.
//
func IntegerSpin(key *cftype.Key) {
if key.NbElements > 1 { // TODO: remove temp test
key.Log().Info("integer multi ffs", key.Type.String())
}
value := key.Value().Int()
minValue, maxValue := minMaxValues(key)
w := newgtk.SpinButtonWithRange(minValue, maxValue, 1)
w.SetValue(float64(value))
PackValuerAsInt(key, w, w, value)
}
示例3: PackComboBoxWithIndexHandbooker
// PackComboBoxWithIndexHandbooker creates a combo box filled with the getList call.
//
func PackComboBoxWithIndexHandbooker(key *cftype.Key, index map[string]datatype.Handbooker) {
model := newModelSimple()
model.SetSortColumnId(RowName, gtk.SORT_ASCENDING)
widget, getValue := NewComboBoxWithModel(model, key.Log(), false, false, false)
value := key.Value().String()
details := handbook.New(key.Log())
key.PackWidget(details, false, false, 0)
widget.Connect("changed", func() {
name := key.Value().String()
pack, ok := index[name]
if ok {
details.SetPackage(pack)
} else {
key.Log().NewErr("key missing", "ComboHandbook select preview:", name)
}
})
fields := datatype.IndexHandbooksToFields(index)
saved := indexiter.NewByString(widget, key.Log())
iter := fillModelWithFields(key, model, fields, value, saved)
widget.SetActiveIter(iter) // Set iter after connect, to update with current value.
key.PackKeyWidget(key,
getValue,
func(uncast interface{}) { saved.SetActive(uncast.(string)) },
widget,
)
}
示例4: IntegerScale
// IntegerScale adds an integer scale widget.
//
func IntegerScale(key *cftype.Key) {
if key.NbElements > 1 { // TODO: remove temp test
key.Log().Info("IntegerScale multi", key.NbElements, key.Type.String())
}
value := key.Value().Int()
minValue, maxValue := minMaxValues(key)
step := (maxValue - minValue) / 20
if step < 1 {
step = 1
}
adjustment := newgtk.Adjustment(float64(value), minValue, maxValue, 1, step, 0)
w := newgtk.Scale(gtk.ORIENTATION_HORIZONTAL, adjustment)
w.Set("digits", 0)
PackValuerAsInt(key, WrapKeyScale(key, w), w, value)
}
示例5: modelAddField
// 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
}
示例6: NewComboBox
// NewComboBox creates a combo box.
//
func NewComboBox(key *cftype.Key, withEntry, numbered bool, current string, list []datatype.Field) (
widget *gtk.ComboBox, model *gtk.ListStore, getValue func() interface{}, setValue func(interface{})) {
model = newModelSimple()
// gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(modele), CAIRO_DOCK_MODEL_NAME, GTK_SORT_ASCENDING)
widget = newgtk.ComboBoxWithModel(model)
renderer := newgtk.CellRendererText()
widget.PackStart(renderer, true)
widget.AddAttribute(renderer, "text", RowName)
// Fill and set current.
iter := fillModelWithFields(key, model, list, current, nil)
widget.SetActiveIter(iter)
switch {
case withEntry: // get and set the entry content string.
entry := newgtk.Entry() // Add entry manually so we don't have to recast a GetChild
entry.SetText(current)
widget.Add(entry)
widget.Set("id-column", RowName)
widget.Connect("changed", func() { entry.SetText(widget.GetActiveID()) })
getValue = func() interface{} { v, _ := entry.GetText(); return v }
setValue = func(uncast interface{}) { entry.SetText(uncast.(string)) }
case numbered: // get and set selected as position int
getValue = func() interface{} { return widget.GetActive() }
setValue = func(uncast interface{}) { widget.SetActive(uncast.(int)) }
default: // get and set selected as content string
widget.Set("id-column", RowKey)
getValue = func() interface{} { return widget.GetActiveID() }
setValue = func(uncast interface{}) {
newID := datatype.ListFieldsIDByName(list, uncast.(string), key.Log())
widget.SetActive(newID)
}
}
return
}
示例7: ListDock
// ListDock adds a dock list widget.
//
func ListDock(key *cftype.Key) {
// Get current Icon name if its a Subdock.
iIconType, _ := key.Storage().Int(key.Group, "Icon Type")
SubdockName := ""
if iIconType == cftype.UserIconStack { // it's a stack-icon
SubdockName, _ = key.Storage().String(key.Group, "Name") // It's a subdock, get its name to remove the selection of a recursive position (inside itself).
}
list := key.Source().ListDocks("", SubdockName) // Get the list of available docks. Keep parent, but remove itself from the list.
list = append(list, datatype.Field{
Key: datatype.KeyNewDock,
Name: tran.Slate("New main dock")},
)
model := newModelSimple()
current := key.Value().String()
if current == "" {
current = datatype.KeyMainDock
}
model.SetSortColumnId(RowName, gtk.SORT_ASCENDING)
widget := newgtk.ComboBoxWithModel(model)
renderer := newgtk.CellRendererText()
widget.PackStart(renderer, false)
widget.AddAttribute(renderer, "text", RowName)
saved := indexiter.NewByString(widget, key.Log())
iter := fillModelWithFields(key, model, list, current, saved)
widget.SetActiveIter(iter)
key.PackKeyWidget(key,
getValueListCombo(widget, model, key.Log()),
func(uncast interface{}) { saved.SetActive(uncast.(string)) },
widget)
}
示例8: Handbook
// Handbook adds a handbook widget to show basic applet informations.
//
func Handbook(key *cftype.Key) {
appletName := key.Value().String()
widget := handbook.New(key.Log())
widget.ShowVersion = true
book := key.Source().Handbook(appletName)
if widget == nil || book == nil {
key.Log().NewErr("Handbook no widget")
return
}
widget.SetPackage(book)
key.BoxPage().PackStart(widget, true, true, 0)
key.PackKeyWidget(key,
func() interface{} { return appletName },
func(uncast interface{}) {
appletName = uncast.(string)
book := key.Source().Handbook(appletName)
widget.SetPackage(book)
},
)
}
示例9: CheckButton
// CheckButton adds a check button widget.
//
func CheckButton(key *cftype.Key) {
if key.NbElements > 1 { // TODO: remove temp test
key.Log().Info("CheckButton multi", key.NbElements, key.Type.String())
}
values := key.Value().ListBool()
var activers []widgetActiver
for k := 0; k < key.NbElements; k++ {
var value bool
if k < len(values) {
value = values[k]
}
w := newgtk.Switch()
w.SetActive(value)
key.PackSubWidget(w)
activers = append(activers, w)
if key.IsType(cftype.KeyBoolCtrl) {
// _allocate_new_buffer;
// data[0] = pKeyBox;
// data[1] = (pFrameVBox != NULL ? pFrameVBox : pGroupBox);
// if (pAuthorizedValuesList != NULL && pAuthorizedValuesList[0] != NULL)
// NbControlled = g_ascii_strtod (pAuthorizedValuesList[0], NULL);
// else
// NbControlled = 1;
// data[2] = GINT_TO_POINTER (NbControlled);
// if (NbControlled < 0) // a negative value means that the behavior is inverted.
// {
// bValue = !bValue;
// NbControlled = -NbControlled;
// }
// g_signal_connect (G_OBJECT (pOneWidget), "toggled", G_CALLBACK(_cairo_dock_toggle_control_button), data);
// g_object_set_data (G_OBJECT (pKeyBox), "nb-ctrl-widgets", GINT_TO_POINTER (NbControlled));
// g_object_set_data (G_OBJECT (pKeyBox), "one-widget", pOneWidget);
// if (! bValue) // les widgets suivants seront inactifs.
// {
// CDControlWidget *cw = g_new0 (CDControlWidget, 1);
// pControlWidgets = g_list_prepend (pControlWidgets, cw);
// cw->iNbSensitiveWidgets = 0;
// cw->NbControlled = NbControlled;
// cw->iFirstSensitiveWidget = 1;
// cw->pControlContainer = (pFrameVBox != NULL ? pFrameVBox : pGroupBox);
// } // sinon le widget suivant est sensitif, donc rien a faire.
}
}
if key.NbElements == 1 {
key.PackKeyWidget(key,
func() interface{} { return activers[0].GetActive() },
func(uncast interface{}) { activers[0].SetActive(uncast.(bool)) },
)
} else {
key.PackKeyWidget(key,
func() interface{} { return listActiverGet(activers) },
func(uncast interface{}) { listActiverSet(activers, uncast.([]bool)) },
)
}
}
示例10: cycleNextField
func cycleNextField(fields []datatype.Field, current string, key *cftype.Key) string {
newID := datatype.ListFieldsIDByName(fields, current, key.Log())
return fields[cycleNextID(len(fields), newID, 1)].Key
}
示例11: Strings
// Strings adds a string widget. Many options included.
// TODO: need password cypher, G_USER_DIRECTORY_PICTURES, play sound.
//
func Strings(key *cftype.Key) {
value := key.Value().String()
widget := newgtk.Entry()
widget.SetText(value)
if key.IsType(cftype.KeyPasswordEntry) { // Hide text and decrypt value.
widget.SetVisibility(false)
value = key.Source().DecryptString(value)
}
// Pack the widget before any other (in full size if needed).
// So we do it now and fill the callbacks later
key.PackKeyWidget(key, nil, nil, widget)
var setValue func(interface{})
// Add special buttons to fill the entry box.
switch key.Type {
case cftype.KeyFileSelector, cftype.KeyFolderSelector,
cftype.KeySoundSelector, cftype.KeyImageSelector: // Add a file selector.
fileChooser := newgtk.Button()
img := newgtk.ImageFromIconName("document-open", gtk.ICON_SIZE_SMALL_TOOLBAR)
fileChooser.SetImage(img)
fileChooser.Connect("clicked", onFileChooserOpen, fileChooserData{widget, key})
key.PackSubWidget(fileChooser)
if key.IsType(cftype.KeySoundSelector) { //Sound Play Button
play := newgtk.Button()
imgPlay := newgtk.ImageFromIconName("media-playback-start", gtk.ICON_SIZE_SMALL_TOOLBAR)
play.SetImage(imgPlay)
// play.Connect("clicked", C._cairo_dock_play_a_sound, data)
key.PackSubWidget(play)
}
case cftype.KeyShortkeySelector, cftype.KeyClassSelector: // Add a key/class grabber.
grab := newgtk.ButtonWithLabel("Grab")
key.PackSubWidget(grab)
// gtk_widget_add_events(pMainWindow, GDK_KEY_PRESS_MASK);
switch key.Type {
case cftype.KeyClassSelector:
grab.Connect("clicked", func() {
widget.SetSensitive(false) // Block widgets.
grab.SetSensitive(false)
go func() {
class, e := key.Source().GrabWindowClass() // Wait user selection in a routine.
glib.IdleAdd(func() { // And resync with the GTK loop to display results.
widget.SetSensitive(true) // Reactivate widgets.
grab.SetSensitive(true)
if !key.Log().Err(e, "ClassSelector", key.Group, key.Name) {
setValue(class) // On success.
key.Log().Debug("KeyClassSelector window selected", class)
}
})
}()
})
case cftype.KeyShortkeySelector:
grab.Connect("clicked", onKeyGrabClicked, &textGrabData{entry: widget, win: key.Source().GetWindow()})
}
// for _, sk := range key.Source().ListShortkeys() {
// if sk.GetConfFilePath() == key.Storage().FilePath() {
// println("found file shortkey")
// }
// }
}
// Display a default value when empty.
if len(key.AuthorizedValues) > 0 && key.AuthorizedValues[0] != "" {
defaultText := key.Translate(key.AuthorizedValues[0])
cbChanged, _ := widget.Connect("changed", onTextDefaultChanged, key)
data := textDefaultData{key: key, text: defaultText, cbID: cbChanged}
widget.Connect("focus-in-event", onTextDefaultFocusIn, data)
widget.Connect("focus-out-event", onTextDefaultFocusOut, data)
// TODO: check other use of those fields.
// g_object_set_data (G_OBJECT (pEntry), "ignore-value", GINT_TO_POINTER (TRUE));
// g_object_set_data (G_OBJECT (pOneWidget), "default-text", cDefaultText);
context, _ := widget.GetStyleContext()
context.AddProvider(MainCSS(), gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
setValue = func(uncast interface{}) {
// if !key.IsDefault { // not sure why this was here.
widget.SetText(uncast.(string))
onTextDefaultFocusOut(widget, nil, data)
}
//.........這裏部分代碼省略.........
示例12: TreeView
// TreeView adds a treeview widget.
//
func TreeView(key *cftype.Key) {
values := key.Value().ListString()
// Build treeview.
model := newgtk.ListStore(
glib.TYPE_STRING, /* RowKey*/
glib.TYPE_STRING, /* RowName*/
glib.TYPE_STRING, /* RowIcon*/
glib.TYPE_STRING, /* RowDesc*/
glib.TYPE_BOOLEAN, // active
glib.TYPE_INT) // order
widget := newgtk.TreeViewWithModel(model)
widget.Set("headers-visible", false)
getValue := func() interface{} { // Grab data from all iters.
var list []string
iter, ok := model.GetIterFirst()
for ; ok; ok = model.IterNext(iter) {
str, e := gunvalue.New(model.GetValue(iter, RowName)).String()
if !key.Log().Err(e, "WidgetTreeView GetValue "+key.Name) {
list = append(list, str)
}
}
return list
}
// Add control buttons.
if key.IsType(cftype.KeyTreeViewMultiChoice) {
renderer := newgtk.CellRendererToggle()
col := newgtk.TreeViewColumnWithAttribute("", renderer, "active", 4)
widget.AppendColumn(col)
// g_signal_connect (G_OBJECT (rend), "toggled", (GCallback) _cairo_dock_activate_one_element, modele);
renderer.Set("active", 4)
}
renderer := newgtk.CellRendererText()
col := newgtk.TreeViewColumnWithAttribute("", renderer, "text", RowName)
widget.AppendColumn(col)
// cValueList = g_key_file_get_string_list (pKeyFile, cGroupName, cKeyName, &length, NULL);
model.SetSortColumnId(5, gtk.SORT_ASCENDING)
scroll := newgtk.ScrolledWindow(nil, nil)
//
// if len(key.AuthorizedValues) > 0 {
// key.Log().Info("WidgetTreeView AuthorizedValues", key.AuthorizedValues)
// }
// if (key.AuthorizedValues != NULL && key.AuthorizedValues[0] != NULL)
// for (k = 0; key.AuthorizedValues[k] != NULL; k++);
// else
// k = 1;
scroll.Set("height-request", 100) // key.IsType(cftype.KeyTreeViewSortModify) ? 100 : MIN (100, k * 25)
scroll.Set("width-request", 250)
scroll.SetPolicy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
scroll.Add(widget)
vboxItems := newgtk.Box(gtk.ORIENTATION_VERTICAL, cftype.MarginGUI)
grid := newgtk.Grid()
grid.Attach(vboxItems, 0, 0, 1, 1)
grid.Attach(scroll, 1, 0, 1, 1)
if key.IsType(cftype.KeyTreeViewSortSimple, cftype.KeyTreeViewSortModify) {
buttonUp := newgtk.Button()
buttonDn := newgtk.Button()
imgUp := newgtk.ImageFromIconName("go-up", gtk.ICON_SIZE_SMALL_TOOLBAR)
imgDn := newgtk.ImageFromIconName("go-down", gtk.ICON_SIZE_SMALL_TOOLBAR)
buttonUp.SetImage(imgUp)
buttonDn.SetImage(imgDn)
data := treeViewData{key.Log(), model, widget, nil}
buttonUp.Connect("clicked", onTreeviewMoveUp, data) // Move selection up and down callbacks.
buttonDn.Connect("clicked", onTreeviewMoveDown, data)
vboxItems.PackStart(buttonUp, false, false, 0)
vboxItems.PackStart(buttonDn, false, false, 0)
if key.IsType(cftype.KeyTreeViewSortModify) {
buttonAdd := newgtk.Button()
entry := newgtk.Entry()
buttonRm := newgtk.Button()
imgAdd := newgtk.ImageFromIconName("list-add", gtk.ICON_SIZE_SMALL_TOOLBAR)
imgRm := newgtk.ImageFromIconName("list-remove", gtk.ICON_SIZE_SMALL_TOOLBAR)
buttonAdd.SetImage(imgAdd)
buttonRm.SetImage(imgRm)
vboxItems.PackStart(buttonRm, false, false, 0)
//.........這裏部分代碼省略.........
示例13: Lists
// Lists adds a string list widget.
//
func Lists(key *cftype.Key) {
if key.IsType(cftype.KeyListNbCtrlSimple, cftype.KeyListNbCtrlSelect) && len(key.AuthorizedValues) == 0 {
key.Log().NewWarn("not enough values", "widget numbered control list:", key.Name)
return
}
// Get full value with ';'.
value := key.Value().String()
// log.DEV("LIST "+string(key.Type), key.Name, value, key.AuthorizedValues)
listIsNumbered := key.IsType(cftype.KeyListNumbered, cftype.KeyListNbCtrlSimple, cftype.KeyListNbCtrlSelect)
iSelectedItem := -1
current := ""
// Control selective use 3 AuthorizedValues fields for each "value".
step := ternary.Int(key.IsType(cftype.KeyListNbCtrlSelect), 3, 1)
if key.IsType(cftype.KeyListEntry) {
current = value
}
if listIsNumbered && value != "" {
var e error
iSelectedItem, e = strconv.Atoi(value)
switch {
case key.Log().Err(e, "selection problem", "[", value, "]", "[", iSelectedItem, "]", key.Name):
case iSelectedItem < 0:
case iSelectedItem < len(key.AuthorizedValues):
current = key.AuthorizedValues[iSelectedItem*step]
default:
key.Log().NewWarn("selection out of range", "widget numbered list:", key.Name)
}
}
var list []datatype.Field
if len(key.AuthorizedValues) > 0 {
// int iOrder1, iOrder2, iExcept;
if key.IsType(cftype.KeyListNbCtrlSimple, cftype.KeyListNbCtrlSelect) {
key.SetNbControlled(0)
}
// gchar *cResult = (listIsNumbered ? g_new0 (gchar , 10) : NULL);
for k := 0; k < len(key.AuthorizedValues); k += step { // on ajoute toutes les chaines possibles a la combo.
if !listIsNumbered && iSelectedItem == -1 && value == key.AuthorizedValues[k] {
current = value
iSelectedItem = k / step
}
// if (cResult != NULL)
// snprintf (cResult, 9, "%d", k/dk); // dk becomes step
// iExcept = 0;
// if key.IsType(cftype.KeyListNbCtrlSelect) {
// iOrder1 = atoi (key.AuthorizedValues[k+1]);
// gchar *str = strchr (key.AuthorizedValues[k+2], ',');
// if (str) // Note: this mechanism is an addition to the original {first widget, number of widgets}; it's not very generic nor beautiful, but until we need more, it's well enough (currently, only the Dock background needs it).
// {
// *str = '\0';
// iExcept = atoi (str+1);
// }
// iOrder2 = atoi (key.AuthorizedValues[k+2]);
// NbControlled = MAX (NbControlled, iOrder1 + iOrder2 - 1);
// //g_print ("iSelectedItem:%d ; k/dk:%d\n", iSelectedItem , k/dk);
// if (iSelectedItem == (int)k/dk)
// {
// iFirstSensitiveWidget = iOrder1;
// iNbSensitiveWidgets = iOrder2;
// iNonSensitiveWidget = iExcept;
// if (iNonSensitiveWidget != 0)
// NbControlled ++;
// }
// } else {
// iOrder1 = iOrder2 = k;
// }
//
name := ""
if key.IsType(cftype.KeyListEntry) {
name = key.AuthorizedValues[k]
} else {
name = key.Translate(key.AuthorizedValues[k])
}
list = append(list, datatype.Field{
Key: key.AuthorizedValues[k],
Name: name,
})
// CAIRO_DOCK_MODEL_ORDER, iOrder1,
// CAIRO_DOCK_MODEL_ORDER2, iOrder2,
// CAIRO_DOCK_MODEL_STATE, iExcept, -1);
}
}
//.........這裏部分代碼省略.........
示例14: LaunchCommand
// LaunchCommand adds a launch command widget.
// HELP ONLY
//
func LaunchCommand(key *cftype.Key) {
if len(key.AuthorizedValues) == 0 || key.AuthorizedValues[0] == "" {
key.Log().NewErrf("command missing", "widget LaunchCommand: %s", key.Name)
return
}
// log.Info(key.Name, key.AuthorizedValues)
if key.IsType(cftype.KeyLaunchCmdIf) {
if len(key.AuthorizedValues) < 2 {
key.Label().SetSensitive(false)
return
}
key.Log().Info("KeyLaunchCmdIf : disabled for now")
return
// key.Log().Info("test", key.AuthorizedValues[1])
// key.Log().Err(key.Log().ExecShow(key.AuthorizedValues[1]), "exec test")
// gchar *cSecondCommand = pAuthorizedValuesList[1];
// gchar *cResult = cairo_dock_launch_command_sync (cSecondCommand);
// cd_debug ("%s: %s => %s", __func__, cSecondCommand, cResult);
// if (cResult == NULL || *cResult == '0' || *cResult == '\0') // result is 'fail'
// {
// gtk_widget_set_sensitive (pLabel, FALSE);
// g_free (cResult);
// break ;
// }
// g_free (cResult);
}
spinner := newgtk.Spinner()
spinner.SetNoShowAll(true)
key.PackSubWidget(spinner)
btn := newgtk.ButtonFromIconName("go-jump", gtk.ICON_SIZE_BUTTON)
key.PackSubWidget(btn)
btn.Connect("clicked", func() {
cmd, e := key.Log().ExecShlex(key.AuthorizedValues[0])
if key.Log().Err(e, "widget LaunchCommand parse command", key.Name, ":", key.AuthorizedValues[0]) {
return
}
e = cmd.Start()
if key.Log().Err(e, "widget LaunchCommand exec", key.AuthorizedValues[0]) {
return
}
btn.Hide()
spinner.Show()
spinner.Start()
// Wait the external program in a go routine.
// When finished, restore buttons state in the gtk idle loop.
go func() {
cmd.Wait()
glib.IdleAdd(func() {
btn.Show()
spinner.Hide()
spinner.Stop()
})
}()
})
// G_CALLBACK (_cairo_dock_widget_launch_command),
}
示例15: ListIconsMainDock
// ListIconsMainDock adds an icon list widget.
//
func ListIconsMainDock(key *cftype.Key) {
// {
// if (g_pMainDock == NULL) // maintenance mode... no dock, no icons
// {
// cValue = g_key_file_get_string (pKeyFile, cGroupName, cKeyName, NULL);
// pOneWidget = gtk_entry_new ();
// gtk_entry_set_text (GTK_ENTRY (pOneWidget), cValue); // if there is a problem, we can edit it.
// _pack_subwidget (pOneWidget);
// g_free (cValue);
// break;
// }
//
//
current := key.Value().String()
model := newModelSimple()
widget := newgtk.ComboBoxWithModel(model)
rp := newgtk.CellRendererPixbuf()
widget.PackStart(rp, false)
widget.AddAttribute(rp, "pixbuf", RowIcon)
renderer := newgtk.CellRendererText()
widget.PackStart(renderer, true)
widget.AddAttribute(renderer, "text", RowName)
list := key.Source().ListIconsMainDock()
saved := indexiter.NewByString(widget, key.Log())
iter := fillModelWithFields(key, model, list, current, saved)
widget.SetActiveIter(iter)
//
// // build the modele and combo
// modele = _cairo_dock_gui_allocate_new_model ();
// pOneWidget = gtk_combo_box_new_with_model (GTK_TREE_MODEL (modele));
// rend = gtk_cell_renderer_pixbuf_new ();
// gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (pOneWidget), rend, FALSE);
// gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (pOneWidget), rend, "pixbuf", CAIRO_DOCK_MODEL_ICON, NULL);
// rend = gtk_cell_renderer_text_new ();
// gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (pOneWidget), rend, FALSE);
// gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (pOneWidget), rend, "text", CAIRO_DOCK_MODEL_NAME, NULL);
// _pack_subwidget (pOneWidget);
// // get the dock
// CairoDock *pDock = NULL;
// if (pAuthorizedValuesList != NULL && pAuthorizedValuesList[0] != NULL)
// pDock = gldi_dock_get (pAuthorizedValuesList[0]);
// if (!pDock)
// pDock = g_pMainDock;
// // insert each icon
// cValue = g_key_file_get_string (pKeyFile, cGroupName, cKeyName, NULL);
// gint iDesiredIconSize = cairo_dock_search_icon_size (GTK_ICON_SIZE_LARGE_TOOLBAR); // 24 by default
// GtkTreeIter iter;
// Icon *pIcon;
// gchar *cImagePath, *cID;
// const gchar *cName;
// GdkPixbuf *pixbuf;
// GList *ic;
// for (ic = pDock->icons; ic != NULL; ic = ic->next)
// {
// pIcon = ic->data;
// if (pIcon->cDesktopFileName != NULL
// || pIcon->pModuleInstance != NULL)
// {
// pixbuf = NULL;
// cImagePath = NULL;
// cName = NULL;
// // get the ID
// if (pIcon->cDesktopFileName != NULL)
// cID = pIcon->cDesktopFileName;
// else
// cID = pIcon->pModuleInstance->cConfFilePath;
// // get the image
// if (pIcon->cFileName != NULL)
// {
// cImagePath = cairo_dock_search_icon_s_path (pIcon->cFileName, iDesiredIconSize);
// }
// if (cImagePath == NULL || ! g_file_test (cImagePath, G_FILE_TEST_EXISTS))
// {
// g_free (cImagePath);
// if (GLDI_OBJECT_IS_SEPARATOR_ICON (pIcon))
// {
// if (myIconsParam.cSeparatorImage)
// cImagePath = cairo_dock_search_image_s_path (myIconsParam.cSeparatorImage);
// }
// else if (CAIRO_DOCK_IS_APPLET (pIcon))
// {
// cImagePath = g_strdup (pIcon->pModuleInstance->pModule->pVisitCard->cIconFilePath);
// }
// else
//.........這裏部分代碼省略.........