! 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 !
Quit confirmation message when multiple tabs are open


Description azzamsa 2019-07-29 01:21:27 CEST
It's very easy to accidentally close Thunar (especially when using it under window manager). Its very frustrating when opening lot of tabs and Thunar closed accidentally.
Comment 1 alexxcons editbugs 2019-07-31 23:22:05 CEST
IMO a quit confirmation is the wrong way to go (would be the first one among all xfce applications)

However I could imagine an option "automatically restore last
Comment 2 alexxcons editbugs 2019-07-31 23:25:47 CEST
> IMO a quit confirmation is the wrong way to go (would be the first one among all xfce applications)

> However I could imagine an option "automatically restore last

Meh, I hate bugzilla. I would like to delete that comment.

Actually I though again about the issue, saw that I was wrong because xfce4-terminal has a quit confirmation if multible tabs are open, and just wanted to edit the bug-title accordingly  :/

So yes, if multiple tabs are open, I think it would be nice to have.

Patches are welcome !
Comment 3 azzamsa 2019-08-06 03:04:31 CEST
> So yes, if multiple tabs are open, I think it would be nice to have.

Yes, I hardly need this feature. I worked with lot of Thunar tabs daily to arrange tons of files manually.  Accidentally closed thunar is nightmare for me.

I know what I need this feature fast, So I look for another way, and luckily I find that i3wm can't prevent app for "accidental closing".

Now my current workaround is to use this in my i3wm config:

bindsym $mod+Shift+Q [con_id="__focused__" instance="^(?!Thunar).*$"] kill
Comment 4 Reuben Green editbugs 2019-08-09 15:47:58 CEST
Created attachment 8857 
Patch to add confirmation when closing multiple tabs

Here is my go at implementing this feature.

This patch adds a signal handler (thunar_window_delete) to catch the "delete" event of the window, which pops up a dialog box to ask for confirmation if there are multiple tabs open.

This feature is on by default, but the user can toggle it on/off via a checkbox on the "Behaviour" tab of the preferences dialog, and the user's preference is stored between sessions in the setting "misc-confirm-close-multiple-tabs".

Criticisms and suggestions for improvement are most welcome!
Comment 5 alexxcons editbugs 2019-08-09 22:38:24 CEST
Nice ! Thanks for the patch!

The feature works fine for me!

Regarding the dialog window: For consistency I would prefer to have the same dialog than for xfce4-terminal. (Or do we have even more multi-tab applications in xfce ?)

I dont think we should have a preferences checkbox for that feature. (Trying not to put too much stuff into the preferences)
(If so, I would add the checkbox to the above heading "tabs instead of new windows" instead of giving it a own heading to safe some space )

If we could re-use the xfce4-terminal dialog "dont ask again" checkbox, imo it would be sufficient to toggle the setting via the xfce4-settings-editor

I know that it would be alot of work to first port the dialog from xfce4-terminal to xfce4ui (and make it re-usable at all) and than use it in thunar .. whats is your impression on that ?

I will as well ask AndreLDM for his opinion on it. (Next week, since probably this weekend he will be busy with releasing xfce4.14)

In every case: Thanks for your contribution, it is very welcome !

A very minor thing: The patch adds some whitespaces
.git/rebase-apply/patch:31: trailing whitespace.  
.git/rebase-apply/patch:106: trailing whitespace.
Comment 6 Reuben Green editbugs 2019-08-10 18:01:59 CEST
Created attachment 8861 
Patch to add confirmation when closing multiple tabs

Thanks for the ideas,  alexxcons!

Here is a prototype patch made by crudely copying over the relevant code from xfce4-terminal and adapting it (and not adding the check box in the preferences dialog like the previous patch), to give
an idea of what this would look like.

So if I understand correctly, you're thinking it would be good if we could add a new function to xfce4ui, say "xfce_dialog_confirm_close_multiple_tabs" (or whatever), and then patch both thunar and xfce4-terminal to use this? I've not used xfce4ui before, but from a quick look at the source, I think this would involve writing an xml description of the dialog which could be used by GtkBuilder. If so, I would be happy to give it a go.
Comment 7 alexxcons editbugs 2019-08-13 22:24:29 CEST
Thanks alot, looks very nice and works well !

I did not contribute to xfce4ui myself so far, so I am as well on "trial and error" here. (One reason why I hope AndreLDM will have a look at this bug)
From looking into the xfce4ui, it seems to be possible, but not mandatory to provide a xml description and use the GtkBuilder.

If I get it correctly, you could add the current code to "xfce_dialog_confirm_close_multiple_tabs" in "libxfce4ui/xfce-dialogs.h/.c" and add the method to "libxfce4ui.symbols" to get the symbol exported .. that should do it.

I guess you as well could add a new "libxfce4ui-dialog-confirm-close-multiple-tabs-ui.ui" if you would like to use the builder instead of using the exiting code.

I am not sure if one way should be preferered .. or if just both are fine. I'll ask in IRC later on !
Comment 8 Reuben Green editbugs 2019-08-18 12:29:07 CEST
So following helpful input from alexxcons and some other devs, I have tried a few experiments and come up with some ideas. See my following comments for pictures (apologies for multiple comments, bugzilla does not seem to support multiple pictures in one comments).

So just to recap, we want this dialog to contain three buttons (cancel, close tab, close window) and a checkbox where the user can opt not to see the dialog again. We would also like this dialog to be somewhat reusable between xfce applications, so it would be good to either use an existing libxfce4ui dialog (perhaps with some small modifications) or extend libxfce4ui, by adding a function "xfce_dialog_confirm_close_multiple_tabs" (or whatever).

