Bug fixed.

This commit is contained in:
Toshio Sekiya 2021-03-08 22:39:47 +09:00
parent ba35c4fc7b
commit c8d7adcb51
6 changed files with 32 additions and 31 deletions

1
.gitignore vendored
View file

@ -23,6 +23,7 @@ src/menu/a.out
src/color/_build src/color/_build
src/turtle/_build src/turtle/_build
src/temp src/temp
src/le
html/* html/*
latex/* latex/*

View file

@ -160,20 +160,20 @@ The error is managed only in the TfeTextView instance and no information is noti
4 GFile *file; 4 GFile *file;
5 GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (tv), GTK_TYPE_WINDOW); 5 GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (tv), GTK_TYPE_WINDOW);
6 6
7 gtk_window_destroy (GTK_WINDOW (dialog)); 7 if (response == GTK_RESPONSE_ACCEPT) {
8 if (response == GTK_RESPONSE_ACCEPT) { 8 file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
9 file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog)); 9 if (! G_IS_FILE (file))
10 if (! G_IS_FILE (file)) 10 g_warning ("TfeTextView: gtk_file_chooser_get_file returns non GFile object.\n");
11 g_warning ("TfeTextView: gtk_file_chooser_get_file returns non GFile object.\n"); 11 else {
12 else { 12 save_file(file, tb, GTK_WINDOW (win));
13 save_file(file, tb, GTK_WINDOW (win)); 13 if (G_IS_FILE (tv->file))
14 if (G_IS_FILE (tv->file)) 14 g_object_unref (tv->file);
15 g_object_unref (tv->file); 15 tv->file = file;
16 tv->file = file; 16 gtk_text_buffer_set_modified (tb, FALSE);
17 gtk_text_buffer_set_modified (tb, FALSE); 17 g_signal_emit (tv, tfe_text_view_signals[CHANGE_FILE], 0);
18 g_signal_emit (tv, tfe_text_view_signals[CHANGE_FILE], 0); 18 }
19 } 19 }
20 } 20 gtk_window_destroy (GTK_WINDOW (dialog));
21 } 21 }
22 22
23 void 23 void

View file

@ -545,20 +545,20 @@ It is a good practice for you to add more features.
101 GFile *file; 101 GFile *file;
102 GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (tv), GTK_TYPE_WINDOW); 102 GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (tv), GTK_TYPE_WINDOW);
103 103
104 gtk_window_destroy (GTK_WINDOW (dialog)); 104 if (response == GTK_RESPONSE_ACCEPT) {
105 if (response == GTK_RESPONSE_ACCEPT) { 105 file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
106 file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog)); 106 if (! G_IS_FILE (file))
107 if (! G_IS_FILE (file)) 107 g_warning ("TfeTextView: gtk_file_chooser_get_file returns non GFile object.\n");
108 g_warning ("TfeTextView: gtk_file_chooser_get_file returns non GFile object.\n"); 108 else {
109 else { 109 save_file(file, tb, GTK_WINDOW (win));
110 save_file(file, tb, GTK_WINDOW (win)); 110 if (G_IS_FILE (tv->file))
111 if (G_IS_FILE (tv->file)) 111 g_object_unref (tv->file);
112 g_object_unref (tv->file); 112 tv->file = file;
113 tv->file = file; 113 gtk_text_buffer_set_modified (tb, FALSE);
114 gtk_text_buffer_set_modified (tb, FALSE); 114 g_signal_emit (tv, tfe_text_view_signals[CHANGE_FILE], 0);
115 g_signal_emit (tv, tfe_text_view_signals[CHANGE_FILE], 0); 115 }
116 } 116 }
117 } 117 gtk_window_destroy (GTK_WINDOW (dialog));
118 } 118 }
119 119
120 void 120 void

View file

@ -705,7 +705,7 @@ But in the future version, it will probably need details.
- 209-212: `tfe_window_new`. - 209-212: `tfe_window_new`.
This function creates TfeWindow instance. This function creates TfeWindow instance.
## GtkApplication ## TfeApplication
The file `tfeapplication.c` is now very simple. The file `tfeapplication.c` is now very simple.

View file

@ -225,7 +225,7 @@ But in the future version, it will probably need details.
- 209-212: `tfe_window_new`. - 209-212: `tfe_window_new`.
This function creates TfeWindow instance. This function creates TfeWindow instance.
## GtkApplication ## TfeApplication
The file `tfeapplication.c` is now very simple. The file `tfeapplication.c` is now very simple.

View file

@ -101,7 +101,6 @@ saveas_dialog_response (GtkWidget *dialog, gint response, TfeTextView *tv) {
GFile *file; GFile *file;
GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (tv), GTK_TYPE_WINDOW); GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (tv), GTK_TYPE_WINDOW);
gtk_window_destroy (GTK_WINDOW (dialog));
if (response == GTK_RESPONSE_ACCEPT) { if (response == GTK_RESPONSE_ACCEPT) {
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog)); file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
if (! G_IS_FILE (file)) if (! G_IS_FILE (file))
@ -115,6 +114,7 @@ saveas_dialog_response (GtkWidget *dialog, gint response, TfeTextView *tv) {
g_signal_emit (tv, tfe_text_view_signals[CHANGE_FILE], 0); g_signal_emit (tv, tfe_text_view_signals[CHANGE_FILE], 0);
} }
} }
gtk_window_destroy (GTK_WINDOW (dialog));
} }
void void