! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Collect gargon model on thread and show spinner while load data
Status:
RESOLVED: WONTFIX
Product:
Xfce4-whiskermenu-plugin
Component:
General

Comments

Description Matias De lellis 2016-10-18 16:31:47 CEST
Created attachment 6874 
Something like that is the proposal ...

Hi,
Love xfce4-whiskermenu-plugin, but is a bit annoying the delay to open the menu while garcon load the menu.

My propoce is collect the menu model on a thread to no freeze the menu.. And While loading show the menu with a spinner indicating process..

I think it is important for user experience.. =)

You can take some ideas here:
https://github.com/xfce-mirror/xfce4-appfinder/blob/master/src/appfinder-model.c

p.s: This is especially slow on older hard disks and on SSDs probably be instantaneous and therefore not notice.. :(
Comment 1 Graeme Gott editbugs 2016-10-18 19:04:26 CEST
I used to do that (with a spinner and everything), but that caused a bunch of issues with the menu completely freezing up at launch and just being a gray rectangle so I had to remove it. Basically--as far as I could figure out--it just isn't safe to add a thread to a panel plugin (unlike a regular application, such as the app finder).

I do not have an SSD and I have a pretty old hard disk. I don't know why everybody assumes developers have fast machines; I certainly don't. It takes the menu a couple of seconds to open the first time I use it each day...
Comment 2 Matias De lellis 2016-10-18 19:34:20 CEST
Hi Graeme,

> I do not have an SSD and I have a pretty old hard disk. I don't know why everybody assumes developers have fast machines; I certainly don't. It takes the menu a couple of seconds to open the first time I use it each day...

Sorry if you feel offended, on the contrary, it is a work experience. We usually work with new machines and then distribute more moderate computers. :S

I work on "Conectar Igualdad" for the Education Ministry of Argentina Republic developing Huayra GNU/Linux..

I try to include Xfce some time ago, but these small details that do not convince to people who then take decisions. :(

> I used to do that (with a spinner and everything), but that caused a bunch of issues with the menu completely freezing up at launch and just being a gray rectangle so I had to remove it. Basically--as far as I could figure out--it just isn't safe to add a thread to a panel plugin (unlike a regular application, such as the app finder).

I understand why you made the decision not to show anything until you have all the data, but in the final experience seems that the menu is freeze.. 

Maybe add the spinner on the same button?.
But perhaps the result is the same as it is a single process and maybe a single line of code is slower stopping the process.

Sorry again,
I hope you reconsider it..

Regards,
Matias.
Comment 3 Graeme Gott editbugs 2016-10-18 20:11:26 CEST
(In reply to Matias De lellis from comment #2)
> > I do not have an SSD and I have a pretty old hard disk. I don't know why everybody assumes developers have fast machines; I certainly don't. It takes the menu a couple of seconds to open the first time I use it each day...
> 
> Sorry if you feel offended, on the contrary, it is a work experience. We
> usually work with new machines and then distribute more moderate computers.
> :S
> 
> I work on "Conectar Igualdad" for the Education Ministry of Argentina
> Republic developing Huayra GNU/Linux..
> 
> I try to include Xfce some time ago, but these small details that do not
> convince to people who then take decisions. :(

Not offended at all, I was just trying to explain that it is slow for me as well.

> > I used to do that (with a spinner and everything), but that caused a bunch of issues with the menu completely freezing up at launch and just being a gray rectangle so I had to remove it. Basically--as far as I could figure out--it just isn't safe to add a thread to a panel plugin (unlike a regular application, such as the app finder).
> 
> I understand why you made the decision not to show anything until you have
> all the data, but in the final experience seems that the menu is freeze.. 
> 
> Maybe add the spinner on the same button?.
> But perhaps the result is the same as it is a single process and maybe a
> single line of code is slower stopping the process.
> 
> Sorry again,
> I hope you reconsider it..

Well, since it is a single process, there is no way to make the spinner move. The garcon function call to load the menu doesn't return until it is loaded, which is where the bulk of the time is spent (it is a single line of code from the perspective of Whisker Menu). It would end up just being a static image of a spinner...

I will look into adding back the threaded loading, but I doubt I will be able to get it working. I didn't rip out the code from before on a whim, after all. ;)
Comment 4 Matias De lellis 2016-10-19 16:46:43 CEST
Hi

> Not offended at all, I was just trying to explain that it is slow for me as well.

Anecdotally, when I start developing Pragha was an old computer and then of buy a newer.. Suddenly I found abusing resources unnecessarily.. Today I think it works adequately.. :)

> I will look into adding back the threaded loading, but I doubt I will be able to get it working. I didn't rip out the code from before on a whim, after all. ;)

You do not need a thread with pooling as implements xfce4-appfinder. With launching just a single thread to perform the initial load is sufficient. Then as the inodes of desktop files are in cache their access to update the menu is much faster.

I'm trying to make a patch, but glibmm not I upgrade to support g_task_new() which simplifies the background task usage.. and I'm not very good with c ++ to write the binding .. :(

Regards,
Comment 5 Graeme Gott editbugs 2016-10-19 19:51:03 CEST
(In reply to Matias De lellis from comment #4)
> You do not need a thread with pooling as implements xfce4-appfinder. With
> launching just a single thread to perform the initial load is sufficient.
> Then as the inodes of desktop files are in cache their access to update the
> menu is much faster.

My thread code was much simpler than the app finder. All I did was put the single function call to garcon_menu_load() in a separate thread, since that is where the bulk of the time is spent. I don't see why using a GTask instead of GThread would make it not lock up, but I will try that.

Garcon already caches the files for future access, so it is only the first time that garcon_menu_load() is called that it is slow.

> I'm trying to make a patch, but glibmm not I upgrade to support g_task_new()
> which simplifies the background task usage.. and I'm not very good with c ++
> to write the binding .. :(

I don't use glibmm, so I'm not sure why you would be looking at that...
Comment 6 Git Bot editbugs 2018-04-15 01:13:25 CEST
Graeme Gott referenced this bugreport in commit 5c285dc7de12df8ae9ea7e13ac3f339952506161

Load applications in a thread. (bug #12903)

https://git.xfce.org/panel-plugins/xfce4-whiskermenu-plugin/commit?id=5c285dc7de12df8ae9ea7e13ac3f339952506161
Comment 7 Matias De lellis 2018-04-15 01:41:53 CEST
Wow..
Thank you so much Graeme. ;)

Bug #12903

Reported by:
Matias De lellis
Reported on: 2016-10-18
Last modified on: 2018-04-15

People

Assignee:
Graeme Gott
CC List:
0 users

Version

Version:
unspecified

Attachments

Something like that is the proposal ... (59.88 KB, image/jpeg)
2016-10-18 16:31 CEST , Matias De lellis
no flags

Additional information