Add option to show menu for test

This commit is contained in:
Huluti 2016-12-11 16:10:50 +01:00
parent d33234b740
commit 6a67be6e15
2 changed files with 26 additions and 3 deletions

View File

@ -41,6 +41,11 @@
<placeholder/>
</child>
</object>
<object class="GtkImage" id="homeicon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">go-home</property>
</object>
<object class="GtkImage" id="iconabout">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -59,7 +64,6 @@
<property name="can_focus">False</property>
<child>
<object class="GtkStackSidebar" id="sidebar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="stack">stack</property>
@ -674,6 +678,16 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<property name="can_focus">False</property>
<property name="title">Manjaro Hello</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkButton" id="home">
<property name="name">home</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">homeicon</property>
<signal name="clicked" handler="on_action_btn_clicked" swapped="no"/>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="languages">
<property name="visible">True</property>
@ -684,7 +698,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
</items>
</object>
<packing>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>

View File

@ -14,6 +14,8 @@ from gi.repository import Gtk
class ManjaroHello():
def __init__(self):
# App vars
args = str(sys.argv)
self.menu = True if "--menu" in args else False
self.app = "manjaro-hello"
self.urls = {
"wiki": "https://wiki.manjaro.org",
@ -77,6 +79,11 @@ class ManjaroHello():
# Save locale used in config file
self.save_preferences()
# Set menu
if self.menu:
self.builder.get_object("sidebar").set_visible(True)
self.builder.get_object("home").set_visible(False)
# Set window subtitle
if self.infos["codename"] and self.infos["release"]:
self.builder.get_object("headerbar").props.subtitle = self.infos["codename"] + " " + self.infos["release"] + " "
@ -201,7 +208,9 @@ class ManjaroHello():
def on_action_btn_clicked(self, btn):
name = btn.get_name()
if name == "readme":
if name == "home":
self.builder.get_object("stack").set_visible_child(self.builder.get_object("welcome"))
elif name == "readme":
self.builder.get_object("stack").set_visible_child(self.builder.get_object("documentation"))
self.builder.get_object("documentation").set_current_page(0)
elif name == "release":