From b7a526e646eb71a9ebcc3a1afd18d5da12eaed8c Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Sat, 26 Jul 2003 04:30:15 +0000 Subject: [PATCH] allow null pointer to be safely passed as arg git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8924 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/gnome-utils/gnc-frequency.c | 27 +++++++++++++++------------ src/gnome-utils/gnc-frequency.h | 12 ++++++------ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/gnome-utils/gnc-frequency.c b/src/gnome-utils/gnc-frequency.c index 5c2ac3cc8c..352011c180 100644 --- a/src/gnome-utils/gnc-frequency.c +++ b/src/gnome-utils/gnc-frequency.c @@ -564,7 +564,7 @@ gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs, GDate *startDate ) } void -gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate ) +gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outDate ) { gint page; struct tm *tmpTm; @@ -578,24 +578,27 @@ gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate ) GDate *gd2; time_t tmpTimeT; - /* get the current tab */ - page = gtk_notebook_get_current_page( gf->nb ); - /* save into UIFreqSpec */ + tmpTimeT = gnc_date_edit_get_date( gf->startDate ); + if ( NULL != outDate ) + { + g_date_set_time( outDate, tmpTimeT ); + } - /* We're going to be creating/destroying FreqSpecs, which will cause GUI - refreshes. :( */ + if (NULL == fs) return; + + /* Get the current tab */ + page = gtk_notebook_get_current_page( gf->nb ); + + /* We're going to be creating/destroying FreqSpecs, + * which will cause GUI refreshes. :( */ gnc_suspend_gui_refresh(); - tmpTimeT = gnc_date_edit_get_date( gf->startDate ); gd = g_date_new(); g_date_set_time( gd, tmpTimeT ); - if ( outStartDate != NULL ) { - g_date_set_time( outStartDate, tmpTimeT ); - } /*uift = xaccFreqSpecGetUIType( fs );*/ uift = PAGES[page].uiFTVal; - /* based on value, parse widget values into FreqSpec */ + /* Based on value, parse widget values into FreqSpec */ switch ( uift ) { case UIFREQ_NONE: /* hmmm... shouldn't really be allowed. */ @@ -1142,7 +1145,7 @@ gnc_frequency_set_frequency_label_text (GNCFrequency *gf, const gchar *txt) } void -gnc_frequency_set_startdate_label_text (GNCFrequency *gf, const gchar *txt) +gnc_frequency_set_date_label_text (GNCFrequency *gf, const gchar *txt) { GtkLabel *lbl; if (!gf || !txt) return; diff --git a/src/gnome-utils/gnc-frequency.h b/src/gnome-utils/gnc-frequency.h index 353a4c0d72..ad2d242336 100644 --- a/src/gnome-utils/gnc-frequency.h +++ b/src/gnome-utils/gnc-frequency.h @@ -84,11 +84,11 @@ void gnc_frequency_init( GNCFrequency *gf ); void gnc_frequency_setup( GNCFrequency *gf, FreqSpec *fs, GDate *startDate ); /** - * Saves the state of the GNCFrequenecy widget into the given FreqSpec - * and UIFreqSpec. - * Places the start date in outStartDate, if it's not null. + * Saves the state of the GNCFrequenecy widget. + * Updates the given FreqSpec if it's not NULL. + * Places the date in outDate, if it's not NULL. **/ -void gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDate ); +void gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outDate); /** * Set the label text for the frequency option menu. In the current @@ -96,10 +96,10 @@ void gnc_frequency_save_state( GNCFrequency *gf, FreqSpec *fs, GDate *outStartDa */ 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 + * Set the label text for the 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); +void gnc_frequency_set_date_label_text (GNCFrequency *gf, const gchar *txt); END_GNOME_DECLS