Definition in file fileout.h.
Go to the source code of this file.
Functions | |
callbacks for file io | |
void | close_file (GtkAction *w, gpointer data) |
void | file_export (GtkAction *w, gpointer data) |
void | save_file (GtkAction *w, gpointer data) |
void | save_as (GtkAction *w, gpointer data) |
gboolean | exit_action (GtkAction *a, gpointer data) |
gboolean | file_exit (GtkWidget *w, GdkEvent *event, gpointer data) |
gboolean | ask_about_save (QlTabData *tab) |
gboolean ask_about_save | ( | QlTabData * | tab | ) |
This dialogue box is called by the close and quit routines to just ask if the front file should be saved onto disk before the window is closed.
Definition at line 597 of file fileout.c.
00598 { 00599 GtkWidget * ask_dlg; 00600 gboolean ret; 00601 gint result; 00602 00603 ret = FALSE; 00604 /* no tabs, no data to save */ 00605 if (!tab) 00606 return FALSE; 00607 if (gtk_notebook_get_current_page (tab->qlc->notebook) < 0) 00608 return FALSE; 00609 if (!check_if_changed(tab)) 00610 return FALSE; 00611 ask_dlg = gtk_message_dialog_new (GTK_WINDOW(tab->qlc->parent), 00612 GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, 00613 GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, 00614 "%s", _("This file has been changed. " 00615 "Do you want to save it to disk?")); 00616 gtk_dialog_add_buttons (GTK_DIALOG(ask_dlg), 00617 GTK_STOCK_YES, GTK_RESPONSE_YES, 00618 GTK_STOCK_NO, GTK_RESPONSE_NO, 00619 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); 00620 00621 result = gtk_dialog_run (GTK_DIALOG (ask_dlg)); 00622 switch (result) 00623 { 00624 case GTK_RESPONSE_YES: 00625 { 00626 /* if user said Yes, save the file */ 00627 any_save (tab); 00628 break; 00629 } 00630 case GTK_RESPONSE_NO: 00631 { 00632 gint tab_index; 00633 tab_index = gtk_notebook_get_current_page (tab->qlc->notebook); 00634 gtk_notebook_remove_page (tab->qlc->notebook, tab_index); 00635 if (tab->file->file_path) 00636 g_free (tab->file->file_path); 00637 tab->file->file_path = NULL; 00638 break; 00639 } 00640 case GTK_RESPONSE_CANCEL : 00641 ret = TRUE; 00642 break; 00643 } 00644 gtk_widget_destroy (ask_dlg); 00645 return ret; 00646 } /* End of ask_about_save */