parent
458b2a3087
commit
5a4bc57355
|
@ -18,6 +18,13 @@ namespace Tootle{
|
||||||
public abstract signal void refresh ();
|
public abstract signal void refresh ();
|
||||||
public abstract signal void toast (string title);
|
public abstract signal void toast (string title);
|
||||||
public abstract signal void error (string title, string text);
|
public abstract signal void error (string title, string text);
|
||||||
|
|
||||||
|
const GLib.ActionEntry[] app_entries = {
|
||||||
|
{"compose-toot", compose_toot_activated },
|
||||||
|
{"back", back_activated },
|
||||||
|
{"refresh", refresh_activated },
|
||||||
|
{"switch-timeline", switch_timeline_activated, "i" }
|
||||||
|
};
|
||||||
|
|
||||||
construct {
|
construct {
|
||||||
application_id = "com.github.bleakgrey.tootle";
|
application_id = "com.github.bleakgrey.tootle";
|
||||||
|
@ -47,6 +54,16 @@ namespace Tootle{
|
||||||
|
|
||||||
window_dummy = new Window ();
|
window_dummy = new Window ();
|
||||||
add_window (window_dummy);
|
add_window (window_dummy);
|
||||||
|
|
||||||
|
this.set_accels_for_action ("app.compose-toot", {"<Ctrl>T"});
|
||||||
|
this.set_accels_for_action ("app.back", {"<Alt>BackSpace", "<Alt>Left"});
|
||||||
|
this.set_accels_for_action ("app.refresh", {"<Ctrl>R", "F5"});
|
||||||
|
this.set_accels_for_action ("app.switch-timeline(0)", {"<Alt>1"});
|
||||||
|
this.set_accels_for_action ("app.switch-timeline(1)", {"<Alt>2"});
|
||||||
|
this.set_accels_for_action ("app.switch-timeline(2)", {"<Alt>3"});
|
||||||
|
this.set_accels_for_action ("app.switch-timeline(3)", {"<Alt>4"});
|
||||||
|
|
||||||
|
this.add_action_entries (app_entries, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void activate () {
|
protected override void activate () {
|
||||||
|
@ -68,6 +85,23 @@ namespace Tootle{
|
||||||
message_dialog.run ();
|
message_dialog.run ();
|
||||||
message_dialog.destroy ();
|
message_dialog.destroy ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void compose_toot_activated () {
|
||||||
|
PostDialog.open ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void back_activated () {
|
||||||
|
window.back ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refresh_activated () {
|
||||||
|
refresh ();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void switch_timeline_activated (SimpleAction a, Variant? parameter) {
|
||||||
|
int32 timeline_no = parameter.get_int32 ();
|
||||||
|
window.switch_timeline (timeline_no);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,13 @@ public class Tootle.MainWindow: Gtk.Window {
|
||||||
network.started.connect (() => spinner.show ());
|
network.started.connect (() => spinner.show ());
|
||||||
network.finished.connect (() => spinner.hide ());
|
network.finished.connect (() => spinner.hide ());
|
||||||
accounts.updated (accounts.saved_accounts);
|
accounts.updated (accounts.saved_accounts);
|
||||||
|
button_release_event.connect ((event) => {
|
||||||
|
// On back mouse button pressed
|
||||||
|
if (event.button == 8) {
|
||||||
|
back ();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void add_header_view (AbstractView view) {
|
private void add_header_view (AbstractView view) {
|
||||||
|
@ -177,4 +184,7 @@ public class Tootle.MainWindow: Gtk.Window {
|
||||||
button_accounts.set_visible (true);
|
button_accounts.set_visible (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void switch_timeline (int32 timeline_no) {
|
||||||
|
button_mode.set_active (timeline_no);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue