[Xfce4-commits] <design:master> Add demo code for an appfinder mockup idea.
Jannis Pohlmann
noreply at xfce.org
Tue May 31 15:26:02 CEST 2011
Updating branch refs/heads/master
to 8e37ead7a30032f2ff99f8d2701db6b89c951b80 (commit)
from cef267f3f42e1690fced003775f58cb317227aa6 (commit)
commit 8e37ead7a30032f2ff99f8d2701db6b89c951b80
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Tue May 31 15:25:01 2011 +0200
Add demo code for an appfinder mockup idea.
.../merge-with-xfrun/demo-code}/Makefile | 0
.../merge-with-xfrun/demo-code/mockup.vala | 142 ++++++++++++++++++++
2 files changed, 142 insertions(+), 0 deletions(-)
diff --git a/thunar/shortcuts-pane/demo-code/tree-view/Makefile b/xfce4-appfinder/merge-with-xfrun/demo-code/Makefile
similarity index 100%
copy from thunar/shortcuts-pane/demo-code/tree-view/Makefile
copy to xfce4-appfinder/merge-with-xfrun/demo-code/Makefile
diff --git a/xfce4-appfinder/merge-with-xfrun/demo-code/mockup.vala b/xfce4-appfinder/merge-with-xfrun/demo-code/mockup.vala
new file mode 100644
index 0000000..fd860f4
--- /dev/null
+++ b/xfce4-appfinder/merge-with-xfrun/demo-code/mockup.vala
@@ -0,0 +1,142 @@
+/* vi:set et ai sw=2 sts=2 ts=2: */
+/*-
+ * Copyright (c) 2011 Jannis Pohlmann <jannis at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+using Gtk;
+
+
+
+public class DetailsView : Paned {
+ private TreeView categories_view { get; set; }
+ private TreeView applications_view { get; set; }
+
+ public DetailsView() {
+ set_position (200);
+ set_size_request (-1, 300);
+
+ var scrollwin1 = new ScrolledWindow (null, null);
+ scrollwin1.set_policy (PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
+ scrollwin1.set_shadow_type (ShadowType.IN);
+ add1 (scrollwin1);
+ scrollwin1.show ();
+
+ categories_view = new TreeView ();
+ scrollwin1.add (categories_view);
+ categories_view.show ();
+
+ var scrollwin2 = new ScrolledWindow (null, null);
+ scrollwin2.set_shadow_type (ShadowType.IN);
+ scrollwin2.set_policy (PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
+ add2 (scrollwin2);
+ scrollwin2.show ();
+
+ var applications_view = new TreeView ();
+ scrollwin2.add (applications_view);
+ applications_view.show ();
+ }
+}
+
+
+
+public class AppfinderView : Table {
+ private Image image { get; set; }
+ private Entry entry { get; set; }
+ private DetailsView details_view { get; set; }
+
+ public bool expanded { get; set; default = false; }
+
+ public AppfinderView () {
+ set_homogeneous (false);
+ set_col_spacings (12);
+ set_row_spacings (6);
+
+ image = new Image.from_icon_name ("claws-mail", IconSize.DIALOG);
+ attach (image, 0, 1, 0, 1, AttachOptions.SHRINK, AttachOptions.SHRINK, 0, 0);
+
+ entry = new Entry ();
+ entry.set_icon_from_stock (EntryIconPosition.PRIMARY, Stock.FIND);
+ entry.set_icon_from_stock (EntryIconPosition.SECONDARY, Stock.GO_DOWN);
+ attach (entry, 1, 2, 0, 1,
+ AttachOptions.FILL | AttachOptions.EXPAND,
+ AttachOptions.SHRINK,
+ 0, 0);
+
+ entry.icon_press.connect ((icon_pos, event) => {
+ if (icon_pos == EntryIconPosition.SECONDARY) {
+ toggle_expand ();
+ }
+ });
+
+ details_view = new DetailsView ();
+ details_view.set_no_show_all (true);
+ attach (details_view, 1, 2, 1, 2,
+ AttachOptions.FILL | AttachOptions.EXPAND,
+ AttachOptions.FILL | AttachOptions.EXPAND,
+ 0, 0);
+
+ notify["expanded"].connect (() => {
+ details_view.set_visible (expanded);
+ });
+ }
+
+ public void toggle_expand () {
+ this.expanded = !expanded;
+ }
+}
+
+
+
+int main (string[] args) {
+ Gtk.init (ref args);
+
+ var window = new Window ();
+ window.title = "Shortcuts Pane Mockup (Tree View)";
+ window.set_default_size (600, -1);
+ window.position = WindowPosition.CENTER;
+ window.destroy.connect (Gtk.main_quit);
+ window.set_border_width (8);
+
+ var vbox = new VBox (false, 6);
+ window.add (vbox);
+
+ var view = new AppfinderView ();
+ vbox.add (view);
+
+ var buttons = new HButtonBox ();
+ buttons.set_spacing (6);
+ buttons.set_layout (ButtonBoxStyle.END);
+ vbox.pack_start (buttons, false, true, 0);
+
+ var cancel = new Button.from_stock (Stock.CANCEL);
+ buttons.pack_start (cancel, false, true, 0);
+
+ cancel.clicked.connect (Gtk.main_quit);
+
+ var launch = new Button.with_mnemonic ("_Launch");
+ launch.set_image (new Image.from_stock (Stock.EXECUTE, IconSize.BUTTON));
+ buttons.pack_start (launch, false, true, 0);
+
+ cancel.clicked.connect (Gtk.main_quit);
+
+ window.show_all ();
+
+ Gtk.main ();
+
+ return 0;
+}
More information about the Xfce4-commits
mailing list