mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-08 07:53:17 +02:00
make the icon view actually work
svn path=/trunk/gtk-sharp/; revision=43423
This commit is contained in:
parent
f78826e7ac
commit
db6b5d036a
@ -37,9 +37,8 @@ namespace GtkDemo
|
|||||||
homeButton.IsImportant = true;
|
homeButton.IsImportant = true;
|
||||||
toolbar.Insert (homeButton, -1);
|
toolbar.Insert (homeButton, -1);
|
||||||
|
|
||||||
// FIXME: use the real icons later
|
fileIcon = GetIcon ("gnome-fs-regular");
|
||||||
fileIcon = Gdk.Pixbuf.LoadFromResource ("MonoIcon.png");
|
dirIcon = GetIcon ("gnome-fs-directory");
|
||||||
dirIcon = Gdk.Pixbuf.LoadFromResource ("MonoIcon.png");
|
|
||||||
|
|
||||||
ScrolledWindow sw = new ScrolledWindow ();
|
ScrolledWindow sw = new ScrolledWindow ();
|
||||||
sw.ShadowType = ShadowType.EtchedIn;
|
sw.ShadowType = ShadowType.EtchedIn;
|
||||||
@ -66,10 +65,15 @@ namespace GtkDemo
|
|||||||
ShowAll ();
|
ShowAll ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gdk.Pixbuf GetIcon (string name)
|
||||||
|
{
|
||||||
|
return Gtk.IconTheme.Default.LoadIcon (name, 32, (IconLookupFlags) 0);
|
||||||
|
}
|
||||||
|
|
||||||
ListStore CreateStore ()
|
ListStore CreateStore ()
|
||||||
{
|
{
|
||||||
// path, name, pixbuf, is_dir
|
// path, name, pixbuf, is_dir
|
||||||
ListStore store = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf), typeof (bool));
|
ListStore store = new ListStore (GLib.GType.String, GLib.GType.String, Gdk.Pixbuf.GType, GLib.GType.Boolean);
|
||||||
|
|
||||||
// Set sort column and function
|
// Set sort column and function
|
||||||
store.SetDefaultSortFunc (SortFunc);
|
store.SetDefaultSortFunc (SortFunc);
|
||||||
@ -90,7 +94,7 @@ namespace GtkDemo
|
|||||||
foreach (DirectoryInfo di in parent.GetDirectories ())
|
foreach (DirectoryInfo di in parent.GetDirectories ())
|
||||||
{
|
{
|
||||||
if (!di.Name.StartsWith ("."))
|
if (!di.Name.StartsWith ("."))
|
||||||
store.AppendValues (di.FullName, di.Name, dirIcon, false);
|
store.AppendValues (di.FullName, di.Name, dirIcon, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (FileInfo file in parent.GetFiles ())
|
foreach (FileInfo file in parent.GetFiles ())
|
||||||
|
Loading…
Reference in New Issue
Block a user