[gnome-boxes] Remove Category treeview and animation glitches
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Remove Category treeview and animation glitches
- Date: Wed, 20 Jun 2012 10:26:13 +0000 (UTC)
commit fd6b5c43ccf71d8f32303be69d763d43dbf2ad5a
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date: Mon Jun 18 11:46:07 2012 +0200
Remove Category treeview and animation glitches
By removing the old Category selection, remove a bit of
rendering glitches.
https://bugzilla.gnome.org/show_bug.cgi?id=678302
src/app.vala | 9 +---
src/collection-view.vala | 5 +-
src/sidebar.vala | 115 ----------------------------------------------
3 files changed, 4 insertions(+), 125 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index b7913b2..4eaddc9 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -170,12 +170,7 @@ private class Boxes.App: Boxes.UI {
return false;
}
- public void set_category (Category category) {
- topbar.label.set_text (category.name);
- view.category = category;
- }
-
- public LibvirtMachine? add_domain (CollectionSource source, GVir.Connection connection, GVir.Domain domain) {
+ public LibvirtMachine? add_domain (CollectionSource source, GVir.Connection connection, GVir.Domain domain) {
var machine = domain.get_data<LibvirtMachine> ("machine");
if (machine != null)
return machine; // Already added
@@ -396,7 +391,7 @@ private class Boxes.App: Boxes.UI {
Clutter.BinAlignment.FILL);
sidebar = new Sidebar ();
- view = new CollectionView (sidebar.category);
+ view = new CollectionView ();
topbar = new Topbar ();
notificationbar = new Notificationbar ();
selectionbar = new Selectionbar ();
diff --git a/src/collection-view.vala b/src/collection-view.vala
index 9fe442a..60064f6 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -27,9 +27,8 @@ private class Boxes.CollectionView: Boxes.UI {
set { icon_view.visible = value; }
}
- public CollectionView (Category category) {
- this.category = category;
-
+ public CollectionView () {
+ category = new Category (_("New and Recent"), Category.Kind.NEW);
setup_view ();
App.app.notify["selection-mode"].connect (() => {
var mode = App.app.selection_mode ? Gtk.SelectionMode.MULTIPLE : Gtk.SelectionMode.NONE;
diff --git a/src/sidebar.vala b/src/sidebar.vala
index 00a3ae9..d3d5174 100644
--- a/src/sidebar.vala
+++ b/src/sidebar.vala
@@ -12,29 +12,12 @@ private enum Boxes.SidebarPage {
private class Boxes.Sidebar: Boxes.UI {
public override Clutter.Actor actor { get { return bin_actor; } }
public Notebook notebook;
- public TreeView default_tree_view;
- public TreeView user_tree_view;
- public Category category;
-
private uint width;
public static const int shadow_width = 7;
private Clutter.Actor bin_actor;
private GtkClutter.Actor gtk_actor; // the sidebar box
- private bool selection_func (Gtk.TreeSelection selection,
- Gtk.TreeModel model,
- Gtk.TreePath path,
- bool path_currently_selected) {
- Gtk.TreeIter iter;
- bool selectable;
-
- model.get_iter (out iter, path);
- model.get (iter, 2, out selectable);
-
- return selectable;
- }
-
public Sidebar () {
width = 200;
@@ -60,71 +43,6 @@ private class Boxes.Sidebar: Boxes.UI {
}
}
- private void list_append (Gtk.ListStore listmodel,
- Category category,
- string? icon = null,
- uint height = 0,
- bool sensitive = true) {
- Gtk.TreeIter iter;
-
- listmodel.append (out iter);
- listmodel.set (iter, 0, category.name);
- listmodel.set (iter, 1, height);
- listmodel.set (iter, 2, sensitive);
- listmodel.set (iter, 3, icon);
- listmodel.set (iter, 4, category);
- }
-
- private Gtk.TreeView make_tree_view () {
- var tree_view = new Gtk.TreeView ();
- var selection = tree_view.get_selection ();
- selection.set_mode (Gtk.SelectionMode.BROWSE);
- selection.set_select_function (selection_func);
- tree_view_activate_on_single_click (tree_view, true);
- tree_view.row_activated.connect ( (treeview, path, column) => {
- Gtk.TreeIter iter;
- Category category;
- var model = treeview.get_model ();
- bool selectable;
-
- model.get_iter (out iter, path);
- model.get (iter, 4, out category);
- model.get (iter, 2, out selectable);
-
- if (selectable) {
- this.category = category;
- App.app.set_category (category);
- }
-
- (treeview == default_tree_view ? user_tree_view : default_tree_view).get_selection ().unselect_all ();
- });
-
- var listmodel = new ListStore (5,
- typeof (string),
- typeof (uint),
- typeof (bool),
- typeof (string),
- typeof (Category));
- tree_view.set_model (listmodel);
- tree_view.headers_visible = false;
-
- var pixbuf_renderer = new CellRendererPixbuf ();
- pixbuf_renderer.xpad = 5;
- tree_view.insert_column_with_attributes (-1, "", pixbuf_renderer, "icon-name", 3);
- var renderer = new CellRendererText ();
- tree_view.insert_column_with_attributes (-1, "", renderer, "text", 0, "height", 1, "sensitive", 2);
-
- return tree_view;
- }
-
- private void update_user_tree () {
- var listmodel = user_tree_view.get_model () as Gtk.ListStore;
-
- listmodel.clear ();
- foreach (var collection in App.app.settings.get_strv ("collections"))
- list_append (listmodel, new Category (_(collection)));
- }
-
private void setup_sidebar () {
bin_actor = new Clutter.Actor ();
var bin = new Clutter.BinLayout (Clutter.BinAlignment.FILL,
@@ -178,39 +96,6 @@ private class Boxes.Sidebar: Boxes.UI {
var vbox = new Gtk.VBox (false, 0);
notebook.append_page (vbox, null);
- default_tree_view = make_tree_view ();
- vbox.pack_start (default_tree_view, false, false, 0);
-
- var listmodel = default_tree_view.get_model () as Gtk.ListStore;
- category = new Category (_("New and Recent"), Category.Kind.NEW);
- list_append (listmodel, category);
- list_append (listmodel, new Category (_("Favorites"), Category.Kind.FAVORITES), "emblem-favorite-symbolic");
- list_append (listmodel, new Category (_("Private"), Category.Kind.PRIVATE), "channel-secure-symbolic");
- list_append (listmodel, new Category (_("Shared with you"), Category.Kind.SHARED), "emblem-shared-symbolic");
- default_tree_view.get_selection ().select_path (new Gtk.TreePath.from_string ("0"));
-
- var label = new Gtk.Label (_("Collections"));
- label.name = "CollectionLabel";
- label.xalign = 0.0f;
- label.margin = 10;
- label.margin_top = 20;
- var labelw = new Gtk.EventBox ();
- labelw.visible_window = true;
- labelw.add (label);
- vbox.pack_start (labelw, false, false, 0);
-
- user_tree_view = make_tree_view ();
- vbox.pack_start (user_tree_view, true, true, 0);
- update_user_tree ();
-
- var create = new Gtk.Button.with_label (_("Create"));
- create.margin = 5;
- vbox.pack_end (create, false, false, 0);
- create.show ();
- create.clicked.connect (() => {
- App.app.ui_state = UIState.WIZARD;
- });
-
/* SidebarPage.WIZARD */
vbox = new Gtk.VBox (false, 0);
vbox.margin_top = 20;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]