? autom4te.cache
? close_tab.patch
? help/C/gnome-terminal-C.omf.out
? help/ro/gnome-terminal-ro.omf.out
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-terminal/ChangeLog,v
retrieving revision 1.328
diff -u -p -r1.328 ChangeLog
--- ChangeLog	22 Sep 2003 23:12:09 -0000	1.328
+++ ChangeLog	23 Sep 2003 17:17:18 -0000
@@ -1,3 +1,8 @@
+2003-09-23 Paolo Borelli <pborelli@katamail.com>
+
+	* src/terminal-window.c (title_changed_callback), (build_tab_label),
+	(terminal_window_add_screen): add a close button to each tab.
+
 2003-09-22 Mariano Suárez-Alvarez <msuarezalvarez@arnet.com.ar>
 
 	* src/.cvsignore: added gnome-terminal.schemas.
Index: src/terminal-window.c
===================================================================
RCS file: /cvs/gnome/gnome-terminal/src/terminal-window.c,v
retrieving revision 1.77
diff -u -p -r1.77 terminal-window.c
--- src/terminal-window.c	16 Jul 2003 01:36:09 -0000	1.77
+++ src/terminal-window.c	23 Sep 2003 17:17:27 -0000
@@ -1183,21 +1183,22 @@ static void
 title_changed_callback (TerminalScreen *screen,
                         TerminalWindow *window)
 {
+  const char *title;
   GtkWidget *label;
   GtkWidget *mi;
-  
+
+  title = terminal_screen_get_title (screen);
+
   if (screen == window->priv->active_term)
-    gtk_window_set_title (GTK_WINDOW (window),
-                          terminal_screen_get_title (screen));
+    gtk_window_set_title (GTK_WINDOW (window), title);
 
   label = screen_get_label (screen);
-  eel_ellipsizing_label_set_text (EEL_ELLIPSIZING_LABEL (label),
-                                  terminal_screen_get_title (screen));
+  eel_ellipsizing_label_set_text (EEL_ELLIPSIZING_LABEL (label), title);
 
   mi = screen_get_menuitem (screen);
   if (mi)
     gtk_label_set_text (GTK_LABEL (gtk_bin_get_child (GTK_BIN (mi))),
-                        terminal_screen_get_title (screen));
+                        title);
 }
 
 static void
@@ -1250,6 +1251,45 @@ selection_changed_callback (TerminalScre
   update_copy_sensitivity (window);
 }
 
+static GtkWidget *
+build_tab_label (TerminalWindow *window,
+                 TerminalScreen *screen)
+{
+  int h, w;
+  const char *title;
+  GtkWidget *hbox;
+  GtkWidget *label;
+  GtkWidget *closebutton;
+  GtkWidget *closeimage;
+
+  gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
+
+  hbox = gtk_hbox_new (FALSE, 0);
+
+  title = terminal_screen_get_title (screen);
+  label = eel_ellipsizing_label_new (title);
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+  gtk_misc_set_padding (GTK_MISC (label), 4, 0);
+
+  closebutton = gtk_button_new ();
+  gtk_button_set_relief (GTK_BUTTON (closebutton), GTK_RELIEF_NONE);
+  closeimage = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
+  gtk_widget_set_size_request (closebutton, w, h);
+  gtk_container_add (GTK_CONTAINER (closebutton), closeimage);
+
+  g_signal_connect (G_OBJECT (closebutton), "clicked",
+                    G_CALLBACK (close_tab_callback), window);
+
+  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (hbox), closebutton, FALSE, FALSE, 0);
+
+  gtk_widget_show_all (hbox);
+
+  screen_set_label (screen, label);
+
+  return hbox;
+}
+
 void
 terminal_window_add_screen (TerminalWindow *window,
                             TerminalScreen *screen)
@@ -1280,13 +1320,11 @@ terminal_window_add_screen (TerminalWind
 
   hbox = gtk_hbox_new (FALSE, 0);
   scrollbar = gtk_vscrollbar_new (NULL);
-  label = eel_ellipsizing_label_new (terminal_screen_get_title (screen));
-  gtk_widget_show (label);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  
+
+  label = build_tab_label (window, screen);  
+
   screen_set_hbox (screen, hbox);
   screen_set_scrollbar (screen, scrollbar);
-  screen_set_label (screen, label);
 
   g_signal_connect (G_OBJECT (screen),
                     "profile_set",
@@ -1327,7 +1365,7 @@ terminal_window_add_screen (TerminalWind
   gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK (window->priv->notebook),
                                       hbox,
                                       TRUE, TRUE, GTK_PACK_START);
-  
+
   /* ZvtTerm is a broken POS and requires this realize to get
    * the size request right.
    */
