Support custom character limit for toots
This commit is contained in:
parent
efa6d25749
commit
08084ecdae
|
@ -36,5 +36,10 @@
|
|||
<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 post</description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue