Update gschema

This commit is contained in:
Bleak Grey 2020-05-31 22:56:03 +03:00
parent f6c7b1795e
commit 01b1223982
5 changed files with 56 additions and 47 deletions

View File

@ -1,47 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<enum id='com.github.bleakgrey.tootle.API.Visibility'>
<value nick='public' value='0'/>
<value nick='unlisted' value='1'/>
<value nick='private' value='2'/>
<value nick='direct' value='3'/>
</enum>
<schema path="/com/github/bleakgrey/tootle/" id="com.github.bleakgrey.tootle" gettext-domain="com.github.bleakgrey.tootle">
<key name="current-account" type="i">
<default>0</default>
<summary>Current Account</summary>
<description>Do not edit or it shall set your house on fire</description>
</key>
<key name="always-online" type="b">
<default>false</default>
<summary>Always monitor new notifications</summary>
<description></description>
</key>
<key name="live-updates" type="b">
<default>true</default>
<summary>Real-time timelines</summary>
<description>Update timelines in real-time</description>
</key>
<key name="live-updates-public" type="b">
<default>false</default>
<summary>Real-time public timelines</summary>
<description>Update local and federated timelines in real-time. May clog up memory on busy instances.</description>
</key>
<key name="dark-theme" type="b">
<default>false</default>
<summary>Sets application theme to dark</summary>
<description></description>
</key>
<key name="char-limit" type="i">
<default>500</default>
<summary>Default character limit</summary>
<description>Change this if your instance supports more than 500 characters in posts</description>
<key name="autostart" type="b">
<default>false</default>
</key>
<key name="work-in-background" type="b">
<default>false</default>
</key>
<key name="default-post-visibility" enum="com.github.bleakgrey.tootle.API.Visibility">
<default>'public'</default>
</key>
<key name="timeline-page-size" type="i">
<default>20</default>
</key>
<key name="post-text-size" type="i">
<default>14</default>
</key>
<key name="live-updates" type="b">
<default>true</default>
</key>
<key name="public-live-updates" type="b">
<default>false</default>
</key>
<key name="watched-users" type="s">
<default>''</default>
<summary>Watched Users</summary>
<description>Comma separated list of usernames to notify you about</description>
</key>
<key name="watched-hashtags" type="s">
<default>''</default>
<summary>Watched Hashtags</summary>
<description>Comma separated list of hashtags to notify you about</description>
</key>
<key name="window-x" type="i">
<default>-1</default>
</key>
@ -49,10 +58,10 @@
<default>-1</default>
</key>
<key name="window-w" type="i">
<default>-1</default>
<default>600</default>
</key>
<key name="window-h" type="i">
<default>-1</default>
<default>700</default>
</key>
</schema>

View File

@ -23,10 +23,10 @@
<child>
<object class="HdyActionRow">
<property name="visible">True</property>
<property name="activatable_widget">use_dark_mode</property>
<property name="activatable_widget">dark_theme</property>
<property name="title" translatable="yes">Dark theme</property>
<child type="action">
<object class="GtkSwitch" id="use_dark_mode">
<object class="GtkSwitch" id="dark_theme">
<property name="visible">True</property>
<property name="valign">center</property>
</object>
@ -170,14 +170,12 @@
<object class="GtkAdjustment" id="page_adjustment">
<property name="lower">10</property>
<property name="upper">50</property>
<property name="value">20</property>
<property name="page-increment">1</property>
<property name="step-increment">1</property>
</object>
<object class="GtkAdjustment" id="font_adjustment">
<property name="lower">14</property>
<property name="upper">32</property>
<property name="value">14</property>
<property name="page-increment">1</property>
<property name="step-increment">1</property>
</object>

View File

@ -42,9 +42,9 @@ public class Tootle.Dialogs.MainWindow: Gtk.Window, ISavedWindow {
add_timeline_view (new Views.Local (), app.ACCEL_TIMELINE_2, 2);
add_timeline_view (new Views.Federated (), app.ACCEL_TIMELINE_3, 3);
settings.bind_property ("dark-theme", Gtk.Settings.get_default (), "gtk-application-prefer-dark-theme", BindingFlags.SYNC_CREATE);
button_press_event.connect (on_button_press);
settings.changed.connect (update_theme);
update_theme ();
update_header ();
restore_state ();
}
@ -98,7 +98,7 @@ public class Tootle.Dialogs.MainWindow: Gtk.Window, ISavedWindow {
public override bool delete_event (EventAny event) {
destroy.connect (() => {
if (!settings.always_online || accounts.is_empty ())
if (!settings.work_in_background || accounts.is_empty ())
app.remove_window (window_dummy);
window = null;
});
@ -123,10 +123,6 @@ public class Tootle.Dialogs.MainWindow: Gtk.Window, ISavedWindow {
});
}
void update_theme () {
Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = settings.dark_theme;
}
void update_header () {
bool primary_mode = get_visible_id () == 0;
timeline_switcher.sensitive = primary_mode;

View File

@ -3,11 +3,14 @@ using GLib;
public class Tootle.Settings : GLib.Settings {
public int current_account { get; set; }
public bool always_online { get; set; }
public int char_limit { get; set; }
public bool live_updates { get; set; }
public bool live_updates_public { get; set; }
public bool dark_theme { get; set; }
public bool autostart { get; set; }
public bool work_in_background { get; set; }
public API.Visibility default_post_visibility { get; set; }
public int timeline_page_size { get; set; }
public int post_text_size { get; set; }
public bool live_updates { get; set; }
public bool public_live_updates { get; set; }
public string watched_users { get; set; }
public string watched_hashtags { get; set; }
@ -20,11 +23,14 @@ public class Tootle.Settings : GLib.Settings {
public Settings () {
Object (schema_id: Build.DOMAIN);
init ("current-account");
init ("always-online");
init ("char-limit");
init ("live-updates");
init ("live-updates-public");
init ("dark-theme");
init ("autostart");
init ("work-in-background");
init ("default-post-visibility");
init ("timeline-page-size");
init ("post-text-size");
init ("live-updates");
init ("public-live-updates");
init ("watched-users");
init ("watched-hashtags");

View File

@ -149,7 +149,7 @@ public class Tootle.Views.Timeline : IAccountListener, IStreamListener, Views.Ba
protected virtual void add_status (API.Status status) {
var allow_update = true;
if (is_public)
allow_update = settings.live_updates_public;
allow_update = settings.public_live_updates;
if (settings.live_updates && allow_update)
prepend (widgetize (status));