[PATCH] Middle-mouse-action, open in new or same window

Eivind Tagseth <[email protected]>
Newsgroups gmane.comp.web.galeon.devel
Message-ID <[email protected]>
This has been bugging me for quite a while now and has been brought up
before I think.  As far as I can see, it still haven't been "fixed".

When pressing the middle mouse button in a window, I want the url in
the selection buffer to be opened.  This can be achieved today as well,
through a gconf-setting.  However, it opens in a _new_ window, which I
find really frustrating and unexpected.

The attached patch creates a new gconf-setting that allows you to
control the behaviour when opening a url through pasting the selection in
a window.  I hope it doesn't break anything, it works fine for me.  And
I guess the naming should be improved... 



Eivind
galeon-1.3.3-paste-in-window.patch (text/plain, 2.7 KB)
Index: galeon.schemas.in
===================================================================
RCS file: /cvs/gnome/galeon/galeon.schemas.in,v
retrieving revision 1.137
diff -u -r1.137 galeon.schemas.in
--- galeon.schemas.in	25 Nov 2002 04:56:52 -0000	1.137
+++ galeon.schemas.in	26 Mar 2003 13:43:10 -0000
@@ -1112,6 +1112,20 @@
         </locale>
       </schema>
       <schema>
+        <key>/schemas/apps/galeon/UI/Mouse/selection_received_action</key>
+        <applyto>/apps/galeon/UI/Mouse/selection_received_action</applyto>
+        <owner>galeon</owner>
+        <type>int</type>
+        <default>0</default>
+        <locale name="C">
+        <short>Selection received action</short>
+        <long>What to do when the window receives a selection.  Possible
+        values are 0 (open a new window with the selection in the location 
+        field), 1 (make the selection the location for the current window/tab).
+        </long>
+        </locale>
+      </schema>
+      <schema>
         <key>/schemas/apps/galeon/UI/Mouse/history_popup</key>
         <applyto>/apps/galeon/UI/Mouse/history_popup</applyto>
         <owner>galeon</owner>
Index: src/galeon-window.c
===================================================================
RCS file: /cvs/gnome/galeon/src/galeon-window.c,v
retrieving revision 1.149
diff -u -r1.149 galeon-window.c
--- src/galeon-window.c	20 Mar 2003 01:26:23 -0000	1.149
+++ src/galeon-window.c	26 Mar 2003 13:43:13 -0000
@@ -299,13 +299,21 @@
 				     guint time, GaleonWindow *window)
 {
 	GaleonTab *tab;
+	gint action;
 
 	if (selection_data->length <= 0 || selection_data->data == NULL)
 		return;
 
 	tab = galeon_window_get_active_tab (window);
-	galeon_shell_new_tab (galeon_shell, window, tab,
+
+	action = eel_gconf_get_integer (CONF_SELECTION_RECEIVED_ACTION);
+	
+	if (action == 1) {
+		galeon_window_load_url (window, selection_data->data);
+	} else {
+		galeon_shell_new_tab (galeon_shell, window, tab,
 			      selection_data->data, 0);
+	}
 }
 	
 static void
Index: utils/prefs-strings.h
===================================================================
RCS file: /cvs/gnome/galeon/utils/prefs-strings.h,v
retrieving revision 1.21
diff -u -r1.21 prefs-strings.h
--- utils/prefs-strings.h	6 Nov 2002 21:22:19 -0000	1.21
+++ utils/prefs-strings.h	26 Mar 2003 13:43:14 -0000
@@ -69,6 +69,7 @@
 /* mouse */
 #define CONF_MOUSE_MIDDLE_BUTTON_ACTION "/apps/galeon/UI/Mouse/middle_button_action"
 #define CONF_MOUSE_RIGHT_BUTTON_ACTION "/apps/galeon/UI/Mouse/right_button_action"
+#define CONF_SELECTION_RECEIVED_ACTION "/apps/galeon/UI/Mouse/selection_received_action"
 
 /* System prefs */
 #define CONF_DESKTOP_FTP_HANDLER "/desktop/gnome/url-handlers/ftp/command"
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.