[Thunar-dev] code for loading folder contents in same window instead of opening a new one

Benedikt Meurer benny at xfce.org
Tue Jul 29 09:10:30 CEST 2008


anna wrote:
> Hi all,
>  
> I'd like to ask if someone would be kind enough to explain to me how the changing a directory works with respect to the thunar source code (and how I can pass my own directory to that process). 
>  
> Background:
>  
> What I'm trying to pull is a homebrew patch for spring loaded folders (yes I know there has been discussion before, I just wanted to do it to learn something new).
>  
> It's sort of half working - I got it to open a new window when I hover over a folder with the contents of that folder. 
>  
> I modified thunar-standard-view.c, and set a timer in the function thunar_standard_view_get_dest_actions that gets triggered when you hover.
>  
> It then (in a nutshell) runs the following code:
>  
> 		  /* popup a new window */
> 		  application = thunar_application_get ();
> 		  new_window = thunar_application_open_window (application, file, gtk_widget_get_screen (G_OBJECT(window)));
>  
> 		  /* grabs focus for new window, prevents accidental launches*/
> 	          gtk_widget_grab_focus (new_window);
> 		  annawindow = 1;
>  
> This opens up a new window.
>  
> What I really want is to be able to load the contents of the folder that Im hovering over in the SAME window. This way I don't need additional actions to close all the spring loaded windows when the drop is done (unecessarily complicated imo).
>  
> BUT I'm not sure how to do this correctly. I've found several functions in the code that appear to do something similar, and from what I understand opening a folder (say on double click) requires sending a "signal" to change directory... but that kind of goes over my head  Like I said I'm still learning a lot.
>  
> So yeah, if someone would be so kind as to explain the bit about changing the direcotry... I think could take it from there. 

You are probably looking for thunar_window_set_current_directory().

HTH,
Benedikt



More information about the Thunar-dev mailing list