347 |
{ |
{ |
348 |
// possibly already removed |
// possibly already removed |
349 |
g_ptr_set_try_remove (Whole->documents, doc); |
g_ptr_set_try_remove (Whole->documents, doc); |
|
|
|
|
// notify non-primary reference holders |
|
|
app_redael_release_transcript (Whole, doc); |
|
350 |
} |
} |
351 |
|
|
352 |
static void |
static void |
777 |
_transcript_revert (DocGui *dg) |
_transcript_revert (DocGui *dg) |
778 |
{ |
{ |
779 |
LeadrDoc *old = dg->model; |
LeadrDoc *old = dg->model; |
780 |
|
DocGui *dg = doc_gui_find (old); |
781 |
|
g_return_if_fail (dg); |
782 |
|
|
783 |
const gchar *pathname = leadr_doc_get_pathname (old); |
const gchar *pathname = leadr_doc_get_pathname (old); |
784 |
|
|
785 |
|
// ref_count is marked as private. If we lose access someday |
786 |
|
// then we can replace it with our own public ref_count to |
787 |
|
// mirror the internal GObject ref_count. |
788 |
|
// |
789 |
|
if (G_OBJECT (old)->ref_count > 1) { |
790 |
|
app_message_run (GTK_MESSAGE_ERROR, |
791 |
|
APP_BUTTONS_OK, |
792 |
|
"One or more exams depend on the document `%s'.\n" |
793 |
|
"Revert is not possible until you close these exams.", |
794 |
|
pathname); |
795 |
|
return; |
796 |
|
} |
797 |
|
|
798 |
if (app_message_run (GTK_MESSAGE_QUESTION, |
if (app_message_run (GTK_MESSAGE_QUESTION, |
799 |
APP_BUTTONS_YES_NO, |
APP_BUTTONS_YES_NO, |
800 |
"Are you sure you want to revert to " |
"Are you sure you want to revert to " |
833 |
return; |
return; |
834 |
} |
} |
835 |
|
|
836 |
app_redael_replace_transcript (Whole, old, fresh); //rename at least XXX |
doc_gui_set_model (dg, fresh); |
|
|
|
837 |
g_object_unref (fresh); |
g_object_unref (fresh); |
838 |
} |
} |
839 |
|
|