[Xfce4-commits] <mousepad:master> * mousepad/mousepad-window.c: Add extra tests if the file really exists, because Gtk file dialogs hang if the file does not exists.
Nick Schermer
noreply at xfce.org
Sat May 5 21:30:34 CEST 2012
Updating branch refs/heads/master
to 4abd78f00bd8306fd7a8028875cb9050b62df53e (commit)
from d2c3c1f88384b617269bcd129f6cce6a86b5efa2 (commit)
commit 4abd78f00bd8306fd7a8028875cb9050b62df53e
Author: Nick Schermer <nick at xfce.org>
Date: Sat May 12 16:38:47 2007 +0000
* mousepad/mousepad-window.c: Add extra tests if the file
really exists, because Gtk file dialogs hang if the
file does not exists.
(Old svn revision: 25708)
ChangeLog | 6 ++++++
mousepad/mousepad-private.h | 1 +
mousepad/mousepad-window.c | 8 +++++++-
3 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d2260c1..c5c1855 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
2007-05-12 Nick Schermer <nick at xfce.org>
+ * mousepad/mousepad-window.c: Add extra tests if the file
+ really exists, because Gtk file dialogs hang if the
+ file does not exists.
+
+
+2007-05-12 Nick Schermer <nick at xfce.org>
* mousepad/mousepad-window.c: Jump to active file when
opening a new document.
diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index b70e0de..ce7fafe 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -21,6 +21,7 @@
#ifndef __MOUSEPAD_PRIVATE_H__
#define __MOUSEPAD_PRIVATE_H__
+#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <libxfce4util/libxfce4util.h>
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index df6ce1f..5b21c0a 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -32,6 +32,8 @@
#include <unistd.h>
#endif
+#include <glib/gstdio.h>
+
#include <mousepad/mousepad-private.h>
#include <mousepad/mousepad-types.h>
#include <mousepad/mousepad-application.h>
@@ -927,6 +929,10 @@ mousepad_window_save (MousepadWindow *window,
/* get the current filename */
filename = mousepad_document_get_filename (document);
+
+ /* check if the file really exists */
+ if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE)
+ filename = NULL;
if (force_save_as || filename == NULL)
{
@@ -2165,7 +2171,7 @@ mousepad_window_action_open_file (GtkAction *action,
active_filename = mousepad_document_get_filename (window->active);
/* set the current filename, if there is one */
- if (active_filename)
+ if (active_filename && g_file_test (active_filename, G_FILE_TEST_EXISTS))
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (chooser), active_filename);
}
More information about the Xfce4-commits
mailing list