Skip to content

Commit 0caa189

Browse files
committed
ShiftEnter is now an instance property to avoid global static states
1 parent b342fcf commit 0caa189

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/compose_bar.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Dc {
88

99
/* When false (default), Return sends and Shift+Return inserts a
1010
newline. When true, the roles are swapped. */
11-
public static bool shift_enter_sends = false;
11+
public bool shift_enter_sends { get; set; default = false; }
1212

1313
public signal void send_message (string text, string? file_path, string? file_name, int quote_msg_id);
1414
public signal void edit_message (int msg_id, string new_text);

src/settings_dialog.vala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ namespace Dc {
2323
markdown_rendering = kf_bool (kf, "markdown_rendering", false);
2424
Markdown.enabled = markdown_rendering;
2525
shift_enter_sends = kf_bool (kf, "shift_enter_sends", false);
26-
ComposeBar.shift_enter_sends = shift_enter_sends;
2726
notifications_enabled = kf_bool (kf, "notifications_enabled", true);
2827
}
2928

@@ -46,7 +45,7 @@ namespace Dc {
4645
}
4746

4847
public void save_shift_enter_sends (bool v) {
49-
shift_enter_sends = v; ComposeBar.shift_enter_sends = v;
48+
shift_enter_sends = v;
5049
save_to_file ((kf) => { kf.set_boolean ("General", "shift_enter_sends", v); });
5150
}
5251

src/window.vala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ namespace Dc {
311311
msg_box.append (scroll_overlay);
312312

313313
compose_bar = new ComposeBar ();
314+
settings.bind_property ("shift-enter-sends", compose_bar,
315+
"shift-enter-sends", BindingFlags.SYNC_CREATE);
314316
compose_bar.send_message.connect (on_send_message);
315317
compose_bar.edit_message.connect ((msg_id, new_text) => {
316318
if (msg_actions != null)

0 commit comments

Comments
 (0)