Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Minimize to tray' functionality using SNI (StatusNotifierItem) #1209

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Systray toggle in settings
  • Loading branch information
emil committed Nov 6, 2022
commit 67521015c3f9e7019057516702b9d60efbd912fb
13 changes: 13 additions & 0 deletions libdino/src/entity/settings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Settings : Object {
notifications_ = col_to_bool_or_default("notifications", true);
convert_utf8_smileys_ = col_to_bool_or_default("convert_utf8_smileys", true);
check_spelling = col_to_bool_or_default("check_spelling", true);
systray = col_to_bool_or_default("systray", true);
}

private bool col_to_bool_or_default(string key, bool def) {
Expand Down Expand Up @@ -78,6 +79,18 @@ public class Settings : Object {
check_spelling_ = value;
}
}

private bool systray_;
public bool systray {
get { return systray_; }
set {
db.settings.upsert()
.value(db.settings.key, "systray", true)
.value(db.settings.value, value.to_string())
.perform();
systray_ = value;
}
}
}

}
12 changes: 12 additions & 0 deletions main/data/settings_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="systray_checkbutton">
<property name="label" translatable="yes">Enable minimize to tray.</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>
Expand Down
3 changes: 3 additions & 0 deletions main/src/ui/settings_dialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class SettingsDialog : Dialog {
[GtkChild] private unowned CheckButton notification_checkbutton;
[GtkChild] private unowned CheckButton emoji_checkbutton;
[GtkChild] private unowned CheckButton check_spelling_checkbutton;
[GtkChild] private unowned CheckButton systray_checkbutton;

Dino.Entities.Settings settings = Dino.Application.get_default().settings;

Expand All @@ -21,12 +22,14 @@ class SettingsDialog : Dialog {
notification_checkbutton.active = settings.notifications;
emoji_checkbutton.active = settings.convert_utf8_smileys;
check_spelling_checkbutton.active = settings.check_spelling;
systray_checkbutton.active = settings.systray;

typing_checkbutton.toggled.connect(() => { settings.send_typing = typing_checkbutton.active; } );
marker_checkbutton.toggled.connect(() => { settings.send_marker = marker_checkbutton.active; } );
notification_checkbutton.toggled.connect(() => { settings.notifications = notification_checkbutton.active; } );
emoji_checkbutton.toggled.connect(() => { settings.convert_utf8_smileys = emoji_checkbutton.active; });
check_spelling_checkbutton.toggled.connect(() => { settings.check_spelling = check_spelling_checkbutton.active; });
systray_checkbutton.toggled.connect(() => { settings.systray = systray_checkbutton.active; });
}
}

Expand Down