Re: Patch: Don't close last tab

"Erwin Mascher [Gentics Net.Solutions]" <[email protected]>
Newsgroups gmane.comp.web.galeon.devel
Message-ID <[email protected]>
fixed compile problems with gcc 2.96

erwin
galeon_blank_last_tab.1.3.3.patch (text/plain, 5.5 KB)
diff -Naurbw galeon-1.3.3/galeon.schemas.in galeon-1.3.3-patched/galeon.schemas.in
--- galeon-1.3.3/galeon.schemas.in	2003-03-08 18:59:00.000000000 +0100
+++ galeon-1.3.3-patched/galeon.schemas.in	2003-03-10 00:18:54.000000000 +0100
@@ -436,6 +436,17 @@
         </locale>
       </schema>
       <schema>
+        <key>/schemas/apps/galeon/UI/Tabs/tabbed_blank_last</key>
+        <applyto>/apps/galeon/UI/Tabs/tabbed_blank_last</applyto>
+        <owner>galeon</owner>
+        <type>bool</type>
+        <default>false</default>
+        <locale name="C">
+        <short>Don't close last Tab</short>
+        <long>Instead of closing the last Tab, go to about:blank.</long>
+        </locale>
+      </schema>
+      <schema>
         <key>/schemas/apps/galeon/UI/Tabs/tabbed_always_show</key>
         <applyto>/apps/galeon/UI/Tabs/tabbed_always_show</applyto>
         <owner>galeon</owner>
diff -Naurbw galeon-1.3.3/src/galeon-window.c galeon-1.3.3-patched/src/galeon-window.c
--- galeon-1.3.3/src/galeon-window.c	2003-02-26 01:21:57.000000000 +0100
+++ galeon-1.3.3-patched/src/galeon-window.c	2003-03-10 00:19:48.000000000 +0100
@@ -1289,15 +1289,43 @@
 	return get_tab_from_page_num (window->priv->notebook, page_num);
 }
 
