Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Talk about code development, features, specific bugzilla bugs, enhancements, patches, and other highly technical things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific referenced Bugzilla bugs, mercurial, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Most "bug reports" do not belong in this board and should initially be posted in Community Support or other relevant support boards.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
Post Reply
User avatar
moonbat
Moon Magic practitioner
Moon Magic practitioner
Posts: 2174
Joined: 2015-12-09, 15:45

Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Post by moonbat » 2020-06-25, 10:42

For both my extensions, Pure URL and PMPlayer - the icon for the tools menu entry and the context menu (for PMPlayer) work fine on my barebones development profile, but not in my regular daily profile. I've seen this with Basilisk and Borealis as well. Even if I switch to the default theme it persists, and I don't see this problem with other extensions whose menu icons display fine. I'm using CSS to set the icon, and it works fine in a fresh/empty profile. The active attribute is set at startup.

Overlay code -

Code: Select all

	<menupopup id="menu_ToolsPopup">
		<menuitem id="menu-pureurl4pm-options" class="menu-iconic"
			label="&pureurl_toolsmenu_caption;" accesskey="&pureurl_accelerator;"
			insertafter="appmenu_addons" command="CmdPureURL4PMOptions" />
	</menupopup>
CSS entry for menu -

Code: Select all

#menu-pureurl4pm-options[active="false"] {
		list-style-image:url('chrome://pureurl4pm/skin/icon-red.png');
}
#menu-pureurl4pm-options[active="true"] {
		list-style-image:url('chrome://pureurl4pm/skin/icon-green.png');
}
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Linux Mint 20 Xfce x64 on HP i5 laptop with 12 GB RAM, always latest versions of PM & Basilisk unless specified.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 27871
Joined: 2011-08-28, 17:27
Location: Tranås, SE
Contact:

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Post by Moonchild » 2020-06-25, 10:47

In your definition you neither set the active attribute to false nor true so it will be undefined and not hit either css rule to display the icon.
Menus are cached (for obvious reasons) in GUI rendering. If something else causes the menu to be altered before your extension init sets it, it'll be cached in its initial state (in your case undefined, meaning without an icon).
"There will be times when the position you advocate, no matter how well framed and supported, will not be accepted by the public simply because you are who you are." -- Merrill Rose
Image

User avatar
moonbat
Moon Magic practitioner
Moon Magic practitioner
Posts: 2174
Joined: 2015-12-09, 15:45

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Post by moonbat » 2020-06-25, 11:06

Moonchild wrote:
2020-06-25, 10:47
Menus are cached (for obvious reasons) in GUI rendering. If something else causes the menu to be altered before your extension init sets it, it'll be cached in its initial state (in your case undefined, meaning without an icon).
But the menu loads and shows the icon fine on a fresh profile, just not on my everyday profile. I do the menu init at the very end of my extension init.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Linux Mint 20 Xfce x64 on HP i5 laptop with 12 GB RAM, always latest versions of PM & Basilisk unless specified.

User avatar
moonbat
Moon Magic practitioner
Moon Magic practitioner
Posts: 2174
Joined: 2015-12-09, 15:45

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Post by moonbat » 2020-06-26, 06:41

Turns out my icons don't play well with themes. If I revert to the default theme as I have on my development profile, then they show up. Other extension icons continue to work. What am I doing wrong?
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Linux Mint 20 Xfce x64 on HP i5 laptop with 12 GB RAM, always latest versions of PM & Basilisk unless specified.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 27871
Joined: 2011-08-28, 17:27
Location: Tranås, SE
Contact:

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Post by Moonchild » 2020-06-26, 08:58

Well, maybe I was wrong then -- unfortunately I'm not the theming guru here so I'll hand this one over to Lootyhoof to answer. ;)
"There will be times when the position you advocate, no matter how well framed and supported, will not be accepted by the public simply because you are who you are." -- Merrill Rose
Image

User avatar
opus_27
Moongazer
Moongazer
Posts: 7
Joined: 2020-06-16, 13:29

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Post by opus_27 » 2020-06-26, 12:10

I'd suggest you try removing [active="false"] from the first CSS rule, leaving the second as is:

#menu-pureurl4pm-options {
list-style-image:url('chrome://pureurl4pm/skin/icon-red.png');
}
#menu-pureurl4pm-options[active="true"] {
list-style-image:url('chrome://pureurl4pm/skin/icon-green.png');
}

User avatar
Lootyhoof
Themeist
Themeist
Posts: 1454
Joined: 2012-02-09, 23:35
Location: United Kingdom

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Post by Lootyhoof » 2020-06-26, 13:16

I'd agree with @opus_27. By default show the red inactive icon, and if it does become active at any point change to the active icon.

User avatar
moonbat
Moon Magic practitioner
Moon Magic practitioner
Posts: 2174
Joined: 2015-12-09, 15:45

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Post by moonbat » 2020-06-26, 13:30

Ok but why does it only not work when I change the theme from the default? If I don't use any themes then the icons display correctly.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Linux Mint 20 Xfce x64 on HP i5 laptop with 12 GB RAM, always latest versions of PM & Basilisk unless specified.

User avatar
Lootyhoof
Themeist
Themeist
Posts: 1454
Joined: 2012-02-09, 23:35
Location: United Kingdom

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Post by Lootyhoof » 2020-06-26, 13:33

Does it happen with any theme, or only specific ones?

User avatar
moonbat
Moon Magic practitioner
Moon Magic practitioner
Posts: 2174
Joined: 2015-12-09, 15:45

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Post by moonbat » 2020-06-26, 13:35

I guess it isn't theme specific. Tested with Moonscape, Australium and XMoon.
I use Moonscape on my usual profile, and just now added Australium to my development profile which doesn't have any extensions to test - and the icons have disappeared after a restart.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Linux Mint 20 Xfce x64 on HP i5 laptop with 12 GB RAM, always latest versions of PM & Basilisk unless specified.

Post Reply