summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-08-06 19:57:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-08-06 19:57:49 (GMT)
commitfacec716100f598a8694889274a4589c75c14722 (patch)
tree7f9d68ec673b8a11c700f4784cc8e65d127a4382
parent9be2705b3214cc7bd6daaf7b498a4df155f2dc46 (diff)
Improved projects managment.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@257 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
-rw-r--r--ChangeLog8
-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
5 files changed, 30 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a6896f..d9bdf8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
12-08-06 Cyrille Bagard <nocbos@gmail.com>
+ * src/gui/menus/project.c:
+ * src/main.c:
+ * src/params.h:
+ * src/project.c:
+ Improve projects managment.
+
+12-08-06 Cyrille Bagard <nocbos@gmail.com>
+
* configure.ac:
* src/dialogs/export.c:
Fix the compilation on Ubuntu Lucid.
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);
+
}