+gboolean
+galeon_window_is_last_tab( GaleonWindow *window )
+{
+        return gul_notebook_is_last_tab( GUL_NOTEBOOK (window->priv->notebook) );
+}
+
 void 
 galeon_window_remove_tab (GaleonWindow *window, 
 		          GaleonTab *tab)
 {
 	GtkWidget *embed;
+	gboolean blank_last_tab;
+	gboolean last_tab;
+	gboolean toolbar_visible;
+	Toolbar *toolbar;
 	
 	g_return_if_fail (IS_GALEON_WINDOW (window));
 	g_return_if_fail (IS_GALEON_TAB (tab));
 
+	blank_last_tab = eel_gconf_get_boolean (CONF_TABS_TABBED_BLANK_LAST);
+
+        last_tab = galeon_window_is_last_tab( window );
+
+	//check if toolbar is visible
+	toolbar = galeon_window_get_toolbar( window );
+	toolbar_visible = toolbar_get_visibility( toolbar );
+
+
+        if ( last_tab && blank_last_tab && toolbar_visible )
+        {
+                embed = galeon_window_get_active_embed (window);
+                g_return_if_fail (embed != NULL);
+
+                galeon_embed_load_url (embed, "about:blank");
+        }
+	else
+	{
 	window->priv->active_tab = NULL;
 	
 	embed  = GTK_WIDGET (galeon_tab_get_embed (tab));
@@ -1305,6 +1333,7 @@
 	gul_notebook_remove_page (GUL_NOTEBOOK (window->priv->notebook), 
 				  embed);
 }
+}
 
 void 
 galeon_window_move_tab (GaleonWindow *window, 
diff -Naurbw galeon-1.3.3/src/galeon-window.h galeon-1.3.3-patched/src/galeon-window.h
--- galeon-1.3.3/src/galeon-window.h	2003-02-06 13:47:03.000000000 +0100
+++ galeon-1.3.3-patched/src/galeon-window.h	2003-03-10 00:18:54.000000000 +0100
@@ -95,6 +95,7 @@
 EmbedChromeMask  galeon_window_get_chrome	  (GaleonWindow *window);
 
 /* Tabs */
+gboolean	galeon_window_is_last_tab	(GaleonWindow *window);
 
 void          	 galeon_window_add_tab      	  (GaleonWindow *window, 
 					     	   GaleonTab *tab,
diff -Naurbw galeon-1.3.3/src/toolbar.c galeon-1.3.3-patched/src/toolbar.c
--- galeon-1.3.3/src/toolbar.c	2003-03-02 20:32:14.000000000 +0100
+++ galeon-1.3.3-patched/src/toolbar.c	2003-03-10 00:18:54.000000000 +0100
@@ -774,6 +774,12 @@
 	return t;
 }
 
+gboolean toolbar_get_visibility( Toolbar *t )
+{
+	g_return_val_if_fail( t != NULL, FALSE );
+	return t->priv->visibility;
+}
+
 void
 toolbar_set_visibility (Toolbar *t, gboolean visibility)
 {
diff -Naurbw galeon-1.3.3/src/toolbar.h galeon-1.3.3-patched/src/toolbar.h
--- galeon-1.3.3/src/toolbar.h	2002-09-02 16:31:53.000000000 +0200
+++ galeon-1.3.3-patched/src/toolbar.h	2003-03-10 00:18:54.000000000 +0100
@@ -61,6 +61,8 @@
 
 void          toolbar_set_visibility  		(Toolbar *t, 
 				       		 gboolean visibility);
+gboolean	 toolbar_get_visibility		( Toolbar *t );
+
 
 void	      toolbar_button_set_sensitive	(Toolbar *t,
 						 ToolbarButtonID id,
diff -Naurbw galeon-1.3.3/utils/gul-notebook.c galeon-1.3.3-patched/utils/gul-notebook.c
--- galeon-1.3.3/utils/gul-notebook.c	2003-02-17 15:07:27.000000000 +0100
+++ galeon-1.3.3-patched/utils/gul-notebook.c	2003-03-10 00:18:54.000000000 +0100
@@ -318,6 +318,16 @@
 	tab_label_set_size (window, hbox);
 }
 
+gboolean
+gul_notebook_is_last_tab( GulNotebook *nb )
+{
+        gboolean last_tab;
+
+        last_tab = gtk_notebook_get_nth_page (GTK_NOTEBOOK (nb), 1) == NULL;
+        return last_tab;
+}
+
+
 
 void
 gul_notebook_move_page (GulNotebook *src, GulNotebook *dest, 
diff -Naurbw galeon-1.3.3/utils/gul-notebook.h galeon-1.3.3-patched/utils/gul-notebook.h
--- galeon-1.3.3/utils/gul-notebook.h	2003-02-06 17:24:38.000000000 +0100
+++ galeon-1.3.3-patched/utils/gul-notebook.h	2003-03-10 00:18:54.000000000 +0100
@@ -66,6 +66,7 @@
 
 GtkWidget      *gul_notebook_new 		(void);
 
+gboolean	gul_notebook_is_last_tab	(GulNotebook *nb);
 void		gul_notebook_insert_page	(GulNotebook *nb,
 						 GtkWidget *child,
 						 int position,
diff -Naurbw galeon-1.3.3/utils/prefs-strings.h galeon-1.3.3-patched/utils/prefs-strings.h
--- galeon-1.3.3/utils/prefs-strings.h	2003-02-20 15:42:48.000000000 +0100
+++ galeon-1.3.3-patched/utils/prefs-strings.h	2003-03-10 00:18:54.000000000 +0100
@@ -32,6 +32,7 @@
 #define CONF_TABS_TABBED_LOADING_COLOR "/apps/galeon/UI/Tabs/tabbed_loading_color"
 #define CONF_TABS_TABBED_NEW_COLOR "/apps/galeon/UI/Tabs/tabbed_new_color"
 #define CONF_TABS_TABBED_ALWAYS_SHOW "/apps/galeon/UI/Tabs/tabbed_always_show"
+#define CONF_TABS_TABBED_BLANK_LAST "/apps/galeon/UI/Tabs/tabbed_blank_last"
 
 /* Window appeareance */
 #define CONF_WINDOWS_SIDEBAR_PAGE "/apps/galeon/UI/Windows/sidebar_page"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.