[ghex] Fix regression with close on save confirmation
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ghex] Fix regression with close on save confirmation
- Date: Tue, 26 Jul 2011 18:18:35 +0000 (UTC)
commit f0bae76f1fe44ab48bbd35698163028fed1e2d61
Author: Kalev Lember <kalevlember gmail com>
Date: Sun Jul 24 01:19:19 2011 +0300
Fix regression with close on save confirmation
When closing an open file, one of the checks that is done is to see if
the file still exists on the disk. However, d48fdd1 introduced a
regression so that this check always returns true, making ghex always
offer to save the file.
Fixed that check to use g_file_new_for_path(), as we are dealing with
local pathnames. While at this, also renamed the function to avoid
future confusion and made it static.
src/ghex-window.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/ghex-window.c b/src/ghex-window.c
index 230fb2f..efd5d4b 100644
--- a/src/ghex-window.c
+++ b/src/ghex-window.c
@@ -1178,18 +1178,18 @@ ghex_window_save_as(GHexWindow *win)
return ret_val;
}
-gboolean
-ghex_window_uri_exists (const gchar* text_uri)
+static gboolean
+ghex_window_path_exists (const gchar* path)
{
- GFile *uri;
+ GFile *file;
gboolean res;
- g_return_val_if_fail (text_uri != NULL, FALSE);
- uri = g_file_new_for_uri (text_uri);
- g_return_val_if_fail (uri != NULL, FALSE);
- res = g_file_query_exists (uri, NULL);
+ g_return_val_if_fail (path != NULL, FALSE);
+ file = g_file_new_for_path (path);
+ g_return_val_if_fail (file != NULL, FALSE);
+ res = g_file_query_exists (file, NULL);
- g_object_unref (uri);
+ g_object_unref (file);
return res;
}
@@ -1198,7 +1198,7 @@ ghex_window_ok_to_close(GHexWindow *win)
{
GtkWidget *mbox;
gint reply;
- gboolean uri_exists;
+ gboolean file_exists;
GtkWidget *save_btn;
HexDocument *doc;
@@ -1206,8 +1206,8 @@ ghex_window_ok_to_close(GHexWindow *win)
return TRUE;
doc = win->gh->document;
- uri_exists = ghex_window_uri_exists(doc->file_name);
- if(!hex_document_has_changed(doc) && uri_exists)
+ file_exists = ghex_window_path_exists (doc->file_name);
+ if (!hex_document_has_changed(doc) && file_exists)
return TRUE;
mbox = gtk_message_dialog_new(GTK_WINDOW(win),
@@ -1231,7 +1231,7 @@ ghex_window_ok_to_close(GHexWindow *win)
gtk_widget_destroy(mbox);
if(reply == GTK_RESPONSE_YES) {
- if(!uri_exists) {
+ if(!file_exists) {
if(!ghex_window_save_as(win)) {
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]