Patch to make confirm-close window optional

Paul Dwerryhouse <[email protected]> Sat, 8 Mar 2008 16:11:11 +1100
Newsgroups gmane.comp.web.galeon.devel
Message-ID <[email protected]>
--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


Hi all,

One thing I find rather annoying about Galeon is when closing a tab or a
window with a modified form in it, it pops up a dialog asking me whether or
not I really want to close it.

I would prefer that it didn't do this, and I am confident that it is
no-one's fault but my own if I accidentally close a window where I have
half filled-out a form.

To this end, I have attached a patch that allows the user to switch off
this dialog box. The patch uses a new GConf value of
/apps/galeon/Browsing/General/confirm_close. The default value - true - 
leaves the application behaving as it always has, popping up the dialog.
When changed to false, the dialog never appears.

I haven't created any special Galeon UI for this option, because I don't
believe that it is a feature that people will want to change regularly.
Being users of Galeon, I'm sure we're all advanced enough to know how to 
launch gconf-editor to change it, if we want to.

I'd appreciate it if the developers could add this to the Galeon source,
because I'd rather not have to patch it into every future release
manually ;)

The diff is against Galeon 2.0.4 source, as found in the current Debian
sid package.

Cheers,

Paul.

-- 
Paul Dwerryhouse				| PGP Key ID: 0x6B91B584
http://weblog.leapster.org/

--EVF5PPMfhYS0aIcm
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="galeon-2.0.4-confirm-close.diff"

diff -urN galeon-2.0.4.old/galeon.schemas.in galeon-2.0.4/galeon.schemas.in
--- galeon-2.0.4.old/galeon.schemas.in	2007-12-15 17:10:38.000000000 +1100
+++ galeon-2.0.4/galeon.schemas.in	2008-03-08 15:10:59.000000000 +1100
@@ -39,6 +39,18 @@
         </locale>
       </schema>
       <schema>
+        <key>/schemas/apps/galeon/Browsing/General/confirm_close</key>
+        <applyto>/apps/galeon/Browsing/General/confirm_close</applyto>
+        <owner>galeon</owner>
+        <type>bool</type>
+        <default>true</default>
+        <locale name="C">
+        <short>Confirm close</short>
+	<long>If true, Galeon will always ask for confirmation, when you 
+	try to close a window with modified forms.</long>
+        </locale>
+      </schema>
+      <schema>
         <key>/schemas/apps/galeon/Browsing/General/offline</key>
         <applyto>/apps/galeon/Browsing/General/offline</applyto>
         <owner>galeon</owner>
diff -urN galeon-2.0.4.old/src/galeon-window.c galeon-2.0.4/src/galeon-window.c
--- galeon-2.0.4.old/src/galeon-window.c	2007-12-15 17:10:21.000000000 +1100
+++ galeon-2.0.4/src/galeon-window.c	2008-03-08 15:15:41.000000000 +1100
@@ -915,7 +915,8 @@
 		embed = galeon_tab_get_embed (tab);
 		g_return_val_if_fail (GALEON_IS_EMBED (embed), FALSE);
 
-		if (galeon_embed_has_modified_forms (embed) && 
+		if (eel_gconf_get_boolean(CONF_GENERAL_CONFIRM_CLOSE) && 
+		    galeon_embed_has_modified_forms (embed) && 
 		    confirm_close_with_modified_forms (window, tab) == FALSE)
 		{
 			allow_close = FALSE;
@@ -2420,7 +2421,8 @@
 
 	embed = galeon_tab_get_embed (tab);
 	
-	if (galeon_embed_has_modified_forms (GALEON_EMBED (embed)) &&
+	if (eel_gconf_get_boolean(CONF_GENERAL_CONFIRM_CLOSE) && 
+	    galeon_embed_has_modified_forms (GALEON_EMBED (embed)) &&
 	    confirm_close_with_modified_forms (window, tab) == FALSE)
 	{
 		return FALSE;
@@ -3799,7 +3801,8 @@
 	g_return_val_if_fail (GALEON_IS_TAB (child), FALSE);
 	embed = galeon_tab_get_embed (GALEON_TAB (child));
 
-	if (galeon_embed_has_modified_forms (GALEON_EMBED (embed)))
+	if (eel_gconf_get_boolean(CONF_GENERAL_CONFIRM_CLOSE) && 
+	    galeon_embed_has_modified_forms (GALEON_EMBED (embed)))
 	{
 		return !confirm_close_with_modified_forms (window, GALEON_TAB (child));
 	}
diff -urN galeon-2.0.4.old/utils/prefs-strings.h galeon-2.0.4/utils/prefs-strings.h
--- galeon-2.0.4.old/utils/prefs-strings.h	2007-12-15 17:10:36.000000000 +1100
+++ galeon-2.0.4/utils/prefs-strings.h	2008-03-08 15:12:45.000000000 +1100
@@ -2,6 +2,7 @@
 #define CONF_GENERAL_HOMEPAGE "/apps/galeon/Browsing/General/startpage"
 #define CONF_GENERAL_ALWAYS_SAVE_SESSION "/apps/galeon/Browsing/General/always_save_session"
 #define CONF_GENERAL_NEWPAGE_TYPE "/apps/galeon/Browsing/General/newpage_type"
+#define CONF_GENERAL_CONFIRM_CLOSE "/apps/galeon/Browsing/General/confirm_close"
 #define CONF_GENERAL_OFFLINE "/apps/galeon/Browsing/General/offline"
 
 /* Bookmarks */

--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Galeon-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/galeon-devel

--EVF5PPMfhYS0aIcm--