diff options
author | fiaxh <git@lightrise.org> | 2022-10-11 17:50:54 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2022-10-11 17:50:54 +0200 |
commit | 11b6e615b73e4183a06f9d456634c44ead612336 (patch) | |
tree | 0c69a48b40ce850eb4ee676769a10a62d3ab9182 | |
parent | 80258a874ddfeb87b4b71f5791eab94a2465de6d (diff) | |
download | dino-11b6e615b73e4183a06f9d456634c44ead612336.tar.gz dino-11b6e615b73e4183a06f9d456634c44ead612336.zip |
Don't require use of MenuButton.set_child introduced with GTK 4.6
-rw-r--r-- | main/src/ui/call_window/call_bottom_bar.vala | 19 | ||||
-rw-r--r-- | main/src/ui/conversation_content_view/reactions_widget.vala | 3 | ||||
-rw-r--r-- | main/src/ui/util/helper.vala | 15 |
3 files changed, 18 insertions, 19 deletions
diff --git a/main/src/ui/call_window/call_bottom_bar.vala b/main/src/ui/call_window/call_bottom_bar.vala index aa318a45..dfa2e4c6 100644 --- a/main/src/ui/call_window/call_bottom_bar.vala +++ b/main/src/ui/call_window/call_bottom_bar.vala @@ -37,7 +37,7 @@ public class Dino.Ui.CallBottomBar : Gtk.Box { 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); - menu_button_set_icon_with_size(audio_settings_button, "go-up-symbolic", 10); + Util.menu_button_set_icon_with_size(audio_settings_button, "go-up-symbolic", 10); audio_settings_button.add_css_class("call-mediadevice-settings-button"); main_buttons.append(audio_button_overlay); @@ -47,7 +47,7 @@ public class Dino.Ui.CallBottomBar : Gtk.Box { video_button.margin_end = video_button.margin_bottom = 5; video_button_overlay.set_child(video_button); video_button_overlay.add_overlay(video_settings_button); - menu_button_set_icon_with_size(video_settings_button, "go-up-symbolic", 10); + Util.menu_button_set_icon_with_size(video_settings_button, "go-up-symbolic", 10); video_settings_button.add_css_class("call-mediadevice-settings-button"); main_buttons.append(video_button_overlay); @@ -76,21 +76,6 @@ public class Dino.Ui.CallBottomBar : Gtk.Box { this.add_css_class("call-bottom-bar"); } - private static void menu_button_set_icon_with_size(MenuButton menu_button, string icon_name, int pixel_size) { -#if GTK_4_6 - menu_button.set_child(new Image.from_icon_name(icon_name) { pixel_size=pixel_size }); -#else - menu_button.set_icon_name(icon_name); - var button = menu_button.get_first_child() as Button; - if (button == null) return; - var box = button.child as Box; - if (box == null) return; - var image = box.get_first_child() as Image; - if (image == null) return; - image.pixel_size = pixel_size; -#endif - } - public AudioSettingsPopover? show_audio_device_choices(bool show) { audio_settings_button.visible = show; if (audio_settings_popover != null) audio_settings_popover.visible = false; diff --git a/main/src/ui/conversation_content_view/reactions_widget.vala b/main/src/ui/conversation_content_view/reactions_widget.vala index 83b3204e..6e58b05f 100644 --- a/main/src/ui/conversation_content_view/reactions_widget.vala +++ b/main/src/ui/conversation_content_view/reactions_widget.vala @@ -129,8 +129,7 @@ public class ReactionsWidget : Grid { add_button = new MenuButton() { tooltip_text= _("Add reaction"), visible=true }; add_button.get_style_context().add_class("reaction-box"); - Image add_image = new Image.from_icon_name("dino-emoticon-add-symbolic") { margin_start=5, margin_end=5, visible=true }; - add_button.set_child(add_image); + Util.menu_button_set_icon_with_size(add_button, "dino-emoticon-add-symbolic", 14); EmojiChooser chooser = new EmojiChooser(); chooser.emoji_picked.connect((emoji) => { diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala index df7438b1..0f0fc605 100644 --- a/main/src/ui/util/helper.vala +++ b/main/src/ui/util/helper.vala @@ -452,4 +452,19 @@ public bool use_tooltips() { return Gtk.MINOR_VERSION != 6 || (Gtk.MICRO_VERSION < 4 || Gtk.MICRO_VERSION > 6); } +public static void menu_button_set_icon_with_size(MenuButton menu_button, string icon_name, int pixel_size) { +#if GTK_4_6 + menu_button.set_child(new Image.from_icon_name(icon_name) { pixel_size=pixel_size }); +#else + menu_button.set_icon_name(icon_name); + var button = menu_button.get_first_child() as Button; + if (button == null) return; + var box = button.child as Box; + if (box == null) return; + var image = box.get_first_child() as Image; + if (image == null) return; + image.pixel_size = pixel_size; +#endif +} + } |