Introduced gwrapped gnc_gnome_locate_data_file().=

This was supposed to go with r12942.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12945 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker 2006-01-23 03:12:27 +00:00
parent ed3b1e3ab9
commit 109f82f964
3 changed files with 38 additions and 5 deletions

View File

@ -42,10 +42,6 @@
static QofLogModule log_module = GNC_MOD_GUI; static QofLogModule log_module = GNC_MOD_GUI;
static GnomeProgram *gnucash_program = NULL; static GnomeProgram *gnucash_program = NULL;
static const struct poptOption nullPoptTable[] = {
{ NULL, 0, 0, NULL, 0 }
};
char * char *
gnc_gnome_locate_pixmap (const char *name) gnc_gnome_locate_pixmap (const char *name)
{ {
@ -64,6 +60,19 @@ gnc_gnome_locate_pixmap (const char *name)
return fullname; return fullname;
} }
char *
gnc_gnome_locate_file (GnomeFileDomain domain, const char *name)
{
char *fullname;
g_return_val_if_fail(name, NULL);
fullname = gnome_program_locate_file(gnucash_program,
domain, name, TRUE, NULL);
if (!fullname)
PERR ("Could not locate file %s", name);
return fullname;
}
char * char *
gnc_gnome_locate_data_file (const char *name) gnc_gnome_locate_data_file (const char *name)
{ {
@ -121,7 +130,7 @@ gnc_gnome_init (int argc, char **argv, const char * version)
gnc_gtk_add_rc_file(); gnc_gtk_add_rc_file();
gnucash_program = gnome_program_init( gnucash_program = gnome_program_init(
"gnucash", version, LIBGNOMEUI_MODULE, "gnucash", version, LIBGNOMEUI_MODULE,
argc, argv, GNOME_PARAM_POPT_TABLE, nullPoptTable, argc, argv,
GNOME_PROGRAM_STANDARD_PROPERTIES, GNOME_PARAM_NONE); GNOME_PROGRAM_STANDARD_PROPERTIES, GNOME_PARAM_NONE);
/* initialization required for gtkhtml */ /* initialization required for gtkhtml */

View File

@ -35,6 +35,8 @@
#ifndef GNC_GNOME_UTILS_H #ifndef GNC_GNOME_UTILS_H
#define GNC_GNOME_UTILS_H #define GNC_GNOME_UTILS_H
#include <libgnome/libgnome.h>
/** Initialize the Gnome libraries. */ /** Initialize the Gnome libraries. */
void gnc_gnome_init (int argc, char **argv, const char * version); void gnc_gnome_init (int argc, char **argv, const char * version);
@ -83,6 +85,20 @@ char *gnc_gnome_locate_data_file (const char *name);
*/ */
char *gnc_gnome_locate_ui_file (const char *name); char *gnc_gnome_locate_ui_file (const char *name);
/** Given a file name, find the file in the directories associated
* with the given file domain. This routine will display an error
* message if it can't find the file.
*
* @param doamin The GnomeFileDomain, e.g. GNOME_FILE_DOMAIN_APP_HELP
*
* @param name The name of the file to be found.
*
* @return the full path name of the file, or NULL of the file can't
* be found.
*
* @note It is the caller's responsibility to free the returned string.
*/
char *gnc_gnome_locate_file (GnomeFileDomain domain, const char *name);
/** Launch the default gnome help browser and open to a given link /** Launch the default gnome help browser and open to a given link
* within a given file. This routine will display an error message * within a given file. This routine will display an error message

View File

@ -493,4 +493,12 @@ if they say 'Yes'. The return is false if the user says 'Cancel'.")
'(((<gw:mchars> caller-owned const) message) '(((<gw:mchars> caller-owned const) message)
(<gw:double> percentage)) (<gw:double> percentage))
"Set the progressbar window from the given GncWindow.") "Set the progressbar window from the given GncWindow.")
(gw:wrap-function
ws
'gnc:gnome-locate-data-file
'(<gw:mchars> caller-owned)
"gnc_gnome_locate_data_file"
'(((<gw:mchars> caller-owned const) name))
"Find the file in the application data directory.")
) )