From 5a74722c39249ad3afefefe28d76915f46516d5c Mon Sep 17 00:00:00 2001 From: Artem Anufrij Date: Tue, 30 Oct 2018 20:20:16 +0100 Subject: [PATCH] fix#80 --- data/com.github.artemanufrij.webpin.appdata.xml | 12 ++++++++++++ src/Widgets/Views/Editor.vala | 2 +- src/Widgets/Views/WebItemsView.vala | 8 ++++++++ src/Widgets/WebItem.vala | 6 ++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/data/com.github.artemanufrij.webpin.appdata.xml b/data/com.github.artemanufrij.webpin.appdata.xml index dfed555..1098a0b 100644 --- a/data/com.github.artemanufrij.webpin.appdata.xml +++ b/data/com.github.artemanufrij.webpin.appdata.xml @@ -33,6 +33,18 @@ + + +

New:

+
    +
  • Sort items inside app overview
  • +
+

Fixed:

+
    +
  • Custom icon was replaced by default one
  • +
+
+

New:

diff --git a/src/Widgets/Views/Editor.vala b/src/Widgets/Views/Editor.vala index d464275..6c674c1 100644 --- a/src/Widgets/Views/Editor.vala +++ b/src/Widgets/Views/Editor.vala @@ -488,7 +488,7 @@ namespace Webpin.Widgets.Views { private void on_accept () { string icon = icon_name_entry.get_text (); - if (tmp_icon_file != "") { + if (tmp_icon_file != "" && tmp_icon_file == icon) { var new_icon = GLib.Path.build_filename (WebpinApp.instance.CACHE_FOLDER, app_name_entry.get_text () + tmp_icon_ext); uint8[] content; try { diff --git a/src/Widgets/Views/WebItemsView.vala b/src/Widgets/Views/WebItemsView.vala index fa10e84..8b8bf93 100644 --- a/src/Widgets/Views/WebItemsView.vala +++ b/src/Widgets/Views/WebItemsView.vala @@ -44,6 +44,7 @@ namespace Webpin.Widgets.Views { scrolled.hscrollbar_policy = Gtk.PolicyType.NEVER; web_items = new Gtk.FlowBox(); + web_items.set_sort_func (sort_func); web_items.valign = Gtk.Align.START; web_items.vexpand = false; web_items.homogeneous = true; @@ -108,5 +109,12 @@ namespace Webpin.Widgets.Views { } } } + + public int sort_func (Gtk.FlowBoxChild child1, Gtk.FlowBoxChild child2) { + var item1 = (WebItem)child1; + var item2 = (WebItem)child2; + + return item1.title.collate (item2.title); + } } } diff --git a/src/Widgets/WebItem.vala b/src/Widgets/WebItem.vala index de87d63..c3f49e5 100644 --- a/src/Widgets/WebItem.vala +++ b/src/Widgets/WebItem.vala @@ -29,6 +29,12 @@ namespace Webpin.Widgets { public class WebItem : Gtk.FlowBoxChild { + public string title { + get { + return desktop_file.name; + } + } + Gtk.Image image; Gtk.Label label;