diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-07-18 10:28:08 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-07-18 10:28:08 (GMT) |
commit | d25dda121501e9cc36b43c15c76d1e00d0173f7d (patch) | |
tree | 067b16b039f2f084e2cbad0120265b131ead0057 /src/gui | |
parent | 3ea00253fa74017ce82bb72d5e11414ab5ee7101 (diff) |
Restored the saving proposal at exit.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/editor.c | 3 | ||||
-rw-r--r-- | src/gui/menus/file.c | 23 | ||||
-rw-r--r-- | src/gui/menus/file.h | 5 | ||||
-rw-r--r-- | src/gui/menus/menubar.c | 2 |
4 files changed, 19 insertions, 14 deletions
diff --git a/src/gui/editor.c b/src/gui/editor.c index 910feb3..fa03e77 100644 --- a/src/gui/editor.c +++ b/src/gui/editor.c @@ -36,6 +36,7 @@ #include "agroup.h" #include "status.h" +#include "menus/file.h" #include "menus/menubar.h" #include "core/core.h" #include "core/panels.h" @@ -441,7 +442,7 @@ static gboolean on_delete_editor(GtkWidget *widget, GdkEvent *event, gpointer da switch (gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_YES: - //mcb_file_save_project_as(NULL, widget); /* FIXME */ + mcb_file_save_project(NULL, NULL); break; case GTK_RESPONSE_NO: diff --git a/src/gui/menus/file.c b/src/gui/menus/file.c index ffe3e9e..41b17e1 100644 --- a/src/gui/menus/file.c +++ b/src/gui/menus/file.c @@ -42,20 +42,17 @@ static void mcb_file_new_project(GtkMenuItem *, gpointer); /* Réagit au menu "Fichier -> Ouvrir un projet". */ static void mcb_file_open_project(GtkMenuItem *, gpointer); -/* Réagit au menu "Fichier -> Enregistrer le projet". */ -static void mcb_file_save_project(GtkMenuItem *, gpointer); - /* Réagit au menu "Fichier -> Enregistrer le projet sous...". */ static void mcb_file_save_project_as(GtkMenuItem *, gpointer); /* Réagit avec le menu "Fichier -> Quitter". */ -static void mcb_file_quit(GtkMenuItem *, GObject *); +static void mcb_file_quit(GtkMenuItem *, gpointer); /****************************************************************************** * * -* Paramètres : ref = espace de référencement global. * +* Paramètres : - * * * * Description : Construit le menu "Fichier". * * * @@ -65,7 +62,7 @@ static void mcb_file_quit(GtkMenuItem *, GObject *); * * ******************************************************************************/ -GtkWidget *build_menu_file(GObject *ref) +GtkWidget *build_menu_file(void) { GtkWidget *result; /* Support à retourner */ GtkWidget *menubar; /* Support pour éléments */ @@ -119,7 +116,7 @@ GtkWidget *build_menu_file(GObject *ref) submenuitem = qck_create_menu_separator(); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); - submenuitem = qck_create_menu_item(NULL, NULL, _("Quit"), G_CALLBACK(mcb_file_quit), ref); + submenuitem = qck_create_menu_item(NULL, NULL, _("Quit"), G_CALLBACK(mcb_file_quit), NULL); add_accelerator_to_widget(submenuitem, "<Ctrl>Q"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); @@ -222,7 +219,7 @@ static void mcb_file_open_project(GtkMenuItem *menuitem, gpointer unused) * * ******************************************************************************/ -static void mcb_file_save_project(GtkMenuItem *menuitem, gpointer unused) +void mcb_file_save_project(GtkMenuItem *menuitem, gpointer unused) { GStudyProject *project; /* Projet courant */ @@ -294,7 +291,7 @@ static void mcb_file_save_project_as(GtkMenuItem *menuitem, gpointer unused) /****************************************************************************** * * * Paramètres : menuitem = élément de menu sélectionné. * -* ref = adresse de l'espace de référencement global. * +* unused = adresse non utilisée ici. * * * * Description : Réagit avec le menu "Fichier -> Quitter". * * * @@ -304,8 +301,12 @@ static void mcb_file_save_project_as(GtkMenuItem *menuitem, gpointer unused) * * ******************************************************************************/ -static void mcb_file_quit(GtkMenuItem *menuitem, GObject *ref) +static void mcb_file_quit(GtkMenuItem *menuitem, gpointer unused) { - gtk_widget_destroy(GTK_WIDGET(ref)); + GtkWindow *editor; /* Fenêtre principale */ + + editor = get_editor_window(); + + gtk_window_close(editor); } diff --git a/src/gui/menus/file.h b/src/gui/menus/file.h index f176c7f..630cec3 100644 --- a/src/gui/menus/file.h +++ b/src/gui/menus/file.h @@ -31,7 +31,10 @@ /* Construit le menu "Fichier". */ -GtkWidget *build_menu_file(GObject *); +GtkWidget *build_menu_file(void); + +/* Réagit au menu "Fichier -> Enregistrer le projet". */ +void mcb_file_save_project(GtkMenuItem *, gpointer); diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c index 2e81619..bc5a045 100644 --- a/src/gui/menus/menubar.c +++ b/src/gui/menus/menubar.c @@ -218,7 +218,7 @@ GEditorItem *g_menu_bar_new(GObject *ref) /* Fichier */ - result->file = build_menu_file(ref); + result->file = build_menu_file(); gtk_container_add(GTK_CONTAINER(item->widget), result->file); /* Edition */ |