diff options
Diffstat (limited to 'main/src/ui/add_conversation/add_conference_dialog.vala')
-rw-r--r-- | main/src/ui/add_conversation/add_conference_dialog.vala | 53 |
1 files changed, 25 insertions, 28 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; + }); } } |