1+ /*
2+ * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
3+ *
4+ * This program is free software; you can redistribute it and/or
5+ * modify it under the terms of the GNU General Public
6+ * License as published by the Free Software Foundation; either
7+ * version 3 of the License, or (at your option) any later version.
8+ *
9+ * This program is distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+ * General Public License for more details.
13+ *
14+ * You should have received a copy of the GNU General Public
15+ * License along with this program; if not, write to the
16+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17+ * Boston, MA 02110-1301 USA
18+ *
19+ * Authored by: Alain M. <[email protected] > 20+ */
21+
22+ public class Utils : GLib .Object {
23+ private static Utils ? _instance;
24+ public static Utils get_default () {
25+ if (_instance == null ) {
26+ _instance = new Utils ();
27+ }
28+
29+ return _instance;
30+ }
31+
32+ public string get_encode_text (string text ) {
33+ return GLib . Uri . escape_string (text, null , false );
34+ }
35+
36+ /*
37+ Icons
38+ */
39+
40+ private Gee . HashMap<string, bool> ? _dynamic_icons;
41+ public Gee . HashMap<string, bool> dynamic_icons {
42+ get {
43+ if (_dynamic_icons != null ) {
44+ return _dynamic_icons;
45+ }
46+
47+ _dynamic_icons = new Gee .HashMap<string, bool> ();
48+ _dynamic_icons. set (" planner-calendar" , true );
49+ _dynamic_icons. set (" planner-search" , true );
50+ _dynamic_icons. set (" chevron-right" , true );
51+ _dynamic_icons. set (" chevron-down" , true );
52+ _dynamic_icons. set (" planner-refresh" , true );
53+ _dynamic_icons. set (" planner-edit" , true );
54+ _dynamic_icons. set (" planner-trash" , true );
55+ _dynamic_icons. set (" planner-star" , true );
56+ _dynamic_icons. set (" planner-note" , true );
57+ _dynamic_icons. set (" planner-close-circle" , true );
58+ _dynamic_icons. set (" planner-check-circle" , true );
59+ _dynamic_icons. set (" planner-flag" , true );
60+ _dynamic_icons. set (" planner-tag" , true );
61+ _dynamic_icons. set (" planner-pinned" , true );
62+ _dynamic_icons. set (" planner-settings" , true );
63+ _dynamic_icons. set (" planner-bell" , true );
64+ _dynamic_icons. set (" sidebar-left" , true );
65+ _dynamic_icons. set (" sidebar-right" , true );
66+ _dynamic_icons. set (" planner-mail" , true );
67+ _dynamic_icons. set (" planner-note" , true );
68+ _dynamic_icons. set (" planner-settings-sliders" , true );
69+ _dynamic_icons. set (" planner-list" , true );
70+ _dynamic_icons. set (" planner-board" , true );
71+ _dynamic_icons. set (" color-swatch" , true );
72+ _dynamic_icons. set (" emoji-happy" , true );
73+ _dynamic_icons. set (" planner-clipboard" , true );
74+ _dynamic_icons. set (" planner-copy" , true );
75+ _dynamic_icons. set (" planner-rotate" , true );
76+ _dynamic_icons. set (" planner-section" , true );
77+ _dynamic_icons. set (" unordered-list" , true );
78+ _dynamic_icons. set (" ordered-list" , true );
79+ _dynamic_icons. set (" menu" , true );
80+ _dynamic_icons. set (" share" , true );
81+ _dynamic_icons. set (" dropdown" , true );
82+ _dynamic_icons. set (" information" , true );
83+ _dynamic_icons. set (" dots-vertical" , true );
84+ _dynamic_icons. set (" plus" , true );
85+
86+ return _dynamic_icons;
87+ }
88+ }
89+
90+ public bool is_dynamic_icon (string icon_name ) {
91+ return dynamic_icons. has_key (icon_name);
92+ }
93+ }
0 commit comments