Skip to content

Commit

Permalink
Remove obsolete User class
Browse files Browse the repository at this point in the history
  • Loading branch information
naxuroqa committed Feb 19, 2018
1 parent f3c58e6 commit cb3d527
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 54 deletions.
2 changes: 1 addition & 1 deletion src/core/Message.vala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace Venom {

public virtual string get_sender_plain() {
if (from == null) {
return User.instance.name;
return _("me");
} else {
return from.get_name_string();
}
Expand Down
43 changes: 0 additions & 43 deletions src/core/User.vala

This file was deleted.

1 change: 0 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ venom_source = files(
'core/R.vala',
'core/Tools.vala',
'core/WidgetFactory.vala',
'core/User.vala',
'core/UserInfo.vala',
'db/DatabaseInterfaces.vala',
'db/SqliteSettingsDatabase.vala',
Expand Down
2 changes: 1 addition & 1 deletion src/tox/GroupMessage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace Venom {

public virtual string get_sender_plain() {
if (message_direction == MessageDirection.OUTGOING) {
return User.instance.name;
return _("me");
} else {
return sender_name;
}
Expand Down
10 changes: 6 additions & 4 deletions src/ui/ConferenceWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ namespace Venom {
text_view.key_press_event.connect(on_keypress);
app_window.add_action_entries(win_entries, this);

// trigger autoscroll
on_items_changed(0, 0, 1);

delayed_scroll_to_end();
model.items_changed.connect(on_items_changed);

logger.d("ConferenceWindow created.");
Expand All @@ -86,10 +84,14 @@ namespace Venom {

private void on_items_changed(uint pos, uint rem, uint add) {
if (add - rem > 0) {
GLib.Timeout.add(50, scroll_to_end);
delayed_scroll_to_end();
}
}

private void delayed_scroll_to_end() {
GLib.Timeout.add(50, scroll_to_end);
}

private bool scroll_to_end() {
var adjustment = scrolled_window.vadjustment;
adjustment.value = adjustment.upper - adjustment.page_size;
Expand Down
10 changes: 6 additions & 4 deletions src/ui/ConversationWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ namespace Venom {
text_view.buffer.changed.connect(on_buffer_changed);
app_window.add_action_entries(win_entries, this);

// trigger autoscroll
on_items_changed(0, 0, 1);

delayed_scroll_to_end();
model.items_changed.connect(on_items_changed);

logger.d("ConversationWindow created.");
Expand All @@ -86,10 +84,14 @@ namespace Venom {

private void on_items_changed(uint pos, uint rem, uint add) {
if (add - rem > 0) {
GLib.Timeout.add(50, scroll_to_end);
delayed_scroll_to_end();
}
}

private void delayed_scroll_to_end() {
GLib.Timeout.add(50, scroll_to_end);
}

private bool scroll_to_end() {
var adjustment = scrolled_window.vadjustment;
adjustment.value = adjustment.upper - adjustment.page_size;
Expand Down

0 comments on commit cb3d527

Please sign in to comment.