Merge on_action_btn_clicked() and on_autostart_switched()

This commit is contained in:
Hugo Posnic 2016-12-17 12:21:15 +01:00
parent 39c5fb75de
commit 4142d73556
2 changed files with 14 additions and 14 deletions

View File

@ -192,14 +192,17 @@ class ManjaroHello():
self.set_locale(self.preferences["locale"])
self.save_preferences()
def on_action_btn_clicked(self, btn):
name = btn.get_name()
def on_action_clicked(self, action, _=None):
name = action.get_name()
if name in ("welcome", "readme", "release", "involved"):
self.builder.get_object("stack").set_visible_child(self.builder.get_object(name + "page"))
elif name == "installgui":
subprocess.call(["sudo", "-E", "calamares"])
elif name == "installcli":
subprocess.call(["sudo cli-installer"])
elif name == "autostart":
autostart = True if action.get_active() else False
self.change_autostart(autostart)
elif name == "about":
dialog = self.builder.get_object("aboutdialog")
dialog.set_transient_for(self.window)
@ -209,10 +212,6 @@ class ManjaroHello():
def on_link_clicked(self, link, _=None):
webbrowser.open_new_tab(self.urls[link.get_name()])
def on_autostart_switched(self, switch, _):
autostart = True if switch.get_active() else False
self.change_autostart(autostart)
def on_delete_window(self, *args):
Gtk.main_quit(*args)

View File

@ -171,7 +171,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_action_btn_clicked" swapped="no"/>
<signal name="clicked" handler="on_action_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
@ -185,7 +185,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_action_btn_clicked" swapped="no"/>
<signal name="clicked" handler="on_action_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
@ -213,7 +213,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_action_btn_clicked" swapped="no"/>
<signal name="clicked" handler="on_action_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
@ -400,10 +400,11 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
</child>
<child>
<object class="GtkSwitch" id="autostart">
<property name="name">autostart</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<signal name="notify::active" handler="on_autostart_switched" swapped="no"/>
<signal name="notify::active" handler="on_action_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -431,7 +432,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<property name="name">installgui</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_action_btn_clicked" swapped="no"/>
<signal name="clicked" handler="on_action_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -445,7 +446,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<property name="name">installcli</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_action_btn_clicked" swapped="no"/>
<signal name="clicked" handler="on_action_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -576,7 +577,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<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"/>
<signal name="clicked" handler="on_action_clicked" swapped="no"/>
</object>
</child>
<child>
@ -599,7 +600,7 @@ We, the Manjaro Developers, hope that you will enjoy using Manjaro as much as we
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">iconabout</property>
<signal name="clicked" handler="on_action_btn_clicked" swapped="no"/>
<signal name="clicked" handler="on_action_clicked" swapped="no"/>
</object>
<packing>
<property name="pack_type">end</property>