mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Make the report name for clicking "Print Invoice" a preference.
The implementation of a GtkComboBox in the preference is somewhat suboptimal as the gconf key is the integer index in the combo box, but the needed key is the (untranslated!) string of the report name. As a workaround, the list of names exists twice, once in business-prefs.glade and once in gnc-plugin-business.c. At least this works fine from the point of view of the user. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21715 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
81884c2ed0
commit
8380d447d6
@ -610,17 +610,21 @@ gnc_invoice_window_blankCB (GtkWidget *widget, gpointer data)
|
||||
static void
|
||||
gnc_invoice_window_print_invoice(GncInvoice *invoice)
|
||||
{
|
||||
SCM func, arg;
|
||||
SCM func, arg, arg2;
|
||||
SCM args = SCM_EOL;
|
||||
int report_id;
|
||||
const char *reportname = gnc_plugin_business_get_invoice_printreport();
|
||||
|
||||
g_return_if_fail (invoice);
|
||||
if (!reportname)
|
||||
reportname = "Printable Invoice"; // fallback if the option lookup failed
|
||||
|
||||
func = scm_c_eval_string ("gnc:invoice-report-create");
|
||||
func = scm_c_eval_string ("gnc:invoice-report-create-withname");
|
||||
g_return_if_fail (scm_is_procedure (func));
|
||||
|
||||
arg = SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p__gncInvoice"), 0);
|
||||
args = scm_cons (arg, args);
|
||||
arg2 = scm_from_locale_string(reportname);
|
||||
args = scm_cons2 (arg, arg2, args);
|
||||
|
||||
/* scm_gc_protect_object(func); */
|
||||
|
||||
|
@ -1169,3 +1169,24 @@ static void gnc_plugin_business_add_to_window (GncPlugin *plugin,
|
||||
G_CALLBACK(gnc_plugin_business_main_window_page_changed),
|
||||
plugin);
|
||||
}
|
||||
|
||||
static const char* invoice_printreport_values[] =
|
||||
{
|
||||
// FIXME: You must manually keep this list in sync with the one at the end
|
||||
// of business-prefs.glade
|
||||
"Printable Invoice",
|
||||
"Tax Invoice",
|
||||
"Easy Invoice",
|
||||
"Fancy Invoice",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *gnc_plugin_business_get_invoice_printreport(void)
|
||||
{
|
||||
int value = gnc_gconf_get_int(GCONF_SECTION_INVOICE,
|
||||
"invoice_printreport", NULL);
|
||||
if (value >= 0 && value < 4)
|
||||
return invoice_printreport_values[value];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
@ -62,5 +62,6 @@ G_END_DECLS
|
||||
GncMainWindow *gnc_plugin_business_get_window (void);
|
||||
void gnc_invoice_remind_bills_due (void);
|
||||
void gnc_invoice_remind_bills_due_cb (void);
|
||||
const char *gnc_plugin_business_get_invoice_printreport(void);
|
||||
|
||||
#endif /* __GNC_PLUGIN_BUSINESS_H */
|
||||
|
@ -113,7 +113,7 @@ libgncmod_business_gnome_gnc_module_init(int refcount)
|
||||
|
||||
/* Add to preferences under Business */
|
||||
/* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */
|
||||
gnc_preferences_add_page("business-prefs.glade", "days_in_adj,business_prefs",
|
||||
gnc_preferences_add_page("business-prefs.glade", "liststore_printinvoice,days_in_adj,business_prefs",
|
||||
_("Business"));
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="2.16"/>
|
||||
<!-- interface-naming-policy project-wide -->
|
||||
@ -11,7 +11,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="n_rows">9</property>
|
||||
<property name="n_rows">10</property>
|
||||
<property name="n_columns">4</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
@ -57,8 +57,8 @@
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="x_padding">12</property>
|
||||
@ -84,8 +84,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -102,8 +102,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -123,8 +123,8 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="x_padding">12</property>
|
||||
@ -140,8 +140,8 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -261,6 +261,44 @@
|
||||
<property name="x_padding">12</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="gconf/dialogs/business/invoice/invoice_printreport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">liststore_printinvoice</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext2"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xpad">10</property>
|
||||
<property name="label" translatable="yes">Report for printing:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
@ -325,4 +363,24 @@
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkListStore" id="liststore_printinvoice">
|
||||
<columns>
|
||||
<!-- column-name item -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Printable Invoice</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Tax Invoice</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Easy Invoice</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Fancy Invoice</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
</interface>
|
||||
|
@ -62,6 +62,20 @@
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/business/invoice/invoice_printreport</key>
|
||||
<applyto>/apps/gnucash/dialogs/business/invoice/invoice_printreport</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>The invoice report to be used for printing</short>
|
||||
<long>
|
||||
The name of the report to be used for invoice printing.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/dialogs/business/invoice/use_new_window</key>
|
||||
<applyto>/apps/gnucash/dialogs/business/invoice/use_new_window</applyto>
|
||||
|
Loading…
Reference in New Issue
Block a user