Applet: Fix handling of symbolic icons
This commit is contained in:
parent
298719a911
commit
01ae4b0f74
@ -421,10 +421,11 @@ class MenuWin(object):
|
|||||||
self.set_applet_icon()
|
self.set_applet_icon()
|
||||||
|
|
||||||
def set_applet_icon(self, saturate=False):
|
def set_applet_icon(self, saturate=False):
|
||||||
if saturate:
|
if not self.symbolic:
|
||||||
self.button_icon.set_from_surface(self.saturated_surface)
|
if saturate:
|
||||||
else:
|
self.button_icon.set_from_surface(self.saturated_surface)
|
||||||
self.button_icon.set_from_surface(self.surface)
|
else:
|
||||||
|
self.button_icon.set_from_surface(self.surface)
|
||||||
|
|
||||||
def createPanelButton(self):
|
def createPanelButton(self):
|
||||||
self.set_applet_icon()
|
self.set_applet_icon()
|
||||||
@ -475,17 +476,24 @@ class MenuWin(object):
|
|||||||
self.settings.reset("applet-icon")
|
self.settings.reset("applet-icon")
|
||||||
applet_icon = self.settings.get_string("applet-icon")
|
applet_icon = self.settings.get_string("applet-icon")
|
||||||
self.scale = self.button_icon.get_scale_factor()
|
self.scale = self.button_icon.get_scale_factor()
|
||||||
|
self.symbolic = False
|
||||||
|
self.pixbuf = None
|
||||||
if "/" in applet_icon:
|
if "/" in applet_icon:
|
||||||
if applet_icon.endswith(".svg"):
|
if applet_icon.endswith(".svg"):
|
||||||
self.pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(applet_icon, -1, 22 * self.scale)
|
self.pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(applet_icon, -1, 22 * self.scale)
|
||||||
else:
|
else:
|
||||||
self.pixbuf = GdkPixbuf.Pixbuf.new_from_file(applet_icon)
|
self.pixbuf = GdkPixbuf.Pixbuf.new_from_file(applet_icon)
|
||||||
else:
|
else:
|
||||||
self.pixbuf = self.icon_theme.load_icon(applet_icon, 22 * self.scale, 0)
|
if applet_icon.endswith("-symbolic"):
|
||||||
self.surface = Gdk.cairo_surface_create_from_pixbuf(self.pixbuf, self.scale)
|
self.button_icon.set_from_icon_name(applet_icon, 22)
|
||||||
self.saturated_pixbuf = self.pixbuf.copy()
|
self.symbolic = True
|
||||||
GdkPixbuf.Pixbuf.saturate_and_pixelate(self.saturated_pixbuf, self.saturated_pixbuf, 1.5, False)
|
else:
|
||||||
self.saturated_surface = Gdk.cairo_surface_create_from_pixbuf(self.saturated_pixbuf, self.scale)
|
self.pixbuf = self.icon_theme.load_icon(applet_icon, 22 * self.scale, 0)
|
||||||
|
if self.pixbuf is not None:
|
||||||
|
self.surface = Gdk.cairo_surface_create_from_pixbuf(self.pixbuf, self.scale)
|
||||||
|
self.saturated_pixbuf = self.pixbuf.copy()
|
||||||
|
GdkPixbuf.Pixbuf.saturate_and_pixelate(self.saturated_pixbuf, self.saturated_pixbuf, 1.5, False)
|
||||||
|
self.saturated_surface = Gdk.cairo_surface_create_from_pixbuf(self.saturated_pixbuf, self.scale)
|
||||||
self.buttonIcon = self.settings.get_string("applet-icon")
|
self.buttonIcon = self.settings.get_string("applet-icon")
|
||||||
self.iconSize = self.settings.get_int("applet-icon-size")
|
self.iconSize = self.settings.get_int("applet-icon-size")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user