* src/gnome/dialog-style-sheet.h: remove

* src/gnome/dialog-style-sheet.c: remove

* src/gnome/dialog-column-view.h: remove

* src/gnome/dialog-column-view.c: remove

* src/gnome/gw-gnc-spec.scm: remove report-related wrapping

* src/gnome/Makefile.am: remove deleted files


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6305 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2001-12-11 00:43:40 +00:00
parent 26198e561e
commit e861014dfe
6 changed files with 0 additions and 881 deletions
-4
View File
@@ -24,7 +24,6 @@ libgw_gnc_la_LIBADD =
libgncgnome_la_SOURCES = \
argv-list-converters.c \
dialog-column-view.c \
dialog-commodities.c \
dialog-fincalc.c \
dialog-find-transactions.c \
@@ -32,7 +31,6 @@ libgncgnome_la_SOURCES = \
dialog-price-editor.c \
dialog-print-check.c \
dialog-progress.c \
dialog-style-sheet.c \
dialog-sx-from-trans.c \
dialog-sxsincelast.c \
dialog-tax-info.c \
@@ -67,13 +65,11 @@ mime_DATA = gnucash.keys gnucash.mime
noinst_HEADERS = \
argv-list-converters.h \
dialog-column-view.h \
dialog-fincalc.h \
dialog-find-transactions.h \
dialog-new-user.h \
dialog-print-check.h \
dialog-progress.h \
dialog-style-sheet.h \
dialog-sx-from-trans.h \
dialog-sxsincelast.h \
dialog-totd.h \
-504
View File
@@ -1,504 +0,0 @@
/********************************************************************
* dialog-column-view.c -- editor for simple column view of reports *
* Copyright (C) 2001 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
********************************************************************/
#include "config.h"
#include <gnome.h>
#include <guile/gh.h>
#include <g-wrap-runtime-guile.h>
#include "dialog-column-view.h"
#include "dialog-options.h"
#include "dialog-utils.h"
#include "messages.h"
#include "option-util.h"
#include "window-report.h"
struct gncp_column_view_edit {
GNCOptionWin * optwin;
GtkCList * available;
GtkCList * contents;
SCM options;
SCM view;
GNCOptionDB * odb;
SCM available_list;
int available_selected;
SCM contents_list;
int contents_selected;
};
static void gnc_column_view_edit_add_cb(GtkButton * button,
gpointer user_data);
static void gnc_column_view_edit_remove_cb(GtkButton * button,
gpointer user_data);
static void gnc_edit_column_view_move_up_cb(GtkButton * button,
gpointer user_data);
static void gnc_edit_column_view_move_down_cb(GtkButton * button,
gpointer user_data);
static void gnc_column_view_edit_size_cb(GtkButton * button,
gpointer user_data);
static void
gnc_column_view_set_option(GNCOptionDB * odb, char * section, char * name,
SCM new_value) {
GNCOption * option =
gnc_option_db_get_option_by_name(odb, section, name);
if(option)
{
gnc_option_db_set_option(odb, section, name, new_value);
/* set_option doesn't do this */
gnc_option_set_changed (option, TRUE);
}
}
static void
gnc_column_view_edit_destroy(gnc_column_view_edit * view) {
gnc_options_dialog_destroy(view->optwin);
scm_unprotect_object(view->options);
scm_unprotect_object(view->view);
gnc_option_db_destroy(view->odb);
g_free(view);
}
static void
update_display_lists(gnc_column_view_edit * view) {
SCM get_names = gh_eval_str("gnc:all-report-template-names");
SCM template_menu_name = gh_eval_str("gnc:report-template-menu-name/name");
SCM report_menu_name = gh_eval_str("gnc:report-menu-name");
SCM find_report = gh_eval_str("gnc:find-report");
SCM names = gh_call0(get_names);
SCM contents =
gnc_option_db_lookup_option(view->odb, "__general", "report-list",
SCM_BOOL_F);
SCM this_report, this_name;
SCM selection;
char * name[3];
int row, i;
/* Update the list of available reports (left selection box). */
row = view->available_selected;
if(gh_list_p(view->available_list) && !gh_null_p (view->available_list)) {
row = MIN (row, gh_length (view->available_list) - 1);
selection = gh_list_ref (view->available_list, gh_int2scm (row));
}
else {
selection = SCM_UNDEFINED;
}
scm_unprotect_object(view->available_list);
view->available_list = names;
scm_protect_object(view->available_list);
gtk_clist_freeze(view->available);
gtk_clist_clear(view->available);
if(gh_list_p(names)) {
for(i = 0; !gh_null_p(names); names = gh_cdr(names), i++) {
if (gh_equal_p (gh_car(names), selection))
row = i;
name[0] = gh_scm2newstr(gh_call1(template_menu_name, gh_car(names)),
NULL);
gtk_clist_append(view->available, name);
free(name[0]);
}
}
gtk_clist_select_row(view->available, row, 0);
gtk_clist_thaw(view->available);
/* Update the list of selected reports (right selection box). */
row = view->contents_selected;
if(gh_list_p(view->contents_list) && !gh_null_p (view->contents_list)) {
row = MIN (row, gh_length (view->contents_list) - 1);
selection = gh_list_ref (view->contents_list, gh_int2scm (row));
}
else {
selection = SCM_UNDEFINED;
}
scm_unprotect_object(view->contents_list);
view->contents_list = contents;
scm_protect_object(view->contents_list);
gtk_clist_freeze(view->contents);
gtk_clist_clear(view->contents);
if(gh_list_p(contents)) {
for(i = 0; !gh_null_p(contents); contents = gh_cdr(contents), i++) {
if (gh_equal_p (gh_car(contents), selection))
row = i;
this_report = gh_call1(find_report, gh_caar(contents));
/* this_name = gh_call1(report_name, this_report); */
this_name = gh_call1(report_menu_name, this_report);
name[0] = gh_scm2newstr(this_name, NULL);
name[1] = g_strdup_printf("%d", gh_scm2int(gh_cadr(gh_car(contents))));
name[2] = g_strdup_printf("%d", gh_scm2int(gh_caddr(gh_car(contents))));
gtk_clist_append(view->contents, name);
free(name[0]);
g_free(name[1]);
g_free(name[2]);
}
}
gtk_clist_select_row(view->contents, row, 0);
gtk_clist_thaw(view->contents);
gnc_clist_columns_autosize (view->available);
gnc_clist_columns_autosize (view->contents);
}
static void
gnc_column_view_select_avail_cb(GtkCList * clist, gint row, gint col,
GdkEvent * ev, gpointer data) {
gnc_column_view_edit * r = data;
r->available_selected = row;
}
static void
gnc_column_view_select_contents_cb(GtkCList * clist, gint row, gint col,
GdkEvent * ev, gpointer data) {
gnc_column_view_edit * r = data;
r->contents_selected = row;
}
static void
gnc_column_view_edit_apply_cb(GNCOptionWin * w, gpointer user_data) {
SCM dirty_report = gh_eval_str("gnc:report-set-dirty?!");
gnc_column_view_edit * win = user_data;
if(!win) return;
gnc_option_db_commit(win->odb);
gh_call2(dirty_report, win->view, SCM_BOOL_T);
}
static void
gnc_column_view_edit_close_cb(GNCOptionWin * win, gpointer user_data) {
gnc_column_view_edit * r = user_data;
SCM set_editor = gh_eval_str("gnc:report-set-editor-widget!");
gh_call2(set_editor, r->view, SCM_BOOL_F);
gnc_column_view_edit_destroy(r);
}
/********************************************************************
* gnc_column_view_edit_options
* create the editor.
********************************************************************/
GtkWidget *
gnc_column_view_edit_options(SCM options, SCM view) {
SCM get_editor = gh_eval_str("gnc:report-editor-widget");
SCM ptr;
GtkWidget * editor;
ptr = gh_call1(get_editor, view);
if(ptr != SCM_BOOL_F) {
GtkWidget * w = gw_wcp_get_ptr(ptr);
gdk_window_raise(GTK_WIDGET(w)->window);
return NULL;
}
else {
gnc_column_view_edit * r = g_new0(gnc_column_view_edit, 1);
GladeXML *xml;
r->optwin = gnc_options_dialog_new(TRUE, NULL);
xml = gnc_glade_xml_new ("report.glade", "view_contents_hbox");
glade_xml_signal_connect_data
(xml, "gnc_column_view_edit_add_cb",
GTK_SIGNAL_FUNC (gnc_column_view_edit_add_cb), r);
glade_xml_signal_connect_data
(xml, "gnc_column_view_edit_remove_cb",
GTK_SIGNAL_FUNC (gnc_column_view_edit_remove_cb), r);
glade_xml_signal_connect_data
(xml, "gnc_edit_column_view_move_up_cb",
GTK_SIGNAL_FUNC (gnc_edit_column_view_move_up_cb), r);
glade_xml_signal_connect_data
(xml, "gnc_edit_column_view_move_down_cb",
GTK_SIGNAL_FUNC (gnc_edit_column_view_move_down_cb), r);
glade_xml_signal_connect_data
(xml, "gnc_column_view_edit_size_cb",
GTK_SIGNAL_FUNC (gnc_column_view_edit_size_cb), r);
editor = glade_xml_get_widget (xml, "view_contents_hbox");
r->available = GTK_CLIST (glade_xml_get_widget (xml, "available_list"));
r->contents = GTK_CLIST (glade_xml_get_widget (xml, "contents_list"));
r->options = options;
r->view = view;
r->available_selected = 0;
r->available_list = SCM_EOL;
r->contents_selected = 0;
r->contents_list = SCM_EOL;
r->odb = gnc_option_db_new(r->options);
gnc_build_options_dialog_contents(r->optwin, r->odb);
gtk_notebook_append_page(GTK_NOTEBOOK(gnc_options_dialog_notebook
(r->optwin)),
editor,
gtk_label_new(_("Contents")));
scm_protect_object(r->options);
scm_protect_object(r->view);
scm_protect_object(r->available_list);
scm_protect_object(r->contents_list);
gtk_signal_connect(GTK_OBJECT(r->available), "select_row",
gnc_column_view_select_avail_cb, (gpointer)r);
gtk_signal_connect(GTK_OBJECT(r->contents), "select_row",
gnc_column_view_select_contents_cb, (gpointer)r);
update_display_lists(r);
gtk_clist_column_titles_passive (r->available);
gtk_clist_column_titles_passive (r->contents);
gnc_options_dialog_set_apply_cb(r->optwin,
gnc_column_view_edit_apply_cb, r);
gnc_options_dialog_set_close_cb(r->optwin,
gnc_column_view_edit_close_cb, r);
gtk_widget_show_all(gnc_options_dialog_widget(r->optwin));
return gnc_options_dialog_widget(r->optwin);
}
}
static void
gnc_column_view_edit_add_cb(GtkButton * button, gpointer user_data) {
gnc_column_view_edit * r = user_data;
SCM make_report = gh_eval_str("gnc:make-report");
SCM mark_report = gh_eval_str("gnc:report-set-needs-save?!");
SCM find_report = gh_eval_str("gnc:find-report");
SCM template_name;
SCM new_report;
SCM newlist = SCM_EOL;
SCM oldlist = r->contents_list;
int count;
int oldlength;
if(gh_list_p(r->available_list) &&
(gh_length(r->available_list) > r->available_selected)) {
template_name = gh_list_ref(r->available_list,
gh_int2scm(r->available_selected));
new_report = gh_call1(make_report, template_name);
gh_call2(mark_report, gh_call1(find_report, new_report), SCM_BOOL_T);
oldlength = gh_length(r->contents_list);
if(oldlength > r->contents_selected) {
for(count = 0; count < r->contents_selected; count++) {
newlist = gh_cons(gh_car(oldlist), newlist);
oldlist = gh_cdr(oldlist);
}
newlist = gh_append2(gh_reverse(gh_cons(SCM_LIST4(new_report,
gh_int2scm(1),
gh_int2scm(1),
SCM_BOOL_F),
newlist)),
oldlist);
}
else {
newlist = gh_append2(oldlist,
SCM_LIST1(SCM_LIST4(new_report,
gh_int2scm(1),
gh_int2scm(1),
SCM_BOOL_F)));
r->contents_selected = oldlength;
}
scm_unprotect_object(r->contents_list);
r->contents_list = newlist;
scm_protect_object(r->contents_list);
gnc_column_view_set_option(r->odb, "__general", "report-list",
r->contents_list);
gnc_options_dialog_changed (r->optwin);
}
update_display_lists(r);
}
static void
gnc_column_view_edit_remove_cb(GtkButton * button, gpointer user_data) {
gnc_column_view_edit * r = user_data;
SCM newlist = SCM_EOL;
SCM oldlist = r->contents_list;
int count;
int oldlength;
if(gh_list_p(r->contents_list)) {
oldlength = gh_length(r->contents_list);
if(oldlength > r->contents_selected) {
for(count=0; count < r->contents_selected; count++) {
newlist = gh_cons(gh_car(oldlist), newlist);
oldlist = gh_cdr(oldlist);
}
if(count <= oldlength) {
newlist = gh_append2(gh_reverse(newlist), gh_cdr(oldlist));
}
}
if(oldlength == r->contents_selected + 1) {
r->contents_selected --;
}
scm_unprotect_object(r->contents_list);
r->contents_list = newlist;
scm_protect_object(r->contents_list);
gnc_column_view_set_option(r->odb, "__general", "report-list",
r->contents_list);
gnc_options_dialog_changed (r->optwin);
}
update_display_lists(r);
}
static void
gnc_edit_column_view_move_up_cb(GtkButton * button, gpointer user_data) {
gnc_column_view_edit * r = user_data;
SCM oldlist = r->contents_list;
SCM newlist = SCM_EOL;
SCM temp;
int oldlength;
int count;
oldlength = gh_length(r->contents_list);
if((r->contents_selected > 0) && (oldlength > r->contents_selected)) {
for(count = 1; count < r->contents_selected; count++) {
newlist = gh_cons(gh_car(oldlist), newlist);
oldlist = gh_cdr(oldlist);
}
temp = gh_car(oldlist);
oldlist = gh_cdr(oldlist);
newlist = gh_cons(temp, gh_cons(gh_car(oldlist), newlist));
newlist = gh_append2(gh_reverse(newlist), gh_cdr(oldlist));
scm_unprotect_object(r->contents_list);
r->contents_list = newlist;
scm_protect_object(r->contents_list);
r->contents_selected = r->contents_selected - 1;
gnc_column_view_set_option(r->odb, "__general", "report-list",
r->contents_list);
gnc_options_dialog_changed (r->optwin);
update_display_lists(r);
}
}
static void
gnc_edit_column_view_move_down_cb(GtkButton * button, gpointer user_data) {
gnc_column_view_edit * r = user_data;
SCM oldlist = r->contents_list;
SCM newlist = SCM_EOL;
SCM temp;
int oldlength;
int count;
oldlength = gh_length(r->contents_list);
if(oldlength > (r->contents_selected + 1)) {
for(count = 0; count < r->contents_selected; count++) {
newlist = gh_cons(gh_car(oldlist), newlist);
oldlist = gh_cdr(oldlist);
}
temp = gh_car(oldlist);
oldlist = gh_cdr(oldlist);
newlist = gh_cons(temp, gh_cons(gh_car(oldlist), newlist));
newlist = gh_append2(gh_reverse(newlist), gh_cdr(oldlist));
scm_unprotect_object(r->contents_list);
r->contents_list = newlist;
scm_protect_object(r->contents_list);
r->contents_selected = r->contents_selected + 1;
gnc_column_view_set_option(r->odb, "__general", "report-list",
r->contents_list);
gnc_options_dialog_changed (r->optwin);
update_display_lists(r);
}
}
static void
gnc_column_view_edit_size_cb(GtkButton * button, gpointer user_data) {
gnc_column_view_edit * r = user_data;
GtkWidget * rowspin;
GtkWidget * colspin;
GtkWidget * dlg;
GladeXML *xml;
SCM current;
int length;
int dlg_ret;
xml = gnc_glade_xml_new ("report.glade", "Edit Report Size");
dlg = glade_xml_get_widget (xml, "Edit Report Size");
/* get the spinner widgets */
rowspin = glade_xml_get_widget (xml, "row_spin");
colspin = glade_xml_get_widget (xml, "col_spin");
length = gh_length(r->contents_list);
if(length > r->contents_selected) {
current = gh_list_ref(r->contents_list,
gh_int2scm(r->contents_selected));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(colspin),
(float)gh_scm2int(gh_cadr(current)));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(rowspin),
(float)gh_scm2int(gh_caddr(current)));
dlg_ret = gnome_dialog_run_and_close(GNOME_DIALOG(dlg));
if(dlg_ret == 0) {
current = SCM_LIST4(gh_car(current),
gh_int2scm(gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(colspin))),
gh_int2scm(gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(rowspin))),
SCM_BOOL_F);
scm_unprotect_object(r->contents_list);
r->contents_list = scm_list_set_x(r->contents_list,
gh_int2scm(r->contents_selected),
current);
scm_protect_object(r->contents_list);
gnc_options_dialog_changed (r->optwin);
update_display_lists(r);
}
}
}
-27
View File
@@ -1,27 +0,0 @@
/********************************************************************
* dialog-column-view.h -- editor for simple column view *
* Copyright (C) 2001 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
********************************************************************/
#include <guile/gh.h>
typedef struct gncp_column_view_edit gnc_column_view_edit;
GtkWidget * gnc_column_view_edit_options(SCM options, SCM view);
-272
View File
@@ -1,272 +0,0 @@
/********************************************************************
* dialog-style-sheet.c -- window for configuring HTML style *
* sheets in GnuCash *
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
********************************************************************/
#include "config.h"
#include <gnome.h>
#include "dialog-style-sheet.h"
#include "dialog-options.h"
#include "dialog-utils.h"
#include "messages.h"
StyleSheetDialog * gnc_style_sheet_dialog = NULL;
struct _stylesheetdialog {
GtkWidget * toplevel;
GtkWidget * list;
GtkWidget * options_frame;
struct ss_info * selection;
};
struct ss_info {
GNCOptionWin * odialog;
GNCOptionDB * odb;
SCM stylesheet;
};
static void
gnc_style_sheet_options_apply_cb(GNCOptionWin * propertybox,
gpointer user_data) {
struct ss_info * ssi = (struct ss_info *)user_data;
SCM apply_changes = gh_eval_str("gnc:html-style-sheet-apply-changes");
gnc_option_db_commit(ssi->odb);
gh_call1(apply_changes, ssi->stylesheet);
}
static void
gnc_style_sheet_options_close_cb(GNCOptionWin * propertybox,
gpointer user_data) {
StyleSheetDialog * ss = user_data;
gtk_widget_hide(GTK_WIDGET(ss->toplevel));
}
static void
gnc_style_sheet_dialog_select_cb(GtkCList * list, gint row, gint col,
GdkEvent * ev, gpointer user_data) {
StyleSheetDialog * ssd = (StyleSheetDialog *)user_data;
struct ss_info * ssinfo = gtk_clist_get_row_data(list, row);
GList * children = gtk_container_children(GTK_CONTAINER(ssd->options_frame));
if(children) {
gtk_container_remove(GTK_CONTAINER(ssd->options_frame),
GTK_WIDGET(children->data));
}
gtk_container_add(GTK_CONTAINER(ssd->options_frame),
gnc_options_dialog_widget(ssinfo->odialog));
gtk_widget_show(gnc_options_dialog_widget(ssinfo->odialog));
gtk_widget_show(ssd->options_frame);
ssd->selection = ssinfo;
}
static void
row_data_destroy_cb(gpointer data) {
struct ss_info * ss = data;
gnc_option_db_destroy(ss->odb);
gnc_options_dialog_destroy(ss->odialog);
scm_unprotect_object(ss->stylesheet);
g_free(ss);
}
static void
gnc_style_sheet_dialog_fill(StyleSheetDialog * ss, SCM selected) {
SCM stylesheets = gh_eval_str("(gnc:get-html-style-sheets)");
SCM get_options = gh_eval_str("gnc:html-style-sheet-options");
SCM get_name = gh_eval_str("gnc:html-style-sheet-name");
int sel_row = 0;
/* pack it full of content */
for(; !gh_null_p(stylesheets); stylesheets=gh_cdr(stylesheets)) {
SCM scm_name = gh_call1(get_name, gh_car(stylesheets));
SCM scm_options = gh_call1(get_options, gh_car(stylesheets));
struct ss_info * ssinfo = g_new0(struct ss_info, 1);
int this_row;
char * c_names[1];
char * c_name;
/* make the options DB and dialog, but don't parent it yet */
ssinfo->odialog = gnc_options_dialog_new(FALSE, NULL);
ssinfo->odb = gnc_option_db_new(scm_options);
ssinfo->stylesheet = gh_car(stylesheets);
scm_protect_object(ssinfo->stylesheet);
gtk_widget_ref(gnc_options_dialog_widget(ssinfo->odialog));
gnc_build_options_dialog_contents(ssinfo->odialog,
ssinfo->odb);
gnc_options_dialog_set_apply_cb(ssinfo->odialog,
gnc_style_sheet_options_apply_cb,
ssinfo);
gnc_options_dialog_set_close_cb(ssinfo->odialog,
gnc_style_sheet_options_close_cb,
ss);
/* add the column name */
c_name = gh_scm2newstr(scm_name, NULL);
if (!c_name)
continue;
c_names[0] = _(c_name);
this_row = gtk_clist_append(GTK_CLIST(ss->list), c_names);
free (c_name);
gtk_clist_set_row_data_full(GTK_CLIST(ss->list), this_row,
(gpointer)ssinfo,
row_data_destroy_cb);
if(gh_eq_p(selected, gh_car(stylesheets))) {
sel_row = this_row;
}
}
gtk_clist_select_row(GTK_CLIST(ss->list), sel_row, 0);
}
static void
gnc_style_sheet_new_cb(GtkWidget * w, gpointer user_data) {
StyleSheetDialog * ssd = user_data;
SCM make_ss = gh_eval_str("gnc:make-html-style-sheet");
SCM templates = gh_eval_str("(gnc:get-html-templates)");
SCM t_name = gh_eval_str("gnc:html-style-sheet-template-name");
GtkWidget * template_entry;
GtkWidget * name_entry;
GtkWidget * template_combo;
GList * strings=NULL;
GList * lptr;
gint dialog_retval;
char * template_str = NULL;
char * name_str = NULL;
/* get the new name for the style sheet */
GladeXML *xml = gnc_glade_xml_new ("report.glade",
"New Style Sheet Dialog");
GtkWidget * dlg = glade_xml_get_widget (xml, "New Style Sheet Dialog");
template_entry = glade_xml_get_widget (xml, "template_entry");
template_combo = glade_xml_get_widget (xml, "template_combo");
name_entry = glade_xml_get_widget (xml, "name_entry");
/* put in the list of style sheet type names */
for(; !gh_null_p(templates); templates=gh_cdr(templates)) {
SCM t = gh_car(templates);
strings = g_list_append(strings, gh_scm2newstr(gh_call1(t_name, t),
NULL));
}
gtk_combo_set_popdown_strings(GTK_COMBO(template_combo), strings);
/* free the strings list */
for(lptr = strings; lptr; lptr = lptr->next) {
free(lptr->data);
}
g_list_free(strings);
/* get the name */
dialog_retval = gnome_dialog_run(GNOME_DIALOG(dlg));
if(dialog_retval == 0) {
template_str = gtk_entry_get_text(GTK_ENTRY(template_entry));
name_str = gtk_entry_get_text(GTK_ENTRY(name_entry));
if(template_str && name_str) {
SCM new_ss = gh_call2(make_ss,
gh_str02scm(template_str),
gh_str02scm(name_str));
gtk_clist_clear(GTK_CLIST(ssd->list));
gnc_style_sheet_dialog_fill(ssd, new_ss);
}
}
gnome_dialog_close(GNOME_DIALOG(dlg));
}
static void
gnc_style_sheet_delete_cb(GtkWidget * w, gpointer user_data) {
StyleSheetDialog * ssd = user_data;
struct ss_info * ssi = ssd->selection;
SCM remover = gh_eval_str("gnc:html-style-sheet-remove");
gh_call1(remover, ssi->stylesheet);
gtk_clist_clear(GTK_CLIST(ssd->list));
gnc_style_sheet_dialog_fill(ssd, SCM_BOOL_F);
}
static int
gnc_style_sheet_dialog_close_cb(GtkWidget * w, GdkEventAny * ev,
gpointer user_data) {
StyleSheetDialog * ss = user_data;
gtk_widget_hide(GTK_WIDGET(ss->toplevel));
return TRUE;
}
static StyleSheetDialog *
gnc_style_sheet_dialog_create() {
StyleSheetDialog * ss = g_new0(StyleSheetDialog, 1);
GtkWidget * new_button=NULL;
GtkWidget * delete_button=NULL;
GladeXML * xml;
xml = gnc_glade_xml_new ("report.glade", "HTML Style Sheet Dialog");
ss->toplevel = glade_xml_get_widget (xml, "HTML Style Sheet Dialog");
ss->list = glade_xml_get_widget (xml, "style_sheet_list");
ss->options_frame = glade_xml_get_widget (xml, "style_sheet_options");
new_button = glade_xml_get_widget (xml, "new_button");
delete_button = glade_xml_get_widget (xml, "delete_button");
gtk_signal_connect(GTK_OBJECT(ss->list), "select_row",
GTK_SIGNAL_FUNC(gnc_style_sheet_dialog_select_cb), ss);
gtk_signal_connect(GTK_OBJECT(new_button), "clicked",
GTK_SIGNAL_FUNC(gnc_style_sheet_new_cb), ss);
gtk_signal_connect(GTK_OBJECT(delete_button), "clicked",
GTK_SIGNAL_FUNC(gnc_style_sheet_delete_cb), ss);
gtk_signal_connect(GTK_OBJECT(ss->toplevel), "delete_event",
GTK_SIGNAL_FUNC(gnc_style_sheet_dialog_close_cb), ss);
gnc_style_sheet_dialog_fill(ss, SCM_BOOL_F);
gtk_window_set_policy(GTK_WINDOW(ss->toplevel), TRUE, TRUE, FALSE);
gtk_clist_columns_autosize (GTK_CLIST (ss->list));
gtk_widget_show(ss->toplevel);
return ss;
}
void
gnc_style_sheet_dialog_open(void) {
if(gnc_style_sheet_dialog) {
gtk_widget_show(gnc_style_sheet_dialog->toplevel);
}
else {
gnc_style_sheet_dialog =
gnc_style_sheet_dialog_create();
}
}
-31
View File
@@ -1,31 +0,0 @@
/********************************************************************
* dialog-style-sheet.h -- window for configuring HTML style *
* sheets in GnuCash *
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
********************************************************************/
#ifndef GNC_DIALOG_STYLE_SHEET_H
#define GNC_DIALOG_STYLE_SHEET_H
typedef struct _stylesheetdialog StyleSheetDialog;
void gnc_style_sheet_dialog_open(void);
#endif
-43
View File
@@ -55,30 +55,20 @@
"#include <gnc-numeric.h>\n"
"#include <window-main.h>\n"
"#include <gnc-gui-query.h>\n"
"#include <dialog-column-view.h>\n"
"#include <dialog-new-user.h>\n"
"#include <dialog-print-check.h>\n"
"#include <dialog-progress.h>\n"
"#include <dialog-style-sheet.h>\n"
"#include <dialog-totd.h>\n"
"#include <dialog-commodity.h>\n"
"#include <druid-hierarchy.h>\n"
"#include <top-level.h>\n"
"#include <window-help.h>\n"
"#include <window-report.h>\n"
"#include <window-main.h>\n"
"#include <gnc-html.h>\n"
"#include <dialog-find-transactions.h>\n"
"#include <dialog-scheduledxaction.h>\n"
"#include <dialog-sxsincelast.h>\n" )))
(let ((nnt (gw:wrap-non-native-type
mod
'<gnc:column-view-edit*>
"gnc_column_view_edit*" "const gnc_column_view_edit*")))
#t)
(gw:wrap-function
mod
'gnc:ui-hierarchy-druid
@@ -143,22 +133,6 @@
'()
"Destroy the UI.")
(gw:wrap-function
mod
'gnc:main-window-open-report
'<gw:void>
"gnc_main_window_open_report"
'((<gw:int> report-id) (<gw:bool> top-level))
"Show report window")
(gw:wrap-function
mod
'gnc:style-sheet-dialog-open
'<gw:void>
"gnc_style_sheet_dialog_open"
'()
"Show the style sheet editor window.")
(gw:wrap-function
mod
'gnc:info-dialog
@@ -307,22 +281,6 @@ sensitive and the dialog closes after the user clicks it.")
order to destroy the dialog. The dialog will not be destroyed
by the user closing the window.")
(gw:wrap-function
mod
'gnc:default-options-editor
'<gnc:UIWidget>
"gnc_report_window_default_params_editor"
'((<gw:scm> options) (<gw:scm> report))
"Default options editor window for reports")
(gw:wrap-function
mod
'gnc:column-view-edit-options
'<gnc:UIWidget>
"gnc_column_view_edit_options"
'((<gw:scm> options) (<gw:scm> view))
"Create an editor for a column-view options object")
(gw:wrap-function
mod
'gnc:sx-editor
@@ -343,5 +301,4 @@ by the user closing the window.")
'<gw:bool>
"gnc_ui_sxsincelast_guile_wrapper" '(((<gw:m-chars-caller-owned>) bookfile))
"Wrapper to open the since-last-run dialog from a book-open hook." )
)