Branch: refs/heads/master Author: Matthew Brush matt@geany.org Committer: Thomas Martitz kugel@rockbox.org Date: Sat, 24 May 2014 13:05:08 UTC Commit: e469aa6acc76fb47194c322efef3d4f900f990a2 https://github.com/geany/geany/commit/e469aa6acc76fb47194c322efef3d4f900f990...
Log Message: ----------- Use document_show_message() when a file is removed from disk
The close button is removed from the dialog also since the user can easily choose to close the document normally.
Setting default response removed since it's not working yet.
Modified Paths: -------------- src/document.c
Modified: src/document.c 38 lines changed, 17 insertions(+), 21 deletions(-) =================================================================== @@ -3126,37 +3126,33 @@ static void monitor_reload_file(GeanyDocument *doc) }
-static gboolean monitor_resave_missing_file(GeanyDocument *doc) +static void on_monitor_resave_missing_file_response(GtkWidget *bar, + gint response_id, + GeanyDocument *doc) { - gboolean want_reload = FALSE; gboolean file_saved = FALSE; - gint ret;
- ret = dialogs_show_prompt(NULL, - _("Close _without saving"), GTK_RESPONSE_CLOSE, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, - _("Try to resave the file?"), - _("File "%s" was not found on disk!"), - doc->file_name); - if (ret == GTK_RESPONSE_ACCEPT) - { + if (response_id == GTK_RESPONSE_ACCEPT) file_saved = dialogs_show_save_as(); - want_reload = TRUE; - } - else if (ret == GTK_RESPONSE_CLOSE) - { - document_close(doc); - } - if (ret != GTK_RESPONSE_CLOSE && ! file_saved) + + if (!file_saved) { - /* file is missing - set unsaved state */ document_set_text_changed(doc, TRUE); /* don't prompt more than once */ SETPTR(doc->real_path, NULL); } +} +
- return want_reload; +static void monitor_resave_missing_file(GeanyDocument *doc) +{ + document_show_message(doc, GTK_MESSAGE_WARNING, on_monitor_resave_missing_file_response, + GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL, GTK_RESPONSE_NONE, + _("Try to resave the file?"), + _("File "%s" was not found on disk!"), + doc->file_name); }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).