Skip to content

Commit aae720d

Browse files
committed
cs_info: Fix cosmetic issues with system icon
- Support icon names, not just path (native HiDPI/symbolic support) - Call the setting system-icon - Move the icon to the top of the page - Remove redundant page title - Increase spacing
1 parent 6bf29ed commit aae720d

File tree

2 files changed

+19
-27
lines changed

2 files changed

+19
-27
lines changed

data/org.cinnamon.gschema.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,12 +501,11 @@
501501
<summary>If true, Cinnamon will no longer attempt to be the session notification handler.</summary>
502502
</key>
503503

504-
<key type="s" name="system-icon-path">
504+
<key type="s" name="system-icon">
505505
<default>""</default>
506506
<summary>The logo to use in the system info settings</summary>
507507
<description>
508508
An icon name or absolute path to an icon, which will be used for the system icon in the "System Info" settings app.
509-
The default path is the emblem-vendor image stored in /usr/share/icons/vendor.
510509
.
511510
Disabled if no value is set.
512511
</description>

files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,6 @@ def getProcInfos():
9595
return result
9696

9797

98-
def getSystemIcon():
99-
schema = Gio.Settings(schema="org.cinnamon")
100-
101-
iconPath = schema.get_string("system-icon-path")
102-
if iconPath == "": # left empty, so its disabled
103-
return None
104-
105-
return iconPath
106-
107-
10898
def createSystemInfos():
10999
procInfos = getProcInfos()
110100
infos = []
@@ -176,13 +166,27 @@ def on_module_selected(self):
176166
if not self.loaded:
177167
print("Loading Info module")
178168

179-
infos = createSystemInfos()
180-
181169
page = SettingsPage()
182-
page.set_spacing(10)
170+
page.set_spacing(24)
183171
self.sidePage.add_widget(page)
184172

185-
settings = page.add_section(_("System info"))
173+
schema = Gio.Settings(schema="org.cinnamon")
174+
systemIcon = schema.get_string("system-icon")
175+
if systemIcon != "":
176+
try:
177+
if "/" in systemIcon:
178+
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale (systemIconPath, -1, 100, True)
179+
systemIcon = Gtk.Image.new_from_pixbuf(pixbuf)
180+
else:
181+
systemIcon = Gtk.Image.new_from_icon_name(systemIcon, Gtk.IconSize.DIALOG)
182+
systemIcon.set_pixel_size(100)
183+
page.add(systemIcon)
184+
except GLib.GError:
185+
pass
186+
187+
infos = createSystemInfos()
188+
189+
settings = page.add_section()
186190

187191
for (key, value) in infos:
188192
widget = SettingsWidget()
@@ -209,24 +213,13 @@ def on_module_selected(self):
209213
settings.add_row(widget)
210214

211215
if shutil.which("inxi"):
212-
213216
widget = SettingsWidget()
214217

215218
button = Gtk.Button(label=_("Copy to clipboard"))
216219
button.connect("clicked", self.on_copy_clipboard_button_clicked)
217220
widget.pack_start(button, True, True, 0)
218221
settings.add_row(widget)
219222

220-
systemIconPath = getSystemIcon()
221-
if systemIconPath is not None:
222-
try:
223-
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale (systemIconPath, -1, 160, True)
224-
systemIcon = Gtk.Image.new_from_pixbuf(pixbuf)
225-
page.add(systemIcon)
226-
except GLib.GError:
227-
pass
228-
229-
230223
def on_copy_clipboard_button_clicked(self, button):
231224
try:
232225
# taken from https://github.com/linuxmint/xapp/blob/master/scripts/upload-system-info

0 commit comments

Comments
 (0)