Fix Back mouse button

This commit is contained in:
bleakgrey 2018-10-23 13:22:43 +03:00
parent bbffaa8b27
commit 77b34c2693
4 changed files with 24 additions and 13 deletions

View File

@ -55,15 +55,14 @@ namespace Tootle {
window_dummy = new Window ();
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);
set_accels_for_action ("app.compose-toot", {"<Ctrl>T"});
set_accels_for_action ("app.back", {"<Alt>BackSpace", "<Alt>Left"});
set_accels_for_action ("app.refresh", {"<Ctrl>R", "F5"});
set_accels_for_action ("app.switch-timeline(0)", {"<Alt>1"});
set_accels_for_action ("app.switch-timeline(1)", {"<Alt>2"});
set_accels_for_action ("app.switch-timeline(2)", {"<Alt>3"});
set_accels_for_action ("app.switch-timeline(3)", {"<Alt>4"});
add_action_entries (app_entries, this);
}
protected override void activate () {

View File

@ -102,10 +102,10 @@ public class Tootle.MainWindow: Gtk.Window {
network.started.connect (() => spinner.show ());
network.finished.connect (() => spinner.hide ());
accounts.updated (accounts.saved_accounts);
button_release_event.connect ((event) => {
// On back mouse button pressed
button_press_event.connect ((event) => {
if (event.button == 8) {
back ();
return true;
}
return false;
});
@ -138,6 +138,9 @@ public class Tootle.MainWindow: Gtk.Window {
public void back () {
var i = get_visible_id ();
if (i == 0)
return;
var child = primary_stack.get_child_by_name (i.to_string ());
primary_stack.set_visible_child_name ((i-1).to_string ());
child.destroy ();

View File

@ -68,7 +68,7 @@ public class Tootle.AttachmentWidget : Gtk.EventBox {
break;
}
show ();
button_press_event.connect(on_clicked);
button_press_event.connect (on_clicked);
}
public AttachmentWidget.upload (string uri) {
@ -106,6 +106,9 @@ public class Tootle.AttachmentWidget : Gtk.EventBox {
}
private bool on_clicked (EventButton ev){
if (ev.button == 8)
return false;
if (ev.button == 3)
return open_menu (ev.button, ev.time);

View File

@ -110,7 +110,7 @@ public class Tootle.StatusWidget : Gtk.EventBox {
grid.attach (counters, 2, 5, 1, 1);
show_all ();
this.button_press_event.connect (on_clicked);
button_press_event.connect (on_clicked);
}
public StatusWidget (Status status) {
@ -245,6 +245,9 @@ public class Tootle.StatusWidget : Gtk.EventBox {
}
public bool open (EventButton ev) {
if (ev.button == 8)
return false;
var formal = status.get_formal ();
var view = new StatusView (formal);
window.open_view (view);
@ -252,6 +255,9 @@ public class Tootle.StatusWidget : Gtk.EventBox {
}
private bool on_clicked (EventButton ev) {
if (ev.button == 8)
return false;
if (ev.button == 3)
return open_menu (ev.button, ev.time);
else