Skip to content

Commit

Permalink
Made the Turn on button as suggested action
Browse files Browse the repository at this point in the history
  • Loading branch information
muflone committed May 21, 2022
1 parent ff86791 commit d52ed14
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
5 changes: 5 additions & 0 deletions gwakeonlan/ui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ def load_image_file(self, image: Gtk.Image) -> bool:
if icon_path.is_file():
image.set_from_file(str(icon_path))
return icon_path.is_file()

def set_buttons_style_suggested_action(self, buttons: Iterable):
"""Add the suggested-action style to a widget"""
for button in buttons:
button.get_style_context().add_class('suggested-action')
2 changes: 2 additions & 0 deletions gwakeonlan/ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def load_ui(self):
# Set buttons with always show image
for button in (self.ui.button_turnon, ):
button.set_always_show_image(True)
self.set_buttons_style_suggested_action(
buttons=[self.ui.button_turnon])
# Set various properties
self.ui.window.set_title(APP_NAME)
self.ui.window.set_icon_from_file(str(FILE_ICON))
Expand Down
33 changes: 16 additions & 17 deletions ui/main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,6 @@
<accelerator key="question" modifiers="GDK_CONTROL_MASK"/>
</child>
</object>
<object class="GtkActionGroup" id="actions_options">
<property name="accel-group">accelerators</property>
<child>
<object class="GtkAction" id="action_options">
<property name="label" translatable="yes">Open the options menu</property>
<property name="icon-name">open-menu-symbolic</property>
</object>
</child>
<child>
<object class="GtkAction" id="action_options_menu">
<property name="label" translatable="yes">Open the options menu</property>
<signal name="activate" handler="on_action_options_menu_activate" swapped="no"/>
</object>
<accelerator key="F10"/>
</child>
</object>
<object class="GtkActionGroup" id="actions_machines">
<property name="accel-group">accelerators</property>
<child>
Expand Down Expand Up @@ -93,6 +77,22 @@
</object>
</child>
</object>
<object class="GtkActionGroup" id="actions_options">
<property name="accel-group">accelerators</property>
<child>
<object class="GtkAction" id="action_options">
<property name="label" translatable="yes">Open the options menu</property>
<property name="icon-name">open-menu-symbolic</property>
</object>
</child>
<child>
<object class="GtkAction" id="action_options_menu">
<property name="label" translatable="yes">Open the options menu</property>
<signal name="activate" handler="on_action_options_menu_activate" swapped="no"/>
</object>
<accelerator key="F10"/>
</child>
</object>
<object class="GtkActionGroup" id="actions_selection">
<property name="accel-group">accelerators</property>
<child>
Expand Down Expand Up @@ -230,7 +230,6 @@
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
</object>
<packing>
<property name="position">3</property>
Expand Down

0 comments on commit d52ed14

Please sign in to comment.