|
4 | 4 | ["gjs.gi.Adw" :as Adw] |
5 | 5 | ["gjs.gi.Gdk" :as Gdk] |
6 | 6 | ["gjs.gi.Gtk" :as Gtk] |
7 | | - ["gjs.gi.GLib" :as GLib] |
8 | | - [clojure.string :as str] |
| 7 | + ["gjs.gi.Gio" :as Gio] |
9 | 8 | [lobjur.state :as state] |
10 | 9 | [lobjur.widgets.comments :as comments] |
11 | 10 | [lobjur.widgets.stories-list-view :refer [home-stories stories-list-view]] |
|
42 | 41 | :init |
43 | 42 | (-> state |
44 | 43 | (push-view (home-stories)) |
| 44 | + (assoc :header-end [Gtk/MenuButton |
| 45 | + :icon-name "open-menu-symbolic" |
| 46 | + :menu-model (doto (Gio/Menu.) |
| 47 | + (.append "About" "win.about") |
| 48 | + (.append "Donate" "win.donate"))]) |
45 | 49 | (assoc :title-widget |
46 | 50 | [Adw/ViewSwitcher |
47 | 51 | :policy Adw/ViewSwitcherPolicy.WIDE |
|
109 | 113 | } |
110 | 114 | ") |
111 | 115 |
|
| 116 | +(defn about [] |
| 117 | + (.present (build-ui |
| 118 | + [Gtk/AboutDialog. |
| 119 | + :license " |
| 120 | + This program comes with absolutely no warranty. |
| 121 | + See the <a href=\"https://www.gnu.org/licenses/gpl-3.0.html\">GNU General Public License, version 3 or later</a> for details." |
| 122 | + :license-type Gtk/License.GPL_3_0 |
| 123 | + :program-name "Lobjur" |
| 124 | + :authors #js ["ranfdev https://ranfdev.com/about"] |
| 125 | + :version "1.1.0" |
| 126 | + :comments "A simple https://lobste.rs client" |
| 127 | + :logo-icon-name "com.ranfdev.Lobjur" |
| 128 | + :website-label "Source" |
| 129 | + :website "https://github.com/ranfdev/Lobjur"]))) |
| 130 | + |
112 | 131 | (defn activate [app] |
113 | 132 | (let [win (Adw/ApplicationWindow. |
114 | 133 | #js |
|
117 | 136 | :default_height 720 |
118 | 137 | :content |
119 | 138 | (build-ui (window-content))})] |
| 139 | + (doto win |
| 140 | + (.present) |
| 141 | + (.add_action (doto (Gio/SimpleAction. #js {:name "about"}) |
| 142 | + (.connect "activate" #(about)))) |
| 143 | + (.add_action (doto (Gio/SimpleAction. #js {:name "donate"}) |
| 144 | + (.connect "activate" #(Gtk/show_uri nil "https://github.com/sponsors/ranfdev" 0))))) |
120 | 145 | (.present win)) |
121 | 146 | (Gtk/StyleContext.add_provider_for_display |
122 | 147 | (Gdk/Display.get_default) |
|
0 commit comments