SF.net SVN: geany:[5206] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Sep 8 14:56:27 UTC 2010


Revision: 5206
          http://geany.svn.sourceforge.net/geany/?rev=5206&view=rev
Author:   ntrel
Date:     2010-09-08 14:56:27 +0000 (Wed, 08 Sep 2010)

Log Message:
-----------
Add Close button to the detected file changed dialog.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/document.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-09-08 13:10:44 UTC (rev 5205)
+++ trunk/ChangeLog	2010-09-08 14:56:27 UTC (rev 5206)
@@ -3,6 +3,8 @@
  * src/ui_utils.h, src/msgwindow.c, src/msgwindow.h, src/main.c:
    Add GeanyMainWidgets::message_window_notebook for plugins to append
    a new notebook page (#3061342).
+ * src/document.c:
+   Add Close button to the detected file changed dialog.
 
 
 2010-08-29  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2010-09-08 13:10:44 UTC (rev 5205)
+++ trunk/src/document.c	2010-09-08 14:56:27 UTC (rev 5206)
@@ -2888,21 +2888,24 @@
 }
 
 
-static gboolean monitor_reload_file(GeanyDocument *doc)
+static void monitor_reload_file(GeanyDocument *doc)
 {
 	gchar *base_name = g_path_get_basename(doc->file_name);
-	gboolean want_reload;
+	gint ret;
 
-	want_reload = dialogs_show_question_full(NULL, _("_Reload"), GTK_STOCK_CANCEL,
+	ret = dialogs_show_prompt(NULL,
+		GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+		_("_Reload"), GTK_RESPONSE_ACCEPT,
 		_("Do you want to reload it?"),
 		_("The file '%s' on the disk is more recent than\nthe current buffer."),
 		base_name);
+	g_free(base_name);
 
-	if (want_reload)
+	if (ret == GTK_RESPONSE_ACCEPT)
 		document_reload_file(doc, doc->encoding);
-
-	g_free(base_name);
-	return want_reload;
+	else if (ret == GTK_RESPONSE_CLOSE)
+		document_close(doc);
 }
 
 
@@ -2978,6 +2981,7 @@
 	if (g_stat(locale_filename, &st) != 0)
 	{
 		monitor_resave_missing_file(doc);
+		/* doc may be closed now */
 		ret = TRUE;
 	}
 	else if (! use_gio_filemon && /* ignore these checks when using GIO */
@@ -2987,14 +2991,15 @@
 	}
 	else if (doc->priv->mtime < st.st_mtime)
 	{
+		doc->priv->mtime = st.st_mtime;
 		monitor_reload_file(doc);
-		doc->priv->mtime = st.st_mtime;
+		/* doc may be closed now */
 		ret = TRUE;
 	}
 	g_free(locale_filename);
 
 	if (DOC_VALID(doc))
-	{	/* doc can get invalid when a document was closed by monitor_resave_missing_file() */
+	{	/* doc can get invalid when a document was closed */
 		old_status = doc->priv->file_disk_status;
 		doc->priv->file_disk_status = FILE_OK;
 		if (old_status != doc->priv->file_disk_status)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list