Advertisement
Guest User

Gedit File Chooser patch

a guest
Nov 2nd, 2011
990
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.43 KB | None | 0 0
  1. --- gedit-3.2.1.orig/gedit/gedit-commands-file.c
  2. +++ gedit-3.2.1/gedit/gedit-commands-file.c
  3. @@ -36,6 +36,7 @@
  4.  
  5.  #include <string.h> /* For strlen and strcmp */
  6.  
  7. +#include <glib.h>
  8.  #include <glib/gi18n.h>
  9.  #include <gio/gio.h>
  10.  #include <gtk/gtk.h>
  11. @@ -476,7 +477,14 @@ _gedit_cmd_file_open (GtkAction   *actio
  12.  
  13.     if (default_path == NULL)
  14.         default_path = _gedit_window_get_default_location (window);
  15. -
  16. +  
  17. +   /*If default_path is still NULL, we set it to users home directory
  18. +    *to prevent the file chooser from displaying "Recently Used" as default
  19. +    *location
  20. +    */
  21. +   if (default_path == NULL)
  22. +       default_path = g_file_new_for_path (g_get_home_dir());
  23. +      
  24.     if (default_path != NULL)
  25.     {
  26.         gchar *uri;
  27. @@ -897,8 +905,24 @@ file_save_as (GeditTab    *tab,
  28.                                  uri);
  29.  
  30.             g_free (uri);
  31. -           g_object_unref (default_path);
  32.         }
  33. +      
  34. +       /*If default_path is NULL, we set it to users home directory
  35. +       *to prevent the file chooser from displaying "Recently Used" as default
  36. +       *location
  37. +       */
  38. +       if (default_path == NULL)
  39. +       {
  40. +           gchar *uri;
  41. +          
  42. +           default_path = g_file_new_for_path (g_get_home_dir());
  43. +           uri = g_file_get_uri (default_path);
  44. +           gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (save_dialog),
  45. +                                uri);
  46. +                                
  47. +           g_free (uri);
  48. +       }
  49. +       g_object_unref (default_path);
  50.  
  51.         gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (save_dialog),
  52.                            docname);
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement