After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 71444 - Better way to close tabs needed
Better way to close tabs needed
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: general
1.9.x
Other Linux
: Normal enhancement
: future
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
: 72170 75029 96537 109777 116829 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-02-14 03:52 UTC by Havoc Pennington
Modified: 2006-01-17 01:19 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
First attempt at Anjuta-like tab close buttons (4.22 KB, patch)
2002-05-24 05:12 UTC, Nate Case
none Details | Review
Revised patch - fix mem leak and code format inconsistencies (4.26 KB, patch)
2002-05-25 09:12 UTC, Nate Case
none Details | Review
Yet another revision -- now with fixed behavior for close buttons in other tabs (like Anjuta) (5.03 KB, patch)
2002-05-26 07:27 UTC, Nate Case
none Details | Review
alternative patch (similar to gedit and epiphany) (4.20 KB, patch)
2003-09-23 18:49 UTC, Paolo Borelli
none Details | Review

Description Havoc Pennington 2002-02-14 03:52:11 UTC
Right now you have to just exit the app inside the terminal. 
I don't like putting the close button on the tab though 
and don't know how to implement the mozilla-style close button on the side. 
Maybe just in the menus?
Comment 1 Havoc Pennington 2002-02-16 23:26:56 UTC
I noticed I have a menu item for it. Still need some other way, but 
probably requires GtkNotebook extensions in GTK 2.2.
Comment 2 Manuel Clos 2002-04-04 21:03:52 UTC
The way Anjuta handles this is pretty nice:

You have the close button in the tab, but you can only close the
current tab, this is, trying to close a tab that is not focused will
only bring that tab to front, then you will be able to close it.
Comment 3 Nate Case 2002-05-22 08:17:33 UTC
Manuel,

That sounds reasonable.  Is this worth implementing, Havoc?  Also,
what did you mean when you said you "didn't know how" to implement the
close-button-on-the-side (Mozilla) style?  I like the Mozilla solution
too, but I do not understand the difficulty in implementation.
Comment 4 Havoc Pennington 2002-05-22 16:51:57 UTC
The Anjuta approach does sound nice.

The issue with the Mozilla approach is that the way GtkNotebook works
makes it tricky to implement.
Comment 5 Nate Case 2002-05-24 05:11:43 UTC
I'm attaching a first attempt at a patch to add close buttons to the
tabs.  Like Anjuta, only the close button on the active tab is functional.

Things to consider if applying:
- Is it desirable to have it also switch to the desired tab if you
click on a desensitized close button (right now it does nothing)?
- This patch assumes you have a close-button.xpm installed in your
pixmaps dir, and doesn't make the necessary changes to the dist files.
Comment 6 Nate Case 2002-05-24 05:12:43 UTC
Created attachment 8701 [details] [review]
First attempt at Anjuta-like tab close buttons
Comment 7 Nate Case 2002-05-24 05:15:05 UTC
s/close-button.xpm/small-close.xpm in previous comment
Comment 8 Manuel Clos 2002-05-24 12:27:44 UTC
Yes, it should move to the tab you click, it will be annoying if not.
Comment 9 Nate Case 2002-05-25 09:12:41 UTC
Created attachment 8719 [details] [review]
Revised patch - fix mem leak and code format inconsistencies
Comment 10 Nate Case 2002-05-25 09:16:27 UTC
I was going to make it switch to the tab when clicking on the disabled
close button, but then encountered a problem.

Desensitized buttons/widgets don't emit signals, so there's no easy
way to tell if it's been clicked on.  Possible workarounds are 1) Not
actually desensitizing the button, but just showing a different image
for the non-active tab's close buttons, 2) Some clever hack utilizing
Gtk/Gdk trickery.

How did Anjuta solve this?  It wasn't clear to me when browsing their
source.  I bet I'm missing something simple.
Comment 11 Manuel Clos 2002-05-25 15:08:34 UTC
Indeed it is very simple, and anjuta is doing what I thinked:

browsing the anjuta code, in text_editor.c in:

GtkWidget* text_editor_tab_widget_new(TextEditor* te)
...
    gtk_box_pack_start(GTK_BOX(box), button15, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(box), close_pixmap, FALSE, FALSE, 0);
...

This is, both a button with the close pixmap and a close pixmap
(sensitive = false) are packed along with the label.

Then in anjuta.c:

void anjuta_set_current_text_editor (TextEditor * te)
....
        if (ote != NULL && ote->buttons.close != NULL) {
   		gtk_widget_hide(ote->buttons.close);
                gtk_widget_show(ote->widgets.close_pixmap);
        }
        app->current_text_editor = te;
        if (te != NULL && te->buttons.close != NULL) {
		gtk_widget_show(te->buttons.close);
                gtk_widget_hide(te->widgets.close_pixmap);
        }
...

Hope you can finish your patch now, as I like the way anjuta tabs work.


Comment 12 Nate Case 2002-05-26 07:27:29 UTC
Created attachment 8730 [details] [review]
Yet another revision -- now with fixed behavior for close buttons in other tabs (like Anjuta)
Comment 13 Nate Case 2002-05-26 07:34:13 UTC
Thanks Manuel, that was a good simple idea and I used it.  I was
actually looking through the Anjuta2 source, so I did not see that.

