SF.net SVN: geany:[3636] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Mar 19 17:50:23 UTC 2009


Revision: 3636
          http://geany.svn.sourceforge.net/geany/?rev=3636&view=rev
Author:   eht16
Date:     2009-03-19 17:50:23 +0000 (Thu, 19 Mar 2009)

Log Message:
-----------
Set the initial directory for the Save As dialog only once on initialisation.
Add a shortcut of the project's base directory to the File Open/Save As dialogs when a project is open for faster access.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/dialogs.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-03-19 17:50:08 UTC (rev 3635)
+++ trunk/ChangeLog	2009-03-19 17:50:23 UTC (rev 3636)
@@ -7,6 +7,11 @@
    set but empty.
  * src/notebook.c:
    Fix wrong display of the filename in the tab bar menu for new files.
+ * src/dialog.c:
+   Set the initial directory for the Save As dialog only once on
+   initialisation.
+   Add a shortcut of the project's base directory to the
+   File Open/Save As dialogs when a project is open for faster access.
 
 
 2009-03-16  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2009-03-19 17:50:08 UTC (rev 3635)
+++ trunk/src/dialogs.c	2009-03-19 17:50:23 UTC (rev 3636)
@@ -56,6 +56,7 @@
 #include "encodings.h"
 #include "build.h"
 #include "main.h"
+#include "project.h"
 
 
 enum
@@ -102,6 +103,9 @@
 		}
 		g_slist_free(filelist);
 	}
+	if (app->project && NZV(app->project->base_path))
+		gtk_file_chooser_remove_shortcut_folder(GTK_FILE_CHOOSER(ui_widgets.open_filesel),
+			app->project->base_path, NULL);
 }
 #endif
 
@@ -273,6 +277,10 @@
 				GTK_FILE_CHOOSER(ui_widgets.open_filesel), initdir);
 	}
 
+	if (app->project && NZV(app->project->base_path))
+		gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(ui_widgets.open_filesel),
+			app->project->base_path, NULL);
+
 	gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(ui_widgets.open_filesel));
 	gtk_window_present(GTK_WINDOW(ui_widgets.open_filesel));
 #endif
@@ -550,12 +558,21 @@
 		g_free(fname);
 	}
 
+	if (app->project && NZV(app->project->base_path))
+		gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(ui_widgets.save_filesel),
+			app->project->base_path, NULL);
+
 	/* if the folder wasn't set so far, we set it to the given directory */
 	if (! folder_set && initdir != NULL && g_path_is_absolute(initdir))
 		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(ui_widgets.save_filesel), initdir);
 
 	/* Run the dialog synchronously, pausing this function call */
 	resp = gtk_dialog_run(GTK_DIALOG(ui_widgets.save_filesel));
+
+	if (app->project && NZV(app->project->base_path))
+		gtk_file_chooser_remove_shortcut_folder(GTK_FILE_CHOOSER(ui_widgets.save_filesel),
+			app->project->base_path, NULL);
+
 	return (resp == GTK_RESPONSE_ACCEPT);
 }
 #endif
@@ -570,13 +587,16 @@
 {
 	gboolean result;
 	gchar *initdir = NULL;
+	static gboolean initial = TRUE;
 
 	initdir = utils_get_current_file_dir_utf8();
 
 	/* use project or default startup directory (if set) if no files are open */
-	/** TODO should it only be used when initally open the dialog and not on every show? */
-	if (! initdir)
+	if (initdir == NULL && initial)
+	{
 		initdir = g_strdup(utils_get_default_dir_utf8());
+		initial = FALSE;
+	}
 
 	setptr(initdir, utils_get_locale_from_utf8(initdir));
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list