One potential model for this dialog is the corresponding dialog in xfce4-terminal, show in the image C-from-xfce4-terminal.png below (and it would be good if eventually xfce4-teminal and thunar were to have the same dialog for consistency). Note that the xfce4-terminal dialog does not use libxfce4ui - it is created using the gtkdialog interface directly.

The simplest option would be to use xfce_message_dialog_new from libxfce4ui to make a dialog with all the buttons and then add a checkbox to this. This results in the dialog shown in the image A-with-libxfce4ui.png below. Note how the icon for the dialog is below the text here, not to the left as in the xfce4-terminal dialog.

To me the dialog in A-with-libxfce4ui.png looks OK, but I think the xfce4-terminal dialog looks better with the icon to the left of the text (of course if other people think A-with-libxfce4ui.png looks good then I'm happy to go with this option). If we wanted to have it look like the xfce4-terminal dialog, we would either need to not use libxfce4ui or else implement a new function in libxfceui as mentioned above with this icon positioning. However, implementing a new libxfce4ui function with this icon placement would be inconsistent with the icon placement used by xfce_message_dialog_new, and consistency is good in libraries.

If we were to just implement this dialog using gtkdialog directly, we could make it look however we liked, for example like the dialog in the image B-no-libxfce4ui.png below, which I've made to look like other common thunar dialog boxes, and also like the dialog box from xfce4-notifyd shown in the image D-from-notifyd.png, which was mentioned by another dev as a possible point of comparison (like xfce4-terminal, the xfce4-notify dialog uses the gtkdialog interface directly rather than libxfce4ui).

So what do we think?
Comment 9 Reuben Green editbugs 2019-08-18 12:29:49 CEST
Created attachment 8903 
example image
Comment 10 Reuben Green editbugs 2019-08-18 12:34:17 CEST
Created attachment 8904 

(ignore previous image, I forgot to add the filename so I am reposting)
Comment 11 Reuben Green editbugs 2019-08-18 12:36:19 CEST
Created attachment 8905 
Comment 12 Reuben Green editbugs 2019-08-18 12:38:23 CEST
Created attachment 8906 
Comment 13 Reuben Green editbugs 2019-08-18 12:40:43 CEST
Created attachment 8907 
Comment 14 alexxcons editbugs 2019-08-18 22:35:58 CEST
Nice collection, and thanks for the summery !

I agree with you, I as well like B and C the most.  Sadly A is a bit huge with the centered icon. I bet the terminal maintainer would refuse to replace his nice dialog with our unlovely libxfce4ui version :P

Since our options regarding libxfce4ui are not that nice, maybe we should split the whole "project" into steps ( Sorry I was the one asking to have the dialog in libxfce4ui directly .. looks like I was to hasty with this request )

Possibly we could do it like that:
1) For the first keep it simple, and just use B to resample the xfce4terminal dialog in thunar (We could take the patch you provided, think it just needs some cosmetics: use scpaces instead of tabs )
2) After that, we could open a new bug for libxfce4ui, e.g. "Unification of close multi tab dialog", where we can discuss further proceedings. 
(E.g. we could discuss additional parameters for xfce_message_dialog_new to get the possibility to add icon horizontally )

I think it would be nice to already have 1) in place before opening 2) .. so we directly have something to point at.
Since for 2) some more people will need to agree on, it probably will take long to get it done.

If you like, I could open 2) after we pushed the dialog to thunar, and invite the relevant people to take a look at it.
If you already have a patch for xfce4ui (A), it would be great if you could upload it there, when it is open.

You think such a proceeding would make sense ?
Comment 15 Reuben Green editbugs 2019-08-19 15:51:52 CEST
Created attachment 8924 
Patch to add confirmation when closing multiple tabs

That sounds like a good plan, alexxcons!

Here is the patch to add a simple dialog to do this (like my previous patch but with newbie errors removed!).

If you're happy to open the bug for stage 2, then go ahead. I will put together a demonstrator patch.
Comment 16 Git Bot editbugs 2019-08-21 00:04:41 CEST
Reuben Green referenced this bugreport in commit 33f6570e3c828f5867244bed3a3f6d9403feaa9d

Add a confirmation dialog when closing a window with multiple open tabs.

Comment 17 alexxcons editbugs 2019-08-21 00:06:11 CEST
Pushed, thanks alot !

I'll open the new bug (stage 2) tomorrow .. already got a bit late today.
Comment 18 alexxcons editbugs 2019-08-22 23:33:51 CEST
Opened new bug for stage 2: Bug #15873

Bug #15758

Reported by:
Reported on: 2019-07-29
Last modified on: 2019-08-22


Xfce Bug Triage
CC List:
2 users



Patch to add confirmation when closing multiple tabs (6.98 KB, patch)
2019-08-09 15:47 CEST , Reuben Green
no flags
Patch to add confirmation when closing multiple tabs (6.99 KB, patch)
2019-08-10 18:01 CEST , Reuben Green
no flags
example image (31.33 KB, image/png)
2019-08-18 12:29 CEST , Reuben Green
no flags
A-with-libxfce4ui.png (31.33 KB, image/png)
2019-08-18 12:34 CEST , Reuben Green
no flags
B-no-libxfce4ui.png (23.23 KB, image/png)
2019-08-18 12:36 CEST , Reuben Green
no flags
C-from-xfce4-terminal.png (27.31 KB, image/png)
2019-08-18 12:38 CEST , Reuben Green
no flags
D-from-notifyd.png (17.65 KB, image/png)
2019-08-18 12:40 CEST , Reuben Green
no flags
Patch to add confirmation when closing multiple tabs (6.54 KB, patch)
2019-08-19 15:51 CEST , Reuben Green
no flags

Additional information