gnome-terminal 上面有个红红的 叉叉,就是关闭按钮了。因为开 tab 多的时候会不小心按到,所以就想把他干掉。可惜 gnome 没提供去掉的选项,google 了下,发现不少人烦这个,可是 gnome 不理会这些声音,2007 年有人写了个补丁,可惜没转正。我琢磨琢磨改巴改巴把他弄到自己能用了。原来那个补丁还添加了 gconf 的配置项,我没那需求,就去掉了。这个是对 gentoo 里面的 gnome-terminal-2.24.2 打的补丁,别的版本没准还得改改。
diff -ur gnome-terminal-2.24.2.org/src/terminal-window.c gnome-terminal-2.24.2/src/terminal-window.c
--- gnome-terminal-2.24.2.org/src/terminal-window.c	2009-02-06 17:51:54.277755771 +0800
+++ gnome-terminal-2.24.2/src/terminal-window.c	2009-02-06 18:04:34.601756240 +0800
@@ -1929,7 +1929,7 @@
 
   gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
 
-  close_button = gtk_button_new ();
+/*  close_button = gtk_button_new ();
   gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
   gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE);
   gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
@@ -1939,17 +1939,17 @@
   image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
   gtk_container_add (GTK_CONTAINER (close_button), image);
   gtk_box_pack_end (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
-
+*/
   sync_tab_label (screen, NULL, label);
   g_signal_connect (screen, "notify::title",
                     G_CALLBACK (sync_tab_label), label);
 
-  g_signal_connect (close_button, "clicked",
+/*  g_signal_connect (close_button, "clicked",
 		    G_CALLBACK (close_button_clicked_cb), screen_container);
 
   g_signal_connect (hbox, "style-set",
                     G_CALLBACK (tab_label_style_set_cb), close_button);
-
+*/
   gtk_widget_show_all (hbox);
 
   return hbox;