[anjuta: 1/3] 568779 – project wizard should infer project name from base path



commit 5fc99d8c63ec6b73a1126d8d398d614a08f80963
Author: Yuriy Penkin <yuriy penkin gmail com>
Date:   Sun Apr 26 22:57:24 2009 +0200

    568779 â?? project wizard should infer project name from base path
---
 plugins/project-import/project-import-dialog.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/plugins/project-import/project-import-dialog.c b/plugins/project-import/project-import-dialog.c
index ceaa24a..7f61c41 100644
--- a/plugins/project-import/project-import-dialog.c
+++ b/plugins/project-import/project-import-dialog.c
@@ -24,6 +24,7 @@
 
 #include "project-import-dialog.h"
 #include <glib/gi18n.h>
+#include <gio/gio.h>
 
 #define BUILDER_FILE PACKAGE_DATA_DIR"/glade/project-import.glade"
 
@@ -63,6 +64,25 @@ vcs_entry_changed (GtkEditable *editable, gpointer user_data)
 }
 
 static void
+source_dir_changed (GtkFileChooserButton *widget, gpointer user_data)
+{
+	gchar *full_folder_uri, *folder_basename;
+	GFile *dir;
+	ProjectImportDialog *project_import = (ProjectImportDialog *)user_data;
+	ProjectImportDialogPrivate *priv = GET_PRIVATE (project_import);
+
+	full_folder_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (priv->source_dir_button));
+
+	dir = g_file_new_for_path (full_folder_uri);
+	folder_basename = g_file_get_basename(dir);
+	gtk_entry_set_text (priv->name_entry, folder_basename);
+	g_object_unref (dir);
+
+	g_free (full_folder_uri);
+	g_free (folder_basename);
+}
+
+static void
 name_entry_changed (GtkEditable *editable, gpointer user_data)
 {
 	ProjectImportDialog *project_import = (ProjectImportDialog *)user_data;
@@ -258,6 +278,9 @@ project_import_dialog_init (ProjectImportDialog *import_dialog)
 	                  import_dialog);
 	g_signal_connect (priv->vcs_entry, "changed", G_CALLBACK (vcs_entry_changed),
 	                  import_dialog);
+
+	g_signal_connect (priv->source_dir_button, "file-set", G_CALLBACK (source_dir_changed),
+	                  import_dialog);
 	
 	g_signal_connect (priv->folder_radio, "toggled",
 	                  G_CALLBACK (folder_radio_toggled), import_dialog);



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