summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/menus/project.c12
-rw-r--r--src/main.c2
-rw-r--r--src/params.h16
-rw-r--r--src/project.c7
4 files changed, 22 insertions, 15 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));
diff --git a/src/main.c b/src/main.c
index 406f762..f5d1592 100644
--- a/src/main.c
+++ b/src/main.c
@@ -147,7 +147,7 @@ int main(int argc, char **argv)
/* Charge le dernier projet */
- filename = get_string_config_value(config, MPT_RECENT_PROJECT_1);
+ filename = get_string_config_value(config, MPT_LAST_PROJECT);
if (filename == NULL) project = g_study_project_new();
else project = g_study_project_open(filename);
diff --git a/src/params.h b/src/params.h
index 11985b6..49e2fd4 100644
--- a/src/params.h
+++ b/src/params.h
@@ -38,13 +38,7 @@
typedef enum _MainParamType
{
- MPT_RECENT_PROJECT_1, /* Projet récent numéro 1 */
- MPT_RECENT_PROJECT_2, /* Projet récent numéro 2 */
- MPT_RECENT_PROJECT_3, /* Projet récent numéro 3 */
- MPT_RECENT_PROJECT_4, /* Projet récent numéro 4 */
- MPT_RECENT_PROJECT_5, /* Projet récent numéro 5 */
- MPT_RECENT_PROJECT_6, /* Projet récent numéro 6 */
- MPT_RECENT_PROJECT_7, /* Projet récent numéro 7 */
+ MPT_LAST_PROJECT, /* Dernier projet ouvert */
MPT_AUTO_SAVE, /* Sauvegarde automatique ? */
@@ -54,13 +48,7 @@ typedef enum _MainParamType
static config_param main_params[MPT_COUNT] = {
- [MPT_RECENT_PROJECT_1] = { "/OpenIDA/Recents/Project1", CVT_STRING, false, NULL, NULL },
- [MPT_RECENT_PROJECT_2] = { "/OpenIDA/Recents/Project2", CVT_STRING, false, NULL, NULL },
- [MPT_RECENT_PROJECT_3] = { "/OpenIDA/Recents/Project3", CVT_STRING, false, NULL, NULL },
- [MPT_RECENT_PROJECT_4] = { "/OpenIDA/Recents/Project4", CVT_STRING, false, NULL, NULL },
- [MPT_RECENT_PROJECT_5] = { "/OpenIDA/Recents/Project5", CVT_STRING, false, NULL, NULL },
- [MPT_RECENT_PROJECT_6] = { "/OpenIDA/Recents/Project6", CVT_STRING, false, NULL, NULL },
- [MPT_RECENT_PROJECT_7] = { "/OpenIDA/Recents/Project7", CVT_STRING, false, NULL, NULL },
+ [MPT_LAST_PROJECT] = { "/OpenIDA/Editor/LastProject", CVT_STRING, false, NULL, NULL },
[MPT_AUTO_SAVE] = { "/OpenIDA/Project/Autosave", CVT_BOOLEAN, false, true, NULL },
diff --git a/src/project.c b/src/project.c
index 245bac4..9763e2d 100644
--- a/src/project.c
+++ b/src/project.c
@@ -29,6 +29,7 @@
#include <string.h>
+#include "params.h"
#include "common/xml.h"
#include "gtkext/easygtk.h"
#include "gtkext/gtkblockview.h"
@@ -661,6 +662,8 @@ void push_project_into_recent_list(const GStudyProject *project)
if (project->filename == NULL)
return;
+ /* Constitution de la liste des projets récents */
+
manager = get_projects_manager();
qualified = (char *)calloc(strlen("file://") + strlen(project->filename) + 1, sizeof(char));
@@ -678,4 +681,8 @@ void push_project_into_recent_list(const GStudyProject *project)
free(qualified);
+ /* Pour la prochaine ouverture du programme... */
+
+ set_string_config_value(get_main_configuration(), MPT_LAST_PROJECT, project->filename);
+
}