Hi, This is a proposal for this feature implementation.
Because the resolved patch use a new developped function interface in file managment, it needs to be validate by project leader to confirm general software behaviour. This impact three sources files. Regards, Yannick
--- ../../anjuta-1.2.4a-orig/src/file.h 2006-11-12 19:59:28.000000000 +0100 +++ file.h 2006-11-13 14:07:21.000000000 +0100 @@ -34,6 +34,7 @@ void display_new_file(void); +void display_new_file_with_preset(const gchar * filename); //~ void clear_new_file(void); void file_insert_text(gchar *txt, gint offset);
--- ../../anjuta-1.2.4a-orig/src/file.c 2006-11-12 19:59:28.000000000 +0100 +++ file.c 2006-11-13 14:22:57.000000000 +0100 @@ -123,6 +123,44 @@ } } +void +display_new_file_with_preset(const gchar * filename) +{ + guint i; + gchar * cur_ext = NULL; + GtkWidget * entry = NULL; + + display_new_file (); + + entry = glade_xml_get_widget(nfg->xml, NEW_FILE_ENTRY); + g_return_if_fail (entry != NULL); + + gtk_entry_set_text (GTK_ENTRY (entry), filename); + + /* We try to set the appropriate type of file */ + for (i = strlen (filename) - 1; i >= 0 && filename[i] != '.'; i--) + ; + + cur_ext = g_strdup (&filename[i]); + g_message ("cur_ext %s", cur_ext); + + for (i = 0; i < (sizeof(new_file_type) / sizeof(NewfileType)); i++) + { + if (0 == strcmp (cur_ext, new_file_type[i].ext)) + { + GtkWidget * optionmenu; + + optionmenu = glade_xml_get_widget(nfg->xml, + NEW_FILE_TYPE); + gtk_option_menu_set_history ( + GTK_OPTION_MENU (optionmenu), i); + break; + } + } + + g_free (cur_ext); +} + //~ void //~ clear_new_file(void) //~ {
--- ../../anjuta-1.2.4a-orig/src/project_dbase_gui.c 2006-11-12 19:59:28.000000000 +0100 +++ project_dbase_gui.c 2006-11-13 19:32:45.000000000 +0100 @@ -1321,6 +1321,8 @@ ProjectDBase *p = (ProjectDBase *) user_data; list = fileselection_get_filelist(p->fileselection_add_file); + list = g_list_prepend (list, (gpointer) + fileselection_get_filename (p->fileselection_add_file)); node = list; while (node) { @@ -1347,9 +1349,17 @@ gtk_widget_show(label); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); button = gtk_dialog_run (GTK_DIALOG(dialog)); + + if(button == GTK_RESPONSE_YES) + { + display_new_file_with_preset (filename); + } + g_free(mesg); - if(button != GTK_RESPONSE_YES) - continue; + gtk_widget_destroy (dialog); + + node = g_list_next (node); + continue; } else if (!S_ISREG(s.st_mode)) {