Commit 2f417071 authored by Naba Kumar's avatar Naba Kumar

Fixed bug #499536. File is not closed if it is not able to save the file

	* src/anjuta_cbs.c: Fixed bug #499536.
	  File is not closed if it is not able to save the file properly.

	* src/mainmenu_callbacks.c: Fixed bug #499536.
	  Newfiles (which are not modified) are also closed on "close all files".
parent 0e4f31fd
......@@ -37,6 +37,12 @@
Now anjuta also searches for file relative to top project dir,
when the project is open.
* src/anjuta_cbs.c: Fixed bug #499536.
File is not closed if it is not able to save the file properly.
* src/mainmenu_callbacks.c: Fixed bug #499536.
Newfiles (which are not modified) are also closed on "close all files".
2002-01-25 Naba Kumar <kh_naba@users.sourceforge.net>
* src/an_symbol_view.c: Added MAX_STRING_LENGTH
......
......@@ -266,9 +266,10 @@ void
on_save_as_overwrite_yes_clicked (GtkButton * button, gpointer user_data)
{
TextEditor *te;
gchar *full_filename;
gchar *full_filename, *saved_filename, *saved_full_filename;
gint page_num;
GtkWidget *child;
gint status;
full_filename = fileselection_get_filename (app->save_as_fileselection);
if (!full_filename)
......@@ -278,62 +279,72 @@ on_save_as_overwrite_yes_clicked (GtkButton * button, gpointer user_data)
g_return_if_fail (te != NULL);
g_return_if_fail (strlen (extract_filename (full_filename)) != 0);
if (te->filename)
{
g_free (te->filename);
te->filename = NULL;
}
if (te->full_filename)
{
if (app->project_dbase->project_is_open == FALSE)
tags_manager_remove (app->tags_manager,
te->full_filename);
g_free (te->full_filename);
te->full_filename = NULL;
}
saved_filename = te->filename;
saved_full_filename = te->full_filename;
te->full_filename = g_strdup (full_filename);
te->filename = g_strdup (extract_filename (full_filename));
text_editor_save_file (te);
status = text_editor_save_file (te);
gtk_widget_hide (app->save_as_fileselection);
if (closing_state)
{
anjuta_remove_current_text_editor ();
closing_state = FALSE;
}
else
if (status == FALSE)
{
text_editor_set_hilite_type(te);
if (te->mode == TEXT_EDITOR_PAGED)
g_free (te->filename);
te->filename = saved_filename;
g_free (te->full_filename);
te->full_filename = saved_full_filename;
if (closing_state) closing_state = FALSE;
g_free (full_filename);
return;
} else {
if (saved_filename)
g_free (saved_filename);
if (saved_full_filename)
{
GtkLabel* label;
page_num =
gtk_notebook_get_current_page (GTK_NOTEBOOK
(app->widgets.notebook));
g_return_if_fail (page_num >= 0);
child =
gtk_notebook_get_nth_page (GTK_NOTEBOOK
(app->widgets.notebook), page_num);
/* This crashes */
/* gtk_notebook_set_tab_label_text (GTK_NOTEBOOK (app->widgets.notebook),
child,
anjuta_get_notebook_text_editor
(page_num)->filename);
*/
label = GTK_LABEL(te->widgets.tab_label);
gtk_label_set_text(GTK_LABEL(label), anjuta_get_notebook_text_editor
(page_num)->filename);
gtk_notebook_set_menu_label_text(GTK_NOTEBOOK(app->widgets.notebook),
child,
anjuta_get_notebook_text_editor
(page_num)->filename);
if (app->project_dbase->project_is_open == FALSE)
tags_manager_remove (app->tags_manager,
saved_full_filename);
g_free (saved_full_filename);
}
if (closing_state)
{
anjuta_remove_current_text_editor ();
closing_state = FALSE;
}
else
{
text_editor_set_hilite_type(te);
if (te->mode == TEXT_EDITOR_PAGED)
{
GtkLabel* label;
page_num =
gtk_notebook_get_current_page (GTK_NOTEBOOK
(app->widgets.notebook));
g_return_if_fail (page_num >= 0);
child =
gtk_notebook_get_nth_page (GTK_NOTEBOOK
(app->widgets.notebook), page_num);
/* This crashes */
/* gtk_notebook_set_tab_label_text (GTK_NOTEBOOK (app->widgets.notebook),
child,
anjuta_get_notebook_text_editor
(page_num)->filename);
*/
label = GTK_LABEL(te->widgets.tab_label);
gtk_label_set_text(GTK_LABEL(label), anjuta_get_notebook_text_editor
(page_num)->filename);
gtk_notebook_set_menu_label_text(GTK_NOTEBOOK(app->widgets.notebook),
child,
anjuta_get_notebook_text_editor
(page_num)->filename);
}
}
anjuta_update_title ();
anjuta_clear_windows_menu();
anjuta_fill_windows_menu();
g_free (full_filename);
}
anjuta_update_title ();
anjuta_clear_windows_menu();
anjuta_fill_windows_menu();
g_free (full_filename);
}
gboolean
......
......@@ -157,7 +157,7 @@ on_close_all_file1_activate (GtkMenuItem * menuitem, gpointer user_data)
next = node->next; // Save it now, as we may change it.
if(te)
{
if (text_editor_is_saved (te) && te->full_filename)
if (text_editor_is_saved (te))
{
anjuta_remove_text_editor(te);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment