Re: [patch] fix cancel dialog on exit
Dodji Seketeli <[email protected]> Tue, 10 Feb 2004 00:26:04 +0100
| Newsgroups | gmane.editors.mlview.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Sebastien, The patch looks good to me. I've just made some smallish modifications such as: * in mlview_editor_close_all_xml_document(): + update the comment of the function + return TRUE when the list of opened editing views contained in the editor is NULL + insert spaces between identifiers/words and parenthesis (e.g function_call () and not function_call() ;) That's all. Thank you very much for you time and efforts ! Regards, Dodji. Le lun 09/02/2004 à 22:36, Sebastien Bacher a écrit : > Hi, > > This patch should fix the bug 130184. > It adds the name of the document to save in the dialog. A question is > asked for each document that need to be saved, and mlview is closed only > if all the documents open are saved (if you cancel one of the choice the > tab stays open and mlview is not closed). > > > Cheers, > > Sebastien Bacher > > > ______________________________________________________________________ > Index: ChangeLog > =================================================================== > RCS file: /cvs/gnome/mlview/ChangeLog,v > retrieving revision 1.223 > diff -u -r1.223 ChangeLog > --- ChangeLog 9 Feb 2004 21:03:06 -0000 1.223 > +++ ChangeLog 9 Feb 2004 21:31:04 -0000 > @@ -1,3 +1,12 @@ > +2004-02-09 Sebastien Bacher <[email protected]> > + > + * src/mlview-app.c: (close_application), (delete_event_cb): > + * src/mlview-editor.[ch]: > + (mlview_editor_close_all_xml_documents_interactive), > + (mlview_editor_confirm_close): > + Fixed bug with cancel on the exit dialog (Closes: #130184). > + Added name, of the document to save, to the dialog. > + > 2004-02-09 Dodji Seketeli <[email protected]> > > * src/mlview-editor.c: > Index: src/mlview-app.c > =================================================================== > RCS file: /cvs/gnome/mlview/src/mlview-app.c,v > retrieving revision 1.61 > diff -u -r1.61 mlview-app.c > --- src/mlview-app.c 11 Jan 2004 01:12:06 -0000 1.61 > +++ src/mlview-app.c 9 Feb 2004 21:32:03 -0000 > @@ -347,6 +347,7 @@ > { > GnomeApp *app = NULL; > MlViewEditor *editor = NULL; > + gboolean is_ok = FALSE; > > g_return_if_fail (a_widget > && GTK_IS_WIDGET (a_widget) > @@ -357,8 +358,12 @@ > "MlViewEditor"); > > if (editor) > - mlview_editor_close_all_xml_documents_interactive > + is_ok = mlview_editor_close_all_xml_documents_interactive > (editor); > + > + if(is_ok == FALSE) > + return; > + > app = mlview_app_context_get_element (a_context, > "GnomeApp"); > g_object_unref (G_OBJECT (a_context)); > @@ -375,7 +380,7 @@ > FALSE) ; > > close_application (a_widget, a_context) ; > - return FALSE ; > + return TRUE ; > } > > static gint > Index: src/mlview-editor.c > =================================================================== > RCS file: /cvs/gnome/mlview/src/mlview-editor.c,v > retrieving revision 1.74 > diff -u -r1.74 mlview-editor.c > --- src/mlview-editor.c 9 Feb 2004 21:02:16 -0000 1.74 > +++ src/mlview-editor.c 9 Feb 2004 21:32:08 -0000 > @@ -2148,23 +2148,23 @@ > * > *@param a_this the current mlview editor. > */ > -void > +gboolean > mlview_editor_close_all_xml_documents_interactive (MlViewEditor *a_this) > { > GList *views = NULL, > *mobile_view_ptr = NULL; > > - g_return_if_fail (a_this != NULL); > - g_return_if_fail (MLVIEW_EDITOR (a_this)); > - g_return_if_fail (PRIVATE (a_this) != NULL); > - g_return_if_fail (PRIVATE (a_this)-> > - mlview_xml_doc_views != NULL); > + g_return_val_if_fail (a_this != NULL, FALSE); > + g_return_val_if_fail (MLVIEW_EDITOR (a_this), FALSE); > + g_return_val_if_fail (PRIVATE (a_this) != NULL, FALSE); > + g_return_val_if_fail (PRIVATE (a_this)-> > + mlview_xml_doc_views != NULL, FALSE); > > views = build_view_list_from_hashtable > (PRIVATE (a_this)->mlview_xml_doc_views); > > if (views == NULL) > - return; > + return FALSE; > > for (mobile_view_ptr = views; > mobile_view_ptr; > @@ -2173,6 +2173,11 @@ > (MlViewIView *) mobile_view_ptr->data; > mlview_editor_close_xml_document_interactive (a_this); > } > + > + if(g_list_length(mlview_editor_get_list_open_doc(a_this)) == 0) > + return TRUE; > + else > + return FALSE; > } > > > @@ -2186,17 +2191,21 @@ > { > GtkWidget *dialog; > gint ret; > + guchar *a_name = NULL; > > g_return_if_fail (a_this != NULL); > g_return_if_fail (MLVIEW_IS_EDITOR (a_this)); > g_return_if_fail (PRIVATE (a_this)); > > + mlview_iview_get_name(PRIVATE (a_this)->cur_view, &a_name); > + > dialog = gtk_message_dialog_new (NULL, > GTK_DIALOG_MODAL, > GTK_MESSAGE_QUESTION, > GTK_BUTTONS_NONE, > - _("The document has been modifed.\n" > - "Should I save it before closing it?")); > + _("The document \"%s\" has been modifed.\n" > + "Should I save it before closing it?"), > + a_name); > > gtk_dialog_add_buttons (GTK_DIALOG (dialog), > _("_Close without Saving"), GTK_RESPONSE_NO, > Index: src/mlview-editor.h > =================================================================== > RCS file: /cvs/gnome/mlview/src/mlview-editor.h,v > retrieving revision 1.33 > diff -u -r1.33 mlview-editor.h > --- src/mlview-editor.h 1 Feb 2004 01:28:20 -0000 1.33 > +++ src/mlview-editor.h 9 Feb 2004 21:32:08 -0000 > @@ -167,7 +167,7 @@ > > void mlview_editor_close_xml_document_interactive (MlViewEditor * a_editor); > > -void mlview_editor_close_all_xml_documents_interactive (MlViewEditor * a_editor); > +gboolean mlview_editor_close_all_xml_documents_interactive (MlViewEditor * a_editor); > > void mlview_editor_paste_node_as_prev_sibling (MlViewEditor * a_editor); >