[gnome-boxes/remove-favorites-and-categories] collection, views: Remove "Favorite" option
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/remove-favorites-and-categories] collection, views: Remove "Favorite" option
- Date: Mon, 3 Jan 2022 12:43:08 +0000 (UTC)
commit 821398577df54e01c51cd1246eae9887ed0d7599
Author: Felipe Borges <felipeborges gnome org>
Date: Mon Jan 3 13:41:16 2022 +0100
collection, views: Remove "Favorite" option
Similarly to the removal of selection-mode, this decision is based
on the assumption that most of our users don't have a significant
amount of Machines to the point where selection-mode, categories,
favourites, are not really used/needed.
Users with more virtual machines than usual can still rely on the
search to find their VMs.
data/gtk-style.css | 8 --------
data/ui/icon-view-child.ui | 10 ----------
data/ui/list-view-row.ui | 11 -----------
src/actions-popover.vala | 14 --------------
src/box-config.vala | 39 +--------------------------------------
src/collection.vala | 18 ------------------
src/icon-view-child.vala | 14 --------------
src/icon-view.vala | 11 -----------
src/list-view-row.vala | 11 -----------
9 files changed, 1 insertion(+), 135 deletions(-)
---
diff --git a/data/gtk-style.css b/data/gtk-style.css
index a6515b22..e5bb19f5 100644
--- a/data/gtk-style.css
+++ b/data/gtk-style.css
@@ -28,14 +28,6 @@
border: none;
}
-.favorite {
- color: @theme_text_color;
-}
-
-.favorite.running {
- color: white;
-}
-
.boxes-product-key-entry {
font-family: monospace;
}
diff --git a/data/ui/icon-view-child.ui b/data/ui/icon-view-child.ui
index 324d3e80..e4cb8894 100644
--- a/data/ui/icon-view-child.ui
+++ b/data/ui/icon-view-child.ui
@@ -16,16 +16,6 @@
<property name="margin">10</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
-
- <child>
- <object class="GtkImage" id="favorite">
- <property name="visible">False</property>
- <property name="icon-name">starred-symbolic</property>
- <style>
- <class name="favorite"/>
- </style>
- </object>
- </child>
</object>
</child>
diff --git a/data/ui/list-view-row.ui b/data/ui/list-view-row.ui
index 2faa18ee..9034795f 100644
--- a/data/ui/list-view-row.ui
+++ b/data/ui/list-view-row.ui
@@ -58,17 +58,6 @@
</packing>
</child>
- <child>
- <object class="GtkImage" id="favorite">
- <property name="visible">True</property>
- <property name="icon-name">starred-symbolic</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
<child>
<object class="GtkBox" id="name_and_info_box">
<property name="visible">True</property>
diff --git a/src/actions-popover.vala b/src/actions-popover.vala
index 4ed0e194..4fce9a90 100644
--- a/src/actions-popover.vala
+++ b/src/actions-popover.vala
@@ -3,7 +3,6 @@
private class Boxes.ActionsPopover: Gtk.Popover {
private const GLib.ActionEntry[] action_entries = {
{"open-in-new-win", open_in_new_win_activated},
- {"favorite", favorite_activated},
{"take_screenshot", take_screenshot_activated},
{"force_shutdown", force_shutdown_activated},
{"delete", delete_activated},
@@ -58,13 +57,6 @@ public void update_for_item (CollectionItem item) {
section.append (_("Take Screenshot"), "box.take_screenshot");
}
- // Favorite
- if (("favorite" in machine.config.categories))
- section.append (_("Remove from Favorites"), "box.favorite");
- else
- section.append (_("Add to Favorites"), "box.favorite");
- menu.append_section (null, section);
-
// New section for force shutdown and delete
section = new GLib.Menu ();
@@ -111,12 +103,6 @@ private void open_in_new_win_activated () {
App.app.open_in_new_window (window.current_item as Machine);
}
- private void favorite_activated () {
- var machine = window.current_item as Machine;
- var enabled = !("favorite" in machine.config.categories);
- machine.config.set_category ("favorite", enabled);
- }
-
private string get_screenshot_filename () {
var now = new GLib.DateTime.now_local ();
var timestamp = now.format ("%Y-%m-%d %H-%M-%S");
diff --git a/src/box-config.vala b/src/box-config.vala
index 15843b55..a8f86dc5 100644
--- a/src/box-config.vala
+++ b/src/box-config.vala
@@ -70,35 +70,6 @@ public void delete () {
save ();
}
- private void remove_category (string category) {
- string[] categories = {};
-
- foreach (var it in this.categories)
- if (it != category)
- categories += it;
-
- this.categories = categories;
- }
-
- private void add_category (string category) {
- if (category in categories)
- return;
-
- // FIXME: vala bug if in one line
- string[] categories = categories;
- categories += category;
- this.categories = categories;
- }
-
- public void set_category (string category, bool enabled) {
- if (enabled)
- add_category (category);
- else
- remove_category (category);
-
- save ();
- }
-
private void save_property (Object object, string property_name) {
var value = Value (object.get_class ().find_property (property_name).value_type);
@@ -186,15 +157,7 @@ public bool contains_strings (string[] strings) {
}
public int compare (BoxConfig other) {
- // sort favorites first
- // FIXME: We should probably have some fixed categories rather than hard-coded strings
- if ("favorite" in categories) {
- if (!("favorite" in other.categories))
- return -1;
- } else if ("favorite" in other.categories)
- return 1;
-
- // then by last time used
+ // sort by last time used
if (access_last_time > 0 || other.access_last_time > 0) {
if (access_last_time > other.access_last_time)
return -1;
diff --git a/src/collection.vala b/src/collection.vala
index e239a27e..48a8fd71 100644
--- a/src/collection.vala
+++ b/src/collection.vala
@@ -140,21 +140,3 @@ public bool filter (CollectionItem item) {
}
private delegate bool Boxes.CollectionFilterFunc (Boxes.CollectionItem item);
-
-private class Boxes.Category: GLib.Object {
- public enum Kind {
- USER,
- NEW,
- FAVORITES,
- PRIVATE,
- SHARED
- }
-
- public string name;
- public Kind kind;
-
- public Category (string name, Kind kind = Kind.USER) {
- this.name = name;
- this.kind = kind;
- }
-}
diff --git a/src/icon-view-child.vala b/src/icon-view-child.vala
index 2d1c2cdb..699bf443 100644
--- a/src/icon-view-child.vala
+++ b/src/icon-view-child.vala
@@ -21,8 +21,6 @@
[GtkChild]
private unowned Gtk.Spinner spinner;
[GtkChild]
- private unowned Gtk.Image favorite;
- [GtkChild]
private unowned Gtk.Image running_thumbnail;
[GtkChild]
private unowned Gtk.Label machine_name;
@@ -39,16 +37,13 @@ public IconViewChild (CollectionItem item) {
stack.width_request = SCREENSHOT_WIDTH;
stack.height_request = SCREENSHOT_HEIGHT;
- machine.config.notify["categories"].connect (update_favorite);
machine.notify["under-construction"].connect (update_thumbnail);
machine.notify["is-stopped"].connect (update_thumbnail);
thumbnailer.notify["thumbnail"].connect (() => {
update_thumbnail ();
- update_favorite ();
});
update_thumbnail ();
- update_favorite ();
machine.bind_property ("name", machine_name, "label", BindingFlags.SYNC_CREATE);
}
@@ -78,13 +73,4 @@ else if (machine.is_stopped)
spinner.stop ();
}
-
- private void update_favorite () {
- favorite.visible = "favorite" in machine.config.categories;
-
- if (thumbnailer.thumbnail != null)
- favorite.get_style_context ().add_class ("running");
- else
- favorite.get_style_context ().remove_class ("running");
- }
}
diff --git a/src/icon-view.vala b/src/icon-view.vala
index e7cd5a85..dcaad597 100644
--- a/src/icon-view.vala
+++ b/src/icon-view.vala
@@ -10,18 +10,7 @@
private AppWindow window;
private Boxes.ActionsPopover context_popover;
- private Category _category;
- public Category category {
- get { return _category; }
- set {
- _category = value;
- // FIXME: update view
- }
- }
-
construct {
- category = new Category (_("New and Recent"), Category.Kind.NEW);
-
filter = new CollectionFilter ();
filter.notify["text"].connect (() => {
flowbox.invalidate_filter ();
diff --git a/src/list-view-row.vala b/src/list-view-row.vala
index 85b75421..c47ebf50 100644
--- a/src/list-view-row.vala
+++ b/src/list-view-row.vala
@@ -22,8 +22,6 @@
[GtkChild]
private unowned Gtk.Spinner spinner;
[GtkChild]
- private unowned Gtk.Image favorite;
- [GtkChild]
private unowned Gtk.Label machine_name;
[GtkChild]
private unowned Gtk.Label info_label;
@@ -42,7 +40,6 @@ public ListViewRow (CollectionItem item) {
stack.width_request = SCREENSHOT_WIDTH;
stack.height_request = SCREENSHOT_HEIGHT;
- machine.config.notify["categories"].connect (update_favorite);
machine.notify["under-construction"].connect (update_thumbnail);
machine.notify["is-stopped"].connect (update_thumbnail);
machine.notify["info"].connect (update_info);
@@ -51,7 +48,6 @@ public ListViewRow (CollectionItem item) {
thumbnailer.notify["thumbnail"].connect (update_thumbnail);
update_thumbnail ();
- update_favorite ();
update_info ();
update_status ();
@@ -84,13 +80,6 @@ else if (machine.is_stopped)
spinner.stop ();
}
- private void update_favorite () {
- if ("favorite" in machine.config.categories)
- favorite.set_from_icon_name ("starred-symbolic", Gtk.IconSize.MENU);
- else
- favorite.clear ();
- }
-
private void update_info () {
var info = (machine.info != null && machine.info != "")? "<small>" + machine.info + "</small>": "";
info_label.label = info;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]