add some handy-dandy utility functions to set the label text

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8864 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2003-07-13 04:53:20 +00:00
parent 6c4b3c40b7
commit 67766c1cb0
2 changed files with 44 additions and 4 deletions

View File

@ -1,6 +1,7 @@
/********************************************************************\ /********************************************************************\
* gnc-frequency.c -- GnuCash widget for frequency editing. * * gnc-frequency.c -- GnuCash widget for frequency editing. *
* Copyright (C) 2001,2002 Joshua Sled <jsled@asynchronous.org> * * Copyright (C) 2001,2002 Joshua Sled <jsled@asynchronous.org> *
* Copyright (C) 2003 Linas Vepstas <linas@linas.org> *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as * * modify it under the terms of the GNU General Public License as *
@ -1124,3 +1125,26 @@ start_date_changed( GNCDateEdit *gde, gpointer d )
} }
gtk_signal_emit_by_name( GTK_OBJECT(gf), "changed", NULL ); gtk_signal_emit_by_name( GTK_OBJECT(gf), "changed", NULL );
} }
/* ================================================================= */
/* Relabel some of the labels */
void
gnc_frequency_set_frequency_label_text (GNCFrequency *gf, const gchar *txt)
{
GtkLabel *lbl;
if (!gf || !txt) return;
lbl = GTK_LABEL (glade_xml_get_widget (gf->gxml, "freq label"));
gtk_label_set_text (lbl, txt);
}
void
gnc_frequency_set_startdate_label_text (GNCFrequency *gf, const gchar *txt)
{
GtkLabel *lbl;
if (!gf || !txt) return;
lbl = GTK_LABEL (glade_xml_get_widget (gf->gxml, "startdate label"));
gtk_label_set_text (lbl, txt);
}
/* ========================= END OF FILE =========================== */

View File

@ -1,6 +1,7 @@
/********************************************************************\ /********************************************************************\
* gnc-frequency.h -- GnuCash widget for frequency editing. * * gnc-frequency.h -- GnuCash widget for frequency editing. *
* Copyright (C) 2001,2002 Joshua Sled <jsled@asynchronous.org> * * Copyright (C) 2001,2002 Joshua Sled <jsled@asynchronous.org> *
* Copyright (C) 2003 Linas Vepstas <linas@linas.org> *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as * * modify it under the terms of the GNU General Public License as *
@ -41,7 +42,8 @@ BEGIN_GNOME_DECLS
* transaction or budgeting category, for instance], manipulating a FreqSpec * transaction or budgeting category, for instance], manipulating a FreqSpec
* object in the process. * object in the process.
**/ **/
typedef struct _GNCFrequency { typedef struct _GNCFrequency
{
GtkVBox widget; GtkVBox widget;
GtkVBox *vb; GtkVBox *vb;
@ -51,12 +53,14 @@ typedef struct _GNCFrequency {
GladeXML *gxml; GladeXML *gxml;
} GNCFrequency; } GNCFrequency;
typedef struct _GNCFrequencyClass { typedef struct _GNCFrequencyClass
{
GtkVBoxClass parent_class; GtkVBoxClass parent_class;
void (*changed) (GNCFrequency *gf); void (*changed) (GNCFrequency *gf);
} GNCFrequencyClass; } GNCFrequencyClass;
struct pageDataTuple { struct pageDataTuple
{
int idx; int idx;
UIFreqType uiFTVal; UIFreqType uiFTVal;
char *name; char *name;
@ -69,6 +73,7 @@ guint gnc_frequency_get_type( void );
**/ **/
GtkWidget * gnc_frequency_new( FreqSpec *fs, GDate *startDate ); GtkWidget * gnc_frequency_new( FreqSpec *fs, GDate *startDate );
void gnc_frequency_init( GNCFrequency *gf ); void gnc_frequency_init( GNCFrequency *gf );
/** /**
* Sets up the given GNCFrequency with the given FreqSpec and * Sets up the given GNCFrequency with the given FreqSpec and
* UIFreqSpec. If the FreqSpec is NULL, then the default value is * UIFreqSpec. If the FreqSpec is NULL, then the default value is
@ -85,6 +90,17 @@ void gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs, GDate *startDate );
**/ **/
void gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate ); void gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate );
/**
* Set the label text for the frequency option menu. In the current
* implementation, the default label text is "Frequency:"
*/
void gnc_frequency_set_frequency_label_text (GNCFrequency *gf, const gchar *txt);
/**
* Set the label text for the start-date entry widget. In the current
* impelmentation, the default label text is "Start Date:"
*/
void gnc_frequency_set_startdate_label_text (GNCFrequency *gf, const gchar *txt);
END_GNOME_DECLS END_GNOME_DECLS
#endif /* !defined( GNC_FREQUENCY_H ) */ #endif /* !defined( GNC_FREQUENCY_H ) */