diff --git a/data/com.github.bleakgrey.tootle.gschema.xml b/data/com.github.bleakgrey.tootle.gschema.xml index e9be8ee..9fec02d 100644 --- a/data/com.github.bleakgrey.tootle.gschema.xml +++ b/data/com.github.bleakgrey.tootle.gschema.xml @@ -36,5 +36,10 @@ Sets application theme to dark + + 500 + Default character limit + Change this if your instance supports more than 500 characters in post + diff --git a/src/Dialogs/PostDialog.vala b/src/Dialogs/PostDialog.vala index 2c8ca60..e3886e1 100644 --- a/src/Dialogs/PostDialog.vala +++ b/src/Dialogs/PostDialog.vala @@ -19,6 +19,7 @@ public class Tootle.PostDialog : Gtk.Dialog { protected Status? in_reply_to; protected StatusVisibility visibility_opt = StatusVisibility.PUBLIC; + protected int char_limit; public PostDialog (Status? status = null) { Object ( @@ -28,6 +29,7 @@ public class Tootle.PostDialog : Gtk.Dialog { title: _("Toot"), transient_for: Tootle.window ); + char_limit = settings.char_limit; in_reply_to = status; if (in_reply_to != null) visibility_opt = in_reply_to.visibility; @@ -92,7 +94,7 @@ public class Tootle.PostDialog : Gtk.Dialog { scroll.show_all (); attachments = new AttachmentBox (true); - counter = new Gtk.Label ("500"); + counter = new Gtk.Label (""); actions.pack_start (counter, false, false, 6); actions.pack_end (spoiler, false, false, 6); @@ -112,6 +114,7 @@ public class Tootle.PostDialog : Gtk.Dialog { show_all (); attachments.hide (); text.grab_focus (); + validate (); } private Gtk.MenuButton get_visibility_btn () { @@ -148,7 +151,7 @@ public class Tootle.PostDialog : Gtk.Dialog { } private void validate () { - var remain = 500 - text.buffer.text.length; + var remain = char_limit - text.buffer.text.length; if (spoiler.active) remain -= spoiler_text.buffer.text.length; diff --git a/src/SettingsManager.vala b/src/SettingsManager.vala index 9a9f5bb..e01351d 100644 --- a/src/SettingsManager.vala +++ b/src/SettingsManager.vala @@ -5,6 +5,7 @@ public class Tootle.SettingsManager : Granite.Services.Settings { public bool always_online { get; set; } public bool cache { get; set; } public int cache_size { get; set; } + public int char_limit { get; set; } public bool live_updates { get; set; } public bool dark_theme { get; set; }