diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/menus/project.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c index 52a2fbb..7e9fc3f 100644 --- a/src/gui/menus/project.c +++ b/src/gui/menus/project.c @@ -26,6 +26,9 @@ #include <i18n.h> +#include <libgen.h> +#include <malloc.h> +#include <string.h> #include "../editem-int.h" @@ -170,6 +173,7 @@ void update_menu_project_for_project(GtkWidget *widget, GStudyProject *project, static void mcb_project_add_binary_file(GtkMenuItem *menuitem, GMenuBar *bar) { GtkWidget *dialog; /* Boîte à afficher */ + char *dir; /* Répertoire courant */ gchar *filename; /* Nom du fichier à intégrer */ GOpenidaBinary *binary; /* Représentation chargée */ @@ -180,6 +184,14 @@ static void mcb_project_add_binary_file(GtkMenuItem *menuitem, GMenuBar *bar) GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); + if (g_study_project_get_filename(get_current_project()) != NULL) + { + dir = strdup(g_study_project_get_filename(get_current_project())); + dir = dirname(dir); + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), dir); + free(dir); + } + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); |