[Monodevelop-patches-list] r2209 - in trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets: . FileBrowser
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Jan 31 15:27:25 EST 2005
Author: jluke
Date: 2005-01-31 15:27:24 -0500 (Mon, 31 Jan 2005)
New Revision: 2209
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs
Log:
use ToolItem instead
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/ChangeLog 2005-01-31 20:27:22 UTC (rev 2208)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/ChangeLog 2005-01-31 20:27:24 UTC (rev 2209)
@@ -1,3 +1,8 @@
+2005-01-31 John Luke <john.luke at gmail.com>
+
+ * FileBrowser/FileBrowser.cs: use ToolItem
+ instead of action crapola
+
2005-01-27 John Luke <john.luke at gmail.com>
* Makefile.am:
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs 2005-01-31 20:27:22 UTC (rev 2208)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs 2005-01-31 20:27:24 UTC (rev 2209)
@@ -33,11 +33,11 @@
{
public DirectoryChangedEventHandler DirectoryChangedEvent;
- Gtk.UIManager uiManager;
+ private static Tooltips tips = new Tooltips ();
private Gtk.TreeView tv;
private Gtk.ScrolledWindow scrolledwindow;
- private Gtk.Button upbutton, homebutton;
- private Gtk.Entry entry;
+ private Gtk.ToolButton goUp, goHome;
+ private ToolbarEntry entry;
private IMessageService messageService;
private Gtk.CellRendererText text_render;
private ListStore store;
@@ -51,12 +51,6 @@
PropertyService PropertyService = (PropertyService) ServiceManager.GetService (typeof (PropertyService));
- const string uiInfo =
- "<toolbar name=\"toolbar\">" +
- " <toolitem name=\"goUp\" action=\"goUp\" />" +
- " <toolitem name=\"home\" action=\"home\" />" +
- "</toolbar>";
-
public FileBrowser ()
{
if (!Vfs.Initialized) {
@@ -70,23 +64,25 @@
scrolledwindow.HscrollbarPolicy = PolicyType.Automatic;
scrolledwindow.ShadowType = ShadowType.In;
- ActionEntry[] actions = new ActionEntry[]
- {
- new ActionEntry ("goUp", Gtk.Stock.GoUp, null, null, GettextCatalog.GetString ("Up one level"), new EventHandler (OnUpClicked)),
- new ActionEntry ("home", Gtk.Stock.Home, null, null, GettextCatalog.GetString ("Home"), new EventHandler (OnHomeClicked))
- };
+ Toolbar toolbar = new Toolbar ();
+ toolbar.IconSize = IconSize.SmallToolbar;
- ActionGroup actionGroup = new ActionGroup ("navbar");
- actionGroup.Add (actions);
+ goUp = new ToolButton (Stock.GoUp);
+ goUp.Clicked += new EventHandler (OnGoUpClicked);
+ goUp.SetTooltip (tips, GettextCatalog.GetString ("Go up"), "Go up");
+ toolbar.Insert (goUp, -1);
- uiManager = new UIManager ();
- uiManager.InsertActionGroup (actionGroup, 0);
- uiManager.AddWidget += new AddWidgetHandler (OnUIAdd);
- uiManager.AddUiFromString (uiInfo);
+ goHome = new ToolButton (Stock.Home);
+ goHome.Clicked += new EventHandler (OnGoHomeClicked);
+ goHome.SetTooltip (tips, GettextCatalog.GetString ("Home"), "Home");
+ toolbar.Insert (goHome, -1);
- Toolbar tb = uiManager.GetWidget ("/ui/toolbar") as Toolbar;
- tb.IconSize = Gtk.IconSize.SmallToolbar;
- AddLocationEntry (tb);
+ entry = new ToolbarEntry ();
+ entry.Activated += new EventHandler (OnEntryActivated);
+ entry.SetTooltip (tips, GettextCatalog.GetString ("Location"), "");
+ toolbar.Insert (entry, -1);
+ toolbar.ShowAll ();
+ this.PackStart (toolbar, false, true, 0);
IProperties p = (IProperties) PropertyService.GetProperty ("SharpDevelop.UI.SelectStyleOptions", new DefaultProperties ());
ignoreHidden = !p.GetProperty ("MonoDevelop.Gui.FileScout.ShowHidden", false);
@@ -167,11 +163,10 @@
{
store.Clear ();
- ToolButton upbutton = uiManager.GetWidget ("/ui/toolbar/goUp") as Gtk.ToolButton;
if (System.IO.Path.GetPathRoot (CurrentDir) == CurrentDir)
- upbutton.Sensitive = false;
- else if (upbutton.Sensitive == false)
- upbutton.Sensitive = true;
+ goUp.Sensitive = false;
+ else if (goUp.Sensitive == false)
+ goUp.Sensitive = true;
DirectoryInfo di = new DirectoryInfo (CurrentDir);
DirectoryInfo[] dirs = di.GetDirectories ();
@@ -296,13 +291,13 @@
}
}
- private void OnUpClicked (object o, EventArgs args)
+ private void OnGoUpClicked (object o, EventArgs args)
{
if (System.IO.Path.GetPathRoot (CurrentDir) != CurrentDir)
CurrentDir = System.IO.Path.Combine (CurrentDir, "..");
}
- private void OnHomeClicked (object o, EventArgs args)
+ private void OnGoHomeClicked (object o, EventArgs args)
{
CurrentDir = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
}
@@ -448,21 +443,40 @@
return !hiddenfolders.Contains (folder);
}
- void OnUIAdd (object sender, AddWidgetArgs a)
+ void AddLocationEntry (Toolbar tb)
{
- a.Widget.Show ();
- this.PackStart (a.Widget, false, true, 0);
}
+ }
- void AddLocationEntry (Toolbar tb)
+ public class ToolbarEntry : ToolItem
+ {
+ Entry entry;
+
+ public ToolbarEntry () : base ()
{
entry = new Entry ();
- entry.Activated += new EventHandler (OnEntryActivated);
+ entry.Activated += new EventHandler (OnActivated);
+ this.Add (entry);
entry.Show ();
- ToolItem item = new ToolItem ();
- item.Add (entry);
- tb.Add (item);
+ this.ShowAll ();
}
+
+ protected void OnActivated (object sender, EventArgs a)
+ {
+ if (Activated != null)
+ Activated (this, EventArgs.Empty);
+ }
+
+ public string Text {
+ get {
+ return entry.Text;
+ }
+ set {
+ entry.Text = value;
+ }
+ }
+
+ public event EventHandler Activated;
}
}
More information about the Monodevelop-patches-list
mailing list