[gnome-boxes/polish-snapshot-preferences: 1/6] preferences, snapshot-list: Drop row "indicator"
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/polish-snapshot-preferences: 1/6] preferences, snapshot-list: Drop row "indicator"
- Date: Tue, 4 Jan 2022 15:39:49 +0000 (UTC)
commit 18c3b364809bb57854aaf2168b641cab37ec7961
Author: Felipe Borges <felipeborges gnome org>
Date: Tue Jan 4 14:27:09 2022 +0100
preferences, snapshot-list: Drop row "indicator"
This fancy drawing is now looking a bit outdated.
Besides, I' have been conflicted with the linear representation of
snapshots not being the most accurate visual model for this.
I think we should value meaningful labels and descriptions more
than the "timeline" aspect.
This is also based on this mockup
https://gitlab.gnome.org/Teams/Design/app-mockups/-/blob/master/boxes/snapshots-efi.png
data/gtk-style.css | 9 -----
data/ui/preferences/snapshot-list-row.ui | 4 +-
src/preferences/snapshot-list-row.vala | 67 --------------------------------
3 files changed, 2 insertions(+), 78 deletions(-)
---
diff --git a/data/gtk-style.css b/data/gtk-style.css
index 33fa7a41..48c6b668 100644
--- a/data/gtk-style.css
+++ b/data/gtk-style.css
@@ -1,12 +1,3 @@
-.boxes-snapshot-list-row.indicator {
- background-color: @insensitive_fg_color;
- border: none;
-}
-
-.boxes-snapshot-list-row.indicator.active {
- background-color: @theme_fg_color;
-}
-
.transparent-bg {
background-color: transparent;
background-image: none;
diff --git a/data/ui/preferences/snapshot-list-row.ui b/data/ui/preferences/snapshot-list-row.ui
index 5c316d6e..b21e2b41 100644
--- a/data/ui/preferences/snapshot-list-row.ui
+++ b/data/ui/preferences/snapshot-list-row.ui
@@ -32,6 +32,7 @@
<object class="GtkBox" id="show_name_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
+
<child>
<object class="GtkLabel" id="name_label">
<property name="visible">True</property>
@@ -40,9 +41,8 @@
<property name="vexpand">True</property>
<property name="halign">start</property>
<property name="valign">center</property>
- <property name="margin_start">45</property>
<property name="ellipsize">end</property>
- <property name="xalign">0</property>
+ <property name="margin">10</property>
</object>
</child>
diff --git a/src/preferences/snapshot-list-row.vala b/src/preferences/snapshot-list-row.vala
index 3994edd3..c23e63b8 100644
--- a/src/preferences/snapshot-list-row.vala
+++ b/src/preferences/snapshot-list-row.vala
@@ -18,10 +18,6 @@
[GtkChild]
private unowned Gtk.Box show_name_box;
- // index of the snapshot in the list
- private int index;
- private int parent_size;
-
private Boxes.LibvirtMachine machine;
private unowned Gtk.Container? parent_container = null;
@@ -32,7 +28,6 @@
};
construct {
- this.get_style_context ().add_class ("boxes-snapshot-list-row");
this.parent_set.connect (() => {
var parent = get_parent () as Gtk.Container;
@@ -40,15 +35,11 @@
return;
this.parent_container = parent;
- update_index ();
- parent.add.connect (update_index);
- parent.remove.connect (update_index);
});
this.selectable = false;
this.activatable = false;
}
-
public SnapshotListRow (GVir.DomainSnapshot snapshot,
LibvirtMachine machine) {
this.snapshot = snapshot;
@@ -65,52 +56,6 @@ public SnapshotListRow (GVir.DomainSnapshot snapshot,
this.insert_action_group ("snap", action_group);
}
- // Need to override this in order to connect the indicators without any gaps.
- public override bool draw (Cairo.Context ct) {
- base.draw (ct);
- var height = this.get_allocated_height ();
- var sc = this.get_style_context ();
-
- double indicator_size = height / 2.0;
-
- sc.save ();
- sc.add_class ("indicator");
-
- var line_color = sc.get_background_color (this.get_state_flags ());
- ct.set_source_rgba (line_color.red, line_color.green, line_color.blue, line_color.alpha);
- ct.set_line_width (4);
- if (index > 0) {
- ct.move_to (height / 2.0 + 0.5, -1);
- ct.line_to (height / 2.0 + 0.5, height / 2.0);
- ct.stroke ();
- }
- // this row + the SnapshotPage's add_button row
- if (index < parent_size - 2) {
- ct.move_to (height / 2.0 + 0.5, height / 2.0);
- ct.line_to (height / 2.0 + 0.5, height + 1);
- ct.stroke ();
- }
-
- bool is_current = false;
- try {
- this.snapshot.get_is_current (0, out is_current);
- } catch (GLib.Error e) {
- warning (e.message);
- }
-
- if (is_current)
- sc.add_class ("active");
-
- ct.save();
- sc.render_background (ct, height / 4.0, height / 4.0, indicator_size, indicator_size);
- sc.render_frame (ct, height / 4.0, height / 4.0, indicator_size, indicator_size + 0.5);
- ct.restore();
-
- sc.restore ();
-
- return true;
- }
-
[GtkCallback]
private void on_save_name_button_clicked () {
var name = name_entry.text;
@@ -207,16 +152,4 @@ private void rename_activated (GLib.SimpleAction action, GLib.Variant? v) {
mode_stack.visible_child = edit_name_box;
name_entry.grab_focus ();
}
-
- private void update_index () {
- var parent = this.get_parent ();
-
- if (parent == null || !(parent is Gtk.ListBox))
- return;
-
- var container = parent as Gtk.Container;
- var siblings = container.get_children ();
- this.index = siblings.index (this);
- this.parent_size = (int) siblings.length ();
- }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]