Changes
6 changed files (+64/-6)
-
-
@@ -28,5 +28,10 @@ <default>""</default><summary>Last Connected Server Token</summary> <description>Connects to the server with this token. Ignored when connected-server-id is empty.</description> </key> <key name="label-parsing-enabled" type="b"> <default>true</default> <summary>Enable label parsing</summary> <description>Enable parsing of browse items' label. Some browse page contains "[[id|label]]" text and this option turns that into "label".</description> </key> </schema> </schemalist>
-
-
-
@@ -119,6 +119,10 @@<menu id="app_menu"> <section> <item> <attribute name="label">Preferences</attribute> <attribute name="action">app.preferences</attribute> </item> <item> <attribute name="label">About Plac</attribute> <attribute name="action">app.about</attribute> </item>
-
-
-
@@ -18,6 +18,10 @@ namespace PlacGtkAdwaita {public class App : Adw.Application { private static GLib.ActionEntry[] app_entries = { GLib.ActionEntry() { name = "preferences", activate = on_preferences, }, GLib.ActionEntry() { name = "about", activate = on_about, },
-
@@ -27,6 +31,8 @@ activate = on_quit,}, }; private Settings settings = new Settings(); public App(){ Object( application_id: "jp.pocka.plac.gtk-adwaita",
-
@@ -35,8 +41,6 @@ );} protected override void activate() { var settings = new Settings(); if (settings.connected_server_id == "") { var selector = new ServerSelector.Window(this); selector.start();
-
@@ -48,6 +52,26 @@ }public static int main(string[] args) { return new App().run(args); } private void on_preferences() { var label_parsing_enabled = new Adw.SwitchRow(); label_parsing_enabled.active = settings.label_parsing_enabled; label_parsing_enabled.notify["active"].connect(() => { settings.label_parsing_enabled = label_parsing_enabled.active; }); label_parsing_enabled.title = "Parse labels"; label_parsing_enabled.subtitle = "Enable parsing of \"[[id|text]]\" labels in browse section."; var group = new Adw.PreferencesGroup(); group.add(label_parsing_enabled); var page = new Adw.PreferencesPage(); page.add(group); var dialog = new Adw.PreferencesDialog(); dialog.add(page); dialog.present(this.active_window); } private void on_about() {
-
-
-
@@ -17,6 +17,7 @@namespace PlacGtkAdwaita { private const string CONNECTED_SERVER_ID = "connected-server-id"; private const string CONNECTED_SERVER_TOKEN = "connected-server-token"; private const string LABEL_PARSING_ENABLED = "label-parsing-enabled"; public class Settings { public GLib.Settings settings;
-
@@ -33,6 +34,11 @@public string connected_server_token { owned get { return settings.get_string(CONNECTED_SERVER_TOKEN); } set { settings.set_string(CONNECTED_SERVER_TOKEN, value); } } public bool label_parsing_enabled { owned get { return settings.get_boolean(LABEL_PARSING_ENABLED); } set { settings.set_boolean(LABEL_PARSING_ENABLED, value); } } } }
-
-
-
@@ -67,6 +67,7 @@private Plac.Browse.Item? item = null; private bool is_loading = false; private Settings settings = new Settings(); public Browse() { Object();
-
@@ -149,9 +150,17 @@ }var action = result.get_list_action(); title.label = action.title; if (settings.label_parsing_enabled) { title.label = new Plac.Browse.Label(action.title).plain_text; } else { title.label = action.title; } if (action.subtitle != null) { subtitle.label = action.subtitle; if (settings.label_parsing_enabled) { subtitle.label = new Plac.Browse.Label(action.subtitle).plain_text; } else { subtitle.label = action.subtitle; } subtitle.visible = true; } else { subtitle.visible = false;
-
-
-
@@ -47,6 +47,8 @@ private bool is_popover_closed_by_submission = false;public Plac.Browse.Item item { get; construct; } private Settings settings = new Settings(); public Plac.AsyncConnection? conn { get { return artwork.conn; } set construct { artwork.conn = value; }
-
@@ -57,9 +59,17 @@ Object(item: item, conn: conn);} construct { title.label = item.title; if (settings.label_parsing_enabled) { title.label = new Plac.Browse.Label(item.title).plain_text; } else { title.label = item.title; } if (item.subtitle != null) { subtitle.label = item.subtitle; if (settings.label_parsing_enabled) { subtitle.label = new Plac.Browse.Label(item.subtitle).plain_text; } else { subtitle.label = item.subtitle; } subtitle.visible = true; }
-