[glade3] * src/glade-window.c: Fix possible crash when saving new project. bug 622635, fix by Martin Schlem
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * src/glade-window.c: Fix possible crash when saving new project. bug 622635, fix by Martin Schlem
- Date: Sun, 9 Jan 2011 14:38:59 +0000 (UTC)
commit 0db118db42f5d01a634811f9dc8ddd664130ffdc
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun Jan 9 23:45:13 2011 +0900
* src/glade-window.c: Fix possible crash when saving new project. bug 622635, fix
by Martin Schlemmer.
ChangeLog | 3 ++
src/glade-window.c | 66 ++++++++++++++++++++++++++-------------------------
2 files changed, 37 insertions(+), 32 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 55dee14..cedc434 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,9 @@
* plugins/gtk+/glade-column-types.c: Fixed crash when user performs Drag'n'Drop of
< enter column here > and no columns are yet added (fixes bug 633943).
+ * src/glade-window.c: Fix possible crash when saving new project. bug 622635, fix
+ by Martin Schlemmer.
+
2011-01-08 Tristan Van Berkom <tristanvb openismus com>
* gladeui/glade-utils.[ch], gladeui/glade-widget.c, gladeui/glade-builtins.c,
diff --git a/src/glade-window.c b/src/glade-window.c
index 3b3ae23..8f6fd7f 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -1122,48 +1122,50 @@ save (GladeWindow * window, GladeProject * project, const gchar * path)
return;
/* check for external modification to the project file */
- mtime = glade_util_get_file_mtime (glade_project_get_path (project), NULL);
-
- if (mtime > glade_project_get_file_mtime (project))
+ if (glade_project_get_path (project))
{
+ mtime = glade_util_get_file_mtime (glade_project_get_path (project), NULL);
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- _
- ("The file %s has been modified since reading it"),
- glade_project_get_path (project));
+ if (mtime > glade_project_get_file_mtime (project))
+ {
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- _
- ("If you save it, all the external changes could be lost. Save it anyway?"));
+ dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ _("The file %s has been modified since reading it"),
+ glade_project_get_path (project));
- gtk_window_set_title (GTK_WINDOW (dialog), "");
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ _("If you save it, all the external changes could be lost. "
+ "Save it anyway?"));
- button = gtk_button_new_with_mnemonic (_("_Save Anyway"));
- gtk_button_set_image (GTK_BUTTON (button),
- gtk_image_new_from_stock (GTK_STOCK_SAVE,
- GTK_ICON_SIZE_BUTTON));
- gtk_widget_show (button);
+ gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button,
- GTK_RESPONSE_ACCEPT);
- gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Don't Save"),
- GTK_RESPONSE_REJECT);
+ button = gtk_button_new_with_mnemonic (_("_Save Anyway"));
+ gtk_button_set_image (GTK_BUTTON (button),
+ gtk_image_new_from_stock (GTK_STOCK_SAVE,
+ GTK_ICON_SIZE_BUTTON));
+ gtk_widget_show (button);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog),
- GTK_RESPONSE_REJECT);
+ gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button,
+ GTK_RESPONSE_ACCEPT);
+ gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Don't Save"),
+ GTK_RESPONSE_REJECT);
- response = gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog),
+ GTK_RESPONSE_REJECT);
- gtk_widget_destroy (dialog);
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
- if (response == GTK_RESPONSE_REJECT)
- {
- g_free (display_path);
- return;
- }
+ gtk_widget_destroy (dialog);
+
+ if (response == GTK_RESPONSE_REJECT)
+ {
+ g_free (display_path);
+ return;
+ }
+ }
}
/* Interestingly; we cannot use `path' after glade_project_reset_path
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]