本文整理汇总了C#中Gtk.Button.Show方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Button.Show方法的具体用法?C# Gtk.Button.Show怎么用?C# Gtk.Button.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Button
的用法示例。
在下文中一共展示了Gtk.Button.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NoteDialog
public NoteDialog(Gtk.Window parentWindow, ITask task)
: base()
{
this.ParentWindow = parentWindow.GdkWindow;
this.task = task;
this.Title = String.Format(Catalog.GetString("Notes for: {0:s}"), task.Text);
this.HasSeparator = false;
this.SetSizeRequest(500,320);
this.Icon = Utilities.GetIcon ("tasque", 16);
//this.Flags = Gtk.DialogFlags.DestroyWithParent;
sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
sw.HscrollbarPolicy = Gtk.PolicyType.Never;
sw.BorderWidth = 0;
sw.CanFocus = true;
sw.Show ();
Gtk.EventBox innerEb = new Gtk.EventBox();
innerEb.BorderWidth = 0;
targetVBox = new Gtk.VBox();
targetVBox.BorderWidth = 5;
targetVBox.Show ();
innerEb.Add(targetVBox);
innerEb.Show ();
if(task.Notes != null) {
foreach (var note in task.Notes) {
NoteWidget noteWidget = new NoteWidget (note);
noteWidget.TextChanged += OnNoteTextChanged;
noteWidget.DeleteButtonClicked += OnDeleteButtonClicked;
noteWidget.EditCanceled += OnEditCanceled;
noteWidget.Show ();
targetVBox.PackStart (noteWidget, false, false, 0);
}
}
sw.AddWithViewport(innerEb);
sw.Show ();
VBox.PackStart (sw, true, true, 0);
if(task.NoteSupport == NoteSupport.Multiple) {
addButton = new Gtk.Button(Gtk.Stock.Add);
addButton.Show();
this.ActionArea.PackStart(addButton);
addButton.Clicked += OnAddButtonClicked;
}
AddButton (Gtk.Stock.Close, Gtk.ResponseType.Close);
Response += delegate (object sender, Gtk.ResponseArgs args) {
// Hide the window. The TaskWindow watches for when the
// dialog is hidden and will take care of the rest.
Hide ();
};
}
示例2: NoteOfTheDayPreferences
public NoteOfTheDayPreferences ()
: base (false, 12)
{
Gtk.Label label = new Gtk.Label (
Catalog.GetString (
"Change the <b>Today: Template</b> note to customize " +
"the text that new Today notes have."));
label.UseMarkup = true;
label.Wrap = true;
label.Show ();
PackStart (label, true, true, 0);
open_template_button = new Gtk.Button (
Catalog.GetString ("_Open Today: Template"));
open_template_button.UseUnderline = true;
open_template_button.Clicked += OpenTemplateButtonClicked;
open_template_button.Show ();
PackStart (open_template_button, false, false, 0);
ShowAll ();
}
示例3: NoteOfTheDayPreferences
public NoteOfTheDayPreferences()
: base(false, 12)
{
Gtk.Label label = new Gtk.Label (
Catalog.GetString (
"Change the <b>Today: Template</b> note to customize " +
"the text that new Today notes have."));
label.UseMarkup = true;
label.Wrap = true;
label.Show ();
PackStart (label, true, true, 0);
use_yesterday_check = new Gtk.CheckButton(
Catalog.GetString("_Use yesterday note as template."));
use_yesterday_check.UseUnderline = true;
use_yesterdat_check.Show();
PackStart (use_yesterday_check, false, false, 0);
// Check if preference has been set before
if (Preferences.Get(NoteOfTheDay.NOTD_YESTERDAY) == null){
// Default value
use_yesterday_check.Active = true;
}else if ((bool) Preferences.Get(NoteOfTheDay.NOTD_YESTERDAY)){
use_yesterday_check.Active = true;
}else{
use_yesterday_check.Active = false;
}
use_yesterday_check.Toggled += OnYesterdayCheckToggled;
open_template_button = new Gtk.Button (
Catalog.GetString ("_Open Today: Template"));
open_template_button.UseUnderline = true;
open_template_button.Clicked += OpenTemplateButtonClicked;
open_template_button.Show ();
PackStart (open_template_button, false, false, 0);
ShowAll ();
}
示例4: SetButtons
public void SetButtons (IEnumerable<DialogButton> newButtons)
{
if (buttons != null) {
foreach (var b in buttons) {
((Gtk.Container)b.Parent).Remove (b);
b.Destroy ();
}
}
dialogButtons = newButtons.ToArray ();
buttons = new Gtk.Button [dialogButtons.Length];
for (int n=0; n<dialogButtons.Length; n++) {
var db = dialogButtons[n];
Gtk.Button b = new Gtk.Button ();
b.Show ();
b.Label = db.Label;
Window.ActionArea.Add (b);
UpdateButton (db, b);
buttons[n] = b;
buttons[n].Clicked += HandleButtonClicked;
}
UpdateActionAreaVisibility ();
}
示例5: CreateGui
private void CreateGui()
{
Gtk.FileChooserButton fc=new Gtk.FileChooserButton("Choose directory to put your splitted files",Gtk.FileChooserAction.SelectFolder);
string fn=Banshee.Configuration.ConfigurationClient.Get<string>("cuesheets_todevice","");
if (fn!="") { fc.SelectFilename(fn); }
fc.FileSet+=new EventHandler(delegate(Object sender,EventArgs args) {
fn=fc.Filename;
Banshee.Configuration.ConfigurationClient.Set<string>("cuesheets_todevice",fn);
});
Gtk.Button btn=new Gtk.Button("Split CueSheet Audio File");
Gtk.Button csplit=new Gtk.Button("Cancel");
csplit.Clicked+=delegate(object sender,EventArgs args) {
_splt.CancelSplit();
};
Gtk.ProgressBar bar=new Gtk.ProgressBar();
Gtk.ProgressBar nr=new Gtk.ProgressBar();
Gtk.Button ok=(Gtk.Button) base.AddButton ("OK",1);
Gtk.Label result=new Gtk.Label("-");
btn.Clicked+=delegate(object sender,EventArgs args) {
btn.Hide ();
csplit.Show ();
result.Markup="";
ok.Sensitive=false;
fc.Sensitive=false;
btn.Sensitive=false;
_splt.SplitWithPaths ();
bool convert_to_latin1=true;
_splt.SplitToDir (fn,convert_to_latin1);
GLib.Timeout.Add(50,delegate () {
bar.Fraction=_splt.ProgressOfCurrentTrack;
int n=_splt.ProgressNTracks;
int i=_splt.ProgressCurrentTrack;
double d=((double) i)/((double) n);
nr.Fraction=d;
if (_splt.SplitFinished) {
ok.Sensitive=true;
btn.Sensitive=true;
fc.Sensitive=true;
csplit.Hide ();
btn.Show ();
if (_splt.Cancelled) {
result.Markup="<b>Split Cancelled</b>";
} else {
result.Markup="<b>Finished</b>";
}
}
return !_splt.SplitFinished;
});
};
fc.Show ();
nr.Show ();
bar.Show ();
btn.Show ();
result.Show ();
base.VBox.Add (fc);
base.VBox.Add (hsep());
base.VBox.Add (nr);
base.VBox.Add (bar);
base.VBox.Add (hsep ());
base.VBox.Add (result);
base.VBox.Add (hsep ());
base.VBox.Add (btn);
base.VBox.Add (csplit);
base.VBox.Show();
}
示例6: AddButton
void AddButton (string stock_id, Gtk.ResponseType response, bool is_default)
{
Gtk.Button button = new Gtk.Button (stock_id);
button.CanDefault = true;
button.Show ();
AddActionWidget (button, response);
if (is_default) {
DefaultResponse = response;
button.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.Escape,
0,
Gtk.AccelFlags.Visible);
}
}
示例7: Build
protected virtual void Build ()
{
Gtk.Window cobj = (Gtk.Window) null;
// Widget Sya.reclutamiento
cobj.Title = "Datos del Aspirante - Reclutamiento de Personal";
Gtk.UIManager w1 = new Gtk.UIManager ();
Gtk.ActionGroup w2 = new Gtk.ActionGroup ("Default");
Gtk.Action w3 = new Gtk.Action ("goBack", null, null, "gtk-go-back");
this.goBack = w3;
w2.Add (w3, null);
Gtk.Action w4 = new Gtk.Action ("goForward", null, null, "gtk-go-forward");
this.goForward = w4;
w2.Add (w4, null);
Gtk.Action w5 = new Gtk.Action ("gotoLast", null, null, "gtk-goto-last");
this.gotoLast = w5;
w2.Add (w5, null);
Gtk.Action w6 = new Gtk.Action ("print", null, null, "gtk-print");
this.print = w6;
w2.Add (w6, null);
Gtk.Action w7 = new Gtk.Action ("save", null, null, "gtk-save");
this.save = w7;
w2.Add (w7, null);
Gtk.Action w8 = new Gtk.Action ("quit", null, null, "gtk-quit");
this.quit = w8;
w2.Add (w8, null);
Gtk.Action w9 = new Gtk.Action ("quit1", null, null, "gtk-quit");
this.quit1 = w9;
w2.Add (w9, null);
Gtk.Action w10 = new Gtk.Action ("save1", null, null, "gtk-save");
this.save1 = w10;
w2.Add (w10, null);
Gtk.Action w11 = new Gtk.Action ("quit2", null, null, "gtk-quit");
this.quit2 = w11;
w2.Add (w11, null);
Gtk.Action w12 = new Gtk.Action ("about", null, null, "gtk-about");
this.about = w12;
w2.Add (w12, null);
Gtk.Action w13 = new Gtk.Action ("gotoFirst", null, null, "gtk-goto-first");
this.gotoFirst = w13;
w2.Add (w13, null);
Gtk.Action w14 = new Gtk.Action ("goBack1", null, null, "gtk-media-rewind");
this.goBack1 = w14;
w2.Add (w14, null);
Gtk.Action w15 = new Gtk.Action ("goForward1", null, null, "gtk-media-forward");
this.goForward1 = w15;
w2.Add (w15, null);
Gtk.Action w16 = new Gtk.Action ("gotoLast1", null, null, "gtk-goto-last");
this.gotoLast1 = w16;
w2.Add (w16, null);
Gtk.Action w17 = new Gtk.Action ("save2", null, null, "gtk-save");
this.save2 = w17;
w2.Add (w17, null);
Gtk.Action w18 = new Gtk.Action ("print1", null, null, "gtk-print");
this.print1 = w18;
w2.Add (w18, null);
Gtk.Action w19 = new Gtk.Action ("quit3", null, null, "gtk-quit");
this.quit3 = w19;
w2.Add (w19, null);
Gtk.Action w20 = new Gtk.Action ("dialogInfo", null, null, "gtk-dialog-info");
this.dialogInfo = w20;
w2.Add (w20, null);
Gtk.Action w21 = new Gtk.Action ("about1", null, null, "gtk-about");
this.about1 = w21;
w2.Add (w21, null);
Gtk.Action w22 = new Gtk.Action ("goBack2", null, null, "gtk-go-back");
this.goBack2 = w22;
w2.Add (w22, null);
Gtk.Action w23 = new Gtk.Action ("goForward2", null, null, "gtk-go-forward");
this.goForward2 = w23;
w2.Add (w23, null);
Gtk.Action w24 = new Gtk.Action ("printPreview", null, null, "gtk-print-preview");
this.printPreview = w24;
w2.Add (w24, null);
w1.InsertActionGroup (w2, 0);
cobj.AddAccelGroup (w1.AccelGroup);
cobj.WindowPosition = ((Gtk.WindowPosition) (4));
cobj.Modal = true;
cobj.Gravity = ((Gdk.Gravity) (5));
cobj.Name = "Sya.reclutamiento";
// Container child Sya.reclutamiento.Gtk.Container+ContainerChild
Gtk.ScrolledWindow w25 = new Gtk.ScrolledWindow ();
w25.VscrollbarPolicy = ((Gtk.PolicyType) (1));
w25.HscrollbarPolicy = ((Gtk.PolicyType) (1));
w25.CanFocus = true;
w25.Name = "scrolledwindow2";
// Container child scrolledwindow2.Gtk.Container+ContainerChild
Gtk.Viewport w26 = new Gtk.Viewport ();
w26.ShadowType = ((Gtk.ShadowType) (0));
w26.Name = "GtkViewport";
// Container child GtkViewport.Gtk.Container+ContainerChild
Gtk.VBox w27 = new Gtk.VBox ();
w27.Name = "vbox1";
// Container child vbox1.Gtk.Box+BoxChild
Gtk.HBox w28 = new Gtk.HBox ();
w28.Name = "hbox2";
// Container child hbox2.Gtk.Box+BoxChild
w1.AddUiFromString ("<ui><toolbar name='toolbar1'><toolitem action='gotoFirst'/><toolitem action='goBack1'/><toolitem action='goForward1'/><toolitem action='gotoLast1'/><toolitem action='save2'/><toolitem action='printPreview'/><toolitem action='print1'/><toolitem action='quit3'/><toolitem action='dialogInfo'/><toolitem action='about1'/><toolitem action='goBack2'/><toolitem action='goForward2'/></toolbar></ui>");
Gtk.Toolbar w29 = ((Gtk.Toolbar) (w1.GetWidget ("/toolbar1")));
w29.ShowArrow = false;
w29.Tooltips = true;
//.........这里部分代码省略.........
示例8: ShowDeletionDialog
public static void ShowDeletionDialog (List<Note> notes, Gtk.Window parent)
{
string message;
if ((bool) Preferences.Get (Preferences.ENABLE_DELETE_CONFIRM)) {
// show confirmation dialog
if (notes.Count == 1) {
Note note = notes[0];
message = string.Format (Catalog.GetString ("Really delete \"{0}\"?"), note.Title) ;
} else
message = string.Format (Catalog.GetPluralString (
"Really delete this {0} note?",
"Really delete these {0} notes?",
notes.Count), notes.Count);
HIGMessageDialog dialog =
new HIGMessageDialog (
parent,
Gtk.DialogFlags.DestroyWithParent,
Gtk.MessageType.Question,
Gtk.ButtonsType.None,
message,
Catalog.GetString ("If you delete a note it is " +
"permanently lost."));
Gtk.Button button;
button = new Gtk.Button (Gtk.Stock.Cancel);
button.CanDefault = true;
button.Show ();
dialog.AddActionWidget (button, Gtk.ResponseType.Cancel);
dialog.DefaultResponse = Gtk.ResponseType.Cancel;
button = new Gtk.Button (Gtk.Stock.Delete);
button.CanDefault = true;
button.Show ();
dialog.AddActionWidget (button, 666);
int result = dialog.Run ();
if (result == 666) {
foreach (Note note in notes) {
note.Manager.Delete (note);
}
}
dialog.Destroy();
} else {
// no confirmation dialog, just delete
foreach (Note note in notes) {
note.Manager.Delete (note);
}
}
}
示例9: Initialize
public override void Initialize()
{
Widget = new Gtk.Button ();
Widget.Show ();
}
示例10: Build
//.........这里部分代码省略.........
w59.Events = ((Gdk.EventMask)(0));
w59.Name = "image3";
bindings["image3"] = w59;
w58.Add(w59);
// Container child GtkHBox.Gtk.Container+ContainerChild
Gtk.Label w61 = new Gtk.Label();
w61.LabelProp = "_Export";
w61.UseUnderline = true;
w61.Events = ((Gdk.EventMask)(0));
w61.Name = "GtkLabel";
bindings["GtkLabel"] = w61;
w58.Add(w61);
bindings["GtkHBox"] = w58;
w57.Add(w58);
bindings["GtkAlignment"] = w57;
w56.Add(w57);
bindings["button16"] = w56;
w27.Add(w56);
Gtk.Box.BoxChild w65 = ((Gtk.Box.BoxChild)(w27[w56]));
w65.Position = 6;
w65.Expand = false;
w65.Fill = false;
bindings["hbox1"] = w27;
w15.Add(w27);
Gtk.Box.BoxChild w66 = ((Gtk.Box.BoxChild)(w15[w27]));
w66.Position = 2;
w66.Expand = false;
w66.Fill = false;
bindings["vbox1"] = w15;
cobj.Add(w15);
cobj.DefaultWidth = 566;
cobj.DefaultHeight = 300;
bindings["igaeditorgtk.MainForm"] = cobj;
w16.Show();
w21.Show();
w20.Show();
w19.Show();
w25.Show();
w18.Show();
w28.Show();
w30.Show();
w32.Show();
w34.Show();
w39.Show();
w41.Show();
w38.Show();
w37.Show();
w36.Show();
w49.Show();
w51.Show();
w48.Show();
w47.Show();
w46.Show();
w59.Show();
w61.Show();
w58.Show();
w57.Show();
w56.Show();
w27.Show();
w15.Show();
cobj.Show();
cobj.DeleteEvent += ((Gtk.DeleteEventHandler)(System.Delegate.CreateDelegate(typeof(Gtk.DeleteEventHandler), cobj, "OnDeleteEvent")));
w7.Activated += ((System.EventHandler)(System.Delegate.CreateDelegate(typeof(System.EventHandler), cobj, "OnReloadActivated")));
w8.Activated += ((System.EventHandler)(System.Delegate.CreateDelegate(typeof(System.EventHandler), cobj, "OnVaccumShrinkDatabaseActivated")));
w9.Activated += ((System.EventHandler)(System.Delegate.CreateDelegate(typeof(System.EventHandler), cobj, "OnCloseDatabaseActivated")));
w10.Activated += ((System.EventHandler)(System.Delegate.CreateDelegate(typeof(System.EventHandler), cobj, "OnExitActivated")));
示例11: fill
public void fill()
{
Gtk.Button cancel=new Gtk.Button("Cancel scan");
Gtk.VSeparator sep=new Gtk.VSeparator();
cancel.Clicked+=delegate(object sender,EventArgs args) {
_fill_canceled=true;
};
bar.Add (sep);
sep.Show ();
bar.Add (cancel);
cancel.Show ();
bar.Show ();
getSheets().Clear ();
basedir=MySource.getCueSheetDir();
Hyena.Log.Information ("Base directory="+basedir);
if (basedir!=null) {
_fill_ready=false;
_fill_count=0;
_fill_dir_count=0;
_fill_canceled=false;
_fill_cues.Clear ();
_fill_dirs.Clear ();
fill (basedir);
GLib.Timeout.Add (500,delegate() {
if (_fill_ready || _fill_canceled) {
try {
Hyena.Log.Information("Reload albums");
MySource.getAlbumModel ().Reload ();
Hyena.Log.Information(MySource.getAlbumModel ().Count.ToString ());
Hyena.Log.Information("Reload artists");
MySource.getArtistModel ().Reload ();
Hyena.Log.Information(MySource.getArtistModel ().Count.ToString ());
Hyena.Log.Information("Reload composers");
MySource.getComposerModel ().Reload ();
Hyena.Log.Information(MySource.getComposerModel ().Count.ToString ());
Hyena.Log.Information("Reload genres");
MySource.getGenreModel ().Reload ();
Hyena.Log.Information(MySource.getGenreModel ().Count.ToString ());
Hyena.Log.Information("Reload tracks");
MySource.getTrackModel ().Reload ();
Hyena.Log.Information("Reload play lists");
MySource.getPlayListsModel().Reload();
Hyena.Log.Information("Reloaded all");
} catch(System.Exception e) {
Hyena.Log.Information (e.ToString());
}
Hyena.Log.Information("Reloaded");
filling.Text="";
bar.Remove (sep);
bar.Remove (cancel);
bar.Hide ();
FillLibrary ();
return false;
} else {
return true;
}
});
}
}
示例12: RemoveClicked
void RemoveClicked (object sender, EventArgs args)
{
// Remove the icon file and call UpdateIconStore ().
Gtk.TreeIter iter;
if (!icon_tree.Selection.GetSelected (out iter))
return;
string icon_path = icon_store.GetValue (iter, 2) as string;
HIGMessageDialog dialog =
new HIGMessageDialog (
null,
Gtk.DialogFlags.DestroyWithParent,
Gtk.MessageType.Question,
Gtk.ButtonsType.None,
Catalog.GetString ("Really remove this icon?"),
Catalog.GetString ("If you remove an icon it is " +
"permanently lost."));
Gtk.Button button;
button = new Gtk.Button (Gtk.Stock.Cancel);
button.CanDefault = true;
button.Show ();
dialog.AddActionWidget (button, Gtk.ResponseType.Cancel);
dialog.DefaultResponse = Gtk.ResponseType.Cancel;
button = new Gtk.Button (Gtk.Stock.Delete);
button.CanDefault = true;
button.Show ();
dialog.AddActionWidget (button, 666);
int result = dialog.Run ();
if (result == 666) {
try {
File.Delete (icon_path);
UpdateIconStore ();
} catch (Exception e) {
Logger.Error ("Error removing icon {0}: {1}",
icon_path,
e.Message);
}
}
dialog.Destroy();
}
示例13: PreferencesDialog
public PreferencesDialog (AddinManager addin_manager)
: base ()
{
this.addin_manager = addin_manager;
IconName = "tomboy";
HasSeparator = false;
BorderWidth = 5;
Resizable = true;
Title = Catalog.GetString ("Tomboy Preferences");
ActionArea.Layout = Gtk.ButtonBoxStyle.End;
addin_prefs_dialogs =
new Dictionary<string, Gtk.Dialog> ();
addin_info_dialogs =
new Dictionary<string, Gtk.Dialog> ();
// Notebook Tabs (Editing, Hotkeys)...
Gtk.Notebook notebook = new Gtk.Notebook ();
notebook.TabPos = Gtk.PositionType.Top;
notebook.Show ();
notebook.AppendPage (MakeEditingPane (),
new Gtk.Label (Catalog.GetString ("Editing")));
if (! (Services.Keybinder is NullKeybinder))
notebook.AppendPage (MakeHotkeysPane (),
new Gtk.Label (Catalog.GetString ("Hotkeys")));
notebook.AppendPage (MakeSyncPane (),
new Gtk.Label (Catalog.GetString ("Synchronization")));
notebook.AppendPage (MakeAddinsPane (),
new Gtk.Label (Catalog.GetString ("Add-ins")));
// TODO: Figure out a way to have these be placed in a specific order
foreach (PreferenceTabAddin tabAddin in addin_manager.GetPreferenceTabAddins ()) {
Logger.Debug ("Adding preference tab addin: {0}", tabAddin.GetType ().Name);
try {
string tabName;
Gtk.Widget tabWidget;
if (tabAddin.GetPreferenceTabWidget (this, out tabName, out tabWidget) == true) {
notebook.AppendPage (tabWidget, new Gtk.Label (tabName));
}
} catch (Exception e) {
Logger.Warn ("Problems adding preferences tab addin: {0}", tabAddin.GetType ().Name);
Logger.Debug ("{0}:\n{1}", e.Message, e.StackTrace);
}
}
VBox.PackStart (notebook, true, true, 0);
addin_manager.ApplicationAddinListChanged += OnAppAddinListChanged;
// Ok button...
Gtk.Button button = new Gtk.Button (Gtk.Stock.Close);
button.CanDefault = true;
button.Show ();
Gtk.AccelGroup accel_group = new Gtk.AccelGroup ();
AddAccelGroup (accel_group);
button.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.Escape,
0,
0);
AddActionWidget (button, Gtk.ResponseType.Close);
DefaultResponse = Gtk.ResponseType.Close;
Preferences.SettingChanged += HandlePreferencesSettingChanged;
}
示例14: MakeAddinsPane
// Page 3
// Extension Preferences
public Gtk.Widget MakeAddinsPane ()
{
Gtk.VBox vbox = new Gtk.VBox (false, 6);
vbox.BorderWidth = 6;
Gtk.Label l = new Gtk.Label (Catalog.GetString (
"The following add-ins are installed"));
l.Xalign = 0;
l.Show ();
vbox.PackStart (l, false, false, 0);
Gtk.HBox hbox = new Gtk.HBox (false, 6);
// TreeView of Add-ins
Gtk.TreeView tree = new Gtk.TreeView ();
addin_tree = new Mono.Addins.Gui.AddinTreeWidget (tree);
tree.Show ();
Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
sw.ShadowType = Gtk.ShadowType.In;
sw.Add (tree);
sw.Show ();
Gtk.LinkButton get_more_link =
new Gtk.LinkButton ("http://live.gnome.org/Tomboy/PluginList",
Catalog.GetString ("Get More Add-Ins..."));
get_more_link.Show ();
Gtk.VBox tree_box = new Gtk.VBox (false, 0);
tree_box.Add (sw);
tree_box.PackEnd (get_more_link, false, false, 5);
tree_box.Show ();
hbox.PackStart (tree_box, true, true, 0);
// Action Buttons (right of TreeView)
Gtk.VButtonBox button_box = new Gtk.VButtonBox ();
button_box.Spacing = 4;
button_box.Layout = Gtk.ButtonBoxStyle.Start;
// TODO: In a future version, add in an "Install Add-ins..." button
// TODO: In a future version, add in a "Repositories..." button
enable_addin_button =
new Gtk.Button (Catalog.GetString ("_Enable"));
enable_addin_button.Sensitive = false;
enable_addin_button.Clicked += OnEnableAddinButton;
enable_addin_button.Show ();
disable_addin_button =
new Gtk.Button (Catalog.GetString ("_Disable"));
disable_addin_button.Sensitive = false;
disable_addin_button.Clicked += OnDisableAddinButton;
disable_addin_button.Show ();
addin_prefs_button =
new Gtk.Button (Gtk.Stock.Preferences);
addin_prefs_button.Sensitive = false;
addin_prefs_button.Clicked += OnAddinPrefsButton;
addin_prefs_button.Show ();
addin_info_button =
new Gtk.Button (Gtk.Stock.Info);
addin_info_button.Sensitive = false;
addin_info_button.Clicked += OnAddinInfoButton;
addin_info_button.Show ();
button_box.PackStart (enable_addin_button);
button_box.PackStart (disable_addin_button);
button_box.PackStart (addin_prefs_button);
button_box.PackStart (addin_info_button);
button_box.Show ();
hbox.PackStart (button_box, false, false, 0);
hbox.Show ();
vbox.PackStart (hbox, true, true, 0);
vbox.Show ();
tree.Selection.Changed += OnAddinTreeSelectionChanged;
LoadAddins ();
return vbox;
}
示例15: 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) => {
//.........这里部分代码省略.........