Commit dd7109b1 authored by Richard Hult's avatar Richard Hult Committed by Richard Hult

Modified patch from Francisco to fix up the path stuff, and adding the sql

2005-04-26  Richard Hult  <richard@imendio.com>

	* libplanner/mrp-application.c: (application_init_gettext):
	* libplanner/mrp-paths-gnome.c: (mrp_paths_get_sql_dir),
	(mrp_paths_get_locale_dir):
	* libplanner/mrp-paths-win32.c: (mrp_paths_get_file_modules_dir),
	(mrp_paths_get_sql_dir), (mrp_paths_get_locale_dir):
	* src/Makefile.am:
	* src/planner-main.c: (main):
	* src/planner-sql-plugin.c: (check_database_tables):
	* src/planner-util-win32.c: (planner_util_show_url),
	(planner_util_show_help): Modified patch from Francisco to fix up
	the path stuff, and adding the sql and locale paths.
parent 5d16000f
2005-04-26 Richard Hult <richard@imendio.com>
* libplanner/mrp-application.c: (application_init_gettext):
* libplanner/mrp-paths-gnome.c: (mrp_paths_get_sql_dir),
(mrp_paths_get_locale_dir):
* libplanner/mrp-paths-win32.c: (mrp_paths_get_file_modules_dir),
(mrp_paths_get_sql_dir), (mrp_paths_get_locale_dir):
* src/Makefile.am:
* src/planner-main.c: (main):
* src/planner-sql-plugin.c: (check_database_tables):
* src/planner-util-win32.c: (planner_util_show_url),
(planner_util_show_help): Modified patch from Francisco to fix up
the path stuff, and adding the sql and locale paths.
2005-04-23 Richard Hult <richard@imendio.com>
* configure.in:
......
......@@ -29,6 +29,7 @@
#include "mrp-file-module.h"
#include "mrp-private.h"
#include "mrp-application.h"
#include "mrp-paths.h"
struct _MrpApplicationPriv {
GList *file_readers;
......@@ -123,7 +124,7 @@ application_finalize (GObject *object)
static void
application_init_gettext (void)
{
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE, mrp_paths_get_locale_dir ());
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
imrp_time_init ();
......
......@@ -36,6 +36,8 @@ static const gchar *image_dir = DATADIR "/planner/images";
static const gchar *dtd_dir = DATADIR "/planner/dtd";
static const gchar *stylesheet_dir = DATADIR "/planner/stylesheets";
static const gchar *ui_dir = DATADIR "/planner/ui";
static const gchar *sql_dir = DATADIR "/planner/sql";
static const gchar *locale_dir = GNOMELOCALEDIR;
gchar *
mrp_paths_get_glade_dir (const gchar *filename)
......@@ -85,3 +87,14 @@ mrp_paths_get_ui_dir (const gchar *filename)
return g_build_filename (ui_dir, filename, NULL);
}
gchar *
mrp_paths_get_sql_dir ()
{
return g_strdup (sql_dir);
}
gchar *
mrp_paths_get_locale_dir ()
{
return g_strdup (locale_dir);
}
......@@ -33,6 +33,19 @@ static gchar *stylesheet_dir = NULL;
static gchar *ui_dir = NULL;
static gchar *storagemodule_dir = NULL;
static gchar *file_modules_dir = NULL;
static gchar *sql_dir = NULL;
static gchar *locale_dir = NULL;
#define STORAGEMODULEDIR "lib/planner/storage-modules"
#define FILEMODULEDIR "lib/planner/file-modules"
#define PLUGINDIR "lib/planner/plugins"
#define DTDDIR "share/planner/dtd"
#define STYLESHEETDIR "share/planner/stylesheets"
#define GLADEDIR "share/planner/glade"
#define IMAGEDIR "share/pixmaps/planner"
#define UIDIR "share/planner/ui"
#define SQLDIR "share/planner/sql"
#define GNOMELOCALEDIR "share/locale"
gchar *
mrp_paths_get_glade_dir (const gchar *filename)
......@@ -113,3 +126,23 @@ mrp_paths_get_file_modules_dir (const gchar *filename)
return g_build_filename (file_modules_dir, filename, NULL);
}
gchar *
mrp_paths_get_sql_dir (void)
{
if (!sql_dir) {
sql_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, SQLDIR);
}
return sql_dir;
}
gchar *
mrp_paths_get_locale_dir (void)
{
if (!locale_dir) {
locale_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, GNOMELOCALEDIR);
}
return locale_dir;
}
......@@ -36,5 +36,7 @@ gchar *mrp_paths_get_image_dir (const gchar *filename);
gchar *mrp_paths_get_dtd_dir (const gchar *filename);
gchar *mrp_paths_get_stylesheet_dir (const gchar *filename);
gchar *mrp_paths_get_ui_dir (const gchar *filename);
gchar *mrp_paths_get_sql_dir (void);
gchar *mrp_paths_get_locale_dir (void);
#endif /* __MRP_PATHS_H__ */
......@@ -169,7 +169,7 @@ if HAVE_GDA
sql_plugin = libsql-plugin.la
libsql_plugin_la_SOURCES = planner-sql-plugin.c
libsql_plugin_la_LIBADD = $(GDA_LIBS)
libsql_plugin_la_CFLAGS = $(GDA_CFLAGS) -DSQL_DIR=\""$(datadir)/planner/sql"\"
libsql_plugin_la_CFLAGS = $(GDA_CFLAGS)
libsql_plugin_la_LDFLAGS = -avoid-version -module
endif
......
......@@ -56,7 +56,7 @@ main (int argc, char **argv)
};
gchar *filename;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE, mrp_paths_get_locale_dir ());
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
......
......@@ -376,6 +376,7 @@ check_database_tables (GdaConnection *conn,
gchar *database_version = VERSION;
const gchar *database_name;
gboolean retval = FALSE;
gchar *sql_dir = mrp_paths_get_sql_dir ();
max_version_database = g_strdup ("0.0");
max_version_upgrade = g_strdup ("0.0");
......@@ -398,18 +399,18 @@ check_database_tables (GdaConnection *conn,
}
/* Check for tables */
dir = g_dir_open (SQL_DIR, 0, NULL);
dir = g_dir_open (sql_dir, 0, NULL);
while ((name = g_dir_read_name (dir)) != NULL) {
gchar **namev = NULL, **versionv = NULL;
gchar *version;
gchar *sql_file = g_build_filename (SQL_DIR, name, NULL);
if (strncmp (name + strlen (name) - 4, ".sql", 4) != 0) {
g_warning ("Strange file in SQL data Planner directory: %s%s",
SQL_DIR, name);
gchar *sql_file;
if (!g_str_has_suffix (name, ".sql")) {
continue;
}
sql_file = g_build_filename (sql_dir, name, NULL);
/* Find version between "-" and ".sql" */
namev = g_strsplit (sql_file,"-",-1);
/* Upgrade: 2 versions in file */
......
......@@ -34,19 +34,30 @@ planner_win32_get_quark ()
return quark;
}
void
planner_util_show_url (const gchar *url)
gboolean
planner_util_show_url (const gchar *url,
GError **error)
{
ShellExecute (NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
// Fix me later
return TRUE;
}
gboolean
planner_util_show_help (GError **error)
{
int res;
gchar *path;
gchar *file;
// should use HtmlHelp but it is not part of MingW yet
res = (int) ShellExecute (NULL, "open", "planner.chm", NULL, NULL, SW_SHOWNORMAL);
path = g_win32_get_package_installation_subdirectory (NULL, NULL, ".");
file = g_build_filename (path, "planner.chm", NULL);
res = (int) ShellExecute (NULL, "open", file, NULL, NULL, SW_SHOWNORMAL);
g_free (file);
g_free (path);
if (res <= 32) {
g_set_error (error,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment