[haiku-3rdparty-dev] Re: Adding a (persistant) Replicant to the Deskbar

  • From: Brian Hill <brianh@xxxxxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Fri, 17 Mar 2017 07:04:31 -0400


On Mar 17, 2017, at 4:38 AM, Humdinger (Redacted sender "humdingerb" for 
DMARC) <dmarc-noreply@xxxxxxxxxxxxx> wrote:

Hello there,

I have a problem getting a replicant added to the Deskbar, that stays there 
after a reboot.
The replicant is super simple, no functionality but launching the app itself. 
I get my inspirations from "desklink" and PowerStatus, NetworkStatus etc.
This is the code (hope the formatting sticks):

The output I get is:
info_name: 
/HiQ-Data/projects/humdinger_projects/quicklaunch/objects.x86-cc2-debug/QuickLaunch,
 ref_name: QuickLaunch, id: 0
err: -2147483641

So, the get_ref_for_path seems to be right, the ref_name, too. But the 
returned id is 0.
deskbar.AddItem(&ref, &id) fails apparently, the error returned is "Name not 
found".

Do you have older QuickLaunch binaries hanging around?  Perhaps deskbar is 
finding one of those and then can’t generate a replicant?  I had the same 
trouble when I was working on a new notification center desk bar replicant and 
had previous notification server binaries that were trying to be used.


After that failure, the deskbar.AddItem(new DeskButton...) - which I 
appropriated from "desklink" - does actually work. The icon is added and 
starts QuickLaunch on a click. But the replicant is never added to 
/boot/home/config/settings/deskbar/replicants and doesn't survive a reboot.
So looks like the replicant view is archiving and instantiating correctly, 
which is good!  For Einsteinium I created a boot launch script which adds the 
replicant (if that option is set to true in the settings file).  I never 
figured out how to get the desk bar replicant to automatically reinstantiate 
after reboot, so I would like to know too!


So... why does the deskbar.AddItem(&ref, &id) fail? And how is a replicant 
added to the Deskbar that will survive reboots?
NetworkStatus appears to do the same AddItem(&ref) as my code (I tried 
without the id,too), but succeeds:
http://xref.plausible.coop/source/xref/haiku/src/apps/networkstatus/NetworkStatus.cpp#189
 
<http://xref.plausible.coop/source/xref/haiku/src/apps/networkstatus/NetworkStatus.cpp#189>

Here is what I did for Notification server:
https://github.com/Perelandra0x309/haiku/blob/n_center/src/servers/notification/DeskbarShelfView.cpp

I have to go to work but if I had time I would look at the Network preflet code 
and see what it does when you toggle the “Show network status in Deskbar” 
checkbox.

-Brian

Other related posts: