Commit 69e424aa authored by Sean Davis's avatar Sean Davis 🕶

Install new icons at each size

parent 73985ec9
Pipeline #627 passed with stage
in 17 seconds
......@@ -1015,7 +1015,7 @@
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="icon_name">catfish</property>
<property name="icon_name">org.xfce.catfish</property>
<property name="type_hint">dialog</property>
<property name="transient_for">Catfish</property>
<signal name="delete-event" handler="on_update_index_dialog_close" swapped="no"/>
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-14 21:03-0500\n"
"POT-Creation-Date: 2020-06-08 20:00-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -60,30 +60,42 @@ def update_config(libdir, values={}):
return oldvalues
def move_icon_file(root, target_data):
"""Move the icon files to their installation prefix."""
old_icon_path = os.path.normpath(
os.path.join(root, target_data, 'share', 'catfish', 'media'))
old_icon_file = os.path.join(old_icon_path, 'catfish.svg')
icon_path = os.path.normpath(
os.path.join(root, target_data, 'share', 'icons', 'hicolor',
'scalable', 'apps'))
icon_file = os.path.join(icon_path, 'catfish.svg')
# Get the real paths.
old_icon_file = os.path.realpath(old_icon_file)
icon_file = os.path.realpath(icon_file)
if not os.path.exists(old_icon_file):
sys.stderr.write("ERROR: Can't find", old_icon_file)
def get_icon_files(root, target_data):
files = []
for extension in ["png", "svg"]:
icon_name = "org.xfce.catfish.%s" % extension
filename = os.path.join(root, icon_name)
if os.path.exists(filename):
files.append(filename)
if len(files) == 0:
sys.stderr.write("ERROR: Can't find icons in %s" % root)
sys.exit(1)
if not os.path.exists(icon_path):
os.makedirs(icon_path)
if old_icon_file != icon_file:
print("Moving icon file: %s -> %s" % (old_icon_file, icon_file))
os.rename(old_icon_file, icon_file)
return files
# Media is now empty
def move_icon_file(root, icon_size, target_data):
"""Move the icon files to their installation prefix."""
old_icon_path = os.path.normpath(
os.path.join(root, target_data, 'share', 'catfish', 'media', icon_size))
for old_icon_file in get_icon_files(old_icon_path, target_data):
icon_name = os.path.basename(old_icon_file)
icon_path = os.path.normpath(
os.path.join(root, target_data, 'share', 'icons',
'hicolor', icon_size, 'apps'))
icon_file = os.path.join(icon_path, icon_name)
# Get the real paths.
old_icon_file = os.path.realpath(old_icon_file)
icon_file = os.path.realpath(icon_file)
if not os.path.exists(icon_path):
os.makedirs(icon_path)
if old_icon_file != icon_file:
print("Moving icon file: %s -> %s" % (old_icon_file, icon_file))
os.rename(old_icon_file, icon_file)
# Media/icon_size is now empty
if len(os.listdir(old_icon_path)) == 0:
print("Removing empty directory: %s" % old_icon_path)
os.rmdir(old_icon_path)
......@@ -91,6 +103,23 @@ def move_icon_file(root, target_data):
return icon_file
def move_icon_files(root, target_data):
"""Move the icon files to their installation prefix."""
files = []
for icon_size in ["16x16", "48x48", "128x128", "scalable"]:
files.append(move_icon_file(root, icon_size, target_data))
media_path = os.path.normpath(
os.path.join(root, target_data, 'share', 'catfish', 'media'))
# Media is now empty
if len(os.listdir(media_path)) == 0:
print("Removing empty directory: %s" % media_path)
os.rmdir(media_path)
return files
def get_desktop_file(root, target_data):
"""Move the desktop file to its installation prefix."""
desktop_path = os.path.realpath(
......@@ -191,7 +220,7 @@ class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
desktop_file = get_desktop_file(self.root, target_data)
print(("Desktop File: %s\n" % desktop_file))
move_icon_file(self.root, target_data)
move_icon_files(self.root, target_data)
update_desktop_file(desktop_file, script_path)
cleanup_metainfo_files(self.root, target_data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment