Skip to content

Commit

Permalink
Use filled and unfilled star icons for favorites.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwebster committed Dec 5, 2023
1 parent 33fdcf2 commit 0e87b67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions usr/lib/hypnotix/hypnotix.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def __init__(self, application):
"layout_properties_box",
"layout_properties_label",
"favorite_button",
"favorite_button_image",
"new_channel_button",
"new_name_entry",
"new_url_entry",
Expand Down Expand Up @@ -878,6 +879,7 @@ def on_favorite_button_toggled(self, widget):
elif widget.get_active() == False and data in self.favorite_data:
print (f"Removing {name} from favorites")
self.favorite_data.remove(data)
self.favorite_button_image.set_from_icon_name("starred-symbolic" if widget.get_active() else "non-starred-symbolic", Gtk.IconSize.BUTTON)
self.manager.save_favorites(self.favorite_data)

def on_channel_activated(self, box, widget):
Expand Down Expand Up @@ -930,9 +932,11 @@ def before_play(self, channel):
data = f"{channel.info}:::{channel.url}"
if data in self.favorite_data:
self.favorite_button.set_active(True)
self.favorite_button_image.set_from_icon_name("starred-symbolic", Gtk.IconSize.BUTTON)
self.favorite_button.set_tooltip_text(_("Remove from favorites"))
else:
self.favorite_button.set_active(False)
self.favorite_button_image.set_from_icon_name("non-starred-symbolic", Gtk.IconSize.BUTTON)
self.favorite_button.set_tooltip_text(_("Add to favorites"))
self.page_is_loading = False

Expand Down
6 changes: 3 additions & 3 deletions usr/share/hypnotix/hypnotix.ui
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">xapp-favorites-app-symbolic</property>
<property name="icon-name">starred-symbolic</property>
<property name="icon_size">3</property>
</object>
</child>
Expand Down Expand Up @@ -517,10 +517,10 @@
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<child>
<object class="GtkImage">
<object class="GtkImage" id="favorite_button_image">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">xapp-favorites-app-symbolic</property>
<property name="icon-name">starred-symbolic</property>
</object>
</child>
</object>
Expand Down

0 comments on commit 0e87b67

Please sign in to comment.