Display detected Finance::Quote version in about dialog

This commit is contained in:
Geert Janssens 2018-01-25 10:09:50 +01:00
parent cb2b039634
commit adba439b1c
5 changed files with 47 additions and 11 deletions

View File

@ -237,7 +237,8 @@ Timespec timespecCanonicalDayTime(Timespec t);
$1 = g_list_reverse (path);
}
void gnc_quote_source_set_fq_installed (GList *sources_list);
void gnc_quote_source_set_fq_installed (const char* version_string,
GList *sources_list);
%clear GList *;
%ignore gnc_quote_source_set_fq_installed;
%ignore gnc_commodity_table_get_quotable_commodities;

View File

@ -142,7 +142,7 @@ struct gnc_new_iso_code
#define GNC_NEW_ISO_CODES \
(sizeof(gnc_new_iso_codes) / sizeof(struct gnc_new_iso_code))
static gboolean fq_is_installed = FALSE;
static char *fq_version = NULL;
struct gnc_quote_source_s
{
@ -259,7 +259,20 @@ static GList *new_quote_sources = NULL;
gboolean
gnc_quote_source_fq_installed (void)
{
return fq_is_installed;
return (fq_version != NULL);
}
/********************************************************************
* gnc_quote_source_fq_version
*
* This function the version of the Finance::Quote module installed
* on a user's computer or NULL if no installation is found.
********************************************************************/
const char*
gnc_quote_source_fq_version (void)
{
return fq_version;
}
/********************************************************************
@ -510,6 +523,7 @@ gnc_quote_source_get_internal_name (const gnc_quote_source *source)
return source->internal_name;
}
/********************************************************************
* gnc_quote_source_set_fq_installed
*
@ -517,18 +531,27 @@ gnc_quote_source_get_internal_name (const gnc_quote_source *source)
* installed.
********************************************************************/
void
gnc_quote_source_set_fq_installed (const GList *sources_list)
gnc_quote_source_set_fq_installed (const char* version_string,
const GList *sources_list)
{
gnc_quote_source *source;
char *source_name;
const GList *node;
ENTER(" ");
fq_is_installed = TRUE;
if (!sources_list)
return;
if (fq_version)
{
g_free (fq_version);
fq_version = NULL;
}
if (version_string)
fq_version = g_strdup (version_string);
for (node = sources_list; node; node = node->next)
{
source_name = node->data;

View File

@ -139,13 +139,21 @@ typedef enum
} QuoteSourceType;
/** This function indicates whether or not the Finance::Quote module
* is installed on a users computer. This includes any other related
* is installed on a user's computer. This includes any other related
* modules that gnucash need to process F::Q information.
*
* @return TRUE is F::Q is installed properly.
*/
gboolean gnc_quote_source_fq_installed (void);
/** This function returns the version of the Finance::Quote module
* installed on a user's computer. If no proper installation is found
* it will return NULL.
*
* @return a version string or NULL
*/
const char* gnc_quote_source_fq_version (void);
/** Update gnucash internal tables based on what Finance::Quote
* sources are installed. Sources that have been explicitly coded
* into gnucash are marked sensitive/insensitive based upon whether
@ -155,7 +163,8 @@ gboolean gnc_quote_source_fq_installed (void);
* @param sources_list A list of strings containing the source names
* as they are known to F::Q.
*/
void gnc_quote_source_set_fq_installed (const GList *sources_list);
void gnc_quote_source_set_fq_installed (const char* version_string,
const GList *sources_list);
/** Return the number of entries for a given type of quote source.
*

View File

@ -4374,7 +4374,7 @@ gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window)
gchar **authors = get_file_strsplit("AUTHORS");
gchar **documenters = get_file_strsplit("DOCUMENTERS");
gchar *license = get_file("LICENSE");
gchar *message;
gchar *message, *tmp_msg;
GdkPixbuf *logo = gnc_gnome_get_gdkpixbuf ("gnucash-icon-48x48.png");
#ifdef GNUCASH_SCM
@ -4383,17 +4383,20 @@ gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window)
2nd %s is the scm type (svn/svk/git/bzr);
3rd %s is the scm revision number;
4th %s is the build date */
message = g_strdup_printf(_("%s\nThis copy was built from %s rev %s on %s."),
tmp_msg = g_strdup_printf(_("%s\nThis copy was built from %s rev %s on %s."),
fixed_message, GNUCASH_SCM, GNUCASH_SCM_REV,
GNUCASH_BUILD_DATE);
#else
/* Translators: 1st %s is a fixed message, which is translated independently;
2nd %s is the scm (svn/svk/git/bzr) revision number;
3rd %s is the build date */
message = g_strdup_printf(_("%s\nThis copy was built from rev %s on %s."),
tmp_msg = g_strdup_printf(_("%s\nThis copy was built from rev %s on %s."),
fixed_message, GNUCASH_SCM_REV,
GNUCASH_BUILD_DATE);
#endif
message = g_strdup_printf ("%s\n\nFinance::Quote: %s", tmp_msg,
gnc_quote_source_fq_version () ? gnc_quote_source_fq_version () : "-");
g_free (tmp_msg);
priv->about_dialog = gtk_about_dialog_new ();
g_object_set (priv->about_dialog,
"authors", authors,

View File

@ -611,4 +611,4 @@ Run 'gnc-fq-update' as root to install them.") "\n")))
(format #t "Found Finance::Quote version ~A" (car sources))
(newline)
(gnc:msg "Found Finance::Quote version " (car sources))
(gnc-quote-source-set-fq-installed (cdr sources))))))
(gnc-quote-source-set-fq-installed (car sources) (cdr sources))))))