/*! \brief Free the gschem toplevel * * \param [in] w_current The gschem toplevel */ void gschem_toplevel_free (GschemToplevel *w_current) { if (w_current->toplevel != NULL) { s_toplevel_delete (w_current->toplevel); w_current->toplevel = NULL; } if (w_current->dash_length_list_store != NULL) { g_object_unref (w_current->dash_length_list_store); w_current->dash_length_list_store = NULL; } if (w_current->dash_space_list_store != NULL) { g_object_unref (w_current->dash_space_list_store); w_current->dash_space_list_store = NULL; } if (w_current->fill_angle_list_store != NULL) { g_object_unref (w_current->fill_angle_list_store); w_current->fill_angle_list_store = NULL; } if (w_current->fill_pitch_list_store != NULL) { g_object_unref (w_current->fill_pitch_list_store); w_current->fill_pitch_list_store = NULL; } if (w_current->fill_width_list_store != NULL) { g_object_unref (w_current->fill_width_list_store); w_current->fill_width_list_store = NULL; } if (w_current->line_width_list_store != NULL) { g_object_unref (w_current->line_width_list_store); w_current->line_width_list_store = NULL; } if (w_current->text_size_list_store != NULL) { g_object_unref (w_current->text_size_list_store); w_current->text_size_list_store = NULL; } if (w_current->options != NULL) { g_object_unref (w_current->options); w_current->options = NULL; } if (w_current->renderer != NULL) { g_object_unref (w_current->renderer); w_current->renderer = NULL; } g_free (w_current); }
static void preview_dispose (GObject *self) { Preview *preview = PREVIEW (self); GSCHEM_TOPLEVEL *preview_w_current = preview->preview_w_current; if (preview_w_current != NULL) { preview_w_current->drawing_area = NULL; x_window_free_gc (preview_w_current); s_toplevel_delete (preview_w_current->toplevel); g_free (preview_w_current); preview->preview_w_current = NULL; } G_OBJECT_CLASS (preview_parent_class)->dispose (self); }
/*! \todo Finish function documentation!!! * \brief * \par Function Description * */ void x_window_close(GSCHEM_TOPLEVEL *w_current) { TOPLEVEL *toplevel = w_current->toplevel; gboolean last_window = FALSE; /* If we're closing whilst inside a move action, re-wind the * page contents back to their state before we started */ if (w_current->inside_action && (w_current->event_state == MOVE || w_current->event_state == ENDMOVE)) { o_move_cancel (w_current); } /* last chance to save possible unsaved pages */ if (!x_dialog_close_window (w_current)) { /* user somehow cancelled the close */ return; } x_clipboard_finish (w_current); #if DEBUG o_conn_print_hash(w_current->page_current->conn_table); #endif /* close all the dialog boxes */ if (w_current->sowindow) gtk_widget_destroy(w_current->sowindow); if (w_current->cswindow) gtk_widget_destroy(w_current->cswindow); if (w_current->tiwindow) gtk_widget_destroy(w_current->tiwindow); if (w_current->tewindow) gtk_widget_destroy(w_current->tewindow); if (w_current->aawindow) gtk_widget_destroy(w_current->aawindow); x_multiattrib_close (w_current); if (w_current->aewindow) gtk_widget_destroy(w_current->aewindow); if (w_current->trwindow) gtk_widget_destroy(w_current->trwindow); x_pagesel_close (w_current); if (w_current->tswindow) gtk_widget_destroy(w_current->tswindow); if (w_current->iwindow) gtk_widget_destroy(w_current->iwindow); if (w_current->hkwindow) gtk_widget_destroy(w_current->hkwindow); if (w_current->cowindow) gtk_widget_destroy(w_current->cowindow); if (w_current->clwindow) gtk_widget_destroy(w_current->clwindow); if (w_current->sewindow) gtk_widget_destroy(w_current->sewindow); if (g_list_length (global_window_list) == 1) { /* no more window after this one, remember to quit */ last_window = TRUE; } if (toplevel->major_changed_refdes) { GList* current = toplevel->major_changed_refdes; while (current) { /* printf("yeah freeing: %s\n", (char*) current->data); */ g_free(current->data); current = g_list_next(current); } g_list_free(toplevel->major_changed_refdes); } /* stuff that has to be done before we free w_current */ if (last_window) { /* close the log file */ s_log_close (); /* free the buffers */ o_buffer_free (w_current); } x_window_free_gc(w_current); /* finally close the main window */ gtk_widget_destroy(w_current->main_window); s_toplevel_delete (toplevel); global_window_list = g_list_remove (global_window_list, w_current); g_free (w_current); /* just closed last window, so quit */ if (last_window) { gschem_quit(); } }