Commit 23ec9ed0 authored by Abhinav Singh's avatar Abhinav Singh
Browse files

ui: Display ControllerPopover in DisplayHeaderBar

https://bugzilla.gnome.org/show_bug.cgi?id=780756
parent af9c4513
......@@ -92,5 +92,30 @@
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="controller_button">
<property name="visible">True</property>
<property name="valign">center</property>
<property name="use-underline">True</property>
<style>
<class name="image-button"/>
</style>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-controller">
<property name="accessible-name" translatable="yes">controller</property>
</object>
</child>
<child>
<object class="GtkImage" id="controller_image">
<property name="visible">True</property>
<property name="icon-name">input-gaming-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</template>
</interface>
......@@ -254,6 +254,8 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
display_box.runner = runner;
display_header_bar.media_set = runner.media_set;
display_box.header_bar.media_set = runner.media_set;
display_header_bar.controller_set = runner.controller_set;
display_box.header_bar.controller_set = runner.controller_set;
is_fullscreen = settings.get_boolean ("fullscreen") && runner.can_fullscreen;
......
......@@ -6,6 +6,8 @@ private class Games.DisplayHeaderBar : Gtk.HeaderBar {
[GtkChild]
private MediaMenuButton media_button;
[GtkChild]
private Gtk.MenuButton controller_button;
public string game_title {
set { title = value; }
......@@ -21,7 +23,15 @@ private class Games.DisplayHeaderBar : Gtk.HeaderBar {
}
}
public ControllerSet? controller_set {
set {
controller_popover.controller_set = value;
controller_button.visible = value != null;
}
}
private MediaSelector media_selector;
private ControllerPopover controller_popover;
[GtkChild]
private Gtk.Button fullscreen;
......@@ -34,6 +44,10 @@ private class Games.DisplayHeaderBar : Gtk.HeaderBar {
construct {
settings = new Settings ("org.gnome.Games");
controller_popover = new ControllerPopover ();
controller_popover.set_relative_to (controller_button);
controller_button.set_popover (controller_popover);
media_selector = new MediaSelector ();
media_selector.set_relative_to (media_button);
media_button.set_popover (media_selector);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment