[anjal] Try to determine the different paths on runtime.
- From: Fridrich Strba <strba src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjal] Try to determine the different paths on runtime.
- Date: Sat, 6 Jun 2009 18:16:19 -0400 (EDT)
commit fea2563418c3e31dac0275e0e74472cb6491e73b
Author: Fridrich Strba <fridrich strba bluewin ch>
Date: Sat Jun 6 23:16:21 2009 +0200
Try to determine the different paths on runtime.
---
src/em-format-webkit-display.c | 12 +++++--
src/em-format-webkit.c | 3 ++
src/mail-component.c | 16 +++++++--
src/main.c | 78 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 6 deletions(-)
diff --git a/src/em-format-webkit-display.c b/src/em-format-webkit-display.c
index 94e7c08..5d2c3a8 100644
--- a/src/em-format-webkit-display.c
+++ b/src/em-format-webkit-display.c
@@ -36,6 +36,7 @@
#include <windows.h>
#undef DATADIR
#undef interface
+const char *_e_get_gladedir (void) G_GNUC_CONST;
#endif
#include <glade/glade.h>
@@ -1123,11 +1124,16 @@ efwd_xpkcs7mime_validity_clicked(GtkWidget *button, EMFormatWebKitPObject *pobje
if (po->widget)
/* FIXME: window raise? */
return;
+ gladefile = g_build_filename (
+#ifndef _WIN32
#ifdef EVOLUTION_2_26
- gladefile = g_build_filename (EVOLUTION226_PRIVDATADIR"glade/",
+ EVOLUTION226_PRIVDATADIR"glade/",
#else
- gladefile = g_build_filename (EVOLUTION228_PRIVDATADIR"glade/",
-#endif
+ EVOLUTION228_PRIVDATADIR"glade/",
+#endif
+#else
+ _e_get_gladedir (),
+#endif
"mail-dialogs.glade",
NULL);
xml = glade_xml_new(gladefile, "message_security_dialog", NULL);
diff --git a/src/em-format-webkit.c b/src/em-format-webkit.c
index 56dd2ab..899d3e6 100644
--- a/src/em-format-webkit.c
+++ b/src/em-format-webkit.c
@@ -39,6 +39,9 @@
#include <windows.h>
#undef DATADIR
#undef interface
+const char *_e_get_imagesdir (void) G_GNUC_CONST;
+#undef EVOLUTION_ICONDIR
+#define EVOLUTION_ICONDIR _e_get_imagesdir ()
#endif
#include <libedataserver/e-data-server-util.h> /* for e_utf8_strftime, what about e_time_format_time? */
diff --git a/src/mail-component.c b/src/mail-component.c
index 5d460ad..cba4c2d 100644
--- a/src/mail-component.c
+++ b/src/mail-component.c
@@ -64,6 +64,10 @@
#include <glib/gi18n.h>
+#ifdef G_OS_WIN32
+const char *_e_get_privdatadir (void) G_GNUC_CONST;
+#endif
+
#include <camel/camel-file-utils.h>
#include <camel/camel-vtrash-folder.h>
#include <camel/camel-disco-store.h>
@@ -339,11 +343,17 @@ setup_search_context (MailComponent *component)
if (priv->search_context == NULL) {
char *user = g_build_filename(component->priv->base_directory, "searches.xml", NULL);
+ char *system = g_build_filename (
+#ifndef G_OS_WIN32
#ifdef EVOLUTION_2_26
- char *system = g_build_filename (EVOLUTION226_PRIVDATADIR, "searchtypes.xml", NULL);
+ EVOLUTION226_PRIVDATADIR,
#else
- char *system = g_build_filename (EVOLUTION228_PRIVDATADIR, "searchtypes.xml", NULL);
-#endif
+ EVOLUTION228_PRIVDATADIR,
+#endif
+#else
+ _e_get_privdatadir (),
+#endif
+ "searchtypes.xml", NULL);
priv->search_context = (RuleContext *)em_search_context_new ();
g_object_set_data_full (G_OBJECT (priv->search_context), "user", user, g_free);
diff --git a/src/main.c b/src/main.c
index 4e8db7a..f3ec6a9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -39,6 +39,17 @@
#include <gconf/gconf-client.h>
#include <e-util/e-icon-factory.h>
+#include <bonobo/bonobo-main.h>
+#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo/bonobo-exception.h>
+
+#include <bonobo-activation/bonobo-activation.h>
+
+#ifdef G_OS_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
gboolean windowed = FALSE;
gboolean default_app = FALSE;
static gchar **remaining_args;
@@ -77,9 +88,73 @@ idle_cb (MailShell *shell)
return FALSE;
}
+#ifdef G_OS_WIN32
+static void
+set_paths (void)
+{
+ wchar_t exe_filename[MAX_PATH];
+ wchar_t *p;
+ gchar *exe_folder_utf8;
+ gchar *components_folder_utf8;
+ gchar *top_folder_utf8;
+ gchar *path;
+
+ GetModuleFileNameW (NULL, exe_filename, G_N_ELEMENTS (exe_filename));
+
+ p = wcsrchr (exe_filename, L'\\');
+ g_assert (p != NULL);
+
+ *p = L'\0';
+ exe_folder_utf8 = g_utf16_to_utf8 (exe_filename, -1, NULL, NULL, NULL);
+
+ p = wcsrchr (exe_filename, L'\\');
+ g_assert (p != NULL);
+
+ *p = L'\0';
+ top_folder_utf8 = g_utf16_to_utf8 (exe_filename, -1, NULL, NULL, NULL);
+ components_folder_utf8 =
+ g_strconcat (top_folder_utf8,
+#ifdef EVOLUTION_2_26
+ "/lib/evolution/2.26/components",
+#else
+ "/lib/evolution/2.28/components",
+#endif
+ NULL);
+
+ path = g_build_path (";",
+ exe_folder_utf8,
+ components_folder_utf8,
+ g_getenv ("PATH"),
+ NULL);
+ if (!g_setenv ("PATH", path, TRUE))
+ g_warning ("Could not set PATH for Anjal and its child processes");
+
+ g_free (path);
+ g_free (exe_folder_utf8);
+ g_free (components_folder_utf8);
+
+ /* Set BONOBO_ACTIVATION_PATH */
+ if (g_getenv ("BONOBO_ACTIVATION_PATH" ) == NULL) {
+ path = g_build_filename (top_folder_utf8,
+ "lib/bonobo/servers",
+ NULL);
+ if (!g_setenv ("BONOBO_ACTIVATION_PATH", path, TRUE))
+ g_warning ("Could not set BONOBO_ACTIVATION_PATH");
+ g_free (path);
+ }
+ g_free (top_folder_utf8);
+}
+#endif
+
int
main (int argc, char *argv[])
{
+ if (!g_thread_supported ())
+ g_thread_init (NULL);
+#ifdef G_OS_WIN32
+ extern void link_shutdown (void);
+ set_paths ();
+#endif
GtkWidget *window;
GError *error = NULL;
static GOptionEntry entries[] = {
@@ -120,6 +195,9 @@ main (int argc, char *argv[])
gnome_sound_shutdown ();
e_cursors_shutdown ();
+#ifdef G_OS_WIN32
+ link_shutdown ();
+#endif
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]