Updating branch refs/heads/master to df3ed4bf8401d91388cae90f3ce3ea6394a1044e (commit) from 8e37ead7a30032f2ff99f8d2701db6b89c951b80 (commit)
commit df3ed4bf8401d91388cae90f3ce3ea6394a1044e Author: Jannis Pohlmann <jan...@xfce.org> Date: Tue May 31 15:48:16 2011 +0200 Work on the appfinder demo code a bit. Resizing doesn't work yet. .../merge-with-xfrun/demo-code/mockup.vala | 70 +++++++++++++++++++- 1 files changed, 68 insertions(+), 2 deletions(-) diff --git a/xfce4-appfinder/merge-with-xfrun/demo-code/mockup.vala b/xfce4-appfinder/merge-with-xfrun/demo-code/mockup.vala index fd860f4..4d4bed2 100644 --- a/xfce4-appfinder/merge-with-xfrun/demo-code/mockup.vala +++ b/xfce4-appfinder/merge-with-xfrun/demo-code/mockup.vala @@ -22,12 +22,53 @@ using Gtk; +public class CategoryModel : ListStore { + public static enum Column { + ICON_NAME, MARKUP, SEPARATOR, + } + + private static Type[] ColumnTypes = { + typeof (string), + typeof (string), + typeof (bool) + }; + + public CategoryModel () { + set_column_types (ColumnTypes); + + TreeIter iter; + + append (out iter); + this.set (iter, Column.ICON_NAME, "applications-other", Column.MARKUP, "All Applications", -1); + + append (out iter); + this.set (iter, Column.ICON_NAME, Stock.EXECUTE, Column.MARKUP, "Command History", -1); + + append (out iter); + this.set (iter, Column.SEPARATOR, true, -1); + + append (out iter); + this.set (iter, Column.ICON_NAME, "applications-accessories", Column.MARKUP, "Accessories", -1); + + append (out iter); + this.set (iter, Column.ICON_NAME, "applications-development", Column.MARKUP, "Development", -1); + + append (out iter); + this.set (iter, Column.ICON_NAME, "applications-graphics", Column.MARKUP, "Graphics", -1); + + append (out iter); + this.set (iter, Column.ICON_NAME, "applications-multimedia", Column.MARKUP, "Multimedia", -1); + } +} + + + public class DetailsView : Paned { private TreeView categories_view { get; set; } private TreeView applications_view { get; set; } public DetailsView() { - set_position (200); + set_position (150); set_size_request (-1, 300); var scrollwin1 = new ScrolledWindow (null, null); @@ -36,10 +77,33 @@ public class DetailsView : Paned { add1 (scrollwin1); scrollwin1.show (); + var categories_model = new CategoryModel (); + categories_view = new TreeView (); + categories_view.set_model (categories_model); + categories_view.set_headers_visible (false); scrollwin1.add (categories_view); categories_view.show (); + categories_view.set_row_separator_func ((model, iter) => { + bool separator = false; + model.get (iter, CategoryModel.Column.SEPARATOR, out separator, -1); + return separator; + }); + + var category_icon_renderer = new CellRendererPixbuf (); + var category_text_renderer = new CellRendererText (); + + var category_column = new TreeViewColumn (); + category_column.set_expand (false); + category_column.pack_start (category_icon_renderer, false); + category_column.set_attributes (category_icon_renderer, + "icon-name", CategoryModel.Column.ICON_NAME); + category_column.pack_start (category_text_renderer, true); + category_column.set_attributes (category_text_renderer, + "markup", CategoryModel.Column.MARKUP); + categories_view.append_column (category_column); + var scrollwin2 = new ScrolledWindow (null, null); scrollwin2.set_shadow_type (ShadowType.IN); scrollwin2.set_policy (PolicyType.AUTOMATIC, PolicyType.AUTOMATIC); @@ -92,6 +156,8 @@ public class AppfinderView : Table { notify["expanded"].connect (() => { details_view.set_visible (expanded); + entry.set_icon_from_stock (EntryIconPosition.SECONDARY, + expanded ? Stock.GO_UP : Stock.GO_DOWN); }); } @@ -107,7 +173,7 @@ int main (string[] args) { var window = new Window (); window.title = "Shortcuts Pane Mockup (Tree View)"; - window.set_default_size (600, -1); + window.set_default_size (500, -1); window.position = WindowPosition.CENTER; window.destroy.connect (Gtk.main_quit); window.set_border_width (8); _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits