View Single Post
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#381
Originally Posted by iscio View Post
I installed your last release and I observe status-menu.plugins file. I attached to you the original and the file after installation of advanced clock plugin. As you can see your installation delete some parts of my file:

[profilesx-sp-plugin.desktop]
X-Desktop-File=/usr/share/applications/hildon-status-menu/profilesx-sp-plugin.desktop
X-Status-Area-Position=18
X-Status-Menu-Position=20

[wifi-switcher.desktop]
X-Desktop-File=/usr/share/applications/hildon-status-menu/wifi-switcher.desktop
X-Status-Area-Position=18
X-Status-Menu-Position=21

[simple-brightness-applet.desktop]
X-Desktop-File=/usr/share/applications/hildon-status-menu/simple-brightness-applet.desktop
X-Status-Area-Position=18
X-Status-Menu-Position=22

[quick-launch-sb.desktop]
X-Desktop-File=/usr/share/applications/hildon-status-menu/quick-launch-sb.desktop
X-Status-Area-Position=18
X-Status-Menu-Position=23

could you solve this?
Hi, sorry my reply is so late - yesterday when I first saw this, I was first busy and then sleepy, and today I was sleepy from the lack of sleep from yesterday. That said, I slept for like 2 hours earlier today, and I'm back to general awakeness.

I looked at your attached files, and looked at my own, and I think I see what went wrong. Have you, by any chance, installed any other programs that have modified those files? Anything that would install Status Menu applets? Note that the following entry exists already in the original file, in the same spot at which your new file got cut off at (lines 93-98 in both files):

Code:
[advanced-clock-plugin.desktop]
X-Desktop-File=/usr/share/applications/hildon-status-menu/advanced-clock-plugin.desktop
X-Status-Menu-Position=22
X-Status-Area-Permanent-Item=Clock
I think I figured out the problem - the uninstall script and postinstall scripts assume that the Advanced Clock Plugin's entry in that file is the last entry. So it simply cuts everything at that point. When you update, as I understand it, apt-get/dpkg uninstall the current version, and install the new one. Even if this isn't what's done at the package level entirely, it seems to be what is getting done for the above file - this means the uninstall script is run on the existing status-menu.plugins file, where it finds the location of advanced-clock-plugin.desktop, deletes everything from that point. Then the new version being installed/updated re-adds the entry normally - but has no way of knowing there was previous stuff beforehand.

There really needs to be a more standardized way of writing to the status-menu.plugins file.

Wonko, here's my suggestion: Use whatever method you use to seek out the respective lines of code - delete them, but ONLY them - I'm sure there must be some way to delete just from-current-line-to-five-lines-down? Then you can just delete however many lines were initially added. As a safety feature, DO make it actually FIND the right string in the status-menu.plugins file, instead of simply, say, remembering that it was on lines x - y. That way, if people manually modify that file, it's less likely to get further messed up. Yes it might make the uninstall script slightly slower (maybe not noticeably so, or maybe I'm wrong and it'll be the same speed, IDK), but that's easier than people having chunks of Status-Menu plugin configuration deleted. ALSO, to be clear, you don't HAVE to specify entries for some of these things. Meaning, your current Advanced Clock doesn't have a button in the status menu. So you don't have to specify a status menu position - just the special status area clock position. (i.e. Unless you intend on eventually adding a button, this doesn't have to be added: "X-Status-Menu-Position=22")

Actually, things like Flashlight Applet and cpumem applet don't even ADD themselves to the status-menu.plugins file. It's not even necessary normally - IT IS necessary in the case of what you're doing though, because you have to override the stock clock applet (but for the button, if you're okay with it being auto-positioned in alphabetical order with the other 'unassigned' buttons, under all the assigned ones, you still won't need the X-Status-Menu-Position=22 line).

Wouldn't it be relatively easy to clone the Clock and Alarms status menu button? You don't have to replace the entire thing like I suggested earlier, you can just make your clone button display the same info (Day/Night clock icon, which is the only slightly annoying one to clone, because of the custom icons people bring in sometimes, "Clock and Alarms" in primary text, and the date in secondary smaller text), which launches the default clock program, just like the Clock and Alarms status applet does? This lets you go back to the 'safer' install method you tried out, with only marginal extra button coding, and avoids the need of coding your own complete replacement - but makes that an option for when there's either time, or someone like me gets off their *** and figures out how to do it.

If not that option though, we return to the former - just having the uninstall/update script seek for a unique part of the string, like the first two lines:

[advanced-clock-plugin.desktop]
X-Desktop-File=/usr/share/applications/hildon-status-menu/advanced-clock-plugin.desktop

...and then delete those +however-many-other-lines-were-added-by-the-installed-version, instead of everything afterward, would prevent a lot more errors. the only other errors would be if people manually edit that particular part of the file and just add extra lines, or delete one - which, well, you shouldn't do unless you're willing to figure out what went wrong at least partially on your own. Either way, that's a corner case, while having other programs get installed that include extra entries after yours isn't really.

On the other hand, iscio, I think all of your applets should still be showing up correctly, right? I don't think any of that stuff replaces another applet. The only thing you might notice is their position might be different, because they'd get auto-sorted.
 

The Following User Says Thank You to Mentalist Traceur For This Useful Post: