Re: [Planner Dev] PATCH: Path changes
- From: Jani Tiainen <redetin luukku com>
- To: planner-dev lists imendio com
- Subject: Re: [Planner Dev] PATCH: Path changes
- Date: Fri, 22 Apr 2005 00:01:36 +0300
Okay, here it comes again... Hopefully this is better.
--
Jani Tiainen
diff -rbNuB -x CVS planner-cvs/libplanner/Makefile.am planner-paths/libplanner/Makefile.am
--- planner-cvs/libplanner/Makefile.am Tue Apr 19 15:58:17 2005
+++ planner-paths/libplanner/Makefile.am Tue Apr 19 16:02:01 2005
@@ -33,7 +33,8 @@
mrp-private.h \
mrp-property.c \
mrp-time.c \
- mrp-error.c
+ mrp-error.c \
+ mrp-paths-gnome.c
libplannerinclude_HEADERS = \
planner.h \
@@ -51,7 +52,8 @@
mrp-relation.h \
mrp-types.h \
mrp-time.h \
- mrp-error.h
+ mrp-error.h \
+ mrp-paths.h
libplanner_1_la_LIBADD = $(LIBPLANNER_LIBS)
diff -rbNuB -x CVS planner-cvs/libplanner/mrp-file-module.c planner-paths/libplanner/mrp-file-module.c
--- planner-cvs/libplanner/mrp-file-module.c Wed Oct 13 17:49:44 2004
+++ planner-paths/libplanner/mrp-file-module.c Thu Apr 21 20:10:35 2005
@@ -24,6 +24,7 @@
#include <config.h>
#include <string.h>
#include <glib/gi18n.h>
+#include "libplanner/mrp-paths.h"
#include "mrp-file-module.h"
static MrpFileModule *
@@ -53,8 +54,13 @@
GDir* dir;
const gchar *name;
MrpFileModule *module;
+ static gchar *filename = NULL;
- dir = g_dir_open (MRP_FILE_MODULES_DIR, 0, NULL);
+ if (!filename) {
+ filename = mrp_paths_get_file_modules_dir (NULL);
+ }
+
+ dir = g_dir_open (filename, 0, NULL);
if (dir == NULL) {
return;
@@ -64,7 +70,7 @@
if (g_str_has_suffix (name, G_MODULE_SUFFIX)) {
gchar *plugin;
- plugin = g_build_filename (MRP_FILE_MODULES_DIR,
+ plugin = g_build_filename (filename,
name,
NULL);
diff -rbNuB -x CVS planner-cvs/libplanner/mrp-paths-gnome.c planner-paths/libplanner/mrp-paths-gnome.c
--- planner-cvs/libplanner/mrp-paths-gnome.c Thu Jan 1 00:00:00 1970
+++ planner-paths/libplanner/mrp-paths-gnome.c Thu Apr 21 20:11:20 2005
@@ -0,0 +1,75 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2005 Jani Tiainen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Path generation
+ * Gnome specific versions
+ */
+
+#include "mrp-paths.h"
+
+gchar *glade_dir = GLADEDIR;
+gchar *data_dir = DATADIR;
+gchar *image_dir = IMAGEDIR;
+gchar *plugin_dir = PLUGINDIR;
+gchar *dtd_dir = DTDDIR;
+gchar *stylesheet_dir = STYLESHEETDIR;
+gchar *storagemodule_dir = MRP_STORAGEMODULEDIR;
+gchar *file_modules_dir = MRP_FILE_MODULES_DIR;
+
+gchar *mrp_paths_get_glade_dir (const gchar *filename)
+{
+ return g_build_filename (glade_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_data_dir (const gchar *filename)
+{
+ return g_build_filename (data_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_image_dir (const gchar *filename)
+{
+ return g_build_filename (image_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_plugin_dir (const gchar *filename)
+{
+ return g_build_filename (plugin_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_dtd_dir (const gchar *filename)
+{
+ return g_build_filename (dtd_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_stylesheet_dir (const gchar *filename)
+{
+ return g_build_filename (stylesheet_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_storagemodule_dir (const gchar *filename)
+{
+ return g_build_filename (storagemodule_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_file_modules_dir (const gchar *filename)
+{
+ return g_build_filename (file_modules_dir, filename, NULL);
+}
diff -rbNuB -x CVS planner-cvs/libplanner/mrp-paths-win32.c planner-paths/libplanner/mrp-paths-win32.c
--- planner-cvs/libplanner/mrp-paths-win32.c Thu Jan 1 00:00:00 1970
+++ planner-paths/libplanner/mrp-paths-win32.c Thu Apr 21 20:12:13 2005
@@ -0,0 +1,107 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2005 Jani Tiainen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Path generation
+ * Win32 specific versions
+ */
+
+#include "mrp-paths.h"
+
+gchar *glade_dir = NULL;
+gchar *data_dir = NULL;
+gchar *image_dir = NULL;
+gchar *plugin_dir = NULL;
+gchar *dtd_dir = NULL;
+gchar *stylesheet_dir = NULL;
+gchar *storagemodule_dir = NULL;
+gchar *file_modules_dir = NULL;
+
+gchar *mrp_paths_get_glade_dir (const gchar *filename)
+{
+ if (!glade_dir) {
+ gchar *glade_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, GLADEDIR);
+ }
+
+ return g_build_filename (glade_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_data_dir (const gchar *filename)
+{
+ if (!data_dir) {
+ gchar *data_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, DATADIR);
+ }
+
+ return g_build_filename (data_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_image_dir (const gchar *filename)
+{
+ if (!image_dir) {
+ gchar *image_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, IMAGEDIR);
+ }
+
+ return g_build_filename (image_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_plugin_dir (const gchar *filename)
+{
+ if (!plugin_dir) {
+ gchar *plugin_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, PLUGINDIR);
+ }
+
+ return g_build_filename (plugin_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_dtd_dir (const gchar *filename)
+{
+ if (!dtd_dir) {
+ gchar *dtd_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, DTDDIR);
+ }
+
+ return g_build_filename (dtd_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_stylesheet_dir (const gchar *filename)
+{
+ if (!stylesheet_dir) {
+ gchar *stylesheet_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, STYLESHEETDIR);
+ }
+
+ return g_build_filename (stylesheet_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_storagemodule_dir (const gchar *filename)
+{
+ if (!storagemodule_dir) {
+ gchar *storagemodule_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, MRP_STORAGEMODULEDIR);
+ }
+
+ return g_build_filename (storagemodule_dir, filename, NULL);
+}
+
+gchar *mrp_paths_get_file_modules_dir (const gchar *filename)
+{
+ if (!file_modules_dir) {
+ gchar *file_modules_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, MRP_FILE_MODULES_DIR);
+ }
+
+ return g_build_filename (file_modules_dir, filename, NULL);
+}
diff -rbNuB -x CVS planner-cvs/libplanner/mrp-paths.h planner-paths/libplanner/mrp-paths.h
--- planner-cvs/libplanner/mrp-paths.h Thu Jan 1 00:00:00 1970
+++ planner-paths/libplanner/mrp-paths.h Wed Apr 20 22:40:41 2005
@@ -0,0 +1,46 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2005 Jani Tiainen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Path generation functions
+ */
+
+#ifndef __MRP_PATHS_H__
+#define __MRP_PATHS_H__
+
+#include <glib.h>
+
+gchar *mrp_paths_get_glade_dir (const gchar *filename);
+
+gchar *mrp_paths_get_data_dir (const gchar *filename);
+
+gchar *mrp_paths_get_image_dir (const gchar *filename);
+
+gchar *mrp_paths_get_plugin_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_storagemodule_dir (const gchar *filename);
+
+gchar *mrp_paths_get_file_modules_dir (const gchar *filename);
+
+#endif /* __MRP_PATHS_H__ */
diff -rbNuB -x CVS planner-cvs/libplanner/mrp-storage-module-factory.c planner-paths/libplanner/mrp-storage-module-factory.c
--- planner-cvs/libplanner/mrp-storage-module-factory.c Mon Dec 1 16:36:22 2003
+++ planner-paths/libplanner/mrp-storage-module-factory.c Thu Apr 21 20:12:35 2005
@@ -22,7 +22,7 @@
#include <config.h>
#include <gmodule.h>
-
+#include "mrp-paths.h"
#include "mrp-storage-module-factory.h"
#include "mrp-storage-module.h"
@@ -131,10 +131,13 @@
{
MrpStorageModuleFactory *factory;
gchar *fullname, *libname;
+ gchar *filename;
fullname = g_strconcat ("storage-", name, NULL);
- libname = g_module_build_path (MRP_STORAGEMODULEDIR, fullname);
+ filename = mrp_paths_get_storagemodule_dir (NULL);
+ libname = g_module_build_path (filename, fullname);
+ g_free (filename);
if (!module_hash) {
module_hash = g_hash_table_new (g_str_hash, g_str_equal);
diff -rbNuB -x CVS planner-cvs/libplanner/mrp-xml.c planner-paths/libplanner/mrp-xml.c
--- planner-cvs/libplanner/mrp-xml.c Fri Feb 18 10:32:07 2005
+++ planner-paths/libplanner/mrp-xml.c Thu Apr 21 20:12:54 2005
@@ -28,6 +28,7 @@
#include <libplanner/mrp-file-module.h>
#include <libplanner/mrp-private.h>
+#include "mrp-paths.h"
#include "mrp-old-xml.h"
typedef enum {
@@ -121,14 +122,21 @@
xml_locate_type (xmlDoc *doc)
{
XmlType ret_val = XML_TYPE_UNKNOWN;
+ gchar *filename;
- if (xml_validate (doc, DTDDIR "/mrproject-0.6.dtd")) {
+ filename = mrp_paths_get_dtd_dir ("/mrproject-0.6.dtd");
+ if (xml_validate (doc, filename)) {
ret_val = XML_TYPE_MRP_0_6;
}
- else if (xml_validate (doc, DTDDIR "/mrproject-0.5.1.dtd")) {
+ else {
+ g_free (filename);
+ filename = mrp_paths_get_dtd_dir ("/mrproject-0.5.1.dtd");
+ if (xml_validate (doc, filename)) {
ret_val = XML_TYPE_MRP_0_5_1;
}
+ }
+ g_free (filename);
return ret_val;
}
diff -rbNuB -x CVS planner-cvs/libplanner/mrp-xsl.c planner-paths/libplanner/mrp-xsl.c
--- planner-cvs/libplanner/mrp-xsl.c Sun Feb 13 08:38:04 2005
+++ planner-paths/libplanner/mrp-xsl.c Thu Apr 21 20:51:50 2005
@@ -33,7 +33,7 @@
#include <string.h>
#include <libplanner/mrp-file-module.h>
#include <libplanner/mrp-private.h>
-
+#include "libplanner/mrp-paths.h"
void init (MrpFileModule *module,
MrpApplication *application);
@@ -65,6 +65,7 @@
gint len;
GnomeVFSResult result;
gboolean ret;
+ gchar *filename;
if (!mrp_project_save_to_xml (project, &xml_project, error)) {
return FALSE;
@@ -75,7 +76,9 @@
xmlLoadExtDtdDefaultValue = 1;
exsltRegisterAll ();
- stylesheet = xsltParseStylesheetFile (STYLESHEETDIR "/planner2html.xsl");
+ filename = mrp_paths_get_stylesheet_dir ("/planner2html.xsl");
+ stylesheet = xsltParseStylesheetFile (filename);
+ g_free (filename);
doc = xmlParseMemory (xml_project, strlen (xml_project));
@@ -132,6 +135,7 @@
gint len;
GnomeVFSResult result;
gboolean ret;
+ gchar *filename;
if (!mrp_project_save_to_xml (project, &xml_project, error)) {
return FALSE;
@@ -142,7 +146,9 @@
xmlLoadExtDtdDefaultValue = 1;
exsltRegisterAll ();
- stylesheet = xsltParseStylesheetFile (STYLESHEETDIR "/planner2plannerv011.xsl");
+ filename = mrp_paths_get_stylesheet_dir ("/planner2plannerv011.xsl");
+ stylesheet = xsltParseStylesheetFile (filename);
+ g_free (filename);
doc = xmlParseMemory (xml_project, strlen (xml_project));
diff -rbNuB -x CVS planner-cvs/src/planner-calendar-dialog.c planner-paths/src/planner-calendar-dialog.c
--- planner-cvs/src/planner-calendar-dialog.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-calendar-dialog.c Thu Apr 21 20:13:42 2005
@@ -29,6 +29,7 @@
#include <libplanner/mrp-day.h>
#include <libplanner/mrp-object.h>
#include <libplanner/mrp-project.h>
+#include <libplanner/mrp-paths.h>
#include "planner-calendar.h"
#include "planner-working-time-dialog.h"
#include "planner-default-week-dialog.h"
@@ -587,12 +588,17 @@
GtkWidget *w;
GtkTreeSelection *selection;
gint i;
+ gchar *filename;
- g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
+ g_return_val_if_fail (PLANNER_IS_MAIN_WINDOW (window), NULL);
- glade = glade_xml_new (GLADEDIR "/calendar-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/calendar-dialog.glade");
+ glade = glade_xml_new (filename ,
"calendar_dialog",
GETTEXT_PACKAGE);
+
+ g_free (filename);
+
if (!glade) {
g_warning ("Could not create calendar dialog.");
return NULL;
@@ -1246,10 +1252,13 @@
GtkWidget *tree_view;
const gchar *name;
GtkTreePath *path;
+ gchar *filename;
- glade = glade_xml_new (GLADEDIR "/calendar-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/calendar-dialog.glade");
+ glade = glade_xml_new (filename,
"new_calendar_dialog",
GETTEXT_PACKAGE);
+ g_free (filename);
dialog = glade_xml_get_widget (glade, "new_calendar_dialog");
diff -rbNuB -x CVS planner-cvs/src/planner-calendar-selector.c planner-paths/src/planner-calendar-selector.c
--- planner-cvs/src/planner-calendar-selector.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-calendar-selector.c Thu Apr 21 20:14:15 2005
@@ -27,6 +27,7 @@
#include <libplanner/mrp-day.h>
#include <libplanner/mrp-object.h>
#include <libplanner/mrp-project.h>
+#include "libplanner/mrp-paths.h"
#include "planner-calendar.h"
#include "planner-calendar-selector.h"
@@ -75,12 +76,15 @@
GtkWidget *selector;
GtkWidget *w;
GtkTreeSelection *selection;
+ gchar *filename;
- g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
+ g_return_val_if_fail (PLANNER_IS_MAIN_WINDOW (window), NULL);
- glade = glade_xml_new (GLADEDIR "/calendar-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/calendar-dialog.glade");
+ glade = glade_xml_new (filename,
"calendar_selector",
GETTEXT_PACKAGE);
+ g_free (filename);
if (!glade) {
g_warning ("Could not create calendar selector.");
return NULL;
diff -rbNuB -x CVS planner-cvs/src/planner-column-dialog.c planner-paths/src/planner-column-dialog.c
--- planner-cvs/src/planner-column-dialog.c Tue Apr 12 22:20:47 2005
+++ planner-paths/src/planner-column-dialog.c Thu Apr 21 20:14:30 2005
@@ -22,6 +22,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
+#include "libplanner/mrp-paths.h"
#include "planner-column-dialog.h"
typedef struct {
@@ -476,8 +477,12 @@
DialogData *data;
GladeXML *glade;
GtkWidget *close_button;
+ gchar *filename;
+
+ filename = mrp_paths_get_glade_dir ("/column-dialog.glade");
+ glade = glade_xml_new (filename, NULL, NULL);
+ g_free (filename);
- glade = glade_xml_new (GLADEDIR "/column-dialog.glade", NULL, NULL);
if (!glade) {
g_warning ("Could not create column dialog.");
return;
diff -rbNuB -x CVS planner-cvs/src/planner-day-type-dialog.c planner-paths/src/planner-day-type-dialog.c
--- planner-cvs/src/planner-day-type-dialog.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-day-type-dialog.c Thu Apr 21 20:14:47 2005
@@ -26,6 +26,7 @@
#include <glade/glade.h>
#include <gtk/gtk.h>
#include <libplanner/mrp-project.h>
+#include "libplanner/mrp-paths.h"
#include "planner-day-type-dialog.h"
#define RESPONSE_ADD 1
@@ -148,12 +149,16 @@
GtkCellRenderer *cell;
GtkTreeViewColumn *col;
GtkTreeSelection *selection;
+ gchar *filename;
- g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
+ g_return_val_if_fail (PLANNER_IS_MAIN_WINDOW (window), NULL);
- glade = glade_xml_new (GLADEDIR "/calendar-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/calendar-dialog.glade");
+ glade = glade_xml_new (filename ,
"day_type_dialog",
GETTEXT_PACKAGE);
+ g_free (filename);
+
if (!glade) {
g_warning ("Could not create day_type dialog.");
return NULL;
@@ -419,10 +424,13 @@
GtkWidget *entry;
GtkWidget *button;
const gchar *name;
+ gchar *filename;
- glade = glade_xml_new (GLADEDIR "/calendar-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/calendar-dialog.glade");
+ glade = glade_xml_new (filename,
"new_day_dialog",
GETTEXT_PACKAGE);
+ g_free (filename);
dialog = glade_xml_get_widget (glade, "new_day_dialog");
diff -rbNuB -x CVS planner-cvs/src/planner-default-week-dialog.c planner-paths/src/planner-default-week-dialog.c
--- planner-cvs/src/planner-default-week-dialog.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-default-week-dialog.c Thu Apr 21 20:15:01 2005
@@ -26,6 +26,7 @@
#include <glade/glade.h>
#include <gtk/gtk.h>
#include <libplanner/mrp-project.h>
+#include "libplanner/mrp-paths.h"
#include "planner-default-week-dialog.h"
#define RESPONSE_ADD 1
@@ -157,12 +158,17 @@
GtkWidget *dialog;
GtkWidget *w;
gint i;
+ gchar *filename;
- g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
+ g_return_val_if_fail (PLANNER_IS_MAIN_WINDOW (window), NULL);
- glade = glade_xml_new (GLADEDIR "/calendar-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/calendar-dialog.glade");
+ glade = glade_xml_new (filename ,
"default_week_dialog",
GETTEXT_PACKAGE);
+
+ g_free (filename);
+
if (!glade) {
g_warning ("Could not create default_week dialog.");
return NULL;
diff -rbNuB -x CVS planner-cvs/src/planner-eds-plugin.c planner-paths/src/planner-eds-plugin.c
--- planner-cvs/src/planner-eds-plugin.c Sun Jan 30 08:27:26 2005
+++ planner-paths/src/planner-eds-plugin.c Thu Apr 21 20:15:26 2005
@@ -45,6 +45,7 @@
#include <gconf/gconf-client.h>
#include <libplanner/mrp-object.h>
#include <libplanner/mrp-property.h>
+#include "libplanner/mrp-paths.h"
#include "planner-window.h"
#include "planner-plugin.h"
#include "planner-resource-cmd.h"
@@ -250,12 +251,14 @@
GConfClient *gconf_client;
ESourceList *source_list;
GSList *groups;
+ gchar *filename;
plugin = PLANNER_PLUGIN (user_data);
priv = plugin->priv;
- priv->glade = glade_xml_new (GLADEDIR"/eds.glade",
- NULL, NULL);
+ filename = mrp_paths_get_glade_dir ("/eds.glade");
+ priv->glade = glade_xml_new (filename, NULL, NULL);
+ g_free (filename);
priv->dialog_get_resources = glade_xml_get_widget (priv->glade, "resources_get");
@@ -558,6 +561,7 @@
GdkPixbuf *pixbuf;
AsyncQuery *async_query;
const gchar *uid;
+ gchar *filename;
async_query = (AsyncQuery *) user_data;
@@ -578,7 +582,9 @@
/* Exceed limit is E_BOOK_ERROR_OTHER_ERROR :( */
if (status == E_BOOK_ERROR_OK || status == E_BOOK_ERROR_OTHER_ERROR) {
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR"/resources.png", NULL);
+ filename = mrp_paths_get_image_dir ("/resources.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+ g_free (filename);
for (l = contacts; l; l = l->next) {
gchar *name, *email;
name = e_contact_get (l->data, E_CONTACT_FULL_NAME);
@@ -938,6 +944,7 @@
GtkUIManager *ui;
GtkActionGroup *actions;
GError *error = NULL;
+ gchar *filename;
priv = g_new0 (PlannerPluginPriv, 1);
plugin->priv = priv;
@@ -951,11 +958,14 @@
ui = planner_window_get_ui_manager (main_window);
gtk_ui_manager_insert_action_group (ui, actions, 0);
- if (!gtk_ui_manager_add_ui_from_file(ui, DATADIR"/planner/ui/eds-plugin.ui", &error)) {
+
+ filename = mrp_paths_get_data_dir ("/planner/ui/eds-plugin.ui");
+ if (!gtk_ui_manager_add_ui_from_file(ui, filename, &error)) {
g_message("Building menu failed: %s", error->message);
- g_message ("Couldn't load: %s",DATADIR"/planner/ui/eds-plugin.ui");
+ g_message ("Couldn't load: %s",filename);
g_error_free(error);
}
+ g_free (filename);
gtk_ui_manager_ensure_update (ui);
}
diff -rbNuB -x CVS planner-cvs/src/planner-gantt-view.c planner-paths/src/planner-gantt-view.c
--- planner-cvs/src/planner-gantt-view.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-gantt-view.c Thu Apr 21 20:24:55 2005
@@ -28,6 +28,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libplanner/mrp-task.h>
+#include "libplanner/mrp-paths.h"
#include "planner-gantt-view.h"
#include "planner-cell-renderer-date.h"
#include "planner-task-dialog.h"
@@ -213,6 +214,7 @@
{
PlannerGanttViewPriv *priv;
gboolean show_critical;
+ gchar *filename;
priv = PLANNER_GANTT_VIEW (view)->priv;
@@ -229,10 +231,11 @@
view);
gtk_ui_manager_insert_action_group (priv->ui_manager, priv->actions, 0);
+ filename = mrp_paths_get_data_dir ("/planner/ui/gantt-view.ui");
priv->merged_id = gtk_ui_manager_add_ui_from_file (priv->ui_manager,
- DATADIR "/planner/ui/gantt-view.ui",
+ filename,
NULL);
-
+ g_free (filename);
gtk_ui_manager_ensure_update (priv->ui_manager);
/* Set the initial UI state. */
@@ -270,6 +273,7 @@
GtkIconFactory *icon_factory;
GtkIconSet *icon_set;
GdkPixbuf *pixbuf;
+ gchar *filename;
priv = PLANNER_GANTT_VIEW (view)->priv;
@@ -279,61 +283,77 @@
icon_factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (icon_factory);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_insert_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_insert_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-insert-task",
icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_remove_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_remove_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-remove-task",
icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_unlink_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_unlink_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-unlink-task",
icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_link_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_link_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-link-task",
icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_indent_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_indent_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-indent-task",
icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_unindent_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_unindent_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-unindent-task",
icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_task_up.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_task_up.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-move-task-up",
icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_task_down.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_task_down.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-move-task-down",
icon_set);
+ g_free (filename);
priv->ui_manager = planner_window_get_ui_manager (main_window);
}
@@ -356,7 +376,13 @@
static const gchar *
gantt_view_get_icon (PlannerView *view)
{
- return IMAGEDIR "/gantt.png";
+ static gchar *filename = NULL;
+
+ if (!filename) {
+ filename = mrp_paths_get_image_dir ("/gantt.png");
+ }
+
+ return filename;
}
static const gchar *
diff -rbNuB -x CVS planner-cvs/src/planner-group-dialog.c planner-paths/src/planner-group-dialog.c
--- planner-cvs/src/planner-group-dialog.c Sat Feb 19 15:22:06 2005
+++ planner-paths/src/planner-group-dialog.c Thu Apr 21 20:24:03 2005
@@ -26,6 +26,7 @@
#include <glib/gi18n.h>
#include <glade/glade.h>
#include <gtk/gtk.h>
+#include "libplanner/mrp-paths.h"
#include "planner-marshal.h"
#include "planner-group-model.h"
#include "planner-group-dialog.h"
@@ -182,6 +183,7 @@
GtkWidget *dialog;
GtkWidget *button;
MrpProject *project;
+ gchar *filename;
data = g_new0 (DialogData, 1);
@@ -190,8 +192,9 @@
data->project = g_object_ref (project);
- gui = glade_xml_new (
- GLADEDIR"/group-dialog.glade", NULL , NULL);
+ filename = mrp_paths_get_glade_dir ( "/group-dialog.glade");
+ gui = glade_xml_new (filename, NULL , NULL);
+ g_free (filename);
dialog = glade_xml_get_widget (gui, "dialog_group_editor");
diff -rbNuB -x CVS planner-cvs/src/planner-html-plugin.c planner-paths/src/planner-html-plugin.c
--- planner-cvs/src/planner-html-plugin.c Mon Apr 18 19:40:44 2005
+++ planner-paths/src/planner-html-plugin.c Thu Apr 21 20:17:01 2005
@@ -25,6 +25,7 @@
#include <glib/gi18n.h>
#include <libgnome/gnome-url.h>
+#include "libplanner/mrp-paths.h"
#include "planner-window.h"
#include "planner-plugin.h"
@@ -214,6 +215,7 @@
PlannerPluginPriv *priv;
GtkUIManager *ui;
GtkActionGroup *actions;
+ gchar *filename;
priv = g_new0 (PlannerPluginPriv, 1);
@@ -230,7 +232,9 @@
ui = planner_window_get_ui_manager (main_window);
gtk_ui_manager_insert_action_group (ui, actions, 0);
- gtk_ui_manager_add_ui_from_file (ui, DATADIR "/planner/ui/html-plugin.ui", NULL);
+ filename = mrp_paths_get_data_dir ("/planner/ui/html-plugin.ui");
+ gtk_ui_manager_add_ui_from_file (ui, filename, NULL);
+ g_free (filename);
gtk_ui_manager_ensure_update (ui);
}
diff -rbNuB -x CVS planner-cvs/src/planner-main.c planner-paths/src/planner-main.c
--- planner-cvs/src/planner-main.c Fri Apr 15 22:05:53 2005
+++ planner-paths/src/planner-main.c Thu Apr 21 20:17:12 2005
@@ -28,6 +28,7 @@
#include <glib/gi18n.h>
#include <libgnome/gnome-program.h>
#include <libgnomeui/gnome-ui-init.h>
+#include "libplanner/mrp-paths.h"
#include "planner-application.h"
#include "planner-window.h"
@@ -49,6 +50,7 @@
},
{ NULL }
};
+ gchar *filename;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -70,9 +72,9 @@
GNOME_PROGRAM_STANDARD_PROPERTIES,
GNOME_PARAM_HUMAN_READABLE_NAME, "Planner",
NULL);
-
- gtk_window_set_default_icon_from_file (DATADIR "/pixmaps/gnome-planner.png", NULL);
-
+ filename = mrp_paths_get_data_dir ("/pixmaps/gnome-planner.png");
+ gtk_window_set_default_icon_from_file (filename, NULL);
+ g_free (filename);
application = planner_application_new ();
main_window = planner_application_new_window (application);
diff -rbNuB -x CVS planner-cvs/src/planner-msp-plugin.c planner-paths/src/planner-msp-plugin.c
--- planner-cvs/src/planner-msp-plugin.c Sat Feb 19 23:15:43 2005
+++ planner-paths/src/planner-msp-plugin.c Thu Apr 21 20:24:45 2005
@@ -27,6 +27,7 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include "libplanner/mrp-paths.h"
#include "planner-conf.h"
#include "planner-window.h"
#include "planner-application.h"
@@ -77,13 +78,16 @@
FILE *file;
gchar *tmp_name, *uri;
MrpProject *project;
+ gchar *filename;
/* libxml housekeeping */
xmlSubstituteEntitiesDefault (1);
xmlLoadExtDtdDefaultValue = 1;
exsltRegisterAll ();
- stylesheet = xsltParseStylesheetFile (STYLESHEETDIR "/msp2planner.xsl");
+ filename = mrp_paths_get_stylesheet_dir ("/msp2planner.xsl");
+ stylesheet = xsltParseStylesheetFile (filename);
+ g_free (filename);
doc = xmlParseFile (input_filename);
if (!doc) {
@@ -99,7 +103,8 @@
return FALSE;
}
- if (!xml_validate (final_doc, DTDDIR "/mrproject-0.6.dtd")) {
+ filename = mrp_paths_get_dtd_dir ("/mrproject-0.6.dtd");
+ if (!xml_validate (final_doc, filename)) {
GtkWidget *dialog;
xsltFreeStylesheet (stylesheet);
@@ -115,9 +120,12 @@
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
+ g_free (filename);
return FALSE;
}
+ g_free (filename);
+
fd = g_file_open_tmp ("planner-msp-XXXXXX", &tmp_name, NULL);
if (fd == -1) {
xsltFreeStylesheet (stylesheet);
@@ -264,6 +272,7 @@
GtkActionGroup *actions;
GtkUIManager *ui;
GError *error = NULL;
+ gchar *filename;
priv = g_new0 (MspPluginPriv, 1);
@@ -278,9 +287,11 @@
ui = planner_window_get_ui_manager (main_window);
gtk_ui_manager_insert_action_group (ui, actions, 0);
- if (!gtk_ui_manager_add_ui_from_file (ui, DATADIR"/planner/ui/msp-plugin.ui", &error)) {
+ filename = mrp_paths_get_data_dir ("/planner/ui/msp-plugin.ui");
+ if (!gtk_ui_manager_add_ui_from_file (ui, filename, &error)) {
g_error_free (error);
}
+ g_free (filename);
gtk_ui_manager_ensure_update (ui);
}
diff -rbNuB -x CVS planner-cvs/src/planner-phase-dialog.c planner-paths/src/planner-phase-dialog.c
--- planner-cvs/src/planner-phase-dialog.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-phase-dialog.c Thu Apr 21 20:18:44 2005
@@ -27,6 +27,7 @@
#include <glade/glade.h>
#include <gtk/gtk.h>
#include <libplanner/mrp-project.h>
+#include "libplanner/mrp-paths.h"
#include "planner-phase-dialog.h"
#define RESPONSE_ADD 1
@@ -176,12 +177,16 @@
GladeXML *glade;
GtkWidget *dialog;
GtkTreeSelection *selection;
+ gchar *filename;
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
- glade = glade_xml_new (GLADEDIR "/project-properties.glade",
+ filename = mrp_paths_get_glade_dir ("/project-properties.glade");
+ glade = glade_xml_new (filename,
"phase_dialog",
GETTEXT_PACKAGE);
+ g_free (filename);
+
if (!glade) {
g_warning ("Could not create phase dialog.");
return NULL;
@@ -422,10 +427,13 @@
GtkWidget *dialog;
GtkWidget *entry;
const gchar *name;
+ gchar *filename;
- glade = glade_xml_new (GLADEDIR "/project-properties.glade",
+ filename = mrp_paths_get_glade_dir ("/project-properties.glade");
+ glade = glade_xml_new (filename,
"new_phase_dialog",
GETTEXT_PACKAGE);
+ g_free (filename);
dialog = glade_xml_get_widget (glade, "new_phase_dialog");
diff -rbNuB -x CVS planner-cvs/src/planner-plugin-loader.c planner-paths/src/planner-plugin-loader.c
--- planner-cvs/src/planner-plugin-loader.c Thu Feb 24 21:31:41 2005
+++ planner-paths/src/planner-plugin-loader.c Thu Apr 21 20:23:56 2005
@@ -24,6 +24,7 @@
#include <string.h>
#include <glib.h>
#include <glib/gi18n.h>
+#include "libplanner/mrp-paths.h"
#include "planner-plugin.h"
#include "planner-plugin-loader.h"
@@ -88,5 +89,11 @@
GList *
planner_plugin_loader_load (PlannerWindow *window)
{
- return mpl_load_dir (PLUGINDIR, window);
+ static gchar *filename = NULL;
+
+ if (!filename) {
+ filename = mrp_paths_get_plugin_dir (NULL);
+ }
+
+ return mpl_load_dir (filename, window);
}
diff -rbNuB -x CVS planner-cvs/src/planner-project-properties.c planner-paths/src/planner-project-properties.c
--- planner-cvs/src/planner-project-properties.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-project-properties.c Thu Apr 21 20:19:12 2005
@@ -33,6 +33,7 @@
#include <glib/gi18n.h>
#include <libplanner/mrp-project.h>
#include <libplanner/mrp-time.h>
+#include "libplanner/mrp-paths.h"
#include "planner-calendar-selector.h"
#include "planner-format.h"
#include "planner-popup-button.h"
@@ -1325,10 +1326,13 @@
GtkWidget *w;
gint response;
gboolean finished = FALSE;
+ gchar *filename;
- glade = glade_xml_new (GLADEDIR "/new-property.glade",
+ filename = mrp_paths_get_glade_dir ("/new-property.glade");
+ glade = glade_xml_new (filename,
NULL,
NULL);
+ g_free (filename);
add_dialog = glade_xml_get_widget (glade, "add_dialog");
@@ -1538,12 +1542,16 @@
gchar *name, *org, *manager;
MrpCalendar *calendar;
GtkWidget *hbox;
+ gchar *filename;
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
- glade = glade_xml_new (GLADEDIR "/project-properties.glade",
+ filename = mrp_paths_get_glade_dir ("/project-properties.glade");
+ glade = glade_xml_new (filename,
"project_properties",
GETTEXT_PACKAGE);
+ g_free (filename);
+
if (!glade) {
g_warning (_("Could not create properties dialog."));
return NULL;
diff -rbNuB -x CVS planner-cvs/src/planner-property-dialog.c planner-paths/src/planner-property-dialog.c
--- planner-cvs/src/planner-property-dialog.c Mon Oct 4 22:29:19 2004
+++ planner-paths/src/planner-property-dialog.c Thu Apr 21 20:19:27 2005
@@ -42,6 +42,7 @@
#include <gtk/gtkmain.h>
#include <libplanner/mrp-object.h>
#include <libplanner/mrp-property.h>
+#include "libplanner/mrp-paths.h"
#include "planner-cell-renderer-list.h"
#include "planner-property-dialog.h"
#include "planner-property-model.h"
@@ -264,12 +265,15 @@
gint response;
gboolean finished = FALSE;
gunichar c;
+ gchar *filename;
priv = GET_PRIV (dialog);
- glade = glade_xml_new (GLADEDIR "/new-property.glade",
+ filename = mrp_paths_get_glade_dir ("/new-property.glade");
+ glade = glade_xml_new (filename,
NULL,
NULL);
+ g_free (filename);
add_dialog = glade_xml_get_widget (glade, "add_dialog");
@@ -566,13 +570,16 @@
GladeXML *glade;
GtkWidget *dialog;
PlannerPropertyDialogPriv *priv;
+ gchar *filename;
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
priv = g_new0 (PlannerPropertyDialogPriv, 1);
- glade = glade_xml_new (GLADEDIR"/property-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/property-dialog.glade");
+ glade = glade_xml_new (filename,
NULL, NULL);
+ g_free (filename);
dialog = glade_xml_get_widget (glade, "dialog");
diff -rbNuB -x CVS planner-cvs/src/planner-resource-dialog.c planner-paths/src/planner-resource-dialog.c
--- planner-cvs/src/planner-resource-dialog.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-resource-dialog.c Thu Apr 21 20:19:36 2005
@@ -31,6 +31,7 @@
#include <libplanner/mrp-resource.h>
#include <libplanner/mrp-calendar.h>
#include <libplanner/mrp-time.h>
+#include "libplanner/mrp-paths.h"
#include "planner-format.h"
#include "planner-resource-dialog.h"
@@ -1689,6 +1690,7 @@
GList *groups;
gint index = 0;
gchar *note;
+ gchar *filename;
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
g_return_val_if_fail (MRP_IS_RESOURCE (resource), NULL);
@@ -1705,9 +1707,11 @@
g_object_get (resource, "project", &project, NULL);
- glade = glade_xml_new (GLADEDIR "/resource-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/resource-dialog.glade");
+ glade = glade_xml_new (filename,
NULL,
GETTEXT_PACKAGE);
+ g_free (filename);
if (!glade) {
g_warning ("Could not create resource dialog.");
return NULL;
diff -rbNuB -x CVS planner-cvs/src/planner-resource-input-dialog.c planner-paths/src/planner-resource-input-dialog.c
--- planner-cvs/src/planner-resource-input-dialog.c Mon Aug 9 12:42:45 2004
+++ planner-paths/src/planner-resource-input-dialog.c Thu Apr 21 20:19:47 2005
@@ -24,6 +24,7 @@
#include <glade/glade.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include "libplanner/mrp-paths.h"
#include "planner-marshal.h"
#include "planner-resource-input-dialog.h"
#include "planner-resource-cmd.h"
@@ -222,6 +223,7 @@
DialogData *data;
GladeXML *gui;
MrpProject *project;
+ gchar *filename;
project = planner_window_get_project (main_window);
@@ -230,8 +232,10 @@
data->project = g_object_ref (project);
data->main_window = g_object_ref (main_window);
- gui = glade_xml_new (GLADEDIR "/resource-input-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/resource-input-dialog.glade");
+ gui = glade_xml_new (filename,
NULL , NULL);
+ g_free (filename);
dialog = glade_xml_get_widget (gui, "resource_input_dialog");
g_signal_connect (dialog,
diff -rbNuB -x CVS planner-cvs/src/planner-resource-view.c planner-paths/src/planner-resource-view.c
--- planner-cvs/src/planner-resource-view.c Wed Apr 20 21:15:02 2005
+++ planner-paths/src/planner-resource-view.c Thu Apr 21 20:23:35 2005
@@ -30,6 +30,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libplanner/mrp-project.h>
+#include "libplanner/mrp-paths.h"
#include "planner-resource-view.h"
#include "planner-cell-renderer-list.h"
#include "planner-group-dialog.h"
@@ -345,6 +346,7 @@
resource_view_activate (PlannerView *view)
{
PlannerResourceViewPriv *priv;
+ gchar *filename;
priv = PLANNER_RESOURCE_VIEW (view)->priv;
@@ -354,9 +356,11 @@
gtk_action_group_add_actions (priv->actions, entries, G_N_ELEMENTS (entries), view);
gtk_ui_manager_insert_action_group (priv->ui_manager, priv->actions, 0);
+ filename = mrp_paths_get_data_dir ("/planner/ui/resource-view.ui");
priv->merged_id = gtk_ui_manager_add_ui_from_file (priv->ui_manager,
- DATADIR "/planner/ui/resource-view.ui",
+ filename,
NULL);
+ g_free (filename);
gtk_ui_manager_ensure_update (priv->ui_manager);
/* Set the initial UI state. */
@@ -388,6 +392,7 @@
GtkIconFactory *icon_factory;
GtkIconSet *icon_set;
GdkPixbuf *pixbuf;
+ gchar *filename;
priv = PLANNER_RESOURCE_VIEW (view)->priv;
@@ -410,33 +415,41 @@
icon_factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (icon_factory);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_insert_resource.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_insert_resource.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-insert-resource",
icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_remove_resource.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_remove_resource.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-remove-resource",
icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_edit_resource.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_edit_resource.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-edit-resource",
icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_groups.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_groups.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory,
"planner-stock-edit-groups",
icon_set);
+ g_free (filename);
priv->ui_manager = planner_window_get_ui_manager(main_window);
}
@@ -456,7 +469,13 @@
static const gchar *
resource_view_get_icon (PlannerView *view)
{
- return IMAGEDIR "/resources.png";
+ static gchar *filename = NULL;
+
+ if (!filename) {
+ filename = mrp_paths_get_image_dir ("/resources.png");
+ }
+
+ return filename;
}
static const gchar *
@@ -1041,7 +1060,7 @@
priv = PLANNER_RESOURCE_VIEW (view)->priv;
planner_column_dialog_show (PLANNER_VIEW (view)->main_window,
- _("Edit Resource Columns"),
+ _("Edit Resoruce Columns"),
GTK_TREE_VIEW (priv->tree_view));
}
diff -rbNuB -x CVS planner-cvs/src/planner-sql-plugin.c planner-paths/src/planner-sql-plugin.c
--- planner-cvs/src/planner-sql-plugin.c Sun Feb 27 21:31:26 2005
+++ planner-paths/src/planner-sql-plugin.c Thu Apr 21 20:23:27 2005
@@ -750,7 +750,9 @@
return -1;
}
- gui = glade_xml_new (GLADEDIR"/sql.glade", "select_dialog", NULL);
+ filename = mrp_path_get_glade_dir ("/sql.glade");
+ gui = glade_xml_new (filename, "select_dialog", NULL);
+ g_free (filename);
dialog = glade_xml_get_widget (gui, "select_dialog");
treeview = glade_xml_get_widget (gui, "project_treeview");
ok_button = glade_xml_get_widget (gui, "ok_button");
@@ -896,7 +898,9 @@
application = planner_window_get_application (plugin->main_window);
- gui = glade_xml_new (GLADEDIR"/sql.glade", "open_dialog" , NULL);
+ filename = mrp_paths_get_glade_dir ("/sql.glade");
+ gui = glade_xml_new (filename, "open_dialog" , NULL);
+ g_free (filename);
dialog = glade_xml_get_widget (gui, "open_dialog");
gtk_window_set_title (GTK_WINDOW (dialog), title);
@@ -1208,12 +1212,13 @@
ui = planner_window_get_ui_manager (main_window);
gtk_ui_manager_insert_action_group (ui, actions, 0);
- if (!gtk_ui_manager_add_ui_from_file (ui, DATADIR"/planner/ui/sql-plugin.ui", &error)) {
+ filename = mrp_paths_get_data_dir ("/planner/ui/sql-plugin.ui");
+ if (!gtk_ui_manager_add_ui_from_file (ui, filename, &error)) {
g_message ("Building menu failed: %s", error->message);
- g_message ("Couldn't load: %s",DATADIR"/planner/ui/sql-plugin.ui");
+ g_message ("Couldn't load: %s",filename);
g_error_free (error);
}
-
+ g_free (filename);
gtk_ui_manager_ensure_update (ui);
}
diff -rbNuB -x CVS planner-cvs/src/planner-task-date-widget.c planner-paths/src/planner-task-date-widget.c
--- planner-cvs/src/planner-task-date-widget.c Sun Feb 20 17:23:30 2005
+++ planner-paths/src/planner-task-date-widget.c Thu Apr 21 20:20:53 2005
@@ -25,6 +25,7 @@
#include "planner-marshal.h"
#include "libplanner/mrp-time.h"
#include "libplanner/mrp-task.h"
+#include "libplanner/mrp-paths.h"
#include "planner-task-date-widget.h"
typedef struct {
@@ -175,15 +176,18 @@
GtkWidget *vbox;
GtkWidget *root_vbox;
GtkWidget *button;
+ gchar *filename;
priv = GET_PRIV (widget);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (widget), vbox);
- glade = glade_xml_new (GLADEDIR "/task-date-widget.glade",
+ filename = mrp_paths_get_glade_dir ("/task-date-widget.glade");
+ glade = glade_xml_new (filename,
"root_vbox",
GETTEXT_PACKAGE);
+ g_free (filename);
if (!glade) {
g_assert_not_reached ();
}
diff -rbNuB -x CVS planner-cvs/src/planner-task-dialog.c planner-paths/src/planner-task-dialog.c
--- planner-cvs/src/planner-task-dialog.c Mon Mar 14 23:05:36 2005
+++ planner-paths/src/planner-task-dialog.c Thu Apr 21 20:21:07 2005
@@ -31,6 +31,7 @@
#include <gtk/gtk.h>
#include <libplanner/mrp-object.h>
#include <libplanner/mrp-project.h>
+#include "libplanner/mrp-paths.h"
#include "planner-cell-renderer-list.h"
#include "planner-assignment-model.h"
#include "planner-predecessor-model.h"
@@ -1848,12 +1849,15 @@
GtkWidget *dialog;
GtkWidget *w;
GList *tasks;
+ gchar *filename;
mrp_object_get (task, "project", &project, NULL);
- glade = glade_xml_new (GLADEDIR "/add-predecessor.glade",
+ filename = mrp_paths_get_glade_dir ("/add-predecessor.glade");
+ glade = glade_xml_new (filename,
NULL,
NULL);
+ g_free (filename);
dialog = glade_xml_get_widget (glade, "add_predecessor_dialog");
@@ -2836,6 +2840,7 @@
GtkSizeGroup *size_group;
MrpProject *project;
MrpCalendar *calendar;
+ gchar *filename;
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
@@ -2849,9 +2854,11 @@
return dialog;
}
- glade = glade_xml_new (GLADEDIR "/task-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/task-dialog.glade");
+ glade = glade_xml_new (filename,
NULL,
GETTEXT_PACKAGE);
+ g_free (filename);
if (!glade) {
g_warning ("Could not create task dialog.");
return NULL;
diff -rbNuB -x CVS planner-cvs/src/planner-task-input-dialog.c planner-paths/src/planner-task-input-dialog.c
--- planner-cvs/src/planner-task-input-dialog.c Mon Jun 14 15:25:18 2004
+++ planner-paths/src/planner-task-input-dialog.c Thu Apr 21 20:21:19 2005
@@ -23,6 +23,7 @@
#include <config.h>
#include <glade/glade.h>
#include <gtk/gtk.h>
+#include "libplanner/mrp-paths.h"
#include "planner-marshal.h"
#include "planner-task-input-dialog.h"
#include "planner-task-cmd.h"
@@ -105,6 +106,7 @@
DialogData *data;
GladeXML *gui;
MrpProject *project;
+ gchar *filename;
data = g_new0 (DialogData, 1);
@@ -113,8 +115,10 @@
data->project = g_object_ref (project);
data->main_window = g_object_ref (main_window);
- gui = glade_xml_new (GLADEDIR "/task-input-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/task-input-dialog.glade");
+ gui = glade_xml_new (filename,
NULL , NULL);
+ g_free (filename);
dialog = glade_xml_get_widget (gui, "task_input_dialog");
g_signal_connect (dialog,
diff -rbNuB -x CVS planner-cvs/src/planner-task-popup.c planner-paths/src/planner-task-popup.c
--- planner-cvs/src/planner-task-popup.c Sun Feb 13 16:14:00 2005
+++ planner-paths/src/planner-task-popup.c Thu Apr 21 20:21:59 2005
@@ -23,6 +23,7 @@
#include <gtk/gtkstock.h>
#include <gtk/gtkmenu.h>
#include <glib/gi18n.h>
+#include "libplanner/mrp-paths.h"
#include "planner-task-tree.h"
#include "planner-task-popup.h"
@@ -136,6 +137,7 @@
GtkIconFactory *icon_factory;
GtkIconSet *icon_set;
GdkPixbuf *pixbuf;
+ gchar *filename;
item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<main>", NULL);
gtk_item_factory_set_translate_func (item_factory,
@@ -150,47 +152,63 @@
icon_factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (icon_factory);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_insert_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_insert_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory, "planner-stock-insert-task", icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_remove_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_remove_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory, "planner-stock-remove-task", icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_unlink_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_unlink_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory, "planner-stock-unlink-task", icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_link_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_link_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory, "planner-stock-link-task", icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_indent_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_indent_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory, "planner-stock-indent-task", icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_unindent_task.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_unindent_task.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory, "planner-stock-unindent-task",
icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_task_up.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_task_up.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory, "planner-stock-move-task-up", icon_set);
+ g_free (filename);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/24_task_down.png", NULL);
+ filename = mrp_paths_get_image_dir ("/24_task_down.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_icon_factory_add (icon_factory, "planner-stock-move-task-down",
icon_set);
+ g_free (filename);
return item_factory;
}
diff -rbNuB -x CVS planner-cvs/src/planner-task-view.c planner-paths/src/planner-task-view.c
--- planner-cvs/src/planner-task-view.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-task-view.c Thu Apr 21 20:22:16 2005
@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include <libplanner/mrp-task.h>
#include "planner-task-view.h"
+#include "libplanner/mrp-paths.h"
#include "planner-conf.h"
#include "planner-cell-renderer-date.h"
#include "planner-task-dialog.h"
@@ -195,6 +196,7 @@
{
PlannerTaskViewPriv *priv;
gboolean show_critical;
+ gchar *filename;
priv = PLANNER_TASK_VIEW (view)->priv;
@@ -209,10 +211,11 @@
view);
gtk_ui_manager_insert_action_group (priv->ui_manager, priv->actions, 0);
+ filename = mrp_paths_get_data_dir ("/planner/ui/task-view.ui");
priv->merged_id = gtk_ui_manager_add_ui_from_file (priv->ui_manager,
- DATADIR "/planner/ui/task-view.ui",
+ filename,
NULL);
-
+ g_free (filename);
gtk_ui_manager_ensure_update (priv->ui_manager);
/* Set the initial UI state. */
@@ -264,7 +267,13 @@
static const gchar *
task_view_get_icon (PlannerView *view)
{
- return IMAGEDIR "/tasks.png";
+ static gchar *filename = NULL;
+
+ if (!filename) {
+ filename = mrp_paths_get_image_dir ("/tasks.png");
+ }
+
+ return filename;
}
static const gchar *
diff -rbNuB -x CVS planner-cvs/src/planner-usage-view.c planner-paths/src/planner-usage-view.c
--- planner-cvs/src/planner-usage-view.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-usage-view.c Thu Apr 21 20:22:32 2005
@@ -25,6 +25,7 @@
#include <gtk/gtk.h>
#include <libplanner/mrp-task.h>
#include <libplanner/mrp-resource.h>
+#include "libplanner/mrp-paths.h"
#include "planner-usage-view.h"
/*#include "planner-usage-print.h"*/
#include "planner-usage-model.h"
@@ -142,6 +143,7 @@
usage_view_activate (PlannerView *view)
{
PlannerUsageViewPriv *priv;
+ gchar *filename;
priv = PLANNER_USAGE_VIEW (view)->priv;
@@ -151,9 +153,11 @@
gtk_action_group_add_actions (priv->actions, entries, G_N_ELEMENTS (entries), view);
gtk_ui_manager_insert_action_group (priv->ui_manager, priv->actions, 0);
+ filename = mrp_paths_get_data_dir ("/planner/ui/time-table-view.ui");
priv->merged_id = gtk_ui_manager_add_ui_from_file (priv->ui_manager,
- DATADIR "/planner/ui/time-table-view.ui",
+ filename,
NULL);
+ g_free (filename);
gtk_ui_manager_ensure_update (priv->ui_manager);
usage_view_update_zoom_sensitivity (view);
@@ -199,7 +203,13 @@
static const gchar *
usage_view_get_icon (PlannerView *view)
{
- return IMAGEDIR "/resources_usage.png";
+ static gchar *filename = NULL;
+
+ if (!filename) {
+ filename = mrp_paths_get_image_dir ("/resources_usage.png");
+ }
+
+ return filename;
}
static const gchar *
diff -rbNuB -x CVS planner-cvs/src/planner-window.c planner-paths/src/planner-window.c
--- planner-cvs/src/planner-window.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-window.c Thu Apr 21 20:22:52 2005
@@ -37,6 +37,7 @@
#include <libgnomeprintui/gnome-print-job-preview.h>
#include <libplanner/mrp-error.h>
#include <libplanner/mrp-project.h>
+#include <libplanner/mrp-paths.h>
#include <libegg/recent-files/egg-recent-view.h>
#include <libegg/recent-files/egg-recent-view-uimanager.h>
#include <libegg/recent-files/egg-recent-util.h>
@@ -460,6 +461,7 @@
GtkRadioActionEntry *r_entries;
gchar *xml_string_tmp, *xml_string;
gchar *str;
+ gchar *filename;
const gchar *xml_string_full =
"<ui>"
"<menubar name='MenuBar'>"
@@ -499,10 +501,11 @@
gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_ui_manager_get_accel_group (priv->ui_manager));
- gtk_ui_manager_add_ui_from_file (priv->ui_manager,
- DATADIR "/planner/ui/main-window.ui",
+ filename = mrp_paths_get_data_dir ("/planner/ui/main-window.ui");
+ gtk_ui_manager_add_ui_from_file(priv->ui_manager,
+ filename ,
NULL);
-
+ g_free (filename);
g_object_set (gtk_action_group_get_action (priv->actions, "EditUndo"),
"sensitive", FALSE,
NULL);
@@ -1189,9 +1192,13 @@
*/
const gchar *translator_credits = N_("translator-credits");
+ gchar *filename;
+
window = PLANNER_WINDOW (data);
- pixbuf = gdk_pixbuf_new_from_file (DATADIR "/pixmaps/gnome-planner.png", NULL);
+ filename = mrp_paths_get_data_dir ("/pixmaps/gnome-planner.png");
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+ g_free (filename);
gtk_about_dialog_set_email_hook ((GtkAboutDialogActivateLinkFunc) handle_links,
GINT_TO_POINTER (LINK_TYPE_EMAIL), NULL);
diff -rbNuB -x CVS planner-cvs/src/planner-working-time-dialog.c planner-paths/src/planner-working-time-dialog.c
--- planner-cvs/src/planner-working-time-dialog.c Tue Apr 19 15:58:18 2005
+++ planner-paths/src/planner-working-time-dialog.c Thu Apr 21 20:23:01 2005
@@ -27,6 +27,7 @@
#include <glade/glade.h>
#include <gtk/gtk.h>
#include <libplanner/mrp-project.h>
+#include "libplanner/mrp-paths.h"
#include "planner-working-time-dialog.h"
#define RESPONSE_CLOSE GTK_RESPONSE_CLOSE
@@ -205,12 +206,15 @@
GtkCellRenderer *cell;
GtkTreeViewColumn *col;
GtkTreeSelection *selection;
+ gchar *filename;
- g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
+ g_return_val_if_fail (PLANNER_IS_MAIN_WINDOW (window), NULL);
- glade = glade_xml_new (GLADEDIR "/calendar-dialog.glade",
+ filename = mrp_paths_get_glade_dir ("/calendar-dialog.glade");
+ glade = glade_xml_new (filename,
"working_time_dialog",
GETTEXT_PACKAGE);
+ g_free (filename);
if (!glade) {
g_warning ("Could not create working_time dialog.");
return NULL;
diff -rbNuB -x CVS planner-cvs/src/planner-xml-planner-plugin.c planner-paths/src/planner-xml-planner-plugin.c
--- planner-cvs/src/planner-xml-planner-plugin.c Mon Oct 4 22:29:19 2004
+++ planner-paths/src/planner-xml-planner-plugin.c Thu Apr 21 20:17:57 2005
@@ -25,6 +25,7 @@
#include <glade/glade.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include <libplanner/mrp-paths.h>
#include "planner-conf.h"
#include "planner-window.h"
#include "planner-plugin.h"
@@ -167,6 +168,7 @@
GtkUIManager *ui;
GtkActionGroup *actions;
GError *error = NULL;
+ gchar *filename;
priv = g_new0 (PlannerPluginPriv, 1);
plugin->priv = priv;
@@ -181,11 +183,13 @@
ui = planner_window_get_ui_manager (main_window);
gtk_ui_manager_insert_action_group (ui, actions, 0);
- if (!gtk_ui_manager_add_ui_from_file (ui, DATADIR"/planner/ui/xml-planner-plugin.ui", &error)) {
+ filename = mrp_paths_get_data_dir ("/planner/ui/xml-planner-plugin.ui");
+ if (!gtk_ui_manager_add_ui_from_file (ui, filename, &error)) {
g_message ("Building menu failed: %s", error->message);
- g_message ("Couldn't load: %s",DATADIR"/planner/ui/xml-planner-plugin.ui");
+ g_message ("Couldn't load: %s",filename);
g_error_free (error);
}
+ g_free (filename);
gtk_ui_manager_ensure_update(ui);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]