Unique method to handle welcome btn signal

This commit is contained in:
Huluti 2016-12-04 19:43:38 +01:00
parent 1eb6c9ed51
commit 4693020ca3
2 changed files with 17 additions and 14 deletions

View File

@ -190,10 +190,11 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Read me</property>
<property name="name">readmebtn</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_readme_clicked" swapped="no"/>
<signal name="clicked" handler="on_welcome_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
@ -203,10 +204,11 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Release info</property>
<property name="name">releasebtn</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_release_clicked" swapped="no"/>
<signal name="clicked" handler="on_welcome_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
@ -230,10 +232,11 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Get involved</property>
<property name="name">involvedbtn</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_involved_clicked" swapped="no"/>
<signal name="clicked" handler="on_welcome_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>

View File

@ -105,17 +105,17 @@ class ManjaroHello(Gtk.Window):
dialog.run()
dialog.hide()
def on_readme_clicked(self, btn):
self.builder.get_object("stack").set_visible_child(self.builder.get_object("documentation"))
self.builder.get_object("documentation").set_current_page(0)
def on_release_clicked(self, btn):
self.builder.get_object("stack").set_visible_child(self.builder.get_object("documentation"))
self.builder.get_object("documentation").set_current_page(1)
def on_involved_clicked(self, btn):
self.builder.get_object("stack").set_visible_child(self.builder.get_object("project"))
self.builder.get_object("project").set_current_page(0)
def on_welcome_btn_clicked(self, btn):
name = btn.get_name()
if name == "readmebtn":
self.builder.get_object("stack").set_visible_child(self.builder.get_object("documentation"))
self.builder.get_object("documentation").set_current_page(0)
elif name == "releasebtn":
self.builder.get_object("stack").set_visible_child(self.builder.get_object("documentation"))
self.builder.get_object("documentation").set_current_page(1)
elif name == "involvedbtn":
self.builder.get_object("stack").set_visible_child(self.builder.get_object("project"))
self.builder.get_object("project").set_current_page(0)
def on_autostart_switched(self, switch, _):
autostart = True if switch.get_active() else False