glom r1975 - in trunk: . glom win32
- From: arminb svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1975 - in trunk: . glom win32
- Date: Tue, 10 Mar 2009 11:16:07 +0000 (UTC)
Author: arminb
Date: Tue Mar 10 11:16:06 2009
New Revision: 1975
URL: http://svn.gnome.org/viewvc/glom?rev=1975&view=rev
Log:
2009-03-10 Armin Burgmeier <armin openismus com>
* glom/xsl_utils.cc: Made reports work on Windows, by using
Glib::get_tmp_dir() instead of "/tmp" and ShellExecute instead of
g_app_info_launch_default_for_uri(), for which file:// URIs don't seem
to be supported on Windows.
* win32/build_installer: Don't ship libdb47.dll anymore, as this is no
longer required with libgda 3.99.13.
Modified:
trunk/ChangeLog
trunk/glom/xsl_utils.cc
trunk/win32/build-installer
Modified: trunk/glom/xsl_utils.cc
==============================================================================
--- trunk/glom/xsl_utils.cc (original)
+++ trunk/glom/xsl_utils.cc Tue Mar 10 11:16:06 2009
@@ -41,6 +41,29 @@
#include <iostream> // for cout, endl
#include <iomanip>
+// For ShellExecute:
+#ifdef G_OS_WIN32
+# define GLOM_SAVE_DATADIR DATADIR
+# undef DATADIR
+# include <windows.h>
+# define DATADIR GLOM_SAVE_DATADIR
+#endif
+
+namespace
+{
+ Glib::ustring get_xslt_file(const Glib::ustring& xsl_file)
+ {
+#ifdef G_OS_WIN32
+ gchar* directory;
+ directory = g_win32_get_package_installation_directory_of_module(NULL);
+ Glib::ustring xsltdir = Glib::build_filename(directory, "share/glom/xslt/" + xsl_file);
+ g_free(directory);
+ return xsltdir;
+#else
+ return GLOM_XSLTDIR + xsl_file;
+#endif
+ }
+}
namespace Glom
{
@@ -48,15 +71,15 @@
void GlomXslUtils::transform_and_open(const xmlpp::Document& xml_document, const Glib::ustring& xsl_file_path, Gtk::Window* parent_window)
{
//Use libxslt to convert the XML to HTML:
- Glib::ustring result = xslt_process(xml_document, GLOM_XSLTDIR + xsl_file_path);
+ Glib::ustring result = xslt_process(xml_document, get_xslt_file(xsl_file_path));
std::cout << "After xslt: " << result << std::endl;
//Save it to a temporary file and show it in a browser:
//TODO: This actually shows it in gedit.
- const Glib::ustring temp_uri = "file:///tmp/glom_printout.html";
- std::cout << "temp_uri=" << temp_uri << std::endl;
+ const Glib::ustring temp_path = Glib::get_tmp_dir() + "/glom_printout.html";
+ std::cout << "temp_path=" << temp_path << std::endl;
- Glib::RefPtr<Gio::File> file = Gio::File::create_for_uri(temp_uri);
+ Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(temp_path);
Glib::RefPtr<Gio::FileOutputStream> stream;
//Create the file if it does not already exist:
@@ -115,14 +138,20 @@
if(parent_window)
Frame_Glom::show_ok_dialog(_("Report Finished"), _("The report will now be opened in your web browser."), *parent_window, Gtk::MESSAGE_INFO);
+#ifdef G_OS_WIN32
+ // gtk_show_uri doesn't seem to work on Win32, at least not for local files
+ // We use Windows API instead.
+ ShellExecute(NULL, "open", file->get_path().c_str(), NULL, NULL, SW_SHOW);
+#else
//Use the GNOME browser:
+ //TODO: Use gtk_show_uri() as soon as we require GTK+ 2.14
GError* gerror = 0;
- // g_app_info_launch_default_for_uri seems not to be wrapped by giomm
- if(!g_app_info_launch_default_for_uri(temp_uri.c_str(), NULL, &gerror))
+ if(!g_app_info_launch_default_for_uri(file->get_uri().c_str(), NULL, &gerror))
{
std::cerr << "Error while calling g_app_info_launch_default_for_uri(): " << gerror->message << std::endl;
g_error_free(gerror);
}
+#endif
}
Glib::ustring GlomXslUtils::xslt_process(const xmlpp::Document& xml_document, const std::string& filepath_xslt)
Modified: trunk/win32/build-installer
==============================================================================
--- trunk/win32/build-installer (original)
+++ trunk/win32/build-installer Tue Mar 10 11:16:06 2009
@@ -98,8 +98,6 @@
cp /bundle/bin/iconv.dll installer/bin || exit
cp /bundle/bin/zlib1.dll installer/bin || exit
-cp /libgda/bin/libdb47.dll installer/bin # TODO: TEMP!
-
echo "Copying Python..."
# TODO: Find out Windows directory somehow, perhaps by looking at PATH?
@@ -177,12 +175,12 @@
cp /bundle/share/locale installer/share -R || exit # GTK+ + deps
cp /share/locale installer/share -R || exit # GConf2
cp /local/share/locale installer/share -R || exit # bakery, glom
+cp /libgda/share/locale installer/share -R || exit # libgda-4.0
# TODO: Switch to >=GtkSourceView 2.5, which has locales in share/
cp /gtksourceview/lib/locale installer/lib -R || exit # gtksourceview
-# TODO: libgda-4.0 locales (wait for them being present in official binaries)
# TODO: Bail if a translation file is missing
-TRANSLATIONS="atk10.mo gtk20.mo bakery.mo GConf2.mo glib20.mo gtk20.mo gtk20-properties.mo gtksourceview-2.0.mo libgda-4.0.mo glom.mo"
+TRANSLATIONS="glib20.mo gtk20-properties.mo atk10.mo gtk20.mo gtksourceview-2.0.mo GConf2.mo libgda-4.0.mo bakery.mo glom.mo"
find installer/lib/locale/ -type f | grep -v atk10.mo | grep -v gtk20.mo | grep -v bakery.mo | grep -v GConf2.mo | grep -v glib20.mo | grep -v glom.mo | grep -v gtk20.mo | grep -v gtk20-properties.mo | grep -v gtksourceview-2.0.mo | grep -v libgda-4.0.mo | xargs rm
find installer/lib/locale -type d | xargs rmdir -p --ignore-fail-on-non-empty
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]