[Monodevelop-patches-list] r2044 - in trunk/MonoDevelop/Core/src: Libraries/MonoDevelop.Gui.Widgets Libraries/MonoDevelop.Gui.Widgets/FileBrowser Main/Base Main/Base/Gui/Pads/FileScout
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Wed Dec 1 14:53:37 EST 2004
Author: jluke
Date: 2004-12-01 14:53:36 -0500 (Wed, 01 Dec 2004)
New Revision: 2044
Modified:
trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/ChangeLog
trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs
trunk/MonoDevelop/Core/src/Main/Base/ChangeLog
trunk/MonoDevelop/Core/src/Main/Base/Gui/Pads/FileScout/FileScout.cs
Log:
port the FileBrowser to GtkAction and UIManager
Modified: trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/ChangeLog 2004-12-01 18:25:51 UTC (rev 2043)
+++ trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/ChangeLog 2004-12-01 19:53:36 UTC (rev 2044)
@@ -1,5 +1,10 @@
2004-12-01 John Luke <john.luke at gmail.com>
+ * FileBrowser/FileBrowser.cs: port to GtkAction
+ some other small updates
+
+2004-12-01 John Luke <john.luke at gmail.com>
+
* FileSelector/FileSelector.cs: modified patch
from Rubens Ramos <rubensr at users.sourceforge.net>
to use the default path from the property service
Modified: trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs
===================================================================
--- trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs 2004-12-01 18:25:51 UTC (rev 2043)
+++ trunk/MonoDevelop/Core/src/Libraries/MonoDevelop.Gui.Widgets/FileBrowser/FileBrowser.cs 2004-12-01 19:53:36 UTC (rev 2044)
@@ -31,8 +31,8 @@
public class FileBrowser : VBox
{
public DirectoryChangedEventHandler DirectoryChangedEvent;
- private static GLib.GType gtype;
+ Gtk.UIManager uiManager;
private Gtk.TreeView tv;
private Gtk.ScrolledWindow scrolledwindow;
private Gtk.Button upbutton, homebutton;
@@ -50,7 +50,13 @@
PropertyService PropertyService = (PropertyService) ServiceManager.GetService (typeof (PropertyService));
- public FileBrowser () : base (GType)
+ const string uiInfo =
+ "<toolbar name=\"toolbar\">" +
+ " <toolitem name=\"goUp\" action=\"goUp\" />" +
+ " <toolitem name=\"home\" action=\"home\" />" +
+ "</toolbar>";
+
+ public FileBrowser ()
{
if (!Vfs.Initialized) {
Vfs.Init ();
@@ -61,24 +67,25 @@
scrolledwindow = new ScrolledWindow ();
scrolledwindow.VscrollbarPolicy = PolicyType.Automatic;
scrolledwindow.HscrollbarPolicy = PolicyType.Automatic;
+ scrolledwindow.ShadowType = ShadowType.In;
- homebutton = new Button ();
- homebutton.Add (new Image (Stock.Home, IconSize.SmallToolbar));
- homebutton.Relief = ReliefStyle.None;
- homebutton.Clicked += new EventHandler (OnHomeClicked);
+ 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))
+ };
- upbutton = new Button ();
- upbutton.Add (new Image (Stock.GoUp, IconSize.SmallToolbar));
- upbutton.Relief = ReliefStyle.None;
- upbutton.Clicked += new EventHandler (OnUpClicked);
+ ActionGroup actionGroup = new ActionGroup ("navbar");
+ actionGroup.Add (actions);
- entry = new Entry ();
- entry.Activated += new EventHandler (OnEntryActivated);
+ uiManager = new UIManager ();
+ uiManager.InsertActionGroup (actionGroup, 0);
+ uiManager.AddWidget += new AddWidgetHandler (OnUIAdd);
+ uiManager.AddUiFromString (uiInfo);
- Toolbar toolbar = new Toolbar ();
- toolbar.AppendWidget (upbutton, GettextCatalog.GetString ("Up one level"), GettextCatalog.GetString ("Up one level"));
- toolbar.AppendWidget (homebutton, GettextCatalog.GetString ("Home"), GettextCatalog.GetString ("Home"));
- toolbar.AppendWidget (entry, GettextCatalog.GetString ("Location"), GettextCatalog.GetString ("Location"));
+ Toolbar tb = uiManager.GetWidget ("/ui/toolbar") as Toolbar;
+ tb.IconSize = Gtk.IconSize.SmallToolbar;
+ AddLocationEntry (tb);
IProperties p = (IProperties) PropertyService.GetProperty ("SharpDevelop.UI.SelectStyleOptions", new DefaultProperties ());
ignoreHidden = !p.GetProperty ("MonoDevelop.Gui.FileScout.ShowHidden", false);
@@ -101,7 +108,7 @@
tv.AppendColumn (directorycolumn);
store = new ListStore (typeof (Gdk.Pixbuf), typeof (string));
- CurrentDir = Environment.GetEnvironmentVariable ("HOME");
+ CurrentDir = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
tv.Model = store;
tv.RowActivated += new RowActivatedHandler (OnRowActivated);
@@ -110,8 +117,7 @@
scrolledwindow.Add (tv);
this.Homogeneous = false;
- this.PackStart (toolbar, false, false, 0);
- this.PackStart (scrolledwindow);
+ this.PackEnd (scrolledwindow);
this.ShowAll ();
init = true;
}
@@ -122,17 +128,11 @@
{
get { return ignoreHidden; }
set {
- /* for some reasont his code crashes (NullReferenceException on the Populate() call
if (ignoreHidden != value) {
ignoreHidden = value;
// redraw folder list
- System.Console.WriteLine("before poplate call");
Populate ();
}
- */
-
- ignoreHidden = value;
- Populate ();
}
}
@@ -157,16 +157,6 @@
}
}
- public static new GLib.GType GType
- {
- get
- {
- if (gtype == GLib.GType.Invalid)
- gtype = RegisterGType (typeof (FileBrowser));
- return gtype;
- }
- }
-
public void SelectFirst ()
{
tv.Selection.SelectPath (new TreePath ("0"));
@@ -176,7 +166,7 @@
{
store.Clear ();
- // FIXME: never turns back on
+ 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)
@@ -189,7 +179,7 @@
{
if (ignoreHidden)
{
- if (!d.Name.StartsWith (".") && NotHidden(d.Name))
+ if (!d.Name.StartsWith (".") && NotHidden (d.Name))
store.AppendValues (FileIconLoader.GetPixbufForFile (System.IO.Path.Combine (CurrentDir, d.Name), 24, 24), d.Name);
}
else
@@ -209,7 +199,7 @@
{
if (ignoreHidden)
{
- if (NotHidden (System.IO.Path.GetFileName(filesaux[cont])))
+ if (NotHidden (System.IO.Path.GetFileName (filesaux[cont])))
{
files.Add (filesaux[cont]);
}
@@ -224,22 +214,18 @@
private void OnRowActivated (object o, RowActivatedArgs args)
{
TreeIter iter;
- store.GetIter (out iter, args.Path);
- string file = (string) store.GetValue (iter, 1);
- string newDir = System.IO.Path.Combine (currentDir, file);
-
- if (Directory.Exists (newDir))
+ if (store.GetIter (out iter, args.Path))
{
- CurrentDir = newDir;
+ string newDir = System.IO.Path.Combine (currentDir, (string) store.GetValue (iter, 1));
+ if (Directory.Exists (newDir))
+ CurrentDir = newDir;
}
}
private void OnButtonRelease (object o, ButtonReleaseEventArgs args)
{
if (args.Event.Button == 3)
- {
ShowPopup ();
- }
}
private void OnPopupMenu (object o, PopupMenuArgs args)
@@ -249,6 +235,7 @@
private void ShowPopup ()
{
+ // FIXME: port to Action API
Menu menu = new Menu ();
MenuItem openfilebrowser = new MenuItem (GettextCatalog.GetString ("Open with file browser"));
openfilebrowser.Activated += new EventHandler (OpenFileBrowser);
@@ -272,7 +259,7 @@
menu.Append (new MenuItem ());
menu.Append (openterminal);
menu.Append (openfilebrowser);
- menu.Popup (null, null, null, IntPtr.Zero, 3, Global.CurrentEventTime);
+ menu.Popup ();
menu.ShowAll ();
}
@@ -316,17 +303,15 @@
private void OnHomeClicked (object o, EventArgs args)
{
- CurrentDir = Environment.GetEnvironmentVariable ("HOME");
+ CurrentDir = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
}
private void OnEntryActivated (object sender, EventArgs args)
{
if (Directory.Exists (entry.Text.Trim ()))
- CurrentDir = entry.Text;
+ CurrentDir = entry.Text.Trim ();
else
- {
messageService.ShowError (null, String.Format (GettextCatalog.GetString ("Cannot enter '{0}' folder"), entry.Text));
- }
}
private void OnDirRename (object o, EventArgs args)
@@ -461,6 +446,22 @@
{
return !hiddenfolders.Contains (folder);
}
+
+ void OnUIAdd (object sender, AddWidgetArgs a)
+ {
+ a.Widget.Show ();
+ this.PackStart (a.Widget, false, true, 0);
+ }
+
+ void AddLocationEntry (Toolbar tb)
+ {
+ entry = new Entry ();
+ entry.Activated += new EventHandler (OnEntryActivated);
+ entry.Show ();
+ ToolItem item = new ToolItem ();
+ item.Add (entry);
+ tb.Add (item);
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/Main/Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/Main/Base/ChangeLog 2004-12-01 18:25:51 UTC (rev 2043)
+++ trunk/MonoDevelop/Core/src/Main/Base/ChangeLog 2004-12-01 19:53:36 UTC (rev 2044)
@@ -1,3 +1,8 @@
+2004-12-01 John Luke <john.luke at gmail.com>
+
+ * Gui/Pads/FileScout.cs: use ShadowType.In so the
+ FileBrowser doesn't look funny when it is the only pad
+
2004-11-16 Todd Berman <tberman at off.net>
* Internal/Project/Project/AbstractProject.cs: Make sure that
Modified: trunk/MonoDevelop/Core/src/Main/Base/Gui/Pads/FileScout/FileScout.cs
===================================================================
--- trunk/MonoDevelop/Core/src/Main/Base/Gui/Pads/FileScout/FileScout.cs 2004-12-01 18:25:51 UTC (rev 2043)
+++ trunk/MonoDevelop/Core/src/Main/Base/Gui/Pads/FileScout/FileScout.cs 2004-12-01 19:53:36 UTC (rev 2044)
@@ -47,6 +47,7 @@
treef.Add (fb);
Gtk.ScrolledWindow listsw = new Gtk.ScrolledWindow ();
+ listsw.ShadowType = Gtk.ShadowType.In;
listsw.Add (filelister);
this.Pack1 (treef, true, true);
More information about the Monodevelop-patches-list
mailing list