[evince] [windows] Make previewer relocatable on windows - GUI
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: svn-commits-list gnome org
- Subject: [evince] [windows] Make previewer relocatable on windows - GUI
- Date: Tue, 9 Jun 2009 09:15:20 -0400 (EDT)
commit ea6c09ad0a1b74b26329a5f6a64d23c95c9bbd97
Author: Hib Eris <hib hiberis nl>
Date: Tue Jun 9 15:13:49 2009 +0200
[windows] Make previewer relocatable on windows - GUI
---
previewer/ev-previewer-window.c | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/previewer/ev-previewer-window.c b/previewer/ev-previewer-window.c
index 8da5871..15a1607 100644
--- a/previewer/ev-previewer-window.c
+++ b/previewer/ev-previewer-window.c
@@ -386,6 +386,23 @@ ev_previewer_window_dispose (GObject *object)
G_OBJECT_CLASS (ev_previewer_window_parent_class)->dispose (object);
}
+static gchar*
+data_dir (void)
+{
+ gchar *datadir;
+#ifdef G_OS_WIN32
+ gchar *dir;
+
+ dir = g_win32_get_package_installation_directory_of_module (NULL);
+ datadir = g_build_filename (dir, "share", "evince", NULL);
+ g_free (dir);
+#else
+ datadir = g_strdup (DATADIR);
+#endif
+
+ return datadir;
+}
+
static void
ev_previewer_window_init (EvPreviewerWindow *window)
{
@@ -393,6 +410,7 @@ ev_previewer_window_init (EvPreviewerWindow *window)
GtkWidget *toolbar;
GtkAction *action;
GError *error = NULL;
+ gchar *datadir, *ui_path;
gtk_window_set_default_size (GTK_WINDOW (window), 600, 600);
@@ -424,12 +442,14 @@ ev_previewer_window_init (EvPreviewerWindow *window)
window->action_group, 0);
gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_ui_manager_get_accel_group (window->ui_manager));
- if (!gtk_ui_manager_add_ui_from_file (window->ui_manager,
- DATADIR"/evince-previewer-ui.xml",
- &error)) {
+ datadir = data_dir ();
+ ui_path = g_build_filename (datadir, "evince-previewer-ui.xml", NULL);
+ if (!gtk_ui_manager_add_ui_from_file (window->ui_manager, ui_path, &error)) {
g_warning ("Failed to load ui from evince-previewer-ui.xml: %s", error->message);
g_error_free (error);
}
+ g_free (ui_path);
+ g_free (datadir);
vbox = gtk_vbox_new (FALSE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]