You are not logged in.

#1 2011-12-14 05:54:00

freud_zoid
Member
Registered: 2011-08-12
Posts: 33

[Solved] Removing "Recently Used" and "Search" Entries from Open/Save

Each time I save or open a document, the dialog box defaults to "Recently Used". What I'm wanting to find out is how to get rid of the entry from the "Places" bar altogether. I understand that the entry was put there with good intentions, but it seems to always amount to an extra step. The best example is when I use "Save As". I will type the name of the file and since the dialog has automatically put me under "Recently Used", I have to then navigate to where I want to save or the "Please select a folder below" error will appear. Had the dialog defaulted to the home folder, this stumbling block could be eliminated.

I realize there is probably some fundamental knowledge I'm not aware of and don't know exactly what to search for. I'm using Openbox and have the core XFCE applications installed, but I don't know if this is a GTK issue, xdg, or what. All of my searches point to getting rid of ~/.local/share/recently-used.xbel, but I'm not concerned with that and already have a transparent panel launcher that handles it.

I have found a post in this forum that addresses the same issue, but it has gone unresolved also:

https://bbs.archlinux.org/viewtopic.php?id=129555

This user mentions a directory hack that is resolving the issue for now, barring any other solution, I'd like to know exactly what that is, as I can't seem to find the answer to that either.

Thanks in advance for any help.

Last edited by freud_zoid (2011-12-14 19:33:07)

Offline

#2 2011-12-14 10:13:09

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [Solved] Removing "Recently Used" and "Search" Entries from Open/Save

It seems your google-fu is much weaker than mine smile. When I first noticed this behavior some time back, and it was totally driving me nuts, I quite quickly found the cause of it, the commit that did it, and some discussions justifying the change. It's a deliberate change in GTK. And like I said, it was driving me nuts too. So I came up with this:

diff -Nur gtk/gtkfilechooserdefault.c.orig gtk/gtkfilechooserdefault.c
--- gtk/gtkfilechooserdefault.c.orig	2011-10-01 17:29:06.000000000 +0200
+++ gtk/gtkfilechooserdefault.c	2011-10-28 23:53:19.849781029 +0200
@@ -5972,7 +5972,7 @@
       switch (impl->reload_state)
         {
         case RELOAD_EMPTY:
-	  recent_shortcut_handler (impl);
+	  home_folder_handler (impl);
           break;
         
         case RELOAD_HAS_FOLDER:

It makes the file chooser default to the home dir instead of recently used. You'll have to recompile GTK with this patch applied.

Offline

#3 2011-12-14 19:31:17

freud_zoid
Member
Registered: 2011-08-12
Posts: 33

Re: [Solved] Removing "Recently Used" and "Search" Entries from Open/Save

Thank you immensely!

I've only been using Arch (and Linux in general) for a few months and this was the single issue I couldn't get resolved. What you've done for me today has not only fixed my problem, but helped me learn a couple other things besides...they say Arch is good for that. smile This exercise alone was worth it just to get acquainted with ABS.

On the other hand, I am a bit ashamed of my yellow belt in Google-Fu.

Last edited by freud_zoid (2011-12-14 19:34:04)

Offline

#4 2011-12-15 17:20:36

fabertawe
Member
From: Lloegr
Registered: 2009-11-24
Posts: 279

Re: [Solved] Removing "Recently Used" and "Search" Entries from Open/Save

I would like to patch this too (i've never patched anything before btw) but the ABS source here doesn't have 'gtk/gtkfilechooserdefault.c'. The nearest match is 'gtk/gtkfilesel.c'. This is from 'gtk+-1.2.10.tar.gz'.

And presumably I'd need this line in the PKGBUILD?

patch -Np0 -i "${srcdir}/patchname"

Any pointers greatly appreciated, thanks.


Ryzen 9 5950X, X570S Aorus Pro AX, RX 6600, Arch x86_64

Offline

#5 2011-12-15 19:15:45

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [Solved] Removing "Recently Used" and "Search" Entries from Open/Save

What you want is gtk2, not gtk smile

Offline

#6 2011-12-16 16:36:52

fabertawe
Member
From: Lloegr
Registered: 2009-11-24
Posts: 279

Re: [Solved] Removing "Recently Used" and "Search" Entries from Open/Save

Many thanks Gusar smile Patched, built and installed.


Ryzen 9 5950X, X570S Aorus Pro AX, RX 6600, Arch x86_64

Offline

#7 2012-12-08 16:51:51

perseus
Member
Registered: 2007-01-28
Posts: 162

Re: [Solved] Removing "Recently Used" and "Search" Entries from Open/Save

In the recent update to gtk2-2.24.14-1 the code in gtkfilechooserdefault.c has changed and the patch no longer works. Gusar, is it possible to provide a new patch please? I absolutely hate the default behaviour.

Offline

#8 2012-12-08 16:55:57

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,202

Re: [Solved] Removing "Recently Used" and "Search" Entries from Open/Save

There had been a report for necrobumping.  This is a bit old, but it seems like it is still relevant.  I am leaving this alone.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#9 2012-12-08 17:01:54

freud_zoid
Member
Registered: 2011-08-12
Posts: 33

Re: [Solved] Removing "Recently Used" and "Search" Entries from Open/Save

perseus wrote:

In the recent update to gtk2-2.24.14-1 the code in gtkfilechooserdefault.c has changed and the patch no longer works. Gusar, is it possible to provide a new patch please? I absolutely hate the default behaviour.

I haven't made many patches for things and you'll need to type in the file name when you apply it, but this will work for the current gtk2 package:

--- gtkfilechooserdefault.c.orig	2012-12-06 20:24:05.758831989 -0500
+++ gtkfilechooserdefault.c	2012-12-06 20:28:07.352183658 -0500
@@ -6061,7 +6061,7 @@
   switch (impl->startup_mode)
     {
     case STARTUP_MODE_RECENT:
-      recent_shortcut_handler (impl);
+      home_folder_handler (impl);
       break;
 
     case STARTUP_MODE_CWD:

Or if you'd rather, you can just edit gtkfilechooserdefault.c directly and replace 'recent_shortcut_handler' on line 6064 with 'home_folder_handler' and rebuild.

The patch above probably reveals my lack of expertise, but thanks goes again to Gusar for showing the way.

Offline

#10 2012-12-08 17:29:55

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [Solved] Removing "Recently Used" and "Search" Entries from Open/Save

@freud_zoid: Patches are usually made from the top-level source dir (so they apply with -p0), or a level above that (in which case they apply with -p1). But your version can still be applied cleanly, just tell patch which directory the file is in with -d:

patch -Np0 -d gtk -i "${srcdir}/patchname"

Offline

#11 2012-12-08 19:43:49

perseus
Member
Registered: 2007-01-28
Posts: 162

Re: [Solved] Removing "Recently Used" and "Search" Entries from Open/Save

Many thanks freud_zoid for the patch, and to Gusar for the original and teaching me something about patch just now.  Patched and working smile

Offline

Board footer

Powered by FluxBB