[Gnucash-changes] r12945 - gnucash/trunk/src/gnome-utils -
Introduced gwrapped gnc_gnome_locate_data_file().=
Chris Shoemaker
chris at cvs.gnucash.org
Sun Jan 22 22:12:29 EST 2006
Author: chris
Date: 2006-01-22 22:12:27 -0500 (Sun, 22 Jan 2006)
New Revision: 12945
Trac: http://svn.gnucash.org/trac/changeset/12945
Modified:
gnucash/trunk/src/gnome-utils/gnc-gnome-utils.c
gnucash/trunk/src/gnome-utils/gnc-gnome-utils.h
gnucash/trunk/src/gnome-utils/gw-gnome-utils-spec.scm
Log:
Introduced gwrapped gnc_gnome_locate_data_file().=
This was supposed to go with r12942.
Modified: gnucash/trunk/src/gnome-utils/gnc-gnome-utils.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-gnome-utils.c 2006-01-23 00:47:45 UTC (rev 12944)
+++ gnucash/trunk/src/gnome-utils/gnc-gnome-utils.c 2006-01-23 03:12:27 UTC (rev 12945)
@@ -42,10 +42,6 @@
static QofLogModule log_module = GNC_MOD_GUI;
static GnomeProgram *gnucash_program = NULL;
-static const struct poptOption nullPoptTable[] = {
- { NULL, 0, 0, NULL, 0 }
-};
-
char *
gnc_gnome_locate_pixmap (const char *name)
{
@@ -65,6 +61,19 @@
}
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 *
gnc_gnome_locate_data_file (const char *name)
{
char *fullname;
@@ -121,7 +130,7 @@
gnc_gtk_add_rc_file();
gnucash_program = gnome_program_init(
"gnucash", version, LIBGNOMEUI_MODULE,
- argc, argv, GNOME_PARAM_POPT_TABLE, nullPoptTable,
+ argc, argv,
GNOME_PROGRAM_STANDARD_PROPERTIES, GNOME_PARAM_NONE);
/* initialization required for gtkhtml */
Modified: gnucash/trunk/src/gnome-utils/gnc-gnome-utils.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-gnome-utils.h 2006-01-23 00:47:45 UTC (rev 12944)
+++ gnucash/trunk/src/gnome-utils/gnc-gnome-utils.h 2006-01-23 03:12:27 UTC (rev 12945)
@@ -35,6 +35,8 @@
#ifndef GNC_GNOME_UTILS_H
#define GNC_GNOME_UTILS_H
+#include <libgnome/libgnome.h>
+
/** Initialize the Gnome libraries. */
void gnc_gnome_init (int argc, char **argv, const char * version);
@@ -83,6 +85,20 @@
*/
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
* within a given file. This routine will display an error message
Modified: gnucash/trunk/src/gnome-utils/gw-gnome-utils-spec.scm
===================================================================
--- gnucash/trunk/src/gnome-utils/gw-gnome-utils-spec.scm 2006-01-23 00:47:45 UTC (rev 12944)
+++ gnucash/trunk/src/gnome-utils/gw-gnome-utils-spec.scm 2006-01-23 03:12:27 UTC (rev 12945)
@@ -493,4 +493,12 @@
'(((<gw:mchars> caller-owned const) message)
(<gw:double> percentage))
"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.")
)
More information about the gnucash-changes
mailing list