Unique method to handle welcome btn signal

merge-requests/64/head
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> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="label" translatable="yes">Read me</property> <property name="label" translatable="yes">Read me</property>
<property name="name">readmebtn</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">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> </object>
<packing> <packing>
<property name="left_attach">0</property> <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> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="label" translatable="yes">Release info</property> <property name="label" translatable="yes">Release info</property>
<property name="name">releasebtn</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">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> </object>
<packing> <packing>
<property name="left_attach">0</property> <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> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="label" translatable="yes">Get involved</property> <property name="label" translatable="yes">Get involved</property>
<property name="name">involvedbtn</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">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> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>

View File

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