aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/add_conversation
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui/add_conversation')
-rw-r--r--main/src/ui/add_conversation/add_conference_dialog.vala53
-rw-r--r--main/src/ui/add_conversation/add_groupchat_dialog.vala2
-rw-r--r--main/src/ui/add_conversation/conference_list.vala17
-rw-r--r--main/src/ui/add_conversation/list_row.vala6
-rw-r--r--main/src/ui/add_conversation/roster_list.vala10
-rw-r--r--main/src/ui/add_conversation/select_contact_dialog.vala4
-rw-r--r--main/src/ui/add_conversation/select_jid_fragment.vala18
7 files changed, 52 insertions, 58 deletions
diff --git a/main/src/ui/add_conversation/add_conference_dialog.vala b/main/src/ui/add_conversation/add_conference_dialog.vala
index e078bc62..4b7364c7 100644
--- a/main/src/ui/add_conversation/add_conference_dialog.vala
+++ b/main/src/ui/add_conversation/add_conference_dialog.vala
@@ -10,7 +10,7 @@ namespace Dino.Ui {
public class AddConferenceDialog : Gtk.Dialog {
private Stack stack = new Stack();
- private Button cancel_button = new Button() { visible=true };
+ private Button cancel_button = new Button();
private Button ok_button;
private SelectJidFragment select_fragment;
@@ -70,12 +70,12 @@ public class AddConferenceDialog : Gtk.Dialog {
stack.transition_type = StackTransitionType.SLIDE_LEFT;
stack.set_visible_child_name("details");
-// animate_window_resize();
+ animate_window_resize(details_fragment);
}
private void setup_headerbar() {
- ok_button = new Button() { can_focus=true, visible=true };
- ok_button.get_style_context().add_class("suggested-action");
+ ok_button = new Button() { can_focus=true };
+ ok_button.add_css_class("suggested-action");
if (Util.use_csd()) {
HeaderBar header_bar = get_header_bar() as HeaderBar;
@@ -104,18 +104,18 @@ public class AddConferenceDialog : Gtk.Dialog {
stream_interactor.get_module(MucManager.IDENTITY).remove_bookmark(conference_row.account, conference_row.bookmark);
});
- Box wrap_box = new Box(Orientation.VERTICAL, 0) { visible=true };
+ Box wrap_box = new Box(Orientation.VERTICAL, 0);
wrap_box.append(select_fragment);
stack.add_named(wrap_box, "select");
if (!Util.use_csd()) {
- Box box = new Box(Orientation.HORIZONTAL, 5) { halign=Align.END, margin_bottom=15, margin_start=80, margin_end=80, visible=true };
+ Box box = new Box(Orientation.HORIZONTAL, 5) { halign=Align.END, margin_bottom=15, margin_start=80, margin_end=80 };
- Button ok_button = new Button.with_label(_("Next")) { sensitive=false, halign = Align.END, can_focus=true, visible=true };
- ok_button.get_style_context().add_class("suggested-action");
+ Button ok_button = new Button.with_label(_("Next")) { sensitive=false, halign = Align.END, can_focus=true };
+ ok_button.add_css_class("suggested-action");
ok_button.clicked.connect(on_next_button_clicked);
select_fragment.notify["done"].connect(() => { ok_button.sensitive = select_fragment.done; });
- Button cancel_button = new Button.with_label(_("Cancel")) { halign=Align.START, visible=true };
+ Button cancel_button = new Button.with_label(_("Cancel")) { halign=Align.START };
cancel_button.clicked.connect(on_cancel);
box.append(cancel_button);
box.append(ok_button);
@@ -129,18 +129,18 @@ public class AddConferenceDialog : Gtk.Dialog {
details_fragment = new ConferenceDetailsFragment(stream_interactor) { ok_button=ok_button };
details_fragment.joined.connect(() => this.close());
- Box wrap_box = new Box(Orientation.VERTICAL, 0) { visible=true };
+ Box wrap_box = new Box(Orientation.VERTICAL, 0);
wrap_box.append(details_fragment);
if (!Util.use_csd()) {
- Box box = new Box(Orientation.HORIZONTAL, 5) { halign=Align.END, margin_bottom=15, margin_start=80, margin_end=80, visible=true };
+ Box box = new Box(Orientation.HORIZONTAL, 5) { halign=Align.END, margin_bottom=15, margin_start=80, margin_end=80 };
- Button ok_button = new Button.with_label(_("Join")) { halign = Align.END, can_focus=true, visible=true };
- ok_button.get_style_context().add_class("suggested-action");
+ Button ok_button = new Button.with_label(_("Join")) { halign = Align.END, can_focus=true };
+ ok_button.add_css_class("suggested-action");
details_fragment.notify["done"].connect(() => { ok_button.sensitive = select_fragment.done; });
details_fragment.ok_button = ok_button;
- Button cancel_button = new Button.with_label(_("Back")) { halign=Align.START, visible=true };
+ Button cancel_button = new Button.with_label(_("Back")) { halign=Align.START };
cancel_button.clicked.connect(show_jid_add_view);
box.append(cancel_button);
box.append(ok_button);
@@ -180,23 +180,20 @@ public class AddConferenceDialog : Gtk.Dialog {
close();
}
- private void animate_window_resize() {
+ private void animate_window_resize(Widget widget) {
int curr_height = get_size(Orientation.VERTICAL);
- int curr_width = get_size(Orientation.HORIZONTAL);
- var natural_size = new Requisition();
- stack.get_preferred_size(null, out natural_size);
+ var natural_size = Requisition();
+ widget.get_preferred_size(null, out natural_size);
int difference = natural_size.height - curr_height;
Timer timer = new Timer();
- Timeout.add((int) (stack.transition_duration / 30),
- () => {
- ulong microsec;
- timer.elapsed(out microsec);
- ulong millisec = microsec / 1000;
- double partial = double.min(1, (double) millisec / stack.transition_duration);
- var a = this.list_toplevels().nth_data(0);
- set_size_request(curr_width, (int) (curr_height + difference * partial));
- return millisec < stack.transition_duration;
- });
+ Timeout.add((int) (stack.transition_duration / 30), () => {
+ ulong microsec;
+ timer.elapsed(out microsec);
+ ulong millisec = microsec / 1000;
+ double partial = double.min(1, (double) millisec / stack.transition_duration);
+ default_height = (int) (curr_height + difference * partial);
+ return millisec < stack.transition_duration;
+ });
}
}
diff --git a/main/src/ui/add_conversation/add_groupchat_dialog.vala b/main/src/ui/add_conversation/add_groupchat_dialog.vala
index 786c1a0b..a94b8c86 100644
--- a/main/src/ui/add_conversation/add_groupchat_dialog.vala
+++ b/main/src/ui/add_conversation/add_groupchat_dialog.vala
@@ -24,7 +24,7 @@ protected class AddGroupchatDialog : Gtk.Dialog {
Object(use_header_bar : 1);
this.stream_interactor = stream_interactor;
ok_button.label = _("Add");
- ok_button.get_style_context().add_class("suggested-action"); // TODO why doesn't it work in XML
+ ok_button.add_css_class("suggested-action"); // TODO why doesn't it work in XML
accounts_stack.set_visible_child_name("combobox");
account_combobox.initialize(stream_interactor);
diff --git a/main/src/ui/add_conversation/conference_list.vala b/main/src/ui/add_conversation/conference_list.vala
index a19630e4..181c6219 100644
--- a/main/src/ui/add_conversation/conference_list.vala
+++ b/main/src/ui/add_conversation/conference_list.vala
@@ -20,10 +20,6 @@ protected class ConferenceList {
public ConferenceList(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
-// list_box.set_filter_func(filter);
- list_box.set_header_func(header);
-// list_box.set_sort_func(sort);
-
stream_interactor.get_module(MucManager.IDENTITY).bookmarks_updated.connect((account, conferences) => {
lists[account] = conferences;
refresh_conferences();
@@ -57,7 +53,12 @@ protected class ConferenceList {
}
public void refresh_conferences() {
-// @foreach((widget) => { remove(widget); });
+ foreach (Account account in widgets.keys) {
+ foreach (Jid jid in widgets[account].keys) {
+ remove_conference(account, jid);
+ }
+ }
+
foreach (Account account in lists.keys) {
foreach (Conference conference in lists[account]) {
add_conference(account, conference);
@@ -74,12 +75,6 @@ protected class ConferenceList {
refresh_conferences();
}
- private void header(ListBoxRow row, ListBoxRow? before_row) {
- if (row.get_header() == null && before_row != null) {
- row.set_header(new Separator(Orientation.HORIZONTAL));
- }
- }
-
public ListBox get_list_box() {
return list_box;
}
diff --git a/main/src/ui/add_conversation/list_row.vala b/main/src/ui/add_conversation/list_row.vala
index 326dba98..a25ecbd3 100644
--- a/main/src/ui/add_conversation/list_row.vala
+++ b/main/src/ui/add_conversation/list_row.vala
@@ -24,7 +24,7 @@ public class ListRow : Widget {
via_label = (Label) builder.get_object("via_label");
this.layout_manager = new BinLayout();
- outer_grid.insert_after(this, null);
+ outer_grid.set_parent(this);
}
public ListRow() {}
@@ -47,6 +47,10 @@ public class ListRow : Widget {
name_label.label = display_name;
image.set_conversation(stream_interactor, conv);
}
+
+ public override void dispose() {
+ outer_grid.unparent();
+ }
}
}
diff --git a/main/src/ui/add_conversation/roster_list.vala b/main/src/ui/add_conversation/roster_list.vala
index a89d24e8..25827d67 100644
--- a/main/src/ui/add_conversation/roster_list.vala
+++ b/main/src/ui/add_conversation/roster_list.vala
@@ -20,10 +20,6 @@ protected class RosterList {
this.stream_interactor = stream_interactor;
this.accounts = accounts;
-// set_filter_func(filter);
- list_box.set_header_func(header);
-// set_sort_func(sort);
-
handler_ids += stream_interactor.get_module(RosterManager.IDENTITY).removed_roster_item.connect( (account, jid, roster_item) => {
if (accounts.contains(account)) {
on_removed_roster_item(account, jid, roster_item);
@@ -64,12 +60,6 @@ protected class RosterList {
}
}
- private void header(ListBoxRow row, ListBoxRow? before_row) {
- if (row.get_header() == null && before_row != null) {
- row.set_header(new Separator(Orientation.HORIZONTAL));
- }
- }
-
public ListBox get_list_box() {
return list_box;
}
diff --git a/main/src/ui/add_conversation/select_contact_dialog.vala b/main/src/ui/add_conversation/select_contact_dialog.vala
index 4bf5b193..09ac1636 100644
--- a/main/src/ui/add_conversation/select_contact_dialog.vala
+++ b/main/src/ui/add_conversation/select_contact_dialog.vala
@@ -40,7 +40,7 @@ public class SelectContactDialog : Gtk.Dialog {
cancel_button.visible = true;
ok_button = new Button();
- ok_button.get_style_context().add_class("suggested-action");
+ ok_button.add_css_class("suggested-action");
ok_button.sensitive = false;
ok_button.visible = true;
@@ -51,7 +51,7 @@ public class SelectContactDialog : Gtk.Dialog {
header_bar.pack_start(cancel_button);
header_bar.pack_end(ok_button);
} else {
- Box box = new Box(Orientation.HORIZONTAL, 5) { halign=Align.END, margin_bottom=15, margin_start=80, margin_end=80, visible=true };
+ Box box = new Box(Orientation.HORIZONTAL, 5) { halign=Align.END, margin_bottom=15, margin_start=80, margin_end=80 };
cancel_button.halign = Align.START;
ok_button.halign = Align.END;
diff --git a/main/src/ui/add_conversation/select_jid_fragment.vala b/main/src/ui/add_conversation/select_jid_fragment.vala
index 58f019c1..a6cf0864 100644
--- a/main/src/ui/add_conversation/select_jid_fragment.vala
+++ b/main/src/ui/add_conversation/select_jid_fragment.vala
@@ -23,7 +23,7 @@ public class SelectJidFragment : Gtk.Box {
private StreamInteractor stream_interactor;
private Gee.List<Account> accounts;
- private ArrayList<AddListRow> added_rows = new ArrayList<AddListRow>();
+ private ArrayList<Widget> added_rows = new ArrayList<Widget>();
private ListBox list;
private string[]? filter_values;
@@ -39,6 +39,7 @@ public class SelectJidFragment : Gtk.Box {
list.set_sort_func(sort);
list.set_filter_func(filter);
+ list.set_header_func(header);
list.row_selected.connect(check_buttons_active);
list.row_selected.connect(() => { done = true; }); // just for notifying
entry.changed.connect(() => { set_filter(entry.text); });
@@ -49,7 +50,7 @@ public class SelectJidFragment : Gtk.Box {
public void set_filter(string str) {
if (entry.text != str) entry.text = str;
- foreach (AddListRow row in added_rows) list.remove(row);
+ foreach (Widget row in added_rows) list.remove(row);
added_rows.clear();
filter_values = str == "" ? null : str.split(" ");
@@ -59,9 +60,10 @@ public class SelectJidFragment : Gtk.Box {
Jid parsed_jid = new Jid(str);
if (parsed_jid != null && parsed_jid.localpart != null) {
foreach (Account account in accounts) {
- AddListRow row = new AddListRow(stream_interactor, parsed_jid, account);
- list.append(row);
- added_rows.add(row);
+ var list_row = new Gtk.ListBoxRow();
+ list_row.set_child(new AddListRow(stream_interactor, parsed_jid, account));
+ list.append(list_row);
+ added_rows.add(list_row);
}
}
} catch (InvalidJidError ignored) {
@@ -108,6 +110,12 @@ public class SelectJidFragment : Gtk.Box {
return true;
}
+ private void header(ListBoxRow row, ListBoxRow? before_row) {
+ if (row.get_header() == null && before_row != null) {
+ row.set_header(new Separator(Orientation.HORIZONTAL));
+ }
+ }
+
private class AddListRow : ListRow {
public AddListRow(StreamInteractor stream_interactor, Jid jid, Account account) {