mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* src/gnome/gnc-dialogs.glade: add title to transfer dialog
* src/engine/gnc-pricedb.c (gnc_pricedb_destroy): fix mem leak * src/gnome/dialog-options.c: cleanup destruction semantics. destroy tooltips * src/engine/io-gncxml-r.c (gnc_book_load_from_xml_file): fix mem leak * src/gnome/dialog-utils.c (gnc_build_option_menu): destroy tooltips when menu is destroyed * src/gnome/dialog-transfer.c: destroy tooltips object * src/gnome/window-main.c (gnc_ui_destroy_all_subwindows): now all windows use component manager * src/gnome/window-report.c: add report to component manager. cleaner destruction behavior * src/gnome/window-help.c: cleaner destruction behavior * src/gnome/gnc-html.c: fix to avoid having the ref the container from outside for destruction * src/FileDialog.c (gncAddHistory): fix mem leak * src/gnome/dialog-options.c (gnc_option_create_date_widget): fix bug & mem leak. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3733 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
e0ef3f6843
commit
d7cf63bf2b
35
ChangeLog
35
ChangeLog
@ -1,3 +1,38 @@
|
||||
2001-03-02 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/gnome/gnc-dialogs.glade: add title to transfer dialog
|
||||
|
||||
* src/engine/gnc-pricedb.c (gnc_pricedb_destroy): fix mem leak
|
||||
|
||||
* src/gnome/dialog-options.c: cleanup destruction semantics.
|
||||
destroy tooltips
|
||||
|
||||
* src/engine/io-gncxml-r.c (gnc_book_load_from_xml_file): fix mem
|
||||
leak
|
||||
|
||||
* src/gnome/dialog-utils.c (gnc_build_option_menu): destroy
|
||||
tooltips when menu is destroyed
|
||||
|
||||
2001-03-01 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/gnome/dialog-transfer.c: destroy tooltips object
|
||||
|
||||
* src/gnome/window-main.c (gnc_ui_destroy_all_subwindows): now all
|
||||
windows use component manager
|
||||
|
||||
* src/gnome/window-report.c: add report to component manager.
|
||||
cleaner destruction behavior
|
||||
|
||||
* src/gnome/window-help.c: cleaner destruction behavior
|
||||
|
||||
* src/gnome/gnc-html.c: fix to avoid having the ref the container
|
||||
from outside for destruction
|
||||
|
||||
* src/FileDialog.c (gncAddHistory): fix mem leak
|
||||
|
||||
* src/gnome/dialog-options.c (gnc_option_create_date_widget): fix
|
||||
bug & mem leak.
|
||||
|
||||
2001-03-01 James LewisMoss <jimdres@mindspring.com>
|
||||
|
||||
* src/engine/gnc-account-xml-v2.c (account_id_handler): fix mem
|
||||
|
@ -197,6 +197,8 @@ gncAddHistory (GNCBook *book)
|
||||
gnc_history_add_file (url + 5);
|
||||
else
|
||||
gnc_history_add_file (url);
|
||||
|
||||
g_free (url);
|
||||
}
|
||||
|
||||
/* ======================================================== */
|
||||
|
@ -296,7 +296,7 @@ gnc_price_list_destroy(GList *prices)
|
||||
*/
|
||||
|
||||
GNCPriceDB *
|
||||
gnc_pricedb_create()
|
||||
gnc_pricedb_create(void)
|
||||
{
|
||||
GNCPriceDB * result = g_new0(GNCPriceDB, 1);
|
||||
result->commodity_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
|
||||
@ -350,6 +350,7 @@ gnc_pricedb_destroy(GNCPriceDB *db)
|
||||
NULL);
|
||||
g_hash_table_destroy (db->commodity_hash);
|
||||
db->commodity_hash = NULL;
|
||||
g_free(db);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -315,6 +315,10 @@ gnc_book_load_from_xml_file(GNCBook *book)
|
||||
}
|
||||
else
|
||||
{
|
||||
GNCPriceDB *db = gnc_book_get_pricedb(book);
|
||||
|
||||
if(db) gnc_pricedb_destroy(db);
|
||||
|
||||
gnc_book_set_pricedb(book, gnc_pricedb_create());
|
||||
}
|
||||
return(TRUE);
|
||||
|
@ -46,9 +46,13 @@
|
||||
static short module = MOD_GUI;
|
||||
|
||||
struct _gnc_option_win {
|
||||
GtkWidget * window;
|
||||
GtkWidget * container;
|
||||
GtkWidget * notebook;
|
||||
|
||||
gboolean toplevel;
|
||||
|
||||
GtkTooltips * tips;
|
||||
|
||||
GNCOptionWinCallback apply_cb;
|
||||
gpointer apply_cb_data;
|
||||
|
||||
@ -794,6 +798,7 @@ gnc_option_create_date_widget (GNCOption *option)
|
||||
char **raw_strings;
|
||||
char **raw;
|
||||
int num_values;
|
||||
|
||||
type = gnc_option_date_option_get_subtype(option);
|
||||
show_time = gnc_option_show_time(option);
|
||||
use24 = gnc_lookup_boolean_option("International",
|
||||
@ -847,6 +852,8 @@ gnc_option_create_date_widget (GNCOption *option)
|
||||
info[i].callback = gnc_option_multichoice_cb;
|
||||
}
|
||||
info[i].user_data = option;
|
||||
|
||||
raw++;
|
||||
}
|
||||
|
||||
rel_widget = gnc_build_option_menu(info, num_values);
|
||||
@ -857,7 +864,8 @@ gnc_option_create_date_widget (GNCOption *option)
|
||||
|
||||
g_free(raw_strings);
|
||||
g_free(info);
|
||||
}
|
||||
}
|
||||
|
||||
if(safe_strcmp(type, "absolute") == 0)
|
||||
{
|
||||
free(type);
|
||||
@ -1677,8 +1685,7 @@ gnc_options_dialog_add_option(GtkWidget *page,
|
||||
|
||||
static gint
|
||||
gnc_options_dialog_append_page(GNCOptionWin * propertybox,
|
||||
GNCOptionSection *section,
|
||||
GtkTooltips *tooltips)
|
||||
GNCOptionSection *section)
|
||||
{
|
||||
GNCOption *option;
|
||||
GtkWidget *page_label;
|
||||
@ -1708,7 +1715,8 @@ gnc_options_dialog_append_page(GNCOptionWin * propertybox,
|
||||
for (i = 0; i < num_options; i++)
|
||||
{
|
||||
option = gnc_get_option_section_option(section, i);
|
||||
gnc_options_dialog_add_option(page_content_box, option, tooltips);
|
||||
gnc_options_dialog_add_option(page_content_box, option,
|
||||
propertybox->tips);
|
||||
}
|
||||
|
||||
return gtk_notebook_page_num(GTK_NOTEBOOK(propertybox->notebook),
|
||||
@ -1729,7 +1737,6 @@ void
|
||||
gnc_build_options_dialog_contents(GNCOptionWin *propertybox,
|
||||
GNCOptionDB *odb)
|
||||
{
|
||||
GtkTooltips *tooltips;
|
||||
GNCOptionSection *section;
|
||||
gchar *default_section_name;
|
||||
gint default_page = -1;
|
||||
@ -1737,7 +1744,10 @@ gnc_build_options_dialog_contents(GNCOptionWin *propertybox,
|
||||
gint page;
|
||||
gint i, j;
|
||||
|
||||
tooltips = gtk_tooltips_new();
|
||||
propertybox->tips = gtk_tooltips_new();
|
||||
|
||||
gtk_object_ref (GTK_OBJECT (propertybox->tips));
|
||||
gtk_object_sink (GTK_OBJECT (propertybox->tips));
|
||||
|
||||
num_sections = gnc_option_db_num_sections(odb);
|
||||
default_section_name = gnc_option_db_get_default_section(odb);
|
||||
@ -1747,7 +1757,7 @@ gnc_build_options_dialog_contents(GNCOptionWin *propertybox,
|
||||
const char *section_name;
|
||||
|
||||
section = gnc_option_db_get_section(odb, i);
|
||||
page = gnc_options_dialog_append_page(propertybox, section, tooltips);
|
||||
page = gnc_options_dialog_append_page(propertybox, section);
|
||||
|
||||
section_name = gnc_option_section_name(section);
|
||||
if (safe_strcmp(section_name, default_section_name) == 0)
|
||||
@ -1779,7 +1789,7 @@ gnc_build_options_dialog_contents(GNCOptionWin *propertybox,
|
||||
|
||||
GtkWidget *
|
||||
gnc_options_dialog_widget(GNCOptionWin * win) {
|
||||
return win->window;
|
||||
return win->container;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1814,7 +1824,7 @@ gnc_options_dialog_close_stub_cb(GtkWidget * w, gpointer data) {
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
gtk_widget_hide(window->window);
|
||||
gtk_widget_hide(window->container);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -1826,7 +1836,7 @@ gnc_options_dialog_ok_cb(GtkWidget * w, gpointer data) {
|
||||
}
|
||||
|
||||
GNCOptionWin *
|
||||
gnc_options_dialog_new(int make_toplevel) {
|
||||
gnc_options_dialog_new(gboolean make_toplevel) {
|
||||
GNCOptionWin * retval = g_new0(GNCOptionWin, 1);
|
||||
GtkWidget * vbox;
|
||||
GtkWidget * buttonbox;
|
||||
@ -1836,15 +1846,19 @@ gnc_options_dialog_new(int make_toplevel) {
|
||||
GtkWidget * help_button=NULL;
|
||||
GtkWidget * close_button=NULL;
|
||||
|
||||
retval->toplevel = make_toplevel;
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 5);
|
||||
|
||||
if(make_toplevel) {
|
||||
retval->window = gtk_window_new(GDK_WINDOW_TOPLEVEL);
|
||||
retval->container = gtk_window_new(GDK_WINDOW_TOPLEVEL);
|
||||
}
|
||||
else {
|
||||
retval->window = vbox;
|
||||
retval->container = vbox;
|
||||
gtk_widget_ref(vbox);
|
||||
gtk_object_sink(GTK_OBJECT(vbox));
|
||||
}
|
||||
|
||||
|
||||
buttonbox = gtk_hbutton_box_new ();
|
||||
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (buttonbox),
|
||||
@ -1868,7 +1882,6 @@ gnc_options_dialog_new(int make_toplevel) {
|
||||
GTK_SIGNAL_FUNC(gnc_options_dialog_help_stub_cb),
|
||||
retval);
|
||||
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(ok_button), "clicked",
|
||||
GTK_SIGNAL_FUNC(gnc_options_dialog_ok_cb),
|
||||
retval);
|
||||
@ -1887,7 +1900,7 @@ gnc_options_dialog_new(int make_toplevel) {
|
||||
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(buttonbox), FALSE, TRUE, 0);
|
||||
|
||||
if(make_toplevel) {
|
||||
gtk_container_add(GTK_CONTAINER(retval->window), vbox);
|
||||
gtk_container_add(GTK_CONTAINER(retval->container), vbox);
|
||||
}
|
||||
|
||||
gtk_widget_show_all(vbox);
|
||||
@ -1919,16 +1932,24 @@ gnc_options_dialog_set_close_cb(GNCOptionWin * win, GNCOptionWinCallback cb,
|
||||
|
||||
void
|
||||
gnc_options_dialog_destroy(GNCOptionWin * win) {
|
||||
if(win && win->window) {
|
||||
gtk_widget_unref(win->window);
|
||||
}
|
||||
if(win) {
|
||||
win->window = NULL;
|
||||
win->notebook = NULL;
|
||||
win->apply_cb = NULL;
|
||||
win->help_cb = NULL;
|
||||
g_free(win);
|
||||
|
||||
if (!win) return;
|
||||
|
||||
gtk_widget_destroy(win->container);
|
||||
|
||||
if(!win->toplevel) {
|
||||
gtk_widget_unref(win->container);
|
||||
}
|
||||
|
||||
gtk_object_unref (GTK_OBJECT(win->tips));
|
||||
|
||||
win->container = NULL;
|
||||
win->notebook = NULL;
|
||||
win->apply_cb = NULL;
|
||||
win->help_cb = NULL;
|
||||
win->tips = NULL;
|
||||
|
||||
g_free(win);
|
||||
}
|
||||
|
||||
|
||||
@ -1985,7 +2006,7 @@ gnc_show_options_dialog(void)
|
||||
gnc_build_options_dialog_contents(options_dialog, global_options);
|
||||
gnc_option_db_clean(global_options);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(options_dialog->window),
|
||||
gtk_window_set_title(GTK_WINDOW(options_dialog->container),
|
||||
_("GnuCash Preferences"));
|
||||
|
||||
gnc_options_dialog_set_apply_cb(options_dialog,
|
||||
@ -1997,6 +2018,6 @@ gnc_show_options_dialog(void)
|
||||
global_options);
|
||||
}
|
||||
|
||||
gtk_widget_show(GTK_WIDGET(options_dialog->window));
|
||||
gdk_window_raise(options_dialog->window->window);
|
||||
gtk_widget_show(options_dialog->container);
|
||||
gdk_window_raise(options_dialog->container->window);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ typedef struct _gnc_option_win GNCOptionWin;
|
||||
|
||||
typedef void (* GNCOptionWinCallback)(GNCOptionWin *, gpointer data);
|
||||
|
||||
GNCOptionWin * gnc_options_dialog_new(int make_toplevel);
|
||||
GNCOptionWin * gnc_options_dialog_new(gboolean make_toplevel);
|
||||
void gnc_options_dialog_destroy(GNCOptionWin * win);
|
||||
|
||||
GtkWidget * gnc_options_dialog_widget(GNCOptionWin * win);
|
||||
|
@ -86,6 +86,8 @@ struct _xferDialog
|
||||
|
||||
GtkWidget * price_radio;
|
||||
GtkWidget * amount_radio;
|
||||
|
||||
GtkTooltips *tips;
|
||||
};
|
||||
|
||||
struct _acct_list_item
|
||||
@ -329,8 +331,7 @@ gnc_xfer_dialog_to_tree_select_cb(GNCAccountTree *tree,
|
||||
|
||||
static void
|
||||
gnc_xfer_dialog_fill_tree_frame(XferDialog *xferData,
|
||||
XferDirection direction,
|
||||
GtkTooltips *tooltips)
|
||||
XferDirection direction)
|
||||
{
|
||||
const char *show_inc_exp_message = _("Show the income and expense accounts");
|
||||
GNCAccountTree *atree;
|
||||
@ -384,7 +385,7 @@ gnc_xfer_dialog_fill_tree_frame(XferDialog *xferData,
|
||||
xferData->from_show_button = button;
|
||||
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);
|
||||
gtk_tooltips_set_tip(tooltips, button, show_inc_exp_message, NULL);
|
||||
gtk_tooltips_set_tip(xferData->tips, button, show_inc_exp_message, NULL);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(button), "toggled",
|
||||
GTK_SIGNAL_FUNC(gnc_xfer_dialog_toggle_cb), tree);
|
||||
@ -897,6 +898,8 @@ gnc_xfer_dialog_close_cb(GnomeDialog *dialog, gpointer data)
|
||||
xferData->curr_accts_list = NULL;
|
||||
}
|
||||
|
||||
gtk_object_unref (GTK_OBJECT (xferData->tips));
|
||||
|
||||
gnc_unregister_gui_component_by_data (DIALOG_TRANSFER_CM_CLASS, xferData);
|
||||
|
||||
g_free(xferData);
|
||||
@ -911,7 +914,6 @@ static void
|
||||
gnc_xfer_dialog_create(GtkWidget * parent, XferDialog *xferData)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkTooltips *tooltips;
|
||||
GtkObject *tdo;
|
||||
|
||||
dialog = create_Transfer_Dialog();
|
||||
@ -936,7 +938,10 @@ gnc_xfer_dialog_create(GtkWidget * parent, XferDialog *xferData)
|
||||
gtk_signal_connect(GTK_OBJECT(dialog), "close",
|
||||
GTK_SIGNAL_FUNC(gnc_xfer_dialog_close_cb), xferData);
|
||||
|
||||
tooltips = gtk_tooltips_new();
|
||||
xferData->tips = gtk_tooltips_new();
|
||||
|
||||
gtk_object_ref (GTK_OBJECT (xferData->tips));
|
||||
gtk_object_sink (GTK_OBJECT (xferData->tips));
|
||||
|
||||
/* amount & date widgets */
|
||||
{
|
||||
@ -982,8 +987,8 @@ gnc_xfer_dialog_create(GtkWidget * parent, XferDialog *xferData)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
gnc_xfer_dialog_fill_tree_frame(xferData, XFER_DIALOG_TO, tooltips);
|
||||
gnc_xfer_dialog_fill_tree_frame(xferData, XFER_DIALOG_FROM, tooltips);
|
||||
gnc_xfer_dialog_fill_tree_frame(xferData, XFER_DIALOG_TO);
|
||||
gnc_xfer_dialog_fill_tree_frame(xferData, XFER_DIALOG_FROM);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(xferData->from), "select_account",
|
||||
GTK_SIGNAL_FUNC(gnc_xfer_dialog_from_tree_select_cb),
|
||||
|
@ -54,7 +54,6 @@ gnc_ui_source_menu_create(Account *account)
|
||||
GtkMenu *menu;
|
||||
GtkWidget *item;
|
||||
GtkWidget *omenu;
|
||||
/* gchar *codename; This didn't appear to be used anywhere... */
|
||||
GNCAccountType type;
|
||||
|
||||
menu = GTK_MENU(gtk_menu_new());
|
||||
@ -82,10 +81,6 @@ gnc_ui_source_menu_create(Account *account)
|
||||
if ((STOCK != type) && (MUTUAL != type))
|
||||
return omenu;
|
||||
|
||||
/*
|
||||
This didn't appear to be used anywhere...
|
||||
codename = xaccInvAcctGetPriceSrc(invacct); */
|
||||
|
||||
return omenu;
|
||||
}
|
||||
|
||||
@ -106,6 +101,13 @@ gnc_option_menu_cb(GtkWidget *w, gpointer data)
|
||||
cb(w, index, data);
|
||||
}
|
||||
|
||||
static void
|
||||
option_menu_destroy_cb (GtkObject *obj, gpointer data)
|
||||
{
|
||||
GtkTooltips *tips = data;
|
||||
|
||||
gtk_object_unref (GTK_OBJECT (tips));
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ui_create_option_button *
|
||||
@ -132,6 +134,9 @@ gnc_build_option_menu(GNCOptionInfo *option_info, gint num_options)
|
||||
|
||||
tooltips = gtk_tooltips_new();
|
||||
|
||||
gtk_object_ref (GTK_OBJECT (tooltips));
|
||||
gtk_object_sink (GTK_OBJECT (tooltips));
|
||||
|
||||
for (i = 0; i < num_options; i++)
|
||||
{
|
||||
menu_item = gtk_menu_item_new_with_label(option_info[i].name);
|
||||
@ -160,6 +165,9 @@ gnc_build_option_menu(GNCOptionInfo *option_info, gint num_options)
|
||||
|
||||
gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (omenu), "destroy",
|
||||
GTK_SIGNAL_FUNC (option_menu_destroy_cb), tooltips);
|
||||
|
||||
return omenu;
|
||||
}
|
||||
|
||||
|
@ -4850,7 +4850,7 @@ create_Transfer_Dialog (void)
|
||||
GtkWidget *button66;
|
||||
GtkWidget *button68;
|
||||
|
||||
Transfer_Dialog = gnome_dialog_new (NULL, NULL);
|
||||
Transfer_Dialog = gnome_dialog_new (_("Transfer Funds"), NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (Transfer_Dialog), "Transfer_Dialog", Transfer_Dialog);
|
||||
gtk_window_set_policy (GTK_WINDOW (Transfer_Dialog), TRUE, TRUE, FALSE);
|
||||
|
||||
|
@ -7050,6 +7050,7 @@ Click "Cancel" to abort the QIF import process.</text>
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>Transfer Dialog</name>
|
||||
<title>Transfer Funds</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
|
@ -1079,12 +1079,12 @@ gnc_html_reload(gnc_html * html) {
|
||||
\********************************************************************/
|
||||
|
||||
gnc_html *
|
||||
gnc_html_new() {
|
||||
gnc_html_new(void) {
|
||||
gnc_html * retval = g_new0(gnc_html, 1);
|
||||
|
||||
retval->container = gtk_scrolled_window_new(NULL, NULL);
|
||||
retval->html = gtk_html_new();
|
||||
|
||||
retval->html = gtk_html_new();
|
||||
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(retval->container),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
@ -1092,7 +1092,10 @@ gnc_html_new() {
|
||||
gtk_container_add(GTK_CONTAINER(retval->container),
|
||||
GTK_WIDGET(retval->html));
|
||||
|
||||
retval->history = gnc_html_history_new();
|
||||
retval->history = gnc_html_history_new();
|
||||
|
||||
gtk_widget_ref (retval->container);
|
||||
gtk_object_sink (GTK_OBJECT (retval->container));
|
||||
|
||||
/* signals */
|
||||
gtk_signal_connect(GTK_OBJECT(retval->html), "url_requested",
|
||||
@ -1176,10 +1179,20 @@ gnc_html_destroy(gnc_html * html) {
|
||||
/* cancel any outstanding HTTP requests */
|
||||
gnc_html_cancel(html);
|
||||
|
||||
gtk_widget_unref(html->container);
|
||||
gnc_html_history_destroy(html->history);
|
||||
|
||||
gtk_widget_destroy(html->container);
|
||||
gtk_widget_unref(html->container);
|
||||
|
||||
g_free(html->current_link);
|
||||
g_free(html->base_location);
|
||||
|
||||
html->container = NULL;
|
||||
html->html = NULL;
|
||||
html->history = NULL;
|
||||
html->current_link = NULL;
|
||||
html->base_location = NULL;
|
||||
|
||||
g_free(html);
|
||||
}
|
||||
|
||||
@ -1221,12 +1234,14 @@ gnc_html_print(gnc_html * html) {
|
||||
|
||||
gnc_html_history *
|
||||
gnc_html_get_history(gnc_html * html) {
|
||||
if (!html) return NULL;
|
||||
return html->history;
|
||||
}
|
||||
|
||||
|
||||
GtkWidget *
|
||||
gnc_html_get_widget(gnc_html * html) {
|
||||
if (!html) return NULL;
|
||||
return html->container;
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,29 @@ static void
|
||||
gnc_help_window_destroy_cb(GtkWidget * w, gpointer data) {
|
||||
gnc_help_window * help = data;
|
||||
|
||||
gnc_help_window_destroy(help);
|
||||
gnc_unregister_gui_component_by_data (WINDOW_HELP_CM_CLASS, help);
|
||||
|
||||
/* close the help index db */
|
||||
if(help->index_db) {
|
||||
help->index_db->close(help->index_db);
|
||||
}
|
||||
|
||||
gnc_html_destroy(help->html);
|
||||
|
||||
help->html = NULL;
|
||||
help->toplevel = NULL;
|
||||
help->statusbar = NULL;
|
||||
help->html_vbox = NULL;
|
||||
help->topics_tree = NULL;
|
||||
|
||||
g_free(help);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_help_window_close_cb(GtkWidget * w, gpointer data) {
|
||||
gnc_help_window * help = data;
|
||||
|
||||
gnc_close_gui_component_by_data (WINDOW_HELP_CM_CLASS, help);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -540,7 +562,7 @@ gnc_help_window_new (void) {
|
||||
{ GNOME_APP_UI_ITEM,
|
||||
N_("Close"),
|
||||
N_("Close this Help window"),
|
||||
gnc_help_window_destroy_cb, help,
|
||||
gnc_help_window_close_cb, help,
|
||||
NULL,
|
||||
GNOME_APP_PIXMAP_STOCK,
|
||||
GNOME_STOCK_PIXMAP_CLOSE,
|
||||
@ -616,30 +638,9 @@ gnc_help_window_new (void) {
|
||||
void
|
||||
gnc_help_window_destroy(gnc_help_window * help) {
|
||||
|
||||
gnc_unregister_gui_component_by_data (WINDOW_HELP_CM_CLASS, help);
|
||||
|
||||
gtk_signal_disconnect_by_func(GTK_OBJECT(help->toplevel),
|
||||
GTK_SIGNAL_FUNC(gnc_help_window_destroy_cb),
|
||||
(gpointer)help);
|
||||
|
||||
/* close the help index db */
|
||||
if(help->index_db) {
|
||||
help->index_db->close(help->index_db);
|
||||
}
|
||||
|
||||
/* take care of the gnc-html object specially */
|
||||
gtk_widget_ref(gnc_html_get_widget(help->html));
|
||||
gnc_html_destroy(help->html);
|
||||
if (!help) return;
|
||||
|
||||
gtk_widget_destroy(GTK_WIDGET(help->toplevel));
|
||||
|
||||
help->html = NULL;
|
||||
help->toplevel = NULL;
|
||||
help->statusbar = NULL;
|
||||
help->html_vbox = NULL;
|
||||
help->topics_tree = NULL;
|
||||
|
||||
g_free(help);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1597,8 +1597,6 @@ gnc_ui_destroy_all_subwindows (void)
|
||||
|
||||
gnc_forall_gui_components (NULL, component_handler, info);
|
||||
|
||||
gnc_ui_destroy_report_windows ();
|
||||
|
||||
gnc_resume_gui_refresh ();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* gnc-report-window.c
|
||||
* gnc-report-window.c *
|
||||
* Copyright (C) 1997 Robin D. Clark *
|
||||
* Copyright (C) 1998 Linas Vepstas *
|
||||
* Copyright (C) 1999 Jeremy Collins ( gtk-xmhtml port ) *
|
||||
@ -26,21 +26,26 @@
|
||||
\********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include <gnome.h>
|
||||
|
||||
#include <gnome.h>
|
||||
#include <guile/gh.h>
|
||||
|
||||
#include "glade-gnc-dialogs.h"
|
||||
#include "window-report.h"
|
||||
#include "gnc-html.h"
|
||||
#include "gnc-html-history.h"
|
||||
#include "dialog-options.h"
|
||||
#include "glade-gnc-dialogs.h"
|
||||
#include "gnc-component-manager.h"
|
||||
#include "gnc-html-history.h"
|
||||
#include "gnc-html.h"
|
||||
#include "query-user.h"
|
||||
#include "window-report.h"
|
||||
|
||||
#define WINDOW_REPORT_CM_CLASS "window-report"
|
||||
|
||||
struct _gnc_report_window {
|
||||
GtkWidget * toplevel;
|
||||
GtkWidget * container;
|
||||
GtkWidget * paned;
|
||||
|
||||
gboolean top_level;
|
||||
|
||||
GtkWidget * popup;
|
||||
GtkWidget * back_widg;
|
||||
GtkWidget * fwd_widg;
|
||||
@ -54,9 +59,6 @@ struct _gnc_report_window {
|
||||
gnc_html * html;
|
||||
};
|
||||
|
||||
/* all open report windows... makes cleanup easier */
|
||||
static GList * open_report_windows = NULL;
|
||||
|
||||
|
||||
/********************************************************************
|
||||
* gnc_report_window_check_urltype
|
||||
@ -237,7 +239,7 @@ gnc_report_window_load_cb(gnc_html * html, URLType type,
|
||||
gnc_options_dialog_close_cb,
|
||||
win);
|
||||
}
|
||||
|
||||
|
||||
scm_unprotect_object(win->scm_options);
|
||||
win->scm_options = inst_options;
|
||||
scm_protect_object(win->scm_options);
|
||||
@ -269,8 +271,41 @@ gnc_report_window_load_cb(gnc_html * html, URLType type,
|
||||
|
||||
static void
|
||||
gnc_report_window_destroy_cb(GtkWidget * w, gpointer data) {
|
||||
gnc_report_window * win = data;
|
||||
|
||||
/* delete the window from the open list */
|
||||
if (win->top_level)
|
||||
gnc_unregister_gui_component_by_data (WINDOW_REPORT_CM_CLASS, win);
|
||||
|
||||
gnc_html_destroy(win->html);
|
||||
|
||||
if(win->option_dialog) {
|
||||
gnc_options_dialog_destroy(win->option_dialog);
|
||||
}
|
||||
|
||||
if(win->odb) gnc_option_db_destroy(win->odb);
|
||||
|
||||
win->container = NULL;
|
||||
win->option_dialog = NULL;
|
||||
win->odb = NULL;
|
||||
win->html = NULL;
|
||||
|
||||
scm_unprotect_object(win->scm_options);
|
||||
scm_unprotect_object(win->scm_report);
|
||||
|
||||
g_free(win);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************
|
||||
* gnc_report_window_close_cb
|
||||
********************************************************************/
|
||||
|
||||
static void
|
||||
gnc_report_window_close_cb(GtkWidget * w, gpointer data) {
|
||||
gnc_report_window * rw = data;
|
||||
gnc_report_window_destroy(rw);
|
||||
|
||||
gnc_close_gui_component_by_data (WINDOW_REPORT_CM_CLASS, rw);
|
||||
}
|
||||
|
||||
|
||||
@ -334,6 +369,14 @@ gnc_report_window_history_destroy_cb(gnc_html_history_node * node,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
close_handler (gpointer user_data)
|
||||
{
|
||||
gnc_report_window *win = user_data;
|
||||
|
||||
gnc_report_window_destroy (win);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* gnc_report_window_new
|
||||
* allocates and opens up a report window
|
||||
@ -341,7 +384,7 @@ gnc_report_window_history_destroy_cb(gnc_html_history_node * node,
|
||||
|
||||
gnc_report_window *
|
||||
gnc_report_window_new(GtkWidget * container) {
|
||||
|
||||
|
||||
gnc_report_window * report = g_new0(gnc_report_window, 1);
|
||||
GtkObject * tlo;
|
||||
GtkWidget * toolbar = NULL;
|
||||
@ -416,7 +459,7 @@ gnc_report_window_new(GtkWidget * container) {
|
||||
{ GNOME_APP_UI_ITEM,
|
||||
_("Close"),
|
||||
_("Close this report window"),
|
||||
gnc_report_window_destroy_cb, report,
|
||||
gnc_report_window_close_cb, report,
|
||||
NULL,
|
||||
GNOME_APP_PIXMAP_STOCK,
|
||||
GNOME_STOCK_PIXMAP_CLOSE,
|
||||
@ -437,28 +480,33 @@ gnc_report_window_new(GtkWidget * container) {
|
||||
scm_protect_object(report->scm_report);
|
||||
|
||||
if(container) {
|
||||
report->toplevel = container;
|
||||
report->paned = gtk_hpaned_new();
|
||||
report->container = container;
|
||||
report->top_level = FALSE;
|
||||
report->paned = gtk_hpaned_new();
|
||||
gtk_paned_add2(GTK_PANED(report->paned),
|
||||
gnc_html_get_widget(report->html));
|
||||
gtk_container_add(GTK_CONTAINER(container), report->paned);
|
||||
report->popup = gnome_popup_menu_new(toolbar_data);
|
||||
}
|
||||
else {
|
||||
report->toplevel = create_Report_Window();
|
||||
|
||||
tlo = GTK_OBJECT(report->toplevel);
|
||||
report->container = create_Report_Window();
|
||||
report->top_level = TRUE;
|
||||
|
||||
tlo = GTK_OBJECT(report->container);
|
||||
toolbar = gtk_object_get_data(tlo, "report_toolbar");
|
||||
report->paned = gtk_object_get_data(tlo, "report_paned");
|
||||
|
||||
|
||||
gnome_app_fill_toolbar(GTK_TOOLBAR(toolbar), toolbar_data, NULL);
|
||||
gtk_paned_add2(GTK_PANED(report->paned),
|
||||
gnc_html_get_widget(report->html));
|
||||
|
||||
gnc_register_gui_component (WINDOW_REPORT_CM_CLASS, NULL,
|
||||
close_handler, report);
|
||||
}
|
||||
|
||||
|
||||
report->back_widg = toolbar_data[0].widget;
|
||||
report->fwd_widg = toolbar_data[1].widget;
|
||||
|
||||
|
||||
gtk_paned_set_gutter_size(GTK_PANED(report->paned), 20);
|
||||
gtk_paned_set_position(GTK_PANED(report->paned), 0);
|
||||
|
||||
@ -466,16 +514,15 @@ gnc_report_window_new(GtkWidget * container) {
|
||||
gnc_html_set_load_cb(report->html, gnc_report_window_load_cb, report);
|
||||
gnc_html_set_button_cb(report->html, gnc_report_window_button_cb, report);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(report->toplevel), "destroy",
|
||||
GTK_SIGNAL_FUNC(gnc_report_window_destroy_cb),
|
||||
(gpointer)report);
|
||||
gtk_signal_connect(GTK_OBJECT(report->container), "destroy",
|
||||
GTK_SIGNAL_FUNC(gnc_report_window_destroy_cb),
|
||||
report);
|
||||
|
||||
report->option_dialog = NULL;
|
||||
report->odb = NULL;
|
||||
gtk_widget_show_all(report->toplevel);
|
||||
|
||||
open_report_windows = g_list_append(open_report_windows, report);
|
||||
|
||||
gtk_widget_show_all(report->container);
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
@ -488,34 +535,9 @@ gnc_report_window_new(GtkWidget * container) {
|
||||
void
|
||||
gnc_report_window_destroy(gnc_report_window * win) {
|
||||
|
||||
/* delete the window from the open list */
|
||||
open_report_windows = g_list_remove(open_report_windows, win);
|
||||
if (!win) return;
|
||||
|
||||
gtk_signal_disconnect_by_func(GTK_OBJECT(win->toplevel),
|
||||
GTK_SIGNAL_FUNC(gnc_report_window_destroy_cb),
|
||||
(gpointer)win);
|
||||
|
||||
/* handle the gnc-html carefully */
|
||||
gtk_widget_ref(gnc_html_get_widget(win->html));
|
||||
gnc_html_destroy(win->html);
|
||||
|
||||
if(win->option_dialog) {
|
||||
gtk_widget_ref(gnc_options_dialog_widget(win->option_dialog));
|
||||
gnc_options_dialog_destroy(win->option_dialog);
|
||||
}
|
||||
|
||||
if(win->odb) gnc_option_db_destroy(win->odb);
|
||||
if(win->toplevel) gtk_widget_destroy(GTK_WIDGET(win->toplevel));
|
||||
|
||||
|
||||
win->toplevel = NULL;
|
||||
win->option_dialog = NULL;
|
||||
win->odb = NULL;
|
||||
win->html = NULL;
|
||||
|
||||
scm_unprotect_object(win->scm_options);
|
||||
|
||||
g_free(win);
|
||||
gtk_widget_destroy(GTK_WIDGET(win->container));
|
||||
}
|
||||
|
||||
gnc_html *
|
||||
@ -536,12 +558,3 @@ reportWindow(int report_id) {
|
||||
gnc_report_window * win = gnc_report_window_new(NULL);
|
||||
gnc_report_window_show_report(win, report_id);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gnc_ui_destroy_report_windows(void) {
|
||||
while(open_report_windows != NULL) {
|
||||
gnc_report_window_destroy((gnc_report_window *)open_report_windows->data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,7 @@ gnc_report_window * gnc_report_window_new(GtkWidget * container);
|
||||
void gnc_report_window_destroy(gnc_report_window * rep);
|
||||
void gnc_report_window_show_report(gnc_report_window * rw, int id);
|
||||
gnc_html * gnc_report_window_get_html(gnc_report_window * rw);
|
||||
|
||||
|
||||
void reportWindow(int id);
|
||||
void gnc_ui_destroy_report_windows(void);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user