The last attached patch should be what you want.  I recommend copying
/usr/share/galeon/small-close.xpm to
$PREFIX/share/pixmaps/small-close.xpm if you want to get something
other than the Gtk+ broken image stock icon.
Comment 14 John Fleck 2002-09-19 14:55:42 UTC
*** Bug 75029 has been marked as a duplicate of this bug. ***
Comment 15 Vincent Untz 2002-10-24 20:12:38 UTC
*** Bug 96537 has been marked as a duplicate of this bug. ***
Comment 16 Olav Vitters 2003-07-06 15:13:12 UTC
*** Bug 116829 has been marked as a duplicate of this bug. ***
Comment 17 Manuel Clos 2003-08-02 15:11:19 UTC
adding PATCH keyword since there is no comment about it.
Comment 18 Paolo Borelli 2003-09-23 18:47:29 UTC
I didn't see this bugreport and I made a patch for the same thing...
when I posted it to desktop-devel Havoc asked me to attach it here.

Anyway note that my patch works like gedit and epiphany (all the
buttons are active) so Nate's patch it's probably better... nontheless
maybe there are a couple of bits you may want to integrate from my patch:
- it does not need to install an icon
- factoring the code in a build_tab_label function seems slightly
cleaner than a add_close_button function.


By the way, I'm fine either we choose to make it behave like anjuta
(only the current close button works) or like gedit and epiphany (all
the tabs may be closed), the important thing to me is that all the
apps work in a _consistent_ way.

Maybe this shuld be discussed on the usability list...
Comment 19 Paolo Borelli 2003-09-23 18:49:01 UTC
Created attachment 20218 [details] [review]
alternative patch (similar to gedit and epiphany)
Comment 20 Mariano Suárez-Alvarez 2003-09-23 20:50:02 UTC
I'd prefer to have a right-click menu on tabs. 

Clicking a close-this-tab button should not open a confirmation
dialog, because that'd become annoying very fast, but having any ui
wich does something which is not undoable in such a prominent place
does not sound right to me, even if it only works on the current tab.
Comment 21 Havoc Pennington 2003-09-23 21:41:20 UTC
I do think there's a need for a usability@ discussion on tab close
buttons, then sync these apps up - ideally by adding close buttons to
GtkNotebook natively, even.

I would say the confirm dialog or no should be the same as for window
close buttons. It _is_ a bit lame that you can lose your whole
terminal session without having to confirm, but having to confirm
would clearly be annoying, at the same time. So I kind of feel this is
a problem with no perfect answer.
Comment 22 Erik Pukinskis 2003-09-23 22:21:19 UTC
Whichever behavior is chosen, if hidden tabs can't be closed without
raising them, the close button should be insensitive on those tabs so
the user knows clicking it won't actually close the tab.

It's also worth noting that you can kill ALL of your terminal
sessisons with the WM close button, without confirmation, even if the
terminal window is inactive and obscured by other windows.  So in that
sense, the gedit/epiphany behavior is consistent with Metacity's behavior.
Comment 23 Paolo Borelli 2003-09-23 23:09:33 UTC
My preferred behaviour is like the current one in epiphany and gedit,
where you can close every tab in every moment:
- if tab labels are so small that the close button takes so much room
that you can click it by mistake it is a bug anyway
- novice users don't use tabbed interfaces anyway

The proposed change (making possible to close only the current tab)
would be acceptable, but having a confirmation dialog is a NO NO. You
don't get a confirmation dialog when you close a window.

The only time when you should get a confirmation dialog is when you
are closing a modified document without having saved it (like it
happens in gedit), but this is peculiar of the application, not
something related to the tabbed interface.
Comment 24 Mariano Suárez-Alvarez 2003-09-24 01:34:24 UTC
The problem with the idea of only confirming exit when there is
unsaved work is that does not at all apply to things one does in
shells. No matter how hard we wish, ed(1) is not going to adapt to any
standard mechanism we may come up for apps to notify us of the
savedness of the files they are working on.

Indeed, there is an important difference between gnome-terminal and
gedit/mozilla/epiphany/etc which cannot be forgotten: these *are* the
applications that run in their windows, but gnome-terminal can be
running anything within the reach of a Turing machine in each of its
tabs... It follows that some differences are to be expected.


I really do not like close-me buttons on tabs. I am a tab freak in
Firebird, and I have never needed them; I think, also, that power
users will use keyboard shortcuts, anyways. 

I have a working patch which adds a Close Tab item to the context
menu, which would put closing a tab 2 clicks away (one if we made
right clicks on tabs raise them *and* pop up the context menu) and a
little drag.


Note this is not the only bug about this:

* Bug 87771 is about adding a confirmation dialog to closing windows
with > 1 tabs; it even has a patch which does that. IMHO this is good:
the points raised by Erik above are valid even for `power users.'

* Bug 109777: this requests and posts a patch to add `little X
buttons' to tabs. The patch needs works, though.

* Bug 72170: some more discussion on closing windows/tabs.

I'll mark only the second as a dup, because the other two actually
deal with differents aspects of closing (!)
Comment 25 Mariano Suárez-Alvarez 2003-09-24 01:35:08 UTC
*** Bug 109777 has been marked as a duplicate of this bug. ***
Comment 26 Luis Villa 2004-04-28 04:26:57 UTC
Comment on attachment 8701 [details] [review]
First attempt at Anjuta-like tab close buttons

Obsoleted by other patches.
Comment 27 Thilo 2004-07-23 12:04:18 UTC
I would vote for the gedit/epiphany style. But anyway there should be any
solution , soon. I am missing comfortable tab handling. I also like moving tabs
with clicking and holding left mouse button. I also think right click on a tab
should present some options (close tab,...). Why is this taking so long if there
do exist patches? I think any solution is better than none. it is also possible
to change the solution later...

tia.

Thilo
Comment 28 Guilherme de Siqueira Pastore 2006-01-09 00:00:41 UTC
*** Bug 72170 has been marked as a duplicate of this bug. ***
Comment 29 Guilherme de Siqueira Pastore 2006-01-16 20:01:05 UTC
Fixed in CVS HEAD.