[anjuta] project-wizard: Use currently defined directory in directory browse dialog



commit d303c8b0b8b1edb48b3a8d09f0fb9396cec094e0
Author: Mathieu Dupuy <deronnax gmail com>
Date:   Sat Mar 5 16:15:11 2011 +0100

    project-wizard: Use currently defined directory in directory browse dialog

 plugins/project-wizard/property.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/plugins/project-wizard/property.c b/plugins/project-wizard/property.c
index 5cd2685..3be5e8e 100644
--- a/plugins/project-wizard/property.c
+++ b/plugins/project-wizard/property.c
@@ -333,6 +333,7 @@ static void
 cb_browse_button_clicked (GtkButton *button, NPWProperty* prop)
 {
 	GtkWidget *dialog;
+	gchar *path;
 	
 	switch (prop->type)
 	{
@@ -343,6 +344,15 @@ cb_browse_button_clicked (GtkButton *button, NPWProperty* prop)
 												 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 				      							 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
 				      							 NULL);
+		path = g_strdup(gtk_entry_get_text(GTK_ENTRY(prop->widget)));
+		while (g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) == FALSE)
+		{
+			char* tmp = g_path_get_dirname(path);
+			g_free(path);
+			path = tmp;
+		}
+		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path);
+		g_free(path);
 		break;
 	case NPW_FILE_PROPERTY:
 		dialog = gtk_file_chooser_dialog_new (_("Select file"),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]