diff options
Diffstat (limited to 'main/src/ui/call_window')
-rw-r--r-- | main/src/ui/call_window/audio_settings_popover.vala | 44 | ||||
-rw-r--r-- | main/src/ui/call_window/call_bottom_bar.vala | 57 | ||||
-rw-r--r-- | main/src/ui/call_window/call_connection_details_window.vala | 30 | ||||
-rw-r--r-- | main/src/ui/call_window/call_encryption_button.vala | 28 | ||||
-rw-r--r-- | main/src/ui/call_window/call_window.vala | 27 | ||||
-rw-r--r-- | main/src/ui/call_window/call_window_controller.vala | 9 | ||||
-rw-r--r-- | main/src/ui/call_window/participant_widget.vala | 31 | ||||
-rw-r--r-- | main/src/ui/call_window/video_settings_popover.vala | 24 |
8 files changed, 131 insertions, 119 deletions
diff --git a/main/src/ui/call_window/audio_settings_popover.vala b/main/src/ui/call_window/audio_settings_popover.vala index f5af90ff..f66c5eee 100644 --- a/main/src/ui/call_window/audio_settings_popover.vala +++ b/main/src/ui/call_window/audio_settings_popover.vala @@ -14,7 +14,7 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { private HashMap<ListBoxRow, Plugins.MediaDevice> row_speaker_device = new HashMap<ListBoxRow, Plugins.MediaDevice>(); public AudioSettingsPopover() { - Box box = new Box(Orientation.VERTICAL, 15) { visible=true }; + Box box = new Box(Orientation.VERTICAL, 15); box.append(create_microphone_box()); box.append(create_speaker_box()); @@ -25,19 +25,19 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { Plugins.VideoCallPlugin call_plugin = Dino.Application.get_default().plugin_registry.video_call_plugin; Gee.List<Plugins.MediaDevice> devices = call_plugin.get_devices("audio", false); - Box micro_box = new Box(Orientation.VERTICAL, 10) { visible=true }; - micro_box.append(new Label("<b>" + _("Microphones") + "</b>") { use_markup=true, xalign=0, visible=true, can_focus=true /* grab initial focus*/ }); + Box micro_box = new Box(Orientation.VERTICAL, 10); + micro_box.append(new Label("<b>" + _("Microphones") + "</b>") { use_markup=true, xalign=0, can_focus=true /* grab initial focus*/ }); if (devices.size == 0) { micro_box.append(new Label(_("No microphone found."))); } else { - ListBox micro_list_box = new ListBox() { activate_on_single_click=true, selection_mode=SelectionMode.SINGLE, visible=true }; + ListBox micro_list_box = new ListBox() { activate_on_single_click=true, selection_mode=SelectionMode.SINGLE }; micro_list_box.set_header_func(listbox_header_func); - Frame micro_frame = new Frame(null) { visible=true }; + Frame micro_frame = new Frame(null); micro_frame.set_child(micro_list_box); foreach (Plugins.MediaDevice device in devices) { - Label display_name_label = new Label(device.display_name) { xalign=0, visible=true }; - Image image = new Image.from_icon_name("object-select-symbolic") { visible=true }; + Label display_name_label = new Label(device.display_name) { xalign=0 }; + Image image = new Image.from_icon_name("object-select-symbolic"); if (current_microphone_device == null || current_microphone_device.id != device.id) { image.opacity = 0; } @@ -48,19 +48,19 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { image.opacity = 1; } }); - Box device_box = new Box(Orientation.HORIZONTAL, 0) { spacing=7, visible=true }; + Box device_box = new Box(Orientation.HORIZONTAL, 0) { spacing=7 }; device_box.append(image); - Box label_box = new Box(Orientation.VERTICAL, 0) { visible = true }; + Box label_box = new Box(Orientation.VERTICAL, 0); label_box.append(display_name_label); if (device.detail_name != null) { - Label detail_name_label = new Label(device.detail_name) { xalign=0, visible=true }; - detail_name_label.get_style_context().add_class("dim-label"); + Label detail_name_label = new Label(device.detail_name) { xalign=0 }; + detail_name_label.add_css_class("dim-label"); detail_name_label.attributes = new Pango.AttrList(); detail_name_label.attributes.insert(Pango.attr_scale_new(0.8)); label_box.append(detail_name_label); } device_box.append(label_box); - ListBoxRow list_box_row = new ListBoxRow() { visible=true }; + ListBoxRow list_box_row = new ListBoxRow(); list_box_row.set_child(device_box); micro_list_box.append(list_box_row); @@ -81,22 +81,22 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { Plugins.VideoCallPlugin call_plugin = Dino.Application.get_default().plugin_registry.video_call_plugin; Gee.List<Plugins.MediaDevice> devices = call_plugin.get_devices("audio", true); - Box speaker_box = new Box(Orientation.VERTICAL, 10) { visible=true }; - speaker_box.append(new Label("<b>" + _("Speakers") +"</b>") { use_markup=true, xalign=0, visible=true }); + Box speaker_box = new Box(Orientation.VERTICAL, 10); + speaker_box.append(new Label("<b>" + _("Speakers") +"</b>") { use_markup=true, xalign=0 }); if (devices.size == 0) { speaker_box.append(new Label(_("No speaker found."))); } else { - ListBox speaker_list_box = new ListBox() { activate_on_single_click=true, selection_mode=SelectionMode.SINGLE, visible=true }; + ListBox speaker_list_box = new ListBox() { activate_on_single_click=true, selection_mode=SelectionMode.SINGLE }; speaker_list_box.set_header_func(listbox_header_func); speaker_list_box.row_selected.connect((row) => { }); - Frame speaker_frame = new Frame(null) { visible=true }; + Frame speaker_frame = new Frame(null); speaker_frame.set_child(speaker_list_box); foreach (Plugins.MediaDevice device in devices) { - Label display_name_label = new Label(device.display_name) { xalign=0, visible=true }; - Image image = new Image.from_icon_name("object-select-symbolic") { visible=true }; + Label display_name_label = new Label(device.display_name) { xalign=0 }; + Image image = new Image.from_icon_name("object-select-symbolic"); if (current_speaker_device == null || current_speaker_device.id != device.id) { image.opacity = 0; } @@ -107,19 +107,19 @@ public class Dino.Ui.AudioSettingsPopover : Gtk.Popover { image.opacity = 1; } }); - Box device_box = new Box(Orientation.HORIZONTAL, 0) { spacing=7, visible=true }; + Box device_box = new Box(Orientation.HORIZONTAL, 0) { spacing=7 }; device_box.append(image); Box label_box = new Box(Orientation.VERTICAL, 0) { visible = true }; label_box.append(display_name_label); if (device.detail_name != null) { - Label detail_name_label = new Label(device.detail_name) { xalign=0, visible=true }; - detail_name_label.get_style_context().add_class("dim-label"); + Label detail_name_label = new Label(device.detail_name) { xalign=0 }; + detail_name_label.add_css_class("dim-label"); detail_name_label.attributes = new Pango.AttrList(); detail_name_label.attributes.insert(Pango.attr_scale_new(0.8)); label_box.append(detail_name_label); } device_box.append(label_box); - ListBoxRow list_box_row = new ListBoxRow() { visible=true }; + ListBoxRow list_box_row = new ListBoxRow(); list_box_row.set_child(device_box); speaker_list_box.append(list_box_row); diff --git a/main/src/ui/call_window/call_bottom_bar.vala b/main/src/ui/call_window/call_bottom_bar.vala index ddc196f2..c30a86e9 100644 --- a/main/src/ui/call_window/call_bottom_bar.vala +++ b/main/src/ui/call_window/call_bottom_bar.vala @@ -11,52 +11,54 @@ public class Dino.Ui.CallBottomBar : Gtk.Box { public string counterpart_display_name { get; set; } - private Button audio_button = new Button() { height_request=45, width_request=45, halign=Align.START, valign=Align.START, visible=true }; - private Overlay audio_button_overlay = new Overlay() { visible=true }; + private Button audio_button = new Button() { height_request=45, width_request=45, halign=Align.START, valign=Align.START }; + private Overlay audio_button_overlay = new Overlay(); private Image audio_image = new Image() { pixel_size=22 }; - private MenuButton audio_settings_button = new MenuButton() { icon_name="go-up-symbolic", halign=Align.END, valign=Align.END }; + private MenuButton audio_settings_button = new MenuButton() { halign=Align.END, valign=Align.END }; public AudioSettingsPopover? audio_settings_popover; - private Button video_button = new Button() { height_request=45, width_request=45, halign=Align.START, valign=Align.START, visible=true }; - private Overlay video_button_overlay = new Overlay() { visible=true }; + private Button video_button = new Button() { height_request=45, width_request=45, halign=Align.START, valign=Align.START }; + private Overlay video_button_overlay = new Overlay(); private Image video_image = new Image() { pixel_size=22 }; - private MenuButton video_settings_button = new MenuButton() { icon_name="go-up-symbolic", halign=Align.END, valign=Align.END }; + private MenuButton video_settings_button = new MenuButton() { halign=Align.END, valign=Align.END }; public VideoSettingsPopover? video_settings_popover; - private Label label = new Label("") { halign=Align.CENTER, valign=Align.CENTER, wrap=true, wrap_mode=Pango.WrapMode.WORD_CHAR, hexpand=true, visible=true }; - private Stack stack = new Stack() { visible=true }; + private Label label = new Label("") { halign=Align.CENTER, valign=Align.CENTER, wrap=true, wrap_mode=Pango.WrapMode.WORD_CHAR, hexpand=true }; + private Stack stack = new Stack(); public CallBottomBar() { Object(orientation:Orientation.HORIZONTAL, spacing:0); - Box main_buttons = new Box(Orientation.HORIZONTAL, 20) { margin_start=40, margin_end=40, margin_bottom=20, margin_top=20, halign=Align.CENTER, hexpand=true, visible=true }; + Box main_buttons = new Box(Orientation.HORIZONTAL, 20) { margin_start=40, margin_end=40, margin_bottom=20, margin_top=20, halign=Align.CENTER, hexpand=true }; audio_button.set_child(audio_image); - audio_button.get_style_context().add_class("call-button"); + audio_button.add_css_class("call-button"); audio_button.clicked.connect(() => { audio_enabled = !audio_enabled; }); audio_button.margin_end = audio_button.margin_bottom = 5; // space for the small settings button audio_button_overlay.set_child(audio_button); audio_button_overlay.add_overlay(audio_settings_button); - audio_settings_button.get_style_context().add_class("call-mediadevice-settings-button"); + audio_settings_button.set_child(new Image.from_icon_name("go-up-symbolic") { pixel_size=10 }); + audio_settings_button.add_css_class("call-mediadevice-settings-button"); main_buttons.append(audio_button_overlay); video_button.set_child(video_image); - video_button.get_style_context().add_class("call-button"); + video_button.add_css_class("call-button"); video_button.clicked.connect(() => { video_enabled = !video_enabled; }); video_button.margin_end = video_button.margin_bottom = 5; video_button_overlay.set_child(video_button); video_button_overlay.add_overlay(video_settings_button); - video_settings_button.get_style_context().add_class("call-mediadevice-settings-button"); + video_settings_button.set_child(new Image.from_icon_name("go-up-symbolic") { pixel_size=10 }); + video_settings_button.add_css_class("call-mediadevice-settings-button"); main_buttons.append(video_button_overlay); - Button button_hang = new Button() { height_request=45, width_request=45, halign=Align.START, valign=Align.START, visible=true }; + Button button_hang = new Button() { height_request=45, width_request=45, halign=Align.START, valign=Align.START }; button_hang.set_child(new Image() { icon_name="dino-phone-hangup-symbolic", pixel_size=22 }); - button_hang.get_style_context().add_class("call-button"); - button_hang.get_style_context().add_class("destructive-action"); + button_hang.add_css_class("call-button"); + button_hang.add_css_class("destructive-action"); button_hang.clicked.connect(() => hang_up()); main_buttons.append(button_hang); - label.get_style_context().add_class("text-no-controls"); + label.add_css_class("text-no-controls"); stack.add_named(main_buttons, "control-buttons"); stack.add_named(label, "label"); @@ -71,7 +73,7 @@ public class Dino.Ui.CallBottomBar : Gtk.Box { on_audio_enabled_changed(); on_video_enabled_changed(); - this.get_style_context().add_class("call-bottom-bar"); + this.add_css_class("call-bottom-bar"); } public AudioSettingsPopover? show_audio_device_choices(bool show) { @@ -112,25 +114,25 @@ public class Dino.Ui.CallBottomBar : Gtk.Box { public void on_audio_enabled_changed() { if (audio_enabled) { audio_image.icon_name = "dino-microphone-symbolic"; - audio_button.get_style_context().add_class("white-button"); - audio_button.get_style_context().remove_class("transparent-white-button"); + audio_button.add_css_class("white-button"); + audio_button.remove_css_class("transparent-white-button"); } else { audio_image.icon_name = "dino-microphone-off-symbolic"; - audio_button.get_style_context().remove_class("white-button"); - audio_button.get_style_context().add_class("transparent-white-button"); + audio_button.remove_css_class("white-button"); + audio_button.add_css_class("transparent-white-button"); } } public void on_video_enabled_changed() { if (video_enabled) { video_image.icon_name = "dino-video-symbolic"; - video_button.get_style_context().add_class("white-button"); - video_button.get_style_context().remove_class("transparent-white-button"); + video_button.add_css_class("white-button"); + video_button.remove_css_class("transparent-white-button"); } else { video_image.icon_name = "dino-video-off-symbolic"; - video_button.get_style_context().remove_class("white-button"); - video_button.get_style_context().add_class("transparent-white-button"); + video_button.remove_css_class("white-button"); + video_button.add_css_class("transparent-white-button"); } } @@ -140,6 +142,7 @@ public class Dino.Ui.CallBottomBar : Gtk.Box { } public bool is_menu_active() { - return video_settings_button.popover.visible || audio_settings_button.popover.visible; // TODO gtk4 does this work? check for null? + return (video_settings_button.popover != null && video_settings_button.popover.visible) || + (audio_settings_button.popover != null && audio_settings_button.popover.visible); } }
\ No newline at end of file diff --git a/main/src/ui/call_window/call_connection_details_window.vala b/main/src/ui/call_window/call_connection_details_window.vala index 0905908c..9e9e1b3a 100644 --- a/main/src/ui/call_window/call_connection_details_window.vala +++ b/main/src/ui/call_window/call_connection_details_window.vala @@ -4,10 +4,10 @@ namespace Dino.Ui { public class CallConnectionDetailsWindow : Gtk.Window { - public Box box = new Box(Orientation.VERTICAL, 15) { halign=Align.CENTER, valign=Align.CENTER, visible=true }; + public Box box = new Box(Orientation.VERTICAL, 15) { halign=Align.CENTER, valign=Align.CENTER }; private bool video_added = false; - private CallContentDetails audio_details = new CallContentDetails("Audio") { visible=true }; + private CallContentDetails audio_details = new CallContentDetails("Audio"); private CallContentDetails video_details = new CallContentDetails("Video"); public CallConnectionDetailsWindow() { @@ -36,24 +36,24 @@ namespace Dino.Ui { public class CallContentDetails : Gtk.Grid { - public Label rtp_title = new Label("RTP") { xalign=0, visible=true }; - public Label rtcp_title = new Label("RTCP") { xalign=0, visible=true }; - public Label target_recv_title = new Label("Target receive bitrate") { xalign=0, visible=true }; - public Label target_send_title = new Label("Target send bitrate") { xalign=0, visible=true }; + public Label rtp_title = new Label("RTP") { xalign=0 }; + public Label rtcp_title = new Label("RTCP") { xalign=0 }; + public Label target_recv_title = new Label("Target receive bitrate") { xalign=0 }; + public Label target_send_title = new Label("Target send bitrate") { xalign=0 }; - public Label rtp_ready = new Label("?") { xalign=0, visible=true }; - public Label rtcp_ready = new Label("?") { xalign=0, visible=true }; - public Label sent_bps = new Label("?") { use_markup=true, xalign=0, visible=true }; - public Label recv_bps = new Label("?") { use_markup=true, xalign=0, visible=true }; - public Label codec = new Label("?") { xalign=0, visible=true }; - public Label target_receive_bitrate = new Label("n/a") { use_markup=true, xalign=0, visible=true }; - public Label target_send_bitrate = new Label("n/a") { use_markup=true, xalign=0, visible=true }; + public Label rtp_ready = new Label("?") { xalign=0 }; + public Label rtcp_ready = new Label("?") { xalign=0 }; + public Label sent_bps = new Label("?") { use_markup=true, xalign=0 }; + public Label recv_bps = new Label("?") { use_markup=true, xalign=0 }; + public Label codec = new Label("?") { xalign=0 }; + public Label target_receive_bitrate = new Label("n/a") { use_markup=true, xalign=0 }; + public Label target_send_bitrate = new Label("n/a") { use_markup=true, xalign=0 }; private PeerContentInfo? prev_info = null; private int row_at = 0; public CallContentDetails(string headline) { - attach(new Label("<b>%s</b>".printf(headline)) { use_markup=true, xalign=0, visible=true }, 0, row_at++, 1, 1); + attach(new Label("<b>%s</b>".printf(headline)) { use_markup=true, xalign=0 }, 0, row_at++, 1, 1); attach(rtp_title, 0, row_at, 1, 1); attach(rtp_ready, 1, row_at++, 1, 1); attach(rtcp_title, 0, row_at, 1, 1); @@ -104,7 +104,7 @@ namespace Dino.Ui { } private void put_row(string label) { - attach(new Label(label) { xalign=0, visible=true }, 0, row_at, 1, 1); + attach(new Label(label) { xalign=0 }, 0, row_at, 1, 1); } } } diff --git a/main/src/ui/call_window/call_encryption_button.vala b/main/src/ui/call_window/call_encryption_button.vala index 095db2b4..1b586f28 100644 --- a/main/src/ui/call_window/call_encryption_button.vala +++ b/main/src/ui/call_window/call_encryption_button.vala @@ -2,7 +2,7 @@ using Dino.Entities; using Gtk; using Pango; -public class Dino.Ui.CallEncryptionButtonController { +public class Dino.Ui.CallEncryptionButtonController : Object { private bool has_been_set = false; public bool controls_active { get; set; default=false; } @@ -21,10 +21,10 @@ public class Dino.Ui.CallEncryptionButtonController { public void set_icon(bool encrypted, string? icon_name) { if (encrypted) { button.icon_name = icon_name ?? "changes-prevent-symbolic"; - button.get_style_context().remove_class("unencrypted"); + button.remove_css_class("unencrypted"); } else { button.icon_name = icon_name ?? "changes-allow-symbolic"; - button.get_style_context().add_class("unencrypted"); + button.add_css_class("unencrypted"); } has_been_set = true; update_opacity(); @@ -35,23 +35,23 @@ public class Dino.Ui.CallEncryptionButtonController { button.set_popover(popover); if (audio_encryption == null) { - popover.set_child(new Label("This call is unencrypted.") { visible=true } ); + popover.set_child(new Label("This call is unencrypted.") ); return; } if (title != null && !show_keys) { - popover.set_child(new Label(title) { use_markup=true, visible=true } ); + popover.set_child(new Label(title) { use_markup=true } ); return; } - Box box = new Box(Orientation.VERTICAL, 10) { visible=true }; - box.append(new Label("<b>%s</b>".printf(title ?? "This call is end-to-end encrypted.")) { use_markup=true, xalign=0, visible=true }); + Box box = new Box(Orientation.VERTICAL, 10); + box.append(new Label("<b>%s</b>".printf(title ?? "This call is end-to-end encrypted.")) { use_markup=true, xalign=0 }); if (video_encryption == null) { box.append(create_media_encryption_grid(audio_encryption)); } else { - box.append(new Label("<b>Audio</b>") { use_markup=true, xalign=0, visible=true }); + box.append(new Label("<b>Audio</b>") { use_markup=true, xalign=0 }); box.append(create_media_encryption_grid(audio_encryption)); - box.append(new Label("<b>Video</b>") { use_markup=true, xalign=0, visible=true }); + box.append(new Label("<b>Video</b>") { use_markup=true, xalign=0 }); box.append(create_media_encryption_grid(video_encryption)); } popover.set_child(box); @@ -62,14 +62,14 @@ public class Dino.Ui.CallEncryptionButtonController { } private Grid create_media_encryption_grid(Xmpp.Xep.Jingle.ContentEncryption? encryption) { - Grid ret = new Grid() { row_spacing=3, column_spacing=5, visible=true }; + Grid ret = new Grid() { row_spacing=3, column_spacing=5 }; if (encryption.peer_key.length > 0) { - ret.attach(new Label("Peer call key") { xalign=0, visible=true }, 1, 2, 1, 1); - ret.attach(new Label("<span font_family='monospace'>" + format_fingerprint(encryption.peer_key) + "</span>") { use_markup=true, max_width_chars=25, ellipsize=EllipsizeMode.MIDDLE, xalign=0, hexpand=true, visible=true }, 2, 2, 1, 1); + ret.attach(new Label("Peer call key") { xalign=0 }, 1, 2, 1, 1); + ret.attach(new Label("<span font_family='monospace'>" + format_fingerprint(encryption.peer_key) + "</span>") { use_markup=true, max_width_chars=25, ellipsize=EllipsizeMode.MIDDLE, xalign=0, hexpand=true }, 2, 2, 1, 1); } if (encryption.our_key.length > 0) { - ret.attach(new Label("Your call key") { xalign=0, visible=true }, 1, 3, 1, 1); - ret.attach(new Label("<span font_family='monospace'>" + format_fingerprint(encryption.our_key) + "</span>") { use_markup=true, max_width_chars=25, ellipsize=EllipsizeMode.MIDDLE, xalign=0, hexpand=true, visible=true }, 2, 3, 1, 1); + ret.attach(new Label("Your call key") { xalign=0 }, 1, 3, 1, 1); + ret.attach(new Label("<span font_family='monospace'>" + format_fingerprint(encryption.our_key) + "</span>") { use_markup=true, max_width_chars=25, ellipsize=EllipsizeMode.MIDDLE, xalign=0, hexpand=true }, 2, 3, 1, 1); } return ret; } diff --git a/main/src/ui/call_window/call_window.vala b/main/src/ui/call_window/call_window.vala index cd05848a..cf89d8e8 100644 --- a/main/src/ui/call_window/call_window.vala +++ b/main/src/ui/call_window/call_window.vala @@ -11,13 +11,13 @@ namespace Dino.Ui { public CallWindowController controller; - public Overlay overlay = new Overlay() { visible=true }; - public Grid grid = new Grid() { visible=true }; - public CallBottomBar bottom_bar = new CallBottomBar() { visible=true }; - public Revealer bottom_bar_revealer = new Revealer() { valign=Align.END, transition_type=RevealerTransitionType.CROSSFADE, transition_duration=200, visible=true }; - public HeaderBar header_bar = new HeaderBar() { valign=Align.START, halign=Align.END, show_title_buttons=true, visible=true, opacity=0.0 }; - public Revealer header_bar_revealer = new Revealer() { halign=Align.END, valign=Align.START, transition_type=RevealerTransitionType.SLIDE_LEFT, transition_duration=200, visible=true, reveal_child=false }; - public Box own_video_box = new Box(Orientation.HORIZONTAL, 0) { halign=Align.END, valign=Align.END, visible=true }; + public Overlay overlay = new Overlay(); + public Grid grid = new Grid(); + public CallBottomBar bottom_bar = new CallBottomBar(); + public Revealer bottom_bar_revealer = new Revealer() { valign=Align.END, transition_type=RevealerTransitionType.CROSSFADE, transition_duration=200 }; + public HeaderBar header_bar = new HeaderBar() { valign=Align.START, halign=Align.END, show_title_buttons=true, opacity=0.0 }; + public Revealer header_bar_revealer = new Revealer() { halign=Align.END, valign=Align.START, transition_type=RevealerTransitionType.SLIDE_LEFT, transition_duration=200, reveal_child=false }; + public Box own_video_box = new Box(Orientation.HORIZONTAL, 0) { halign=Align.END, valign=Align.END }; private Widget? own_video = null; private HashMap<string, ParticipantWidget> participant_widgets = new HashMap<string, ParticipantWidget>(); private ArrayList<string> participants = new ArrayList<string>(); @@ -32,14 +32,14 @@ namespace Dino.Ui { public bool controls_active { get; set; default=true; } construct { - header_bar.get_style_context().add_class("call-header-bar"); + header_bar.add_css_class("call-header-bar"); header_bar.title_widget = new Box(Orientation.VERTICAL, 0); // header_bar.spacing = 0; header_bar_revealer.set_child(header_bar); bottom_bar_revealer.set_child(bottom_bar); - own_video_box.get_style_context().add_class("own-video"); + own_video_box.add_css_class("own-video"); - this.get_style_context().add_class("dino-call-window"); + this.add_css_class("dino-call-window"); overlay.set_child(grid); overlay.add_overlay(own_video_box); @@ -64,7 +64,7 @@ namespace Dino.Ui { this.notify["default-width"].connect(reposition_participant_widgets); this.notify["default-height"].connect(reposition_participant_widgets); - this.set_titlebar(new OutsideHeaderBar(this.header_bar) { visible=true }); + this.set_titlebar(new OutsideHeaderBar(this.header_bar)); reveal_control_elements(); } @@ -72,7 +72,7 @@ namespace Dino.Ui { public void add_participant(string participant, ParticipantWidget participant_widget) { participant_widget.visible = true; this.bind_property("controls-active", participant_widget, "controls-active", BindingFlags.SYNC_CREATE); - this.bind_property("controls-active", participant_widget.encryption_button, "controls-active", BindingFlags.SYNC_CREATE); + this.bind_property("controls-active", participant_widget.encryption_button_controller, "controls-active", BindingFlags.SYNC_CREATE); participants.add(participant); participant_widgets[participant] = participant_widget; @@ -153,8 +153,9 @@ namespace Dino.Ui { own_video = widget_; if (own_video == null) { - own_video = new Box(Orientation.HORIZONTAL, 0) { hexpand=true, vexpand=true }; + own_video = new Box(Orientation.HORIZONTAL, 0); } + own_video.hexpand = own_video.vexpand = true; own_video.visible = true; own_video_box.append(own_video); } diff --git a/main/src/ui/call_window/call_window_controller.vala b/main/src/ui/call_window/call_window_controller.vala index e3f8b670..e0eca6dc 100644 --- a/main/src/ui/call_window/call_window_controller.vala +++ b/main/src/ui/call_window/call_window_controller.vala @@ -134,10 +134,11 @@ public class Dino.Ui.CallWindowController : Object { warning("suspend inhibit request failed or unsupported"); } - call_window.destroy.connect(() => { + call_window.close_request.connect(() => { if (inhibit_cookie != 0) { app.uninhibit(inhibit_cookie); } + return false; }); } @@ -235,7 +236,7 @@ public class Dino.Ui.CallWindowController : Object { ParticipantWidget participant_widget = new ParticipantWidget(participant_name); participant_widget.may_show_invite_button = !participant_widgets.is_empty; participant_widget.debug_information_clicked.connect(() => { - var conn_details_window = new CallConnectionDetailsWindow() { title=participant_name, visible=true }; + var conn_details_window = new CallConnectionDetailsWindow() { title=participant_name }; conn_details_window.update_content(peer_states[participant_id].get_info()); uint timeout_handle_id = Timeout.add_seconds(1, () => { conn_details_window.update_content(peer_states[participant_id].get_info()); @@ -361,7 +362,9 @@ public class Dino.Ui.CallWindowController : Object { public override void dispose() { foreach (ulong handler_id in call_window_handler_ids) call_window.disconnect(handler_id); foreach (ulong handler_id in bottom_bar_handler_ids) call_window.bottom_bar.disconnect(handler_id); - participant_widgets.keys.@foreach((peer_id) => { remove_participant(peer_id); return true; }); + foreach (string peer_id in participant_widgets.keys) { + remove_participant(peer_id); + } call_window_handler_ids = bottom_bar_handler_ids = new ulong[0]; own_video.detach(); diff --git a/main/src/ui/call_window/participant_widget.vala b/main/src/ui/call_window/participant_widget.vala index ecd6cbb3..180923f1 100644 --- a/main/src/ui/call_window/participant_widget.vala +++ b/main/src/ui/call_window/participant_widget.vala @@ -10,15 +10,15 @@ namespace Dino.Ui { public Overlay overlay = new Overlay(); public Widget main_widget; - public HeaderBar header_bar = new HeaderBar() { valign=Align.START, visible=true }; + public HeaderBar header_bar = new HeaderBar() { valign=Align.START }; public Label title_label = new Label(""); public Label subtitle_label = new Label(""); - public Box inner_box = new Box(Orientation.HORIZONTAL, 0) { margin_start=5, margin_top=5, hexpand=true, visible=true }; - public Box title_box = new Box(Orientation.VERTICAL, 0) { valign=Align.CENTER, hexpand=true, visible=true }; - public MenuButton encryption_button = new MenuButton() { opacity=0, has_frame=false, height_request=30, width_request=30, margin_end=5, visible=true }; + public Box inner_box = new Box(Orientation.HORIZONTAL, 0) { margin_start=5, margin_top=5, hexpand=true }; + public Box title_box = new Box(Orientation.VERTICAL, 0) { valign=Align.CENTER, hexpand=true }; + public MenuButton encryption_button = new MenuButton() { opacity=0, has_frame=false, height_request=30, width_request=30, margin_end=5 }; public CallEncryptionButtonController encryption_button_controller; - public MenuButton menu_button = new MenuButton() { icon_name="open-menu-symbolic", has_frame=false, visible=true }; - public Button invite_button = new Button.from_icon_name("dino-account-plus") { has_frame=false, visible=true }; + public MenuButton menu_button = new MenuButton() { icon_name="open-menu-symbolic", has_frame=false }; + public Button invite_button = new Button.from_icon_name("dino-account-plus") { has_frame=false }; public bool shows_video = false; public string? participant_name; @@ -40,18 +40,19 @@ namespace Dino.Ui { this.participant_name = participant_name; Box titles_box = new Box(Orientation.VERTICAL, 0) { valign=Align.CENTER }; + titles_box.add_css_class("titles"); title_label.attributes = new AttrList(); title_label.attributes.insert(Pango.attr_weight_new(Weight.BOLD)); titles_box.append(title_label); subtitle_label.attributes = new AttrList(); subtitle_label.attributes.insert(Pango.attr_scale_new(Pango.Scale.SMALL)); - subtitle_label.get_style_context().add_class("dim-label"); + subtitle_label.add_css_class("dim-label"); titles_box.append(subtitle_label); header_bar.set_title_widget(titles_box); title_label.label = participant_name; - header_bar.get_style_context().add_class("participant-header-bar"); + header_bar.add_css_class("participant-header-bar"); header_bar.pack_start(invite_button); header_bar.pack_start(encryption_button); header_bar.pack_end(menu_button); @@ -73,14 +74,14 @@ namespace Dino.Ui { header_bar.show_title_buttons = is_highest_row; if (is_highest_row) { - header_bar.get_style_context().add_class("call-header-background"); + header_bar.add_css_class("call-header-background"); Gtk.Settings? gtk_settings = Gtk.Settings.get_default(); if (gtk_settings != null) { string[] buttons = gtk_settings.gtk_decoration_layout.split(":"); header_bar.decoration_layout = (is_start ? buttons[0] : "") + ":" + (is_end && buttons.length == 2 ? buttons[1] : ""); } } else { - header_bar.get_style_context().remove_class("call-header-background"); + header_bar.remove_css_class("call-header-background"); } reveal_or_hide_controls(); } @@ -93,9 +94,9 @@ namespace Dino.Ui { public void set_placeholder(Conversation? conversation, StreamInteractor stream_interactor) { shows_video = false; - Box box = new Box(Orientation.HORIZONTAL, 0) { visible=true }; - box.get_style_context().add_class("video-placeholder-box"); - AvatarImage avatar = new AvatarImage() { allow_gray=false, hexpand=true, vexpand=true, halign=Align.CENTER, valign=Align.CENTER, height=100, width=100, visible=true }; + Box box = new Box(Orientation.HORIZONTAL, 0); + box.add_css_class("video-placeholder-box"); + AvatarImage avatar = new AvatarImage() { allow_gray=false, hexpand=true, vexpand=true, halign=Align.CENTER, valign=Align.CENTER, height=100, width=100 }; if (conversation != null) { avatar.set_conversation(stream_interactor, conversation); } else { @@ -133,6 +134,10 @@ namespace Dino.Ui { } } + public bool is_menu_active() { + return false; + } + private void reveal_or_hide_controls() { header_bar.opacity = controls_active ? 1.0 : 0.0; invite_button.visible = may_show_invite_button && is_highest_row && is_start_row; diff --git a/main/src/ui/call_window/video_settings_popover.vala b/main/src/ui/call_window/video_settings_popover.vala index c931c466..58967bd2 100644 --- a/main/src/ui/call_window/video_settings_popover.vala +++ b/main/src/ui/call_window/video_settings_popover.vala @@ -11,7 +11,7 @@ public class Dino.Ui.VideoSettingsPopover : Gtk.Popover { private HashMap<ListBoxRow, Plugins.MediaDevice> row_device = new HashMap<ListBoxRow, Plugins.MediaDevice>(); public VideoSettingsPopover() { - Box box = new Box(Orientation.VERTICAL, 15) { visible=true }; + Box box = new Box(Orientation.VERTICAL, 15); box.append(create_camera_box()); this.set_child(box); @@ -21,19 +21,19 @@ public class Dino.Ui.VideoSettingsPopover : Gtk.Popover { Plugins.VideoCallPlugin call_plugin = Dino.Application.get_default().plugin_registry.video_call_plugin; Gee.List<Plugins.MediaDevice> devices = call_plugin.get_devices("video", false); - Box camera_box = new Box(Orientation.VERTICAL, 10) { visible=true }; - camera_box.append(new Label("<b>" + _("Cameras") + "</b>") { use_markup=true, xalign=0, visible=true, can_focus=true /* grab initial focus*/ }); + Box camera_box = new Box(Orientation.VERTICAL, 10); + camera_box.append(new Label("<b>" + _("Cameras") + "</b>") { use_markup=true, xalign=0, can_focus=true /* grab initial focus*/ }); if (devices.size == 0) { - camera_box.append(new Label(_("No camera found.")) { visible=true }); + camera_box.append(new Label(_("No camera found."))); } else { - ListBox list_box = new ListBox() { activate_on_single_click=true, selection_mode=SelectionMode.SINGLE, visible=true }; + ListBox list_box = new ListBox() { activate_on_single_click=true, selection_mode=SelectionMode.SINGLE }; list_box.set_header_func(listbox_header_func); - Frame frame = new Frame(null) { visible=true }; + Frame frame = new Frame(null); frame.set_child(list_box); foreach (Plugins.MediaDevice device in devices) { - Label display_name_label = new Label(device.display_name) { xalign=0, visible=true }; - Image image = new Image.from_icon_name("object-select-symbolic") { visible=true }; + Label display_name_label = new Label(device.display_name) { xalign=0 }; + Image image = new Image.from_icon_name("object-select-symbolic"); if (current_device == null || current_device.id != device.id) { image.opacity = 0; } @@ -44,19 +44,19 @@ public class Dino.Ui.VideoSettingsPopover : Gtk.Popover { image.opacity = 1; } }); - Box device_box = new Box(Orientation.HORIZONTAL, 0) { spacing=7, visible=true }; + Box device_box = new Box(Orientation.HORIZONTAL, 0) { spacing=7 }; device_box.append(image); Box label_box = new Box(Orientation.VERTICAL, 0) { visible = true }; label_box.append(display_name_label); if (device.detail_name != null) { - Label detail_name_label = new Label(device.detail_name) { xalign=0, visible=true }; - detail_name_label.get_style_context().add_class("dim-label"); + Label detail_name_label = new Label(device.detail_name) { xalign=0 }; + detail_name_label.add_css_class("dim-label"); detail_name_label.attributes = new Pango.AttrList(); detail_name_label.attributes.insert(Pango.attr_scale_new(0.8)); label_box.append(detail_name_label); } device_box.append(label_box); - ListBoxRow list_box_row = new ListBoxRow() { visible=true }; + ListBoxRow list_box_row = new ListBoxRow(); list_box_row.set_child(device_box); list_box.append(list_box_row); |