[gnome-games] ui: Make DisplayHeaderBar use MediaMenuButton
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] ui: Make DisplayHeaderBar use MediaMenuButton
- Date: Fri, 19 Aug 2016 21:09:55 +0000 (UTC)
commit 4f899bdcca6ee8699e694f035d217dc0bc7720b4
Author: Ricard Gascons <gascons1995 gmail com>
Date: Thu Aug 18 16:34:09 2016 +0200
ui: Make DisplayHeaderBar use MediaMenuButton
Make DisplayHeaderBar use MediaMenuButton and MediaSet so it can be
later used by a subsequent commit by ApplicationWindow.
This is part of a series of commits to add multi-source support.
data/ui/display-header-bar.ui | 10 ++++++++++
src/ui/display-header-bar.vala | 19 +++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/display-header-bar.ui b/data/ui/display-header-bar.ui
index 67d00af..54613f4 100644
--- a/data/ui/display-header-bar.ui
+++ b/data/ui/display-header-bar.ui
@@ -82,5 +82,15 @@
<property name="pack-type">end</property>
</packing>
</child>
+ <child>
+ <object class="GamesMediaMenuButton" id="media_button">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="use-underline">True</property>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
</template>
</interface>
diff --git a/src/ui/display-header-bar.vala b/src/ui/display-header-bar.vala
index 85863b8..f9d7a21 100644
--- a/src/ui/display-header-bar.vala
+++ b/src/ui/display-header-bar.vala
@@ -4,6 +4,9 @@
private class Games.DisplayHeaderBar : Gtk.HeaderBar {
public signal void back ();
+ [GtkChild]
+ private MediaMenuButton media_button;
+
public string game_title {
set { title = value; }
}
@@ -11,12 +14,28 @@ private class Games.DisplayHeaderBar : Gtk.HeaderBar {
public bool can_fullscreen { set; get; }
public bool is_fullscreen { set; get; }
+ public MediaSet? media_set {
+ set {
+ media_button.media_set = value;
+ media_selector.media_set = value;
+ }
+ }
+
+ private MediaSelector media_selector;
+
[GtkChild]
private Gtk.Button fullscreen;
[GtkChild]
private Gtk.Button restore;
+ construct {
+ media_selector = new MediaSelector ();
+ media_selector.set_relative_to (media_button);
+ media_button.set_popover (media_selector);
+ media_button.show ();
+ }
+
[GtkCallback]
private void on_fullscrren_changed () {
fullscreen.visible = can_fullscreen && !is_fullscreen;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]