Skip to content

Commit

Permalink
icon rework
Browse files Browse the repository at this point in the history
* normal icon names
* icon size enums
* update icon from icon theme

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
  • Loading branch information
stephanlachnit committed Jan 14, 2021
1 parent 6edf378 commit 69f1210
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
Binary file removed data/images/update_available.png
Binary file not shown.
2 changes: 1 addition & 1 deletion data/ui/gametile.ui
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
<object class="GtkImage" id="cancel_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-cancel</property>
<property name="icon-name">process-stop</property>
</object>
</child>
</object>
Expand Down
4 changes: 0 additions & 4 deletions minigalaxy/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
if not os.path.exists(ICON_WINE_PATH):
ICON_WINE_PATH = os.path.abspath(os.path.join(LAUNCH_DIR, "../share/minigalaxy/images/winehq_logo_glass.png"))

ICON_UPDATE_PATH = os.path.abspath(os.path.join(LAUNCH_DIR, "../data/images/update_available.png"))
if not os.path.exists(ICON_UPDATE_PATH):
ICON_UPDATE_PATH = os.path.abspath(os.path.join(LAUNCH_DIR, "../share/minigalaxy/images/update_available.png"))

LOCALE_DIR = os.path.abspath(os.path.join(LAUNCH_DIR, "../data/mo"))
if not os.path.exists(LOCALE_DIR):
LOCALE_DIR = os.path.abspath(os.path.join(LAUNCH_DIR, "../share/minigalaxy/translations"))
16 changes: 6 additions & 10 deletions minigalaxy/ui/gametile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from minigalaxy.installer import uninstall_game, install_game
from minigalaxy.css import CSS_PROVIDER
from minigalaxy.paths import ICON_WINE_PATH
from minigalaxy.paths import ICON_UPDATE_PATH
from minigalaxy.api import NoDownloadLinkFound


Expand Down Expand Up @@ -377,7 +376,7 @@ def update_gtk_box_for_dlc(self, icon, title, installer):
dlc_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
dlc_box.set_spacing(8)
image = Gtk.Image()
image.set_from_icon_name("media-optical-symbolic.symbolic", 1)
image.set_from_icon_name("media-optical", Gtk.IconSize.BUTTON)
dlc_box.pack_start(image, False, True, 0)
label = Gtk.Label(label=title, xalign=0)
dlc_box.pack_start(label, True, True, 0)
Expand All @@ -390,19 +389,16 @@ def update_gtk_box_for_dlc(self, icon, title, installer):
self.get_async_image_dlc_icon(icon, title)
download_info = self.api.get_download_info(self.game, dlc_installers=installer)
if self.game.is_update_available(version_from_api=download_info["version"], dlc_title=title):
icon_name = ICON_UPDATE_PATH
icon_name = "emblem-synchronizing"
self.dlc_dict[title][0].set_sensitive(True)
elif self.game.is_installed(dlc_title=title):
icon_name = "emblem-default-symbolic.symbolic"
icon_name = "object-select"
self.dlc_dict[title][0].set_sensitive(False)
else:
icon_name = "go-bottom-symbolic.symbolic"
icon_name = "document-save"
self.dlc_dict[title][0].set_sensitive(True)
install_button_image = Gtk.Image()
if icon_name in [ICON_UPDATE_PATH]:
install_button_image.set_from_file(ICON_UPDATE_PATH)
else:
install_button_image.set_from_icon_name(icon_name, 1)
install_button_image.set_from_icon_name(icon_name, Gtk.IconSize.BUTTON)
self.dlc_dict[title][0].set_image(install_button_image)

def get_async_image_dlc_icon(self, icon, title):
Expand Down Expand Up @@ -552,7 +548,7 @@ def update_to_state(self, state):

elif state == self.state.UPDATABLE:
self.update_icon.show()
self.update_icon.set_from_file(ICON_UPDATE_PATH)
self.update_icon.set_from_icon_name("emblem-synchronizing", Gtk.IconSize.LARGE_TOOLBAR)
self.button.set_label(_("play"))
self.menu_button.show()
tooltip_text = "{} (update{})".format(self.game.name, ", Wine" if self.game.platform == "windows" else "")
Expand Down

0 comments on commit 69f1210

Please sign in to comment.