本文整理汇总了C#中Gtk.ListStore.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.ListStore.SetValue方法的具体用法?C# Gtk.ListStore.SetValue怎么用?C# Gtk.ListStore.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.ListStore
的用法示例。
在下文中一共展示了Gtk.ListStore.SetValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NotebookManager
static NotebookManager ()
{
notebooks = new Gtk.ListStore (typeof (Notebook));
sortedNotebooks = new Gtk.TreeModelSort (notebooks);
sortedNotebooks.SetSortFunc (0, new Gtk.TreeIterCompareFunc (CompareNotebooksSortFunc));
sortedNotebooks.SetSortColumnId (0, Gtk.SortType.Ascending);
filteredNotebooks = new Gtk.TreeModelFilter (sortedNotebooks, null);
filteredNotebooks.VisibleFunc = FilterNotebooks;
AllNotesNotebook allNotesNotebook = new AllNotesNotebook ();
Gtk.TreeIter iter = notebooks.Append ();
notebooks.SetValue (iter, 0, allNotesNotebook);
UnfiledNotesNotebook unfiledNotesNotebook = new UnfiledNotesNotebook ();
iter = notebooks.Append ();
notebooks.SetValue (iter, 0, unfiledNotesNotebook);
// <summary>
// The key for this dictionary is Notebook.Name.ToLower ().
// </summary>
notebookMap = new Dictionary<string, Gtk.TreeIter> ();
// Load the notebooks now if the notes have already been loaded
// or wait for the NotesLoaded event otherwise.
if (Tomboy.DefaultNoteManager.Initialized)
LoadNotebooks ();
else
Tomboy.DefaultNoteManager.NotesLoaded += OnNotesLoaded;
}
示例2: SourceCitationView
public SourceCitationView()
{
this.Build();
Gtk.ListStore certaintyTypes = new Gtk.ListStore(typeof(string));
foreach (GedcomCertainty certainty in Enum.GetValues(typeof(GedcomCertainty)))
{
Gtk.TreeIter iter = certaintyTypes.Append();
certaintyTypes.SetValue(iter, 0, certainty.ToString());
}
Gtk.CellRenderer rend = new Gtk.CellRendererText();
CertaintyComboBox.PackStart(rend,true);
CertaintyComboBox.AddAttribute(rend, "text", 0);
CertaintyComboBox.Model = certaintyTypes;
Notebook.Page = 0;
}
示例3: RtmBackend
public RtmBackend()
{
initialized = false;
configured = false;
taskIters = new Dictionary<string, Gtk.TreeIter> ();
taskLock = new Object();
categories = new Dictionary<string, RtmCategory> ();
catLock = new Object();
// *************************************
// Data Model Set up
// *************************************
taskStore = new Gtk.TreeStore (typeof (ITask));
sortedTasksModel = new Gtk.TreeModelSort (taskStore);
sortedTasksModel.SetSortFunc (0, new Gtk.TreeIterCompareFunc (CompareTasksSortFunc));
sortedTasksModel.SetSortColumnId (0, Gtk.SortType.Ascending);
categoryListStore = new Gtk.ListStore (typeof (ICategory));
sortedCategoriesModel = new Gtk.TreeModelSort (categoryListStore);
sortedCategoriesModel.SetSortFunc (0, new Gtk.TreeIterCompareFunc (CompareCategorySortFunc));
sortedCategoriesModel.SetSortColumnId (0, Gtk.SortType.Ascending);
// make sure we have the all Category in our list
Gtk.Application.Invoke ( delegate {
AllCategory allCategory = new Tasque.AllCategory ();
Gtk.TreeIter iter = categoryListStore.Append ();
categoryListStore.SetValue (iter, 0, allCategory);
});
runRefreshEvent = new AutoResetEvent(false);
runningRefreshThread = false;
refreshThread = new Thread(RefreshThreadLoop);
}
示例4: SetCompletions
/// <summary>
/// Set the list of completions that will be shown by the entry
/// </summary>
/// <param name="completions">The list of completion or null if no completions should be shown</param>
public void SetCompletions (string[] completions)
{
var widgetCompletion = Widget.Completion;
if (completions == null || completions.Length == 0) {
if (widgetCompletion != null)
widgetCompletion.Model = null;
return;
}
if (widgetCompletion == null)
Widget.Completion = widgetCompletion = CreateCompletion ();
var model = new Gtk.ListStore (typeof(string));
foreach (var c in completions)
model.SetValue (model.Append (), 0, c);
widgetCompletion.Model = model;
}
示例5: MakeSyncPane
public Gtk.Widget MakeSyncPane ()
{
Gtk.VBox vbox = new Gtk.VBox (false, 0);
vbox.Spacing = 4;
vbox.BorderWidth = 8;
Gtk.HBox hbox = new Gtk.HBox (false, 4);
Gtk.Label label = new Gtk.Label (Catalog.GetString ("Ser_vice:"));
label.Xalign = 0;
label.Show ();
hbox.PackStart (label, false, false, 0);
// Populate the store with all the available SyncServiceAddins
syncAddinStore = new Gtk.ListStore (typeof (SyncServiceAddin));
syncAddinIters = new Dictionary<string,Gtk.TreeIter> ();
SyncServiceAddin [] addins = Tomboy.DefaultNoteManager.AddinManager.GetSyncServiceAddins ();
Array.Sort (addins, CompareSyncAddinsByName);
foreach (SyncServiceAddin addin in addins) {
Gtk.TreeIter iter = syncAddinStore.Append ();
syncAddinStore.SetValue (iter, 0, addin);
syncAddinIters [addin.Id] = iter;
}
syncAddinCombo = new Gtk.ComboBox (syncAddinStore);
label.MnemonicWidget = syncAddinCombo;
Gtk.CellRendererText crt = new Gtk.CellRendererText ();
syncAddinCombo.PackStart (crt, true);
syncAddinCombo.SetCellDataFunc (crt,
new Gtk.CellLayoutDataFunc (ComboBoxTextDataFunc));
// Read from Preferences which service is configured and select it
// by default. Otherwise, just select the first one in the list.
string addin_id = Preferences.Get (
Preferences.SYNC_SELECTED_SERVICE_ADDIN) as String;
Gtk.TreeIter active_iter;
if (addin_id != null && syncAddinIters.ContainsKey (addin_id)) {
active_iter = syncAddinIters [addin_id];
syncAddinCombo.SetActiveIter (active_iter);
} else {
if (syncAddinStore.GetIterFirst (out active_iter) == true) {
syncAddinCombo.SetActiveIter (active_iter);
}
}
syncAddinCombo.Changed += OnSyncAddinComboChanged;
syncAddinCombo.Show ();
hbox.PackStart (syncAddinCombo, true, true, 0);
hbox.Show ();
vbox.PackStart (hbox, false, false, 0);
// Get the preferences GUI for the Sync Addin
if (active_iter.Stamp != Gtk.TreeIter.Zero.Stamp)
selectedSyncAddin = syncAddinStore.GetValue (active_iter, 0) as SyncServiceAddin;
if (selectedSyncAddin != null)
syncAddinPrefsWidget = selectedSyncAddin.CreatePreferencesControl (OnSyncAddinPrefsChanged);
if (syncAddinPrefsWidget == null) {
Gtk.Label l = new Gtk.Label (Catalog.GetString ("Not configurable"));
l.Yalign = 0.5f;
l.Yalign = 0.5f;
syncAddinPrefsWidget = l;
}
if (syncAddinPrefsWidget != null && addin_id != null &&
syncAddinIters.ContainsKey (addin_id) && selectedSyncAddin.IsConfigured)
syncAddinPrefsWidget.Sensitive = false;
syncAddinPrefsWidget.Show ();
syncAddinPrefsContainer = new Gtk.VBox (false, 0);
syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0);
syncAddinPrefsContainer.Show ();
vbox.PackStart (syncAddinPrefsContainer, true, true, 10);
// Autosync preference
int timeout = (int) Preferences.Get (Preferences.SYNC_AUTOSYNC_TIMEOUT);
if (timeout > 0 && timeout < 5) {
timeout = 5;
Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT, 5);
}
Gtk.HBox autosyncBox = new Gtk.HBox (false, 5);
// Translators: This is and the next string go together.
// Together they look like "Automatically Sync in Background Every [_] Minutes",
// where "[_]" is a GtkSpinButton.
autosyncCheck =
new Gtk.CheckButton (Catalog.GetString ("Automaticall_y Sync in Background Every"));
autosyncSpinner = new Gtk.SpinButton (5, 1000, 1);
autosyncSpinner.Value = timeout >= 5 ? timeout : 10;
Gtk.Label autosyncExtraText =
// Translators: See above comment for details on
// this string.
new Gtk.Label (Catalog.GetString ("Minutes"));
autosyncCheck.Active = autosyncSpinner.Sensitive = timeout >= 5;
EventHandler updateTimeoutPref = (o, e) => {
Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT,
autosyncCheck.Active ? (int) autosyncSpinner.Value : -1);
};
autosyncCheck.Toggled += (o, e) => {
//.........这里部分代码省略.........
示例6: SourceView
public SourceView()
{
this.Build();
_eventModel = new EventModel(EventModel.EventModelType.All);
Gtk.TreeViewColumn eventNameCol = new Gtk.TreeViewColumn();
Gtk.CellRenderer rend = new Gtk.CellRendererToggle();
eventNameCol.Title = "Event";
eventNameCol.PackStart(rend, false);
eventNameCol.AddAttribute(rend, "active", (int)EventModel.Columns.Included);
((Gtk.CellRendererToggle)rend).Activatable = true;
((Gtk.CellRendererToggle)rend).Toggled += new Gtk.ToggledHandler(OnIncluded_Toggle);
rend = new Gtk.CellRendererText();
eventNameCol.PackStart(rend, true);
eventNameCol.AddAttribute(rend, "text", (int)EventModel.Columns.Readable);
EventTypeTreeView.AppendColumn(eventNameCol);
EventTypeTreeView.Model = _eventModel;
Gtk.TreeViewColumn buttonCol = new Gtk.TreeViewColumn();
GtkCellRendererButton butRend = new GtkCellRendererButton();
butRend.StockId = "gtk-remove";
buttonCol.PackStart(butRend,true);
Gtk.TreeViewColumn noteCountCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
noteCountCol.Title = "No.";
noteCountCol.PackStart(rend,true);
noteCountCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderEventRecordedCount));
EventGroupTreeView.AppendColumn(buttonCol);
EventGroupTreeView.AppendColumn(noteCountCol);
Gtk.TreeSelection selection = EventGroupTreeView.Selection;
selection.Changed += new EventHandler(OnEventGroupSelection_Changed);
_eventGroups = new GenericListModel<GedcomRecordedEvent>();
EventGroupTreeView.Model = _eventGroups.Adapter;
Gtk.TreeViewColumn callNumberCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
callNumberCol.Title = "Call Number";
callNumberCol.PackStart(rend,true);
callNumberCol.AddAttribute(rend, "text", 0);
Gtk.TreeViewColumn mediaTypeCol = new Gtk.TreeViewColumn();
rend = new Gtk.CellRendererText();
mediaTypeCol.Title = "Media Type";
mediaTypeCol.PackStart(rend,true);
mediaTypeCol.AddAttribute(rend, "text", 1);
CallNumberTreeView.AppendColumn(callNumberCol);
CallNumberTreeView.AppendColumn(mediaTypeCol);
RepositoryCitationListModel repoCitationListModel = new RepositoryCitationListModel();
CallNumberTreeView.Model = repoCitationListModel;
selection = CallNumberTreeView.Selection;
selection.Changed += new EventHandler(OnCallNumberSelection_Changed);
// How to handle SourceMediaType.Other ?
// don't include in initial and if the select one is SourceMediaType.Other
// add an item into the dropdown for its value?
// as other isn't really valid this seems like a reasonable idea
Gtk.ListStore mediaTypes = new Gtk.ListStore(typeof(string));
foreach (SourceMediaType mediaType in Enum.GetValues(typeof(SourceMediaType)))
{
if (mediaType != SourceMediaType.Other)
{
Gtk.TreeIter iter = mediaTypes.Append();
mediaTypes.SetValue(iter, 0, mediaType.ToString());
}
}
rend = new Gtk.CellRendererText();
MediaTypeCombo.PackStart(rend,true);
MediaTypeCombo.AddAttribute(rend, "text", 0);
MediaTypeCombo.Model = mediaTypes;
Notebook.Page = 0;
}