[planner] Major trailing white space removal
- From: Maurice van der Pot <mvdpot src gnome org>
- To: svn-commits-list gnome org
- Subject: [planner] Major trailing white space removal
- Date: Tue, 2 Jun 2009 16:04:16 -0400 (EDT)
commit f143a2f502f7e2e6319306b86107d0a865904888
Author: Maurice van der Pot <griffon26 kfk4ever com>
Date: Tue Jun 2 21:30:24 2009 +0200
Major trailing white space removal
Use the --whitespace=fix option when rebasing to master for the first
time after this commit to prevent conflicts with your own commits.
---
eds-backend/e-cal-backend-planner.c | 404 +++++++-------
eds-backend/e-cal-backend-planner.h | 2 +-
eds-backend/planner-source/planner-source.c | 26 +-
eds-backend/utils/create-planner-source.c | 4 +-
libegg/recent-files/egg-recent-item.c | 28 +-
libegg/recent-files/egg-recent-item.h | 2 +-
libegg/recent-files/egg-recent-model.c | 74 ++--
libegg/recent-files/egg-recent-model.h | 2 +-
libegg/recent-files/egg-recent-util.c | 18 +-
libegg/recent-files/egg-recent-vfs-utils.c | 34 +-
libegg/recent-files/egg-recent-vfs-utils.h | 2 +-
libegg/recent-files/egg-recent-view-bonobo.c | 54 +-
libegg/recent-files/egg-recent-view-bonobo.h | 2 +-
libegg/recent-files/egg-recent-view-gtk.c | 28 +-
libegg/recent-files/egg-recent-view-gtk.h | 2 +-
libegg/recent-files/egg-recent-view-uimanager.c | 56 +-
libegg/recent-files/egg-recent-view.h | 2 +-
libplanner/mrp-application.c | 50 +-
libplanner/mrp-assignment.c | 50 +-
libplanner/mrp-calendar.c | 296 +++++-----
libplanner/mrp-day.c | 78 ++--
libplanner/mrp-error.c | 2 +-
libplanner/mrp-error.h | 2 +-
libplanner/mrp-file-module.c | 34 +-
libplanner/mrp-file-module.h | 10 +-
libplanner/mrp-group.c | 54 +-
libplanner/mrp-mpx.c | 12 +-
libplanner/mrp-object.c | 140 +++---
libplanner/mrp-old-xml.c | 224 ++++----
libplanner/mrp-old-xml.h | 4 +-
libplanner/mrp-parser.c | 240 ++++----
libplanner/mrp-paths-gnome.c | 2 +-
libplanner/mrp-paths-win32.c | 20 +-
libplanner/mrp-project.c | 516 +++++++++---------
libplanner/mrp-property.c | 94 ++--
libplanner/mrp-relation.c | 50 +-
libplanner/mrp-relation.h | 2 +-
libplanner/mrp-resource.c | 168 +++---
libplanner/mrp-resource.h | 2 +-
libplanner/mrp-sql.c | 650 +++++++++++-----------
libplanner/mrp-storage-module-factory.c | 24 +-
libplanner/mrp-storage-module-xml.c | 8 +-
libplanner/mrp-storage-module.c | 22 +-
libplanner/mrp-storage-module.h | 2 +-
libplanner/mrp-storage-mrproject.c | 20 +-
libplanner/mrp-storage-mrproject.h | 2 +-
libplanner/mrp-storage-sql.c | 56 +-
libplanner/mrp-task-manager.c | 392 +++++++-------
libplanner/mrp-task.c | 362 ++++++------
libplanner/mrp-task.h | 6 +-
libplanner/mrp-time.c | 212 ++++----
libplanner/mrp-time.h | 2 +-
libplanner/mrp-types.c | 12 +-
libplanner/mrp-types.h | 2 +-
libplanner/mrp-xml.c | 38 +-
libplanner/mrp-xsl.c | 40 +-
python/plannermodule.c | 4 +-
python/planneruimodule.c | 4 +-
src/eel-canvas-rect.c | 68 ++--
src/planner-application.c | 32 +-
src/planner-assignment-model.c | 56 +-
src/planner-calendar-dialog.c | 146 +++---
src/planner-calendar-selector.c | 26 +-
src/planner-calendar.c | 706 +++++++++++-----------
src/planner-calendar.h | 28 +-
src/planner-canvas-line.c | 2 +-
src/planner-cell-renderer-date.c | 62 +-
src/planner-cell-renderer-list.c | 38 +-
src/planner-cell-renderer-popup.c | 64 +-
src/planner-cell-renderer-popup.h | 6 +-
src/planner-cmd-manager.c | 92 ++--
src/planner-cmd-manager.h | 4 +-
src/planner-column-dialog.c | 62 +-
src/planner-conf-gconf.c | 18 +-
src/planner-conf-win32.c | 14 +-
src/planner-conf.h | 2 +-
src/planner-day-type-dialog.c | 50 +-
src/planner-default-week-dialog.c | 64 +-
src/planner-eds-plugin.c | 236 ++++----
src/planner-format.c | 60 +-
src/planner-gantt-background.c | 56 +-
src/planner-gantt-background.h | 2 +-
src/planner-gantt-chart.c | 214 ++++----
src/planner-gantt-header.c | 58 +-
src/planner-gantt-model.c | 148 +++---
src/planner-gantt-print.c | 262 +++++-----
src/planner-gantt-row.c | 600 ++++++++++----------
src/planner-gantt-row.h | 2 +-
src/planner-gantt-view.c | 166 +++---
src/planner-group-dialog.c | 178 +++---
src/planner-group-model.c | 84 ++--
src/planner-html-plugin.c | 32 +-
src/planner-list-model.c | 86 ++--
src/planner-list-model.h | 6 +-
src/planner-main.c | 12 +-
src/planner-msp-plugin.c | 38 +-
src/planner-phase-dialog.c | 98 ++--
src/planner-plugin-loader.c | 18 +-
src/planner-plugin.h | 2 +-
src/planner-popup-button.c | 46 +-
src/planner-popup-entry.c | 30 +-
src/planner-predecessor-model.c | 44 +-
src/planner-print-dialog.c | 62 +-
src/planner-print-job.c | 78 ++--
src/planner-print-job.h | 2 +-
src/planner-project-properties.c | 464 ++++++++--------
src/planner-property-dialog.c | 164 +++---
src/planner-property-model.c | 36 +-
src/planner-python-plugin.c | 18 +-
src/planner-relation-arrow.c | 126 ++--
src/planner-resource-cmd.c | 4 +-
src/planner-resource-dialog.c | 326 ++++++------
src/planner-resource-input-dialog.c | 46 +-
src/planner-resource-view.c | 424 +++++++-------
src/planner-scale-utils.c | 20 +-
src/planner-scale-utils.h | 2 +-
src/planner-sidebar.c | 80 ++--
src/planner-sql-plugin.c | 228 ++++----
src/planner-table-print-sheet.c | 128 ++--
src/planner-task-cmd.c | 30 +-
src/planner-task-date-widget.c | 28 +-
src/planner-task-dialog.c | 450 +++++++-------
src/planner-task-input-dialog.c | 32 +-
src/planner-task-popup.c | 10 +-
src/planner-task-popup.h | 2 +-
src/planner-task-tree.c | 560 +++++++++---------
src/planner-task-view.c | 113 ++--
src/planner-test-plugin.c | 6 +-
src/planner-usage-chart.c | 36 +-
src/planner-usage-chart.h | 2 +-
src/planner-usage-model.c | 10 +-
src/planner-usage-model.h | 2 +-
src/planner-usage-row.c | 82 ++--
src/planner-usage-row.h | 1 -
src/planner-usage-tree.c | 8 +-
src/planner-usage-view.c | 42 +-
src/planner-util-win32.c | 2 +-
src/planner-view.c | 14 +-
src/planner-view.h | 4 +-
src/planner-window.c | 334 ++++++------
src/planner-window.h | 2 +-
src/planner-working-time-dialog.c | 60 +-
src/planner-xml-planner-plugin.c | 26 +-
tests/calendar-test.c | 30 +-
tests/scheduler-test.c | 32 +-
tests/self-check.c | 16 +-
tests/task-test.c | 56 +-
147 files changed, 6431 insertions(+), 6433 deletions(-)
diff --git a/eds-backend/e-cal-backend-planner.c b/eds-backend/e-cal-backend-planner.c
index 0487902..a89fead 100644
--- a/eds-backend/e-cal-backend-planner.c
+++ b/eds-backend/e-cal-backend-planner.c
@@ -58,100 +58,100 @@ struct _ECalBackendPlannerPrivate {
/* Backend implementation */
static void cbp_dispose (GObject *object);
static void cbp_finalize (GObject *object);
-static ECalBackendSyncStatus cbp_is_read_only (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_is_read_only (ECalBackendSync *backend,
+ EDataCal *cal,
gboolean *read_only);
-static ECalBackendSyncStatus cbp_get_cal_address (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_get_cal_address (ECalBackendSync *backend,
+ EDataCal *cal,
char **address);
-static ECalBackendSyncStatus cbp_get_ldap_attribute (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_get_ldap_attribute (ECalBackendSync *backend,
+ EDataCal *cal,
char **attribute);
-static ECalBackendSyncStatus cbp_get_alarm_email_address (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_get_alarm_email_address (ECalBackendSync *backend,
+ EDataCal *cal,
char **address);
-static ECalBackendSyncStatus cbp_get_static_capabilities (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_get_static_capabilities (ECalBackendSync *backend,
+ EDataCal *cal,
char **capabilities);
-static ECalBackendSyncStatus cbp_open (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_open (ECalBackendSync *backend,
+ EDataCal *cal,
gboolean only_if_exists,
- const gchar *username,
+ const gchar *username,
const gchar *password);
-static ECalBackendSyncStatus cbp_remove (ECalBackendSync *backend,
+static ECalBackendSyncStatus cbp_remove (ECalBackendSync *backend,
EDataCal *cal);
static gboolean cbp_is_loaded (ECalBackend *backend);
static CalMode cbp_get_mode (ECalBackend *backend);
-static void cbp_set_mode (ECalBackend *backend,
+static void cbp_set_mode (ECalBackend *backend,
CalMode mode);
-static ECalBackendSyncStatus cbp_get_default_object (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_get_default_object (ECalBackendSync *backend,
+ EDataCal *cal,
char **object);
-static ECalBackendSyncStatus cbp_get_object (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *uid,
- const gchar *rid,
+static ECalBackendSyncStatus cbp_get_object (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *uid,
+ const gchar *rid,
gchar **object);
-static ECalBackendSyncStatus cbp_get_timezone (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *tzid,
+static ECalBackendSyncStatus cbp_get_timezone (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *tzid,
char **object);
-static ECalBackendSyncStatus cbp_add_timezone (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_add_timezone (ECalBackendSync *backend,
+ EDataCal *cal,
const gchar *tzobj);
-static ECalBackendSyncStatus cbp_set_default_timezone (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_set_default_timezone (ECalBackendSync *backend,
+ EDataCal *cal,
const gchar *tzid);
-static ECalBackendSyncStatus cbp_get_object_list (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *sexp,
+static ECalBackendSyncStatus cbp_get_object_list (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *sexp,
GList **objects);
-static void cbp_start_query (ECalBackend *backend,
+static void cbp_start_query (ECalBackend *backend,
EDataCalView *query);
-static ECalBackendSyncStatus cbp_get_free_busy (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_get_free_busy (ECalBackendSync *backend,
+ EDataCal *cal,
GList *users,
- time_t start,
- time_t end,
+ time_t start,
+ time_t end,
GList **freebusy);
-static ECalBackendSyncStatus cbp_get_changes (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_get_changes (ECalBackendSync *backend,
+ EDataCal *cal,
const char *change_id,
- GList **adds,
- GList **modifies,
+ GList **adds,
+ GList **modifies,
GList **deletes);
-static ECalBackendSyncStatus cbp_discard_alarm (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *uid,
+static ECalBackendSyncStatus cbp_discard_alarm (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *uid,
const gchar *auid);
-static ECalBackendSyncStatus cbp_create_object (ECalBackendSync *backend,
- EDataCal *cal,
- gchar **calobj,
+static ECalBackendSyncStatus cbp_create_object (ECalBackendSync *backend,
+ EDataCal *cal,
+ gchar **calobj,
gchar **uid);
-static ECalBackendSyncStatus cbp_modify_object (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *calobj,
- CalObjModType mod,
+static ECalBackendSyncStatus cbp_modify_object (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *calobj,
+ CalObjModType mod,
char **old_object);
-static ECalBackendSyncStatus cbp_remove_object (ECalBackendSync *backend,
+static ECalBackendSyncStatus cbp_remove_object (ECalBackendSync *backend,
EDataCal *cal,
- const gchar *uid,
+ const gchar *uid,
const gchar *rid,
- CalObjModType mod,
+ CalObjModType mod,
gchar **object);
-static ECalBackendSyncStatus cbp_receive_objects (ECalBackendSync *backend,
- EDataCal *cal,
+static ECalBackendSyncStatus cbp_receive_objects (ECalBackendSync *backend,
+ EDataCal *cal,
const gchar *calobj);
-static ECalBackendSyncStatus cbp_send_objects (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *calobj,
+static ECalBackendSyncStatus cbp_send_objects (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *calobj,
GList **users,
gchar **modified_calobj);
static icaltimezone * cbp_internal_get_default_timezone (ECalBackend *backend);
-static icaltimezone * cbp_internal_get_timezone (ECalBackend *backend,
+static icaltimezone * cbp_internal_get_timezone (ECalBackend *backend,
const gchar *tzid);
/* Utilities */
@@ -165,15 +165,15 @@ static gboolean get_planner_tasks_cb (ECalBackendPlanner *cb
static void add_comp_to_list (gpointer key,
gpointer value,
GList **comps);
-static void dump_print (gpointer key,
- gpointer value,
+static void dump_print (gpointer key,
+ gpointer value,
gpointer user_data);
static void dump_cache (ECalBackendPlanner *backend);
-static ECalComponent * lookup_component (ECalBackendPlanner *backend,
+static ECalComponent * lookup_component (ECalBackendPlanner *backend,
const char *uid);
-static MrpTask * lookup_task (ECalBackendPlanner *backend,
+static MrpTask * lookup_task (ECalBackendPlanner *backend,
const char *uid);
-static void task_replace (MrpProject *project,
+static void task_replace (MrpProject *project,
MrpTask *task,
MrpTask *task_new);
static void task_add_properties (MrpProject *project);
@@ -198,17 +198,17 @@ dump_print (gpointer key,
}
static void
-dump_cache (ECalBackendPlanner *backend)
+dump_cache (ECalBackendPlanner *backend)
{
ECalBackendPlannerPrivate *priv;
- priv = backend->priv;
+ priv = backend->priv;
g_hash_table_foreach (priv->tasks_comp, dump_print, NULL);
}
/* Looks up a component by its UID on the backend's component hash table */
static ECalComponent *
-lookup_component (ECalBackendPlanner *backend,
+lookup_component (ECalBackendPlanner *backend,
const char *uid)
{
ECalBackendPlannerPrivate *priv;
@@ -229,7 +229,7 @@ lookup_component (ECalBackendPlanner *backend,
/* Looks up a component by its UID on the backend's component hash table */
static MrpTask *
-lookup_task (ECalBackendPlanner *backend,
+lookup_task (ECalBackendPlanner *backend,
const char *uid)
{
ECalBackendPlannerPrivate *priv;
@@ -252,8 +252,8 @@ lookup_task (ECalBackendPlanner *backend,
}
/* Replace a MrpTask in a MrpProject */
-static void
-task_replace (MrpProject *project,
+static void
+task_replace (MrpProject *project,
MrpTask *task,
MrpTask *task_new)
{
@@ -282,9 +282,9 @@ task_add_properties (MrpProject *project)
MrpProperty *property;
/* eds-uid */
- if (!mrp_project_has_property (project,
+ if (!mrp_project_has_property (project,
MRP_TYPE_TASK, "eds-uid")) {
- property = mrp_property_new ("eds-uid",
+ property = mrp_property_new ("eds-uid",
MRP_PROPERTY_TYPE_STRING,
_("EDS UID"),
_("Identifier used by Evolution Data Server for tasks"),
@@ -292,9 +292,9 @@ task_add_properties (MrpProject *project)
mrp_project_add_property (project, MRP_TYPE_TASK, property, FALSE);
}
/* Categories */
- if (!mrp_project_has_property (project,
+ if (!mrp_project_has_property (project,
MRP_TYPE_TASK, "eds-categories")) {
- property = mrp_property_new ("eds-categories",
+ property = mrp_property_new ("eds-categories",
MRP_PROPERTY_TYPE_STRING,
_("EDS Categories"),
_("Categories for a task used by Evolution Data Server"),
@@ -302,9 +302,9 @@ task_add_properties (MrpProject *project)
mrp_project_add_property (project, MRP_TYPE_TASK, property, FALSE);
}
/* Classification */
- if (!mrp_project_has_property (project,
+ if (!mrp_project_has_property (project,
MRP_TYPE_TASK, "eds-classification")) {
- property = mrp_property_new ("eds-classification",
+ property = mrp_property_new ("eds-classification",
MRP_PROPERTY_TYPE_INT,
_("EDS Classification"),
_("Task access classification used by Evolution Data Server"),
@@ -312,9 +312,9 @@ task_add_properties (MrpProject *project)
mrp_project_add_property (project, MRP_TYPE_TASK, property, FALSE);
}
/* Web page */
- if (!mrp_project_has_property (project,
+ if (!mrp_project_has_property (project,
MRP_TYPE_TASK, "eds-url")) {
- property = mrp_property_new ("eds-url",
+ property = mrp_property_new ("eds-url",
MRP_PROPERTY_TYPE_STRING,
_("EDS URL"),
_("URL for a Task used by Evolution Data Server"),
@@ -375,20 +375,20 @@ cbp_finalize (GObject *object)
/* Is_read_only handler for the file backend */
/* It will be read and write in the future */
static ECalBackendSyncStatus
-cbp_is_read_only (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_is_read_only (ECalBackendSync *backend,
+ EDataCal *cal,
gboolean *read_only)
{
*read_only = FALSE;
-
+
return GNOME_Evolution_Calendar_Success;
}
-/* FIXME: The only address for the Planner backend is the file
+/* FIXME: The only address for the Planner backend is the file
for the moment. Later we will have a URI */
static ECalBackendSyncStatus
-cbp_get_cal_address (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_get_cal_address (ECalBackendSync *backend,
+ EDataCal *cal,
char **address)
{
*address = NULL;
@@ -397,28 +397,28 @@ cbp_get_cal_address (ECalBackendSync *backend,
}
static ECalBackendSyncStatus
-cbp_get_ldap_attribute (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_get_ldap_attribute (ECalBackendSync *backend,
+ EDataCal *cal,
char **attribute)
{
*attribute = NULL;
-
+
return GNOME_Evolution_Calendar_Success;
}
static ECalBackendSyncStatus
-cbp_get_alarm_email_address (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_get_alarm_email_address (ECalBackendSync *backend,
+ EDataCal *cal,
char **address)
{
*address = NULL;
-
+
return GNOME_Evolution_Calendar_Success;
}
static ECalBackendSyncStatus
-cbp_get_static_capabilities (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_get_static_capabilities (ECalBackendSync *backend,
+ EDataCal *cal,
char **capabilities)
{
*capabilities = g_strdup (CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS);
@@ -449,9 +449,9 @@ task_to_comp (MrpTask *task)
comp = e_cal_component_new ();
e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_TODO);
- mrp_object_get (task,
- "eds-uid", &uid,
- "name", &name,
+ mrp_object_get (task,
+ "eds-uid", &uid,
+ "name", &name,
"note", ¬e,
"eds-url", &url,
"eds-categories", &categories,
@@ -472,7 +472,7 @@ task_to_comp (MrpTask *task)
dt_end.tzid = NULL;
if (!uid) {
uid = e_uid_new ();
- mrp_object_set (task, "eds-uid", uid, NULL);
+ mrp_object_set (task, "eds-uid", uid, NULL);
}
g_message ("New task found: %s %s", uid, name);
e_cal_component_set_uid (comp, uid);
@@ -485,7 +485,7 @@ task_to_comp (MrpTask *task)
/* url */
e_cal_component_set_url (comp, url);
g_free (url);
-
+
/* description */
if (note) {
GSList l;
@@ -527,7 +527,7 @@ task_to_comp (MrpTask *task)
e_cal_component_set_attendee_list (comp, attendee_list);
/* priority */
- /* FIXME: In planner we use a open field. In evo, only from 0-9
+ /* FIXME: In planner we use a open field. In evo, only from 0-9
and it is translated to a string */
e_cal_component_set_priority (comp, &priority);
@@ -540,17 +540,17 @@ task_to_comp (MrpTask *task)
GSList *categories_list = NULL;
guint i;
- g_message ("Categories: %s", categories);
+ g_message ("Categories: %s", categories);
categories_array = g_strsplit (categories, ",", -1);
g_message ("Category 0: %s", categories_array[0]);
for (i = 0; categories_array[i]; i++) {
- categories_list = g_slist_append (categories_list,
+ categories_list = g_slist_append (categories_list,
g_strdup (categories_array[i]));
}
e_cal_component_set_categories_list (comp, categories_list);
g_strfreev(categories_array);
}
-
+
/* classification */
e_cal_component_set_classification (comp, classification);
@@ -593,12 +593,12 @@ comp_categories_as_char (ECalComponent *comp)
e_cal_component_get_categories_list (comp, &slist_cat);
if (slist_cat) {
GString *str = g_string_new ("");
-
+
for (sl = slist_cat; sl != NULL; sl = sl->next) {
str = g_string_append (str, sl->data);
str = g_string_append (str, ",");
}
-
+
cat = g_strdup (str->str);
g_string_free (str, TRUE);
e_cal_component_free_text_list (slist_cat);
@@ -621,7 +621,7 @@ comp_desc_as_char (ECalComponent *comp)
if (pt && pt->value)
str = g_string_append (str, pt->value);
- }
+ }
desc = g_strdup (str->str);
g_string_free (str, TRUE);
@@ -649,7 +649,7 @@ comp_to_task (MrpProject *project,
const gchar *uid;
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
-
+
task = mrp_task_new ();
mrp_project_insert_task (project, NULL, -1, task);
@@ -669,9 +669,9 @@ comp_to_task (MrpProject *project,
note = comp_desc_as_char (comp);
categories = comp_categories_as_char (comp);
- mrp_object_set (task,
- "eds-uid", uid,
- "name", summary.value ? summary.value : "",
+ mrp_object_set (task,
+ "eds-uid", uid,
+ "name", summary.value ? summary.value : "",
"eds-url", url ? url : "",
"note", note ? note : "",
"eds-categories", categories ? categories : "",
@@ -680,20 +680,20 @@ comp_to_task (MrpProject *project,
"finish", &end, */
NULL);
if (!priority) {
- mrp_object_set (task, "priority", 0, NULL);
+ mrp_object_set (task, "priority", 0, NULL);
} else {
- mrp_object_set (task, "priority", *priority, NULL);
-
+ mrp_object_set (task, "priority", *priority, NULL);
+
}
if (!complete) {
- mrp_object_set (task,"percent-complete", 0, NULL);
+ mrp_object_set (task,"percent-complete", 0, NULL);
} else {
- mrp_object_set (task,"percent-complete", *complete, NULL);
+ mrp_object_set (task,"percent-complete", *complete, NULL);
}
/* Time to save the resources */
if (e_cal_component_has_attendees (comp)) {
GSList *attendee_list, *al;
- GError *error = NULL;
+ GError *error = NULL;
GList *resources = NULL, *l = NULL;
/* We remove all the old resources: we are loosing here the data
@@ -705,7 +705,7 @@ comp_to_task (MrpProject *project,
mrp_project_remove_resource (project, l->data);
g_object_unref (l->data);
}
-
+
g_message ("The comp has attendee");
e_cal_component_get_attendee_list (comp, &attendee_list);
@@ -724,11 +724,11 @@ comp_to_task (MrpProject *project,
}
if (attendee->cutype == ICAL_CUTYPE_ROOM ||
attendee->cutype == ICAL_CUTYPE_RESOURCE) {
- mrp_object_set (resource, "type",
+ mrp_object_set (resource, "type",
MRP_RESOURCE_TYPE_MATERIAL, NULL);
} else {
- mrp_object_set (resource, "type",
- MRP_RESOURCE_TYPE_WORK, NULL);
+ mrp_object_set (resource, "type",
+ MRP_RESOURCE_TYPE_WORK, NULL);
}
if (email) {
@@ -767,7 +767,7 @@ get_planner_tasks_cb (ECalBackendPlanner *cbplanner)
comp = task_to_comp (l->data);
e_cal_component_get_uid (comp, &uid);
- g_hash_table_insert (priv->tasks_comp, (gpointer) uid, comp);
+ g_hash_table_insert (priv->tasks_comp, (gpointer) uid, comp);
}
d(g_message ("Planner task retrieval done.\n"));
@@ -775,12 +775,12 @@ get_planner_tasks_cb (ECalBackendPlanner *cbplanner)
return FALSE;
}
-static char*
+static char*
form_uri (ESource *source)
{
guint len;
gchar *uri;
- gchar *formed_uri;
+ gchar *formed_uri;
uri = e_source_get_uri (source);
if (uri == NULL) {
@@ -788,7 +788,7 @@ form_uri (ESource *source)
}
g_message ("URI to open: %s", uri);
-
+
/* Remove planer:// */
len = strlen (uri);
if (len > 10) {
@@ -796,9 +796,9 @@ form_uri (ESource *source)
formed_uri = g_strdup (uri + 10);
} else {
return NULL;
- }
+ }
g_message ("Parsed URI to open: %s", formed_uri);
-
+
g_free (uri);
return formed_uri;
@@ -806,10 +806,10 @@ form_uri (ESource *source)
/* Open handler for the file backend */
static ECalBackendSyncStatus
-cbp_open (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_open (ECalBackendSync *backend,
+ EDataCal *cal,
gboolean only_if_exists,
- const gchar *username,
+ const gchar *username,
const gchar *password)
{
ECalBackendPlanner *cbplanner;
@@ -820,7 +820,7 @@ cbp_open (ECalBackendSync *backend,
g_message ("Open planner tasks ...");
-
+
source = e_cal_backend_get_source (E_CAL_BACKEND (backend));
if (source) {
uri = form_uri (source);
@@ -829,13 +829,13 @@ cbp_open (ECalBackendSync *backend,
e_cal_backend_notify_error (E_CAL_BACKEND (backend), _("Invalid server URI"));
return GNOME_Evolution_Calendar_NoSuchCal;
}
-
+
cbplanner = E_CAL_BACKEND_PLANNER (backend);
priv = cbplanner->priv;
if (priv->project_loaded) {
g_warning ("Reopening project ... we need to check for new tasks ...");
- return GNOME_Evolution_Calendar_Success;
+ return GNOME_Evolution_Calendar_Success;
} else {
g_warning ("Openinig project for the first time ...");
}
@@ -857,12 +857,12 @@ cbp_open (ECalBackendSync *backend,
}
static ECalBackendSyncStatus
-cbp_remove (ECalBackendSync *backend,
+cbp_remove (ECalBackendSync *backend,
EDataCal *cal)
{
ECalBackendPlanner *cbplanner;
ECalBackendPlannerPrivate *priv;
-
+
cbplanner = E_CAL_BACKEND_PLANNER (backend);
priv = cbplanner->priv;
@@ -899,7 +899,7 @@ cbp_get_mode (ECalBackend *backend)
/* Set_mode handler for the planner backend */
static void
-cbp_set_mode (ECalBackend *backend,
+cbp_set_mode (ECalBackend *backend,
CalMode mode)
{
ECalBackendPlanner *cbplanner;
@@ -935,8 +935,8 @@ cbp_set_mode (ECalBackend *backend,
}
static ECalBackendSyncStatus
-cbp_get_default_object (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_get_default_object (ECalBackendSync *backend,
+ EDataCal *cal,
char **object)
{
ECalBackendPlanner *cbplanner;
@@ -957,10 +957,10 @@ cbp_get_default_object (ECalBackendSync *backend,
/* Get_object_component handler for the planner backend */
static ECalBackendSyncStatus
-cbp_get_object (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *uid,
- const gchar *rid,
+cbp_get_object (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *uid,
+ const gchar *rid,
gchar **object)
{
ECalBackendPlanner *cbplanner;
@@ -972,7 +972,7 @@ cbp_get_object (ECalBackendSync *backend,
g_return_val_if_fail (uid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
- comp = g_hash_table_lookup (priv->tasks_comp, uid);
+ comp = g_hash_table_lookup (priv->tasks_comp, uid);
/* comp = e_cal_backend_cache_get_component (priv->cache, uid, rid); */
/* We take the comp directly from libplanner */
if (!comp)
@@ -985,9 +985,9 @@ cbp_get_object (ECalBackendSync *backend,
/* Get_timezone_object handler for the file backend */
static ECalBackendSyncStatus
-cbp_get_timezone (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *tzid,
+cbp_get_timezone (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *tzid,
char **object)
{
ECalBackendPlanner *cbplanner;
@@ -1015,8 +1015,8 @@ cbp_get_timezone (ECalBackendSync *backend,
/* Add_timezone handler for the file backend */
static ECalBackendSyncStatus
-cbp_add_timezone (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_add_timezone (ECalBackendSync *backend,
+ EDataCal *cal,
const gchar *tzobj)
{
ECalBackendPlanner *cbplanner;
@@ -1024,7 +1024,7 @@ cbp_add_timezone (ECalBackendSync *backend,
cbplanner = (ECalBackendPlanner *) backend;
- g_return_val_if_fail (E_IS_CAL_BACKEND_PLANNER (cbplanner),
+ g_return_val_if_fail (E_IS_CAL_BACKEND_PLANNER (cbplanner),
GNOME_Evolution_Calendar_OtherError);
g_return_val_if_fail (tzobj != NULL, GNOME_Evolution_Calendar_OtherError);
@@ -1035,8 +1035,8 @@ cbp_add_timezone (ECalBackendSync *backend,
}
static ECalBackendSyncStatus
-cbp_set_default_timezone (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_set_default_timezone (ECalBackendSync *backend,
+ EDataCal *cal,
const gchar *tzid)
{
ECalBackendPlanner *cbplanner;
@@ -1044,7 +1044,7 @@ cbp_set_default_timezone (ECalBackendSync *backend,
cbplanner = E_CAL_BACKEND_PLANNER (backend);
priv = cbplanner->priv;
-
+
/* FIXME */
return GNOME_Evolution_Calendar_Success;
}
@@ -1062,9 +1062,9 @@ add_comp_to_list (gpointer key,
/* Get_objects_in_range handler for the planner backend */
static ECalBackendSyncStatus
-cbp_get_object_list (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *sexp,
+cbp_get_object_list (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *sexp,
GList **objects)
{
ECalBackendPlanner *cbplanner;
@@ -1082,10 +1082,10 @@ cbp_get_object_list (ECalBackendSync *backend,
*objects = NULL;
g_hash_table_foreach (priv->tasks_comp, (GHFunc) add_comp_to_list, &comps);
for (l = comps; l; l = l->next) {
- if (e_cal_backend_sexp_match_comp (cbsexp,
- E_CAL_COMPONENT (l->data),
+ if (e_cal_backend_sexp_match_comp (cbsexp,
+ E_CAL_COMPONENT (l->data),
E_CAL_BACKEND (backend))) {
- *objects = g_list_append (*objects,
+ *objects = g_list_append (*objects,
e_cal_component_get_as_string (l->data));
}
}
@@ -1097,7 +1097,7 @@ cbp_get_object_list (ECalBackendSync *backend,
/* get_query handler for the planner backend */
static void
-cbp_start_query (ECalBackend *backend,
+cbp_start_query (ECalBackend *backend,
EDataCalView *query)
{
ECalBackendPlanner *cbplanner;
@@ -1118,10 +1118,10 @@ cbp_start_query (ECalBackend *backend,
/* FIXME: get components from Planner */
g_hash_table_foreach (priv->tasks_comp, (GHFunc) add_comp_to_list, &comps);
for (l = comps; l; l = l->next) {
- if (e_cal_backend_sexp_match_comp (cbsexp,
- E_CAL_COMPONENT (l->data),
+ if (e_cal_backend_sexp_match_comp (cbsexp,
+ E_CAL_COMPONENT (l->data),
E_CAL_BACKEND (backend))) {
- objects = g_list_append (objects,
+ objects = g_list_append (objects,
e_cal_component_get_as_string (l->data));
}
}
@@ -1138,11 +1138,11 @@ cbp_start_query (ECalBackend *backend,
/* Get_free_busy handler for the planner backend */
static ECalBackendSyncStatus
-cbp_get_free_busy (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_get_free_busy (ECalBackendSync *backend,
+ EDataCal *cal,
GList *users,
- time_t start,
- time_t end,
+ time_t start,
+ time_t end,
GList **freebusy)
{
ECalBackendPlanner *cbplanner;
@@ -1151,7 +1151,7 @@ cbp_get_free_busy (ECalBackendSync *backend,
cbplanner = E_CAL_BACKEND_PLANNER (backend);
priv = cbplanner->priv;
- g_return_val_if_fail (start != -1 && end != -1,
+ g_return_val_if_fail (start != -1 && end != -1,
GNOME_Evolution_Calendar_InvalidRange);
g_return_val_if_fail (start <= end, GNOME_Evolution_Calendar_InvalidRange);
@@ -1161,11 +1161,11 @@ cbp_get_free_busy (ECalBackendSync *backend,
/* Get_changes handler for the planner backend */
static ECalBackendSyncStatus
-cbp_get_changes (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_get_changes (ECalBackendSync *backend,
+ EDataCal *cal,
const char *change_id,
- GList **adds,
- GList **modifies,
+ GList **adds,
+ GList **modifies,
GList **deletes)
{
ECalBackendPlanner *cbplanner;
@@ -1182,9 +1182,9 @@ cbp_get_changes (ECalBackendSync *backend,
/* Discard_alarm handler for the planner backend */
static ECalBackendSyncStatus
-cbp_discard_alarm (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *uid,
+cbp_discard_alarm (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *uid,
const gchar *auid)
{
ECalBackendPlanner *cbplanner;
@@ -1198,9 +1198,9 @@ cbp_discard_alarm (ECalBackendSync *backend,
}
static ECalBackendSyncStatus
-cbp_create_object (ECalBackendSync *backend,
- EDataCal *cal,
- gchar **calobj,
+cbp_create_object (ECalBackendSync *backend,
+ EDataCal *cal,
+ gchar **calobj,
gchar **uid)
{
ECalBackendPlanner *cbplanner;
@@ -1211,7 +1211,7 @@ cbp_create_object (ECalBackendSync *backend,
struct icaltimetype current;
MrpTask *task;
GError *error = NULL;
-
+
cbplanner = E_CAL_BACKEND_PLANNER (backend);
priv = cbplanner->priv;
@@ -1247,7 +1247,7 @@ cbp_create_object (ECalBackendSync *backend,
g_message ("Creating a new object %s", comp_uid);
-
+
/* check the object is not in our cache */
if (lookup_component (cbplanner, comp_uid)) {
icalcomponent_free (icalcomp);
@@ -1276,15 +1276,15 @@ cbp_create_object (ECalBackendSync *backend,
/* return GNOME_Evolution_Calendar_PermissionDenied; */
}
-/* FIXME: not finished.
+/* FIXME: not finished.
This method is called for the moment when:
- You check the done checkbox
*/
static ECalBackendSyncStatus
-cbp_modify_object (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *calobj,
- CalObjModType mod,
+cbp_modify_object (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *calobj,
+ CalObjModType mod,
char **old_object)
{
ECalBackendPlanner *cbplanner;
@@ -1300,7 +1300,7 @@ cbp_modify_object (ECalBackendSync *backend,
cbplanner = E_CAL_BACKEND_PLANNER (backend);
priv = cbplanner->priv;
- g_return_val_if_fail (E_IS_CAL_BACKEND_PLANNER (cbplanner),
+ g_return_val_if_fail (E_IS_CAL_BACKEND_PLANNER (cbplanner),
GNOME_Evolution_Calendar_InvalidObject);
g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
@@ -1341,7 +1341,7 @@ cbp_modify_object (ECalBackendSync *backend,
g_hash_table_replace (priv->tasks_comp, (gpointer) comp_uid, comp);
task_replace (priv->project, task, task_new);
mrp_project_save (priv->project, TRUE, &error);
-
+
/* Inform evolution about the object removed */
if (!E_IS_CAL_COMPONENT (cache_comp)) {
g_warning ("we don't have the old component ...");
@@ -1356,11 +1356,11 @@ cbp_modify_object (ECalBackendSync *backend,
/* Remove_object handler for the planner backend */
static ECalBackendSyncStatus
-cbp_remove_object (ECalBackendSync *backend,
+cbp_remove_object (ECalBackendSync *backend,
EDataCal *cal,
- const gchar *uid,
+ const gchar *uid,
const gchar *rid,
- CalObjModType mod,
+ CalObjModType mod,
gchar **object)
{
ECalBackendPlanner *cbplanner;
@@ -1378,7 +1378,7 @@ cbp_remove_object (ECalBackendSync *backend,
comp = lookup_component (cbplanner, uid);
g_hash_table_remove (priv->tasks_comp, (gpointer) uid);
g_object_unref (comp);
- task = lookup_task (cbplanner, uid);
+ task = lookup_task (cbplanner, uid);
mrp_project_remove_task (priv->project, task);
g_object_unref (task);
mrp_project_save (priv->project, TRUE, &error);
@@ -1388,13 +1388,13 @@ cbp_remove_object (ECalBackendSync *backend,
/* Update_objects handler for the planner backend. */
static ECalBackendSyncStatus
-cbp_receive_objects (ECalBackendSync *backend,
- EDataCal *cal,
+cbp_receive_objects (ECalBackendSync *backend,
+ EDataCal *cal,
const gchar *calobj)
{
ECalBackendPlanner *cbplanner;
ECalBackendPlannerPrivate *priv;
- icalcomponent *icalcomp;
+ icalcomponent *icalcomp;
/* icalcomponent *subcomp; */
cbplanner = E_CAL_BACKEND_PLANNER (backend);
@@ -1407,17 +1407,17 @@ cbp_receive_objects (ECalBackendSync *backend,
return GNOME_Evolution_Calendar_InvalidObject;
g_message ("Modifying object: %s", calobj);
-
+
/* return GNOME_Evolution_Calendar_PermissionDenied;*/
return GNOME_Evolution_Calendar_Success;
-
+
}
static ECalBackendSyncStatus
-cbp_send_objects (ECalBackendSync *backend,
- EDataCal *cal,
- const gchar *calobj,
+cbp_send_objects (ECalBackendSync *backend,
+ EDataCal *cal,
+ const gchar *calobj,
GList **users,
gchar **modified_calobj)
{
@@ -1444,7 +1444,7 @@ cbp_internal_get_default_timezone (ECalBackend *backend)
}
static icaltimezone *
-cbp_internal_get_timezone (ECalBackend *backend,
+cbp_internal_get_timezone (ECalBackend *backend,
const gchar *tzid)
{
ECalBackendPlanner *cbplanner;
@@ -1465,7 +1465,7 @@ cbp_internal_get_timezone (ECalBackend *backend,
/* Object initialization function for the file backend */
static void
-cbp_init (ECalBackendPlanner *cbplanner,
+cbp_init (ECalBackendPlanner *cbplanner,
ECalBackendPlannerClass *class)
{
ECalBackendPlannerPrivate *priv;
@@ -1495,7 +1495,7 @@ cbp_class_init (ECalBackendPlannerClass *class)
sync_class = (ECalBackendSyncClass *) class;
class->mrp_app = mrp_application_new ();
-
+
parent_class = (ECalBackendSyncClass *) g_type_class_peek_parent (class);
@@ -1536,11 +1536,11 @@ cbp_class_init (ECalBackendPlannerClass *class)
/**
* cbp_get_type:
- * @void:
- *
+ * @void:
+ *
* Registers the #ECalBackendPlanner class if necessary, and returns the type ID
* associated to it.
- *
+ *
* Return value: The type ID of the #ECalBackendPlanner class.
**/
GType
@@ -1560,7 +1560,7 @@ e_cal_backend_planner_get_type (void)
(GInstanceInitFunc) cbp_init
};
cbp_type = g_type_register_static (E_TYPE_CAL_BACKEND_SYNC,
- "ECalBackendPlanner",
+ "ECalBackendPlanner",
&info, 0);
}
diff --git a/eds-backend/e-cal-backend-planner.h b/eds-backend/e-cal-backend-planner.h
index d5a7b38..abc8019 100644
--- a/eds-backend/e-cal-backend-planner.h
+++ b/eds-backend/e-cal-backend-planner.h
@@ -53,7 +53,7 @@ struct _ECalBackendPlanner {
};
struct _ECalBackendPlannerClass {
- ECalBackendSyncClass parent_class;
+ ECalBackendSyncClass parent_class;
MrpApplication *mrp_app;
};
diff --git a/eds-backend/planner-source/planner-source.c b/eds-backend/planner-source/planner-source.c
index c766929..aa0c6df 100644
--- a/eds-backend/planner-source/planner-source.c
+++ b/eds-backend/planner-source/planner-source.c
@@ -38,16 +38,16 @@
static GConfClient *conf_client;
static GMainLoop *main_loop;
-void org_gnome_planner_source_add (EPlugin *epl,
+void org_gnome_planner_source_add (EPlugin *epl,
EConfigHookItemFactoryData *data);
/* From mrp-project.c */
-static const gchar *
+static const gchar *
uri_peek_file_name (const gchar *uri)
{
const gchar *name;
size_t len;
-
+
len = strlen (uri);
if (len > 3 && !strstr (uri, ":/")) {
/* No protocol. */
@@ -63,7 +63,7 @@ uri_peek_file_name (const gchar *uri)
}
static void
-add_planner_file (const gchar *uri)
+add_planner_file (const gchar *uri)
{
ESourceList *source_list;
ESourceGroup *group;
@@ -108,7 +108,7 @@ add_planner_file (const gchar *uri)
}
void
-org_gnome_planner_source_add (EPlugin *epl,
+org_gnome_planner_source_add (EPlugin *epl,
EConfigHookItemFactoryData *data)
{
GtkWidget *widget;
@@ -132,7 +132,7 @@ org_gnome_planner_source_add (EPlugin *epl,
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
- dest_uri = gtk_file_chooser_get_uri
+ dest_uri = gtk_file_chooser_get_uri
(GTK_FILE_CHOOSER (dialog));
}
@@ -141,15 +141,15 @@ org_gnome_planner_source_add (EPlugin *epl,
gtk_widget_destroy (dialog);
return;
}
-
+
tmp = strstr (dest_uri, planner_ext);
-
+
if (tmp && *(tmp + strlen (planner_ext)) == '\0') {
proceed = TRUE;
} else {
-
- GtkWidget *warning =
+
+ GtkWidget *warning =
gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
@@ -163,11 +163,11 @@ org_gnome_planner_source_add (EPlugin *epl,
}
gtk_widget_destroy (warning);
}
-
+
/* Time to add the new source */
if (proceed) {
add_planner_file (dest_uri);
}
- gtk_widget_destroy (dialog);
- g_free (dest_uri);
+ gtk_widget_destroy (dialog);
+ g_free (dest_uri);
}
diff --git a/eds-backend/utils/create-planner-source.c b/eds-backend/utils/create-planner-source.c
index 1a0ca4e..10409a0 100644
--- a/eds-backend/utils/create-planner-source.c
+++ b/eds-backend/utils/create-planner-source.c
@@ -30,8 +30,8 @@ static GMainLoop *main_loop;
static char *planner_file;
static void
-add_planner_file (const gchar *conf_key,
- const gchar *uri)
+add_planner_file (const gchar *conf_key,
+ const gchar *uri)
{
ESourceList *source_list;
ESourceGroup *group;
diff --git a/libegg/recent-files/egg-recent-item.c b/libegg/recent-files/egg-recent-item.c
index 9be7970..9eabbba 100644
--- a/libegg/recent-files/egg-recent-item.c
+++ b/libegg/recent-files/egg-recent-item.c
@@ -83,7 +83,7 @@ egg_recent_item_unref (EggRecentItem *item)
}
-EggRecentItem *
+EggRecentItem *
egg_recent_item_new_from_uri (const gchar *uri)
{
EggRecentItem *item;
@@ -96,7 +96,7 @@ egg_recent_item_new_from_uri (const gchar *uri)
egg_recent_item_free (item);
return NULL;
}
-
+
item->mime_type = gnome_vfs_get_mime_type (item->uri);
if (!item->mime_type)
@@ -211,19 +211,19 @@ egg_recent_item_set_uri (EggRecentItem *item, const gchar *uri)
return TRUE;
}
-gchar *
+gchar *
egg_recent_item_get_uri (const EggRecentItem *item)
{
return g_strdup (item->uri);
}
-G_CONST_RETURN gchar *
+G_CONST_RETURN gchar *
egg_recent_item_peek_uri (const EggRecentItem *item)
{
return item->uri;
}
-gchar *
+gchar *
egg_recent_item_get_uri_utf8 (const EggRecentItem *item)
{
/* this could fail, but it's not likely, since we've already done it
@@ -331,19 +331,19 @@ egg_recent_item_get_short_name (const EggRecentItem *item)
return short_name;
}
-void
+void
egg_recent_item_set_mime_type (EggRecentItem *item, const gchar *mime)
{
item->mime_type = g_strdup (mime);
}
-gchar *
+gchar *
egg_recent_item_get_mime_type (const EggRecentItem *item)
{
return g_strdup (item->mime_type);
}
-void
+void
egg_recent_item_set_timestamp (EggRecentItem *item, time_t timestamp)
{
if (timestamp == (time_t) -1)
@@ -352,7 +352,7 @@ egg_recent_item_set_timestamp (EggRecentItem *item, time_t timestamp)
item->timestamp = timestamp;
}
-time_t
+time_t
egg_recent_item_get_timestamp (const EggRecentItem *item)
{
return item->timestamp;
@@ -372,13 +372,13 @@ egg_recent_item_in_group (const EggRecentItem *item, const gchar *group_name)
tmp = item->groups;
while (tmp != NULL) {
gchar *val = (gchar *)tmp->data;
-
+
if (strcmp (group_name, val) == 0)
return TRUE;
tmp = tmp->next;
}
-
+
return FALSE;
}
@@ -401,7 +401,7 @@ egg_recent_item_remove_group (EggRecentItem *item, const gchar *group_name)
tmp = item->groups;
while (tmp != NULL) {
gchar *val = (gchar *)tmp->data;
-
+
if (strcmp (group_name, val) == 0) {
item->groups = g_list_remove (item->groups,
val);
@@ -429,12 +429,12 @@ GType
egg_recent_item_get_type (void)
{
static GType boxed_type = 0;
-
+
if (!boxed_type) {
boxed_type = g_boxed_type_register_static ("EggRecentItem",
(GBoxedCopyFunc)egg_recent_item_ref,
(GBoxedFreeFunc)egg_recent_item_unref);
}
-
+
return boxed_type;
}
diff --git a/libegg/recent-files/egg-recent-item.h b/libegg/recent-files/egg-recent-item.h
index 5b3b405..7de6eb9 100644
--- a/libegg/recent-files/egg-recent-item.h
+++ b/libegg/recent-files/egg-recent-item.h
@@ -25,7 +25,7 @@ struct _EggRecentItem {
gboolean private_data;
GList *groups;
-
+
int refcount;
};
diff --git a/libegg/recent-files/egg-recent-model.c b/libegg/recent-files/egg-recent-model.c
index 76a20d4..1266d10 100644
--- a/libegg/recent-files/egg-recent-model.c
+++ b/libegg/recent-files/egg-recent-model.c
@@ -159,11 +159,11 @@ egg_recent_model_string_match (const GSList *list, const gchar *str)
return TRUE;
tmp = list;
-
+
while (tmp) {
if (g_pattern_match_string (tmp->data, str))
return TRUE;
-
+
tmp = tmp->next;
}
@@ -358,7 +358,7 @@ start_element_handler (GMarkupParseContext *context,
egg_recent_item_set_private (info->current_item, TRUE);
} else if (ELEMENT_IS (TAG_GROUPS))
push_state (info, STATE_GROUPS);
- else if (ELEMENT_IS (TAG_GROUP))
+ else if (ELEMENT_IS (TAG_GROUP))
push_state (info, STATE_GROUP);
}
@@ -437,7 +437,7 @@ text_handler (GMarkupParseContext *context,
text);
break;
}
-
+
}
static void
@@ -478,7 +478,7 @@ egg_recent_model_sort (EggRecentModel *model, GList *list)
switch (model->priv->sort_type) {
case EGG_RECENT_MODEL_SORT_MRU:
list = g_list_sort (list,
- (GCompareFunc)list_compare_func_mru);
+ (GCompareFunc)list_compare_func_mru);
break;
case EGG_RECENT_MODEL_SORT_LRU:
list = g_list_sort (list,
@@ -557,7 +557,7 @@ egg_recent_model_filter (EggRecentModel *model,
if (pass_mime_test && pass_group_test &&
model->priv->scheme_filter_values != NULL) {
gchar *scheme;
-
+
scheme = gnome_vfs_get_uri_scheme (uri);
if (egg_recent_model_string_match
@@ -579,7 +579,7 @@ egg_recent_model_filter (EggRecentModel *model,
g_list_free (list);
}
-
+
return newlist;
}
@@ -618,7 +618,7 @@ egg_recent_model_monitor_list (EggRecentModel *model, GList *list)
gchar *uri;
tmp = tmp->next;
-
+
uri = egg_recent_item_get_uri (item);
if (g_hash_table_lookup (model->priv->monitors, uri)) {
/* already monitoring this one */
@@ -630,7 +630,7 @@ egg_recent_model_monitor_list (EggRecentModel *model, GList *list)
GNOME_VFS_MONITOR_FILE,
egg_recent_model_monitor_list_cb,
model);
-
+
if (res == GNOME_VFS_OK)
g_hash_table_insert (model->priv->monitors, uri, handle);
else
@@ -729,9 +729,9 @@ egg_recent_model_read (EggRecentModel *model, FILE *file)
}
parse_info_init (&info);
-
+
ctx = g_markup_parse_context_new (&parser, 0, &info, NULL);
-
+
error = NULL;
if (!g_markup_parse_context_parse (ctx, content, strlen (content),
&error)) {
@@ -744,7 +744,7 @@ egg_recent_model_read (EggRecentModel *model, FILE *file)
error = NULL;
if (!g_markup_parse_context_end_parse (ctx, &error))
goto out;
-
+
g_markup_parse_context_free (ctx);
out:
list = info.items;
@@ -770,7 +770,7 @@ egg_recent_model_write (EggRecentModel *model, FILE *file, GList *list)
const GList *groups;
int i;
int ret;
-
+
string = g_string_new ("<?xml version=\"1.0\"?>\n");
string = g_string_append (string, "<" TAG_RECENT_FILES ">\n");
@@ -790,7 +790,7 @@ egg_recent_model_write (EggRecentModel *model, FILE *file, GList *list)
mime_type = egg_recent_item_get_mime_type (item);
timestamp = egg_recent_item_get_timestamp (item);
-
+
string = g_string_append (string, " <" TAG_RECENT_ITEM ">\n");
g_string_append_printf (string,
@@ -803,7 +803,7 @@ egg_recent_model_write (EggRecentModel *model, FILE *file, GList *list)
g_string_append_printf (string,
" <" TAG_MIME_TYPE "></" TAG_MIME_TYPE ">\n");
-
+
g_string_append_printf (string,
" <" TAG_TIMESTAMP ">%d</" TAG_TIMESTAMP ">\n", (int)timestamp);
@@ -819,7 +819,7 @@ egg_recent_model_write (EggRecentModel *model, FILE *file, GList *list)
if (groups == NULL && egg_recent_item_get_private (item))
g_warning ("Item with URI \"%s\" marked as private, but"
" does not belong to any groups.\n", uri);
-
+
while (groups) {
const gchar *group = (const gchar *)groups->data;
gchar *escaped_group;
@@ -834,7 +834,7 @@ egg_recent_model_write (EggRecentModel *model, FILE *file, GList *list)
groups = groups->next;
}
-
+
string = g_string_append (string, " </" TAG_GROUPS ">\n");
string = g_string_append (string,
@@ -863,7 +863,7 @@ egg_recent_model_open_file (EggRecentModel *model)
{
FILE *file;
mode_t prev_umask;
-
+
file = fopen (model->priv->path, "r+");
if (file == NULL) {
/* be paranoid */
@@ -889,13 +889,13 @@ egg_recent_model_lock_file (FILE *file)
fd = fileno (file);
/* Attempt to lock the file 5 times,
- * waiting a random interval (< 1 second)
+ * waiting a random interval (< 1 second)
* in between attempts.
* We should really be doing asynchronous
* locking, but requires substantially larger
* changes.
*/
-
+
while (try > 0)
{
int rand_interval;
@@ -904,7 +904,7 @@ egg_recent_model_lock_file (FILE *file)
return TRUE;
rand_interval = 1 + (int) (10.0 * rand()/(RAND_MAX + 1.0));
-
+
g_usleep (100000 * rand_interval);
--try;
@@ -964,7 +964,7 @@ egg_recent_model_finalize (GObject *object)
g_free (model->priv->path);
model->priv->path = NULL;
-
+
g_hash_table_destroy (model->priv->monitors);
model->priv->monitors = NULL;
@@ -1067,14 +1067,14 @@ egg_recent_model_class_init (EggRecentModelClass * klass)
G_TYPE_NONE, 1,
G_TYPE_POINTER);
-
+
g_object_class_install_property (object_class,
PROP_MIME_FILTERS,
g_param_spec_pointer ("mime-filters",
"Mime Filters",
"List of mime types to be allowed.",
G_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_GROUP_FILTERS,
g_param_spec_pointer ("group-filters",
@@ -1155,7 +1155,7 @@ egg_recent_model_init (EggRecentModel * model)
g_warning ("gnome-vfs initialization failed.");
return;
}
-
+
model->priv = g_new0 (EggRecentModelPrivate, 1);
@@ -1165,7 +1165,7 @@ egg_recent_model_init (EggRecentModel * model)
model->priv->mime_filter_values = NULL;
model->priv->group_filter_values = NULL;
model->priv->scheme_filter_values = NULL;
-
+
model->priv->client = gconf_client_get_default ();
gconf_client_add_dir (model->priv->client, EGG_RECENT_MODEL_KEY_DIR,
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
@@ -1186,7 +1186,7 @@ egg_recent_model_init (EggRecentModel * model)
model->priv->client,
EGG_RECENT_MODEL_EXPIRE_KEY,
NULL);
-
+
#if 0
/* keep this out, for now */
model->priv->limit = gconf_client_get_int (
@@ -1247,7 +1247,7 @@ egg_recent_model_add_full (EggRecentModel * model, EggRecentItem *item)
gboolean updated = FALSE;
char *uri;
time_t t;
-
+
g_return_val_if_fail (model != NULL, FALSE);
g_return_val_if_fail (EGG_IS_RECENT_MODEL (model), FALSE);
@@ -1374,7 +1374,7 @@ egg_recent_model_delete (EggRecentModel * model, const gchar * uri)
length = g_list_length (list);
list = egg_recent_model_delete_from_list (list, uri);
-
+
if (length == g_list_length (list)) {
/* nothing was deleted */
EGG_RECENT_ITEM_LIST_UNREF (list);
@@ -1390,7 +1390,7 @@ egg_recent_model_delete (EggRecentModel * model, const gchar * uri)
}
out:
-
+
if (!egg_recent_model_unlock_file (file))
g_warning ("Failed to unlock: %s", strerror (errno));
@@ -1425,10 +1425,10 @@ egg_recent_model_get_list (EggRecentModel *model)
file = egg_recent_model_open_file (model);
g_return_val_if_fail (file != NULL, NULL);
-
+
if (egg_recent_model_lock_file (file)) {
list = egg_recent_model_read (model, file);
-
+
} else {
g_warning ("Failed to lock: %s", strerror (errno));
fclose (file);
@@ -1475,7 +1475,7 @@ egg_recent_model_set_limit (EggRecentModel *model, int limit)
* egg_recent_model_get_limit:
* @model: A EggRecentModel object.
*
- * This function gets the maximum length of the list.
+ * This function gets the maximum length of the list.
*
* Returns: int
*/
@@ -1651,7 +1651,7 @@ egg_recent_model_set_sort (EggRecentModel *model,
EggRecentModelSort sort)
{
g_return_if_fail (model != NULL);
-
+
model->priv->sort_type = sort;
}
@@ -1671,7 +1671,7 @@ egg_recent_model_changed (EggRecentModel *model)
if (model->priv->limit > 0) {
list = egg_recent_model_get_list (model);
/* egg_recent_model_monitor_list (model, list); */
-
+
g_signal_emit (G_OBJECT (model), model_signals[CHANGED], 0,
list);
}
@@ -1726,10 +1726,10 @@ egg_recent_model_remove_expired (EggRecentModel *model)
file = egg_recent_model_open_file (model);
g_return_if_fail (file != NULL);
-
+
if (egg_recent_model_lock_file (file)) {
list = egg_recent_model_read (model, file);
-
+
} else {
g_warning ("Failed to lock: %s", strerror (errno));
return;
diff --git a/libegg/recent-files/egg-recent-model.h b/libegg/recent-files/egg-recent-model.h
index 8c2eb8d..5a406b6 100644
--- a/libegg/recent-files/egg-recent-model.h
+++ b/libegg/recent-files/egg-recent-model.h
@@ -23,7 +23,7 @@ struct _EggRecentModel {
struct _EggRecentModelClass {
GObjectClass parent_class;
-
+
void (*changed) (EggRecentModel *model, GList *list);
};
diff --git a/libegg/recent-files/egg-recent-util.c b/libegg/recent-files/egg-recent-util.c
index 6780cd1..48571fc 100644
--- a/libegg/recent-files/egg-recent-util.c
+++ b/libegg/recent-files/egg-recent-util.c
@@ -15,7 +15,7 @@
#define EGG_RECENT_UTIL_HOSTNAME_SIZE 512
/* ripped out of gedit2 */
-gchar*
+gchar*
egg_recent_util_escape_underlines (const gchar* text)
{
GString *str;
@@ -66,8 +66,8 @@ load_icon_file (char *filename,
if (pixbuf == NULL) {
return NULL;
}
-
- width = gdk_pixbuf_get_width (pixbuf);
+
+ width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
/* if the icon is larger than the nominal size, scale down */
if (MAX (width, height) > nominal_size) {
@@ -95,10 +95,10 @@ egg_recent_util_get_icon (GnomeIconTheme *theme, const gchar *uri,
gchar *filename;
const GnomeIconData *icon_data;
GdkPixbuf *pixbuf;
-
+
icon = gnome_icon_lookup (theme, NULL, uri, NULL, NULL,
mime_type, 0, NULL);
-
+
g_return_val_if_fail (icon != NULL, NULL);
@@ -114,8 +114,8 @@ egg_recent_util_get_icon (GnomeIconTheme *theme, const gchar *uri,
pixbuf = load_icon_file (filename, size);
g_free (filename);
-
-
+
+
return pixbuf;
}
#endif /* !USE_STABLE_LIBGNOMEUI */
@@ -127,9 +127,9 @@ egg_recent_util_get_unique_id (void)
time_t the_time;
guint32 rand;
int pid;
-
+
gethostname (hostname, EGG_RECENT_UTIL_HOSTNAME_SIZE);
-
+
time (&the_time);
rand = g_random_int ();
pid = getpid ();
diff --git a/libegg/recent-files/egg-recent-vfs-utils.c b/libegg/recent-files/egg-recent-vfs-utils.c
index 51083dd..3af7d88 100644
--- a/libegg/recent-files/egg-recent-vfs-utils.c
+++ b/libegg/recent-files/egg-recent-vfs-utils.c
@@ -22,7 +22,7 @@
Boston, MA 02111-1307, USA.
Authors: Ettore Perazzoli <ettore comm2000 it>
- John Sullivan <sullivan eazel com>
+ John Sullivan <sullivan eazel com>
Darin Adler <darin eazel com>
*/
@@ -143,7 +143,7 @@ uri_is_local_scheme (const char *uri)
char *temp_scheme;
int i;
char *local_schemes[] = {"file:", "help:", "ghelp:", "gnome-help:",
- "trash:", "man:", "info:",
+ "trash:", "man:", "info:",
"hardware:", "search:", "pipe:",
"gnome-trash:", NULL};
@@ -208,7 +208,7 @@ handle_trailing_slashes (const char *uri)
/* go back till you remove them all but one. */
for (temp--; *(temp - 1) == '/'; temp--) {
*temp = '\0';
- }
+ }
}
}
@@ -235,7 +235,7 @@ make_uri_canonical (const char *uri)
return NULL;
}
- /* FIXME bugzilla.eazel.com 648:
+ /* FIXME bugzilla.eazel.com 648:
* This currently ignores the issue of two uris that are not identical but point
* to the same data except for the specific cases of trailing '/' characters,
* file:/ and file:///, and "lack of file:".
@@ -256,9 +256,9 @@ make_uri_canonical (const char *uri)
old_uri = canonical_uri;
if (old_uri[0] != '/') {
- /* FIXME bugzilla.eazel.com 5069:
+ /* FIXME bugzilla.eazel.com 5069:
* bandaid alert. Is this really the right thing to do?
- *
+ *
* We got what really is a relative path. We do a little bit of
* a stretch here and assume it was meant to be a cryptic absolute path,
* and convert it to one. Since we can't call gnome_vfs_uri_new and
@@ -291,7 +291,7 @@ make_uri_canonical (const char *uri)
canonical_uri = old_uri;
}
}
-
+
/* FIXME bugzilla.eazel.com 2802:
* Work around gnome-vfs's desire to convert file:foo into file://foo
* by converting to file:///foo here. When you remove this, check that
@@ -319,7 +319,7 @@ format_uri_for_display (const char *uri, gboolean filenames_are_locale_encoded)
/* If there's no fragment and it's a local path. */
path = gnome_vfs_get_local_path_from_uri (canonical_uri);
-
+
if (path != NULL) {
if (filenames_are_locale_encoded) {
utf8_path = g_locale_to_utf8 (path, -1, NULL, NULL, NULL);
@@ -327,7 +327,7 @@ format_uri_for_display (const char *uri, gboolean filenames_are_locale_encoded)
g_free (canonical_uri);
g_free (path);
return utf8_path;
- }
+ }
} else if (g_utf8_validate (path, -1, NULL)) {
g_free (canonical_uri);
return path;
@@ -348,7 +348,7 @@ char *
egg_recent_vfs_format_uri_for_display (const char *uri)
{
static gboolean broken_filenames;
-
+
broken_filenames = g_getenv ("G_BROKEN_FILENAMES") != NULL;
return format_uri_for_display (uri, broken_filenames);
@@ -388,7 +388,7 @@ escape_high_chars (const guchar *string)
static const gchar hex[16] = "0123456789ABCDEF";
#define ACCEPTABLE(a) ((a)>=32 && (a)<128)
-
+
escape_count = 0;
if (string == NULL) {
@@ -400,7 +400,7 @@ escape_high_chars (const guchar *string)
escape_count++;
}
}
-
+
if (escape_count == 0) {
return g_strdup (string);
}
@@ -414,7 +414,7 @@ escape_high_chars (const guchar *string)
*result_scanner++ = '%';
*result_scanner++ = hex[*scanner >> 4];
*result_scanner++ = hex[*scanner & 15];
-
+
} else {
*result_scanner++ = *scanner;
}
@@ -495,7 +495,7 @@ make_uri_from_input_internal (const char *text,
g_free (stripped);
return uri;
-
+
}
char *
@@ -543,7 +543,7 @@ uris_match (const char *uri_1, const char *uri_2, gboolean ignore_fragments)
g_free (canonical_1);
g_free (canonical_2);
-
+
return result;
}
@@ -561,10 +561,10 @@ egg_recent_vfs_get_uri_scheme (const char *uri)
g_return_val_if_fail (uri != NULL, NULL);
colon = strchr (uri, ':');
-
+
if (colon == NULL) {
return NULL;
}
-
+
return g_strndup (uri, colon - uri);
}
diff --git a/libegg/recent-files/egg-recent-vfs-utils.h b/libegg/recent-files/egg-recent-vfs-utils.h
index 619b25b..571f7d4 100644
--- a/libegg/recent-files/egg-recent-vfs-utils.h
+++ b/libegg/recent-files/egg-recent-vfs-utils.h
@@ -21,7 +21,7 @@
Boston, MA 02111-1307, USA.
Authors: Ettore Perazzoli <ettore comm2000 it>
- John Sullivan <sullivan eazel com>
+ John Sullivan <sullivan eazel com>
*/
#ifndef EGG_RECENT_VFS_UTILS_H
diff --git a/libegg/recent-files/egg-recent-view-bonobo.c b/libegg/recent-files/egg-recent-view-bonobo.c
index e728e70..35643ee 100644
--- a/libegg/recent-files/egg-recent-view-bonobo.c
+++ b/libegg/recent-files/egg-recent-view-bonobo.c
@@ -97,7 +97,7 @@ egg_recent_view_bonobo_clear (EggRecentViewBonobo *view)
g_return_if_fail (view->uic);
model = egg_recent_view_get_model (EGG_RECENT_VIEW (view));
-
+
while (!done)
{
gchar *verb_name = g_strdup_printf ("%s-%d", view->uid, i);
@@ -173,17 +173,17 @@ egg_recent_view_bonobo_set_list (EggRecentViewBonobo *view, GList *list)
egg_recent_view_bonobo_clear (view);
-
+
bonobo_ui_component_freeze (ui_component, NULL);
for (i = 1; i <= g_list_length (list); ++i)
{
- EggRecentItem *item = (EggRecentItem *)g_list_nth_data (list, i-1);
+ EggRecentItem *item = (EggRecentItem *)g_list_nth_data (list, i-1);
utf8_uri = egg_recent_item_get_uri_for_display (item);
if (utf8_uri == NULL)
continue;
-
+
/* this is what gets passed to our private "activate" callback */
md = (EggRecentViewBonoboMenuData *)g_malloc (sizeof (EggRecentViewBonoboMenuData));
md->view = view;
@@ -194,7 +194,7 @@ egg_recent_view_bonobo_set_list (EggRecentViewBonobo *view, GList *list)
base_uri = g_path_get_basename (utf8_uri);
xml_escaped_name = g_markup_escape_text (base_uri,
strlen (base_uri));
-
+
escaped_name = egg_recent_util_escape_underlines (xml_escaped_name);
g_free (xml_escaped_name);
@@ -243,7 +243,7 @@ egg_recent_view_bonobo_set_list (EggRecentViewBonobo *view, GList *list)
/* Riiiiight.... */
pixbuf_xml = bonobo_ui_util_pixbuf_to_xml (pixbuf);
-
+
cmd = g_strdup_printf ("<cmd name=\"%s\" pixtype=\"pixbuf\" pixname=\"%s\"/>", verb_name, pixbuf_xml);
g_free (pixbuf_xml);
@@ -262,10 +262,10 @@ egg_recent_view_bonobo_set_list (EggRecentViewBonobo *view, GList *list)
closure = g_cclosure_new (G_CALLBACK (egg_recent_view_bonobo_menu_cb),
md, egg_recent_view_bonobo_menu_data_destroy_cb);
-
+
bonobo_ui_component_add_verb_full (ui_component, verb_name,
- closure);
-
+ closure);
+
if (view->show_numbers) {
if (i < 10)
label = g_strdup_printf ("_%d. %s", i,
@@ -275,35 +275,35 @@ egg_recent_view_bonobo_set_list (EggRecentViewBonobo *view, GList *list)
} else {
label = g_strdup (escaped_name);
}
-
-
-
+
+
+
item_path = g_strconcat (view->path, "/", verb_name, NULL);
if (bonobo_ui_component_path_exists (ui_component, item_path, NULL))
{
- bonobo_ui_component_set_prop (ui_component, item_path,
+ bonobo_ui_component_set_prop (ui_component, item_path,
"label", label, NULL);
- bonobo_ui_component_set_prop (ui_component, item_path,
+ bonobo_ui_component_set_prop (ui_component, item_path,
"tip", tip, NULL);
}
else
{
gchar *xml;
-
+
xml = g_strdup_printf ("<menuitem name=\"%s\" "
"verb=\"%s\""
" _label=\"%s\" _tip=\"%s\" "
- "hidden=\"0\" />",
+ "hidden=\"0\" />",
verb_name, verb_name, label,
tip);
bonobo_ui_component_set_translate (ui_component, view->path, xml, NULL);
- g_free (xml);
+ g_free (xml);
}
-
+
g_free (label);
g_free (verb_name);
g_free (tip);
@@ -333,10 +333,10 @@ static EggRecentModel *
egg_recent_view_bonobo_get_model (EggRecentView *view_parent)
{
EggRecentViewBonobo *view;
-
+
g_return_val_if_fail (view_parent, NULL);
view = EGG_RECENT_VIEW_BONOBO (view_parent);
-
+
return view->model;
}
@@ -344,14 +344,14 @@ static void
egg_recent_view_bonobo_set_model (EggRecentView *view_parent, EggRecentModel *model)
{
EggRecentViewBonobo *view;
-
+
g_return_if_fail (view_parent);
view = EGG_RECENT_VIEW_BONOBO (view_parent);
-
+
if (view->model)
g_signal_handler_disconnect (G_OBJECT (view->model),
view->changed_cb_id);
-
+
view->model = model;
g_object_ref (view->model);
view->changed_cb_id = g_signal_connect_object (G_OBJECT (model),
@@ -439,7 +439,7 @@ egg_recent_view_bonobo_class_init (EggRecentViewBonoboClass * klass)
{
GObjectClass *object_class;
-
+
object_class = G_OBJECT_CLASS (klass);
object_class->set_property = egg_recent_view_bonobo_set_property;
@@ -567,7 +567,7 @@ egg_recent_view_bonobo_set_icon_size (EggRecentViewBonobo *view,
view->icon_size = icon_size;
}
}
-
+
GtkIconSize
egg_recent_view_bonobo_get_icon_size (EggRecentViewBonobo *view)
{
@@ -635,7 +635,7 @@ egg_recent_view_bonobo_set_tooltip_func (EggRecentViewBonobo *view,
{
view->tooltip_func = func;
view->tooltip_func_data = user_data;
-
+
if (view->model)
egg_recent_model_changed (view->model);
}
@@ -664,7 +664,7 @@ egg_recent_view_bonobo_new (BonoboUIComponent *uic, const gchar *path)
"show-numbers", TRUE, NULL));
g_return_val_if_fail (view, NULL);
-
+
return view;
}
diff --git a/libegg/recent-files/egg-recent-view-bonobo.h b/libegg/recent-files/egg-recent-view-bonobo.h
index 0b283ef..bde1a8b 100644
--- a/libegg/recent-files/egg-recent-view-bonobo.h
+++ b/libegg/recent-files/egg-recent-view-bonobo.h
@@ -19,7 +19,7 @@ typedef struct _EggRecentViewBonoboClass EggRecentViewBonoboClass;
struct _EggRecentViewBonoboClass {
GObjectClass parent_class;
-
+
void (*activate) (EggRecentViewBonobo *view, EggRecentItem *item);
};
diff --git a/libegg/recent-files/egg-recent-view-gtk.c b/libegg/recent-files/egg-recent-view-gtk.c
index 34805b2..dc59ef9 100644
--- a/libegg/recent-files/egg-recent-view-gtk.c
+++ b/libegg/recent-files/egg-recent-view-gtk.c
@@ -109,13 +109,13 @@ egg_recent_view_gtk_clear (EggRecentViewGtk *view)
menu_data = (gint *)g_object_get_data (menu_item,
view->uid);
-
+
if (menu_data) {
gtk_container_remove (GTK_CONTAINER (view->menu),
GTK_WIDGET (menu_item));
}
-
+
p = p->next;
}
}
@@ -163,9 +163,9 @@ egg_recent_view_gtk_menu_cb (GtkWidget *menu, gpointer data)
g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (md->view));
item = md->item;
-
+
egg_recent_item_ref (item);
-
+
g_signal_emit (G_OBJECT(md->view), view_signals[ACTIVATE], 0,
item);
@@ -187,7 +187,7 @@ egg_recent_view_gtk_new_separator (EggRecentViewGtk *view)
GtkWidget *retval;
g_return_val_if_fail (view, NULL);
-
+
retval = gtk_separator_menu_item_new ();
/**
@@ -307,7 +307,7 @@ egg_recent_view_gtk_add_to_menu (EggRecentViewGtk *view,
{
GtkWidget *menu_item;
gint menu_offset;
-
+
g_return_if_fail (view);
g_return_if_fail (view->menu);
@@ -322,7 +322,7 @@ egg_recent_view_gtk_add_to_menu (EggRecentViewGtk *view,
view->tooltip_func (view->tooltips, menu_item,
item, view->tooltip_func_data);
}
-
+
if (menu_item)
gtk_menu_shell_insert (GTK_MENU_SHELL (view->menu), menu_item,
menu_offset+index);
@@ -373,7 +373,7 @@ static EggRecentModel *
egg_recent_view_gtk_get_model (EggRecentView *view_parent)
{
EggRecentViewGtk *view;
-
+
g_return_val_if_fail (view_parent != NULL, NULL);
view = EGG_RECENT_VIEW_GTK (view_parent);
return view->model;
@@ -384,7 +384,7 @@ egg_recent_view_gtk_set_model (EggRecentView *view_parent,
EggRecentModel *model)
{
EggRecentViewGtk *view;
-
+
g_return_if_fail (view_parent != NULL);
view = EGG_RECENT_VIEW_GTK (view_parent);
@@ -393,7 +393,7 @@ egg_recent_view_gtk_set_model (EggRecentView *view_parent,
g_signal_handler_disconnect (G_OBJECT (model),
view->changed_cb_id);
}
-
+
view->model = model;
g_object_ref (view->model);
@@ -675,7 +675,7 @@ egg_recent_view_gtk_set_tooltip_func (EggRecentViewGtk *view,
{
view->tooltip_func = func;
view->tooltip_func_data = user_data;
-
+
if (view->model)
egg_recent_model_changed (view->model);
}
@@ -699,7 +699,7 @@ egg_recent_view_gtk_set_menu (EggRecentViewGtk *view,
if (view->menu != NULL)
g_object_unref (view->menu);
-
+
view->menu = menu;
g_object_ref (view->menu);
}
@@ -717,7 +717,7 @@ egg_recent_view_gtk_set_start_menu_item (EggRecentViewGtk *view,
{
g_return_if_fail (view);
g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (view));
-
+
view->start_menu_item = menu_item;
}
@@ -767,7 +767,7 @@ egg_recent_view_gtk_new (GtkWidget *menu, GtkWidget *start_menu_item)
"show-numbers", TRUE, NULL));
g_return_val_if_fail (view, NULL);
-
+
return view;
}
diff --git a/libegg/recent-files/egg-recent-view-gtk.h b/libegg/recent-files/egg-recent-view-gtk.h
index 7e56baf..63ce409 100644
--- a/libegg/recent-files/egg-recent-view-gtk.h
+++ b/libegg/recent-files/egg-recent-view-gtk.h
@@ -22,7 +22,7 @@ typedef struct _EggRecentViewGtkClass EggRecentViewGtkClass;
struct _EggRecentViewGtkClass {
GObjectClass parent_class;
-
+
void (*activate) (EggRecentViewGtk *view, EggRecentItem *item);
};
diff --git a/libegg/recent-files/egg-recent-view-uimanager.c b/libegg/recent-files/egg-recent-view-uimanager.c
index c758875..1932f56 100644
--- a/libegg/recent-files/egg-recent-view-uimanager.c
+++ b/libegg/recent-files/egg-recent-view-uimanager.c
@@ -118,13 +118,13 @@ egg_recent_view_uimanager_clear (EggRecentViewUIManager *view)
}
gtk_ui_manager_ensure_update (view->uimanager);
-
+
if (view->action_group != NULL) {
gtk_ui_manager_remove_action_group (view->uimanager, view->action_group);
g_object_unref (view->action_group);
view->action_group = NULL;
}
-
+
free_item_list (view);
}
@@ -146,13 +146,13 @@ egg_recent_view_uimanager_set_list (EggRecentViewUIManager *view, GList *list)
if (view->merge_id == 0)
view->merge_id = gtk_ui_manager_new_merge_id (view->uimanager);
- if (view->leading_sep)
- gtk_ui_manager_add_ui (view->uimanager,
- view->merge_id,
+ if (view->leading_sep)
+ gtk_ui_manager_add_ui (view->uimanager,
+ view->merge_id,
view->path,
- "EggRecentLeadingSeparator",
+ "EggRecentLeadingSeparator",
EGG_RECENT_SEPARATOR,
- GTK_UI_MANAGER_AUTO,
+ GTK_UI_MANAGER_AUTO,
FALSE);
for (scan = list; scan; scan = scan->next, index++) {
@@ -187,7 +187,7 @@ egg_recent_view_uimanager_set_list (EggRecentViewUIManager *view, GList *list)
else
label = g_strdup_printf ("_%d. %s", index, escaped);
g_free (escaped);
- } else
+ } else
label = escaped;
action = g_object_new (GTK_TYPE_ACTION,
@@ -213,12 +213,12 @@ egg_recent_view_uimanager_set_list (EggRecentViewUIManager *view, GList *list)
gtk_action_group_add_action (view->action_group, action);
g_object_unref (action);
- gtk_ui_manager_add_ui (view->uimanager,
- view->merge_id,
+ gtk_ui_manager_add_ui (view->uimanager,
+ view->merge_id,
view->path,
name,
name,
- GTK_UI_MANAGER_AUTO,
+ GTK_UI_MANAGER_AUTO,
FALSE);
g_free (name);
@@ -227,19 +227,19 @@ egg_recent_view_uimanager_set_list (EggRecentViewUIManager *view, GList *list)
view->item_list = g_list_reverse (view->item_list);
- if (view->trailing_sep)
- gtk_ui_manager_add_ui (view->uimanager,
- view->merge_id,
+ if (view->trailing_sep)
+ gtk_ui_manager_add_ui (view->uimanager,
+ view->merge_id,
view->path,
- "EggRecentTrailingSeparator",
+ "EggRecentTrailingSeparator",
EGG_RECENT_SEPARATOR,
- GTK_UI_MANAGER_AUTO,
+ GTK_UI_MANAGER_AUTO,
FALSE);
}
static void
-model_changed_cb (EggRecentModel *model,
- GList *list,
+model_changed_cb (EggRecentModel *model,
+ GList *list,
EggRecentViewUIManager *view)
{
if (list != NULL)
@@ -253,7 +253,7 @@ static EggRecentModel *
egg_recent_view_uimanager_get_model (EggRecentView *view_parent)
{
EggRecentViewUIManager *view;
-
+
g_return_val_if_fail (view_parent != NULL, NULL);
view = EGG_RECENT_VIEW_UIMANAGER (view_parent);
return view->model;
@@ -264,7 +264,7 @@ egg_recent_view_uimanager_set_model (EggRecentView *view_parent,
EggRecentModel *model)
{
EggRecentViewUIManager *view;
-
+
g_return_if_fail (view_parent != NULL);
view = EGG_RECENT_VIEW_UIMANAGER (view_parent);
@@ -274,7 +274,7 @@ egg_recent_view_uimanager_set_model (EggRecentView *view_parent,
view->changed_cb_id);
g_object_unref (view->model);
}
-
+
view->model = model;
g_object_ref (view->model);
@@ -287,7 +287,7 @@ egg_recent_view_uimanager_set_model (EggRecentView *view_parent,
}
void
-egg_recent_view_uimanager_set_leading_sep (EggRecentViewUIManager *view,
+egg_recent_view_uimanager_set_leading_sep (EggRecentViewUIManager *view,
gboolean val)
{
view->leading_sep = val;
@@ -444,7 +444,7 @@ egg_recent_view_uimanager_class_init (EggRecentViewUIManagerClass * klass)
"Whether or not to show icons",
FALSE,
G_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_SHOW_NUMBERS,
g_param_spec_boolean ("show-numbers",
@@ -479,7 +479,7 @@ show_menus_changed_cb (GConfClient *client,
#ifndef USE_STABLE_LIBGNOMEUI
static void
-theme_changed_cb (GnomeIconTheme *theme,
+theme_changed_cb (GnomeIconTheme *theme,
EggRecentViewUIManager *view)
{
if (view->model != NULL)
@@ -495,7 +495,7 @@ egg_recent_view_uimanager_init (EggRecentViewUIManager * view)
view->show_icons = gconf_client_get_bool (view->client,
"/desktop/gnome/interface/menus_have_icons",
NULL);
-
+
gconf_client_add_dir (view->client, "/desktop/gnome/interface",
GCONF_CLIENT_PRELOAD_NONE,
NULL);
@@ -559,7 +559,7 @@ egg_recent_view_uimanager_show_icons (EggRecentViewUIManager *view,
}
void
-egg_recent_view_uimanager_show_numbers (EggRecentViewUIManager *view,
+egg_recent_view_uimanager_show_numbers (EggRecentViewUIManager *view,
gboolean show)
{
view->show_numbers = show;
@@ -679,7 +679,7 @@ egg_recent_view_uimanager_new (GtkUIManager *uimanager,
NULL);
g_return_val_if_fail (view, NULL);
-
+
egg_recent_view_uimanager_set_action_func (EGG_RECENT_VIEW_UIMANAGER (view),
callback,
user_data);
@@ -737,7 +737,7 @@ egg_recent_view_uimanager_get_item (EggRecentViewUIManager *view,
{
const char *name;
int n;
-
+
name = gtk_action_get_name (action);
n = atoi (name + strlen (EGG_RECENT_NAME_PREFIX));
diff --git a/libegg/recent-files/egg-recent-view.h b/libegg/recent-files/egg-recent-view.h
index 79f0346..0c0b421 100644
--- a/libegg/recent-files/egg-recent-view.h
+++ b/libegg/recent-files/egg-recent-view.h
@@ -23,7 +23,7 @@ typedef struct _EggRecentViewClass EggRecentViewClass;
struct _EggRecentViewClass
{
GTypeInterface base_iface;
-
+
/* vtable, not signals */
void (* do_set_model) (EggRecentView *view,
EggRecentModel *model);
diff --git a/libplanner/mrp-application.c b/libplanner/mrp-application.c
index 6ebe75c..3b67bb6 100644
--- a/libplanner/mrp-application.c
+++ b/libplanner/mrp-application.c
@@ -65,8 +65,8 @@ mrp_application_get_type (void)
(GInstanceInitFunc) application_init,
};
- type = g_type_register_static (G_TYPE_OBJECT,
- "MrpApplication",
+ type = g_type_register_static (G_TYPE_OBJECT,
+ "MrpApplication",
&info, 0);
}
@@ -79,13 +79,13 @@ application_class_init (MrpApplicationClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
-
+
object_class->finalize = application_finalize;
data_hash = g_hash_table_new (NULL, NULL);
last_used_id = 0;
-
+
}
static void
@@ -107,7 +107,7 @@ application_init (MrpApplication *app)
application_init_gettext ();
application_init_file_modules (app);
-
+
first = FALSE;
}
@@ -143,9 +143,9 @@ imrp_application_register_reader (MrpApplication *app, MrpFileReader *reader)
g_return_if_fail (MRP_IS_APPLICATION (app));
g_return_if_fail (reader != NULL);
-
+
priv = app->priv;
-
+
priv->file_readers = g_list_prepend (priv->file_readers, reader);
}
@@ -156,31 +156,31 @@ imrp_application_register_writer (MrpApplication *app, MrpFileWriter *writer)
g_return_if_fail (MRP_IS_APPLICATION (app));
g_return_if_fail (writer != NULL);
-
+
priv = app->priv;
-
+
priv->file_writers = g_list_prepend (priv->file_writers, writer);
}
-GList *
+GList *
imrp_application_get_all_file_readers (MrpApplication *app)
{
MrpApplicationPriv *priv;
g_return_val_if_fail (MRP_IS_APPLICATION (app), NULL);
-
+
priv = app->priv;
return priv->file_readers;
}
-GList *
+GList *
imrp_application_get_all_file_writers (MrpApplication *app)
{
MrpApplicationPriv *priv;
g_return_val_if_fail (MRP_IS_APPLICATION (app), NULL);
-
+
priv = app->priv;
return priv->file_writers;
@@ -188,9 +188,9 @@ imrp_application_get_all_file_writers (MrpApplication *app)
/**
* mrp_application_new:
- *
+ *
* Creates a new #MrpApplication.
- *
+ *
* Return value: the newly created application
**/
MrpApplication *
@@ -201,12 +201,12 @@ mrp_application_new (void)
/**
* mrp_application_get_unique_id:
- *
+ *
* Returns a unique identifier in the #MrpApplication namespace.
- *
+ *
* Return value: the unique id
**/
-guint
+guint
mrp_application_get_unique_id (void)
{
return ++last_used_id;
@@ -214,9 +214,9 @@ mrp_application_get_unique_id (void)
/**
* imrp_application_id_set_data:
- *
+ *
* Set the data unique identifier for a data
- *
+ *
* Return value: TRUE if the change has been done
**/
gboolean
@@ -234,10 +234,10 @@ imrp_application_id_set_data (gpointer data,
/**
* mrp_application_id_get_data:
- *
+ *
* Get the object reference in the list of MrpObjects
* using the object_id as locator
- *
+ *
* Return value: a pointer to the data
**/
gpointer
@@ -248,13 +248,13 @@ mrp_application_id_get_data (guint object_id)
/**
* mrp_application_id_get_data:
- *
+ *
* Get the object reference in the list of MrpObjects
* using the object_id as locator
- *
+ *
* Return value: a pointer to the data
**/
-gboolean
+gboolean
imrp_application_id_remove_data (guint object_id)
{
return g_hash_table_remove (data_hash, GUINT_TO_POINTER (object_id));
diff --git a/libplanner/mrp-assignment.c b/libplanner/mrp-assignment.c
index 1275f5b..7ca8a94 100644
--- a/libplanner/mrp-assignment.c
+++ b/libplanner/mrp-assignment.c
@@ -76,8 +76,8 @@ mrp_assignment_get_type (void)
(GInstanceInitFunc) assignment_init,
};
- type = g_type_register_static (MRP_TYPE_OBJECT,
- "MrpAssignment",
+ type = g_type_register_static (MRP_TYPE_OBJECT,
+ "MrpAssignment",
&info, 0);
}
@@ -88,9 +88,9 @@ static void
assignment_class_init (MrpAssignmentClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
+
parent_class = MRP_OBJECT_CLASS (g_type_class_peek_parent (klass));
-
+
object_class->finalize = assignment_finalize;
object_class->set_property = assignment_set_property;
object_class->get_property = assignment_get_property;
@@ -115,7 +115,7 @@ assignment_class_init (MrpAssignmentClass *klass)
g_param_spec_int ("units",
"Units",
"Number of units assignment",
- -1,
+ -1,
G_MAXINT,
0,
G_PARAM_READWRITE));
@@ -125,9 +125,9 @@ static void
assignment_init (MrpAssignment *assignment)
{
MrpAssignmentPriv *priv;
-
+
priv = g_new0 (MrpAssignmentPriv, 1);
-
+
assignment->priv = priv;
}
@@ -136,7 +136,7 @@ assignment_finalize (GObject *object)
{
MrpAssignment *assignment = MRP_ASSIGNMENT (object);
MrpAssignmentPriv *priv;
-
+
priv = assignment->priv;
if (priv->task) {
@@ -162,10 +162,10 @@ assignment_set_property (GObject *object,
{
MrpAssignment *assignment;
MrpAssignmentPriv *priv;
-
+
assignment = MRP_ASSIGNMENT (object);
priv = assignment->priv;
-
+
/* FIXME: See bug #138368 about this. The assignment doesn't have a
* project pointer so we can't emit changed on it. We cheat for now and
* use the resource/task in those cases.
@@ -179,7 +179,7 @@ assignment_set_property (GObject *object,
priv->task = g_object_ref (g_value_get_object (value));
mrp_object_changed (MRP_OBJECT (priv->task));
break;
-
+
case PROP_RESOURCE:
if (priv->resource) {
g_object_unref (priv->resource);
@@ -206,10 +206,10 @@ assignment_get_property (GObject *object,
{
MrpAssignment *assignment;
MrpAssignmentPriv *priv;
-
+
assignment = MRP_ASSIGNMENT (object);
priv = assignment->priv;
-
+
switch (prop_id) {
case PROP_TASK:
g_value_set_object (value, priv->task);
@@ -231,25 +231,25 @@ assignment_get_property (GObject *object,
*
* Creates a new, empty, assignment. You most often don't want to create an
* assignment explicitly like this, but using mrp_resource_assign() instead.
- *
+ *
* Return value: Newly created assignment.
**/
MrpAssignment *
mrp_assignment_new (void)
{
MrpAssignment *assignment;
-
+
assignment = g_object_new (MRP_TYPE_ASSIGNMENT, NULL);
-
+
return assignment;
}
/**
* mrp_assignment_get_task:
* @assignment: an #MrpAssignment
- *
+ *
* Retrieves the #MrpTask associated with @assignment.
- *
+ *
* Return value: the task associated with the assignment object. The reference
* count of the task is not increased.
**/
@@ -257,16 +257,16 @@ MrpTask *
mrp_assignment_get_task (MrpAssignment *assignment)
{
g_return_val_if_fail (MRP_IS_ASSIGNMENT (assignment), NULL);
-
+
return assignment->priv->task;
}
/**
* mrp_assignment_get_resource:
* @assignment: an #MrpAssignment
- *
+ *
* Retrieves the #MrpResource associated with @assignment.
- *
+ *
* Return value: the resource associated with the assignment object. The reference
* count of the resource is not increased.
**/
@@ -274,23 +274,23 @@ MrpResource *
mrp_assignment_get_resource (MrpAssignment *assignment)
{
g_return_val_if_fail (MRP_IS_ASSIGNMENT (assignment), NULL);
-
+
return assignment->priv->resource;
}
/**
* mrp_assignment_get_units:
* @assignment: an #MrpAssignment
- *
+ *
* Retrieves the number of units that the resource is assigned with to the
* task. 100 means 100%, etc.
- *
+ *
* Return value: number of units of the assignment.
**/
gint
mrp_assignment_get_units (MrpAssignment *assignment)
{
g_return_val_if_fail (MRP_IS_ASSIGNMENT (assignment), -1);
-
+
return assignment->priv->units;
}
diff --git a/libplanner/mrp-calendar.c b/libplanner/mrp-calendar.c
index 3b59062..95925ae 100644
--- a/libplanner/mrp-calendar.c
+++ b/libplanner/mrp-calendar.c
@@ -50,11 +50,11 @@ struct _MrpCalendarPriv {
/* This can override the default calendar */
MrpDay *default_days[7];
-
+
/* Tree structure */
MrpCalendar *parent;
GList *children;
-
+
/* Working time intervals set for day types in this calendar */
GHashTable *day_intervals;
@@ -62,7 +62,7 @@ struct _MrpCalendarPriv {
GHashTable *days;
};
-struct _MrpInterval
+struct _MrpInterval
{
mrptime start;
mrptime end;
@@ -120,8 +120,8 @@ mrp_calendar_get_type (void)
(GInstanceInitFunc) calendar_init,
};
- object_type = g_type_register_static (MRP_TYPE_OBJECT,
- "MrpCalendar",
+ object_type = g_type_register_static (MRP_TYPE_OBJECT,
+ "MrpCalendar",
&object_info, 0);
}
@@ -146,9 +146,9 @@ calendar_class_init (MrpCalendarClass *klass)
0,
NULL, NULL,
mrp_marshal_VOID__VOID,
- G_TYPE_NONE,
+ G_TYPE_NONE,
0);
-
+
g_object_class_install_property (object_class,
PROP_NAME,
g_param_spec_string ("name",
@@ -171,14 +171,14 @@ static void
calendar_init (MrpCalendar *calendar)
{
MrpCalendarPriv *priv;
-
+
priv = g_new0 (MrpCalendarPriv, 1);
-
+
priv->name = NULL;
priv->parent = NULL;
priv->project = NULL;
priv->days = g_hash_table_new_full (NULL, NULL,
- NULL,
+ NULL,
(GDestroyNotify) mrp_day_unref);
priv->children = NULL;
@@ -198,12 +198,12 @@ calendar_finalize (GObject *object)
g_hash_table_destroy (priv->days);
g_hash_table_destroy (priv->day_intervals);
-
+
g_list_foreach (priv->children, (GFunc) g_object_unref, NULL);
g_list_free (priv->children);
g_free (priv->name);
-
+
g_free (priv);
if (G_OBJECT_CLASS (parent_class)->finalize) {
@@ -219,10 +219,10 @@ calendar_get_property (GObject *object,
{
MrpCalendar *calendar;
MrpCalendarPriv *priv;
-
+
calendar = MRP_CALENDAR (object);
priv = calendar->priv;
-
+
switch (prop_id) {
case PROP_NAME:
g_value_set_string (value, priv->name);
@@ -245,10 +245,10 @@ calendar_set_property (GObject *object,
{
MrpCalendar *calendar;
MrpCalendarPriv *priv;
-
+
calendar = MRP_CALENDAR (object);
priv = calendar->priv;
-
+
switch (prop_id) {
case PROP_NAME:
mrp_calendar_set_name (calendar, g_value_get_string (value));
@@ -266,17 +266,17 @@ calendar_get_default_day (MrpCalendar *calendar, mrptime date, gboolean derive)
{
MrpCalendarPriv *priv;
gint week_day;
-
+
g_return_val_if_fail (MRP_IS_CALENDAR (calendar), 0);
priv = calendar->priv;
week_day = mrp_time_day_of_week (date);
-
+
if (priv->default_days[week_day] == mrp_day_get_use_base ()) {
if (!derive) {
return mrp_day_get_use_base ();
}
-
+
/* Shouldn't be possible to set MRP_DAY_TYPE_USE_BASE when
priv->parent == NULL so no need to check here */
return mrp_calendar_get_day (priv->parent, date, TRUE);
@@ -290,12 +290,12 @@ calendar_get_day (MrpCalendar *calendar, mrptime date, gboolean derive)
{
MrpCalendarPriv *priv;
MrpDay *day;
-
+
g_return_val_if_fail (MRP_IS_CALENDAR (calendar), 0);
priv = calendar->priv;
- day = (MrpDay *) g_hash_table_lookup (priv->days,
+ day = (MrpDay *) g_hash_table_lookup (priv->days,
GINT_TO_POINTER ((int)date));
if (!day) {
if (derive && priv->parent) {
@@ -312,12 +312,12 @@ static MrpCalendar *
calendar_new (const gchar *name, MrpCalendar *parent)
{
MrpCalendar *calendar;
-
+
calendar = g_object_new (MRP_TYPE_CALENDAR,
- "name", name,
+ "name", name,
"project", parent->priv->project,
NULL);
-
+
calendar_add_child (parent, calendar);
return calendar;
@@ -331,9 +331,9 @@ calendar_add_child (MrpCalendar *parent, MrpCalendar *child)
return;
}
- parent->priv->children = g_list_prepend (parent->priv->children,
+ parent->priv->children = g_list_prepend (parent->priv->children,
g_object_ref (child));
-
+
child->priv->parent = parent;
}
@@ -357,7 +357,7 @@ calendar_reparent (MrpCalendar *new_parent, MrpCalendar *child)
* mrp_calendar_new:
* @name: name of the calendar
* @project: the #MrpProject that the new calendar will belong to
- *
+ *
* Creates a new #MrpCalendar. The calendar will be empty so you need to set the
* default week and/or override days, see mrp_calendar_set_default_days() and
* mrp_calendar_set_days().
@@ -370,7 +370,7 @@ mrp_calendar_new (const gchar *name, MrpProject *project)
MrpCalendar *calendar;
calendar = calendar_new (name, mrp_project_get_root_calendar (project));
-
+
imrp_project_signal_calendar_tree_changed (project);
imrp_project_set_needs_saving (project, TRUE);
@@ -397,17 +397,17 @@ foreach_copy_days (gpointer key,
MrpCalendar *copy)
{
MrpDay *day = value;
-
+
g_hash_table_insert (copy->priv->days, key, mrp_day_ref (day));
}
/**
* mrp_calendar_add:
* @calendar: a #MrpCalendar to add
- * @parent: a #MrpCalendar to inherit from
- *
- * Add @calendar to the project
- *
+ * @parent: a #MrpCalendar to inherit from
+ *
+ * Add @calendar to the project
+ *
* Return value:
**/
void
@@ -423,10 +423,10 @@ mrp_calendar_add (MrpCalendar *calendar, MrpCalendar *parent)
* mrp_calendar_copy:
* @name: the name of the new calendar
* @calendar: a #MrpCalendar to copy
- *
+ *
* Copies @calendar, making the new calendar a base calendar, that does not have
* a parent.
- *
+ *
* Return value: a new #MrpCalendar that is a copy of @calendar.
**/
MrpCalendar *
@@ -435,7 +435,7 @@ mrp_calendar_copy (const gchar *name, MrpCalendar *calendar)
MrpCalendar *parent, *ret_val;
parent = mrp_project_get_root_calendar (calendar->priv->project);
-
+
ret_val = calendar_new (name, parent);
memcpy (ret_val->priv->default_days,
@@ -444,11 +444,11 @@ mrp_calendar_copy (const gchar *name, MrpCalendar *calendar)
g_hash_table_foreach (calendar->priv->day_intervals,
(GHFunc) foreach_copy_day_intervals,
- ret_val);
+ ret_val);
g_hash_table_foreach (calendar->priv->days,
(GHFunc) foreach_copy_days,
- ret_val);
+ ret_val);
imrp_project_signal_calendar_tree_changed (calendar->priv->project);
imrp_project_set_needs_saving (calendar->priv->project, TRUE);
@@ -460,11 +460,11 @@ mrp_calendar_copy (const gchar *name, MrpCalendar *calendar)
* mrp_calendar_derive:
* @name: the name of the new calendar
* @parent: the #MrpCalendar to derive
- *
+ *
* Derives a new calendar from @parent. The new calendar will inherit all
* properties from @parent, so if no days are overridden, the calendars will be
* identical.
- *
+ *
* Return value: a new #MrpCalendar that is derived from @parent.
**/
MrpCalendar *
@@ -472,7 +472,7 @@ mrp_calendar_derive (const gchar *name, MrpCalendar *parent)
{
MrpCalendar *ret_val;
int i;
-
+
g_return_val_if_fail (MRP_IS_CALENDAR (parent), NULL);
ret_val = calendar_new (name, parent);
@@ -494,16 +494,16 @@ mrp_calendar_derive (const gchar *name, MrpCalendar *parent)
*
* Changes the parent of @calendar so that it inherits @new_parent, instead of
* its old parent.
- *
+ *
**/
void
mrp_calendar_reparent (MrpCalendar *new_parent, MrpCalendar *child)
{
g_return_if_fail (MRP_IS_CALENDAR (new_parent));
g_return_if_fail (MRP_IS_CALENDAR (child));
-
+
calendar_reparent (new_parent, child);
-
+
imrp_project_signal_calendar_tree_changed (new_parent->priv->project);
imrp_project_set_needs_saving (new_parent->priv->project, TRUE);
}
@@ -511,13 +511,13 @@ mrp_calendar_reparent (MrpCalendar *new_parent, MrpCalendar *child)
/**
* mrp_calendar_remove:
* @calendar: an #MrpCalendar
- *
+ *
* Removes @calendar from the project. If the calendar is used by the project, a
* new calendar is set for the project. If the calendar has a parent, the parent
* is used, otherwise the first child of the root is used. For resources, the
* calendar is exchanged for the parent if one exists, otherwise the resource
* calendar is unset, so that the project default will be used.
- *
+ *
**/
void
mrp_calendar_remove (MrpCalendar *calendar)
@@ -535,7 +535,7 @@ mrp_calendar_remove (MrpCalendar *calendar)
parent = priv->parent;
root = mrp_project_get_root_calendar (priv->project);
-
+
/* See if this calendar is used anywhere, if so we need to use another
* calendar.
*
@@ -550,19 +550,19 @@ mrp_calendar_remove (MrpCalendar *calendar)
list = mrp_calendar_get_children (root);
if (list) {
new_cal = list->data;
- }
+ }
}
-
+
if (!new_cal) {
g_warning ("Couldn't find fallback calendar.");
}
-
+
tmp_cal = mrp_project_get_calendar (priv->project);
-
+
if (tmp_cal == calendar) {
g_object_set (priv->project, "calendar", new_cal, NULL);
}
-
+
/* Resources. Here we try to use the parent or if that fails,
* unset calendar so we get the project default.
*/
@@ -571,31 +571,31 @@ mrp_calendar_remove (MrpCalendar *calendar)
} else {
new_cal = NULL;
}
-
+
resources = mrp_project_get_resources (priv->project);
for (r = resources; r; r = r->next) {
MrpResource *resource = r->data;
-
+
tmp_cal = mrp_resource_get_calendar (resource);
if (tmp_cal == calendar) {
mrp_resource_set_calendar (resource, new_cal);
}
}
-
+
/* FIXME: Need to check tasks when/if they get calendar
* support. Do it like for the resources.
*/
-
+
/* Remove it. We need to work on a copy, since the real list will be
* changed in calendar_reparent. Prevents corrupt list with infinite
* loops etc.
*/
list = g_list_copy (priv->children);
-
+
for (l = list; l; l = l->next) {
MrpCalendar *child = l->data;
-
+
if (parent) {
calendar_reparent (parent, child);
} else {
@@ -606,7 +606,7 @@ mrp_calendar_remove (MrpCalendar *calendar)
}
g_list_free (list);
-
+
if (parent) {
parent->priv->children = g_list_remove (parent->priv->children,
calendar);
@@ -615,23 +615,23 @@ mrp_calendar_remove (MrpCalendar *calendar)
imrp_project_signal_calendar_tree_changed (priv->project);
imrp_project_set_needs_saving (priv->project, TRUE);
-
+
g_object_unref (calendar);
}
/**
* mrp_calendar_get_name:
* @calendar: an #MrpCalendar
- *
+ *
* Retrieves the name of the calendar.
- *
+ *
* Return value: the calendar name.
**/
const gchar *
mrp_calendar_get_name (MrpCalendar *calendar)
{
g_return_val_if_fail (MRP_IS_CALENDAR (calendar), "");
-
+
return calendar->priv->name;
}
@@ -641,18 +641,18 @@ mrp_calendar_get_name (MrpCalendar *calendar)
* @name: the new name
*
* Sets the name of the calendar.
- *
+ *
**/
void
mrp_calendar_set_name (MrpCalendar *calendar, const gchar *name)
{
MrpCalendarPriv *priv;
-
+
g_return_if_fail (MRP_IS_CALENDAR (calendar));
g_return_if_fail (name != NULL);
priv = calendar->priv;
-
+
g_free (priv->name);
priv->name = g_strdup (name);
}
@@ -664,7 +664,7 @@ mrp_calendar_set_name (MrpCalendar *calendar, const gchar *name)
* @intervals: list of #MrpInterval to set for the specified day
*
* Overrides the working time for the day type @day when used in @calendar.
- *
+ *
**/
void
mrp_calendar_day_set_intervals (MrpCalendar *calendar,
@@ -685,7 +685,7 @@ mrp_calendar_day_set_intervals (MrpCalendar *calendar,
g_hash_table_remove (priv->day_intervals, day);
}
-
+
list = calendar_clean_intervals (intervals);
g_hash_table_insert (priv->day_intervals, day, list);
@@ -699,13 +699,13 @@ mrp_calendar_day_set_intervals (MrpCalendar *calendar,
* @calendar: an #MrpCalendar
* @day: an #MrpDay
* @check_ancestors: specifies if the whole calendar hierarchy should be checked
- *
+ *
* Retrieves the working time for the given day/calendar combination. If
* @check_ancestors is %TRUE, the calendar hierarchy is searched until a
* calendar that has set the working time for this day type is found. If %FALSE,
* the returned list will be empty if there is no explicit working time set for
* @calendar.
- *
+ *
* Return value: List of #MrpInterval, specifying the working time for @day.
**/
GList *
@@ -715,11 +715,11 @@ mrp_calendar_day_get_intervals (MrpCalendar *calendar,
{
MrpCalendarPriv *priv;
GList *list = NULL;
-
+
g_return_val_if_fail (MRP_IS_CALENDAR (calendar), NULL);
priv = calendar->priv;
-
+
/* Look upwards in the tree structure until we find a calendar that has
* defined the working time intervals for this day type.
*/
@@ -736,9 +736,9 @@ mrp_calendar_day_get_intervals (MrpCalendar *calendar,
* mrp_calendar_day_get_total_work:
* @calendar: an #MrpCalendar
* @day: an #MrpDay
- *
+ *
* Calculates the total amount of work for @day in @calendar.
- *
+ *
* Return value: the amount of work in seconds.
**/
gint
@@ -750,7 +750,7 @@ mrp_calendar_day_get_total_work (MrpCalendar *calendar,
MrpInterval *ival;
gint total = 0;
mrptime start, end;
-
+
g_return_val_if_fail (MRP_IS_CALENDAR (calendar), 0);
priv = calendar->priv;
@@ -761,7 +761,7 @@ mrp_calendar_day_get_total_work (MrpCalendar *calendar,
ival = l->data;
mrp_interval_get_absolute (ival, 0, &start, &end);
-
+
total += end - start;
}
@@ -772,9 +772,9 @@ mrp_calendar_day_get_total_work (MrpCalendar *calendar,
* mrp_calendar_get_default_day:
* @calendar: an #MrpCalendar
* @week_day: integer in the range 0 - 6, where 0 is Sunday
- *
+ *
* Retrieves the default day for @calendar.
- *
+ *
* Return value: default #MrpDay.
**/
MrpDay *
@@ -782,7 +782,7 @@ mrp_calendar_get_default_day (MrpCalendar *calendar,
gint week_day)
{
MrpCalendarPriv *priv;
-
+
g_return_val_if_fail (MRP_IS_CALENDAR (calendar), NULL);
priv = calendar->priv;
@@ -795,7 +795,7 @@ mrp_calendar_get_default_day (MrpCalendar *calendar,
* @calendar: an #MrpCalendar
* @week_day: integer in the range 0 - 6, where 0 is Sunday
* @...: #MrpDay followed by more week day/#MrpDay pairs, terminated by -1
- *
+ *
* Sets days in the default week for @calendar. Those are the days that are used
* as fallback is a date is not overridden.
*
@@ -807,25 +807,25 @@ mrp_calendar_set_default_days (MrpCalendar *calendar,
{
MrpCalendarPriv *priv;
va_list args;
-
+
g_return_if_fail (MRP_IS_CALENDAR (calendar));
-
+
priv = calendar->priv;
va_start (args, week_day);
-
+
/* Loop the args */
for (; week_day != -1; week_day = va_arg (args, gint)) {
MrpDay *day = (MrpDay *) va_arg (args, gpointer);
-
+
if (day == mrp_day_get_use_base () && !priv->parent) {
g_warning ("Trying to set day type to use base calendar on a base calendar");
continue;
}
-
+
priv->default_days[week_day] = day;
}
-
+
va_end (args);
calendar_emit_changed (calendar);
@@ -840,7 +840,7 @@ mrp_calendar_set_default_days (MrpCalendar *calendar,
*
* Overrides specific dates in @calendar, setting the type of day to use for
* those dates.
- *
+ *
**/
void
mrp_calendar_set_days (MrpCalendar *calendar,
@@ -853,15 +853,15 @@ mrp_calendar_set_days (MrpCalendar *calendar,
va_list args;
g_return_if_fail (MRP_IS_CALENDAR (calendar));
-
+
priv = calendar->priv;
va_start (args, date);
-
+
for (time = date; time != -1; time = va_arg (args, mrptime)) {
MrpDay *day;
-
+
key = (int) mrp_time_align_day (time);
-
+
day = (MrpDay *) va_arg (args, gpointer);
if (day == mrp_day_get_use_base ()) {
if (!priv->parent) {
@@ -884,34 +884,34 @@ mrp_calendar_set_days (MrpCalendar *calendar,
/**
* mrp_calendar_get_parent:
* @calendar: an #MrpCalendar
- *
+ *
* Retrieves the parent calendar of @calendar. The parent is the calendar that a
* calendar falls back to if a date or day type is not overridden.
- *
+ *
* Return value: The parent calendar.
**/
MrpCalendar *
mrp_calendar_get_parent (MrpCalendar *calendar)
{
g_return_val_if_fail (MRP_IS_CALENDAR (calendar), NULL);
-
+
return calendar->priv->parent;
}
/**
* mrp_calendar_get_children:
* @calendar: an #MrpCalendar
- *
+ *
* Retreives a list of the children, i.e. the calenderas that are immediately
* derived from @calendar.
- *
+ *
* Return value: List of @calendar's children.
**/
GList *
mrp_calendar_get_children (MrpCalendar *calendar)
{
g_return_val_if_fail (MRP_IS_CALENDAR (calendar), NULL);
-
+
return calendar->priv->children;
}
@@ -920,16 +920,16 @@ mrp_calendar_get_children (MrpCalendar *calendar)
* @calendar: an #MrpCalendar
* @date: an #mrptime
* @check_ancestors: specifies if the whole calendar hierarchy should be checked
- *
+ *
* Retrieves the day type for the given date and calender. If @check_ancestors
* is %TRUE, the parent and grandparent, and so on, is searched if @calendar
* does not have an overridden day type for the specified date.
- *
+ *
* Return value: An #MrpDay.
**/
MrpDay *
-mrp_calendar_get_day (MrpCalendar *calendar,
- mrptime date,
+mrp_calendar_get_day (MrpCalendar *calendar,
+ mrptime date,
gboolean check_ancestors)
{
MrpCalendarPriv *priv;
@@ -937,11 +937,11 @@ mrp_calendar_get_day (MrpCalendar *calendar,
MrpDay *day;
g_return_val_if_fail (MRP_IS_CALENDAR (calendar), NULL);
-
+
priv = calendar->priv;
aligned_date = mrp_time_align_day (date);
day = calendar_get_day (calendar, aligned_date, check_ancestors);
-
+
if (!day) {
return calendar_get_default_day (calendar,
aligned_date,
@@ -955,9 +955,9 @@ mrp_calendar_get_day (MrpCalendar *calendar,
* mrp_interval_new:
* @start: an #mrptime specifying the start of the interval
* @end: an #mrptime specifying the end of the interval
- *
- * Creates a new #MrpInterval ranging from @start to @end.
- *
+ *
+ * Creates a new #MrpInterval ranging from @start to @end.
+ *
* Return value: The newly created interval.
**/
MrpInterval *
@@ -965,9 +965,9 @@ mrp_interval_new (mrptime start,
mrptime end)
{
MrpInterval *ret_val;
-
+
ret_val = g_new0 (MrpInterval, 1);
-
+
ret_val->start = start;
ret_val->end = end;
ret_val->ref_count = 1;
@@ -978,9 +978,9 @@ mrp_interval_new (mrptime start,
/**
* mrp_interval_copy:
* @interval: an #MrpInterval
- *
+ *
* Copies @interval.
- *
+ *
* Return value: The copied interval.
**/
MrpInterval *
@@ -989,29 +989,29 @@ mrp_interval_copy (MrpInterval *interval)
MrpInterval *ret_val;
g_return_val_if_fail (interval != NULL, NULL);
-
+
ret_val = g_new0 (MrpInterval, 1);
-
+
memcpy (ret_val, interval, sizeof (MrpInterval));
ret_val->ref_count = 1;
-
+
return ret_val;
}
/**
* mrp_interval_ref:
* @interval: an #MrpInterval
- *
+ *
* Increases the reference count on @interval.
- *
+ *
* Return value: The interval.
**/
MrpInterval *
mrp_interval_ref (MrpInterval *interval)
{
g_return_val_if_fail (interval != NULL, NULL);
-
+
interval->ref_count++;
return interval;
@@ -1023,7 +1023,7 @@ mrp_interval_ref (MrpInterval *interval)
*
* Decreases the reference count on @interval. When the count goes to 0, the
* interval is freed.
- *
+ *
**/
void
mrp_interval_unref (MrpInterval *interval)
@@ -1031,7 +1031,7 @@ mrp_interval_unref (MrpInterval *interval)
g_return_if_fail (interval != NULL);
interval->ref_count--;
-
+
if (interval->ref_count <= 0) {
g_free (interval);
}
@@ -1045,7 +1045,7 @@ mrp_interval_unref (MrpInterval *interval)
* @end: location to store end time, or %NULL
*
* Retrieves the start and end time of #interval, with an optional @offset.
- *
+ *
**/
void
mrp_interval_get_absolute (MrpInterval *interval,
@@ -1054,7 +1054,7 @@ mrp_interval_get_absolute (MrpInterval *interval,
mrptime *end)
{
g_return_if_fail (interval != NULL);
-
+
if (start) {
*start = interval->start + offset;
}
@@ -1071,7 +1071,7 @@ mrp_interval_get_absolute (MrpInterval *interval,
* @end: value of end time
*
* Set the start and end time of #interval, with an optional @offset.
- *
+ *
**/
void
mrp_interval_set_absolute (MrpInterval *interval,
@@ -1080,7 +1080,7 @@ mrp_interval_set_absolute (MrpInterval *interval,
mrptime end)
{
g_return_if_fail (interval != NULL);
-
+
interval->start = start - offset;
interval->end = end - offset;
@@ -1088,23 +1088,23 @@ mrp_interval_set_absolute (MrpInterval *interval,
static void
foreach_day_interval_add_to_list (MrpDay *day,
- GList *intervals,
+ GList *intervals,
GList **list)
{
MrpDayWithIntervals *di = g_new0 (MrpDayWithIntervals, 1);
di->day = day;
di->intervals = intervals;
-
+
*list = g_list_prepend (*list, di);
}
/**
* mrp_calendar_get_overridden_days:
* @calendar: an #MrpCalendar
- *
+ *
* Retrieves the days that are overridden in this calendar, and the intervals
* that they are overriden with. This is mainly used when saving calendar data.
- *
+ *
* Return value: A list of #MrpDayWithIntervals structs, that must be freed
* (both the list and the data).
**/
@@ -1115,10 +1115,10 @@ mrp_calendar_get_overridden_days (MrpCalendar *calendar)
GList *ret_val = NULL;
g_return_val_if_fail (MRP_IS_CALENDAR (calendar), NULL);
-
+
priv = calendar->priv;
-
- g_hash_table_foreach (priv->day_intervals,
+
+ g_hash_table_foreach (priv->day_intervals,
(GHFunc) foreach_day_interval_add_to_list,
&ret_val);
@@ -1131,14 +1131,14 @@ foreach_day_add_to_list (gpointer key, MrpDay *day, GList **list)
MrpDateWithDay *dd = g_new0 (MrpDateWithDay, 1);
dd->date = GPOINTER_TO_INT (key);
dd->day = day;
-
+
*list = g_list_prepend (*list, dd);
}
/**
* mrp_calendar_get_all_overridden_dates:
* @calendar: an #MrpCalendar
- *
+ *
* Retrieves the overridden dates of @calendar, i.e. the specific dates that
* differ from the parent calendar.
*
@@ -1150,11 +1150,11 @@ mrp_calendar_get_all_overridden_dates (MrpCalendar *calendar)
{
MrpCalendarPriv *priv;
GList *ret_val = NULL;
-
+
g_return_val_if_fail (MRP_IS_CALENDAR (calendar), NULL);
-
+
priv = calendar->priv;
-
+
g_hash_table_foreach (priv->days,
(GHFunc) foreach_day_add_to_list,
&ret_val);
@@ -1192,7 +1192,7 @@ imrp_calendar_replace_day (MrpCalendar *calendar,
g_return_if_fail (new_day != NULL);
priv = calendar->priv;
-
+
/* Default week. */
for (i = 0; i < 7; i++) {
if (priv->default_days[i] == orig_day) {
@@ -1203,19 +1203,19 @@ imrp_calendar_replace_day (MrpCalendar *calendar,
/* Overridden days. */
data.list = NULL;
data.day = orig_day;
-
- g_hash_table_foreach (priv->days,
+
+ g_hash_table_foreach (priv->days,
(GHFunc) foreach_matching_day_add_to_list,
&data);
-
+
for (l = data.list; l; l = l->next) {
mrptime date = GPOINTER_TO_INT (l->data);
-
+
/*g_print ("Got overriden day, %s\n",
mrp_time_format ("%H:%M %a %e %b", date));*/
mrp_calendar_set_days (calendar, date, new_day, (mrptime) -1);
- }
+ }
g_list_free (data.list);
}
@@ -1229,7 +1229,7 @@ calendar_emit_changed (MrpCalendar *calendar)
priv = calendar->priv;
g_signal_emit (calendar, signals[CALENDAR_CHANGED], 0, NULL);
-
+
for (l = priv->children; l; l = l->next) {
calendar_emit_changed (l->data);
}
@@ -1242,7 +1242,7 @@ compare_intervals_func (MrpInterval *a, MrpInterval *b)
mrp_interval_get_absolute (a, 0, &at, NULL);
mrp_interval_get_absolute (b, 0, &bt, NULL);
-
+
if (at < bt) {
return -1;
}
@@ -1270,10 +1270,10 @@ calendar_clean_intervals (GList *list)
if (t1 >= t2) {
continue;
}
-
+
sorted = g_list_prepend (sorted, ival);
}
-
+
sorted = g_list_sort (sorted, (GCompareFunc) compare_intervals_func);
start = -1;
@@ -1292,14 +1292,14 @@ calendar_clean_intervals (GList *list)
} else {
/* Store the current interval and start a new one. */
ival = mrp_interval_new (start, end);
-
+
merged = g_list_prepend (merged, ival);
start = t1;
end = t2;
}
- /* Add the last interval if needed. */
+ /* Add the last interval if needed. */
if (!l->next && start != -1 && end != -1) {
ival = mrp_interval_new (start, end);
merged = g_list_prepend (merged, ival);
@@ -1318,13 +1318,13 @@ GType
mrp_interval_get_type (void)
{
static GType our_type = 0;
-
+
if (our_type == 0) {
our_type = g_boxed_type_register_static ("MrpInterval",
(GBoxedCopyFunc) mrp_interval_ref,
(GBoxedFreeFunc) mrp_interval_unref);
}
-
+
return our_type;
}
diff --git a/libplanner/mrp-day.c b/libplanner/mrp-day.c
index 457ecce..bcc7ca9 100644
--- a/libplanner/mrp-day.c
+++ b/libplanner/mrp-day.c
@@ -38,7 +38,7 @@ static MrpDay *use_base_day = NULL;
static void day_free (MrpDay *day);
-static void
+static void
day_free (MrpDay *day)
{
g_free (day->name);
@@ -50,8 +50,8 @@ void
imrp_day_setup_defaults (void)
{
if (!work_day && !nonwork_day && !use_base_day) {
- work_day = mrp_day_add (NULL,
- _("Working"),
+ work_day = mrp_day_add (NULL,
+ _("Working"),
_("A default working day"));
nonwork_day = mrp_day_add (NULL,
_("Nonworking"),
@@ -67,16 +67,16 @@ imrp_day_setup_defaults (void)
* @project: an #MrpProject
* @name: the name of the day type
* @description: human readable description of the day type
- *
+ *
* Adds a new day type to @project.
- *
+ *
* Return value: the newly created #MrpDay
**/
-MrpDay *
+MrpDay *
mrp_day_add (MrpProject *project, const gchar *name, const gchar *description)
-{
+{
MrpDay *day;
-
+
g_return_val_if_fail (name != NULL, NULL);
day = g_new0 (MrpDay, 1);
@@ -85,7 +85,7 @@ mrp_day_add (MrpProject *project, const gchar *name, const gchar *description)
day->ref_count = 1;
day->name = g_strdup (name);
day->id = g_quark_from_string (name);
-
+
if (description) {
day->description = g_strdup (description);
}
@@ -102,7 +102,7 @@ mrp_day_add (MrpProject *project, const gchar *name, const gchar *description)
* @project: an #MrpProject
*
* Fetches a list of all available day types in @project.
- *
+ *
* Return value: the list of all available day types in @project
**/
GList *
@@ -115,7 +115,7 @@ mrp_day_get_all (MrpProject *project)
* mrp_day_remove:
* @project: an #MrpProject
* @day: an #MrpDay
- *
+ *
* Remove @day from available day types in @project
**/
void
@@ -127,32 +127,32 @@ mrp_day_remove (MrpProject *project, MrpDay *day)
/**
* mrp_day_get_id:
* @day: an #MrpDay
- *
+ *
* Fetches the id of @day
- *
+ *
* Return value: the id of @day
**/
gint
mrp_day_get_id (MrpDay *day)
{
g_return_val_if_fail (day != NULL, -1);
-
+
return day->id;
}
/**
* mrp_day_get_name:
* @day: an #MrpDay
- *
+ *
* Fetches the name of @day
- *
+ *
* Return value: the name of @day
**/
const gchar *
mrp_day_get_name (MrpDay *day)
{
g_return_val_if_fail (day != NULL, NULL);
-
+
return day->name;
}
@@ -160,14 +160,14 @@ mrp_day_get_name (MrpDay *day)
* mrp_day_set_name:
* @day: an #MrpDay
* @name: the new name
- *
+ *
* Sets the name of @day to @name and emits the "day-changed" signal
**/
void
mrp_day_set_name (MrpDay *day, const gchar *name)
{
g_return_if_fail (day != NULL);
-
+
g_free (day->name);
day->name = g_strdup (name);
@@ -181,16 +181,16 @@ mrp_day_set_name (MrpDay *day, const gchar *name)
/**
* mrp_day_get_description:
* @day: an #MrpDay
- *
+ *
* Fetches the description of @day
- *
+ *
* Return value: the description of @day
**/
const gchar *
mrp_day_get_description (MrpDay *day)
{
g_return_val_if_fail (day != NULL, NULL);
-
+
return day->description;
}
@@ -198,15 +198,15 @@ mrp_day_get_description (MrpDay *day)
* mrp_day_set_description:
* @day: an #MrpDay
* @description: the new description
- *
- * Sets the description of @day to @description and emits the "day-changed"
+ *
+ * Sets the description of @day to @description and emits the "day-changed"
* signal
**/
void
mrp_day_set_description (MrpDay *day, const gchar *description)
{
g_return_if_fail (day != NULL);
-
+
g_free (day->description);
day->description = g_strdup (description);
@@ -219,11 +219,11 @@ mrp_day_set_description (MrpDay *day, const gchar *description)
/**
* mrp_day_ref:
- * @day: #MrpDay
- *
- * Add a reference to @day. User should call this when storing a reference to
+ * @day: #MrpDay
+ *
+ * Add a reference to @day. User should call this when storing a reference to
* a day.
- *
+ *
* Return value: the day
**/
MrpDay *
@@ -239,8 +239,8 @@ mrp_day_ref (MrpDay *day)
/**
* mrp_day_unref:
* @day: an #MrpDay
- *
- * Remove a reference from property. If the reference count reaches 0 the
+ *
+ * Remove a reference from property. If the reference count reaches 0 the
* property will be freed. User should not use it's reference after calling
* mrp_day_unref().
**/
@@ -257,9 +257,9 @@ mrp_day_unref (MrpDay *day)
/**
* mrp_day_get_work:
- *
+ *
* Fetches the builtin day type work.
- *
+ *
* Return value: the builtin day type work
**/
MrpDay *
@@ -270,9 +270,9 @@ mrp_day_get_work (void)
/**
* mrp_day_get_nonwork:
- *
+ *
* Fetches the builtin day type nonwork.
- *
+ *
* Return value: the builtin day type nowork
**/
MrpDay *
@@ -283,9 +283,9 @@ mrp_day_get_nonwork (void)
/**
* mrp_day_get_use_base:
- *
+ *
* Fetches the builtin day type user base
- *
+ *
* Return value: the builtin day type use base
**/
MrpDay *
@@ -301,13 +301,13 @@ GType
mrp_day_get_type (void)
{
static GType our_type = 0;
-
+
if (our_type == 0) {
our_type = g_boxed_type_register_static ("MrpDay",
(GBoxedCopyFunc) mrp_day_ref,
(GBoxedFreeFunc) mrp_day_unref);
}
-
+
return our_type;
}
diff --git a/libplanner/mrp-error.c b/libplanner/mrp-error.c
index 5f0759c..1d97570 100644
--- a/libplanner/mrp-error.c
+++ b/libplanner/mrp-error.c
@@ -32,6 +32,6 @@ mrp_error_quark (void)
if (q == 0) {
q = g_quark_from_static_string ("mrp-error-quark");
}
-
+
return q;
}
diff --git a/libplanner/mrp-error.h b/libplanner/mrp-error.h
index e764813..24c07e0 100644
--- a/libplanner/mrp-error.h
+++ b/libplanner/mrp-error.h
@@ -41,7 +41,7 @@ typedef enum {
MRP_ERROR_SAVE_WRITE_FAILED,
MRP_ERROR_INVALID_URI,
-
+
/* General error (should avoid using this). */
MRP_ERROR_FAILED
} MrpError;
diff --git a/libplanner/mrp-file-module.c b/libplanner/mrp-file-module.c
index 94e8f98..a3a2bac 100644
--- a/libplanner/mrp-file-module.c
+++ b/libplanner/mrp-file-module.c
@@ -31,18 +31,18 @@ static MrpFileModule *
file_module_load (const gchar *file)
{
MrpFileModule *module;
-
+
module = mrp_file_module_new ();
-
+
module->handle = g_module_open (file, G_MODULE_BIND_LAZY);
-
+
if (module->handle == NULL) {
g_warning ("Could not open file module '%s'\n",
g_module_error ());
-
+
return NULL;
}
-
+
g_module_symbol (module->handle, "init", (gpointer)&module->init);
return module;
@@ -57,7 +57,7 @@ mrp_file_module_load_all (MrpApplication *app)
gchar *path;
path = mrp_paths_get_file_modules_dir (NULL);
-
+
dir = g_dir_open (path, 0, NULL);
if (dir == NULL) {
@@ -68,16 +68,16 @@ mrp_file_module_load_all (MrpApplication *app)
while ((name = g_dir_read_name (dir)) != NULL) {
if (g_str_has_suffix (name, G_MODULE_SUFFIX)) {
gchar *plugin;
-
+
plugin = g_build_filename (path,
name,
NULL);
-
+
module = file_module_load (plugin);
if (module) {
mrp_file_module_init (module, app);
}
-
+
g_free (plugin);
}
}
@@ -97,9 +97,9 @@ mrp_file_module_init (MrpFileModule *plugin, MrpApplication *app)
{
g_return_if_fail (plugin != NULL);
g_return_if_fail (MRP_IS_APPLICATION (app));
-
+
plugin->app = app;
-
+
if (plugin->init) {
plugin->init (plugin, app);
}
@@ -114,12 +114,12 @@ mrp_file_reader_read_string (MrpFileReader *reader,
if (reader->read_string) {
return reader->read_string (reader, str, project, error);
}
-
- g_set_error (error,
+
+ g_set_error (error,
MRP_ERROR,
MRP_ERROR_FAILED,
_("This format does not support reading"));
-
+
return FALSE;
}
@@ -148,14 +148,14 @@ mrp_file_writer_get_mime_type (MrpFileWriter *writer)
}
gboolean
-mrp_file_writer_write (MrpFileWriter *writer,
- MrpProject *project,
+mrp_file_writer_write (MrpFileWriter *writer,
+ MrpProject *project,
const gchar *uri,
gboolean force,
GError **error)
{
g_return_val_if_fail (writer != NULL, FALSE);
-
+
if (writer->write) {
return writer->write (writer, project, uri, force, error);
}
diff --git a/libplanner/mrp-file-module.h b/libplanner/mrp-file-module.h
index 7f3c598..c60d335 100644
--- a/libplanner/mrp-file-module.h
+++ b/libplanner/mrp-file-module.h
@@ -37,7 +37,7 @@ typedef struct _MrpFileWriterPriv MrpFileWriterPriv;
struct _MrpFileModule {
GModule *handle;
MrpApplication *app;
-
+
/* Methods */
void (*init) (MrpFileModule *plugin,
MrpApplication *app);
@@ -47,9 +47,9 @@ struct _MrpFileModule {
struct _MrpFileReader {
MrpFileModule *module;
-
+
MrpFileReaderPriv *priv;
-
+
gboolean (*read_string) (MrpFileReader *reader,
const gchar *str,
MrpProject *project,
@@ -60,9 +60,9 @@ struct _MrpFileWriter {
MrpFileModule *module;
const gchar *identifier;
const gchar *mime_type;
-
+
MrpFileWriterPriv *priv;
-
+
/* Methods */
gboolean (*write) (MrpFileWriter *writer,
MrpProject *project,
diff --git a/libplanner/mrp-group.c b/libplanner/mrp-group.c
index 675e0fd..76c5e96 100644
--- a/libplanner/mrp-group.c
+++ b/libplanner/mrp-group.c
@@ -76,8 +76,8 @@ mrp_group_get_type (void)
(GInstanceInitFunc) group_init,
};
- object_type = g_type_register_static (MRP_TYPE_OBJECT,
- "MrpGroup",
+ object_type = g_type_register_static (MRP_TYPE_OBJECT,
+ "MrpGroup",
&object_info, 0);
}
@@ -88,13 +88,13 @@ static void
group_class_init (MrpGroupClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
+
parent_class = MRP_OBJECT_CLASS (g_type_class_peek_parent (klass));
-
+
object_class->finalize = group_finalize;
object_class->set_property = group_set_property;
object_class->get_property = group_get_property;
-
+
g_object_class_install_property (object_class,
PROP_NAME,
g_param_spec_string ("name",
@@ -116,7 +116,7 @@ group_class_init (MrpGroupClass *klass)
"The phone number of the group manager",
"empty",
G_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_MANAGER_EMAIL,
g_param_spec_string ("manager_email",
@@ -132,14 +132,14 @@ static void
group_init (MrpGroup *group)
{
MrpGroupPriv *priv;
-
+
priv = g_new0 (MrpGroupPriv, 1);
priv->name = g_strdup ("");
priv->manager_name = g_strdup ("");
priv->manager_phone = g_strdup ("");
priv->manager_email = g_strdup ("");
-
+
group->priv = priv;
}
@@ -150,7 +150,7 @@ group_finalize (GObject *object)
MrpGroupPriv *priv;
priv = group->priv;
-
+
g_free (priv->name);
priv->name = NULL;
@@ -178,26 +178,26 @@ group_set_property (GObject *object,
MrpGroupPriv *priv;
gboolean changed = FALSE;
const gchar *str;
-
+
g_return_if_fail (MRP_IS_GROUP (object));
-
+
group = MRP_GROUP (object);
priv = group->priv;
-
+
switch (prop_id) {
case PROP_NAME:
str = g_value_get_string (value);
-
+
if (!priv->name || strcmp (priv->name, str)) {
g_free (priv->name);
priv->name = g_strdup (str);
changed = TRUE;
}
-
+
break;
case PROP_MANAGER_NAME:
str = g_value_get_string (value);
-
+
if (!priv->manager_name || strcmp (priv->manager_name, str)) {
g_free (priv->manager_name);
priv->manager_name = g_strdup (str);
@@ -213,11 +213,11 @@ group_set_property (GObject *object,
priv->manager_phone = g_strdup (str);
changed = TRUE;
}
-
+
break;
case PROP_MANAGER_EMAIL:
str = g_value_get_string (value);
-
+
if (!priv->manager_email || strcmp (priv->manager_email, str)) {
g_free (priv->manager_email);
priv->manager_email = g_strdup (str);
@@ -227,7 +227,7 @@ group_set_property (GObject *object,
default:
break;
}
-
+
if (changed) {
mrp_object_changed (MRP_OBJECT (object));
}
@@ -241,9 +241,9 @@ group_get_property (GObject *object,
{
MrpGroup *group;
MrpGroupPriv *priv;
-
+
g_return_if_fail (MRP_IS_GROUP (object));
-
+
group = MRP_GROUP (object);
priv = group->priv;
@@ -268,29 +268,29 @@ group_get_property (GObject *object,
/**
* mrp_group_new:
- *
+ *
* Creates a new end group.
- *
+ *
* Return value: the newly created group.
**/
MrpGroup *
mrp_group_new (void)
{
MrpGroup *group;
-
+
group = g_object_new (MRP_TYPE_GROUP,
"name", "",
NULL);
-
+
return group;
}
/**
* mrp_group_get_name:
* @group: an #MrpGroup
- *
+ *
* Retrives the name of @group.
- *
+ *
* Return value: the name
**/
const gchar *
@@ -305,7 +305,7 @@ mrp_group_get_name (MrpGroup *group)
* mrp_group_set_name:
* @group: an #MrpGroup
* @name: new name of @group
- *
+ *
* Sets the name of @group.
**/
void
diff --git a/libplanner/mrp-mpx.c b/libplanner/mrp-mpx.c
index 68dd22f..599ab8b 100644
--- a/libplanner/mrp-mpx.c
+++ b/libplanner/mrp-mpx.c
@@ -28,9 +28,9 @@ void init (MrpFileModule *module,
MrpApplication *application);
-static gboolean
-mpx_read_string (MrpFileReader *reader,
- const gchar *str,
+static gboolean
+mpx_read_string (MrpFileReader *reader,
+ const gchar *str,
MrpProject *project,
GError **error)
{
@@ -39,7 +39,7 @@ mpx_read_string (MrpFileReader *reader,
g_return_val_if_fail (str != NULL, FALSE);
ret = TRUE;
-
+
return ret;
}
@@ -47,11 +47,11 @@ G_MODULE_EXPORT void
init (MrpFileModule *module, MrpApplication *application)
{
MrpFileReader *reader;
-
+
reader = g_new0 (MrpFileReader, 1);
reader->module = module;
reader->priv = NULL;
-
+
reader->read_string = mpx_read_string;
imrp_application_register_reader (application, reader);
diff --git a/libplanner/mrp-object.c b/libplanner/mrp-object.c
index ed702d5..2d4fedd 100644
--- a/libplanner/mrp-object.c
+++ b/libplanner/mrp-object.c
@@ -90,8 +90,8 @@ mrp_object_get_type (void)
(GInstanceInitFunc) object_init,
};
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "MrpObject",
+ object_type = g_type_register_static (G_TYPE_OBJECT,
+ "MrpObject",
&object_info, 0);
}
@@ -102,9 +102,9 @@ static void
object_class_init (MrpObjectClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
+
parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
-
+
object_class->finalize = object_finalize;
object_class->set_property = object_set_g_property;
object_class->get_property = object_get_g_property;
@@ -119,7 +119,7 @@ object_class_init (MrpObjectClass *klass)
G_STRUCT_OFFSET (MrpObjectClass, removed),
NULL, NULL,
mrp_marshal_VOID__VOID,
- G_TYPE_NONE,
+ G_TYPE_NONE,
0);
signals[PROP_CHANGED] =
@@ -147,7 +147,7 @@ static void
object_init (MrpObject *object)
{
MrpObjectPriv *priv;
-
+
priv = g_new0 (MrpObjectPriv, 1);
object->priv = priv;
@@ -162,7 +162,7 @@ object_finalize (GObject *g_object)
{
MrpObject *object = MRP_OBJECT (g_object);
MrpObjectPriv *priv;
-
+
priv = object->priv;
if (G_OBJECT_CLASS (parent_class)->finalize) {
@@ -175,7 +175,7 @@ object_finalize (GObject *g_object)
* @object: an #MrpObject
* @property: the property to set
* @value: the value to set
- *
+ *
* Sets a custom property. This is mostly for language bindings. C programmers
* should use mrp_object_set instead.
**/
@@ -189,13 +189,13 @@ mrp_object_set_property (MrpObject *object, MrpProperty *property, GValue *value
priv = object->priv;
pspec = G_PARAM_SPEC (property);
-
+
value_cpy = g_new0 (GValue, 1);
g_value_init (value_cpy, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_value_copy (value, value_cpy);
-
+
tmp_value = g_hash_table_lookup (priv->property_hash,
property);
@@ -205,11 +205,11 @@ mrp_object_set_property (MrpObject *object, MrpProperty *property, GValue *value
} else {
mrp_property_ref (property);
}
-
- g_hash_table_insert (priv->property_hash,
+
+ g_hash_table_insert (priv->property_hash,
property, value_cpy);
- g_signal_emit (object, signals[PROP_CHANGED],
+ g_signal_emit (object, signals[PROP_CHANGED],
g_quark_from_string (G_PARAM_SPEC (property)->name),
property, value);
@@ -221,7 +221,7 @@ mrp_object_set_property (MrpObject *object, MrpProperty *property, GValue *value
* @object: an #MrpObject
* @property: the property to get
* @value: the value to get
- *
+ *
* Gets a custom property. This is mostly for language bindings. C programmers
* should use mrp_object_get instead.
**/
@@ -230,7 +230,7 @@ mrp_object_get_property (MrpObject *object, MrpProperty *property, GValue *value
{
MrpObjectPriv *priv;
GValue *tmp_value;
-
+
priv = object->priv;
tmp_value = g_hash_table_lookup (priv->property_hash,
@@ -253,9 +253,9 @@ object_set_g_property (GObject *g_object,
{
MrpObject *object;
MrpObjectPriv *priv;
-
+
g_return_if_fail (MRP_IS_OBJECT (g_object));
-
+
object = MRP_OBJECT (g_object);
priv = object->priv;
@@ -271,7 +271,7 @@ object_set_g_property (GObject *g_object,
priv->project = g_value_get_object (value);
if (priv->project) {
g_object_ref (priv->project);
- g_signal_connect_object (priv->project,
+ g_signal_connect_object (priv->project,
"property_removed",
G_CALLBACK (object_property_removed_cb),
object,
@@ -294,10 +294,10 @@ object_get_g_property (GObject *g_object,
MrpObjectPriv *priv;
g_return_if_fail (MRP_IS_OBJECT (g_object));
-
+
object = MRP_OBJECT (g_object);
priv = object->priv;
-
+
switch (prop_id) {
case PROP_PROJECT:
g_value_set_object (value, priv->project);
@@ -343,7 +343,7 @@ void
mrp_object_removed (MrpObject *object)
{
g_return_if_fail (MRP_IS_OBJECT (object));
-
+
g_signal_emit (object, signals[REMOVED], 0);
}
@@ -358,9 +358,9 @@ void
mrp_object_changed (MrpObject *object)
{
MrpObjectPriv *priv;
-
+
g_return_if_fail (MRP_IS_OBJECT (object));
-
+
priv = object->priv;
if (priv->project) {
@@ -383,18 +383,18 @@ void
mrp_object_set (gpointer pobject,
const gchar *first_property_name,
...)
-{
+{
MrpObject *object = MRP_OBJECT (pobject);
va_list var_args;
gboolean blocked = FALSE;
-
+
g_return_if_fail (MRP_IS_OBJECT (object));
if (object->priv->project) {
blocked = mrp_project_get_block_scheduling (object->priv->project);
mrp_project_set_block_scheduling (object->priv->project, TRUE);
}
-
+
va_start (var_args, first_property_name);
mrp_object_set_valist (object, first_property_name, var_args);
va_end (var_args);
@@ -409,7 +409,7 @@ mrp_object_set (gpointer pobject,
* @object: an #MrpProject
* @first_property_name: the name of the first property to get
* @...: first value to get, followed by additional name/value pairs to get, NULL terminated
- *
+ *
* Retrieves the values of a variable number of custom properties or regular
* properties from an object. See mrp_object_set().
**/
@@ -420,9 +420,9 @@ mrp_object_get (gpointer pobject,
{
MrpObject *object = MRP_OBJECT (pobject);
va_list var_args;
-
+
g_return_if_fail (MRP_IS_OBJECT (object));
-
+
va_start (var_args, first_property_name);
mrp_object_get_valist (object, first_property_name, var_args);
va_end (var_args);
@@ -443,28 +443,28 @@ mrp_object_set_valist (MrpObject *object,
{
MrpObjectPriv *priv;
const gchar *name;
-
+
g_return_if_fail (MRP_IS_OBJECT (object));
priv = object->priv;
-
+
g_object_ref (object);
-
+
name = first_property_name;
while (name) {
GValue value = { 0, };
GParamSpec *pspec;
gchar *error = NULL;
-
+
pspec = g_object_class_find_property (
G_OBJECT_GET_CLASS (object), name);
if (pspec) {
/* Normal g_object property */
- g_value_init (&value,
+ g_value_init (&value,
G_PARAM_SPEC_VALUE_TYPE (pspec));
-
+
G_VALUE_COLLECT (&value, var_args, 0, &error);
g_object_set_property (G_OBJECT (object),
name,
@@ -472,10 +472,10 @@ mrp_object_set_valist (MrpObject *object,
} else {
/* Our custom properties */
pspec = G_PARAM_SPEC (
- mrp_project_get_property (priv->project,
+ mrp_project_get_property (priv->project,
name,
G_OBJECT_TYPE (object)));
-
+
if (!pspec) {
g_warning ("%s: object class `%s' has no property named `%s'",
G_STRLOC,
@@ -483,7 +483,7 @@ mrp_object_set_valist (MrpObject *object,
name);
break;
}
-
+
if (!(pspec->flags & G_PARAM_WRITABLE)) {
g_warning ("%s: property `%s' of object class `%s' is not writable",
G_STRLOC,
@@ -491,16 +491,16 @@ mrp_object_set_valist (MrpObject *object,
G_OBJECT_TYPE_NAME (object));
break;
}
-
+
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-
+
G_VALUE_COLLECT (&value, var_args, 0, &error);
}
if (error) {
g_warning ("%s: %s", G_STRLOC, error);
g_free (error);
-
+
/* we purposely leak the value here, it might not be
* in a sane state if an error condition occoured
*/
@@ -508,10 +508,10 @@ mrp_object_set_valist (MrpObject *object,
}
mrp_object_set_property (object, MRP_PROPERTY (pspec), &value);
-
+
/* set the property value */
g_value_unset (&value);
-
+
name = va_arg (var_args, gchar*);
}
@@ -533,15 +533,15 @@ mrp_object_get_valist (MrpObject *object,
{
MrpObjectPriv *priv;
const gchar *name;
-
+
g_return_if_fail (MRP_IS_OBJECT (object));
-
+
priv = object->priv;
-
+
g_object_ref (object);
-
+
name = first_property_name;
-
+
while (name) {
GValue value = { 0, };
GParamSpec *pspec;
@@ -550,7 +550,7 @@ mrp_object_get_valist (MrpObject *object,
pspec = g_object_class_find_property (
G_OBJECT_GET_CLASS (object),
name);
-
+
if (pspec) {
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
@@ -561,7 +561,7 @@ mrp_object_get_valist (MrpObject *object,
pspec = mrp_project_get_property (priv->project,
name,
G_OBJECT_TYPE (object));
-
+
if (!pspec) {
break;
}
@@ -573,14 +573,14 @@ mrp_object_get_valist (MrpObject *object,
G_OBJECT_TYPE_NAME (object));
break;
}
-
+
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-
+
mrp_object_get_property (object,
- MRP_PROPERTY (pspec),
+ MRP_PROPERTY (pspec),
&value);
}
-
+
G_VALUE_LCOPY (&value, var_args, 0, &error);
if (error) {
@@ -589,21 +589,21 @@ mrp_object_get_valist (MrpObject *object,
g_value_unset (&value);
break;
}
-
+
g_value_unset (&value);
-
+
name = va_arg (var_args, gchar *);
}
-
+
g_object_unref (object);
}
/**
* mrp_object_get_properties:
* @object: an #MrpObject
- *
+ *
* Retrieves the list of custom properties for the type of @object.
- *
+ *
* Return value: A list of #MrpProperty, must not be changed or freed.
**/
GList *
@@ -614,26 +614,26 @@ mrp_object_get_properties (MrpObject *object)
g_return_val_if_fail (MRP_IS_OBJECT (object), NULL);
priv = object->priv;
-
- return mrp_project_get_properties_from_type (priv->project,
+
+ return mrp_project_get_properties_from_type (priv->project,
G_OBJECT_TYPE (object));
}
/**
* mrp_object_get_id:
* @object: an #MrpObject
- *
+ *
* Retrieves the unique object id in the application
- *
+ *
* Return value: 0 if fails, object id if everything is ok.
**/
guint
mrp_object_get_id (MrpObject *object)
{
MrpObjectPriv *priv;
-
+
g_return_val_if_fail (MRP_IS_OBJECT (object), 0);
-
+
priv = object->priv;
return priv->id;
@@ -643,10 +643,10 @@ mrp_object_get_id (MrpObject *object)
/**
* mrp_object_set_id:
* @object: an #MrpObject
- *
+ *
* Change the unique object id in the application.
- * This function must be called only from Undo/Redo operations.
- *
+ * This function must be called only from Undo/Redo operations.
+ *
* Return value: FALSE if fails, TRUE is everything is ok.
**/
gboolean
@@ -658,8 +658,8 @@ mrp_object_set_id (MrpObject *object,
g_return_val_if_fail (MRP_IS_OBJECT (object), FALSE);
priv = object->priv;
-
- if (imrp_application_id_set_data (object, id)) {
+
+ if (imrp_application_id_set_data (object, id)) {
priv->id = id;
return TRUE;
} else {
diff --git a/libplanner/mrp-old-xml.c b/libplanner/mrp-old-xml.c
index 41f1a1b..2703a9a 100644
--- a/libplanner/mrp-old-xml.c
+++ b/libplanner/mrp-old-xml.c
@@ -40,9 +40,9 @@ typedef struct {
xmlDocPtr doc;
gint version;
-
+
MrpProject *project;
-
+
MrpTask *root_task;
GList *resources;
GList *groups;
@@ -51,11 +51,11 @@ typedef struct {
mrptime project_start;
gint project_calendar_id;
-
+
MrpGroup *default_group;
gint last_id;
-
+
GHashTable *task_hash;
GHashTable *resource_hash;
GHashTable *group_hash;
@@ -91,7 +91,7 @@ static MrpTaskType old_xml_get_task_type (xmlNodePtr node,
const char *name);
static MrpTaskSched old_xml_get_task_sched (xmlNodePtr node,
const char *name);
-static xmlNodePtr old_xml_search_child (xmlNodePtr node,
+static xmlNodePtr old_xml_search_child (xmlNodePtr node,
const gchar *name);
static MrpPropertyType
old_xml_property_type_from_string (const gchar *str);
@@ -147,7 +147,7 @@ old_xml_read_predecessor (MrpParser *parser,
relation->predecessor_id = predecessor_id;
relation->type = type;
relation->lag = old_xml_get_int (tree, "lag");
-
+
parser->delayed_relations = g_list_prepend (parser->delayed_relations,
relation);
}
@@ -156,7 +156,7 @@ static gboolean
old_xml_read_constraint (xmlNodePtr node, MrpConstraint *constraint)
{
gchar *str;
-
+
str = old_xml_get_string (node, "type");
if (str == NULL) {
@@ -195,7 +195,7 @@ old_xml_read_custom_properties (MrpParser *parser,
if (strcmp (child->name, "property")) {
continue;
}
-
+
old_xml_set_property_from_node (parser->project,
object,
child);
@@ -219,7 +219,7 @@ old_xml_read_task (MrpParser *parser, xmlNodePtr tree, MrpTask *parent)
gboolean got_constraint = FALSE;
MrpTaskType type;
MrpTaskSched sched;
-
+
if (strcmp (tree->name, "task")){
/*g_warning ("Got %s, expected 'task'.", tree->name);*/
return;
@@ -247,7 +247,7 @@ old_xml_read_task (MrpParser *parser, xmlNodePtr tree, MrpTask *parent)
constraint.type = MRP_CONSTRAINT_MSO;
constraint.time = start;
got_constraint = TRUE;
-
+
task = g_object_new (MRP_TYPE_TASK,
"project", parser->project,
"name", name,
@@ -279,7 +279,7 @@ old_xml_read_task (MrpParser *parser, xmlNodePtr tree, MrpTask *parent)
work = 0;
duration = 0;
}
-
+
task = g_object_new (MRP_TYPE_TASK,
"project", parser->project,
"name", name,
@@ -292,7 +292,7 @@ old_xml_read_task (MrpParser *parser, xmlNodePtr tree, MrpTask *parent)
"note", note,
NULL);
}
-
+
g_free (name);
g_free (note);
@@ -310,12 +310,12 @@ old_xml_read_task (MrpParser *parser, xmlNodePtr tree, MrpTask *parent)
work = mrp_project_calculate_task_work (parser->project,
task,
start, end);
-
+
g_object_set (task,
"work", work,
NULL);
}
-
+
g_hash_table_insert (parser->task_hash, GINT_TO_POINTER (id), task);
for (child = tree->children; child; child = child->next) {
@@ -323,7 +323,7 @@ old_xml_read_task (MrpParser *parser, xmlNodePtr tree, MrpTask *parent)
old_xml_read_custom_properties (parser, child, MRP_OBJECT (task));
}
}
-
+
for (tasks = tree->children; tasks; tasks = tasks->next) {
if (!strcmp (tasks->name, "task")) {
/* Silently correct old milestones with children to
@@ -333,7 +333,7 @@ old_xml_read_task (MrpParser *parser, xmlNodePtr tree, MrpTask *parent)
type = MRP_TASK_TYPE_NORMAL;
g_object_set (task, "type", type, NULL);
}
-
+
old_xml_read_task (parser, tasks, task);
}
else if (!strcmp (tasks->name, "predecessors")) {
@@ -389,7 +389,7 @@ old_xml_read_resource (MrpParser *parser, xmlNodePtr tree)
if (short_name == NULL) {
short_name = g_strdup ("");
}
-
+
if (email == NULL) {
email = g_strdup ("");
}
@@ -400,7 +400,7 @@ old_xml_read_resource (MrpParser *parser, xmlNodePtr tree)
group = g_hash_table_lookup (parser->group_hash, GINT_TO_POINTER (gid));
calendar = g_hash_table_lookup (parser->calendar_hash, GINT_TO_POINTER (calendar_id));
-
+
resource = g_object_new (MRP_TYPE_RESOURCE,
"name", name,
"short_name", short_name,
@@ -415,7 +415,7 @@ old_xml_read_resource (MrpParser *parser, xmlNodePtr tree)
/* These are cost custom properties */
/* We need first to register the resource in the project */
mrp_project_add_resource (parser->project, resource);
-
+
mrp_object_set (MRP_OBJECT (resource),
"cost", std_rate,
/*"cost_overtime", ovt_rate,*/
@@ -427,11 +427,11 @@ old_xml_read_resource (MrpParser *parser, xmlNodePtr tree)
}
}
- g_hash_table_insert (parser->resource_hash,
+ g_hash_table_insert (parser->resource_hash,
GINT_TO_POINTER (id), resource);
parser->resources = g_list_prepend (parser->resources, resource);
-
+
g_free (name);
g_free (email);
g_free (short_name);
@@ -445,7 +445,7 @@ old_xml_read_group (MrpParser *parser, xmlNodePtr tree)
gchar *name;
gchar *mgr_name, *mgr_phone, *mgr_email;
MrpGroup *group;
-
+
if (strcmp (tree->name, "group")){
/*g_warning ("Got %s, expected 'group'.", tree->name);*/
return;
@@ -469,7 +469,7 @@ old_xml_read_group (MrpParser *parser, xmlNodePtr tree)
g_free (mgr_name);
g_free (mgr_phone);
g_free (mgr_email);
-
+
g_hash_table_insert (parser->group_hash, GINT_TO_POINTER (id), group);
parser->groups = g_list_prepend (parser->groups, group);
@@ -491,12 +491,12 @@ old_xml_read_assignment (MrpParser *parser, xmlNodePtr tree)
task_id = old_xml_get_int (tree, "task-id");
resource_id = old_xml_get_int (tree, "resource-id");
assigned_units = old_xml_get_int_with_default (tree, "units",100);
-
- task = g_hash_table_lookup (parser->task_hash,
+
+ task = g_hash_table_lookup (parser->task_hash,
GINT_TO_POINTER (task_id));
resource = g_hash_table_lookup (parser->resource_hash,
GINT_TO_POINTER (resource_id));
-
+
if (!task) {
g_warning ("Corrupt file? Task %d not found in hash.", task_id);
goto fail;
@@ -525,21 +525,21 @@ old_xml_read_day_type (MrpParser *parser, xmlNodePtr tree)
MrpDay *day;
gint id;
xmlChar *name, *desc;
-
+
id = old_xml_get_int (tree, "id");
if (id == MRP_DAY_WORK || id == MRP_DAY_NONWORK || id == MRP_DAY_USE_BASE) {
return;
}
-
+
if (strcmp (tree->name, "day-type") != 0){
return;
}
-
+
name = xmlGetProp (tree, "name");
- if (!name) {
+ if (!name) {
return;
}
-
+
desc = xmlGetProp (tree, "description");
if (!desc) {
xmlFree (name);
@@ -547,15 +547,15 @@ old_xml_read_day_type (MrpParser *parser, xmlNodePtr tree)
}
day = mrp_day_add (parser->project, name, desc);
-
+
xmlFree (name);
xmlFree (desc);
-
+
g_hash_table_insert (parser->day_hash, GINT_TO_POINTER (id), day);
}
static void
-old_xml_read_default_day (MrpParser *parser,
+old_xml_read_default_day (MrpParser *parser,
xmlNodePtr node,
MrpCalendar *calendar,
gint day_id,
@@ -563,16 +563,16 @@ old_xml_read_default_day (MrpParser *parser,
{
gint id;
MrpDay *day;
-
+
id = old_xml_get_int (node, day_name);
- day = g_hash_table_lookup (parser->day_hash,
+ day = g_hash_table_lookup (parser->day_hash,
GINT_TO_POINTER (id));
mrp_calendar_set_default_days (calendar, day_id, day, -1);
}
static void
old_xml_read_overridden_day_type (MrpParser *parser,
- MrpCalendar *calendar,
+ MrpCalendar *calendar,
xmlNodePtr day)
{
gint id;
@@ -614,12 +614,12 @@ old_xml_read_overridden_day_type (MrpParser *parser,
}
mrp_calendar_day_set_intervals (calendar, mrp_day, intervals);
-
+
g_list_foreach (intervals, (GFunc) mrp_interval_unref, NULL);
g_list_free (intervals);
}
-static void
+static void
old_xml_read_overridden_day (MrpParser *parser,
MrpCalendar *calendar,
xmlNodePtr day)
@@ -629,33 +629,33 @@ old_xml_read_overridden_day (MrpParser *parser,
xmlChar *xml_str;
MrpDay *mrp_day;
gint y, m, d;
-
+
if (strcmp (day->name, "day") != 0){
return;
}
-
+
xml_str = xmlGetProp (day, "type");
if (!xml_str) {
return;
- }
+ }
if (strcmp (xml_str, "day-type") != 0) {
xmlFree (xml_str);
return;
}
xmlFree (xml_str);
-
+
id = old_xml_get_int (day, "id");
-
+
mrp_day = g_hash_table_lookup (parser->day_hash, GINT_TO_POINTER (id));
xml_str = xmlGetProp (day, "date");
if (!xml_str) {
return;
- }
-
+ }
+
if (sscanf (xml_str, "%04d%02d%02d", &y, &m, &d) == 3) {
date = mrp_time_compose (y, m, d, 0, 0, 0);
- mrp_calendar_set_days (calendar, date, mrp_day, (mrptime) -1);
+ mrp_calendar_set_days (calendar, date, mrp_day, (mrptime) -1);
} else {
g_warning ("Invalid time format for overridden day.");
}
@@ -670,13 +670,13 @@ old_xml_read_calendar (MrpParser *parser, MrpCalendar *parent, xmlNodePtr tree)
xmlChar *name;
xmlNodePtr child;
gint id;
-
+
if (strcmp (tree->name, "calendar") != 0){
return;
}
-
+
name = xmlGetProp (tree, "name");
- if (!name) {
+ if (!name) {
return;
}
@@ -715,10 +715,10 @@ old_xml_read_calendar (MrpParser *parser, MrpCalendar *parent, xmlNodePtr tree)
}
else if (strcmp (child->name, "overridden-day-types") == 0) {
xmlNodePtr day;
-
+
for (day = child->children; day; day = day->next) {
old_xml_read_overridden_day_type (parser,
- calendar,
+ calendar,
day);
}
}
@@ -727,7 +727,7 @@ old_xml_read_calendar (MrpParser *parser, MrpCalendar *parent, xmlNodePtr tree)
for (day = child->children; day; day = day->next) {
old_xml_read_overridden_day (parser,
- calendar,
+ calendar,
day);
}
}
@@ -753,7 +753,7 @@ old_xml_read_project_properties (MrpParser *parser)
parser->project_start = old_xml_get_date (node,
"project-start");
}
-
+
name = old_xml_get_string (node, "name");
org = old_xml_get_string (node, "company");
manager = old_xml_get_string (node, "manager");
@@ -786,12 +786,12 @@ old_xml_read_string_list (xmlNodePtr node,
if (!node->children) {
return NULL;
}
-
+
array = g_value_array_new (0);
-
+
g_value_init (&value, G_TYPE_STRING);
-
+
for (child = node->children; child; child = child->next) {
if (!strcmp (child->name, "list-item")) {
str = old_xml_get_string (child, "value");
@@ -800,19 +800,19 @@ old_xml_read_string_list (xmlNodePtr node,
g_value_set_string (&value, str);
g_value_array_append (array, &value);
}
-
+
g_free (str);
}
}
g_value_unset (&value);
-
+
return array;
}
/* Note: this is a hack to read phases as custom properties from files created
* with 0.8pre, 0.8, 0.9pre.
- */
+ */
static GList *
old_xml_read_crufty_phases (xmlNodePtr node)
{
@@ -823,7 +823,7 @@ old_xml_read_crufty_phases (xmlNodePtr node)
if (!node->children) {
return NULL;
}
-
+
for (child = node->children; child; child = child->next) {
if (!strcmp (child->name, "list-item")) {
str = old_xml_get_string (child, "value");
@@ -835,7 +835,7 @@ old_xml_read_crufty_phases (xmlNodePtr node)
}
phases = g_list_reverse (phases);
-
+
return phases;
}
@@ -852,32 +852,32 @@ old_xml_read_property_specs (MrpParser *parser)
MrpProperty *property;
MrpPropertyType type;
GType owner;
-
- node = old_xml_search_child (parser->doc->children, "properties");
+
+ node = old_xml_search_child (parser->doc->children, "properties");
if (node == NULL) {
return;
}
-
+
for (child = node->children; child; child = child->next) {
if (strcmp (child->name, "property")) {
continue;
}
-
+
name = old_xml_get_string (child, "name");
if (!strcmp (name, "phases") || !strcmp (name, "phase")) {
g_free (name);
continue;
}
-
+
label = old_xml_get_string (child, "label");
description = old_xml_get_string (child, "description");
owner_str = old_xml_get_string (child, "owner");
type_str = old_xml_get_string (child, "type");
type = old_xml_property_type_from_string (type_str);
-
+
property = mrp_property_new (name,
type,
label,
@@ -895,7 +895,7 @@ old_xml_read_property_specs (MrpParser *parser)
g_free (description);
continue;
}
-
+
if (!strcmp (owner_str, "task")) {
owner = MRP_TYPE_TASK;
}
@@ -917,7 +917,7 @@ old_xml_read_property_specs (MrpParser *parser)
mrp_project_add_property (parser->project,
owner,
property,
- TRUE /* FIXME: user_defined, should
+ TRUE /* FIXME: user_defined, should
be read from the file */);
}
@@ -936,17 +936,17 @@ old_xml_read_phases (MrpParser *parser)
xmlNodePtr child;
GList *phases = NULL;
gchar *name;
-
- node = old_xml_search_child (parser->doc->children, "phases");
+
+ node = old_xml_search_child (parser->doc->children, "phases");
if (node == NULL) {
return;
}
-
+
for (child = node->children; child; child = child->next) {
if (strcmp (child->name, "phase")) {
continue;
}
-
+
name = old_xml_get_string (child, "name");
phases = g_list_prepend (phases, name);
}
@@ -963,27 +963,27 @@ old_xml_read_project (MrpParser *parser)
xmlNodePtr tasks, resources, groups, assignments, calendars;
gint gid;
MrpCalendar *calendar;
-
+
old_xml_read_project_properties (parser);
parser->root_task = mrp_task_new ();
child = parser->doc->children;
-
+
child = child->children;
-
+
/* Get the first "properties" node, i.e. specs. */
while (child) {
if (!strcmp (child->name, "properties")) {
old_xml_read_property_specs (parser);
-
+
child = child->next;
break;
}
-
+
child = child->next;
}
-
+
/* Get the second "properties" node, i.e. values. */
while (child) {
if (!strcmp (child->name, "properties")) {
@@ -992,12 +992,12 @@ old_xml_read_project (MrpParser *parser)
MRP_OBJECT (parser->project));
break;
}
-
+
child = child->next;
}
old_xml_read_phases (parser);
-
+
/* Load calendars */
calendars = old_xml_search_child (parser->doc->children, "calendars");
if (calendars != NULL) {
@@ -1007,7 +1007,7 @@ old_xml_read_project (MrpParser *parser)
/* Insert hardcoded days. */
g_hash_table_insert (parser->day_hash,
- GINT_TO_POINTER (MRP_DAY_WORK),
+ GINT_TO_POINTER (MRP_DAY_WORK),
mrp_day_ref (mrp_day_get_work ()));
g_hash_table_insert (parser->day_hash,
GINT_TO_POINTER (MRP_DAY_NONWORK),
@@ -1015,14 +1015,14 @@ old_xml_read_project (MrpParser *parser)
g_hash_table_insert (parser->day_hash,
GINT_TO_POINTER (MRP_DAY_USE_BASE),
mrp_day_ref (mrp_day_get_use_base ()));
-
+
if (child != NULL) {
/* Read day-types */
for (day = child->children; day; day = day->next) {
old_xml_read_day_type (parser, day);
}
}
-
+
for (child = calendars->children; child; child = child->next) {
if (strcmp (child->name, "calendar") == 0) {
old_xml_read_calendar (parser, NULL, child);
@@ -1037,7 +1037,7 @@ old_xml_read_project (MrpParser *parser)
g_object_set (parser->project, "calendar", calendar, NULL);
}
-
+
/* Load tasks. */
child = old_xml_search_child (parser->doc->children, "tasks");
if (child != NULL) {
@@ -1052,13 +1052,13 @@ old_xml_read_project (MrpParser *parser)
if (parser->version == 1) {
mrp_time_align_day (parser->project_start);
}
-
+
/* Load resource groups. */
- child = old_xml_search_child (parser->doc->children,
- "resource-groups");
- if (child != NULL) {
+ child = old_xml_search_child (parser->doc->children,
+ "resource-groups");
+ if (child != NULL) {
for (groups = child->children; groups; groups = groups->next) {
- old_xml_read_group (parser, groups);
+ old_xml_read_group (parser, groups);
}
/* Gah, why underscore?! */
@@ -1066,16 +1066,16 @@ old_xml_read_project (MrpParser *parser)
parser->default_group = g_hash_table_lookup (parser->group_hash,
GINT_TO_POINTER (gid));
}
-
+
/* Load resources. */
- child = old_xml_search_child (parser->doc->children, "resources");
+ child = old_xml_search_child (parser->doc->children, "resources");
if (child != NULL) {
for (resources = child->children; resources; resources = resources->next) {
- old_xml_read_resource (parser, resources);
+ old_xml_read_resource (parser, resources);
}
}
parser->resources = g_list_reverse (parser->resources);
-
+
/* Load assignments. */
child = old_xml_search_child (parser->doc->children, "allocations");
if (child != NULL) {
@@ -1161,7 +1161,7 @@ old_xml_get_date (xmlNodePtr node, const char *name)
val = old_xml_get_value (node, name);
t = mrp_time_from_string (val, NULL);
-
+
xmlFree (val);
return t;
@@ -1182,7 +1182,7 @@ old_xml_get_int (xmlNodePtr node, const char *name)
}
ret = atoi (val);
-
+
xmlFree (val);
return ret;
@@ -1203,7 +1203,7 @@ old_xml_get_int_with_default (xmlNodePtr node, const char *name, gint def)
}
ret = atoi (val);
-
+
xmlFree (val);
return ret;
@@ -1224,7 +1224,7 @@ old_xml_get_float (xmlNodePtr node, const char *name)
}
ret = g_ascii_strtod (val, NULL);
-
+
xmlFree (val);
return ret;
@@ -1252,7 +1252,7 @@ old_xml_get_task_type (xmlNodePtr node, const char *name)
} else {
type = MRP_TASK_TYPE_NORMAL;
}
-
+
xmlFree (val);
return type;
@@ -1280,7 +1280,7 @@ old_xml_get_task_sched (xmlNodePtr node, const char *name)
} else {
sched = MRP_TASK_SCHED_FIXED_WORK;
}
-
+
xmlFree (val);
return sched;
@@ -1333,7 +1333,7 @@ old_xml_property_type_from_string (const gchar *str)
}
else if (!strcmp (str, "cost")) {
/* FIXME: implement */
- } else {
+ } else {
g_warning ("Not implemented support for type");
}
@@ -1386,7 +1386,7 @@ old_xml_set_property_from_node (MrpProject *project,
g_free (str);
return;
}
-
+
property = mrp_project_get_property (project,
name,
G_OBJECT_TYPE (object));
@@ -1438,7 +1438,7 @@ old_xml_process_delayed_relations (MrpParser *parser)
GList *l;
MrpTask *task, *predecessor_task;
DelayedRelation *relation;
-
+
for (l = parser->delayed_relations; l; l = l->next) {
relation = l->data;
@@ -1468,7 +1468,7 @@ mrp_old_xml_parse (MrpProject *project, xmlDoc *doc, GError **error)
MrpTaskManager *task_manager;
MrpAssignment *assignment;
GList *node;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), FALSE);
g_return_val_if_fail (doc != NULL, FALSE);
@@ -1476,17 +1476,17 @@ mrp_old_xml_parse (MrpProject *project, xmlDoc *doc, GError **error)
parser.project_start = -1;
parser.project = g_object_ref (project);
-
+
parser.doc = doc;
-
+
parser.task_hash = g_hash_table_new (NULL, NULL);
parser.resource_hash = g_hash_table_new (NULL, NULL);
parser.group_hash = g_hash_table_new (NULL, NULL);
parser.day_hash = g_hash_table_new_full (NULL, NULL,
- NULL,
+ NULL,
(GDestroyNotify) mrp_day_unref);
parser.calendar_hash = g_hash_table_new (NULL, NULL);
-
+
success = old_xml_read_project (&parser);
g_hash_table_destroy (parser.resource_hash);
@@ -1497,12 +1497,12 @@ mrp_old_xml_parse (MrpProject *project, xmlDoc *doc, GError **error)
if (!success) {
return FALSE;
}
-
+
task_manager = imrp_project_get_task_manager (project);
mrp_task_manager_set_root (task_manager, parser.root_task);
parser.project_start = mrp_time_align_day (parser.project_start);
-
+
g_object_set (project,
"project-start", parser.project_start,
"default-group", parser.default_group,
@@ -1530,7 +1530,7 @@ mrp_old_xml_parse (MrpProject *project, xmlDoc *doc, GError **error)
g_list_free (parser.assignments);
g_list_free (parser.resources);
-
+
return TRUE;
}
diff --git a/libplanner/mrp-old-xml.h b/libplanner/mrp-old-xml.h
index 7ca8c7e..518cf57 100644
--- a/libplanner/mrp-old-xml.h
+++ b/libplanner/mrp-old-xml.h
@@ -27,8 +27,8 @@
#include <libxml/parser.h>
#include <libplanner/mrp-project.h>
-gboolean mrp_old_xml_parse (MrpProject *project,
- xmlDoc *doc,
+gboolean mrp_old_xml_parse (MrpProject *project,
+ xmlDoc *doc,
GError **error);
#endif /* __MRP_OLD_XML_H__ */
diff --git a/libplanner/mrp-parser.c b/libplanner/mrp-parser.c
index aa22c7a..8548623 100644
--- a/libplanner/mrp-parser.c
+++ b/libplanner/mrp-parser.c
@@ -50,23 +50,23 @@ typedef struct {
xmlDocPtr doc;
gint version;
-
+
MrpProject *project;
-
+
MrpTask *root_task;
GList *resources;
GList *groups;
GList *assignments;
mrptime project_start;
-
+
MrpGroup *default_group;
gint last_id;
gint next_day_type_id;
gint next_calendar_id;
-
+
GHashTable *task_hash;
GHashTable *resource_hash;
GHashTable *group_hash;
@@ -88,7 +88,7 @@ static void mpp_xml_set_int (xmlNodePtr node,
const gchar *prop,
gint value);
static void mpp_xml_set_float (xmlNodePtr node,
- const gchar *prop,
+ const gchar *prop,
gfloat value);
static void mpp_xml_set_task_type (xmlNodePtr node,
const gchar *prop,
@@ -130,12 +130,12 @@ mpp_write_project_properties (MrpParser *parser, xmlNodePtr node)
if (calendar) {
id = GPOINTER_TO_INT (g_hash_table_lookup (parser->calendar_hash,
calendar));
-
+
if (id) {
mpp_xml_set_int (node, "calendar", id);
}
}
-
+
g_free (name);
g_free (org);
g_free (manager);
@@ -157,9 +157,9 @@ mpp_property_type_to_string (MrpPropertyType type)
case MRP_PROPERTY_TYPE_DURATION:
return "duration";
case MRP_PROPERTY_TYPE_DATE:
- return "date";
+ return "date";
case MRP_PROPERTY_TYPE_COST:
- return "cost";
+ return "cost";
default:
g_warning ("Not implemented support for type %d", type);
break;
@@ -179,9 +179,9 @@ mpp_property_to_string (MrpObject *object,
gfloat f;
mrptime date;
GValueArray *array;
-
+
name = mrp_property_get_name (property);
-
+
switch (mrp_property_get_property_type (property)) {
case MRP_PROPERTY_TYPE_STRING:
mrp_object_get (object, name, &str, NULL);
@@ -208,7 +208,7 @@ mpp_property_to_string (MrpObject *object,
return g_strdup_printf ("%d", i);
case MRP_PROPERTY_TYPE_DATE:
mrp_object_get (object, name, &date, NULL);
- str = mrp_time_to_string (date);
+ str = mrp_time_to_string (date);
return str;
case MRP_PROPERTY_TYPE_COST:
/* FIXME: implement cost */
@@ -229,22 +229,22 @@ mpp_write_property_specs (MrpParser *parser, xmlNodePtr node)
xmlNodePtr child;
MrpProperty *property;
MrpPropertyType type;
-
- properties = mrp_project_get_properties_from_type (parser->project,
+
+ properties = mrp_project_get_properties_from_type (parser->project,
MRP_TYPE_PROJECT);
-
+
node = xmlNewChild (node, NULL, "properties", NULL);
for (l = properties; l; l = l->next) {
property = l->data;
child = xmlNewChild (node, NULL, "property", NULL);
-
+
xmlSetProp (child, "name", mrp_property_get_name (property));
type = mrp_property_get_property_type (property);
xmlSetProp (child, "type", mpp_property_type_to_string (type));
-
+
xmlSetProp (child, "owner", "project");
xmlSetProp (child, "label", mrp_property_get_label (property));
xmlSetProp (child, "description", mrp_property_get_description (property));
@@ -252,19 +252,19 @@ mpp_write_property_specs (MrpParser *parser, xmlNodePtr node)
g_list_free (properties);
- properties = mrp_project_get_properties_from_type (parser->project,
+ properties = mrp_project_get_properties_from_type (parser->project,
MRP_TYPE_TASK);
-
+
for (l = properties; l; l = l->next) {
property = l->data;
child = xmlNewChild (node, NULL, "property", NULL);
-
+
xmlSetProp (child, "name", mrp_property_get_name (property));
type = mrp_property_get_property_type (property);
xmlSetProp (child, "type", mpp_property_type_to_string (type));
-
+
xmlSetProp (child, "owner", "task");
xmlSetProp (child, "label", mrp_property_get_label (property));
xmlSetProp (child, "description", mrp_property_get_description (property));
@@ -272,19 +272,19 @@ mpp_write_property_specs (MrpParser *parser, xmlNodePtr node)
g_list_free (properties);
- properties = mrp_project_get_properties_from_type (parser->project,
+ properties = mrp_project_get_properties_from_type (parser->project,
MRP_TYPE_RESOURCE);
-
+
for (l = properties; l; l = l->next) {
property = l->data;
child = xmlNewChild (node, NULL, "property", NULL);
-
+
xmlSetProp (child, "name", mrp_property_get_name (property));
type = mrp_property_get_property_type (property);
xmlSetProp (child, "type", mpp_property_type_to_string (type));
-
+
xmlSetProp (child, "owner", "resource");
xmlSetProp (child, "label", mrp_property_get_label (property));
xmlSetProp (child, "description", mrp_property_get_description (property));
@@ -298,14 +298,14 @@ mpp_write_phases (MrpParser *parser, xmlNodePtr node)
{
GList *phases, *l;
xmlNodePtr child;
-
+
g_object_get (parser->project, "phases", &phases, NULL);
-
+
node = xmlNewChild (node, NULL, "phases", NULL);
for (l = phases; l; l = l->next) {
child = xmlNewChild (node, NULL, "phase", NULL);
-
+
xmlSetProp (child, "name", l->data);
}
@@ -358,17 +358,17 @@ static gboolean
mpp_hash_insert_task_cb (MrpTask *task, MrpParser *parser)
{
NodeEntry *entry;
-
+
/* Don't want the root task. */
if (task == parser->root_task) {
return FALSE;
}
-
+
entry = g_new0 (NodeEntry, 1);
entry->id = parser->last_id++;
-
+
g_hash_table_insert (parser->task_hash, task, entry);
-
+
return FALSE;
}
@@ -377,7 +377,7 @@ mpp_write_constraint (xmlNodePtr node, MrpConstraint *constraint)
{
xmlNodePtr child;
const gchar *str = NULL;
-
+
/* No need to save if we have ASAP. */
if (constraint->type == MRP_CONSTRAINT_ASAP) {
return;
@@ -399,7 +399,7 @@ mpp_write_constraint (xmlNodePtr node, MrpConstraint *constraint)
case MRP_CONSTRAINT_ALAP:
g_assert_not_reached ();
break;
- }
+ }
xmlSetProp (child, "type", str);
mpp_xml_set_date (child, "time", constraint->time);
@@ -414,15 +414,15 @@ mpp_write_string_list (xmlNodePtr node,
GValueArray *array;
GValue *value;
gint i;
-
+
mrp_object_get (object, mrp_property_get_name (property), &array, NULL);
if (!array) {
return;
}
-
+
for (i = 0; i < array->n_values; i++) {
value = g_value_array_get_nth (array, i);
-
+
child = xmlNewChild (node, NULL, "list-item", NULL);
xmlSetProp (child, "value", g_value_get_string (value));
}
@@ -442,25 +442,25 @@ mpp_write_custom_properties (MrpParser *parser,
properties = mrp_project_get_properties_from_type (parser->project,
G_OBJECT_TYPE (object));
-
+
if (properties == NULL) {
return;
}
-
+
node = xmlNewChild (node, NULL, "properties", NULL);
for (l = properties; l; l = l->next) {
property = l->data;
-
+
child = xmlNewChild (node, NULL, "property", NULL);
-
+
xmlSetProp (child, "name", mrp_property_get_name (property));
if (mrp_property_get_property_type (property) == MRP_PROPERTY_TYPE_STRING_LIST) {
mpp_write_string_list (child, property, object);
} else {
value = mpp_property_to_string (object, property);
-
+
xmlSetProp (child, "value", value);
g_free (value);
@@ -492,7 +492,7 @@ mpp_write_task_cb (MrpTask *task, MrpParser *parser)
if (task == parser->root_task) {
return FALSE;
}
-
+
parent = mrp_task_get_parent (task);
entry = g_hash_table_lookup (parser->task_hash, parent);
@@ -502,7 +502,7 @@ mpp_write_task_cb (MrpTask *task, MrpParser *parser)
entry = g_hash_table_lookup (parser->task_hash, task);
entry->node = node;
-
+
g_object_get (task,
"name", &name,
"note", ¬e,
@@ -524,7 +524,7 @@ mpp_write_task_cb (MrpTask *task, MrpParser *parser)
work = 0;
duration = 0;
}
-
+
mpp_xml_set_int (node, "id", entry->id);
xmlSetProp (node, "name", name);
xmlSetProp (node, "note", note);
@@ -533,7 +533,7 @@ mpp_write_task_cb (MrpTask *task, MrpParser *parser)
if (sched == MRP_TASK_SCHED_FIXED_DURATION) {
mpp_xml_set_int (node, "duration", duration);
}
-
+
mpp_xml_set_date (node, "start", start);
mpp_xml_set_date (node, "end", finish);
mpp_xml_set_date (node, "work-start", work_start);
@@ -545,9 +545,9 @@ mpp_write_task_cb (MrpTask *task, MrpParser *parser)
mpp_xml_set_task_sched (node, "scheduling", sched);
mpp_write_custom_properties (parser, node, MRP_OBJECT (task));
-
+
mpp_write_constraint (node, constraint);
-
+
predecessors = mrp_task_get_predecessor_relations (task);
if (predecessors != NULL) {
node = xmlNewChild (node, NULL, "predecessors", NULL);
@@ -558,7 +558,7 @@ mpp_write_task_cb (MrpTask *task, MrpParser *parser)
g_free (name);
g_free (note);
-
+
return FALSE;
}
@@ -590,9 +590,9 @@ mpp_write_group (MrpParser *parser, xmlNodePtr parent, MrpGroup *group)
entry = g_hash_table_lookup (parser->group_hash, group);
entry->node = node;
-
+
mpp_xml_set_int (node, "id", entry->id);
-
+
g_object_get (group,
"name", &name,
"manager-name", &admin_name,
@@ -600,9 +600,9 @@ mpp_write_group (MrpParser *parser, xmlNodePtr parent, MrpGroup *group)
"manager-email", &admin_email,
NULL);
- xmlSetProp (node, "name", name);
- xmlSetProp (node, "admin-name", admin_name);
- xmlSetProp (node, "admin-phone", admin_phone);
+ xmlSetProp (node, "name", name);
+ xmlSetProp (node, "admin-name", admin_name);
+ xmlSetProp (node, "admin-phone", admin_phone);
xmlSetProp (node, "admin-email", admin_email);
g_free (name);
@@ -623,7 +623,7 @@ mpp_hash_insert_resource (MrpParser *parser, MrpResource *resource)
}
static void
-mpp_write_resource (MrpParser *parser,
+mpp_write_resource (MrpParser *parser,
xmlNodePtr parent,
MrpResource *resource)
{
@@ -659,7 +659,7 @@ mpp_write_resource (MrpParser *parser,
group_entry = g_hash_table_lookup (parser->group_hash, group);
- /* FIXME: should group really be able to be NULL? Should always
+ /* FIXME: should group really be able to be NULL? Should always
* be default group? */
if (group_entry != NULL) {
mpp_xml_set_int (node, "group", group_entry->id);
@@ -667,15 +667,15 @@ mpp_write_resource (MrpParser *parser,
resource_entry = g_hash_table_lookup (parser->resource_hash, resource);
mpp_xml_set_int (node, "id", resource_entry->id);
-
+
xmlSetProp (node, "name", name);
xmlSetProp (node, "short-name", short_name);
-
+
mpp_xml_set_int (node, "type", type);
-
+
mpp_xml_set_int (node, "units", units);
xmlSetProp (node, "email", email);
-
+
xmlSetProp (node, "note", note);
mpp_xml_set_float (node, "std-rate", std_rate);
@@ -685,7 +685,7 @@ mpp_write_resource (MrpParser *parser,
if (calendar) {
id = GPOINTER_TO_INT (g_hash_table_lookup (parser->calendar_hash,
calendar));
-
+
if (id) {
mpp_xml_set_int (node, "calendar", id);
}
@@ -738,7 +738,7 @@ mpp_write_interval (xmlNodePtr parent, MrpInterval *interval)
xmlNodePtr child;
mrptime start, end;
gchar *str;
-
+
child = xmlNewChild (parent, NULL, "interval", NULL);
mrp_interval_get_absolute (interval, 0, &start, &end);
@@ -746,7 +746,7 @@ mpp_write_interval (xmlNodePtr parent, MrpInterval *interval)
str = mrp_time_format ("%H%M", start);
xmlSetProp (child, "start", str);
g_free (str);
-
+
str = mrp_time_format ("%H%M", end);
xmlSetProp (child, "end", str);
g_free (str);
@@ -757,7 +757,7 @@ mpp_write_day (MrpParser *parser, xmlNodePtr parent, MrpDay *day)
{
xmlNodePtr node;
NodeEntry *day_entry;
-
+
g_return_if_fail (day != NULL);
node = xmlNewChild (parent, NULL, "day-type", NULL);
@@ -774,7 +774,7 @@ mpp_write_day (MrpParser *parser, xmlNodePtr parent, MrpDay *day)
} else {
day_entry->id = parser->next_day_type_id++;
}
-
+
g_hash_table_insert (parser->day_hash, day, day_entry);
mpp_xml_set_int (node, "id", day_entry->id);
@@ -782,23 +782,23 @@ mpp_write_day (MrpParser *parser, xmlNodePtr parent, MrpDay *day)
xmlSetProp (node, "description", mrp_day_get_description (day));
}
-static void
+static void
mpp_write_default_day (MrpParser *parser,
- xmlNode *node,
- MrpCalendar *calendar,
- const gchar *name,
+ xmlNode *node,
+ MrpCalendar *calendar,
+ const gchar *name,
gint week_day)
{
MrpDay *day;
NodeEntry *day_entry;
-
+
day = mrp_calendar_get_default_day (calendar, week_day);
day_entry = (NodeEntry *) g_hash_table_lookup (parser->day_hash, day);
-
+
if (!day_entry) {
return;
}
-
+
mpp_xml_set_int (node, name, day_entry->id);
}
@@ -840,7 +840,7 @@ mpp_write_overridden_date (MrpParser *parser,
str = mrp_time_format ("%Y%m%d", dd->date);
xmlSetProp (child, "date", str);
g_free (str);
-
+
xmlSetProp (child, "type", "day-type");
mpp_xml_set_int (child, "id", entry->id);
}
@@ -849,14 +849,14 @@ mpp_write_overridden_date (MrpParser *parser,
}
static void
-mpp_write_calendar (MrpParser *parser,
- xmlNodePtr parent,
+mpp_write_calendar (MrpParser *parser,
+ xmlNodePtr parent,
MrpCalendar *calendar)
{
xmlNodePtr node, child;
GList *l, *days, *dates;
gint id;
-
+
g_return_if_fail (MRP_IS_CALENDAR (calendar));
node = xmlNewChild (parent, NULL, "calendar", NULL);
@@ -867,44 +867,44 @@ mpp_write_calendar (MrpParser *parser,
g_hash_table_insert (parser->calendar_hash,
calendar,
GINT_TO_POINTER (id));
-
+
xmlSetProp (node, "name", mrp_calendar_get_name (calendar));
-
+
/* Write the default week */
child = xmlNewChild (node, NULL, "default-week", NULL);
-
- mpp_write_default_day (parser, child, calendar,
+
+ mpp_write_default_day (parser, child, calendar,
"mon", MRP_CALENDAR_DAY_MON);
mpp_write_default_day (parser, child, calendar,
"tue", MRP_CALENDAR_DAY_TUE);
- mpp_write_default_day (parser, child, calendar,
+ mpp_write_default_day (parser, child, calendar,
"wed", MRP_CALENDAR_DAY_WED);
mpp_write_default_day (parser, child, calendar,
"thu", MRP_CALENDAR_DAY_THU);
- mpp_write_default_day (parser, child, calendar,
+ mpp_write_default_day (parser, child, calendar,
"fri", MRP_CALENDAR_DAY_FRI);
- mpp_write_default_day (parser, child, calendar,
+ mpp_write_default_day (parser, child, calendar,
"sat", MRP_CALENDAR_DAY_SAT);
- mpp_write_default_day (parser, child, calendar,
+ mpp_write_default_day (parser, child, calendar,
"sun", MRP_CALENDAR_DAY_SUN);
-
+
/* Override days */
child = xmlNewChild (node, NULL, "overridden-day-types", NULL);
days = mrp_calendar_get_overridden_days (calendar);
-
+
for (l = days; l; l = l->next) {
MrpDayWithIntervals *day_ival =l->data;
-
+
mpp_write_overridden_day (parser, child, day_ival);
}
g_list_free (days);
-
+
/* Write the overriden dates */
child = xmlNewChild (node, NULL, "days", NULL);
dates = mrp_calendar_get_all_overridden_dates (calendar);
for (l = dates; l; l = l->next) {
MrpDateWithDay *date_day = l->data;
-
+
mpp_write_overridden_date (parser, child, date_day);
}
g_list_free (dates);
@@ -912,7 +912,7 @@ mpp_write_calendar (MrpParser *parser,
/* Add special dates */
for (l = mrp_calendar_get_children (calendar); l; l = l->next) {
MrpCalendar *child_calendar = l->data;
-
+
mpp_write_calendar (parser, node, child_calendar);
}
}
@@ -926,7 +926,7 @@ mpp_write_project (MrpParser *parser)
MrpGroup *default_group = NULL;
NodeEntry *entry;
MrpCalendar *root_calendar;
-
+
node = xmlNewDocNode (parser->doc, NULL, "project", NULL);
parser->doc->xmlRootNode = node;
@@ -934,11 +934,11 @@ mpp_write_project (MrpParser *parser)
mpp_write_custom_properties (parser, node, MRP_OBJECT (parser->project));
mpp_write_phases (parser, node);
-
+
/* Write calendars */
calendars_node = xmlNewChild (node, NULL, "calendars", NULL);
child = xmlNewChild (calendars_node, NULL, "day-types", NULL);
-
+
mpp_write_day (parser, child, mrp_day_get_work ());
mpp_write_day (parser, child, mrp_day_get_nonwork ());
mpp_write_day (parser, child, mrp_day_get_use_base ());
@@ -949,7 +949,7 @@ mpp_write_project (MrpParser *parser)
/* Get the calendars */
root_calendar = mrp_project_get_root_calendar (parser->project);
-
+
for (l = mrp_calendar_get_children (root_calendar); l; l = l->next) {
mpp_write_calendar (parser, calendars_node, l->data);
}
@@ -965,14 +965,14 @@ mpp_write_project (MrpParser *parser)
entry->node = child;
g_hash_table_insert (parser->task_hash, parser->root_task, entry);
-
+
/* Generate IDs and hash table. */
parser->last_id = 1;
mrp_project_task_traverse (parser->project,
parser->root_task,
(MrpTaskTraverseFunc) mpp_hash_insert_task_cb,
parser);
-
+
mrp_project_task_traverse (parser->project,
parser->root_task,
(MrpTaskTraverseFunc) mpp_write_task_cb,
@@ -985,21 +985,21 @@ mpp_write_project (MrpParser *parser)
/* Generate IDs and hash table. */
parser->last_id = 1;
for (l = list; l; l = l->next) {
- mpp_hash_insert_group (parser, l->data);
+ mpp_hash_insert_group (parser, l->data);
}
g_object_get (parser->project, "default-group", &default_group, NULL);
if (default_group) {
- entry = g_hash_table_lookup (parser->group_hash,
+ entry = g_hash_table_lookup (parser->group_hash,
default_group);
mpp_xml_set_int (child, "default_group", entry->id);
}
-
+
for (l = list; l; l = l->next) {
- mpp_write_group (parser, child, l->data);
+ mpp_write_group (parser, child, l->data);
}
-
+
/* Write resources. */
child = xmlNewChild (node, NULL, "resources",NULL);
list = mrp_project_get_resources (parser->project);
@@ -1008,14 +1008,14 @@ mpp_write_project (MrpParser *parser)
parser->last_id = 1;
for (l = list; l; l = l->next) {
GList *r_list;
- mpp_hash_insert_resource (parser, l->data);
+ mpp_hash_insert_resource (parser, l->data);
r_list = mrp_resource_get_assignments (MRP_RESOURCE (l->data));
- assignments = g_list_concat (assignments,
+ assignments = g_list_concat (assignments,
g_list_copy (r_list));
}
for (l = list; l; l = l->next) {
- mpp_write_resource (parser, child, l->data);
+ mpp_write_resource (parser, child, l->data);
}
/* Write assignments. */
@@ -1034,12 +1034,12 @@ parser_build_xml_doc (MrpStorageMrproject *module,
GError **error)
{
MrpParser parser;
-
+
g_return_val_if_fail (MRP_IS_STORAGE_MRPROJECT (module), FALSE);
/* We want indentation. */
xmlKeepBlanksDefault (0);
-
+
memset (&parser, 0, sizeof (parser));
parser.project = module->project;
@@ -1069,7 +1069,7 @@ parser_build_xml_doc (MrpStorageMrproject *module,
g_hash_table_destroy (parser.resource_hash);
g_hash_table_destroy (parser.day_hash);
g_hash_table_destroy (parser.calendar_hash);
-
+
return parser.doc;
}
@@ -1083,7 +1083,7 @@ mrp_parser_save (MrpStorageMrproject *module,
gint ret;
gboolean file_exist;
xmlDocPtr doc;
-
+
g_return_val_if_fail (MRP_IS_STORAGE_MRPROJECT (module), FALSE);
g_return_val_if_fail (filename != NULL && filename[0] != 0, FALSE);
@@ -1092,16 +1092,16 @@ mrp_parser_save (MrpStorageMrproject *module,
} else {
real_filename = g_strdup (filename);
}
-
+
file_exist = g_file_test (
real_filename, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR);
-
+
if (file_exist && !force) {
g_set_error (error,
MRP_ERROR,
MRP_ERROR_SAVE_FILE_EXIST,
"%s", real_filename);
-
+
g_free (real_filename);
return FALSE;
}
@@ -1124,7 +1124,7 @@ mrp_parser_save (MrpStorageMrproject *module,
return FALSE;
}
-
+
return TRUE;
}
@@ -1136,7 +1136,7 @@ mrp_parser_to_xml (MrpStorageMrproject *module,
xmlDocPtr doc;
xmlChar *buf;
int len;
-
+
g_return_val_if_fail (MRP_IS_STORAGE_MRPROJECT (module), FALSE);
doc = parser_build_xml_doc (module, error);
@@ -1149,16 +1149,16 @@ mrp_parser_to_xml (MrpStorageMrproject *module,
*str = g_strdup (buf);
xmlFree (buf);
-
+
if (len <= 0) {
g_set_error (error,
MRP_ERROR,
MRP_ERROR_SAVE_WRITE_FAILED,
_("Could not create XML tree"));
-
+
return FALSE;
}
-
+
return TRUE;
}
@@ -1221,8 +1221,8 @@ mpp_xml_set_task_type (xmlNodePtr node, const gchar *prop, MrpTaskType type)
default:
str = "normal";
break;
- }
-
+ }
+
xmlSetProp (node, prop, str);
}
@@ -1240,7 +1240,7 @@ mpp_xml_set_task_sched (xmlNodePtr node, const gchar *prop, MrpTaskSched sched)
default:
str = "fixed-work";
break;
- }
-
+ }
+
xmlSetProp (node, prop, str);
}
diff --git a/libplanner/mrp-paths-gnome.c b/libplanner/mrp-paths-gnome.c
index e62fe4f..b91b31a 100644
--- a/libplanner/mrp-paths-gnome.c
+++ b/libplanner/mrp-paths-gnome.c
@@ -59,7 +59,7 @@ mrp_paths_get_image_dir (const gchar *filename)
gchar *
mrp_paths_get_plugin_dir (const gchar *filename)
-{
+{
const gchar *env_plugin_dir = g_getenv ("PLANNER_PLUGINDIR");
return g_build_filename (env_plugin_dir ? env_plugin_dir
: default_plugin_dir,
diff --git a/libplanner/mrp-paths-win32.c b/libplanner/mrp-paths-win32.c
index 5d84093..fb039ca 100644
--- a/libplanner/mrp-paths-win32.c
+++ b/libplanner/mrp-paths-win32.c
@@ -53,7 +53,7 @@ mrp_paths_get_glade_dir (const gchar *filename)
if (!glade_dir) {
glade_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, GLADEDIR);
}
-
+
return g_build_filename (glade_dir, filename, NULL);
}
@@ -63,7 +63,7 @@ mrp_paths_get_image_dir (const gchar *filename)
if (!image_dir) {
image_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, IMAGEDIR);
}
-
+
return g_build_filename (image_dir, filename, NULL);
}
@@ -73,7 +73,7 @@ mrp_paths_get_plugin_dir (const gchar *filename)
if (!plugin_dir) {
plugin_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, PLUGINDIR);
}
-
+
return g_build_filename (plugin_dir, filename, NULL);
}
@@ -83,7 +83,7 @@ mrp_paths_get_dtd_dir (const gchar *filename)
if (!dtd_dir) {
dtd_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, DTDDIR);
}
-
+
return g_build_filename (dtd_dir, filename, NULL);
}
@@ -93,7 +93,7 @@ mrp_paths_get_stylesheet_dir (const gchar *filename)
if (!stylesheet_dir) {
stylesheet_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, STYLESHEETDIR);
}
-
+
return g_build_filename (stylesheet_dir, filename, NULL);
}
@@ -103,7 +103,7 @@ mrp_paths_get_ui_dir (const gchar *filename)
if (!ui_dir) {
ui_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, UIDIR);
}
-
+
return g_build_filename (ui_dir, filename, NULL);
}
@@ -113,7 +113,7 @@ mrp_paths_get_storagemodule_dir (const gchar *filename)
if (!storagemodule_dir) {
storagemodule_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, STORAGEMODULEDIR);
}
-
+
return g_build_filename (storagemodule_dir, filename, NULL);
}
@@ -123,7 +123,7 @@ mrp_paths_get_file_modules_dir (const gchar *filename)
if (!file_modules_dir) {
file_modules_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, FILEMODULEDIR);
}
-
+
return g_build_filename (file_modules_dir, filename, NULL);
}
@@ -133,7 +133,7 @@ mrp_paths_get_sql_dir (void)
if (!sql_dir) {
sql_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, SQLDIR);
}
-
+
return sql_dir;
}
@@ -143,6 +143,6 @@ mrp_paths_get_locale_dir (void)
if (!locale_dir) {
locale_dir = g_win32_get_package_installation_subdirectory (NULL, NULL, GNOMELOCALEDIR);
}
-
+
return locale_dir;
}
diff --git a/libplanner/mrp-project.c b/libplanner/mrp-project.c
index ef56bd3..775f2e0 100644
--- a/libplanner/mrp-project.c
+++ b/libplanner/mrp-project.c
@@ -44,7 +44,7 @@ struct _MrpProjectPriv {
GList *resources;
GList *groups;
-
+
MrpStorageModule *primary_storage;
mrptime project_start;
@@ -52,13 +52,13 @@ struct _MrpProjectPriv {
gchar *organization;
gchar *manager;
gchar *name;
-
+
/*GList *storage_modules;*/ /* <MrpStorageModule> */
gboolean needs_saving;
gboolean empty;
-
+
MrpGroup *default_group;
-
+
/* Property stuff */
GParamSpecPool *property_pool;
@@ -156,8 +156,8 @@ mrp_project_get_type (void)
(GInstanceInitFunc) project_init,
};
- object_type = g_type_register_static (MRP_TYPE_OBJECT,
- "MrpProject",
+ object_type = g_type_register_static (MRP_TYPE_OBJECT,
+ "MrpProject",
&object_info, 0);
}
@@ -179,7 +179,7 @@ project_class_init (MrpProjectClass *klass)
("loaded",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- 0, /*G_STRUCT_OFFSET (MrpProjectClass, method), */
+ 0, /*G_STRUCT_OFFSET (MrpProjectClass, method), */
NULL, NULL,
mrp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -203,7 +203,7 @@ project_class_init (MrpProjectClass *klass)
mrp_marshal_VOID__OBJECT,
G_TYPE_NONE,
1, MRP_TYPE_RESOURCE);
-
+
signals[GROUP_ADDED] = g_signal_new
("group_added",
G_TYPE_FROM_CLASS (klass),
@@ -233,7 +233,7 @@ project_class_init (MrpProjectClass *klass)
mrp_marshal_VOID__OBJECT,
G_TYPE_NONE,
1, MRP_TYPE_GROUP);
-
+
signals[TASK_INSERTED] = g_signal_new
("task_inserted",
G_TYPE_FROM_CLASS (klass),
@@ -283,7 +283,7 @@ project_class_init (MrpProjectClass *klass)
mrp_marshal_VOID__LONG_POINTER,
G_TYPE_NONE,
2, G_TYPE_LONG, G_TYPE_POINTER);
-
+
signals[PROPERTY_CHANGED] = g_signal_new
("property_changed",
G_TYPE_FROM_CLASS (klass),
@@ -293,7 +293,7 @@ project_class_init (MrpProjectClass *klass)
mrp_marshal_VOID__POINTER,
G_TYPE_NONE,
1, G_TYPE_POINTER);
-
+
signals[PROPERTY_REMOVED] = g_signal_new
("property_removed",
G_TYPE_FROM_CLASS (klass),
@@ -304,7 +304,7 @@ project_class_init (MrpProjectClass *klass)
G_TYPE_NONE,
1, G_TYPE_POINTER);
- signals[CALENDAR_TREE_CHANGED] = g_signal_new
+ signals[CALENDAR_TREE_CHANGED] = g_signal_new
("calendar_tree_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -313,7 +313,7 @@ project_class_init (MrpProjectClass *klass)
mrp_marshal_VOID__OBJECT,
G_TYPE_NONE,
1, MRP_TYPE_CALENDAR);
-
+
signals[DAY_ADDED] = g_signal_new
("day_added",
G_TYPE_FROM_CLASS (klass),
@@ -323,7 +323,7 @@ project_class_init (MrpProjectClass *klass)
mrp_marshal_VOID__POINTER,
G_TYPE_NONE,
1, G_TYPE_POINTER);
-
+
signals[DAY_REMOVED] = g_signal_new
("day_removed",
G_TYPE_FROM_CLASS (klass),
@@ -333,7 +333,7 @@ project_class_init (MrpProjectClass *klass)
mrp_marshal_VOID__POINTER,
G_TYPE_NONE,
1, G_TYPE_POINTER);
-
+
signals[DAY_CHANGED] = g_signal_new
("day_changed",
G_TYPE_FROM_CLASS (klass),
@@ -397,7 +397,7 @@ project_class_init (MrpProjectClass *klass)
"Project Phases",
"The various phases the project can be in",
G_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_PHASE,
g_param_spec_string ("phase",
@@ -412,7 +412,7 @@ project_init (MrpProject *project)
{
MrpProjectPriv *priv;
MrpCalendar *calendar;
-
+
project->priv = g_new0 (MrpProjectPriv, 1);
priv = project->priv;
@@ -436,14 +436,14 @@ project_init (MrpProject *project)
calendar = mrp_calendar_derive (_("Default"), priv->root_calendar);
project_set_calendar (project, calendar);
-
+
project_setup_default_calendar (project);
priv->day_types = g_hash_table_new_full (
NULL, NULL, NULL,
(GDestroyNotify) mrp_day_unref);
-
+
/* Move these into the cost plugin */
-/* property = mrp_property_new ("cost",
+/* property = mrp_property_new ("cost",
MRP_PROPERTY_TYPE_COST,
"Cost",
"standard cost for a resource",
@@ -454,14 +454,14 @@ project_init (MrpProject *project)
TRUE);
*/
/* FIXME: Add back this when it's used. */
-/* property = mrp_property_new ("cost_overtime",
+/* property = mrp_property_new ("cost_overtime",
MRP_PROPERTY_TYPE_COST,
"Overtime Cost",
"overtime cost for a resource");
mrp_project_add_property (project,
MRP_TYPE_RESOURCE,
property,
- FALSE);
+ FALSE);
*/
/* FIXME: Small temporary hack to get custom properties working on
@@ -479,7 +479,7 @@ project_finalize (GObject *object)
g_object_unref (project->priv->primary_storage);
g_object_unref (project->priv->task_manager);
-
+
g_free (project->priv->uri);
g_free (project->priv);
@@ -498,10 +498,10 @@ project_set_property (GObject *object,
MrpProjectPriv *priv;
MrpGroup *group;
MrpCalendar *calendar;
-
+
project = MRP_PROJECT (object);
priv = project->priv;
-
+
switch (prop_id) {
case PROP_PROJECT_START:
priv->project_start = g_value_get_long (value);
@@ -531,11 +531,11 @@ project_set_property (GObject *object,
if (priv->default_group == group) {
break;
}
-
+
if (priv->default_group) {
g_object_unref (priv->default_group);
}
-
+
priv->default_group = group;
if (priv->default_group) {
@@ -546,7 +546,7 @@ project_set_property (GObject *object,
* this one, but not the others?
*/
g_signal_emit (project,
- signals[DEFAULT_GROUP_CHANGED],
+ signals[DEFAULT_GROUP_CHANGED],
0,
priv->default_group);
imrp_project_set_needs_saving (project, TRUE);
@@ -558,7 +558,7 @@ project_set_property (GObject *object,
imrp_project_set_needs_saving (project, TRUE);
break;
- case PROP_PHASES:
+ case PROP_PHASES:
mrp_string_list_free (priv->phases);
priv->phases = mrp_string_list_copy (g_value_get_pointer (value));
imrp_project_set_needs_saving (project, TRUE);
@@ -583,10 +583,10 @@ project_get_property (GObject *object,
{
MrpProject *project;
MrpProjectPriv *priv;
-
+
project = MRP_PROJECT (object);
priv = project->priv;
-
+
switch (prop_id) {
case PROP_PROJECT_START:
g_value_set_long (value, priv->project_start);
@@ -622,7 +622,7 @@ project_get_property (GObject *object,
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
+ break;
}
}
@@ -635,9 +635,9 @@ project_connect_object (MrpObject *object, MrpProject *project)
/**
* mrp_project_new:
* @app: #MrpApplication that creates the new project.
- *
+ *
* Creates a new #MrpProject.
- *
+ *
* Return value: the #MrpProject
**/
MrpProject *
@@ -648,9 +648,9 @@ mrp_project_new (MrpApplication *app)
project = g_object_new (MRP_TYPE_PROJECT, NULL);
priv = project->priv;
-
+
priv->app = app;
-
+
project_set_storage (project, "mrproject-1");
project->priv->app = app;
@@ -661,7 +661,7 @@ mrp_project_new (MrpApplication *app)
*/
imrp_project_set_needs_saving (project, FALSE);
priv->empty = TRUE;
-
+
return project;
}
@@ -670,9 +670,9 @@ mrp_project_new (MrpApplication *app)
* @project: an #MrpProject
* @uri: the URI where project should be read from
* @error: location to store error, or %NULL
- *
+ *
* Loads a project stored at @uri into @project.
- *
+ *
* Return value: Returns %TRUE on success, otherwise %FALSE.
**/
gboolean
@@ -683,7 +683,7 @@ mrp_project_load (MrpProject *project, const gchar *uri, GError **error)
MrpCalendar *old_default_calendar;
gchar *file_str;
size_t len;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
@@ -693,8 +693,8 @@ mrp_project_load (MrpProject *project, const gchar *uri, GError **error)
if (strncmp (uri, "sql://", 6) == 0) {
return project_load_from_sql (project, uri, error);
}
-
- /* Small hack for now. We will load the project, then remove the
+
+ /* Small hack for now. We will load the project, then remove the
* default calendar.
*/
old_default_calendar = priv->calendar;
@@ -710,22 +710,22 @@ mrp_project_load (MrpProject *project, const gchar *uri, GError **error)
/* Naively strip method. */
uri = uri + 7;
} else {
- g_set_error (error,
+ g_set_error (error,
MRP_ERROR,
MRP_ERROR_INVALID_URI,
_("Invalid URI: '%s'"),
uri);
-
+
return FALSE;
}
}
-
+
if (!g_file_get_contents (uri, &file_str, NULL, error)) {
return FALSE;
}
-
+
mrp_task_manager_set_block_scheduling (priv->task_manager, TRUE);
-
+
l = imrp_application_get_all_file_readers (priv->app);
for (; l; l = l->next) {
MrpFileReader *reader = l->data;
@@ -742,9 +742,9 @@ mrp_project_load (MrpProject *project, const gchar *uri, GError **error)
mrp_task_manager_set_block_scheduling (priv->task_manager, FALSE);
imrp_project_set_needs_saving (project, FALSE);
-
+
g_free (file_str);
-
+
return TRUE;
}
}
@@ -753,7 +753,7 @@ mrp_project_load (MrpProject *project, const gchar *uri, GError **error)
mrp_task_manager_set_block_scheduling (priv->task_manager, FALSE);
- g_set_error (error,
+ g_set_error (error,
MRP_ERROR,
MRP_ERROR_NO_FILE_MODULE,
_("Couldn't find a suitable file module for loading '%s'"),
@@ -769,7 +769,7 @@ project_do_save (MrpProject *project,
GError **error)
{
MrpProjectPriv *priv;
-
+
priv = project->priv;
/* A small hack for now: special case SQL URIs. */
@@ -783,7 +783,7 @@ project_do_save (MrpProject *project,
} else {
project_set_storage (project, "mrproject-1");
}
-
+
return mrp_storage_module_save (priv->primary_storage, uri, force, error);
}
@@ -794,28 +794,28 @@ project_do_save (MrpProject *project,
* @error: location to store error, or %NULL
*
* Saves a project.
- *
+ *
* Return value: %TRUE on success, otherwise %FALSE
**/
gboolean
mrp_project_save (MrpProject *project, gboolean force, GError **error)
{
MrpProjectPriv *priv;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), FALSE);
-
+
priv = project->priv;
if (!priv->needs_saving) {
return TRUE;
}
-
+
/* Sanity check the URI. */
if (priv->uri == NULL) {
g_set_error (error,
MRP_ERROR, MRP_ERROR_INVALID_URI,
_("Invalid URI."));
-
+
return FALSE;
}
@@ -825,7 +825,7 @@ mrp_project_save (MrpProject *project, gboolean force, GError **error)
if (strncmp (priv->uri, "sql://", 6) != 0) {
force = TRUE;
}
-
+
if (!project_do_save (project, priv->uri, force, error)) {
return FALSE;
}
@@ -841,9 +841,9 @@ mrp_project_save (MrpProject *project, gboolean force, GError **error)
* @uri: URI to save to
* @force: overwrite an existing file if necessary
* @error: location to store error, or %NULL
- *
+ *
* Saves a project to a specific URI.
- *
+ *
* Return value: %TRUE on success, otherwise %FALSE
**/
gboolean
@@ -855,10 +855,10 @@ mrp_project_save_as (MrpProject *project,
MrpProjectPriv *priv;
gboolean is_sql;
gchar *real_uri;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), FALSE);
g_return_val_if_fail (uri != NULL && uri[0] != '\0', FALSE);
-
+
priv = project->priv;
if (strncmp (uri, "sql://", 6) == 0) {
@@ -875,30 +875,30 @@ mrp_project_save_as (MrpProject *project,
real_uri = g_strdup (uri);
}
}
-
+
if (!project_do_save (project, real_uri, force, error)) {
g_free (real_uri);
return FALSE;
}
g_free (priv->uri);
-
+
/* A small hack for now: check if it's SQL and update the URI to include
* the newly assigned id.
*/
if (is_sql) {
gchar *new_uri;
-
+
new_uri = g_object_get_data (G_OBJECT (priv->primary_storage), "uri");
priv->uri = g_strdup (new_uri);
} else {
priv->uri = g_strdup (real_uri);
}
-
+
g_free (real_uri);
-
+
imrp_project_set_needs_saving (project, FALSE);
-
+
return TRUE;
}
@@ -910,28 +910,28 @@ mrp_project_save_as (MrpProject *project,
* @identifier: string identifying which export module to use
* @force: overwrite an existing file if necessary
* @error: location to store error, or %NULL
- *
+ *
* Exports a project to a specific URI. @identifier is used to identify which
- * module to use. It can be either the identifier string of a module or the
+ * module to use. It can be either the identifier string of a module or the
* mime type you whish to export to.
- *
+ *
* Return value: %TRUE on success, otherwise %FALSE.
**/
gboolean
mrp_project_export (MrpProject *project,
const gchar *uri,
const gchar *identifier,
- gboolean force,
+ gboolean force,
GError **error)
{
MrpProjectPriv *priv;
GList *l;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), FALSE);
g_return_val_if_fail (uri != NULL && uri[0] != '\0', FALSE);
priv = project->priv;
-
+
l = imrp_application_get_all_file_writers (priv->app);
for (; l; l = l->next) {
MrpFileWriter *writer = l->data;
@@ -966,9 +966,9 @@ mrp_project_export (MrpProject *project,
* @project: an #MrpProject
* @str: XML string with project data to read from
* @error: location to store error, or %NULL
- *
+ *
* Loads a project from XML data into @project.
- *
+ *
* Return value: Returns %TRUE on success, otherwise %FALSE.
**/
gboolean
@@ -977,19 +977,19 @@ mrp_project_load_from_xml (MrpProject *project, const gchar *str, GError **error
MrpProjectPriv *priv;
GList *l;
MrpCalendar *old_default_calendar;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), FALSE);
g_return_val_if_fail (str != NULL, FALSE);
priv = project->priv;
- /* Small hack for now. We will load the project, then remove the
+ /* Small hack for now. We will load the project, then remove the
* default calendar.
*/
old_default_calendar = priv->calendar;
-
+
mrp_task_manager_set_block_scheduling (priv->task_manager, TRUE);
-
+
l = imrp_application_get_all_file_readers (priv->app);
for (; l; l = l->next) {
MrpFileReader *reader = l->data;
@@ -1008,14 +1008,14 @@ mrp_project_load_from_xml (MrpProject *project, const gchar *str, GError **error
/* FIXME: See bug #416. */
imrp_project_set_needs_saving (project, FALSE);
-
+
return TRUE;
}
}
mrp_task_manager_set_block_scheduling (priv->task_manager, FALSE);
- g_set_error (error,
+ g_set_error (error,
MRP_ERROR,
MRP_ERROR_NO_FILE_MODULE,
_("Couldn't find a suitable file module for loading project"));
@@ -1028,9 +1028,9 @@ mrp_project_load_from_xml (MrpProject *project, const gchar *str, GError **error
* @project: an #MrpProject
* @str: location to store XML string
* @error: location to store error, or %NULL
- *
+ *
* Saves a project as XML to a string buffer.
- *
+ *
* Return value: %TRUE on success, otherwise %FALSE
**/
gboolean
@@ -1039,10 +1039,10 @@ mrp_project_save_to_xml (MrpProject *project,
GError **error)
{
MrpProjectPriv *priv;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), FALSE);
g_return_val_if_fail (str != NULL, FALSE);
-
+
priv = project->priv;
return mrp_storage_module_to_xml (priv->primary_storage, str, error);
@@ -1069,26 +1069,26 @@ project_load_from_sql (MrpProject *project,
if (mrp_storage_module_load (priv->primary_storage, uri, error)) {
old_default_calendar = priv->calendar;
-
+
g_signal_emit (project, signals[LOADED], 0, NULL);
imrp_project_set_needs_saving (project, FALSE);
-
+
g_free (priv->uri);
priv->uri = g_strdup (uri);
-
+
/* Remove old calendar. */
mrp_calendar_remove (old_default_calendar);
-
+
mrp_task_manager_set_block_scheduling (priv->task_manager, FALSE);
/* FIXME: See bug #416. */
imrp_project_set_needs_saving (project, FALSE);
-
+
return TRUE;
}
-
+
mrp_task_manager_set_block_scheduling (priv->task_manager, FALSE);
-
+
return FALSE;
}
@@ -1106,20 +1106,20 @@ project_set_storage (MrpProject *project,
if (!factory) {
return FALSE;
}
-
+
module = mrp_storage_module_factory_create_module (factory);
if (!module) {
return FALSE;
}
g_type_module_unuse (G_TYPE_MODULE (factory));
-
+
imrp_storage_module_set_project (module, project);
if (priv->primary_storage) {
g_object_unref (priv->primary_storage);
}
-
+
priv->primary_storage = module;
return TRUE;
@@ -1128,7 +1128,7 @@ project_set_storage (MrpProject *project,
/**
* mrp_project_close:
* @project: an #MrpProject
- *
+ *
* Closes a project.
**/
void
@@ -1149,25 +1149,25 @@ imrp_project_get_task_manager (MrpProject *project)
* mrp_project_get_resource_by_name:
* @project: an #MrpProject
* @name: name to search for
- *
+ *
* Retrieves the first resource in the list that match the name.
- *
+ *
* Return value: an #MrpResource or %NULL if not found
**/
MrpResource *
mrp_project_get_resource_by_name (MrpProject *project, const gchar *name)
{
GList *resources, *l;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
g_return_val_if_fail (name != NULL, NULL);
-
+
/* Should we use a hash table to store these in as well? */
resources = mrp_project_get_resources (project);
for (l = resources; l; l = l->next) {
const gchar *rname;
-
+
rname = mrp_resource_get_name (MRP_RESOURCE (l->data));
if (strcmp (name, rname) == 0) {
return MRP_RESOURCE (l->data);
@@ -1180,10 +1180,10 @@ mrp_project_get_resource_by_name (MrpProject *project, const gchar *name)
/**
* mrp_project_get_resources:
* @project: an #MrpProject
- *
+ *
* Fetches the list of resources in @project. This list should not be freed and
* if caller needs to manipulate it, a copy needs to be made first.
- *
+ *
* Return value: the resource list of @project
**/
GList *
@@ -1199,10 +1199,10 @@ imrp_project_set_resources (MrpProject *project,
GList *resources)
{
g_return_if_fail (MRP_IS_PROJECT (project));
-
+
project->priv->resources = resources;
- g_list_foreach (project->priv->resources,
+ g_list_foreach (project->priv->resources,
(GFunc) project_connect_object,
project);
}
@@ -1211,38 +1211,38 @@ imrp_project_set_resources (MrpProject *project,
* mrp_project_add_resource:
* @project: an #MrpProject
* @resource: #MrpResource to add
- *
+ *
* Adds @resource to the list of resources in @project.
**/
-void
+void
mrp_project_add_resource (MrpProject *project, MrpResource *resource)
{
MrpProjectPriv *priv;
MrpGroup *group;
MrpResourceType type;
-
+
g_return_if_fail (MRP_IS_PROJECT (project));
g_return_if_fail (MRP_IS_RESOURCE (resource));
-
+
priv = project->priv;
priv->resources = g_list_prepend (priv->resources, resource);
g_object_get (resource, "group", &group, NULL);
-
+
if (!group) {
g_object_set (resource, "group", priv->default_group, NULL);
}
g_object_get (resource, "type", &type, NULL);
-
+
if (type == MRP_RESOURCE_TYPE_NONE) {
g_object_set (resource, "type", MRP_RESOURCE_TYPE_WORK, NULL);
}
-
+
project_connect_object (MRP_OBJECT (resource), project);
-
+
g_signal_emit (project, signals[RESOURCE_ADDED], 0, resource);
@@ -1253,19 +1253,19 @@ mrp_project_add_resource (MrpProject *project, MrpResource *resource)
* mrp_project_remove_resource:
* @project: an #MrpProject
* @resource: #MrpResource to remove
- *
+ *
* Removes @resource from @project.
**/
void
mrp_project_remove_resource (MrpProject *project, MrpResource *resource)
{
MrpProjectPriv *priv;
-
+
g_return_if_fail (MRP_IS_PROJECT (project));
g_return_if_fail (MRP_IS_RESOURCE (resource));
-
+
priv = project->priv;
-
+
mrp_object_removed (MRP_OBJECT (resource));
priv->resources = g_list_remove (priv->resources, resource);
@@ -1279,16 +1279,16 @@ mrp_project_remove_resource (MrpProject *project, MrpResource *resource)
* mrp_project_get_group_by_name:
* @project: an #MrpProject
* @name: a name to look for
- *
+ *
* Retrieves the first group with name that matches @name
- *
+ *
* Return value: an #MrpGroup or %NULL if not found
**/
MrpGroup *
mrp_project_get_group_by_name (MrpProject *project, const gchar *name)
{
GList *groups, *l;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
g_return_val_if_fail (name != NULL, NULL);
@@ -1308,7 +1308,7 @@ mrp_project_get_group_by_name (MrpProject *project, const gchar *name)
/**
* mrp_project_get_groups:
* @project: an #MrpProject
- *
+ *
* Fetches the list of groups in @project. The list should not be freed and if
* caller needs to manipulate it, a copy needs to be made first.
*
@@ -1318,7 +1318,7 @@ GList *
mrp_project_get_groups (MrpProject *project)
{
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
-
+
return project->priv->groups;
}
@@ -1327,30 +1327,30 @@ imrp_project_set_groups (MrpProject *project,
GList *groups)
{
g_return_if_fail (MRP_IS_PROJECT (project));
-
+
project->priv->groups = groups;
- g_list_foreach (project->priv->groups,
+ g_list_foreach (project->priv->groups,
(GFunc) project_connect_object,
project);
-
+
}
/**
* mrp_project_add_group:
* @project: an #MrpProject
* @group: #MrpGroup to remove
- *
+ *
* Adds @group to the list of groups in @project.
**/
void
mrp_project_add_group (MrpProject *project, MrpGroup *group)
{
MrpProjectPriv *priv;
-
+
g_return_if_fail (MRP_IS_PROJECT (project));
g_return_if_fail (MRP_IS_GROUP (group));
-
+
priv = project->priv;
priv->groups = g_list_prepend (priv->groups, group);
@@ -1368,23 +1368,23 @@ mrp_project_add_group (MrpProject *project, MrpGroup *group)
* mrp_project_remove_group:
* @project: an #MrpProject
* @group: #MrpGroup to remove
- *
+ *
* Removes @group from @project.
**/
void
mrp_project_remove_group (MrpProject *project, MrpGroup *group)
{
MrpProjectPriv *priv;
-
+
g_return_if_fail (MRP_IS_PROJECT (project));
g_return_if_fail (MRP_IS_GROUP (group));
-
+
priv = project->priv;
-
+
if (priv->default_group && priv->default_group == group) {
priv->default_group = NULL;
}
-
+
priv->groups = g_list_remove (priv->groups, group);
g_signal_emit (project, signals[GROUP_REMOVED], 0, group);
@@ -1397,9 +1397,9 @@ mrp_project_remove_group (MrpProject *project, MrpGroup *group)
/**
* mrp_project_is_empty:
* @project: an #MrpProject
- *
+ *
* Checks whether a project is empty.
- *
+ *
* Return value: %TRUE if @project is empty, otherwise %FALSE
**/
gboolean
@@ -1411,10 +1411,10 @@ mrp_project_is_empty (MrpProject *project)
/**
* mrp_project_needs_saving:
* @project: an #MrpProject
- *
+ *
* Checks if @project needs saving
- *
- * Return value: %TRUE if project has been altered since last save,
+ *
+ * Return value: %TRUE if project has been altered since last save,
* otherwise %FALSE
**/
gboolean
@@ -1426,12 +1426,12 @@ mrp_project_needs_saving (MrpProject *project)
/**
* mrp_project_get_uri:
* @project: an #MrpProject
- *
+ *
* Fetches the URI from @project.
- *
+ *
* Return value: the URI of @project
**/
-const gchar *
+const gchar *
mrp_project_get_uri (MrpProject *project)
{
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
@@ -1442,10 +1442,10 @@ mrp_project_get_uri (MrpProject *project)
/**
* mrp_project_set_uri:
* @project: an #MrpProject
- *
+ *
* Sets the URI on @project.
**/
-void
+void
mrp_project_set_uri (MrpProject *project, const gchar *uri)
{
g_return_if_fail (MRP_IS_PROJECT (project));
@@ -1457,9 +1457,9 @@ mrp_project_set_uri (MrpProject *project, const gchar *uri)
/**
* mrp_project_get_project_start:
* @project: an #MrpProject
- *
+ *
* Fetches the project start from @project.
- *
+ *
* Return value: the project start
**/
mrptime
@@ -1474,7 +1474,7 @@ mrp_project_get_project_start (MrpProject *project)
* mrp_project_set_project_start:
* @project: an #MrpProject
* @start: project start time
- *
+ *
* Set the project start.
**/
void
@@ -1489,10 +1489,10 @@ mrp_project_set_project_start (MrpProject *project,
* imrp_project_add_calendar_day:
* @project: an #MrpProject
* @day: #MrpDay to add
- *
+ *
* This adds a calendar day type to the list of available day types.
- *
- * Return value: %TRUE on success, %FALSE if a day type of the same id
+ *
+ * Return value: %TRUE on success, %FALSE if a day type of the same id
* was already in the list.
**/
gboolean
@@ -1500,15 +1500,15 @@ imrp_project_add_calendar_day (MrpProject *project, MrpDay *day)
{
MrpProjectPriv *priv;
MrpDay *tmp_day;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), -1);
g_return_val_if_fail (day != NULL, -1);
priv = project->priv;
-
+
tmp_day = (MrpDay *) g_hash_table_lookup (priv->day_types,
GINT_TO_POINTER (mrp_day_get_id (day)));
-
+
if (tmp_day) {
g_warning ("Trying to add already present day type: '%s'",
mrp_day_get_name (tmp_day));
@@ -1516,7 +1516,7 @@ imrp_project_add_calendar_day (MrpProject *project, MrpDay *day)
}
g_hash_table_insert (priv->day_types,
- GINT_TO_POINTER (mrp_day_get_id (day)),
+ GINT_TO_POINTER (mrp_day_get_id (day)),
mrp_day_ref (day));
g_signal_emit (project,
@@ -1532,10 +1532,10 @@ imrp_project_add_calendar_day (MrpProject *project, MrpDay *day)
/**
* mrp_project_get_calendar_day_by_id:
* @project: an #MrpProject
- *
+ *
* Semi-private function. You most likely won't need this outside of
* Planner. Returns the day type associated with @id.
- *
+ *
* Return value: A day type.
**/
MrpDay *
@@ -1543,11 +1543,11 @@ mrp_project_get_calendar_day_by_id (MrpProject *project, gint id)
{
MrpProjectPriv *priv;
MrpDay *day;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
priv = project->priv;
-
+
day = g_hash_table_lookup (priv->day_types, GINT_TO_POINTER (id));
return day;
@@ -1562,10 +1562,10 @@ foreach_day_add_to_list (gpointer key, MrpDay *day, GList **list)
/**
* imrp_project_get_calendar_days:
* @project: an #MrpProject
- *
- * Returns a new list of the day types in @project. This list needs to be
+ *
+ * Returns a new list of the day types in @project. This list needs to be
* saved by the caller.
- *
+ *
* Return value: A newly allocated list containing the day types in @project.
**/
GList *
@@ -1581,7 +1581,7 @@ imrp_project_get_calendar_days (MrpProject *project)
g_hash_table_foreach (priv->day_types,
(GHFunc) foreach_day_add_to_list,
&ret_val);
-
+
return ret_val;
}
@@ -1591,7 +1591,7 @@ project_day_fallback_when_removed (MrpCalendar *calendar,
{
GList *children, *l;
MrpCalendar *child;
-
+
children = mrp_calendar_get_children (calendar);
for (l = children; l; l = l->next) {
child = l->data;
@@ -1605,7 +1605,7 @@ project_day_fallback_when_removed (MrpCalendar *calendar,
* imrp_project_remove_calendar_day:
* @project: an #MrpProject
* @day: #MrpDay to remove
- *
+ *
* Removes @day from list of available day types in @project.
**/
void
@@ -1615,20 +1615,20 @@ imrp_project_remove_calendar_day (MrpProject *project, MrpDay *day)
g_return_if_fail (MRP_IS_PROJECT (project));
g_return_if_fail (day != NULL);
-
+
priv = project->priv;
/* Check if the day type is used in a calendar, if so fallback to
* working day.
*/
project_day_fallback_when_removed (priv->root_calendar, day);
-
+
g_signal_emit (project,
signals[DAY_REMOVED],
0,
day);
-
- g_hash_table_remove (priv->day_types,
+
+ g_hash_table_remove (priv->day_types,
GINT_TO_POINTER (mrp_day_get_id (day)));
imrp_project_set_needs_saving (project, TRUE);
@@ -1637,23 +1637,23 @@ imrp_project_remove_calendar_day (MrpProject *project, MrpDay *day)
/**
* imrp_project_signal_calendar_tree_changed:
* @project: an #MrpProject
- *
+ *
* Emits the "calendar_tree_changed" signal. Used from calendar to notify user
- * that it has changed, so that the user doesn't have to connect to every
- * calendar.
+ * that it has changed, so that the user doesn't have to connect to every
+ * calendar.
**/
void
imrp_project_signal_calendar_tree_changed (MrpProject *project)
{
MrpProjectPriv *priv;
-
+
if (!project) {
return;
}
-
+
priv = project->priv;
- g_signal_emit (project,
+ g_signal_emit (project,
signals[CALENDAR_TREE_CHANGED],
0,
priv->root_calendar);
@@ -1663,15 +1663,15 @@ imrp_project_signal_calendar_tree_changed (MrpProject *project)
* imrp_project_set_needs_saving:
* @project: an #MrpProject
* @needs_saving: a #gboolean
- *
- * Sets the needs_saving flag on @project and if it changed emit the
+ *
+ * Sets the needs_saving flag on @project and if it changed emit the
* "needs_saving_changed" signal.
**/
void
-imrp_project_set_needs_saving (MrpProject *project, gboolean needs_saving)
+imrp_project_set_needs_saving (MrpProject *project, gboolean needs_saving)
{
MrpProjectPriv *priv;
-
+
g_return_if_fail (MRP_IS_PROJECT (project));
priv = project->priv;
@@ -1686,9 +1686,9 @@ imrp_project_set_needs_saving (MrpProject *project, gboolean needs_saving)
project->priv->needs_saving = needs_saving;
- g_signal_emit (project,
- signals[NEEDS_SAVING_CHANGED],
- 0,
+ g_signal_emit (project,
+ signals[NEEDS_SAVING_CHANGED],
+ 0,
needs_saving);
}
@@ -1699,8 +1699,8 @@ typedef struct {
const gchar *name;
MrpTask *task;
} FindTaskByNameData;
-
-static gboolean
+
+static gboolean
find_task_by_name_traverse_func (MrpTask *task, FindTaskByNameData *data)
{
const gchar *name;
@@ -1710,7 +1710,7 @@ find_task_by_name_traverse_func (MrpTask *task, FindTaskByNameData *data)
data->task = task;
return TRUE;
}
-
+
return FALSE;
}
@@ -1718,17 +1718,17 @@ find_task_by_name_traverse_func (MrpTask *task, FindTaskByNameData *data)
* mrp_project_get_task_by_name:
* @project: an #MrpProject
* @name: the name to look for
- *
+ *
* Retrieves the first task with name matching @name. Uses task_traverse to traverse all tasks.
- *
+ *
* Return value: an #MrpTask or %NULL if not found.
**/
MrpTask *
-mrp_project_get_task_by_name (MrpProject *project, const gchar *name)
+mrp_project_get_task_by_name (MrpProject *project, const gchar *name)
{
FindTaskByNameData *data;
MrpTask *ret_val;
-
+
data = g_new0 (FindTaskByNameData, 1);
data->name = name;
data->task = NULL;
@@ -1740,17 +1740,17 @@ mrp_project_get_task_by_name (MrpProject *project, const gchar *name)
ret_val = data->task;
g_free (data);
-
+
return ret_val;
}
/**
* mrp_project_get_all_tasks:
* @project: an #MrpProject
- *
- * Returns a new list of the tasks in @project. The caller needs to free the
+ *
+ * Returns a new list of the tasks in @project. The caller needs to free the
* list with g_list_free(), but not the values in it.
- *
+ *
* Return value: a newly allocated list of the tasks
**/
GList *
@@ -1767,8 +1767,8 @@ mrp_project_get_all_tasks (MrpProject *project)
* @parent: #MrpTask that will be parent to inserted task
* @position: position among children to insert task
* @task: #MrpTask to insert
- *
- * Insert @task in the task tree with @parent at @position among other
+ *
+ * Insert @task in the task tree with @parent at @position among other
* children.
**/
void
@@ -1791,7 +1791,7 @@ mrp_project_insert_task (MrpProject *project,
* mrp_project_remove_task:
* @project: an #MrpProject
* @task: #MrpTask to remove
- *
+ *
* Removes @task from the task tree in @project.
**/
void
@@ -1804,7 +1804,7 @@ mrp_project_remove_task (MrpProject *project,
mrp_task_manager_remove_task (project->priv->task_manager,
task);
-
+
g_signal_emit (project, signals[TASK_REMOVED], 0, task);
imrp_project_set_needs_saving (project, TRUE);
@@ -1818,12 +1818,12 @@ mrp_project_remove_task (MrpProject *project,
* @parent: #MrpTask the new parent
* @before: whether to put @task before or after @sibling.
* @error: location to store error, or NULL
- *
- * Move the task in the task tree. If @sibling is %NULL task will be placed
- * first among the children of @parent if @before is %TRUE, otherwise it will
- * be placed last. If @sibling is set, @task will be placed before or after
+ *
+ * Move the task in the task tree. If @sibling is %NULL task will be placed
+ * first among the children of @parent if @before is %TRUE, otherwise it will
+ * be placed last. If @sibling is set, @task will be placed before or after
* @sibling depending on the value of @before.
- *
+ *
* Return value: %TRUE on success, otherwise %FALSE
**/
gboolean
@@ -1851,7 +1851,7 @@ mrp_project_move_task (MrpProject *project,
* imrp_project_task_moved:
* @project: an #MrpProject
* @task: #MrpTask that was moved
- *
+ *
* Signals "task-moved" and sets the "needs_saving" flag on project.
**/
void
@@ -1866,9 +1866,9 @@ imrp_project_task_moved (MrpProject *project,
/**
* mrp_project_get_root_task:
* @project: an #MrpProject
- *
+ *
* Fetches the root task from @project.
- *
+ *
* Return value: the root task
**/
MrpTask *
@@ -1885,7 +1885,7 @@ mrp_project_get_root_task (MrpProject *project)
* @root: #MrpTask indicates where traversing will begin.
* @func: the function to call for each task
* @user_data: user data passed to the function
- *
+ *
* Calls @func on each task under @root in the task tree. @user_data is passed
* to @func. If @func returns %TRUE, the traversal is stopped.
**/
@@ -1906,7 +1906,7 @@ mrp_project_task_traverse (MrpProject *project,
/**
* mrp_project_reschedule:
* @project: an #MrpProject
- *
+ *
* Reschedules the project, calculating task start/end/duration etc.
**/
void
@@ -1921,18 +1921,18 @@ mrp_project_reschedule (MrpProject *project)
* mrp_project_calculate_summary_duration:
* @project: an #MrpProject
* @task: an #MrpTask
- * @start: a start time, or if %-1, the task start time is to be used
+ * @start: a start time, or if %-1, the task start time is to be used
* @finish: a finish time
- *
- * Calculates the time needed to achieve the given start and finish time,
+ *
+ * Calculates the time needed to achieve the given start and finish time,
* ignoring allocated resources' calendars (summary tasks should ignore
* their own resource assignments)
- *
+ *
* Return value: The calculated duration.
**/
gint
-mrp_project_calculate_summary_duration (MrpProject *project,
- MrpTask *task,
+mrp_project_calculate_summary_duration (MrpProject *project,
+ MrpTask *task,
mrptime start,
mrptime finish)
{
@@ -1950,17 +1950,17 @@ mrp_project_calculate_summary_duration (MrpProject *project,
* mrp_project_calculate_task_work:
* @project: an #MrpProject
* @task: an #MrpTask
- * @start: a start time, or if %-1, the task start time is to be used
+ * @start: a start time, or if %-1, the task start time is to be used
* @finish: a finish time
- *
+ *
* Calculates the work needed to achieve the given start and finish time, with
* the allocated resources' calendards in consideration.
- *
+ *
* Return value: The calculated work.
**/
gint
-mrp_project_calculate_task_work (MrpProject *project,
- MrpTask *task,
+mrp_project_calculate_task_work (MrpProject *project,
+ MrpTask *task,
mrptime start,
mrptime finish)
{
@@ -1978,7 +1978,7 @@ mrp_project_calculate_task_work (MrpProject *project,
* imrp_project_task_inserted:
* @project: an #MrpProject
* @task: #MrpTask that was inserted
- *
+ *
* Signals "task-inserted" and sets the "needs_saving" flag on project.
**/
void
@@ -2007,10 +2007,10 @@ project_dump_task_tree (MrpProject *project)
* @project: an #MrpProject
* @name: the name of the property
* @object_type: object type the property belongs to
- *
+ *
* Fetches an #MrpProperty that corresponds to @name and @object_type. This is
* mainly for language bindings and should not be used for other cases.
- *
+ *
* Return value: An #MrpProperty, if found, otherwise %NULL.
**/
MrpProperty *
@@ -2020,7 +2020,7 @@ mrp_project_get_property (MrpProject *project,
{
MrpProjectPriv *priv;
MrpProperty *property;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
priv = project->priv;
@@ -2029,7 +2029,7 @@ mrp_project_get_property (MrpProject *project,
name,
object_type,
TRUE));
-
+
if (!property) {
g_warning ("%s: object of type `%s' has no property named `%s'",
G_STRLOC,
@@ -2045,7 +2045,7 @@ mrp_project_get_property (MrpProject *project,
* imrp_project_property_changed:
* @project: an #MrpProject
* @property: an #MrpProperty
- *
+ *
* Signals "property-changed" and sets the "needs_saving" flag on @project.
**/
void
@@ -2062,11 +2062,11 @@ imrp_project_property_changed (MrpProject *project, MrpProperty *property)
* mrp_project_get_properties_from_type:
* @project: an #MrpProject
* @object_type: a #GType
- *
+ *
* Fetches a list of the properties belonging to @project and applies to
- * @object_type. The list should not be freed and needs to be copied before
+ * @object_type. The list should not be freed and needs to be copied before
* modified.
- *
+ *
* Return value: The list of properties.
**/
GList *
@@ -2074,7 +2074,7 @@ mrp_project_get_properties_from_type (MrpProject *project, GType object_type)
{
MrpProjectPriv *priv;
GList *properties;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
priv = project->priv;
@@ -2091,10 +2091,10 @@ mrp_project_get_properties_from_type (MrpProject *project, GType object_type)
* @object_type: the owner type
* @property: an #MrpProperty
* @user_defined: whether the property is defined through a user interface
- *
- * Add a custom property to @project. The @object_type specifies what kind of
- * objects the property applies to. @user_defined specifies whether the
- * property is created by the user or by some plugin.
+ *
+ * Add a custom property to @project. The @object_type specifies what kind of
+ * objects the property applies to. @user_defined specifies whether the
+ * property is created by the user or by some plugin.
**/
void
mrp_project_add_property (MrpProject *project,
@@ -2105,7 +2105,7 @@ mrp_project_add_property (MrpProject *project,
MrpProjectPriv *priv;
g_return_if_fail (MRP_IS_PROJECT (project));
-
+
priv = project->priv;
/* FIXME: Check for name conflicts. */
@@ -2128,8 +2128,8 @@ mrp_project_add_property (MrpProject *project,
imrp_property_set_project (property, project);
- g_signal_emit (project, signals[PROPERTY_ADDED], 0,
- object_type,
+ g_signal_emit (project, signals[PROPERTY_ADDED], 0,
+ object_type,
property);
if (user_defined) {
@@ -2142,7 +2142,7 @@ mrp_project_add_property (MrpProject *project,
* @project: an #MrpProject
* @object_type: a #GType specifing object type to remove property from
* @name: the name of the property
- *
+ *
* Removes the property corresponding to @object_type and @name from @project.
**/
void
@@ -2152,9 +2152,9 @@ mrp_project_remove_property (MrpProject *project,
{
MrpProjectPriv *priv;
MrpProperty *property;
-
+
g_return_if_fail (MRP_IS_PROJECT (project));
-
+
priv = project->priv;
property = mrp_project_get_property (project, name, object_type);
@@ -2168,7 +2168,7 @@ mrp_project_remove_property (MrpProject *project,
}
g_signal_emit (project, signals[PROPERTY_REMOVED], 0, property);
-
+
g_param_spec_pool_remove (priv->property_pool,
G_PARAM_SPEC (property));
@@ -2180,10 +2180,10 @@ mrp_project_remove_property (MrpProject *project,
* @project: an #MrpProperty
* @owner_type: a #GType specifing object type look for property on
* @name: the name of the property
- *
- * Checks if @project has a property named @name applying to object of type
+ *
+ * Checks if @project has a property named @name applying to object of type
* @object_type.
- *
+ *
* Return value: %TRUE if property @name exists on objects of type @object_type
**/
gboolean
@@ -2195,7 +2195,7 @@ mrp_project_has_property (MrpProject *project,
g_return_val_if_fail (MRP_IS_PROJECT (project), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
-
+
priv = project->priv;
return NULL != g_param_spec_pool_lookup (priv->property_pool,
@@ -2207,40 +2207,40 @@ mrp_project_has_property (MrpProject *project,
/**
* mrp_project_get_root_calendar:
* @project: an #MrpProject
- *
+ *
* Fetches the root calendar of @project.
- *
+ *
* Return value: the root calendar of @project
**/
MrpCalendar *
mrp_project_get_root_calendar (MrpProject *project)
{
MrpProjectPriv *priv;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
-
+
priv = project->priv;
-
+
return priv->root_calendar;
}
/**
* mrp_project_get_calendar:
* @project: an #MrpProject
- *
- * Fetches the calendar used by @project.
- *
+ *
+ * Fetches the calendar used by @project.
+ *
* Return value: the calendar used by @project
**/
MrpCalendar *
mrp_project_get_calendar (MrpProject *project)
{
MrpProjectPriv *priv;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
-
+
priv = project->priv;
-
+
return priv->calendar;
}
@@ -2252,7 +2252,7 @@ project_setup_default_calendar (MrpProject *project)
GList *ivals = NULL;
priv = project->priv;
-
+
mrp_calendar_set_default_days (
priv->calendar,
MRP_CALENDAR_DAY_MON, mrp_day_get_work (),
@@ -2263,13 +2263,13 @@ project_setup_default_calendar (MrpProject *project)
MRP_CALENDAR_DAY_SAT, mrp_day_get_nonwork (),
MRP_CALENDAR_DAY_SUN, mrp_day_get_nonwork (),
-1);
-
+
ival = mrp_interval_new (8 * 60*60, 12 * 60*60);
ivals = g_list_append (ivals, ival);
-
+
ival = mrp_interval_new (13 * 60*60, 17 * 60*60);
ivals = g_list_append (ivals, ival);
-
+
mrp_calendar_day_set_intervals (priv->calendar, mrp_day_get_work (), ivals);
g_list_foreach (ivals, (GFunc) mrp_interval_unref, NULL);
@@ -2335,7 +2335,7 @@ mrp_project_get_block_scheduling (MrpProject *project)
g_return_val_if_fail (MRP_IS_PROJECT (project), FALSE);
priv = project->priv;
-
+
return mrp_task_manager_get_block_scheduling (priv->task_manager);
}
diff --git a/libplanner/mrp-property.c b/libplanner/mrp-property.c
index 19c5ce3..716c8d4 100644
--- a/libplanner/mrp-property.c
+++ b/libplanner/mrp-property.c
@@ -66,11 +66,11 @@ imrp_property_set_project (MrpProperty *property, MrpProject *project)
* @label: the human readable label
* @description: a string describing the property
* @user_defined: a #gboolean
- *
+ *
* Creates a new #MrpProperty. @name must be unique in the application.
- * @user_defined specifies if the property was created by a user or a plugin
+ * @user_defined specifies if the property was created by a user or a plugin
* or Planner itself.
- *
+ *
* Return value: a newly create property
**/
MrpProperty *
@@ -109,7 +109,7 @@ mrp_property_new (const gchar *name,
G_MAXINT,
0,
G_PARAM_READWRITE));
- break;
+ break;
case MRP_PROPERTY_TYPE_STRING:
property = MRP_PROPERTY (g_param_spec_string (name,
"",
@@ -141,7 +141,7 @@ mrp_property_new (const gchar *name,
default:
break;
};
-
+
if (!property) {
return NULL;
}
@@ -149,11 +149,11 @@ mrp_property_new (const gchar *name,
property_set_type (property, type);
g_param_spec_set_qdata_full (G_PARAM_SPEC (property),
g_quark_from_static_string (LABEL),
- g_strdup (label),
+ g_strdup (label),
g_free);
g_param_spec_set_qdata_full (G_PARAM_SPEC (property),
g_quark_from_static_string (DESCRIPTION),
- g_strdup (description),
+ g_strdup (description),
g_free);
g_param_spec_set_qdata_full (G_PARAM_SPEC (property),
g_quark_from_static_string (USER_DEFINED),
@@ -165,32 +165,32 @@ mrp_property_new (const gchar *name,
/**
* mrp_property_get_name:
* @property: an #MrpProperty
- *
+ *
* Fetches the name of @property
- *
+ *
* Return value: the name of @property
**/
const gchar *
mrp_property_get_name (MrpProperty *property)
{
g_return_val_if_fail (property != NULL, NULL);
-
+
return G_PARAM_SPEC (property)->name;
}
/**
* mrp_property_get_property_type:
* @property: an #MrpProperty
- *
+ *
* Fetches the type of @property
- *
+ *
* Return value: the type of @property
**/
-MrpPropertyType
+MrpPropertyType
mrp_property_get_property_type (MrpProperty *property)
{
g_return_val_if_fail (property != NULL, MRP_PROPERTY_TYPE_NONE);
-
+
return GPOINTER_TO_INT (
g_param_spec_get_qdata (G_PARAM_SPEC (property),
g_quark_from_static_string (TYPE)));
@@ -200,7 +200,7 @@ mrp_property_get_property_type (MrpProperty *property)
* mrp_property_set_label:
* @property: an #MrpProperty
* @label: a string containing the new label
- *
+ *
* Sets the label of @property and signals the "property-changed" signal on
* the project @property is attached to.
**/
@@ -208,16 +208,16 @@ void
mrp_property_set_label (MrpProperty *property, const gchar *label)
{
gpointer project;
-
+
g_param_spec_set_qdata_full (G_PARAM_SPEC (property),
g_quark_from_static_string (LABEL),
- g_strdup (label),
+ g_strdup (label),
g_free);
project = g_param_spec_get_qdata (G_PARAM_SPEC (property),
g_quark_from_static_string (PROJECT));
if (project) {
- imrp_project_property_changed (MRP_PROJECT (project),
+ imrp_project_property_changed (MRP_PROJECT (project),
property);
}
}
@@ -225,9 +225,9 @@ mrp_property_set_label (MrpProperty *property, const gchar *label)
/**
* mrp_property_get_label:
* @property: an #MrpProperty
- *
+ *
* Fetches the label of @property
- *
+ *
* Return value: the label of @property
**/
const gchar *
@@ -235,7 +235,7 @@ mrp_property_get_label (MrpProperty *property)
{
g_return_val_if_fail (property != NULL, NULL);
- return ((const gchar *)
+ return ((const gchar *)
g_param_spec_get_qdata (G_PARAM_SPEC (property),
g_quark_from_static_string (LABEL)));
}
@@ -244,23 +244,23 @@ mrp_property_get_label (MrpProperty *property)
* mrp_property_set_description:
* @property: an #MrpProperty
* @description: a string containing the new description
- *
+ *
* Sets the description of @property and signals the "property-changed" signal on the project @property is attached to.
**/
void
mrp_property_set_description (MrpProperty *property, const gchar *description)
{
gpointer project;
-
+
g_param_spec_set_qdata_full (G_PARAM_SPEC (property),
- g_quark_from_static_string (DESCRIPTION),
- g_strdup (description),
+ g_quark_from_static_string (DESCRIPTION),
+ g_strdup (description),
g_free);
- project = g_param_spec_get_qdata (G_PARAM_SPEC (property),
+ project = g_param_spec_get_qdata (G_PARAM_SPEC (property),
g_quark_from_static_string (PROJECT));
if (project) {
- imrp_project_property_changed (MRP_PROJECT (project),
+ imrp_project_property_changed (MRP_PROJECT (project),
property);
}
}
@@ -268,9 +268,9 @@ mrp_property_set_description (MrpProperty *property, const gchar *description)
/**
* mrp_property_get_description:
* @property: an #MrpProperty
- *
+ *
* Fetches the description of @property
- *
+ *
* Return value: the description of @property
**/
const gchar *
@@ -278,8 +278,8 @@ mrp_property_get_description (MrpProperty *property)
{
g_return_val_if_fail (property != NULL, NULL);
- return ((const gchar *)
- g_param_spec_get_qdata (G_PARAM_SPEC (property),
+ return ((const gchar *)
+ g_param_spec_get_qdata (G_PARAM_SPEC (property),
g_quark_from_static_string (DESCRIPTION)));
}
@@ -287,7 +287,7 @@ mrp_property_get_description (MrpProperty *property)
* mrp_property_set_user_defined:
* @property: an #MrpProperty
* @user_defined: if the property is user defined
- *
+ *
* Sets if @property is user-defined or created by a plugin or Planner
* itself.
**/
@@ -303,9 +303,9 @@ mrp_property_set_user_defined (MrpProperty *property, gboolean user_defined)
/**
* mrp_property_get_user_defined:
* @property: an #MrpProperty
- *
+ *
* Fetches if @property is uesr defined or not.
- *
+ *
* Return value: %TRUE if @property is user defined, otherwise %FALSE
**/
gboolean
@@ -319,42 +319,42 @@ mrp_property_get_user_defined (MrpProperty *property)
/**
* mrp_property_ref:
* @property: an #MrpProperty
- *
+ *
* Add a reference to @property. User should call this when storing a reference
* to @property.
- *
+ *
* Return value: the property
**/
MrpProperty *
mrp_property_ref (MrpProperty *property)
{
g_return_val_if_fail (property != NULL, NULL);
-
+
return MRP_PROPERTY (g_param_spec_ref (G_PARAM_SPEC (property)));
}
/**
* mrp_property_unref:
* @property: an #MrpProperty
- *
- * Remove a reference from @property. If the reference count reaches 0 the
- * property will be freed. User should not use it's reference after calling
+ *
+ * Remove a reference from @property. If the reference count reaches 0 the
+ * property will be freed. User should not use it's reference after calling
* mrp_property_unref().
**/
void
mrp_property_unref (MrpProperty *property)
{
g_return_if_fail (property != NULL);
-
+
g_param_spec_unref (G_PARAM_SPEC (property));
}
/**
* mrp_property_type_as_string:
* @type: an #MrpPropertyType
- *
+ *
* Transform a #MrpPropertyTYpe into a human readable string.
- *
+ *
* Return value: a string representation of @type
**/
const gchar *
@@ -374,7 +374,7 @@ mrp_property_type_as_string (MrpPropertyType type)
case MRP_PROPERTY_TYPE_DURATION:
return _("Duration");
case MRP_PROPERTY_TYPE_COST:
- return _("Cost");
+ return _("Cost");
case MRP_PROPERTY_TYPE_NONE:
g_warning ("Requested name for type 'none'.");
return _("None");
@@ -392,7 +392,7 @@ property_param_spec_string_list (const gchar *name,
GParamFlags flags)
{
GParamSpec *spec;
-
+
spec = g_param_spec_string (name,
nick,
blurb,
@@ -412,13 +412,13 @@ GType
mrp_property_get_type (void)
{
static GType our_type = 0;
-
+
if (our_type == 0) {
our_type = g_boxed_type_register_static ("MrpProperty",
(GBoxedCopyFunc) g_param_spec_ref,
(GBoxedFreeFunc) g_param_spec_unref);
}
-
+
return our_type;
}
diff --git a/libplanner/mrp-relation.c b/libplanner/mrp-relation.c
index e8b7b65..0c3aabb 100644
--- a/libplanner/mrp-relation.c
+++ b/libplanner/mrp-relation.c
@@ -86,8 +86,8 @@ mrp_relation_get_type (void)
(GInstanceInitFunc) relation_init,
};
- object_type = g_type_register_static (MRP_TYPE_OBJECT,
- "MrpRelation",
+ object_type = g_type_register_static (MRP_TYPE_OBJECT,
+ "MrpRelation",
&object_info, 0);
}
@@ -114,7 +114,7 @@ relation_class_init (MrpRelationClass *klass)
mrp_marshal_VOID__VOID,
G_TYPE_NONE,
0);
-
+
/* Properties. */
g_object_class_install_property (object_class,
PROP_SUCCESSOR,
@@ -155,7 +155,7 @@ static void
relation_init (MrpRelation *relation)
{
MrpRelationPriv *priv;
-
+
relation->priv = g_new0 (MrpRelationPriv, 1);
priv = relation->priv;
@@ -171,7 +171,7 @@ relation_finalize (GObject *object)
g_object_unref (relation->priv->successor);
g_object_unref (relation->priv->predecessor);
-
+
if (G_OBJECT_CLASS (parent_class)->finalize) {
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -187,17 +187,17 @@ relation_set_property (GObject *object,
MrpRelationPriv *priv;
MrpTask *task;
gboolean changed = FALSE;
-
+
relation = MRP_RELATION (object);
priv = relation->priv;
-
+
switch (prop_id) {
case PROP_SUCCESSOR:
priv->successor = g_value_get_object (value);
if (priv->successor) {
g_object_ref (priv->successor);
changed = TRUE;
- }
+ }
break;
case PROP_PREDECESSOR:
@@ -218,7 +218,7 @@ relation_set_property (GObject *object,
changed = TRUE;
break;
- default:
+ default:
break;
}
@@ -233,7 +233,7 @@ relation_set_property (GObject *object,
if (task != NULL) {
mrp_object_changed (MRP_OBJECT (task));
}
- }
+ }
}
static void
@@ -244,10 +244,10 @@ relation_get_property (GObject *object,
{
MrpRelation *relation;
MrpRelationPriv *priv;
-
+
relation = MRP_RELATION (object);
priv = relation->priv;
-
+
switch (prop_id) {
case PROP_SUCCESSOR:
g_value_set_object (value, priv->successor);
@@ -267,64 +267,64 @@ relation_get_property (GObject *object,
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
+ break;
}
}
/**
* mrp_relation_get_predecessor:
* @relation: an #MrpRelation
- *
+ *
* Retrieves the predecessor of @relation.
- *
+ *
* Return value: the predecessor task.
**/
MrpTask *
mrp_relation_get_predecessor (MrpRelation *relation)
{
g_return_val_if_fail (MRP_IS_RELATION (relation), NULL);
-
+
return relation->priv->predecessor;
}
/**
* mrp_relation_get_successor:
* @relation: an #MrpRelation
- *
+ *
* Retrieves the successor of @relation.
- *
+ *
* Return value: the successor task.
**/
MrpTask *
mrp_relation_get_successor (MrpRelation *relation)
{
g_return_val_if_fail (MRP_IS_RELATION (relation), NULL);
-
+
return relation->priv->successor;
}
/**
* mrp_relation_get_lag:
* @relation: an #MrpRelation
- *
+ *
* Retrieves the lag between the predecessor and successor in @relation.
- *
+ *
* Return value: Lag time in seconds.
**/
gint
mrp_relation_get_lag (MrpRelation *relation)
{
g_return_val_if_fail (MRP_IS_RELATION (relation), 0);
-
+
return relation->priv->lag;
}
/**
* mrp_relation_get_relation_type:
* @relation: an #MrpRelation
- *
+ *
* Retrieves the relation type of @relation.
- *
+ *
* Return value: the #MrpRelationType of the relation.
**/
/* Cumbersome name, but mrp_relation_get_type is already taken :) */
@@ -332,6 +332,6 @@ MrpRelationType
mrp_relation_get_relation_type (MrpRelation *relation)
{
g_return_val_if_fail (MRP_IS_RELATION (relation), MRP_RELATION_NONE);
-
+
return relation->priv->type;
}
diff --git a/libplanner/mrp-relation.h b/libplanner/mrp-relation.h
index d38d85d..76b36e3 100644
--- a/libplanner/mrp-relation.h
+++ b/libplanner/mrp-relation.h
@@ -54,7 +54,7 @@ MrpTask *mrp_relation_get_predecessor (MrpRelation *relation);
MrpTask *mrp_relation_get_successor (MrpRelation *relation);
gint mrp_relation_get_lag (MrpRelation *relation);
-
+
MrpRelationType mrp_relation_get_relation_type (MrpRelation *relation);
diff --git a/libplanner/mrp-resource.c b/libplanner/mrp-resource.c
index 8c98cc7..16165e2 100644
--- a/libplanner/mrp-resource.c
+++ b/libplanner/mrp-resource.c
@@ -42,7 +42,7 @@ struct _MrpResourcePriv {
gchar *email;
gchar *note;
GList *assignments;
-
+
MrpCalendar *calendar;
gfloat cost;
};
@@ -113,7 +113,7 @@ mrp_resource_get_type (void)
};
object_type = g_type_register_static (MRP_TYPE_OBJECT,
- "MrpResource",
+ "MrpResource",
&object_info, 0);
}
@@ -125,15 +125,15 @@ resource_class_init (MrpResourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MrpObjectClass *mrp_object_class = MRP_OBJECT_CLASS (klass);
-
+
parent_class = MRP_OBJECT_CLASS (g_type_class_peek_parent (klass));
-
+
object_class->finalize = resource_finalize;
object_class->set_property = resource_set_property;
object_class->get_property = resource_get_property;
-
+
mrp_object_class->removed = resource_removed;
-
+
/* Properties */
g_object_class_install_property (object_class,
PROP_NAME,
@@ -165,7 +165,7 @@ resource_class_init (MrpResourceClass *klass)
MRP_RESOURCE_TYPE_MATERIAL,
MRP_RESOURCE_TYPE_WORK,
G_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_UNITS,
g_param_spec_int ("units",
@@ -175,7 +175,7 @@ resource_class_init (MrpResourceClass *klass)
G_MAXINT,
0,
G_PARAM_READWRITE));
-
+
g_object_class_install_property (object_class,
PROP_EMAIL,
g_param_spec_string ("email",
@@ -205,9 +205,9 @@ resource_class_init (MrpResourceClass *klass)
G_MAXFLOAT,
0.0,
G_PARAM_READWRITE));
-
+
/* Signals */
- signals[ASSIGNMENT_ADDED] =
+ signals[ASSIGNMENT_ADDED] =
g_signal_new ("assignment_added",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -217,7 +217,7 @@ resource_class_init (MrpResourceClass *klass)
G_TYPE_NONE,
1, MRP_TYPE_ASSIGNMENT);
- signals[ASSIGNMENT_REMOVED] =
+ signals[ASSIGNMENT_REMOVED] =
g_signal_new ("assignment_removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -232,7 +232,7 @@ static void
resource_init (MrpResource *resource)
{
MrpResourcePriv *priv;
-
+
priv = g_new0 (MrpResourcePriv, 1);
priv->assignments = NULL;
@@ -241,7 +241,7 @@ resource_init (MrpResource *resource)
priv->short_name = g_strdup ("");
priv->group = NULL;
priv->email = g_strdup ("");
- priv->note = g_strdup ("");
+ priv->note = g_strdup ("");
resource->priv = priv;
}
@@ -250,7 +250,7 @@ resource_finalize (GObject *object)
{
MrpResource *resource = MRP_RESOURCE (object);
MrpResourcePriv *priv;
-
+
priv = resource->priv;
g_free (priv->name);
@@ -263,7 +263,7 @@ resource_finalize (GObject *object)
if (priv->calendar) {
g_object_unref (priv->calendar);
}
-
+
g_free (priv);
resource->priv = NULL;
@@ -287,10 +287,10 @@ resource_set_property (GObject *object,
MrpGroup *group;
MrpCalendar *calendar;
MrpProject *project;
-
+
resource = MRP_RESOURCE (object);
priv = resource->priv;
-
+
switch (prop_id) {
case PROP_NAME:
str = g_value_get_string (value);
@@ -300,8 +300,8 @@ resource_set_property (GObject *object,
changed = TRUE;
}
break;
-
- case PROP_SHORT_NAME:
+
+ case PROP_SHORT_NAME:
str = g_value_get_string (value);
if (!priv->short_name || strcmp (priv->short_name, str)) {
g_free (priv->short_name);
@@ -313,11 +313,11 @@ resource_set_property (GObject *object,
case PROP_GROUP:
if (priv->group != NULL) {
g_object_unref (priv->group);
- g_signal_handlers_disconnect_by_func
+ g_signal_handlers_disconnect_by_func
(priv->group,
resource_group_removed_cb,
resource);
-
+
}
group = g_value_get_object (value);
@@ -335,7 +335,7 @@ resource_set_property (GObject *object,
break;
case PROP_TYPE:
i_val = g_value_get_int (value);
-
+
if (priv->type != i_val) {
priv->type = i_val;
changed = TRUE;
@@ -343,7 +343,7 @@ resource_set_property (GObject *object,
break;
case PROP_UNITS:
i_val = g_value_get_int (value);
-
+
if (priv->units != i_val) {
priv->units = i_val;
changed = TRUE;
@@ -351,22 +351,22 @@ resource_set_property (GObject *object,
break;
case PROP_EMAIL:
str = g_value_get_string (value);
-
+
if (!priv->email || strcmp (priv->email, str)) {
g_free (priv->email);
priv->email = g_strdup (str);
changed = TRUE;
}
- break;
+ break;
case PROP_NOTE:
str = g_value_get_string (value);
-
+
if (!priv->note || strcmp (priv->note, str)) {
g_free (priv->note);
priv->note = g_strdup (str);
changed = TRUE;
}
-
+
break;
case PROP_CALENDAR:
calendar = g_value_get_pointer (value);
@@ -375,17 +375,17 @@ resource_set_property (GObject *object,
} else {
break;
}
-
+
if (priv->calendar != NULL) {
g_signal_handlers_disconnect_by_func (priv->calendar,
resource_calendar_changed,
resource);
g_object_unref (priv->calendar);
}
-
+
if (calendar != NULL) {
g_object_ref (calendar);
-
+
g_signal_connect_object (calendar,
"calendar_changed",
G_CALLBACK (resource_calendar_changed),
@@ -405,7 +405,7 @@ resource_set_property (GObject *object,
break;
case PROP_COST:
f_val = g_value_get_float (value);
-
+
if (priv->cost != f_val) {
priv->cost = f_val;
changed = TRUE;
@@ -430,10 +430,10 @@ resource_get_property (GObject *object,
{
MrpResource *resource;
MrpResourcePriv *priv;
-
+
resource = MRP_RESOURCE (object);
priv = resource->priv;
-
+
switch (prop_id) {
case PROP_NAME:
g_value_set_string (value, priv->name);
@@ -479,16 +479,16 @@ resource_calendar_changed (MrpCalendar *calendar,
if (!project) {
return;
}
-
+
mrp_project_reschedule (project);
}
static void
-resource_remove_assignment_foreach (MrpAssignment *assignment,
+resource_remove_assignment_foreach (MrpAssignment *assignment,
MrpResource *resource)
{
g_return_if_fail (MRP_IS_ASSIGNMENT (assignment));
-
+
g_signal_handlers_disconnect_by_func (MRP_OBJECT (assignment),
resource_assignment_removed_cb,
resource);
@@ -499,7 +499,7 @@ resource_remove_assignment_foreach (MrpAssignment *assignment,
}
static void
-resource_invalidate_task_cost_foreach (MrpAssignment *assignment,
+resource_invalidate_task_cost_foreach (MrpAssignment *assignment,
MrpResource *resource)
{
g_return_if_fail (MRP_IS_ASSIGNMENT (assignment));
@@ -512,16 +512,16 @@ resource_removed (MrpObject *object)
{
MrpResource *resource;
MrpResourcePriv *priv;
-
+
g_return_if_fail (MRP_IS_RESOURCE (object));
-
+
resource = MRP_RESOURCE (object);
priv = resource->priv;
-
+
g_list_foreach (priv->assignments,
(GFunc) resource_remove_assignment_foreach,
resource);
-
+
g_list_free (priv->assignments);
priv->assignments = NULL;
@@ -541,19 +541,19 @@ resource_group_removed_cb (MrpGroup *group,
}
static void
-resource_assignment_removed_cb (MrpAssignment *assignment,
+resource_assignment_removed_cb (MrpAssignment *assignment,
MrpResource *resource)
{
MrpResourcePriv *priv;
MrpTask *task;
-
+
g_return_if_fail (MRP_IS_RESOURCE (resource));
g_return_if_fail (MRP_IS_ASSIGNMENT (assignment));
-
+
priv = resource->priv;
task = mrp_assignment_get_task (assignment);
-
+
if (!task) {
g_warning ("Task not found in resource's assignment list");
return;
@@ -561,8 +561,8 @@ resource_assignment_removed_cb (MrpAssignment *assignment,
priv->assignments = g_list_remove (priv->assignments, assignment);
- g_signal_emit (resource, signals[ASSIGNMENT_REMOVED],
- 0,
+ g_signal_emit (resource, signals[ASSIGNMENT_REMOVED],
+ 0,
assignment);
g_object_unref (assignment);
@@ -585,29 +585,29 @@ resource_invalidate_task_costs (MrpResource *resource)
*
* Adds an assignment to @resource. This increases the reference count of
* @assignment.
- *
+ *
**/
void
imrp_resource_add_assignment (MrpResource *resource, MrpAssignment *assignment)
{
MrpResourcePriv *priv;
MrpTask *task;
-
+
g_return_if_fail (MRP_IS_RESOURCE (resource));
g_return_if_fail (MRP_IS_ASSIGNMENT (assignment));
-
+
priv = resource->priv;
-
+
task = mrp_assignment_get_task (assignment);
- priv->assignments = g_list_prepend (priv->assignments,
+ priv->assignments = g_list_prepend (priv->assignments,
g_object_ref (assignment));
-
+
g_signal_connect (G_OBJECT (assignment),
"removed",
G_CALLBACK (resource_assignment_removed_cb),
resource);
-
+
g_signal_emit (resource, signals[ASSIGNMENT_ADDED], 0, assignment);
mrp_object_changed (MRP_OBJECT (resource));
@@ -617,32 +617,32 @@ imrp_resource_add_assignment (MrpResource *resource, MrpAssignment *assignment)
* mrp_resource_new:
*
* Creates a new empty resource.
- *
+ *
* Return value: the newly created resource.
**/
MrpResource *
mrp_resource_new (void)
{
MrpResource *resource;
-
+
resource = g_object_new (MRP_TYPE_RESOURCE, NULL);
-
+
return resource;
}
/**
* mrp_resource_get_name:
* @resource: an #MrpResource
- *
+ *
* Retrives the name of @resource.
- *
+ *
* Return value: the name
**/
const gchar *
mrp_resource_get_name (MrpResource *resource)
{
g_return_val_if_fail (MRP_IS_RESOURCE (resource), NULL);
-
+
return resource->priv->name;
}
@@ -650,7 +650,7 @@ mrp_resource_get_name (MrpResource *resource)
* mrp_resource_set_name:
* @resource: an #MrpResource
* @name: new name of @resource
- *
+ *
* Sets the name of @resource.
**/
void mrp_resource_set_name (MrpResource *resource, const gchar *name)
@@ -663,16 +663,16 @@ void mrp_resource_set_name (MrpResource *resource, const gchar *name)
/**
* mrp_resource_get_short_name:
* @resource: an #MrpResource
- *
+ *
* Retrives the short_name of @resource.
- *
+ *
* Return value: the short name
**/
const gchar *
mrp_resource_get_short_name (MrpResource *resource)
{
g_return_val_if_fail (MRP_IS_RESOURCE (resource), NULL);
-
+
return resource->priv->short_name;
}
@@ -680,7 +680,7 @@ mrp_resource_get_short_name (MrpResource *resource)
* mrp_resource_set_short_name:
* @resource: an #MrpResource
* @name: new short name of @resource
- *
+ *
* Sets the short name of @resource.
**/
void mrp_resource_set_short_name (MrpResource *resource, const gchar *name)
@@ -698,7 +698,7 @@ void mrp_resource_set_short_name (MrpResource *resource, const gchar *name)
*
* Assigns @resource to @task by the given amount of @units. A value of 100
* units corresponds to fulltime assignment.
- *
+ *
**/
void
mrp_resource_assign (MrpResource *resource,
@@ -706,7 +706,7 @@ mrp_resource_assign (MrpResource *resource,
gint units)
{
MrpAssignment *assignment;
-
+
g_return_if_fail (MRP_IS_RESOURCE (resource));
g_return_if_fail (MRP_IS_TASK (task));
@@ -725,27 +725,27 @@ mrp_resource_assign (MrpResource *resource,
/**
* mrp_resource_get_assignments:
* @resource: an #MrpResource.
- *
- * Retrieves the assignments that this resource has. If caller needs to
+ *
+ * Retrieves the assignments that this resource has. If caller needs to
* manipulate the returned list, a copy of it needs to be made.
- *
+ *
* Return value: The assignments of @resource. It should not be freed.
**/
GList *
mrp_resource_get_assignments (MrpResource *resource)
{
g_return_val_if_fail (MRP_IS_RESOURCE (resource), NULL);
-
+
return resource->priv->assignments;
}
/**
* mrp_resource_get_assigned_tasks:
* @resource: an #MrpResource
- *
+ *
* Retrieves a list of all the tasks that this resource is assigned to. It is
* basically a convenience wrapper around mrp_resource_get_assignments().
- *
+ *
* Return value: A list of the tasks that this resource is assigned to. Needs to
* be freed when not used anymore.
**/
@@ -756,9 +756,9 @@ mrp_resource_get_assigned_tasks (MrpResource *resource)
GList *l;
MrpAssignment *assignment;
MrpTask *task;
-
+
g_return_val_if_fail (MRP_IS_RESOURCE (resource), NULL);
-
+
for (l = resource->priv->assignments; l; l = l->next) {
assignment = l->data;
task = mrp_assignment_get_task (assignment);
@@ -775,49 +775,49 @@ mrp_resource_get_assigned_tasks (MrpResource *resource)
* mrp_resource_compare:
* @a: an #MrpResource
* @b: an #MrpResource
- *
+ *
* Comparison routine for resources. It is suitable for sorting, and only
* compares the resource name.
- *
+ *
* Return value: -1 if @a is less than @b, 1 id @a is greater than @b, and 1 if
* equal.
**/
gint
mrp_resource_compare (gconstpointer a, gconstpointer b)
{
- return strcmp (MRP_RESOURCE(a)->priv->name,
+ return strcmp (MRP_RESOURCE(a)->priv->name,
MRP_RESOURCE(b)->priv->name);
}
/**
* mrp_resource_get_calendar:
* @resource: an #MrpResource
- *
+ *
* Retrieves the calendar that is used for @resource. If no calendar is set,
* %NULL is returned, which means the project default calendar.
- *
+ *
* Return value: a #MrpCalendar, or %NULL if no specific calendar is set.
**/
MrpCalendar *
mrp_resource_get_calendar (MrpResource *resource)
{
MrpResourcePriv *priv;
-
+
g_return_val_if_fail (MRP_IS_RESOURCE (resource), NULL);
priv = resource->priv;
-
+
return priv->calendar;
}
/**
* mrp_resource_set_calendar:
* @resource: an #MrpResource
- * @calendar: the #MrpCalendar to set, or %NULL
+ * @calendar: the #MrpCalendar to set, or %NULL
*
* Sets the calendar to use for @resource. %NULL means to use the project
* default calendar.
- *
+ *
**/
void
mrp_resource_set_calendar (MrpResource *resource, MrpCalendar *calendar)
diff --git a/libplanner/mrp-resource.h b/libplanner/mrp-resource.h
index c99dc29..0856b44 100644
--- a/libplanner/mrp-resource.h
+++ b/libplanner/mrp-resource.h
@@ -68,7 +68,7 @@ void mrp_resource_assign (MrpResource *resource,
gint units);
GList * mrp_resource_get_assignments (MrpResource *resource);
-
+
GList * mrp_resource_get_assigned_tasks (MrpResource *resource);
gint mrp_resource_compare (gconstpointer a,
diff --git a/libplanner/mrp-sql.c b/libplanner/mrp-sql.c
index 13742ef..2992538 100644
--- a/libplanner/mrp-sql.c
+++ b/libplanner/mrp-sql.c
@@ -3,7 +3,7 @@
* Copyright (C) 2003 CodeFactory AB
* Copyright (C) 2003 Richard Hult <richard imendio com>
* Copyright (C) 2003 Mikael Hallendal <micke imendio com>
- * Copyright (C) 2004 Alvaro del Castillo <acs barrapunto com>
+ * Copyright (C) 2004 Alvaro del Castillo <acs barrapunto com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -81,7 +81,7 @@ typedef struct {
gint calendar_id;
gint default_group_id;
gint phase_id;
-
+
GList *calendars;
GList *tasks;
@@ -89,7 +89,7 @@ typedef struct {
gchar *last_user;
MrpTask *root_task;
-
+
/* Maps from database id to project objects. */
GHashTable *calendar_id_hash;
GHashTable *group_id_hash;
@@ -105,7 +105,7 @@ typedef struct {
GHashTable *task_hash;
GHashTable *day_hash;
GHashTable *property_type_hash;
-} SQLData;
+} SQLData;
static gint get_int (GdaDataModel *model,
gint i,
@@ -180,26 +180,26 @@ static gboolean sql_write_default_group_id (SQLData *data);
static gboolean sql_write_resources (SQLData *data);
static gboolean sql_write_tasks (SQLData *data);
-static GdaDataModel *
- sql_execute_query (GdaConnection *con,
+static GdaDataModel *
+ sql_execute_query (GdaConnection *con,
gchar *query);
-static gboolean sql_execute_command (GdaConnection *con,
+static gboolean sql_execute_command (GdaConnection *con,
gchar *query);
-static gchar * sql_quote_and_escape_const_string (SQLData *data,
+static gchar * sql_quote_and_escape_const_string (SQLData *data,
const gchar *string);
-static void sql_quote_and_escape_string (SQLData *data,
+static void sql_quote_and_escape_string (SQLData *data,
gchar **string,
gboolean must_free);
static gchar *
-sql_quote_and_escape_const_string(SQLData *data,
+sql_quote_and_escape_const_string(SQLData *data,
const gchar *string)
{
GdaDataHandler *handler;
GValue *value;
gchar *quoted_string;
-
+
handler = gda_dict_get_handler(data->dict, G_TYPE_STRING);
value = gda_data_handler_get_value_from_str(handler, string, G_TYPE_STRING);
@@ -210,13 +210,13 @@ sql_quote_and_escape_const_string(SQLData *data,
return quoted_string;
}
-static void
-sql_quote_and_escape_string(SQLData *data,
+static void
+sql_quote_and_escape_string(SQLData *data,
gchar **string,
gboolean must_free)
{
gchar *quoted_string;
-
+
quoted_string = sql_quote_and_escape_const_string(data, *string);
/* Only free the string we are replacing if we're requested to do so */
@@ -227,13 +227,13 @@ sql_quote_and_escape_string(SQLData *data,
*string = quoted_string;
}
-static gboolean
+static gboolean
sql_execute_command (GdaConnection *con, gchar *command)
{
GdaCommand *cmd;
GList *list;
GError *error = NULL;
-
+
cmd = gda_command_new (command, GDA_COMMAND_TYPE_SQL, GDA_COMMAND_OPTION_STOP_ON_ERRORS);
list = gda_connection_execute_command (con, cmd, NULL, &error);
gda_command_free (cmd);
@@ -276,7 +276,7 @@ sql_get_last_error (GdaConnection *connection)
GdaConnectionEvent *error;
const gchar *error_txt;
- g_return_val_if_fail (GDA_IS_CONNECTION (connection),
+ g_return_val_if_fail (GDA_IS_CONNECTION (connection),
_("Can't connect to database server"));
list = (GList *) gda_connection_get_events (connection);
@@ -299,7 +299,7 @@ get_int (GdaDataModel *model, gint row, gint column)
GValue *value;
gchar *str;
gint i;
-
+
value = (GValue *) gda_data_model_get_value_at (model, column, row);
if (value == NULL) {
g_warning ("Failed to get a value: (%d,%d)", column, row);
@@ -319,7 +319,7 @@ get_id (GdaDataModel *model, gint row, gint column)
GValue *value;
gchar *str;
gint i;
-
+
value = (GValue *) gda_data_model_get_value_at (model, column, row);
if (value == NULL) {
g_warning ("Failed to get a value: (%d,%d)", column, row);
@@ -346,17 +346,17 @@ get_string (GdaDataModel *model, gint row, gint column)
gsize len;
gchar *ret;
gchar *str;
-
+
value = (GValue *) gda_data_model_get_value_at (model, column, row);
if (value == NULL) {
g_warning ("Failed to get a value: (%d,%d)", column, row);
d(sql_show_result (model));
return g_strdup ("");
}
-
+
str = gda_value_stringify (value);
len = strlen (str);
-
+
if (g_utf8_validate (str, len, NULL)) {
return str;
}
@@ -375,7 +375,7 @@ get_string (GdaDataModel *model, gint row, gint column)
}
g_free (str);
-
+
return ret;
}
@@ -383,14 +383,14 @@ static gboolean
get_boolean (GdaDataModel *model, gint row, gint column)
{
GValue *value;
-
+
value = (GValue *) gda_data_model_get_value_at (model, column, row);
if (value == NULL) {
g_warning ("Failed to get a value: (%d,%d)", column, row);
d(sql_show_result (model));
return FALSE;
}
-
+
return g_value_get_boolean (value);
}
@@ -400,7 +400,7 @@ get_float (GdaDataModel *model, gint row, gint column)
GValue *value;
gchar *str;
gdouble d;
-
+
value = (GValue *) gda_data_model_get_value_at (model, column, row);
if (value == NULL) {
@@ -408,7 +408,7 @@ get_float (GdaDataModel *model, gint row, gint column)
d(sql_show_result (model));
return -1;
}
-
+
str = gda_value_stringify (value);
d = g_ascii_strtod (str, NULL);
g_free (str);
@@ -422,7 +422,7 @@ is_field (GdaDataModel *model, gint j, const gchar *name)
const gchar *str;
str = gda_data_model_get_column_title (model, j);
-
+
return str && (strcmp (str, name) == 0);
}
@@ -442,7 +442,7 @@ get_inserted_id (SQLData *data,
g_free (query);
if (!success) {
- g_warning ("Couldn't get cursor (get_inserted_id) %s.",
+ g_warning ("Couldn't get cursor (get_inserted_id) %s.",
sql_get_last_error (data->con));
goto out;
}
@@ -450,11 +450,11 @@ get_inserted_id (SQLData *data,
model = sql_execute_query (data->con, "FETCH ALL in idcursor");
if (model == NULL) {
- g_warning ("FETCH ALL failed (%s) %s.", id_name,
+ g_warning ("FETCH ALL failed (%s) %s.", id_name,
sql_get_last_error (data->con));
goto out;
}
-
+
if (gda_data_model_get_n_rows (model) > 0) {
id = get_int (model, 0, 0);
}
@@ -462,7 +462,7 @@ get_inserted_id (SQLData *data,
g_object_unref (model);
sql_execute_command (data->con, "CLOSE idcursor");
-
+
return id;
out:
@@ -505,7 +505,7 @@ sql_read_project (SQLData *data, gint proj_id)
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
gchar *name = NULL;
gchar *manager = NULL;
gchar *company = NULL;
@@ -518,9 +518,9 @@ sql_read_project (SQLData *data, gint proj_id)
" * FROM project WHERE proj_id=%d", proj_id);
success = sql_execute_command (data->con, query);
g_free (query);
-
+
if (!success) {
- g_warning ("DECLARE CURSOR command failed (project) %s.",
+ g_warning ("DECLARE CURSOR command failed (project) %s.",
sql_get_last_error (data->con));
goto out;
}
@@ -531,13 +531,13 @@ sql_read_project (SQLData *data, gint proj_id)
g_warning ("FETCH ALL failed %s.", sql_get_last_error (data->con));
goto out;
}
-
+
if (gda_data_model_get_n_rows (model) == 0) {
g_warning ("There is no project with the id '%d'.", proj_id);
goto out;
}
-
+
n = gda_data_model_get_n_columns (model);
for (j = 0; j < n; j++) {
if (is_field (model, j, "proj_id")) {
@@ -586,7 +586,7 @@ sql_read_project (SQLData *data, gint proj_id)
g_free (manager);
g_free (company);
g_free (phase);
-
+
sql_execute_command (data->con, "CLOSE mycursor");
return TRUE;
@@ -605,36 +605,36 @@ sql_read_phases (SQLData *data)
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
gchar *name;
GList *phases = NULL;
-
+
/* Get phases. */
query = g_strdup_printf ("DECLARE mycursor CURSOR FOR SELECT * FROM phase WHERE proj_id=%d",
data->project_id);
-
+
success = sql_execute_command (data->con, query);
g_free (query);
-
+
if (!success) {
- g_warning ("DECLARE CURSOR command failed (phase) %s.",
+ g_warning ("DECLARE CURSOR command failed (phase) %s.",
sql_get_last_error (data->con));
goto out;
}
model = sql_execute_query (data->con, "FETCH ALL in mycursor");
if (model == NULL) {
- g_warning ("FETCH ALL failed for phase %s.",
+ g_warning ("FETCH ALL failed for phase %s.",
sql_get_last_error (data->con));
goto out;
}
-
-
+
+
n = gda_data_model_get_n_columns (model);
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
name = NULL;
-
+
for (j = 0; j < n; j++) {
if (is_field (model, j, "name")) {
name = get_string (model, i, j);
@@ -648,9 +648,9 @@ sql_read_phases (SQLData *data)
g_object_unref (model);
model = NULL;
-
+
sql_execute_command (data->con, "CLOSE mycursor");
-
+
phases = g_list_reverse (phases);
g_object_set (data->project, "phases", phases, NULL);
@@ -673,7 +673,7 @@ sql_read_property_specs (SQLData *data)
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
gint property_type_id;
gchar *name;
gchar *label;
@@ -682,14 +682,14 @@ sql_read_property_specs (SQLData *data)
MrpProperty *property;
GType owner;
const gchar *tmp;
-
+
/* Get property types/specs. */
query = g_strdup_printf ("DECLARE mycursor CURSOR FOR SELECT * FROM property_type WHERE proj_id=%d",
data->project_id);
-
+
success = sql_execute_command (data->con, query);
g_free (query);
-
+
if (!success) {
g_warning ("DECLARE CURSOR command failed (property_type) %s.",
@@ -699,12 +699,12 @@ sql_read_property_specs (SQLData *data)
model = sql_execute_query (data->con, "FETCH ALL in mycursor");
if (model == NULL) {
- g_warning ("FETCH ALL failed for property_type %s.",
+ g_warning ("FETCH ALL failed for property_type %s.",
sql_get_last_error (data->con));
goto out;
}
-
-
+
+
n = gda_data_model_get_n_columns (model);
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
name = NULL;
@@ -738,7 +738,7 @@ sql_read_property_specs (SQLData *data)
}
}
else if (is_field (model, j, "type")) {
- tmp = get_string (model, i, j);
+ tmp = get_string (model, i, j);
if (!strcmp (tmp, "date")) {
type = MRP_PROPERTY_TYPE_DATE;
@@ -748,10 +748,10 @@ sql_read_property_specs (SQLData *data)
}
else if (!strcmp (tmp, "float")) {
type = MRP_PROPERTY_TYPE_FLOAT;
- }
+ }
else if (!strcmp (tmp, "int")) {
type = MRP_PROPERTY_TYPE_INT;
- }
+ }
else if (!strcmp (tmp, "text")) {
type = MRP_PROPERTY_TYPE_STRING;
}
@@ -775,21 +775,21 @@ sql_read_property_specs (SQLData *data)
label,
description,
TRUE);
-
+
mrp_project_add_property (data->project,
owner,
property,
- TRUE /* FIXME: user_defined, should
+ TRUE /* FIXME: user_defined, should
be read from the file */);
-
- g_hash_table_insert (data->property_type_id_hash,
+
+ g_hash_table_insert (data->property_type_id_hash,
GINT_TO_POINTER (property_type_id), property);
} else {
/* FIXME: Properties that are already added (e.g. cost). */
property = mrp_project_get_property (data->project, name, owner);
g_hash_table_insert (data->property_type_id_hash, GINT_TO_POINTER (property_type_id), property);
}
-
+
g_free (name);
g_free (label);
g_free (description);
@@ -807,7 +807,7 @@ sql_read_property_specs (SQLData *data)
}
return FALSE;
-}
+}
static gboolean
sql_set_property_value (SQLData *data,
@@ -867,7 +867,7 @@ sql_read_property_values (SQLData *data,
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
const gchar *table;
const gchar *object_id_name;
gint object_id;
@@ -893,20 +893,20 @@ sql_read_property_values (SQLData *data,
object_id = get_hash_data_as_id (data->resource_hash, object);
} else {
g_assert_not_reached ();
-
+
table = NULL;
object_id_name = NULL;
object_id = -1;
}
-
+
/* Get properties. */
query = g_strdup_printf ("DECLARE propcursor CURSOR FOR SELECT * "
"FROM %s WHERE %s=%d",
table, object_id_name, object_id);
-
+
success = sql_execute_command (data->con, query);
g_free (query);
-
+
if (!success) {
g_warning ("DECLARE CURSOR command failed (*_to_property) %s.",
sql_get_last_error (data->con));
@@ -915,12 +915,12 @@ sql_read_property_values (SQLData *data,
model = sql_execute_query (data->con,"FETCH ALL in propcursor");
if (model == NULL) {
- g_warning ("FETCH ALL failed for *_to_property %s.",
+ g_warning ("FETCH ALL failed for *_to_property %s.",
sql_get_last_error (data->con));
goto out;
}
-
-
+
+
n = gda_data_model_get_n_columns (model);
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
prop_id = -1;
@@ -937,39 +937,39 @@ sql_read_property_values (SQLData *data,
model = NULL;
sql_execute_command (data->con, "CLOSE propcursor");
-
+
/* Get the actual values. */
for (l = prop_ids; l; l = l->next) {
prop_id = GPOINTER_TO_INT (l->data);
-
+
query = g_strdup_printf ("DECLARE propcursor CURSOR FOR SELECT * "
"FROM property WHERE prop_id=%d",
prop_id);
-
+
success = sql_execute_command (data->con, query);
g_free (query);
-
-
+
+
if (!success) {
g_warning ("DECLARE CURSOR command failed (property) %s.",
sql_get_last_error (data->con));
goto out;
}
-
+
model = sql_execute_query (data->con,"FETCH ALL in propcursor");
if (model == NULL) {
g_warning ("FETCH ALL failed for property %s.",
sql_get_last_error (data->con));
goto out;
}
-
-
+
+
n = gda_data_model_get_n_columns (model);
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
prop_type_id = -1;
value = NULL;
-
+
for (j = 0; j < n; j++) {
if (is_field (model, j, "proptype_id")) {
prop_type_id = get_id (model, i, j);
@@ -986,13 +986,13 @@ sql_read_property_values (SQLData *data,
}
g_object_unref (model);
model = NULL;
-
+
sql_execute_command (data->con, "CLOSE propcursor");
-
+
}
g_list_free (prop_ids);
-
+
return TRUE;
out:
@@ -1025,7 +1025,7 @@ sql_read_overriden_day_types (SQLData *data, gint calendar_id)
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
gint day_type_id;
mrptime start, end;
MrpInterval *interval;
@@ -1033,17 +1033,17 @@ sql_read_overriden_day_types (SQLData *data, gint calendar_id)
OverriddenDayTypeData *day_type_data;
GHashTable *hash;
MrpCalendar *calendar;
-
+
/* Get overridden days for the given calendar. */
query = g_strdup_printf ("DECLARE daycursor CURSOR FOR SELECT "
"extract (epoch from start_time) as start_seconds, "
"extract (epoch from end_time) as end_seconds, "
"* FROM day_interval WHERE cal_id=%d",
calendar_id);
-
+
success = sql_execute_command (data->con, query);
g_free (query);
-
+
if (!success) {
g_warning ("DECLARE CURSOR command failed (day_interval) %s.",
@@ -1057,9 +1057,9 @@ sql_read_overriden_day_types (SQLData *data, gint calendar_id)
sql_get_last_error (data->con));
goto out;
}
-
+
hash = g_hash_table_new (NULL, NULL);
-
+
n = gda_data_model_get_n_columns (model);
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
day_type_id = -1;
@@ -1089,8 +1089,8 @@ sql_read_overriden_day_types (SQLData *data, gint calendar_id)
}
interval = mrp_interval_new (start, end);
- day_type_data->intervals = g_list_append (day_type_data->intervals, interval);
-
+ day_type_data->intervals = g_list_append (day_type_data->intervals, interval);
+
d(g_print ("Overridden intervals for day %d, on cal %d, %d - %d\n",
day_type_id, calendar_id,
(int)start, (int)end));
@@ -1101,8 +1101,8 @@ sql_read_overriden_day_types (SQLData *data, gint calendar_id)
model = NULL;
sql_execute_command (data->con,"CLOSE daycursor");
-
-
+
+
/* Set the intervals for the day types. */
calendar = g_hash_table_lookup (data->calendar_id_hash, GINT_TO_POINTER (calendar_id));
g_hash_table_foreach (hash, (GHFunc) foreach_insert_overridden_day_type, calendar);
@@ -1116,7 +1116,7 @@ sql_read_overriden_day_types (SQLData *data, gint calendar_id)
}
return FALSE;
-}
+}
/* Reads overridden days, i.e. specific dates that doesn't use the default day.
*/
@@ -1127,7 +1127,7 @@ sql_read_overriden_days (SQLData *data, gint calendar_id)
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
gint day_type_id;
mrptime date;
@@ -1136,39 +1136,39 @@ sql_read_overriden_days (SQLData *data, gint calendar_id)
"extract (epoch from date) as date_seconds, "
"* FROM day WHERE cal_id=%d",
calendar_id);
-
+
success = sql_execute_command (data->con, query);
g_free (query);
-
+
if (!success) {
g_warning ("DECLARE CURSOR command failed (day) %s.",
sql_get_last_error (data->con));
goto out;
}
-
+
model = sql_execute_query (data->con, "FETCH ALL in daycursor");
if (model == NULL) {
g_warning ("FETCH ALL failed for day %s.",
sql_get_last_error (data->con));
goto out;
}
-
-
+
+
n = gda_data_model_get_n_columns (model);
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
day_type_id = -1;
date = -1;
-
+
for (j = 0; j < n; j++) {
if (is_field (model, j, "date_seconds")) {
- date = get_int (model, i, j);
+ date = get_int (model, i, j);
}
else if (is_field (model, j, "dtype_id")) {
day_type_id = get_int (model, i, j);
}
}
-
+
d(g_print ("Overridden for cal %d, on %s\n", calendar_id, mrp_time_format ("%a %e %b", date)));
/*data->days = g_list_prepend (data->days, day);*/
@@ -1177,7 +1177,7 @@ sql_read_overriden_days (SQLData *data, gint calendar_id)
model = NULL;
sql_execute_command (data->con,"CLOSE daycursor");
-
+
return TRUE;
@@ -1187,7 +1187,7 @@ sql_read_overriden_days (SQLData *data, gint calendar_id)
}
return FALSE;
-}
+}
static gboolean
sql_read_day_types (SQLData *data)
@@ -1196,17 +1196,17 @@ sql_read_day_types (SQLData *data)
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
gint day_type_id;
gchar *name;
gchar *description;
MrpDay *day;
gboolean is_work, is_nonwork;
-
+
/* Get day types. */
query = g_strdup_printf ("DECLARE mycursor CURSOR FOR SELECT * FROM daytype WHERE proj_id=%d",
data->project_id);
-
+
success = sql_execute_command (data->con, query);
g_free (query);
@@ -1222,7 +1222,7 @@ sql_read_day_types (SQLData *data)
sql_get_last_error (data->con));
goto out;
}
-
+
n = gda_data_model_get_n_columns (model);
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
name = NULL;
@@ -1259,10 +1259,10 @@ sql_read_day_types (SQLData *data)
} else {
day = mrp_day_add (data->project, name, description);
}
-
+
g_free (name);
g_free (description);
-
+
g_hash_table_insert (data->day_id_hash, GINT_TO_POINTER (day_type_id), day);
}
g_object_unref (model);
@@ -1278,7 +1278,7 @@ sql_read_day_types (SQLData *data)
}
return FALSE;
-}
+}
static gboolean
sql_calendar_create (GNode *node,
@@ -1291,17 +1291,17 @@ sql_calendar_create (GNode *node,
/* Skip the root .*/
return FALSE;
}
-
+
if (!node->parent->parent) {
/* Calendar directly under the root don't inherit from another
* calendar.
*/
d(g_print ("Create new calendar: %s\n", cal_data->name));
-
+
calendar = mrp_calendar_new (cal_data->name, data->project);
} else {
d(g_print ("Derive new calendar: %s\n", cal_data->name));
-
+
parent = g_hash_table_lookup (data->calendar_id_hash, GINT_TO_POINTER (cal_data->parent_id));
calendar = mrp_calendar_derive (cal_data->name, parent);
}
@@ -1317,10 +1317,10 @@ sql_calendar_create (GNode *node,
MRP_CALENDAR_DAY_SAT, cal_data->day_sat,
MRP_CALENDAR_DAY_SUN, cal_data->day_sun,
-1);
-
+
sql_read_overriden_days (data, cal_data->id);
sql_read_overriden_day_types (data, cal_data->id);
-
+
return FALSE;
}
@@ -1331,7 +1331,7 @@ sql_calendar_insert_node (GHashTable *hash,
{
CalendarData *data;
GNode *parent;
-
+
/* If the node is already inserted, do nothing. */
if (node->parent) {
return;
@@ -1343,7 +1343,7 @@ sql_calendar_insert_node (GHashTable *hash,
g_node_prepend (root, node);
return;
}
-
+
/* Otherwise insert below the parent corresponding to the parent id. */
parent = g_hash_table_lookup (hash, GINT_TO_POINTER (data->parent_id));
@@ -1351,7 +1351,7 @@ sql_calendar_insert_node (GHashTable *hash,
/* If we for some reason don't find the parent, use the root. */
parent = root;
}
-
+
g_node_prepend (parent, node);
}
@@ -1363,10 +1363,10 @@ dump_calendar_tree (GNode *node)
gchar *str;
return;
-
+
str = g_malloc0 (g_node_depth (node));
memset (str, ' ', g_node_depth (node)-1);
-
+
data = node->data;
d(g_print ("%s%s\n", str, data ? data->name : "[Root]"));
@@ -1384,7 +1384,7 @@ sql_read_calendars (SQLData *data)
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
CalendarData *calendar_data;
GNode *tree;
GNode *node;
@@ -1413,12 +1413,12 @@ sql_read_calendars (SQLData *data)
tree = g_node_new (NULL);
hash = g_hash_table_new (NULL, NULL);
-
+
n = gda_data_model_get_n_columns (model);
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
calendar_data = g_new0 (CalendarData, 1);
node = g_node_new (calendar_data);
-
+
for (j = 0; j < n; j++) {
if (is_field (model, j, "name")) {
calendar_data->name = get_string (model, i, j);
@@ -1458,12 +1458,12 @@ sql_read_calendars (SQLData *data)
calendar_data->day_sun = g_hash_table_lookup (data->day_id_hash, GINT_TO_POINTER (day_id));
}
}
-
+
d(g_print ("Calendar: %s, id: %d, parent: %d\n",
calendar_data->name,
calendar_data->id,
calendar_data->parent_id));
-
+
calendars = g_list_prepend (calendars, node);
g_hash_table_insert (hash, GINT_TO_POINTER (calendar_data->id), node);
}
@@ -1499,7 +1499,7 @@ sql_read_calendars (SQLData *data)
g_list_free (calendars);
g_hash_table_destroy (hash);
g_node_destroy (tree);
-
+
return TRUE;
out:
@@ -1508,7 +1508,7 @@ sql_read_calendars (SQLData *data)
}
return FALSE;
-}
+}
static gboolean
sql_read_groups (SQLData *data)
@@ -1517,14 +1517,14 @@ sql_read_groups (SQLData *data)
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
MrpGroup *group;
gint group_id;
gchar *name;
gchar *admin_name;
gchar *admin_phone;
gchar *admin_email;
-
+
/* Get resource groups. */
query = g_strdup_printf ("DECLARE mycursor CURSOR FOR SELECT * FROM resource_group WHERE proj_id=%d",
data->project_id);
@@ -1543,7 +1543,7 @@ sql_read_groups (SQLData *data)
sql_get_last_error (data->con));
goto out;
}
-
+
n = gda_data_model_get_n_columns (model);
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
group_id = -1;
@@ -1551,7 +1551,7 @@ sql_read_groups (SQLData *data)
admin_name = NULL;
admin_phone = NULL;
admin_email = NULL;
-
+
for (j = 0; j < n; j++) {
if (is_field (model, j, "name")) {
name = get_string (model, i, j);
@@ -1569,7 +1569,7 @@ sql_read_groups (SQLData *data)
admin_email = get_string (model, i, j);
}
}
-
+
group = g_object_new (MRP_TYPE_GROUP,
"name", name,
"manager_name", admin_name,
@@ -1600,7 +1600,7 @@ sql_read_groups (SQLData *data)
}
return FALSE;
-}
+}
static gboolean
sql_read_resources (SQLData *data)
@@ -1609,7 +1609,7 @@ sql_read_resources (SQLData *data)
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
gint resource_id;
gint group_id;
gint calendar_id;
@@ -1639,9 +1639,9 @@ sql_read_resources (SQLData *data)
sql_get_last_error (data->con));
goto out;
}
-
+
n = gda_data_model_get_n_columns (model);
-
+
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
resource_id = -1;
group_id = -1;
@@ -1650,14 +1650,14 @@ sql_read_resources (SQLData *data)
short_name = NULL; /* Added in schema 0.7 */
email = NULL;
note = NULL;
-
+
for (j = 0; j < n; j++) {
if (is_field (model, j, "name")) {
name = get_string (model, i, j);
}
else if (is_field (model, j, "short_name")) {
short_name = get_string (model, i, j);
-
+
/* FIXME: The next section detects the case if
* short_name is NULL. If a string field is null
* then get_string() seems to actually return
@@ -1666,7 +1666,7 @@ sql_read_resources (SQLData *data)
* the following is a workaround until we have a
* database upgrade process that fixes NULLs.
*/
- if (strcmp (short_name, "NULL") == 0) {
+ if (strcmp (short_name, "NULL") == 0) {
short_name = g_strdup ("");
}
}
@@ -1690,11 +1690,11 @@ sql_read_resources (SQLData *data)
group = g_hash_table_lookup (data->group_id_hash, GINT_TO_POINTER (group_id));
calendar = g_hash_table_lookup (data->calendar_id_hash, GINT_TO_POINTER (calendar_id));
- /* Warning: Always check for NULL data on strings here for any new schema variables
- * because if you don't and someone opens an OLD database then it will segfault
+ /* Warning: Always check for NULL data on strings here for any new schema variables
+ * because if you don't and someone opens an OLD database then it will segfault
* in resource-set-property. Use short_name as an example.
*/
-
+
resource = g_object_new (MRP_TYPE_RESOURCE,
"name", name,
"short_name", (short_name ? short_name : ""),
@@ -1708,7 +1708,7 @@ sql_read_resources (SQLData *data)
g_free (short_name);
g_free (email);
g_free (note);
-
+
/* Add resource to project. */
mrp_project_add_resource (data->project, resource);
g_hash_table_insert (data->resource_id_hash, GINT_TO_POINTER (resource_id), resource);
@@ -1719,19 +1719,19 @@ sql_read_resources (SQLData *data)
g_warning ("Couldn't read resource properties.");
}
}
-
+
g_object_unref (model);
model = NULL;
-
+
sql_execute_command (data->con, "CLOSE mycursor");
return TRUE;
-
+
out:
if (model) {
g_object_unref (model);
}
-
+
return FALSE;
}
@@ -1743,7 +1743,7 @@ sql_read_assignments (SQLData *data,
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
gint units;
gint resource_id;
MrpTask *task;
@@ -1773,7 +1773,7 @@ sql_read_assignments (SQLData *data,
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
resource_id = -1;
units = -1;
-
+
for (j = 0; j < n; j++) {
if (is_field (model, j, "units")) {
units = floor (0.5 + 100.0 * get_float (model, i, j));
@@ -1794,12 +1794,12 @@ sql_read_assignments (SQLData *data,
sql_execute_command (data->con, "CLOSE alloccursor");
return TRUE;
-
+
out:
if (model) {
g_object_unref (model);
}
-
+
return FALSE;
}
@@ -1810,7 +1810,7 @@ sql_read_relations (SQLData *data, gint task_id)
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
gint predecessor_id;
gint lag;
MrpTask *task;
@@ -1840,7 +1840,7 @@ sql_read_relations (SQLData *data, gint task_id)
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
predecessor_id = -1;
lag = 0;
-
+
for (j = 0; j < n; j++) {
if (is_field (model, j, "pred_task_id")) {
predecessor_id = get_id (model, i, j);
@@ -1865,12 +1865,12 @@ sql_read_relations (SQLData *data, gint task_id)
sql_execute_command (data->con, "CLOSE predcursor");
return TRUE;
-
+
out:
if (model) {
g_object_unref (model);
}
-
+
return FALSE;
}
@@ -1888,7 +1888,7 @@ sql_task_insert (GNode *node,
/* Skip the root .*/
return FALSE;
}
-
+
if (!node->parent->parent) {
/* Tasks directly under the root is inserted below the root. */
parent = data->root_task;
@@ -1897,7 +1897,7 @@ sql_task_insert (GNode *node,
}
imrp_task_insert_child (parent, -1, task_data->task);
-
+
return FALSE;
}
@@ -1912,7 +1912,7 @@ sql_task_insert_node (GHashTable *hash,
{
TaskData *data;
GNode *parent;
-
+
/* If the node is already inserted, do nothing. */
if (node->parent) {
return;
@@ -1924,14 +1924,14 @@ sql_task_insert_node (GHashTable *hash,
g_node_prepend (root, node);
return;
}
-
+
/* Otherwise insert below the parent corresponding to the parent id. */
parent = g_hash_table_lookup (hash, GINT_TO_POINTER (data->parent_id));
if (!parent) {
/* If we for some reason don't find the parent, use the root. */
parent = root;
}
-
+
g_node_prepend (parent, node);
}
@@ -1944,10 +1944,10 @@ dump_task_tree (GNode *node)
gchar *name = NULL;
return;
-
+
str = g_malloc0 (g_node_depth (node));
memset (str, ' ', g_node_depth (node)-1);
-
+
data = node->data;
if (data) {
@@ -1988,7 +1988,7 @@ sql_read_tasks (SQLData *data)
GdaDataModel *model = NULL;
gboolean success;
gchar *query;
-
+
gint task_id;
gint parent_id;
gchar *name;
@@ -2047,7 +2047,7 @@ sql_read_tasks (SQLData *data)
is_milestone = FALSE;
constraint_time = 0;
constraint_type = MRP_CONSTRAINT_ASAP;
-
+
for (j = 0; j < n; j++) {
if (is_field (model, j, "name")) {
name = get_string (model, i, j);
@@ -2080,7 +2080,7 @@ sql_read_tasks (SQLData *data)
note = get_string (model, i, j);
}
else if (is_field (model, j, "constraint_type")) {
- constraint_type = constraint_string_to_type
+ constraint_type = constraint_string_to_type
(get_string (model, i, j));
}
else if (is_field (model, j, "constraint_time_seconds")) {
@@ -2092,18 +2092,18 @@ sql_read_tasks (SQLData *data)
type = MRP_TASK_TYPE_MILESTONE;
} else {
type = MRP_TASK_TYPE_NORMAL;
- }
+ }
if (is_fixed_work) {
sched = MRP_TASK_SCHED_FIXED_WORK;
duration = work;
} else {
sched = MRP_TASK_SCHED_FIXED_DURATION;
- }
+ }
constraint.type = constraint_type;
constraint.time = constraint_time;
-
+
task = g_object_new (MRP_TYPE_TASK,
"name", name,
"note", note,
@@ -2116,7 +2116,7 @@ sql_read_tasks (SQLData *data)
"constraint", &constraint,
"project", data->project,
NULL);
-
+
g_free (name);
g_free (note);
@@ -2143,7 +2143,7 @@ sql_read_tasks (SQLData *data)
for (l = tasks; l; l = l->next) {
sql_task_insert_node (hash, tree, l->data);
}
-
+
/* Debug output. */
dump_task_tree (tree);
@@ -2158,7 +2158,7 @@ sql_read_tasks (SQLData *data)
/* Get predecessor relations. */
for (l = tasks; l; l = l->next) {
GNode *node = l->data;
-
+
task_data = node->data;
if (!sql_read_relations (data, task_data->id)) {
g_warning ("Couldn't read predecessor relations.");
@@ -2168,7 +2168,7 @@ sql_read_tasks (SQLData *data)
/* Get resource assignments. */
for (l = tasks; l; l = l->next) {
GNode *node = l->data;
-
+
task_data = node->data;
if (!sql_read_assignments (data, task_data->id)) {
g_warning ("Couldn't read resource assignments.");
@@ -2178,7 +2178,7 @@ sql_read_tasks (SQLData *data)
/* Get property values. */
for (l = tasks; l; l = l->next) {
GNode *node = l->data;
-
+
task_data = node->data;
if (!sql_read_property_values (data, MRP_OBJECT (task_data->task))) {
g_warning ("Couldn't read task properties.");
@@ -2198,12 +2198,12 @@ sql_read_tasks (SQLData *data)
g_node_destroy (tree);
return TRUE;
-
+
out:
if (model) {
g_object_unref (model);
}
-
+
return FALSE;
}
@@ -2229,7 +2229,7 @@ mrp_sql_load_project (MrpStorageSQL *storage,
data = g_new0 (SQLData, 1);
- data->project_id = -1;
+ data->project_id = -1;
/* data->project_id = project_id; */
data->day_id_hash = g_hash_table_new (NULL, NULL);
data->calendar_id_hash = g_hash_table_new (NULL, NULL);
@@ -2246,8 +2246,8 @@ mrp_sql_load_project (MrpStorageSQL *storage,
data->root_task = mrp_task_new ();
db_txt = g_strdup_printf (CONNECTION_FORMAT_STRING, host, database);
- gda_config_save_data_source (dsn_name,
- provider,
+ gda_config_save_data_source (dsn_name,
+ provider,
db_txt,
"planner project", login, password, FALSE);
g_free (db_txt);
@@ -2276,7 +2276,7 @@ mrp_sql_load_project (MrpStorageSQL *storage,
}
gda_dict_set_connection (data->dict, data->con);
- success = sql_execute_command (data->con, "SET TIME ZONE 'UTC'");
+ success = sql_execute_command (data->con, "SET TIME ZONE 'UTC'");
if (!success) {
g_warning ("SET TIME ZONE command failed: %s.",
sql_get_last_error (data->con));
@@ -2310,7 +2310,7 @@ mrp_sql_load_project (MrpStorageSQL *storage,
if (!sql_read_property_values (data, MRP_OBJECT (data->project))) {
g_warning ("Couldn't read project properties.");
}
-
+
/* Get day types. */
if (!sql_read_day_types (data)) {
g_warning ("Couldn't read day types.");
@@ -2350,13 +2350,13 @@ mrp_sql_load_project (MrpStorageSQL *storage,
g_object_unref (data->con);
d(g_print ("Read project, set rev to %d\n", data->revision));
-
+
g_object_set_data (G_OBJECT (storage->project),
REVISION,
GINT_TO_POINTER (data->revision));
return TRUE;
-
+
out:
if (data->dict) {
g_object_unref (data->dict);
@@ -2388,7 +2388,7 @@ sql_write_project (MrpStorageSQL *storage,
gboolean success;
gboolean ret = TRUE;
gchar *query;
-
+
gint project_id;
gint revision;
mrptime project_start;
@@ -2411,14 +2411,14 @@ sql_write_project (MrpStorageSQL *storage,
"name, revision, last_user FROM project WHERE proj_id=%d",
project_id);
success = sql_execute_command (data->con, query);
-
+
g_free (query);
if (!success) {
WRITE_ERROR (error, data->con);
ret = FALSE;
goto out;
}
-
+
model = sql_execute_query (data->con, "FETCH ALL in mycursor");
if (model == NULL) {
WRITE_ERROR (error, data->con);
@@ -2430,27 +2430,27 @@ sql_write_project (MrpStorageSQL *storage,
name = get_string (model, 0, 0);
revision = get_int (model, 0, 1);
last_user = get_string (model, 0, 2);
-
+
g_object_unref (model);
model = NULL;
-
+
sql_execute_command (data->con, "CLOSE mycursor");
-
+
/* Remove the old project. */
d(g_print ("Got old project with id %d (rev %d), remove.\n", project_id, revision));
-
+
query = g_strdup_printf ("DELETE FROM project WHERE proj_id=%d", project_id);
success = sql_execute_command (data->con, query);
g_free (query);
-
+
if (!success) {
WRITE_ERROR (error, data->con);
ret = FALSE;
goto out;
}
-
+
d(g_print ("*** revision: %d, old revision: %d\n", revision, data->revision));
-
+
if (!force && data->revision > 0 && revision != data->revision) {
g_set_error (error,
MRP_ERROR, MRP_ERROR_SAVE_FILE_CHANGED,
@@ -2467,12 +2467,12 @@ sql_write_project (MrpStorageSQL *storage,
last_user = NULL;
name = NULL;
-
+
data->revision = revision + 1;
} else {
g_object_unref (model);
model = NULL;
-
+
data->revision = 1;
}
} else {
@@ -2507,7 +2507,7 @@ sql_write_project (MrpStorageSQL *storage,
name, company, manager, str, data->revision);
}
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
if (!success) {
@@ -2521,7 +2521,7 @@ sql_write_project (MrpStorageSQL *storage,
/* Get the assigned id. */
project_id = get_inserted_id (data, "project_proj_id_seq");
}
-
+
d(g_print ("Inserted project %s, %d\n", name, project_id));
data->project_id = project_id;
@@ -2541,7 +2541,7 @@ sql_write_phases (SQLData *data)
{
gboolean success;
gchar *query;
-
+
GList *phases, *l;
gchar *name;
@@ -2557,7 +2557,7 @@ sql_write_phases (SQLData *data)
"VALUES(%d, %s)",
data->project_id, name);
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
g_free (name);
@@ -2571,7 +2571,7 @@ sql_write_phases (SQLData *data)
mrp_string_list_free (phases);
return TRUE;
-
+
out:
return FALSE;
}
@@ -2581,34 +2581,34 @@ sql_write_phase (SQLData *data)
{
gboolean success;
gchar *query;
-
+
gchar *phase;
-
+
g_object_get (data->project,
"phase", &phase,
NULL);
if (phase && phase[0]) {
sql_quote_and_escape_string (data, &phase, TRUE);
- query = g_strdup_printf ("UPDATE project SET phase=%s WHERE proj_id=%d",
+ query = g_strdup_printf ("UPDATE project SET phase=%s WHERE proj_id=%d",
phase, data->project_id);
} else {
- query = g_strdup_printf ("UPDATE project SET phase=NULL WHERE proj_id=%d",
+ query = g_strdup_printf ("UPDATE project SET phase=NULL WHERE proj_id=%d",
data->project_id);
}
-
- success = sql_execute_command (data->con, query);
+
+ success = sql_execute_command (data->con, query);
g_free (query);
g_free (phase);
-
+
if (!success) {
g_warning ("UPDATE command failed (phase) %s.",
sql_get_last_error (data->con));
goto out;
}
-
+
return TRUE;
-
+
out:
return FALSE;
}
@@ -2628,14 +2628,14 @@ property_type_to_string (MrpPropertyType type)
case MRP_PROPERTY_TYPE_DURATION:
return "duration";
case MRP_PROPERTY_TYPE_DATE:
- return "date";
+ return "date";
case MRP_PROPERTY_TYPE_COST:
- return "cost";
+ return "cost";
default:
g_warning ("Not implemented support for type %d", type);
break;
}
-
+
return "";
}
@@ -2649,9 +2649,9 @@ property_to_string (MrpObject *object,
gint i;
gfloat f;
mrptime date;
-
+
name = mrp_property_get_name (property);
-
+
switch (mrp_property_get_property_type (property)) {
case MRP_PROPERTY_TYPE_STRING:
mrp_object_get (object, name, &str, NULL);
@@ -2671,7 +2671,7 @@ property_to_string (MrpObject *object,
return g_strdup_printf ("%d", i);
case MRP_PROPERTY_TYPE_DATE:
mrp_object_get (object, name, &date, NULL);
- str = mrp_time_to_string (date);
+ str = mrp_time_to_string (date);
return str;
case MRP_PROPERTY_TYPE_COST:
mrp_object_get (object, name, &f, NULL);
@@ -2691,7 +2691,7 @@ sql_write_specific_property_specs (SQLData *data, GList *properties, const gchar
{
gboolean success;
gchar *query;
-
+
GList *l;
const gchar *name, *label, *description, *type;
gchar *quoted_name, *quoted_label, *quoted_description, *quoted_type;
@@ -2714,10 +2714,10 @@ sql_write_specific_property_specs (SQLData *data, GList *properties, const gchar
query = g_strdup_printf ("INSERT INTO property_type(proj_id, name, label, type, owner, descr) "
"VALUES(%d, %s, %s, %s, '%s', %s)",
data->project_id,
- quoted_name, quoted_label,
- quoted_type, owner,
+ quoted_name, quoted_label,
+ quoted_type, owner,
quoted_description);
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
g_free (quoted_name);
@@ -2738,7 +2738,7 @@ sql_write_specific_property_specs (SQLData *data, GList *properties, const gchar
}
return TRUE;
-
+
out:
return FALSE;
}
@@ -2776,7 +2776,7 @@ sql_write_property_values (SQLData *data,
{
gboolean success;
gchar *query;
-
+
GType object_type;
GList *properties, *l;
const gchar *name, *label, *description, *type;
@@ -2793,7 +2793,7 @@ sql_write_property_values (SQLData *data,
properties = mrp_project_get_properties_from_type (data->project, object_type);
for (l = properties; l; l = l->next) {
property = l->data;
-
+
if (mrp_property_get_property_type (property) == MRP_PROPERTY_TYPE_STRING_LIST) {
g_warning ("Don't support string list.");
continue;
@@ -2805,7 +2805,7 @@ sql_write_property_values (SQLData *data,
type = property_type_to_string (mrp_property_get_property_type (property));
property_type_id = get_hash_data_as_id (data->property_type_hash, property);
-
+
value = property_to_string (object, property);
if (value) {
@@ -2816,8 +2816,8 @@ sql_write_property_values (SQLData *data,
query = g_strdup_printf ("INSERT INTO property(proptype_id, value) "
"VALUES(%d, NULL)", property_type_id);
}
-
- success = sql_execute_command (data->con, query);
+
+ success = sql_execute_command (data->con, query);
g_free (query);
g_free (value);
@@ -2846,12 +2846,12 @@ sql_write_property_values (SQLData *data,
object_id = -1;
g_assert_not_reached ();
}
-
+
query = g_strdup_printf ("INSERT INTO %s "
"VALUES(%d, %d)",
str,
object_id, id);
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
if (!success) {
@@ -2862,7 +2862,7 @@ sql_write_property_values (SQLData *data,
}
return TRUE;
-
+
out:
return FALSE;
}
@@ -2872,7 +2872,7 @@ sql_write_day_types (SQLData *data)
{
gboolean success;
gchar *query;
-
+
GList *days, *l;
MrpDay *day;
gint id;
@@ -2891,7 +2891,7 @@ sql_write_day_types (SQLData *data)
day = l->data;
is_work = "false";
-
+
if (day == mrp_day_get_work ()) {
is_work = "true";
is_nonwork = "false";
@@ -2909,13 +2909,13 @@ sql_write_day_types (SQLData *data)
quoted_day_name = sql_quote_and_escape_const_string (data, day_name);
quoted_day_description = sql_quote_and_escape_const_string (data, day_description);
-
+
query = g_strdup_printf ("INSERT INTO daytype(proj_id, name, descr, is_work, is_nonwork) "
"VALUES(%d, %s, %s, %s, %s)",
data->project_id,
quoted_day_name, quoted_day_description,
is_work, is_nonwork);
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
g_free (quoted_day_name);
@@ -2934,9 +2934,9 @@ sql_write_day_types (SQLData *data)
}
g_list_free (days);
-
+
return TRUE;
-
+
out:
return FALSE;
}
@@ -2946,7 +2946,7 @@ get_day_id_string (SQLData *data, MrpCalendar *calendar, gint weekday)
{
MrpDay *day;
gint day_id;
-
+
day = mrp_calendar_get_default_day (calendar, weekday);
day_id = get_hash_data_as_id (data->day_hash, day);
@@ -2964,7 +2964,7 @@ sql_write_overridden_day_type (SQLData *data,
{
gboolean success;
gchar *query;
-
+
GList *l;
gint calendar_id;
gint day_type_id;
@@ -2974,10 +2974,10 @@ sql_write_overridden_day_type (SQLData *data,
calendar_id = get_hash_data_as_id (data->calendar_hash, calendar);
day_type_id = get_hash_data_as_id (data->day_hash, day_ivals->day);
-
+
for (l = day_ivals->intervals; l; l = l->next) {
ival = l->data;
-
+
mrp_interval_get_absolute (ival, 0, &start, &end);
start_string = mrp_time_format ("%H:%M:%S+0", start);
@@ -2985,12 +2985,12 @@ sql_write_overridden_day_type (SQLData *data,
sql_quote_and_escape_string (data, &start_string, TRUE);
sql_quote_and_escape_string (data, &end_string, TRUE);
-
+
query = g_strdup_printf ("INSERT INTO day_interval(cal_id, dtype_id, start_time, end_time) "
"VALUES(%d, %d, %s, %s)",
calendar_id, day_type_id,
start_string, end_string);
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
g_free (start_string);
g_free (end_string);
@@ -3003,7 +3003,7 @@ sql_write_overridden_day_type (SQLData *data,
}
return TRUE;
-
+
out:
return FALSE;
}
@@ -3015,7 +3015,7 @@ sql_write_overridden_dates (SQLData *data,
{
gboolean success;
gchar *query;
-
+
gint calendar_id;
gint day_type_id;
gchar *date_string;
@@ -3030,7 +3030,7 @@ sql_write_overridden_dates (SQLData *data,
query = g_strdup_printf ("INSERT INTO day(cal_id, dtype_id, date) "
"VALUES(%d, %d, %s)",
calendar_id, day_type_id, date_string);
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
g_free (date_string);
@@ -3041,7 +3041,7 @@ sql_write_overridden_dates (SQLData *data,
}
return TRUE;
-
+
out:
return FALSE;
}
@@ -3053,7 +3053,7 @@ sql_write_calendars_recurse (SQLData *data,
{
gboolean success;
gchar *query;
-
+
GList *list, *l;
gint id;
gint parent_id;
@@ -3079,14 +3079,14 @@ sql_write_calendars_recurse (SQLData *data,
sun = get_day_id_string (data, calendar, MRP_CALENDAR_DAY_SUN);
name = sql_quote_and_escape_const_string (data, mrp_calendar_get_name (calendar));
-
+
query = g_strdup_printf ("INSERT INTO calendar(proj_id, parent_cid, name, "
"day_mon, day_tue, day_wed, day_thu, day_fri, day_sat, day_sun) "
"VALUES(%d, %s, %s, "
"%s, %s, %s, %s, %s, %s, %s)",
data->project_id, parent_id_string, name,
mon, tue, wed, thu, fri, sat, sun);
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
g_free (mon);
g_free (tue);
@@ -3095,18 +3095,18 @@ sql_write_calendars_recurse (SQLData *data,
g_free (fri);
g_free (sat);
g_free (sun);
-
+
if (!success) {
g_warning ("INSERT command failed (calendar) %s.",
sql_get_last_error (data->con));
goto out;
}
-
+
id = get_inserted_id (data, "calendar_cal_id_seq");
d(g_print ("Inserted calendar %s, %d\n", name, id));
g_hash_table_insert (data->calendar_hash, calendar, GINT_TO_POINTER (id));
-
+
g_free (name);
g_free (parent_id_string);
@@ -3125,7 +3125,7 @@ sql_write_calendars_recurse (SQLData *data,
goto out;
}
}
-
+
/* Write the calendar's children. */
list = mrp_calendar_get_children (calendar);
for (l = list; l; l = l->next) {
@@ -3133,9 +3133,9 @@ sql_write_calendars_recurse (SQLData *data,
goto out;
}
}
-
+
return TRUE;
-
+
out:
return FALSE;
}
@@ -3162,35 +3162,35 @@ sql_write_calendar_id (SQLData *data)
{
gboolean success;
gchar *query;
-
+
MrpCalendar *calendar;
gint id;
g_object_get (data->project,
"calendar", &calendar,
NULL);
-
+
id = get_hash_data_as_id (data->calendar_hash, calendar);
if (id != -1) {
- query = g_strdup_printf ("UPDATE project SET cal_id=%d WHERE proj_id=%d",
+ query = g_strdup_printf ("UPDATE project SET cal_id=%d WHERE proj_id=%d",
id, data->project_id);
} else {
- query = g_strdup_printf ("UPDATE project SET cal_id=NULL WHERE proj_id=%d",
+ query = g_strdup_printf ("UPDATE project SET cal_id=NULL WHERE proj_id=%d",
data->project_id);
}
-
- success = sql_execute_command (data->con, query);
+
+ success = sql_execute_command (data->con, query);
g_free (query);
-
+
if (!success) {
g_warning ("UPDATE command failed (cal_id) %s.",
sql_get_last_error (data->con));
goto out;
}
-
+
return TRUE;
-
+
out:
return FALSE;
}
@@ -3200,9 +3200,9 @@ sql_write_groups (SQLData *data)
{
gboolean success;
gchar *query;
-
+
GList *groups, *l;
- gchar *name, *manager_name, *manager_phone, *manager_email;
+ gchar *name, *manager_name, *manager_phone, *manager_email;
MrpGroup *group;
gint id;
@@ -3221,13 +3221,13 @@ sql_write_groups (SQLData *data)
sql_quote_and_escape_string (data, &manager_name, TRUE);
sql_quote_and_escape_string (data, &manager_phone, TRUE);
sql_quote_and_escape_string (data, &manager_email, TRUE);
-
+
query = g_strdup_printf ("INSERT INTO resource_group(proj_id, name, admin_name, admin_phone, admin_email) "
"VALUES(%d, %s, %s, %s, %s)",
data->project_id,
name,
manager_name, manager_phone, manager_email);
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
if (!success) {
@@ -3240,7 +3240,7 @@ sql_write_groups (SQLData *data)
d(g_print ("Inserted group %s, %d\n", name, id));
g_hash_table_insert (data->group_hash, group, GINT_TO_POINTER (id));
-
+
g_free (name);
g_free (manager_name);
g_free (manager_phone);
@@ -3248,7 +3248,7 @@ sql_write_groups (SQLData *data)
}
return TRUE;
-
+
out:
return FALSE;
}
@@ -3258,27 +3258,27 @@ sql_write_default_group_id (SQLData *data)
{
gboolean success;
gchar *query;
-
+
MrpGroup *group;
gint id;
g_object_get (data->project,
"default_group", &group,
NULL);
-
+
id = get_hash_data_as_id (data->group_hash, group);
if (id != -1) {
- query = g_strdup_printf ("UPDATE project SET default_group_id=%d WHERE proj_id=%d",
+ query = g_strdup_printf ("UPDATE project SET default_group_id=%d WHERE proj_id=%d",
id, data->project_id);
} else {
- query = g_strdup_printf ("UPDATE project SET default_group_id=NULL WHERE proj_id=%d",
+ query = g_strdup_printf ("UPDATE project SET default_group_id=NULL WHERE proj_id=%d",
data->project_id);
}
-
- success = sql_execute_command (data->con, query);
+
+ success = sql_execute_command (data->con, query);
g_free (query);
-
+
if (!success) {
g_warning ("UPDATE command failed (default_group_id) %s.",
sql_get_last_error (data->con));
@@ -3296,9 +3296,9 @@ sql_write_resources (SQLData *data)
{
gboolean success;
gchar *query;
-
+
GList *resources, *l;
- gchar *name, *short_name, *email, *note;
+ gchar *name, *short_name, *email, *note;
MrpResource *resource;
MrpCalendar *calendar;
MrpGroup *group;
@@ -3311,7 +3311,7 @@ sql_write_resources (SQLData *data)
gchar *cal_id_string;
gchar *group_id_string;
-
+
resources = mrp_project_get_resources (data->project);
for (l = resources; l; l = l->next) {
resource = l->data;
@@ -3356,7 +3356,7 @@ sql_write_resources (SQLData *data)
data->project_id, group_id_string, name,
short_name, email, note, is_worker, (double) units,
cal_id_string);
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
g_free (cal_id_string);
g_free (group_id_string);
@@ -3373,9 +3373,9 @@ sql_write_resources (SQLData *data)
id = get_inserted_id (data, "resource_res_id_seq");
d(g_print ("Inserted resource %s, %d\n", name, id));
-
+
g_hash_table_insert (data->resource_hash, resource, GINT_TO_POINTER (id));
-
+
g_free (name);
}
@@ -3387,9 +3387,9 @@ sql_write_resources (SQLData *data)
goto out;
}
}
-
+
return TRUE;
-
+
out:
return FALSE;
}
@@ -3398,9 +3398,9 @@ static gboolean
sql_write_tasks (SQLData *data)
{
gboolean success;
- gchar *query;
+ gchar *query;
GList *tasks, *l;
- gchar *name, *note;
+ gchar *name, *note;
MrpTask *task;
MrpTask *parent;
MrpTaskType type;
@@ -3429,7 +3429,7 @@ sql_write_tasks (SQLData *data)
gint resource_id;
MrpAssignment *assignment;
MrpResource *resource;
-
+
/* Note: we depend on the tasks being returned with parents before
* children.
*/
@@ -3450,7 +3450,7 @@ sql_write_tasks (SQLData *data)
"sched", &sched,
"constraint", &constraint,
NULL);
-
+
parent = mrp_task_get_parent (task);
parent_id = get_hash_data_as_id (data->task_hash, parent);
@@ -3459,7 +3459,7 @@ sql_write_tasks (SQLData *data)
} else {
parent_id_string = g_strdup ("NULL");
}
-
+
if (type == MRP_TASK_TYPE_MILESTONE) {
work = 0;
duration = 0;
@@ -3467,13 +3467,13 @@ sql_write_tasks (SQLData *data)
} else {
is_milestone = "false";
}
-
+
if (sched == MRP_TASK_SCHED_FIXED_WORK) {
is_fixed_work = "true";
} else {
is_fixed_work = "false";
}
-
+
start_string = mrp_time_format ("%Y-%m-%d %H:%M:%S+0", start);
finish_string = mrp_time_format ("%Y-%m-%d %H:%M:%S+0", finish);
@@ -3512,7 +3512,7 @@ sql_write_tasks (SQLData *data)
sql_quote_and_escape_string (data, ¬e, TRUE);
sql_quote_and_escape_string (data, &start_string, TRUE);
sql_quote_and_escape_string (data, &finish_string, TRUE);
-
+
query = g_strdup_printf ("INSERT INTO task(proj_id, parent_id, name, "
"note, start, finish, work, duration, "
"percent_complete, is_milestone, is_fixed_work, "
@@ -3526,7 +3526,7 @@ sql_write_tasks (SQLData *data)
percent_complete, is_milestone, is_fixed_work,
constraint_type, constraint_time, priority);
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
g_free (start_string);
g_free (finish_string);
@@ -3545,7 +3545,7 @@ sql_write_tasks (SQLData *data)
d(g_print ("Inserted task %s, %d under %d\n", name, id, parent_id));
g_hash_table_insert (data->task_hash, task, GINT_TO_POINTER (id));
-
+
g_free (name);
}
@@ -3582,14 +3582,14 @@ sql_write_tasks (SQLData *data)
id = get_hash_data_as_id (data->task_hash, task);
pred_id = get_hash_data_as_id (data->task_hash, predecessor);
-
+
query = g_strdup_printf ("INSERT INTO predecessor(task_id, pred_task_id, "
"type, lag) "
"VALUES(%d, %d, '%s', %d)",
id, pred_id, relation_type, lag);
- success = sql_execute_command (data->con, query);
+ success = sql_execute_command (data->con, query);
g_free (query);
-
+
if (!success) {
g_warning ("INSERT command failed (predecessor) %s.",
sql_get_last_error (data->con));
@@ -3606,16 +3606,16 @@ sql_write_tasks (SQLData *data)
goto out;
}
}
-
+
/* Write resource assignments. */
for (l = tasks; l; l = l->next) {
task = l->data;
assignments = mrp_task_get_assignments (task);
-
+
for (a = assignments; a; a = a->next) {
gchar tmp[G_ASCII_DTOSTR_BUF_SIZE];
-
+
assignment = a->data;
resource = mrp_assignment_get_resource (assignment);
@@ -3624,15 +3624,15 @@ sql_write_tasks (SQLData *data)
id = get_hash_data_as_id (data->task_hash, task);
resource_id = get_hash_data_as_id (data->resource_hash, resource);
- g_ascii_dtostr (tmp, G_ASCII_DTOSTR_BUF_SIZE, units / 100.0);
-
+ g_ascii_dtostr (tmp, G_ASCII_DTOSTR_BUF_SIZE, units / 100.0);
+
query = g_strdup_printf ("INSERT INTO allocation(task_id, res_id, units) "
"VALUES(%d, %d, %s)",
id, resource_id, tmp);
-
- success = sql_execute_command (data->con, query);
+
+ success = sql_execute_command (data->con, query);
g_free (query);
-
+
if (!success) {
g_warning ("INSERT command failed (allocation) %s.",
sql_get_last_error (data->con));
@@ -3640,11 +3640,11 @@ sql_write_tasks (SQLData *data)
}
}
}
-
+
g_list_free (tasks);
-
+
return TRUE;
-
+
out:
return FALSE;
}
@@ -3682,11 +3682,11 @@ mrp_sql_save_project (MrpStorageSQL *storage,
data->task_hash = g_hash_table_new (NULL, NULL);
data->resource_hash = g_hash_table_new (NULL, NULL);
data->property_type_hash = g_hash_table_new (NULL, NULL);
-
+
data->project = storage->project;
db_txt = g_strdup_printf (CONNECTION_FORMAT_STRING, host, database);
- gda_config_save_data_source (dsn_name,
+ gda_config_save_data_source (dsn_name,
provider,
db_txt,
"planner project", user, password, FALSE);
@@ -3695,8 +3695,8 @@ mrp_sql_save_project (MrpStorageSQL *storage,
client = gda_client_new ();
data->con = gda_client_open_connection (client, dsn_name, NULL, NULL, 0, error);
-
- data->revision = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (data->project),
+
+ data->revision = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (data->project),
REVISION));
if (!GDA_IS_CONNECTION (data->con)) {
@@ -3715,7 +3715,7 @@ mrp_sql_save_project (MrpStorageSQL *storage,
}
gda_dict_set_connection (data->dict, data->con);
- success = sql_execute_command (data->con, "SET TIME ZONE 'UTC'");
+ success = sql_execute_command (data->con, "SET TIME ZONE 'UTC'");
if (!success) {
g_warning ("SET TIME ZONE command failed: %s.",
@@ -3759,17 +3759,17 @@ mrp_sql_save_project (MrpStorageSQL *storage,
if (!sql_write_day_types (data)) {
g_warning ("Couldn't write day types.");
}
-
+
/* Write calendars. */
if (!sql_write_calendars (data)) {
g_warning ("Couldn't write calendars.");
}
-
+
/* Write project calendar id. */
if (!sql_write_calendar_id (data)) {
g_warning ("Couldn't write project calendar id.");
}
-
+
/* Write resource groups. */
if (!sql_write_groups (data)) {
g_warning ("Couldn't write resource groups.");
@@ -3779,7 +3779,7 @@ mrp_sql_save_project (MrpStorageSQL *storage,
if (!sql_write_default_group_id (data)) {
g_warning ("Couldn't write default groups.");
}
-
+
/* Write resources. */
if (!sql_write_resources (data)) {
g_warning ("Couldn't write resources.");
@@ -3793,18 +3793,18 @@ mrp_sql_save_project (MrpStorageSQL *storage,
sql_execute_command (data->con, "COMMIT");
d(g_print ("Write project, set rev to %d\n", data->revision));
-
+
g_object_set_data (G_OBJECT (data->project), REVISION, GINT_TO_POINTER (data->revision));
*project_id = data->project_id;
-
+
ret = TRUE;
-
+
out:
if (data->con) {
g_object_unref (data->con);
}
-
+
/* FIXME: free more data */
g_hash_table_destroy (data->day_id_hash);
@@ -3822,9 +3822,9 @@ mrp_sql_save_project (MrpStorageSQL *storage,
g_list_free (data->calendars);
g_list_free (data->tasks);
-
+
g_free (data);
-
+
return ret;
}
diff --git a/libplanner/mrp-storage-module-factory.c b/libplanner/mrp-storage-module-factory.c
index 14ef1c1..c12521d 100644
--- a/libplanner/mrp-storage-module-factory.c
+++ b/libplanner/mrp-storage-module-factory.c
@@ -55,12 +55,12 @@ mrp_storage_module_factory_get_type (void)
(GInstanceInitFunc) storage_module_factory_init,
};
- object_type =
- g_type_register_static (G_TYPE_TYPE_MODULE,
- "MrpStorageModuleFactory",
+ object_type =
+ g_type_register_static (G_TYPE_TYPE_MODULE,
+ "MrpStorageModuleFactory",
&object_info, 0);
}
-
+
return object_type;
}
@@ -87,20 +87,20 @@ storage_module_factory_load (GTypeModule *module)
MrpStorageModuleFactory *factory = MRP_STORAGE_MODULE_FACTORY (module);
/*g_print ("Load '%s'\n", factory->name);*/
-
+
factory->library = g_module_open (factory->name, 0);
if (!factory->library) {
g_warning (g_module_error ());
return FALSE;
}
-
+
/* These must be implemented by all storage modules. */
if (!g_module_symbol (factory->library, "module_init", (gpointer)&factory->init) ||
!g_module_symbol (factory->library, "module_new", (gpointer)&factory->new) ||
!g_module_symbol (factory->library, "module_exit", (gpointer)&factory->exit)) {
g_warning (g_module_error ());
g_module_close (factory->library);
-
+
return FALSE;
}
@@ -121,7 +121,7 @@ storage_module_factory_unload (GTypeModule *module)
g_module_close (factory->library);
factory->library = NULL;
-
+
factory->init = NULL;
factory->exit = NULL;
}
@@ -138,7 +138,7 @@ mrp_storage_module_factory_get (const gchar *name)
path = mrp_paths_get_storagemodule_dir (NULL);
libname = g_module_build_path (path, fullname);
g_free (path);
-
+
if (!module_hash) {
module_hash = g_hash_table_new (g_str_hash, g_str_equal);
}
@@ -149,12 +149,12 @@ mrp_storage_module_factory_get (const gchar *name)
factory = g_object_new (MRP_TYPE_STORAGE_MODULE_FACTORY, NULL);
g_type_module_set_name (G_TYPE_MODULE (factory), libname);
factory->name = libname;
-
+
g_hash_table_insert (module_hash, factory->name, factory);
}
g_free (fullname);
-
+
if (!g_type_module_use (G_TYPE_MODULE (factory))) {
return NULL;
}
@@ -168,7 +168,7 @@ mrp_storage_module_factory_create_module (MrpStorageModuleFactory *factory)
MrpStorageModule *module;
module = factory->new ();
-
+
return module;
}
diff --git a/libplanner/mrp-storage-module-xml.c b/libplanner/mrp-storage-module-xml.c
index 74a08e4..31910f5 100644
--- a/libplanner/mrp-storage-module-xml.c
+++ b/libplanner/mrp-storage-module-xml.c
@@ -49,7 +49,7 @@ mrp_storage_module_xml_register_type (GTypeModule *module)
0, /* n_preallocs */
(GInstanceInitFunc) mpsm_xml_init,
};
-
+
static const GInterfaceInfo project_storage_info = {
(GInterfaceInitFunc) mpsm_xml_ps_init, /* interface_init */
NULL, /* interface_finalize */
@@ -58,8 +58,8 @@ mrp_storage_module_xml_register_type (GTypeModule *module)
static const GInterfaceInfo task_storage_info = {
(GInterfaceInitFunc) mpsm_xml_ts_init,
- NULL,
- NULL
+ NULL,
+ NULL
};
static const GInterfaceInfo resource_storage_info = {
@@ -73,7 +73,7 @@ mrp_storage_module_xml_register_type (GTypeModule *module)
MRP_TYPE_STORAGE_MODULE,
"MrPStorageModuleXML",
&object_info, 0);
-
+
g_type_add_interface_static (mrp_storage_module_xml_type,
MRP_TYPE_PROJECT_STORAGE,
&project_storage_info);
diff --git a/libplanner/mrp-storage-module.c b/libplanner/mrp-storage-module.c
index 5ec93b0..beef6eb 100644
--- a/libplanner/mrp-storage-module.c
+++ b/libplanner/mrp-storage-module.c
@@ -50,8 +50,8 @@ mrp_storage_module_get_type (void)
(GInstanceInitFunc) storage_module_init,
};
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "MrpStorageModule",
+ object_type = g_type_register_static (G_TYPE_OBJECT,
+ "MrpStorageModule",
&object_info, 0);
}
@@ -72,7 +72,7 @@ storage_module_class_init (MrpStorageModuleClass *klass)
}
gboolean
-mrp_storage_module_load (MrpStorageModule *module,
+mrp_storage_module_load (MrpStorageModule *module,
const gchar *uri,
GError **error)
{
@@ -89,7 +89,7 @@ mrp_storage_module_load (MrpStorageModule *module,
}
gboolean
-mrp_storage_module_save (MrpStorageModule *module,
+mrp_storage_module_save (MrpStorageModule *module,
const gchar *uri,
gboolean force,
GError **error)
@@ -98,7 +98,7 @@ mrp_storage_module_save (MrpStorageModule *module,
g_return_val_if_fail (uri != NULL, FALSE);
if (MRP_STORAGE_MODULE_GET_CLASS (module)->save) {
- return MRP_STORAGE_MODULE_GET_CLASS (module)->save (module,
+ return MRP_STORAGE_MODULE_GET_CLASS (module)->save (module,
uri,
force,
error);
@@ -108,14 +108,14 @@ mrp_storage_module_save (MrpStorageModule *module,
}
gboolean
-mrp_storage_module_to_xml (MrpStorageModule *module,
+mrp_storage_module_to_xml (MrpStorageModule *module,
gchar **str,
GError **error)
{
g_return_val_if_fail (MRP_IS_STORAGE_MODULE (module), FALSE);
if (MRP_STORAGE_MODULE_GET_CLASS (module)->to_xml) {
- return MRP_STORAGE_MODULE_GET_CLASS (module)->to_xml (module,
+ return MRP_STORAGE_MODULE_GET_CLASS (module)->to_xml (module,
str,
error);
}
@@ -124,15 +124,15 @@ mrp_storage_module_to_xml (MrpStorageModule *module,
}
gboolean
-mrp_storage_module_from_xml (MrpStorageModule *module,
+mrp_storage_module_from_xml (MrpStorageModule *module,
const gchar *str,
GError **error)
{
g_return_val_if_fail (MRP_IS_STORAGE_MODULE (module), FALSE);
g_return_val_if_fail (str != NULL, FALSE);
-
+
if (MRP_STORAGE_MODULE_GET_CLASS (module)->from_xml) {
- return MRP_STORAGE_MODULE_GET_CLASS (module)->from_xml (module,
+ return MRP_STORAGE_MODULE_GET_CLASS (module)->from_xml (module,
str,
error);
}
@@ -148,7 +148,7 @@ imrp_storage_module_set_project (MrpStorageModule *module,
g_return_if_fail (MRP_IS_PROJECT (project));
if (MRP_STORAGE_MODULE_GET_CLASS (module)->set_project) {
- MRP_STORAGE_MODULE_GET_CLASS (module)->set_project (module,
+ MRP_STORAGE_MODULE_GET_CLASS (module)->set_project (module,
project);
}
}
diff --git a/libplanner/mrp-storage-module.h b/libplanner/mrp-storage-module.h
index c35eb09..5da4f8b 100644
--- a/libplanner/mrp-storage-module.h
+++ b/libplanner/mrp-storage-module.h
@@ -96,7 +96,7 @@ gboolean mrp_storage_module_save (MrpStorageModule *module,
gboolean mrp_storage_module_to_xml (MrpStorageModule *module,
gchar **str,
GError **error);
-gboolean mrp_storage_module_from_xml (MrpStorageModule *module,
+gboolean mrp_storage_module_from_xml (MrpStorageModule *module,
const gchar *str,
GError **error);
diff --git a/libplanner/mrp-storage-mrproject.c b/libplanner/mrp-storage-mrproject.c
index 5d3fa81..b3fda64 100644
--- a/libplanner/mrp-storage-mrproject.c
+++ b/libplanner/mrp-storage-mrproject.c
@@ -69,7 +69,7 @@ mrp_storage_mrproject_register_type (GTypeModule *module)
0, /* n_preallocs */
(GInstanceInitFunc) mpsm_init,
};
-
+
mrp_storage_mrproject_type = g_type_module_register_type (
module,
MRP_TYPE_STORAGE_MODULE,
@@ -124,7 +124,7 @@ mpsm_process_delayed_relations (MrpStorageMrproject *sm)
GList *l;
MrpTask *task, *predecessor_task;
DelayedRelation *relation;
-
+
for (l = sm->delayed_relations; l; l = l->next) {
relation = l->data;
@@ -153,13 +153,13 @@ mpsm_load (MrpStorageModule *module, const gchar *uri, GError **error)
MrpTaskManager *task_manager;
MrpAssignment *assignment;
GList *node;
-
+
g_return_val_if_fail (MRP_IS_STORAGE_MRPROJECT (module), FALSE);
sm = MRP_STORAGE_MRPROJECT (module);
-
+
/* FIXME: Check that we don't load twice? Free before loading? */
-
+
#if 0
if (!mrp_parser_load (MRP_STORAGE_MRPROJECT (module), uri, error)) {
return FALSE;
@@ -167,7 +167,7 @@ mpsm_load (MrpStorageModule *module, const gchar *uri, GError **error)
#endif
task_manager = imrp_project_get_task_manager (sm->project);
-
+
mrp_task_manager_set_root (task_manager,
sm->root_task);
@@ -180,7 +180,7 @@ mpsm_load (MrpStorageModule *module, const gchar *uri, GError **error)
g_hash_table_destroy (sm->task_id_hash);
g_list_free (sm->delayed_relations);
-
+
imrp_project_set_groups (sm->project, sm->groups);
for (node = sm->assignments; node; node = node->next) {
@@ -197,7 +197,7 @@ mpsm_load (MrpStorageModule *module, const gchar *uri, GError **error)
}
static gboolean
-mpsm_save (MrpStorageModule *module,
+mpsm_save (MrpStorageModule *module,
const gchar *uri,
gboolean force,
GError **error)
@@ -211,7 +211,7 @@ mpsm_save (MrpStorageModule *module,
}
static gboolean
-mpsm_to_xml (MrpStorageModule *module,
+mpsm_to_xml (MrpStorageModule *module,
gchar **str,
GError **error)
{
@@ -223,7 +223,7 @@ mpsm_to_xml (MrpStorageModule *module,
}
static gboolean
-mpsm_from_xml (MrpStorageModule *module,
+mpsm_from_xml (MrpStorageModule *module,
const gchar *str,
GError **error)
{
diff --git a/libplanner/mrp-storage-mrproject.h b/libplanner/mrp-storage-mrproject.h
index 029f6c4..e3d0541 100644
--- a/libplanner/mrp-storage-mrproject.h
+++ b/libplanner/mrp-storage-mrproject.h
@@ -45,7 +45,7 @@ struct _MrpStorageMrproject
MrpStorageModule parent;
MrpProject *project;
-
+
MrpTask *root_task;
GHashTable *task_id_hash;
GList *delayed_relations;
diff --git a/libplanner/mrp-storage-sql.c b/libplanner/mrp-storage-sql.c
index 7d29d83..8e8d942 100644
--- a/libplanner/mrp-storage-sql.c
+++ b/libplanner/mrp-storage-sql.c
@@ -66,7 +66,7 @@ mrp_storage_sql_register_type (GTypeModule *module)
0, /* n_preallocs */
(GInstanceInitFunc) storage_sql_init,
};
-
+
mrp_storage_sql_type = g_type_module_register_type (
module,
MRP_TYPE_STORAGE_MODULE,
@@ -125,7 +125,7 @@ strdup_null_if_empty (const gchar *str)
g_free (tmp);
return NULL;
}
-
+
return tmp;
}
@@ -141,21 +141,21 @@ create_sql_uri (const gchar *server,
gchar *str;
string = g_string_new ("sql://");
-
+
if (server) {
if (login) {
g_string_append (string, login);
-
+
if (password) {
g_string_append_c (string, ':');
g_string_append (string, password);
}
-
+
g_string_append_c (string, '@');
}
-
+
g_string_append (string, server);
-
+
if (port) {
g_string_append_c (string, ':');
g_string_append (string, port);
@@ -165,14 +165,14 @@ create_sql_uri (const gchar *server,
g_string_append_c (string, '#');
g_string_append_printf (string, "db=%s", database);
-
+
if (project_id != -1) {
g_string_append_printf (string, "&id=%d", project_id);
}
-
+
str = string->str;
g_string_free (string, FALSE);
-
+
return str;
}
@@ -198,7 +198,7 @@ storage_sql_parse_uri (const gchar *uri,
*login = NULL;
*password = NULL;
*project_id = -1;
-
+
if (strncmp (uri, "sql://", 6) != 0 || !strchr (uri, '#')) {
g_set_error (error,
MRP_ERROR,
@@ -206,9 +206,9 @@ storage_sql_parse_uri (const gchar *uri,
_("Invalid SQL URI (must start with 'sql://' and contain '#')."));
return FALSE;
}
-
+
p = uri + 6;
-
+
strs = g_strsplit (p, "#", 2);
location = g_strdup (strs[0]);
args = g_strdup (strs[1]);
@@ -224,7 +224,7 @@ storage_sql_parse_uri (const gchar *uri,
host = strdup_null_if_empty (location);
}
g_free (location);
-
+
if (who && strchr (who, ':')) {
strs = g_strsplit (who, ":", 2);
*login = strdup_null_if_empty (strs[0]);
@@ -237,7 +237,7 @@ storage_sql_parse_uri (const gchar *uri,
strs = g_strsplit (host, ":", 2);
*server = strdup_null_if_empty (strs[0]);
*port = strdup_null_if_empty (strs[1]);
-
+
g_strfreev (strs);
g_free (host);
} else {
@@ -275,7 +275,7 @@ storage_sql_parse_uri (const gchar *uri,
_("Invalid SQL URI (invalid project id)."));
goto fail;
}
-
+
if (*database == NULL) {
g_set_error (error,
MRP_ERROR,
@@ -311,7 +311,7 @@ test_uri_parser (const gchar *uri)
gint project_id;
g_print ("Test: '%s'\n", uri);
-
+
if (storage_sql_parse_uri (uri,
&server,
&port,
@@ -331,7 +331,7 @@ test_uri_parser (const gchar *uri)
g_clear_error (&error);
}
}
-
+
static gboolean
storage_sql_load (MrpStorageModule *module, const gchar *uri, GError **error)
@@ -339,9 +339,9 @@ storage_sql_load (MrpStorageModule *module, const gchar *uri, GError **error)
MrpStorageSQL *sql;
gchar *server, *port, *database, *login, *password;
gint project_id;
-
+
g_return_val_if_fail (MRP_IS_STORAGE_SQL (module), FALSE);
-
+
sql = MRP_STORAGE_SQL (module);
if (0) {
@@ -354,18 +354,18 @@ storage_sql_load (MrpStorageModule *module, const gchar *uri, GError **error)
g_print ("==================\n");
test_uri_parser ("sql://rhult:sliff.sloff#id=12&db=qwerty");
}
-
+
if (!storage_sql_parse_uri (uri, &server, &port, &database, &login, &password, &project_id, error)) {
return FALSE;
}
-
+
mrp_sql_load_project (sql, server, port, database, login, password, project_id, error);
-
+
return TRUE;
}
static gboolean
-storage_sql_save (MrpStorageModule *module,
+storage_sql_save (MrpStorageModule *module,
const gchar *uri,
gboolean force,
GError **error)
@@ -374,9 +374,9 @@ storage_sql_save (MrpStorageModule *module,
gchar *server, *port, *database, *login, *password;
gint project_id;
gchar *new_uri;
-
+
g_return_val_if_fail (MRP_IS_STORAGE_SQL (module), FALSE);
-
+
sql = MRP_STORAGE_SQL (module);
if (!storage_sql_parse_uri (uri, &server, &port, &database, &login, &password, &project_id, error)) {
@@ -386,14 +386,14 @@ storage_sql_save (MrpStorageModule *module,
if (!mrp_sql_save_project (sql, force, server, port, database, login, password, &project_id, error)) {
return FALSE;
}
-
+
new_uri = create_sql_uri (server,
port,
database,
login,
password,
project_id);
-
+
g_object_set_data_full (G_OBJECT (sql), "uri", new_uri, g_free);
return TRUE;
diff --git a/libplanner/mrp-task-manager.c b/libplanner/mrp-task-manager.c
index 22dca26..60f3ee5 100644
--- a/libplanner/mrp-task-manager.c
+++ b/libplanner/mrp-task-manager.c
@@ -39,7 +39,7 @@ struct _MrpTaskManagerPriv {
MrpTask *root;
gboolean block_scheduling;
-
+
/* Whether the dependency graph is valid or needs to be rebuilt. */
gboolean needs_rebuild;
@@ -72,7 +72,7 @@ static void task_manager_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static void
+static void
task_manager_task_duration_notify_cb (MrpTask *task,
GParamSpec *spec,
MrpTaskManager *manager);
@@ -182,7 +182,7 @@ static void
task_manager_init (MrpTaskManager *man)
{
MrpTaskManagerPriv *priv;
-
+
man->priv = g_new0 (MrpTaskManagerPriv, 1);
priv = man->priv;
@@ -212,10 +212,10 @@ task_manager_set_property (GObject *object,
{
MrpTaskManager *manager;
MrpTaskManagerPriv *priv;
-
+
manager = MRP_TASK_MANAGER (object);
priv = manager->priv;
-
+
switch (prop_id) {
case PROP_PROJECT:
priv->project = g_value_get_object (value);
@@ -223,7 +223,7 @@ task_manager_set_property (GObject *object,
"notify::project-start",
G_CALLBACK (task_manager_project_start_notify_cb),
manager);
-
+
mrp_task_manager_set_root (manager, mrp_task_new ());
break;
@@ -233,15 +233,15 @@ task_manager_set_property (GObject *object,
}
static void
-task_manager_get_property (GObject *object,
- guint prop_id,
+task_manager_get_property (GObject *object,
+ guint prop_id,
GValue *value,
GParamSpec *pspec)
{
MrpTaskManager *manager;
manager = MRP_TASK_MANAGER (object);
-
+
switch (prop_id) {
case PROP_PROJECT:
g_value_set_object (value, manager->priv->project);
@@ -257,11 +257,11 @@ MrpTaskManager *
mrp_task_manager_new (MrpProject *project)
{
MrpTaskManager *manager;
-
+
manager = g_object_new (MRP_TYPE_TASK_MANAGER,
"project", project,
NULL);
-
+
return manager;
}
@@ -295,11 +295,11 @@ task_manager_task_connect_signals (MrpTaskManager *manager,
g_signal_connect (task,
"assignment_added",
G_CALLBACK (task_manager_task_assignment_added_cb),
- manager);
+ manager);
g_signal_connect (task,
"assignment_removed",
G_CALLBACK (task_manager_task_assignment_removed_cb),
- manager);
+ manager);
}
/**
@@ -309,9 +309,9 @@ task_manager_task_connect_signals (MrpTaskManager *manager,
* @position: the position to place task at, with respect to its siblings.
* If position is -1, task is inserted as the last child of parent.
* @task: The task to insert.
- *
+ *
* Inserts a task beneath the parent at the given position.
- *
+ *
**/
void
mrp_task_manager_insert_task (MrpTaskManager *manager,
@@ -337,7 +337,7 @@ mrp_task_manager_insert_task (MrpTaskManager *manager,
manager->priv->needs_rebuild = TRUE;
manager->priv->needs_recalc = TRUE;
-
+
imrp_project_task_inserted (manager->priv->project, task);
mrp_task_manager_recalc (manager, TRUE);
@@ -349,7 +349,7 @@ mrp_task_manager_insert_task (MrpTaskManager *manager,
* mrp_task_manager_remove_task:
* @manager: A task manager
* @task: The task to remove.
- *
+ *
* Removes a task, or a task subtree if the task has children. The root task
* (with id 0) cannot be removed.
*
@@ -369,7 +369,7 @@ mrp_task_manager_remove_task (MrpTaskManager *manager,
g_object_set (task,
"project", NULL,
NULL);
-
+
imrp_task_remove_subtree (task);
manager->priv->needs_rebuild = TRUE;
@@ -383,16 +383,16 @@ task_manager_get_all_tasks_cb (GNode *node, GList **list)
if (node->parent != NULL) {
*list = g_list_prepend (*list, node->data);
}
-
+
return FALSE; /* don't stop the traversal */
}
/**
* mrp_task_manager_get_all_tasks:
* @manager: A task manager
- *
+ *
* Gets all the tasks in the project.
- *
+ *
* Return value: A list of all the MrpTasks in the project.
**/
GList *
@@ -405,7 +405,7 @@ mrp_task_manager_get_all_tasks (MrpTaskManager *manager)
if (manager->priv->root == NULL) {
return NULL;
}
-
+
tasks = NULL;
g_node_traverse (imrp_task_get_node (manager->priv->root),
@@ -416,7 +416,7 @@ mrp_task_manager_get_all_tasks (MrpTaskManager *manager)
&tasks);
tasks = g_list_reverse (tasks);
-
+
return tasks;
}
@@ -432,9 +432,9 @@ task_manager_traverse_cb (GNode *node, MrpTaskTraverseData *data)
* @root: The task to start traversing
* @func: A function to call for each traversed task
* @user_data: Argument to pass to the callback
- *
+ *
* Calls %func for the subtree starting at %root, until @func returns %TRUE.
- *
+ *
**/
void
mrp_task_manager_traverse (MrpTaskManager *manager,
@@ -449,7 +449,7 @@ mrp_task_manager_traverse (MrpTaskManager *manager,
data.func = func;
data.user_data = user_data;
-
+
g_node_traverse (imrp_task_get_node (root),
G_PRE_ORDER,
G_TRAVERSE_ALL,
@@ -464,7 +464,7 @@ mrp_task_manager_set_root (MrpTaskManager *manager,
{
GList *tasks, *l;
MrpProject *project;
-
+
g_return_if_fail (MRP_IS_TASK_MANAGER (manager));
g_return_if_fail (task == NULL || MRP_IS_TASK (task));
@@ -475,11 +475,11 @@ mrp_task_manager_set_root (MrpTaskManager *manager,
manager->priv->root = task;
project = manager->priv->project;
-
+
tasks = mrp_task_manager_get_all_tasks (manager);
for (l = tasks; l; l = l->next) {
g_object_set (l->data, "project", project, NULL);
-
+
task_manager_task_connect_signals (manager, l->data);
}
@@ -496,7 +496,7 @@ MrpTask *
mrp_task_manager_get_root (MrpTaskManager *manager)
{
g_return_val_if_fail (MRP_IS_TASK_MANAGER (manager), NULL);
-
+
return manager->priv->root;
}
@@ -511,7 +511,7 @@ mrp_task_manager_move_task (MrpTaskManager *manager,
MrpTask *old_parent;
gint old_pos;
MrpTask *grand_parent;
-
+
g_return_val_if_fail (MRP_IS_TASK_MANAGER (manager), FALSE);
g_return_val_if_fail (MRP_IS_TASK (task), FALSE);
g_return_val_if_fail (sibling == NULL || MRP_IS_TASK (sibling), FALSE);
@@ -536,9 +536,9 @@ mrp_task_manager_move_task (MrpTaskManager *manager,
mrp_task_invalidate_cost (parent);
mrp_task_manager_rebuild (manager);
-
+
imrp_project_task_moved (manager->priv->project, task);
-
+
mrp_task_manager_recalc (manager, FALSE);
return TRUE;
@@ -556,14 +556,14 @@ get_n_chars (gint n, gchar c)
gint i;
str = g_string_new ("");
-
+
for (i = 0; i < n; i++) {
g_string_append_c (str, c);
}
ret = str->str;
g_string_free (str, FALSE);
-
+
return ret;
}
@@ -576,7 +576,7 @@ dump_children (GNode *node, gint depth)
const gchar *name;
padding = get_n_chars (2 * depth, ' ');
-
+
for (child = g_node_first_child (node); child; child = g_node_next_sibling (child)) {
task = (MrpTask *) child->data;
@@ -618,9 +618,9 @@ dump_children (GNode *node, gint depth)
g_print ("\n");
} else {
- g_print ("%s<unknown>\n", padding);
+ g_print ("%s<unknown>\n", padding);
}
-
+
dump_children (child, depth + 1);
}
@@ -632,7 +632,7 @@ task_manager_dump_task_tree (GNode *node)
{
g_return_if_fail (node != NULL);
g_return_if_fail (node->parent == NULL);
-
+
g_print ("------------------------------------------\n<Root>\n");
dump_children (node, 1);
@@ -704,7 +704,7 @@ task_manager_get_ancestor_with_same_parent (MrpTask *task_a, MrpTask *task_b)
task_b = mrp_task_get_parent (task_b);
}
}
-
+
ancestor = NULL;
while (task_a != NULL && task_b != NULL) {
@@ -716,7 +716,7 @@ task_manager_get_ancestor_with_same_parent (MrpTask *task_a, MrpTask *task_b)
task_a = mrp_task_get_parent (task_a);
task_b = mrp_task_get_parent (task_b);
}
-
+
return ancestor;
}
@@ -759,7 +759,7 @@ task_manager_traverse_dependency_graph (MrpTaskManager *manager,
output);
}
}
-
+
/* Follow parent -> child. */
child = mrp_task_get_first_child (task);
while (child) {
@@ -780,11 +780,11 @@ dump_task_node (MrpTask *task)
{
MrpTaskGraphNode *node;
GList *l;
-
+
node = imrp_task_get_graph_node (task);
g_print ("Task: %s\n", mrp_task_get_name (task));
-
+
for (l = node->prev; l; l = l->next) {
g_print (" from %s\n", mrp_task_get_name (l->data));
}
@@ -814,20 +814,20 @@ add_predecessor_to_dependency_graph_recursive (MrpTask *task,
MrpTaskGraphNode *predecessor_node;
MrpTask *child;
MrpTaskGraphNode *child_node;
-
+
predecessor_node = imrp_task_get_graph_node (predecessor);
child = mrp_task_get_first_child (task);
while (child) {
child_node = imrp_task_get_graph_node (child);
-
+
child_node->prev = g_list_append (child_node->prev, predecessor);
predecessor_node->next = g_list_append (predecessor_node->next, child);
-
+
if (mrp_task_get_n_children (child) > 0) {
add_predecessor_to_dependency_graph_recursive (child, predecessor);
}
-
+
child = mrp_task_get_next_sibling (child);
}
}
@@ -840,9 +840,9 @@ add_predecessor_to_dependency_graph (MrpTaskManager *manager,
MrpTaskManagerPriv *priv;
MrpTaskGraphNode *task_node;
MrpTaskGraphNode *predecessor_node;
-
+
priv = manager->priv;
-
+
predecessor_node = imrp_task_get_graph_node (predecessor);
task_node = imrp_task_get_graph_node (task);
@@ -863,20 +863,20 @@ remove_predecessor_from_dependency_graph_recursive (MrpTask *task,
MrpTaskGraphNode *predecessor_node;
MrpTask *child;
MrpTaskGraphNode *child_node;
-
+
predecessor_node = imrp_task_get_graph_node (predecessor);
child = mrp_task_get_first_child (task);
while (child) {
child_node = imrp_task_get_graph_node (child);
-
+
child_node->prev = g_list_remove (child_node->prev, predecessor);
predecessor_node->next = g_list_remove (predecessor_node->next, child);
-
+
if (mrp_task_get_n_children (child) > 0) {
remove_predecessor_from_dependency_graph_recursive (child, predecessor);
}
-
+
child = mrp_task_get_next_sibling (child);
}
}
@@ -889,16 +889,16 @@ remove_predecessor_from_dependency_graph (MrpTaskManager *manager,
MrpTaskManagerPriv *priv;
MrpTaskGraphNode *task_node;
MrpTaskGraphNode *predecessor_node;
-
+
priv = manager->priv;
-
+
predecessor_node = imrp_task_get_graph_node (predecessor);
task_node = imrp_task_get_graph_node (task);
task_node->prev = g_list_remove (task_node->prev, predecessor);
predecessor_node->next = g_list_remove (predecessor_node->next, task);
-
+
/* Remove dependencies from the predecessor to the task's children,
* recursively.
*/
@@ -914,7 +914,7 @@ remove_parent_predecessors_from_dependency_graph (MrpTask *task,
MrpTaskGraphNode *task_node;
GList *list, *l;
MrpRelation *relation;
-
+
/* Remove parent's predecessors from task and all of its children. */
list = imrp_task_peek_predecessors (parent);
for (l = list; l; l = l->next) {
@@ -926,7 +926,7 @@ remove_parent_predecessors_from_dependency_graph (MrpTask *task,
predecessor_node->next = g_list_remove (predecessor_node->next, task);
task_node = imrp_task_get_graph_node (task);
task_node->prev = g_list_remove (task_node->prev, predecessor);
-
+
/* Remove predecessor from all its children */
if (mrp_task_get_n_children (task) > 0) {
remove_predecessor_from_dependency_graph_recursive (task, predecessor);
@@ -944,7 +944,7 @@ remove_parent_from_dependency_graph (MrpTaskManager *manager,
MrpTaskGraphNode *parent_node;
priv = manager->priv;
-
+
task_node = imrp_task_get_graph_node (task);
parent_node = imrp_task_get_graph_node (parent);
@@ -996,7 +996,7 @@ add_parent_to_dependency_graph (MrpTaskManager *manager,
MrpTaskGraphNode *parent_node;
priv = manager->priv;
-
+
task_node = imrp_task_get_graph_node (task);
parent_node = imrp_task_get_graph_node (parent);
@@ -1020,7 +1020,7 @@ remove_task_from_dependency_graph (MrpTaskManager *manager,
MrpTask *predecessor;
priv = manager->priv;
-
+
/* Remove predecessors. */
list = imrp_task_peek_predecessors (task);
for (l = list; l; l = l->next) {
@@ -1047,7 +1047,7 @@ add_task_to_dependency_graph (MrpTaskManager *manager,
MrpTask *predecessor;
priv = manager->priv;
-
+
if (task == priv->root) {
return;
}
@@ -1060,7 +1060,7 @@ add_task_to_dependency_graph (MrpTaskManager *manager,
add_predecessor_to_dependency_graph (manager, task, predecessor);
}
-
+
/* Add the parent. */
if (parent && parent != priv->root) {
add_parent_to_dependency_graph (manager, task, parent);
@@ -1105,7 +1105,7 @@ task_manager_build_dependency_graph (MrpTaskManager *manager)
MrpTask *task;
MrpTaskGraphNode *node;
GList *queue;
-
+
priv = manager->priv;
/* Build a directed, acyclic graph, where relation links and children ->
@@ -1133,7 +1133,7 @@ task_manager_build_dependency_graph (MrpTaskManager *manager)
queue = NULL;
for (l = tasks; l; l = l->next) {
task = l->data;
-
+
node = imrp_task_get_graph_node (task);
if (node->prev == NULL) {
@@ -1144,7 +1144,7 @@ task_manager_build_dependency_graph (MrpTaskManager *manager)
deps = NULL;
while (queue) {
GList *next, *link;
-
+
task = queue->data;
link = queue;
@@ -1155,7 +1155,7 @@ task_manager_build_dependency_graph (MrpTaskManager *manager)
deps->prev = link;
}
deps = link;
-
+
/* Remove this task from all the dependent tasks. */
node = imrp_task_get_graph_node (task);
for (next = node->next; next; next = next->next) {
@@ -1178,7 +1178,7 @@ task_manager_build_dependency_graph (MrpTaskManager *manager)
g_list_free (queue);
g_list_free (tasks);
-
+
mrp_task_manager_traverse (manager,
priv->root,
task_manager_unset_visited_func,
@@ -1193,7 +1193,7 @@ task_manager_build_dependency_graph (MrpTaskManager *manager)
*/
static mrptime
task_manager_calculate_task_start (MrpTaskManager *manager,
- MrpTask *task,
+ MrpTask *task,
gint *duration)
{
MrpTaskManagerPriv *priv;
@@ -1209,7 +1209,7 @@ task_manager_calculate_task_start (MrpTaskManager *manager,
MrpConstraint constraint;
priv = manager->priv;
-
+
project_start = mrp_project_get_project_start (priv->project);
start = project_start;
@@ -1221,7 +1221,7 @@ task_manager_calculate_task_start (MrpTaskManager *manager,
predecessor = mrp_relation_get_predecessor (relation);
type = mrp_relation_get_relation_type (relation);
-
+
switch (type) {
case MRP_RELATION_FF:
/* finish-to-finish */
@@ -1234,7 +1234,7 @@ task_manager_calculate_task_start (MrpTaskManager *manager,
dep_start = start;
break;
-
+
case MRP_RELATION_SF:
/* start-to-finish */
/* predecessor must start before successor can finish */
@@ -1283,7 +1283,7 @@ task_manager_calculate_task_start (MrpTaskManager *manager,
/* Must-start-on. */
start = MAX (project_start, constraint.time);
break;
-
+
case MRP_CONSTRAINT_ASAP:
/* As-soon-as-possible, do nothing. */
break;
@@ -1300,7 +1300,7 @@ task_manager_calculate_task_start (MrpTaskManager *manager,
/* NOTE: MrpUnitsInterval moved in mrp-task.h to enable
other objects to use it. */
-static gint
+static gint
units_interval_sort_func (gconstpointer a, gconstpointer b)
{
MrpUnitsInterval *ai = *(MrpUnitsInterval **) a;
@@ -1317,8 +1317,8 @@ units_interval_sort_func (gconstpointer a, gconstpointer b)
bt = bi->start;
} else {
bt = bi->end;
- }
-
+ }
+
if (at < bt) {
return -1;
}
@@ -1402,14 +1402,14 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
array = g_ptr_array_new ();
priority = mrp_task_get_priority (task);
-
+
#ifdef WITH_SIMPLE_PRIORITY_SCHEDULING
v_tasks = mrp_task_manager_get_all_tasks (manager);
#endif
-
+
for (a = assignments; a; a = a->next) {
assignment = a->data;
-
+
resource = mrp_assignment_get_resource (assignment);
units_orig = mrp_assignment_get_units (assignment);
@@ -1425,13 +1425,13 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
mrp_interval_get_absolute (ival, date, &i_start, &i_end);
units = units_orig;
diffe = i_end - i_start;
-
+
#ifdef WITH_SIMPLE_PRIORITY_SCHEDULING
for (v_l = v_tasks; v_l; v_l = v_l->next) {
MrpTask *v_task;
-
+
v_task = v_l->data;
-
+
if (v_task == task) {
continue;
}
@@ -1443,7 +1443,7 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
/* If intervals not overlapped -> contine. */
v_start = mrp_task_get_work_start (v_task);
v_end = mrp_task_get_finish (v_task);
-
+
if (i_start > v_end || i_end < v_start) {
continue;
}
@@ -1453,13 +1453,13 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
for (v_a = v_assignments; v_a; v_a = v_a->next) {
v_assignment = v_a->data;
-
+
v_resource = mrp_assignment_get_resource (v_assignment);
if (v_resource == resource) {
v_units = mrp_assignment_get_units (v_assignment);
- /*
+ /*
If the dominant cost is compatible with the task
- request -> break.
+ request -> break.
FIXME - tasks that share the vampirised resource not work!
*/
@@ -1468,11 +1468,11 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
}
/* Trim the interval of the dominant task. */
- v_start = (v_start < i_start ?
+ v_start = (v_start < i_start ?
i_start : v_start);
v_end = (v_end > i_end ?
i_end : v_end);
-
+
if (i_start < v_start) {
/*
----...
@@ -1488,13 +1488,13 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
g_ptr_array_add (array, unit_ival_start);
g_ptr_array_add (array, unit_ival_end);
}
-
+
ival = mrp_interval_new (v_start-date, v_end-date);
unit_ival_start = units_interval_new (ival, (100 - v_units), TRUE);
unit_ival_start->units_full = units;
unit_ival_end = units_interval_new (ival, (100 - v_units), FALSE);
- unit_ival_end->units_full = units;
+ unit_ival_end->units_full = units;
g_ptr_array_add (array, unit_ival_start);
g_ptr_array_add (array, unit_ival_end);
@@ -1520,8 +1520,8 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
break;
}
} /* for (v_l = v_tasks; v_l; ... */
-
-
+
+
if (v_l == NULL) {
#endif /* ifdef WITH_SIMPLE_PRIORITY_SCHEDULING */
/* Start of the interval. */
@@ -1545,13 +1545,13 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
*/
if (!assignments) {
calendar = mrp_project_get_calendar (priv->project);
-
+
day = mrp_calendar_get_day (calendar, date, TRUE);
ivals = mrp_calendar_day_get_intervals (calendar, day, TRUE);
-
+
for (l = ivals; l; l = l->next) {
ival = l->data;
-
+
/* Start of the interval. */
unit_ival = units_interval_new (ival, 100, TRUE);
unit_ival->units_full = 100;
@@ -1563,7 +1563,7 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
g_ptr_array_add (array, unit_ival);
}
}
-
+
#ifdef WITH_SIMPLE_PRIORITY_SCHEDULING
/* Requantize the time intervals. */
array_split = g_ptr_array_new ();
@@ -1584,7 +1584,7 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
i_end_post = i_end;
for (e = 0 ; e < len ; e+= 2) {
unit_ival_start_cmp = g_ptr_array_index (array, e);
-
+
i_start_cmp = unit_ival_start_cmp->start;
i_end_cmp = unit_ival_start_cmp->end;
@@ -1616,7 +1616,7 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
for (i = 0; i < array->len; i++) {
g_free (array->pdata[i]);
}
-
+
g_ptr_array_free (array, TRUE);
array = array_split;
#endif /* ifdef WITH_SIMPLE_PRIORITY_SCHEDULING */
@@ -1631,7 +1631,7 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
units_full = 0;
res_n = 0;
for (i = 0; i < len; i++) {
- unit_ival = g_ptr_array_index (array, i);
+ unit_ival = g_ptr_array_index (array, i);
/* Get the next point of change. */
t = UNIT_IVAL_GET_TIME (unit_ival);
@@ -1650,10 +1650,10 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
res_n = 0;
unit_ivals = g_list_prepend (unit_ivals, new_unit_ival);
}
-
+
poc = t;
}
-
+
if (unit_ival->is_start) {
units += unit_ival->units;
units_full += unit_ival->units_full;
@@ -1669,7 +1669,7 @@ task_manager_get_task_units_intervals (MrpTaskManager *manager,
for (i = 0; i < array->len; i++) {
g_free (array->pdata[i]);
}
-
+
g_ptr_array_free (array, TRUE);
return g_list_reverse (unit_ivals);
@@ -1688,14 +1688,14 @@ task_manager_calculate_milestone_work_start (MrpTaskManager *manager,
GList *unit_ivals, *l;
MrpUnitsInterval *unit_ival;
MrpTaskType type;
-
+
priv = manager->priv;
type = mrp_task_get_task_type (task);
g_return_if_fail (type == MRP_TASK_TYPE_MILESTONE);
-
+
work_start = -1;
-
+
t = mrp_time_align_day (start);
while (1) {
@@ -1713,13 +1713,13 @@ task_manager_calculate_milestone_work_start (MrpTaskManager *manager,
t += 60*60*24;
continue;
}
-
- for (l = unit_ivals; l; l = l->next) {
+
+ for (l = unit_ivals; l; l = l->next) {
unit_ival = l->data;
t1 = t + unit_ival->start;
t2 = t + unit_ival->end;
-
+
/* Skip any intervals before the task starts. */
if (t2 < start) {
continue;
@@ -1735,16 +1735,16 @@ task_manager_calculate_milestone_work_start (MrpTaskManager *manager,
if (work_start != -1) {
break;
}
-
+
t += 60*60*24;
}
if (work_start == -1) {
work_start = start;
}
-
+
imrp_task_set_work_start (task, work_start);
-
+
g_list_foreach (unit_ivals, (GFunc) g_free, NULL);
g_list_free (unit_ivals);
}
@@ -1788,7 +1788,7 @@ task_manager_calculate_task_finish (MrpTaskManager *manager,
task_manager_calculate_milestone_work_start (manager, task, start);
return start;
}
-
+
work = mrp_task_get_work (task);
sched = mrp_task_get_sched (task);
@@ -1802,7 +1802,7 @@ task_manager_calculate_task_finish (MrpTaskManager *manager,
finish = start;
work_start = -1;
-
+
t = mrp_time_align_day (start);
while (1) {
@@ -1821,8 +1821,8 @@ task_manager_calculate_task_finish (MrpTaskManager *manager,
t += 60*60*24;
continue;
}
-
- for (l = unit_ivals; l; l = l->next) {
+
+ for (l = unit_ivals; l; l = l->next) {
unit_ival = l->data;
t1 = t + unit_ival->start;
@@ -1838,7 +1838,7 @@ task_manager_calculate_task_finish (MrpTaskManager *manager,
if (t1 == t2) {
continue;
}
-
+
if (work_start == -1) {
work_start = t1;
}
@@ -1860,7 +1860,7 @@ task_manager_calculate_task_finish (MrpTaskManager *manager,
finish = t1 + floor (work - effort);
*duration -= floor (0.5 + (effort + delta - work));
}
-
+
unit_ival->start = t1;
unit_ival->end = finish;
unit_ivals_tot = g_list_prepend (unit_ivals_tot, unit_ival);
@@ -1884,7 +1884,7 @@ task_manager_calculate_task_finish (MrpTaskManager *manager,
delta = 0;
g_assert_not_reached ();
}
-
+
effort += delta;
}
t += 60*60*24;
@@ -1899,7 +1899,7 @@ task_manager_calculate_task_finish (MrpTaskManager *manager,
/* clean the tail of the list before exit of function. */
if (l) {
- for (l = l->next ; l; l = l->next) {
+ for (l = l->next ; l; l = l->next) {
unit_ival = l->data;
g_free (unit_ival);
}
@@ -1959,7 +1959,7 @@ task_manager_calculate_task_start_from_finish (MrpTaskManager *manager,
task_manager_calculate_milestone_work_start (manager, task, start);
return start;
}
-
+
work = mrp_task_get_work (task);
sched = mrp_task_get_sched (task);
@@ -1984,13 +1984,13 @@ task_manager_calculate_task_start_from_finish (MrpTaskManager *manager,
t -= 60*60*24;
continue;
}
-
- for (l = unit_ivals; l; l = l->next) {
+
+ for (l = unit_ivals; l; l = l->next) {
unit_ival = l->data;
t1 = t + unit_ival->start;
t2 = t + unit_ival->end;
-
+
/* Skip any intervals after the task ends. */
if (t1 > finish) {
continue;
@@ -2002,7 +2002,7 @@ task_manager_calculate_task_start_from_finish (MrpTaskManager *manager,
if (t1 == t2) {
continue;
}
-
+
if (work_start == -1) {
work_start = t1;
}
@@ -2012,7 +2012,7 @@ task_manager_calculate_task_start_from_finish (MrpTaskManager *manager,
delta = floor (0.5 + (double) unit_ival->units * (t2 - t1) / 100.0);
*duration += (t2 - t1);
-
+
if (effort + delta >= work) {
/* Subtract the spill to duration. */
if (unit_ival->units) {
@@ -2021,13 +2021,13 @@ task_manager_calculate_task_start_from_finish (MrpTaskManager *manager,
} else {
start = t2 - floor (0.5 + (work - effort));
*duration -= floor (0.5 + (effort + delta - work));
- }
+ }
goto done;
}
}
else if (sched == MRP_TASK_SCHED_FIXED_DURATION) {
delta = t2 - t1;
-
+
if (unit_ival->units_full == 0) {
delta = 0;
} else if (effort + delta >= *duration) {
@@ -2040,10 +2040,10 @@ task_manager_calculate_task_start_from_finish (MrpTaskManager *manager,
delta = 0;
g_assert_not_reached ();
}
-
+
effort += delta;
}
-
+
t -= 60*60*24;
}
@@ -2076,12 +2076,12 @@ task_manager_do_forward_pass_helper (MrpTaskManager *manager,
MrpTaskSched sched;
priv = manager->priv;
-
+
old_start = mrp_task_get_start (task);
old_finish = mrp_task_get_finish (task);
old_duration = old_finish - old_start;
duration = 0;
-
+
if (mrp_task_get_n_children (task) > 0) {
MrpTask *child;
@@ -2089,7 +2089,7 @@ task_manager_do_forward_pass_helper (MrpTaskManager *manager,
sub_work_start = -1;
sub_finish = -1;
work = 0;
-
+
child = mrp_task_get_first_child (task);
while (child) {
t1 = mrp_task_get_start (child);
@@ -2105,7 +2105,7 @@ task_manager_do_forward_pass_helper (MrpTaskManager *manager,
} else {
sub_finish = MAX (sub_finish, t2);
}
-
+
t2 = mrp_task_get_work_start (child);
if (sub_work_start == -1) {
sub_work_start = t2;
@@ -2131,37 +2131,37 @@ task_manager_do_forward_pass_helper (MrpTaskManager *manager,
/* Non-summary task. */
t1 = task_manager_calculate_task_start (manager, task, &duration);
t2 = task_manager_calculate_task_finish (manager, task, t1, &duration);
-
+
imrp_task_set_start (task, t1);
imrp_task_set_finish (task, t2);
-
+
sched = mrp_task_get_sched (task);
if (sched == MRP_TASK_SCHED_FIXED_WORK) {
imrp_task_set_duration (task, duration);
} else {
duration = mrp_task_get_duration (task);
work = mrp_task_get_work (task);
-
+
/* Update resource units for fixed duration. */
if (duration > 0) {
GList *assignments, *a;
MrpAssignment *assignment;
gint n, units;
-
+
assignments = mrp_task_get_assignments (task);
-
+
n = g_list_length (assignments);
units = floor (0.5 + 100.0 * (gdouble) work / duration / n);
-
+
for (a = assignments; a; a = a->next) {
assignment = a->data;
-
+
g_signal_handlers_block_by_func (assignment,
task_manager_assignment_units_notify_cb,
manager);
-
+
g_object_set (assignment, "units", units, NULL);
-
+
g_signal_handlers_unblock_by_func (assignment,
task_manager_assignment_units_notify_cb,
manager);
@@ -2174,7 +2174,7 @@ task_manager_do_forward_pass_helper (MrpTaskManager *manager,
if (old_start != new_start) {
g_object_notify (G_OBJECT (task), "start");
}
-
+
new_finish = mrp_task_get_finish (task);
if (old_finish != new_finish) {
g_object_notify (G_OBJECT (task), "finish");
@@ -2204,7 +2204,7 @@ task_manager_do_forward_pass (MrpTaskManager *manager,
} else {
l = priv->dependency_list;
}
-
+
while (l) {
task_manager_do_forward_pass_helper (manager, l->data);
l = l->next;
@@ -2227,7 +2227,7 @@ task_manager_do_backward_pass (MrpTaskManager *manager)
gint duration;
gboolean critical;
gboolean was_critical;
-
+
priv = manager->priv;
project_finish = mrp_task_get_finish (priv->root);
@@ -2253,7 +2253,7 @@ task_manager_do_backward_pass (MrpTaskManager *manager)
relation = s->data;
successor = mrp_relation_get_successor (relation);
-
+
child = mrp_task_get_first_child (successor);
if (child) {
/* If successor has children go through them
@@ -2261,7 +2261,7 @@ task_manager_do_backward_pass (MrpTaskManager *manager)
*/
for (; child; child = mrp_task_get_next_sibling (child)) {
successor = child;
-
+
t2 = mrp_task_get_latest_start (successor) -
mrp_relation_get_lag (relation);
@@ -2300,9 +2300,9 @@ task_manager_do_backward_pass (MrpTaskManager *manager)
g_print ("Task %s:\n", mrp_task_get_name (task));
g_print (" latest start : "); mrp_time_debug_print (mrp_task_get_latest_start (task));
g_print (" latest finish : "); mrp_time_debug_print (mrp_task_get_latest_finish (task));
-
+
#endif
-
+
if (was_critical != critical) {
g_object_set (task, "critical", critical, NULL);
}
@@ -2319,11 +2319,11 @@ mrp_task_manager_set_block_scheduling (MrpTaskManager *manager, gboolean block)
g_return_if_fail (MRP_IS_TASK_MANAGER (manager));
priv = manager->priv;
-
+
if (priv->block_scheduling == block) {
return;
}
-
+
priv->block_scheduling = block;
if (!block) {
@@ -2348,13 +2348,13 @@ mrp_task_manager_rebuild (MrpTaskManager *manager)
g_return_if_fail (manager->priv->root != NULL);
priv = manager->priv;
-
+
if (priv->block_scheduling) {
return;
}
task_manager_build_dependency_graph (manager);
-
+
priv->needs_rebuild = FALSE;
priv->needs_recalc = TRUE;
}
@@ -2370,7 +2370,7 @@ mrp_task_manager_recalc (MrpTaskManager *manager,
g_return_if_fail (manager->priv->root != NULL);
priv = manager->priv;
-
+
if (priv->block_scheduling) {
return;
}
@@ -2380,7 +2380,7 @@ mrp_task_manager_recalc (MrpTaskManager *manager,
}
priv->needs_recalc |= force;
-
+
if (!priv->needs_recalc && !priv->needs_rebuild) {
return;
}
@@ -2396,7 +2396,7 @@ mrp_task_manager_recalc (MrpTaskManager *manager,
if (!project) {
return;
}
-
+
priv->in_recalc = TRUE;
if (priv->needs_rebuild) {
@@ -2448,7 +2448,7 @@ task_manager_task_relation_notify_cb (MrpRelation *relation,
GParamSpec *spec,
MrpTaskManager *manager)
{
- mrp_task_manager_recalc (manager, TRUE);
+ mrp_task_manager_recalc (manager, TRUE);
}
static void
@@ -2457,7 +2457,7 @@ task_manager_assignment_units_notify_cb (MrpAssignment *assignment,
MrpTaskManager *manager)
{
mrp_task_invalidate_cost (mrp_assignment_get_task (assignment));
- mrp_task_manager_recalc (manager, TRUE);
+ mrp_task_manager_recalc (manager, TRUE);
}
static void
@@ -2492,11 +2492,11 @@ task_manager_task_relation_removed_cb (MrpTask *task,
if (task == mrp_relation_get_predecessor (relation)) {
return;
}
-
+
g_signal_handlers_disconnect_by_func (relation,
task_manager_task_relation_notify_cb,
manager);
-
+
manager->priv->needs_rebuild = TRUE;
mrp_task_manager_recalc (manager, FALSE);
}
@@ -2509,7 +2509,7 @@ task_manager_task_assignment_added_cb (MrpTask *task,
g_signal_connect_object (assignment, "notify::units",
G_CALLBACK (task_manager_assignment_units_notify_cb),
manager, 0);
-
+
mrp_task_invalidate_cost (task);
manager->priv->needs_rebuild = TRUE;
mrp_task_manager_recalc (manager, FALSE);
@@ -2520,10 +2520,10 @@ task_manager_task_assignment_removed_cb (MrpTask *task,
MrpAssignment *assignment,
MrpTaskManager *manager)
{
- g_signal_handlers_disconnect_by_func (assignment,
+ g_signal_handlers_disconnect_by_func (assignment,
task_manager_assignment_units_notify_cb,
manager);
-
+
mrp_task_invalidate_cost (task);
manager->priv->needs_rebuild = TRUE;
mrp_task_manager_recalc (manager, FALSE);
@@ -2548,14 +2548,14 @@ check_predecessor_traverse (MrpTaskManager *manager,
}
imrp_task_set_visited (task, TRUE);
-
+
node = imrp_task_get_graph_node (task);
for (l = node->next; l; l = l->next) {
if (!check_predecessor_traverse (manager, l->data, end, length + 1)) {
return FALSE;
}
}
-
+
return TRUE;
}
@@ -2565,7 +2565,7 @@ check_move_traverse_recursive (MrpTaskManager *manager,
{
MrpTask *child;
gboolean retval = TRUE;
-
+
child = mrp_task_get_first_child (task);
while (retval && child) {
retval = check_predecessor_traverse (manager, child, child, 1);
@@ -2573,7 +2573,7 @@ check_move_traverse_recursive (MrpTaskManager *manager,
if (retval && mrp_task_get_n_children (child) > 0) {
retval = check_move_traverse_recursive (manager, child);
}
-
+
child = mrp_task_get_next_sibling (child);
}
@@ -2595,7 +2595,7 @@ mrp_task_manager_check_predecessor (MrpTaskManager *manager,
GError **error)
{
gboolean retval;
-
+
g_return_val_if_fail (MRP_IS_TASK_MANAGER (manager), FALSE);
g_return_val_if_fail (MRP_IS_TASK (task), FALSE);
g_return_val_if_fail (MRP_IS_TASK (predecessor), FALSE);
@@ -2603,26 +2603,26 @@ mrp_task_manager_check_predecessor (MrpTaskManager *manager,
if (manager->priv->needs_rebuild) {
mrp_task_manager_rebuild (manager);
}
-
+
/* Add the predecessor to check. */
add_predecessor_to_dependency_graph (manager, task, predecessor);
-
+
if (0) {
g_print ("--->\n");
dump_all_task_nodes (manager);
g_print ("<---\n");
}
-
+
mrp_task_manager_traverse (manager,
manager->priv->root,
task_manager_unset_visited_func,
NULL);
-
+
retval = check_predecessor_traverse (manager, predecessor, predecessor, 1);
/* Remove the predecessor again. */
remove_predecessor_from_dependency_graph (manager, task, predecessor);
-
+
if (!retval) {
g_set_error (error,
MRP_ERROR,
@@ -2641,7 +2641,7 @@ mrp_task_manager_check_move (MrpTaskManager *manager,
GError **error)
{
gboolean retval;
-
+
g_return_val_if_fail (MRP_IS_TASK_MANAGER (manager), FALSE);
g_return_val_if_fail (MRP_IS_TASK (task), FALSE);
g_return_val_if_fail (MRP_IS_TASK (parent), FALSE);
@@ -2649,18 +2649,18 @@ mrp_task_manager_check_move (MrpTaskManager *manager,
/* Remove the task from the old parent and add it to its new parent. */
remove_task_from_dependency_graph (manager, task, mrp_task_get_parent (task));
add_task_to_dependency_graph (manager, task, parent);
-
+
if (0) {
g_print ("--->\n");
dump_all_task_nodes (manager);
g_print ("<---\n");
}
-
+
mrp_task_manager_traverse (manager,
manager->priv->root,
task_manager_unset_visited_func,
NULL);
-
+
retval = check_move_traverse (manager, task);
/* Put the task back again. */
@@ -2707,26 +2707,26 @@ task_manager_get_work_for_calendar (MrpTaskManager *manager,
for (l = ivals; l; l = l->next) {
ival = l->data;
-
+
mrp_interval_get_absolute (ival, t, &t1, &t2);
-
+
/* Skip intervals that are before the task. */
if (t2 < start) {
continue;
}
-
+
/* Stop if the interval starts after the task. */
if (t1 >= finish) {
break;
}
-
+
/* Don't add time outside the task. */
t1 = MAX (t1, start);
t2 = MIN (t2, finish);
-
+
work += t2 - t1;
}
-
+
t += 24*60*60;
}
@@ -2772,8 +2772,8 @@ task_manager_get_work_for_task_with_assignments (MrpTaskManager *manager,
t += 60*60*24;
continue;
}
-
- for (l = ivals; l; l = l->next) {
+
+ for (l = ivals; l; l = l->next) {
ival = l->data;
t1 = t + ival->start;
@@ -2796,10 +2796,10 @@ task_manager_get_work_for_task_with_assignments (MrpTaskManager *manager,
}
delta = floor (0.5 + (double) ival->units * (t2 - t1) / 100.0);
-
+
work += delta;
}
-
+
t += 24*60*60;
}
@@ -2837,7 +2837,7 @@ mrp_task_manager_calculate_task_work (MrpTaskManager *manager,
if (finish <= start) {
return 0;
}
-
+
/* Loop through the intervals of the assigned resources' calendars (or
* the project calendar if no resources are assigned), and add up the
* work.
@@ -2893,7 +2893,7 @@ mrp_task_manager_calculate_summary_duration (MrpTaskManager *manager,
if (finish <= start) {
return 0;
}
-
+
calendar = mrp_project_get_calendar (priv->project);
duration = 0;
@@ -2909,26 +2909,26 @@ mrp_task_manager_calculate_summary_duration (MrpTaskManager *manager,
for (l = ivals; l; l = l->next) {
ival = l->data;
-
+
mrp_interval_get_absolute (ival, t, &t1, &t2);
-
+
/* Skip intervals that are before the task. */
if (t2 < start) {
continue;
}
-
+
/* Stop if the interval starts after the task. */
if (t1 >= finish) {
break;
}
-
+
/* Don't add time outside the task. */
t1 = MAX (t1, start);
t2 = MIN (t2, finish);
-
+
duration += t2 - t1;
}
-
+
t += 24*60*60;
}
diff --git a/libplanner/mrp-task.c b/libplanner/mrp-task.c
index 1cc72f0..7a7ceca 100644
--- a/libplanner/mrp-task.c
+++ b/libplanner/mrp-task.c
@@ -67,7 +67,7 @@ struct _MrpTaskPriv {
guint visited : 1;
MrpTaskGraphNode *graph_node;
-
+
/* FIXME: This might be a mistake... I can't think of any other types,
* besides milestone and normal. Should we have a boolean instead,
* is_milestone? That or a flags type variable.
@@ -78,13 +78,13 @@ struct _MrpTaskPriv {
* well.
*/
MrpTaskSched sched;
-
+
/* Percent complete, 0-100. */
gshort percent_complete;
-
+
/* Arbitary range of 0,1..9999. A hint for any (3rd party) resource leveller */
gint priority;
-
+
gchar *name;
gchar *note;
@@ -98,7 +98,7 @@ struct _MrpTaskPriv {
/* Slack. */
gint slack;
-
+
/* Calculated start and finish values. */
mrptime start;
mrptime finish;
@@ -115,7 +115,7 @@ struct _MrpTaskPriv {
/* The acyclic dependency graph. */
GList *successors;
GList *predecessors;
-
+
/* Calculated CPM values. */
mrptime latest_start;
mrptime latest_finish;
@@ -185,7 +185,7 @@ static void
task_init (MrpTask *task)
{
MrpTaskPriv *priv;
-
+
priv = g_new0 (MrpTaskPriv, 1);
task->priv = priv;
@@ -206,7 +206,7 @@ task_class_init (MrpTaskClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MrpObjectClass *mrp_object_class = MRP_OBJECT_CLASS (klass);
-
+
parent_class = MRP_OBJECT_CLASS (g_type_class_peek_parent (klass));
object_class->finalize = task_finalize;
@@ -214,7 +214,7 @@ task_class_init (MrpTaskClass *klass)
object_class->get_property = task_get_property;
mrp_object_class->removed = task_removed;
-
+
signals[TASK_MOVED] =
g_signal_new ("task_moved",
G_TYPE_FROM_CLASS (klass),
@@ -223,7 +223,7 @@ task_class_init (MrpTaskClass *klass)
NULL, NULL,
mrp_marshal_VOID__OBJECT_INT,
G_TYPE_NONE, 2, MRP_TYPE_TASK, G_TYPE_INT);
-
+
signals[RELATION_ADDED] =
g_signal_new ("relation_added",
G_TYPE_FROM_CLASS (klass),
@@ -232,7 +232,7 @@ task_class_init (MrpTaskClass *klass)
NULL, NULL,
mrp_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
-
+
signals[RELATION_REMOVED] =
g_signal_new ("relation_removed",
G_TYPE_FROM_CLASS (klass),
@@ -242,7 +242,7 @@ task_class_init (MrpTaskClass *klass)
mrp_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals[ASSIGNMENT_ADDED] =
+ signals[ASSIGNMENT_ADDED] =
g_signal_new ("assignment_added",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -252,7 +252,7 @@ task_class_init (MrpTaskClass *klass)
G_TYPE_NONE,
1, MRP_TYPE_ASSIGNMENT);
- signals[ASSIGNMENT_REMOVED] =
+ signals[ASSIGNMENT_REMOVED] =
g_signal_new ("assignment_removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -261,8 +261,8 @@ task_class_init (MrpTaskClass *klass)
mrp_marshal_VOID__OBJECT,
G_TYPE_NONE,
1, MRP_TYPE_ASSIGNMENT);
-
- signals[CHILD_ADDED] =
+
+ signals[CHILD_ADDED] =
g_signal_new ("child_added",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -271,7 +271,7 @@ task_class_init (MrpTaskClass *klass)
mrp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- signals[CHILD_REMOVED] =
+ signals[CHILD_REMOVED] =
g_signal_new ("child_removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -288,7 +288,7 @@ task_class_init (MrpTaskClass *klass)
"Name of the task",
"",
G_PARAM_READWRITE));
-
+
g_object_class_install_property (
object_class,
PROP_NOTE,
@@ -305,7 +305,7 @@ task_class_init (MrpTaskClass *klass)
"Start time",
"Task Start time",
G_PARAM_READABLE));
-
+
g_object_class_install_property (
object_class,
PROP_FINISH,
@@ -313,7 +313,7 @@ task_class_init (MrpTaskClass *klass)
"Finish time",
"Task finish time",
G_PARAM_READABLE));
-
+
g_object_class_install_property (
object_class,
PROP_LATEST_START,
@@ -321,7 +321,7 @@ task_class_init (MrpTaskClass *klass)
"Latest start",
"Latest task start time",
G_PARAM_READABLE));
-
+
g_object_class_install_property (
object_class,
PROP_LATEST_FINISH,
@@ -329,7 +329,7 @@ task_class_init (MrpTaskClass *klass)
"Latest finish",
"Latest task finish time",
G_PARAM_READABLE));
-
+
g_object_class_install_property (
object_class,
PROP_DURATION,
@@ -366,7 +366,7 @@ task_class_init (MrpTaskClass *klass)
MRP_TYPE_TASK_TYPE,
MRP_TASK_TYPE_NORMAL,
G_PARAM_READWRITE));
-
+
g_object_class_install_property (
object_class,
PROP_SCHED,
@@ -385,7 +385,7 @@ task_class_init (MrpTaskClass *klass)
"Task scheduling constraint",
MRP_TYPE_CONSTRAINT,
G_PARAM_READWRITE));
-
+
g_object_class_install_property (
object_class,
PROP_PERCENT_COMPLETE,
@@ -394,7 +394,7 @@ task_class_init (MrpTaskClass *klass)
"Percent completed of task",
0, 100, 0,
G_PARAM_READWRITE));
-
+
g_object_class_install_property (
object_class,
PROP_PRIORITY,
@@ -413,7 +413,7 @@ task_finalize (GObject *object)
task = MRP_TASK (object);
priv = task->priv;
-
+
g_free (priv->name);
g_free (priv->note);
@@ -423,7 +423,7 @@ task_finalize (GObject *object)
/* Make sure we don't have dangling relations. */
g_assert (priv->predecessors == NULL);
g_assert (priv->successors == NULL);
-
+
g_node_destroy (priv->node);
g_free (priv);
@@ -449,7 +449,7 @@ task_set_property (GObject *object,
task = MRP_TASK (object);
priv = task->priv;
-
+
switch (prop_id) {
case PROP_NAME:
str = g_value_get_string (value);
@@ -459,7 +459,7 @@ task_set_property (GObject *object,
priv->name = g_strdup (str);
changed = TRUE;
}
-
+
break;
case PROP_NOTE:
@@ -472,7 +472,7 @@ task_set_property (GObject *object,
}
break;
-
+
case PROP_START:
priv->start = g_value_get_long (value);
break;
@@ -490,9 +490,9 @@ task_set_property (GObject *object,
if (priv->sched == MRP_TASK_SCHED_FIXED_WORK) {
return;
}
-
+
i_val = g_value_get_int (value);
-
+
if (priv->duration != i_val) {
priv->duration = i_val;
@@ -502,7 +502,7 @@ task_set_property (GObject *object,
mrp_task_invalidate_cost (task);
}
break;
-
+
case PROP_WORK:
if (mrp_task_get_n_children (task) > 0 ||
priv->type == MRP_TASK_TYPE_MILESTONE) {
@@ -529,7 +529,7 @@ task_set_property (GObject *object,
type = g_value_get_enum (value);
if (type != priv->type) {
priv->type = type;
-
+
if (type == MRP_TASK_TYPE_MILESTONE) {
priv->duration = 0;
priv->work = 0;
@@ -540,10 +540,10 @@ task_set_property (GObject *object,
priv->duration = 60*60*8;
priv->work = 60*60*8;
}
-
+
g_object_notify (G_OBJECT (task), "duration");
g_object_notify (G_OBJECT (task), "work");
-
+
changed = TRUE;
}
break;
@@ -561,24 +561,24 @@ task_set_property (GObject *object,
case PROP_PERCENT_COMPLETE:
i_val = g_value_get_int (value);
-
+
if (priv->percent_complete != i_val) {
priv->percent_complete = i_val;
changed = TRUE;
}
-
+
break;
case PROP_PRIORITY:
i_val = g_value_get_int (value);
-
+
if (priv->priority != i_val) {
priv->priority = i_val;
changed = TRUE;
}
-
+
break;
-
+
default:
break;
}
@@ -599,7 +599,7 @@ task_get_property (GObject *object,
task = MRP_TASK (object);
priv = task->priv;
-
+
switch (prop_id) {
case PROP_NAME:
g_value_set_string (value, priv->name);
@@ -654,15 +654,15 @@ task_removed (MrpObject *object)
{
MrpTask *task;
MrpTaskPriv *priv;
-
+
g_return_if_fail (MRP_IS_TASK (object));
-
+
task = MRP_TASK (object);
priv = task->priv;
task_remove_assignments (task);
task_remove_relations (task);
-
+
if (MRP_OBJECT_CLASS (parent_class)->removed) {
(* MRP_OBJECT_CLASS (parent_class)->removed) (object);
}
@@ -672,10 +672,10 @@ static void
task_assignment_removed_cb (MrpAssignment *assignment, MrpTask *task)
{
MrpTaskPriv *priv;
-
+
g_return_if_fail (MRP_IS_TASK (task));
g_return_if_fail (MRP_IS_ASSIGNMENT (assignment));
-
+
priv = task->priv;
priv->assignments = g_list_remove (priv->assignments, assignment);
@@ -695,7 +695,7 @@ task_remove_relations (MrpTask *task)
MrpTask *successor;
g_return_if_fail (MRP_IS_TASK (task));
-
+
/* Cut relations involving the task (make sure to be robust when
* removing during traversing).
*/
@@ -705,19 +705,19 @@ task_remove_relations (MrpTask *task)
relation = l->data;
predecessor = mrp_relation_get_predecessor (relation);
-
+
mrp_task_remove_predecessor (task, predecessor);
l = next;
}
-
+
l = task->priv->successors;
while (l) {
next = l->next;
relation = l->data;
successor = mrp_relation_get_successor (relation);
-
+
mrp_task_remove_predecessor (successor, task);
l = next;
@@ -739,14 +739,14 @@ task_remove_assignments (MrpTask *task)
for (l = copy; l; l = l->next) {
assignment = l->data;
-
+
g_signal_handlers_disconnect_by_func (MRP_ASSIGNMENT (l->data),
task_assignment_removed_cb,
task);
g_object_unref (assignment);
mrp_object_removed (MRP_OBJECT (assignment));
}
-
+
g_list_free (priv->assignments);
g_list_free (copy);
@@ -761,16 +761,16 @@ task_remove_subtree_cb (GNode *node, gpointer data)
task = node->data;
priv = task->priv;
-
+
task_remove_relations (task);
task_remove_assignments (task);
g_node_unlink (priv->node);
-
+
mrp_object_removed (MRP_OBJECT (task));
g_object_unref (task);
-
+
return FALSE;
}
@@ -778,16 +778,16 @@ void
imrp_task_remove_subtree (MrpTask *task)
{
MrpTask *parent;
-
+
g_return_if_fail (MRP_IS_TASK (task));
parent = NULL;
if (task->priv->node->parent) {
parent = task->priv->node->parent->data;
}
-
+
g_object_ref (task);
-
+
/* Remove the tasks one by one using post order so we don't mess with
* the tree while traversing it.
*/
@@ -823,7 +823,7 @@ imrp_task_reattach (MrpTask *task,
gboolean before)
{
GNode *node;
-
+
g_return_if_fail (MRP_IS_TASK (task));
g_return_if_fail (sibling == NULL || MRP_IS_TASK (sibling));
g_return_if_fail (MRP_IS_TASK (parent));
@@ -837,13 +837,13 @@ imrp_task_reattach (MrpTask *task,
"sched", MRP_TASK_SCHED_FIXED_WORK,
NULL);
}
-
+
if (sibling == NULL) {
if (before) {
node = g_node_first_child (parent->priv->node);
} else {
node = g_node_last_child (parent->priv->node);
- }
+ }
if (node) {
sibling = node->data;
@@ -889,9 +889,9 @@ imrp_task_reattach_pos (MrpTask *task,
/**
* mrp_task_new:
- *
+ *
* Create a new task.
- *
+ *
* Return value: the newly created #MrpTask.
**/
MrpTask *
@@ -907,9 +907,9 @@ mrp_task_new (void)
/**
* mrp_task_get_name:
* @task: an #MrpTask
- *
+ *
* Retrives the name of @task.
- *
+ *
* Return value: the name
**/
const gchar *
@@ -924,14 +924,14 @@ mrp_task_get_name (MrpTask *task)
* mrp_task_set_name:
* @task: an #MrpResource
* @name: new name of @task
- *
+ *
* Sets the name of @task.
**/
void mrp_task_set_name (MrpTask *task, const gchar *name)
{
g_return_if_fail (MRP_IS_TASK (task));
g_return_if_fail (name != NULL);
-
+
mrp_object_set (MRP_OBJECT (task), "name", name, NULL);
}
@@ -946,7 +946,7 @@ imrp_task_insert_child (MrpTask *parent,
if (child->priv->duration == -1) {
child->priv->duration = parent->priv->duration;
}
-
+
g_node_insert (parent->priv->node,
position,
child->priv->node);
@@ -958,7 +958,7 @@ imrp_task_insert_child (MrpTask *parent,
"type", MRP_TASK_TYPE_NORMAL,
NULL);
}
-
+
g_signal_emit (parent, signals[CHILD_ADDED], 0);
}
@@ -1002,10 +1002,10 @@ task_get_successor_relation (MrpTask *task,
* mrp_task_has_relation_to:
* @task_a: an #MrpTask
* @task_b: an #MrpTask
- *
+ *
* Checks if @a and @b has a relation, i.e. if a is a predecessor or successor
* of b.
- *
+ *
* Return value: %TRUE if @a and @b has a relation
**/
gboolean
@@ -1018,9 +1018,9 @@ mrp_task_has_relation_to (MrpTask *task_a, MrpTask *task_b)
/**
* mrp_task_has_relation:
* @task: an #MrpTask
- *
+ *
* Checks if a task has any relations, i.e. predecessors or successors.
- *
+ *
* Return value: %TRUE if there are any relations.
**/
gboolean
@@ -1037,7 +1037,7 @@ mrp_task_has_relation (MrpTask *task)
* @type: type of relation
* @lag: lag time, if negative, it means lead time
* @error: location to store error, or %NULL
- *
+ *
* Adds a predecessor task to a task. Depending on type, the predecessor
* must be started or finished before task can be started or finished,
* with an optional lag/lead time.
@@ -1058,7 +1058,7 @@ mrp_task_add_predecessor (MrpTask *task,
gchar *tmp;
MrpConstraint constraint;
mrptime pred_start;
-
+
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
g_return_val_if_fail (MRP_IS_TASK (predecessor), NULL);
@@ -1068,10 +1068,10 @@ mrp_task_add_predecessor (MrpTask *task,
MRP_ERROR,
MRP_ERROR_TASK_RELATION_FAILED,
_("Could not add a predecessor relation, because the tasks are already related."));
-
+
return NULL;
}
-
+
relations = mrp_task_get_predecessor_relations (task);
/* check for attempt to add SF or FF relation when other relation types already present */
@@ -1087,13 +1087,13 @@ mrp_task_add_predecessor (MrpTask *task,
MRP_ERROR,
MRP_ERROR_TASK_RELATION_FAILED,
tmp);
-
+
return NULL;
}
/* check for attempt to add SF or FF when a Start No Earlier Than constraint exists */
constraint = imrp_task_get_constraint (task);
- if ((type == MRP_RELATION_SF || type == MRP_RELATION_FF) &&
+ if ((type == MRP_RELATION_SF || type == MRP_RELATION_FF) &&
constraint.type == MRP_CONSTRAINT_SNET) {
if (type == MRP_RELATION_SF) {
tmp = _("Start to Finish relation type cannot be combined with Start No Earlier Than constraint.");
@@ -1105,7 +1105,7 @@ mrp_task_add_predecessor (MrpTask *task,
MRP_ERROR,
MRP_ERROR_TASK_RELATION_FAILED,
tmp);
-
+
return NULL;
}
@@ -1115,14 +1115,14 @@ mrp_task_add_predecessor (MrpTask *task,
project = mrp_object_get_project (MRP_OBJECT (task));
pred_start = mrp_time_align_day (mrp_task_get_work_start (predecessor));
- if ((type == MRP_RELATION_SF) &&
+ if ((type == MRP_RELATION_SF) &&
pred_start == mrp_project_get_project_start (project)) {
g_set_error (error,
MRP_ERROR,
MRP_ERROR_TASK_RELATION_FAILED,
_("Start to Finish relation cannot be set. Predecessor starts on project start date."));
-
+
return NULL;
}
@@ -1130,7 +1130,7 @@ mrp_task_add_predecessor (MrpTask *task,
if (!mrp_task_manager_check_predecessor (manager, task, predecessor, error)) {
return NULL;
}
-
+
relation = g_object_new (MRP_TYPE_RELATION,
"successor", task,
"predecessor", predecessor,
@@ -1154,7 +1154,7 @@ mrp_task_add_predecessor (MrpTask *task,
* mrp_task_remove_predecessor:
* @task: an #MrpTask
* @predecessor: the predecessor to remove
- *
+ *
* Removes a predecessor previously added to task.
**/
void
@@ -1162,7 +1162,7 @@ mrp_task_remove_predecessor (MrpTask *task,
MrpTask *predecessor)
{
MrpRelation *relation;
-
+
g_return_if_fail (MRP_IS_TASK (task));
g_return_if_fail (MRP_IS_TASK (predecessor));
@@ -1188,20 +1188,20 @@ mrp_task_remove_predecessor (MrpTask *task,
* mrp_task_get_relation:
* @task_a: an #MrpTask
* @task_b: an #MrpTask
- *
+ *
* Fetches a relation between two tasks if it exists.
- *
- * Return value: a #MrpRelation representing the relation between @task_a and
+ *
+ * Return value: a #MrpRelation representing the relation between @task_a and
* @task_b or %NULL if they don't have any relation.
**/
MrpRelation *
mrp_task_get_relation (MrpTask *task_a, MrpTask *task_b)
{
MrpRelation *relation;
-
+
g_return_val_if_fail (MRP_IS_TASK (task_a), NULL);
g_return_val_if_fail (MRP_IS_TASK (task_b), NULL);
-
+
relation = task_get_predecessor_relation (task_a, task_b);
if (relation != NULL) {
return relation;
@@ -1214,9 +1214,9 @@ mrp_task_get_relation (MrpTask *task_a, MrpTask *task_b)
* mrp_task_get_predecessor_relation:
* @task: an #MrpTask
* @predecessor: #an MrpTask
- *
+ *
* Fetches a predecessor relation between task and it's predecessor.
- *
+ *
* Return value: the #MrpRelation if it exists, otherwise %NULL
**/
MrpRelation *
@@ -1224,7 +1224,7 @@ mrp_task_get_predecessor_relation (MrpTask *task, MrpTask *predecessor)
{
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
g_return_val_if_fail (MRP_IS_TASK (predecessor), NULL);
-
+
return task_get_predecessor_relation (task, predecessor);
}
@@ -1232,19 +1232,19 @@ mrp_task_get_predecessor_relation (MrpTask *task, MrpTask *predecessor)
* mrp_task_get_successor_relation:
* @task: an #MrpTask
* @successor: an #MrpTask
- *
+ *
* Fetches a successor relation between task and it's successor.
- *
+ *
* Return value: the #MrpRelation if it exists, otherwise %NULL
**/
MrpRelation *
mrp_task_get_successor_relation (MrpTask *task, MrpTask *successor)
{
MrpRelation *relation;
-
+
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
g_return_val_if_fail (MRP_IS_TASK (successor), NULL);
-
+
relation = task_get_successor_relation (task, successor);
return relation;
}
@@ -1252,9 +1252,9 @@ mrp_task_get_successor_relation (MrpTask *task, MrpTask *successor)
/**
* mrp_task_get_predecessor_relations:
* @task: an #MrpTask
- *
- * Fetches a list of predecessor relations to @task.
- *
+ *
+ * Fetches a list of predecessor relations to @task.
+ *
* Return value: the list of predecessor relations to @task
**/
GList *
@@ -1268,9 +1268,9 @@ mrp_task_get_predecessor_relations (MrpTask *task)
/**
* mrp_task_get_successor_relations:
* @task: an #MrpTask
- *
- * Fetches a list of successor relations to @task.
- *
+ *
+ * Fetches a list of successor relations to @task.
+ *
* Return value: a list of successor relations to @task
**/
GList *
@@ -1284,9 +1284,9 @@ mrp_task_get_successor_relations (MrpTask *task)
/**
* mrp_task_get_parent:
* @task: an #MrpTask
- *
+ *
* Fetches the parent of @task.
- *
+ *
* Return value: the parent of @task, or %NULL if there is no parent..
**/
MrpTask *
@@ -1303,16 +1303,16 @@ mrp_task_get_parent (MrpTask *task)
/**
* mrp_task_get_first_child:
* @task: an #MrpTask
- *
+ *
* Fetches the first child of @task.
- *
+ *
* Return value: the first child of @task, or %NULL if there are no children.
**/
MrpTask *
mrp_task_get_first_child (MrpTask *task)
{
GNode *node;
-
+
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
node = g_node_first_child (task->priv->node);
@@ -1322,9 +1322,9 @@ mrp_task_get_first_child (MrpTask *task)
/**
* mrp_task_get_next_sibling:
* @task: an #MrpTask
- *
+ *
* Fetches the next sibling of @task.
- *
+ *
* Return value: the next sibling of @task, or %NULL if there is no next
* sibling.
**/
@@ -1342,9 +1342,9 @@ mrp_task_get_next_sibling (MrpTask *task)
/**
* mrp_task_get_prev_sibling:
* @task: an #MrpTask
- *
+ *
* Fetches the previous sibling of @task.
- *
+ *
* Return value: the previous sibling of @task, or %NULL if there is none.
**/
MrpTask *
@@ -1361,9 +1361,9 @@ mrp_task_get_prev_sibling (MrpTask *task)
/**
* mrp_task_get_n_children:
* @task: an #MrpTask
- *
+ *
* Fetches the number of children @task has.
- *
+ *
* Return value: the number of children @task has
**/
guint
@@ -1378,9 +1378,9 @@ mrp_task_get_n_children (MrpTask *task)
* mrp_task_get_nth_child:
* @task: an #MrpTask
* @n: the index of the child to get
- *
+ *
* Fetches the nth child of @task.
- *
+ *
* Return value: the nth child of @task, or %NULL if there is no such child.
**/
MrpTask *
@@ -1397,21 +1397,21 @@ mrp_task_get_nth_child (MrpTask *task, guint n)
/**
* mrp_task_get_position:
* @task: an #MrpTask
- *
+ *
* Fetches the index or position of @task among its siblings.
- *
+ *
* Return value: the position of @task among its siblings.
**/
gint
mrp_task_get_position (MrpTask *task)
{
GNode *parent;
-
+
g_return_val_if_fail (MRP_IS_TASK (task), 0);
g_return_val_if_fail (task->priv->node->parent != NULL, 0);
parent = task->priv->node->parent;
-
+
return g_node_child_position (parent, task->priv->node);
}
@@ -1419,20 +1419,20 @@ mrp_task_get_position (MrpTask *task)
* mrp_task_add_assignment:
* @task: an #MrpTask
* @assignment: an #MrpAssignment
- *
+ *
* Adds an assignment to @task.
**/
void
imrp_task_add_assignment (MrpTask *task, MrpAssignment *assignment)
{
MrpTaskPriv *priv;
-
+
g_return_if_fail (MRP_IS_TASK (task));
g_return_if_fail (MRP_IS_ASSIGNMENT (assignment));
-
+
priv = task->priv;
-
- priv->assignments = g_list_prepend (priv->assignments,
+
+ priv->assignments = g_list_prepend (priv->assignments,
g_object_ref (assignment));
g_signal_connect (assignment,
@@ -1448,9 +1448,9 @@ imrp_task_add_assignment (MrpTask *task, MrpAssignment *assignment)
/**
* mrp_task_get_start:
* @task: an #MrpTask
- *
+ *
* Fetches the start time of @task.
- *
+ *
* Return value: the start time of @task.
**/
mrptime
@@ -1464,9 +1464,9 @@ mrp_task_get_start (MrpTask *task)
/**
* mrp_task_get_finish:
* @task: an #MrpTask
- *
+ *
* Fetches the finish time of @task.
- *
+ *
* Return value: the finish time of @task.
**/
mrptime
@@ -1480,29 +1480,29 @@ mrp_task_get_finish (MrpTask *task)
/**
* mrp_task_get_work_start:
* @task: an #MrpTask
- *
+ *
* Retrieves the first time where work is performed of @task. This might be
* different from the start time, if the start time is during non-working
* time. In that case, the work start would be right after the non-working
* interval.
- *
+ *
* Return value: The work start time of @task.
**/
mrptime
mrp_task_get_work_start (MrpTask *task)
{
g_return_val_if_fail (MRP_IS_TASK (task), 0);
-
+
return task->priv->work_start;
}
/**
* mrp_task_get_latest_start:
* @task: an #MrpTask
- *
+ *
* Retrieves the latest start time of @task, i.e. the latest time the task can
* start without delaying the project.
- *
+ *
* Return value: The latest start time of @task.
**/
mrptime
@@ -1514,10 +1514,10 @@ mrp_task_get_latest_start (MrpTask *task)
/**
* mrp_task_get_latest_finish:
* @task: an #MrpTask
- *
+ *
* Retrieves the latest finish time of @task, i.e. the latest time the task can
* finish without delaying the project.
- *
+ *
* Return value: The latest finish time of @task.
**/
mrptime
@@ -1529,10 +1529,10 @@ mrp_task_get_latest_finish (MrpTask *task)
/**
* mrp_task_get_duration:
* @task: an #MrpTask
- *
+ *
* Fetches the duration of @task. This differs from the calendar duration that
* is retrieved by (finish - start).
- *
+ *
* Return value: The duration of @task.
**/
gint
@@ -1546,32 +1546,32 @@ mrp_task_get_duration (MrpTask *task)
/**
* mrp_task_get_work:
* @task: an #MrpTask
- *
+ *
* Retrieves the amount of work of @task.
- *
+ *
* Return value: The work of @task.
**/
gint
mrp_task_get_work (MrpTask *task)
{
g_return_val_if_fail (MRP_IS_TASK (task), 0);
-
+
return task->priv->work;
}
/**
* mrp_task_get_priority:
* @task: an #MrpTask
- *
+ *
* Retrieves the priority of @task.
- *
+ *
* Return value: The priority of @task.
**/
gint
mrp_task_get_priority (MrpTask *task)
{
g_return_val_if_fail (MRP_IS_TASK (task), 0);
-
+
return task->priv->priority;
}
@@ -1579,9 +1579,9 @@ mrp_task_get_priority (MrpTask *task)
/**
* mrp_task_is_dominant:
* @task: an #MrpTask
- *
+ *
* Retrieves if @task is a dominant task.
- *
+ *
* Return value: if @task is a dominant task.
**/
gboolean
@@ -1590,7 +1590,7 @@ mrp_task_is_dominant (MrpTask *task)
MrpConstraint constraint;
g_return_val_if_fail (MRP_IS_TASK (task), 0);
-
+
constraint = imrp_task_get_constraint (task);
if (constraint.type != MRP_CONSTRAINT_MSO) {
return (FALSE);
@@ -1606,9 +1606,9 @@ mrp_task_is_dominant (MrpTask *task)
/**
* mrp_task_get_unit_ivals:
* @task: an #MrpTask
- *
+ *
* Retrieves the list of intervals of @task.
- *
+ *
* Return value: Intervals of @task.
**/
GList *
@@ -1622,9 +1622,9 @@ mrp_task_get_unit_ivals (MrpTask *task)
/**
* mrp_task_set_unit_ivals:
* @task: an #MrpTask
- *
+ *
* Set the list of intervals of @task.
- *
+ *
* Return value: Intervals of @task.
**/
GList *
@@ -1645,25 +1645,25 @@ mrp_task_set_unit_ivals (MrpTask *task, GList *ivals)
/**
* mrp_task_get_assignments:
* @task: an #MrpTask
- *
+ *
* Fetches a list of #MrpAssignment.
- *
+ *
* Return value: the list of assignments.
**/
GList *
mrp_task_get_assignments (MrpTask *task)
{
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
-
+
return task->priv->assignments;
}
/**
* mrp_task_get_nres:
* @task: an #MrpTask
- *
+ *
* Calculate the number of resources assigned to task.
- *
+ *
* Return value: the number of resources.
**/
gint mrp_task_get_nres (MrpTask *task)
@@ -1676,7 +1676,7 @@ gint mrp_task_get_nres (MrpTask *task)
for (a = assignments; a; a = a->next) {
nres++;
}
-
+
return (nres);
}
@@ -1684,38 +1684,38 @@ gint mrp_task_get_nres (MrpTask *task)
* mrp_task_get_assignment:
* @task: an #MrpTask
* @resource: an #MrpResource
- *
+ *
* retrieves the #MrpAssignment associated with @task and @resource if the
* resource is assigned to @task, or %NULL if there is no such assignment.
- *
+ *
* Return value: The assignment if it exists, otherwise %NULL.
**/
MrpAssignment *
mrp_task_get_assignment (MrpTask *task, MrpResource *resource)
{
GList *l;
-
+
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
g_return_val_if_fail (MRP_IS_RESOURCE (resource), NULL);
for (l = task->priv->assignments; l; l = l->next) {
MrpAssignment *assignment = l->data;
-
+
if (mrp_assignment_get_resource (assignment) == resource) {
return assignment;
}
}
-
+
return NULL;
}
/**
* mrp_task_get_assigned_resources:
* @task: an #MrpTask
- *
- * Fetches a list of resources assigned to @task. The list needs to be freed
+ *
+ * Fetches a list of resources assigned to @task. The list needs to be freed
* with g_list_free() by caller.
- *
+ *
* Return value: A newly created list of #MrpResource.
**/
GList *
@@ -1723,7 +1723,7 @@ mrp_task_get_assigned_resources (MrpTask *task)
{
GList *list = NULL;
GList *l;
-
+
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
for (l = task->priv->assignments; l; l = l->next) {
@@ -1732,9 +1732,9 @@ mrp_task_get_assigned_resources (MrpTask *task)
list = g_list_prepend (
list, mrp_assignment_get_resource (assignment));
}
-
+
list = g_list_sort (list, mrp_resource_compare);
-
+
return list;
}
@@ -1742,9 +1742,9 @@ mrp_task_get_assigned_resources (MrpTask *task)
* mrp_task_compare:
* @a: an #MrpTask
* @b: an #MrpTask
- *
+ *
* Compares the name of the tasks, by calling strcmp() on the names.
- *
+ *
* Return value: the return value of strcmp (a->name, b->name).
**/
gint
@@ -1756,7 +1756,7 @@ mrp_task_compare (gconstpointer a, gconstpointer b)
/**
* mrp_task_reset_constraint:
* @task: an #MrpTask
- *
+ *
* Sets the contraint type to %MRP_CONTRAINT_ASAP and notifies listeners.
**/
void
@@ -1773,9 +1773,9 @@ mrp_task_reset_constraint (MrpTask *task)
/**
* mrp_task_get_cost:
* @task: an #MrpTask
- *
+ *
* Calculates the cost to complete @task.
- *
+ *
* Return value: The cost to complete @task.
**/
gfloat
@@ -1849,13 +1849,13 @@ GType
mrp_constraint_get_type (void)
{
static GType our_type = 0;
-
+
if (our_type == 0) {
our_type = g_boxed_type_register_static ("MrpConstraint",
(GBoxedCopyFunc) mrp_constraint_copy,
(GBoxedFreeFunc) g_free);
}
-
+
return our_type;
}
@@ -1935,7 +1935,7 @@ MrpConstraint
imrp_task_get_constraint (MrpTask *task)
{
MrpConstraint c = { 0 };
-
+
g_return_val_if_fail (MRP_IS_TASK (task), c);
return task->priv->constraint;
@@ -1953,7 +1953,7 @@ gint
imrp_task_get_depth (MrpTask *task)
{
g_return_val_if_fail (MRP_IS_TASK (task), 0);
-
+
return g_node_depth (task->priv->node);
}
@@ -1961,7 +1961,7 @@ GNode *
imrp_task_get_node (MrpTask *task)
{
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
-
+
return task->priv->node;
}
@@ -1969,7 +1969,7 @@ MrpTaskGraphNode *
imrp_task_get_graph_node (MrpTask *task)
{
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
-
+
return task->priv->graph_node;
}
@@ -1977,7 +1977,7 @@ GList *
imrp_task_peek_predecessors (MrpTask *task)
{
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
-
+
return task->priv->predecessors;
}
@@ -1985,7 +1985,7 @@ GList *
imrp_task_peek_successors (MrpTask *task)
{
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
-
+
return task->priv->successors;
}
diff --git a/libplanner/mrp-task.h b/libplanner/mrp-task.h
index 4d2b2b0..4efa9e2 100644
--- a/libplanner/mrp-task.h
+++ b/libplanner/mrp-task.h
@@ -43,11 +43,11 @@ typedef struct _MrpTaskClass MrpTaskClass;
typedef struct _MrpTaskPriv MrpTaskPriv;
/*
- NOTE: moved from libplanner/mrp-task-manager.c to use
+ NOTE: moved from libplanner/mrp-task-manager.c to use
the structure in the src/planner-gantt-row.c
new fields are:
units . worked units in the interval
- units_full . expected worked units in the interval
+ units_full . expected worked units in the interval
all resources that are working in the
interval in the right percentage
res_n . number of expected resources working
@@ -59,7 +59,7 @@ typedef struct {
mrptime end;
gint units;
gint units_full;
- gint res_n;
+ gint res_n;
} MrpUnitsInterval;
#define UNIT_IVAL_GET_TIME(R) ((R->is_start?R->start:R->end))
diff --git a/libplanner/mrp-time.c b/libplanner/mrp-time.c
index 8ebd857..e610d11 100644
--- a/libplanner/mrp-time.c
+++ b/libplanner/mrp-time.c
@@ -63,9 +63,9 @@ static struct tm *mrp_time_to_tm (mrptime t);
* @hour: the hour
* @minute: the minute
* @second: the second
- *
+ *
* Composes an #mrptime value from the separate components.
- *
+ *
* Return value: An #mrptime value.
**/
mrptime
@@ -93,9 +93,9 @@ mrp_time_compose (gint year,
* @hour: location to store hour, or %NULL
* @minute: location to store minute, or %NULL
* @second: location to store second, or %NULL
- *
+ *
* Splits up an #mrptime value into its components.
- *
+ *
* Return value: %TRUE on success.
**/
gboolean
@@ -135,12 +135,12 @@ mrp_time_decompose (mrptime t,
mrp_time2_get_time (&t2, hour, minute, second);
return TRUE;
-}
+}
/**
* mrp_time_debug_print:
* @t: an #mrptime
- *
+ *
* Prints the time on stdout, for debugging purposes.
**/
void
@@ -156,9 +156,9 @@ mrp_time_debug_print (mrptime t)
/**
* mrp_time_from_tm:
* @tm: pointer to a struct tm time value
- *
+ *
* Converts a struct tm value to an #mrptime value.
- *
+ *
* Return value: #mrptime value.
**/
mrptime
@@ -171,7 +171,7 @@ mrp_time_from_tm (struct tm *tm)
/* This is a hack. Set the timezone to UTC temporarily. */
old_tz = g_strdup (g_getenv ("TZ"));
g_setenv ("TZ", "UTC", TRUE);
-
+
t = mktime (tm);
/* And set it back. */
@@ -184,13 +184,13 @@ mrp_time_from_tm (struct tm *tm)
}
g_free (old_tz);
-
+
return t;
}
/**
* mrp_time_current_time:
- *
+ *
* Retrieves the current time as an #mrptime value.
*
* Return value: Current time.
@@ -209,9 +209,9 @@ mrp_time_current_time (void)
/**
* mrp_time_to_tm:
* @t: an #mrptime value
- *
+ *
* Converts @t to a struct tm value.
- *
+ *
* Return value: struct tm time, which is static data and should not be
* modified or freed.
**/
@@ -221,7 +221,7 @@ mrp_time_to_tm (mrptime t)
time_t tt;
tt = t;
-
+
return gmtime (&tt);
}
@@ -229,9 +229,9 @@ mrp_time_to_tm (mrptime t)
* mrp_time_from_string:
* @str: a string with a time, ISO8601 format
* @err: Location to store error, or %NULL
- *
+ *
* Parses an ISO8601 time string and converts it to an #mrptime.
- *
+ *
* Return value: Converted time value.
**/
mrptime
@@ -256,7 +256,7 @@ mrp_time_from_string (const gchar *str,
} else if (len == 16) { /* UTC time, ends in 'Z' */
is_utc = TRUE;
is_date = FALSE;
-
+
if (str[15] != 'Z') {
/*g_set_error (err,
GQuark domain,
@@ -279,21 +279,21 @@ mrp_time_from_string (const gchar *str,
return 0;
}
-
+
if (is_date) {
if (sscanf (str, "%04d%02d%02d", &year, &month, &day) != 3) {
return 0;
}
} else {
gchar tsep;
-
+
if (sscanf (str,"%04d%02d%02d%c%02d%02d%02d",
&year, &month, &day,
&tsep,
&hour, &minute, &second) != 7) {
return 0;
}
-
+
if (tsep != 'T') {
/*g_set_error (err,
GQuark domain,
@@ -302,13 +302,13 @@ mrp_time_from_string (const gchar *str,
...);*/
return 0;
}
-
+
}
/* FIXME: If we want to support reading times other than in UTC,
* implement that here.
*/
-
+
return mrp_time_compose (year,
month,
day,
@@ -320,9 +320,9 @@ mrp_time_from_string (const gchar *str,
/**
* mrp_time_to_string:
* @t: an #mrptime time
- *
+ *
* Converts a time value to an ISO8601 string.
- *
+ *
* Return value: Allocated string that needs to be freed.
**/
gchar *
@@ -338,9 +338,9 @@ mrp_time_to_string (mrptime t)
/**
* mrp_time_align_day:
* @t: an #mrptime value
- *
+ *
* Aligns a time value to the start of the day.
- *
+ *
* Return value: Aligned value.
**/
mrptime
@@ -379,9 +379,9 @@ mrp_time_align_next (mrptime t, MrpTimeUnit unit)
/**
* mrp_time_day_of_week:
* @t: an #mrptime value
- *
+ *
* Retrieves the day of week of the specified time.
- *
+ *
* Return value: The day of week, in the range 0 to 6, where Sunday is 0.
**/
gint
@@ -396,25 +396,25 @@ mrp_time_day_of_week (mrptime t)
if (weekday == 7) {
weekday = 0;
}
-
+
return weekday;
}
/**
* mrp_time_week_number:
* @t: an #mrptime value
- *
+ *
* Retrieves the week number of the specified time.
- *
+ *
* Return value: ISO standard week number.
**/
gint
mrp_time_week_number (mrptime t)
{
MrpTime t2;
-
+
mrp_time2_set_epoch (&t2, t);
-
+
return mrp_time2_get_week_number (&t2, NULL);
}
@@ -424,9 +424,9 @@ mrp_time_week_number (mrptime t)
* @nick: nick for the propery
* @blurb: blurb for the property
* @flags: flags
- *
+ *
* Convenience function for creating a #GParamSpec carrying an #mrptime value.
- *
+ *
* Return value: Newly created #GparamSpec.
**/
GParamSpec *
@@ -445,9 +445,9 @@ mrp_param_spec_time (const gchar *name,
/**
* mrp_time_day_name:
* @t: an #mrptime value
- *
- * Retrieves the name of the day of the specified time.
- *
+ *
+ * Retrieves the name of the day of the specified time.
+ *
* Return value: The day name, which is static data.
**/
const gchar *
@@ -458,18 +458,18 @@ mrp_time_day_name (mrptime t)
g_return_val_if_fail (t > 0, NULL);
g_warning ("day name");
-
+
dow = mrp_time_day_of_week (t);
-
+
return short_day_names[dow];
}
/**
* mrp_time_month_name:
* @t: an #mrptime value
- *
+ *
* Retrieves the name of the month of the specified time.
- *
+ *
* Return value: The month name, which is static data.
**/
const gchar *
@@ -487,9 +487,9 @@ mrp_time_month_name (mrptime t)
/**
* mrp_time_month_name_initial:
* @t: an #mrptime value
- *
+ *
* Retrieves the initial letter for the month of the specified time.
- *
+ *
* Return value: The initial, which is static data.
**/
const gchar *
@@ -506,7 +506,7 @@ mrp_time_month_name_initial (mrptime t)
/**
* imrp_time_init:
- *
+ *
* Initializes the time functions. Must be called before using any mrp_
* functions.
**/
@@ -514,28 +514,28 @@ void
imrp_time_init (void)
{
gint i;
-
+
/* Get month and day names. */
-
+
#ifndef WIN32
for (i = 0; i < 12; i++) {
gunichar c;
-
+
short_month_names[i] = g_locale_to_utf8 (nl_langinfo (ABMON_1 + i),
-1, NULL, NULL, NULL);
month_names[i] = g_locale_to_utf8 (nl_langinfo (MON_1 + i),
-1, NULL, NULL, NULL);
-
+
c = g_utf8_get_char (month_names[i]);
month_names_initial[i] = g_malloc0 (7);
g_unichar_to_utf8 (c, (char *)month_names_initial[i]);
-
+
}
for (i = 0; i < 7; i++) {
short_day_names[i] = g_locale_to_utf8 (nl_langinfo (ABDAY_1 + i),
-1, NULL, NULL, NULL);
-
+
day_names[i] = g_locale_to_utf8 (nl_langinfo (DAY_1 + i),
-1, NULL, NULL, NULL);
}
@@ -557,13 +557,13 @@ imrp_time_init (void)
len);
short_month_names[i] = g_locale_to_utf8(buffer, -1, NULL, NULL,
NULL);
-
+
len = GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_SMONTHNAME1+i,
NULL,
0);
buffer = g_realloc(buffer, len);
-
+
GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_SMONTHNAME1+i,
buffer,
@@ -571,17 +571,17 @@ imrp_time_init (void)
month_names[i] = g_locale_to_utf8(buffer, -1, NULL, NULL,
NULL);
g_free(buffer);
-
+
c = g_utf8_get_char (month_names[i]);
month_names_initial[i] = g_malloc0 (7);
g_unichar_to_utf8 (c, (char *)month_names_initial[i]);
-
+
}
for (i = 0; i < 7; i++) {
int len;
gchar *buffer;
-
+
len = GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_SABBREVDAYNAME1+i,
NULL,
@@ -596,7 +596,7 @@ imrp_time_init (void)
// we need to offset Mon-Sat and fix Sunday
short_day_names[i < 6 ? i + 1 : 0] = g_locale_to_utf8(buffer, -1, NULL, NULL,
NULL);
-
+
len = GetLocaleInfo(LOCALE_USER_DEFAULT,
LOCALE_SDAYNAME1+i,
NULL,
@@ -626,7 +626,7 @@ time_format_helper (const gchar *format,
gint year, month, day;
gint hour, min, sec;
gint weekday;
-
+
if (!format) {
return 1;
}
@@ -638,12 +638,12 @@ time_format_helper (const gchar *format,
hour = t->hour;
min = t->min;
sec = t->sec;
-
+
weekday = g_date_get_weekday (&t->date);
if (weekday == 7) {
weekday = 0;
}
-
+
while (*format) {
register gchar c = *format++;
register gint tmp;
@@ -652,11 +652,11 @@ time_format_helper (const gchar *format,
if (buffer) {
buffer[len] = c;
}
-
+
len++;
continue;
}
-
+
c = *format++;
switch (c) {
case 'a':
@@ -713,7 +713,7 @@ time_format_helper (const gchar *format,
buffer[len] = hour / 10 + '0';
buffer[len+1] = hour - 10 * (hour / 10) + '0';
}
- len += 2;
+ len += 2;
break;
case 'I':
/* The hour using a 12-hour clock (01 - 12). */
@@ -723,11 +723,11 @@ time_format_helper (const gchar *format,
if (tmp == 0) {
tmp = 12;
}
-
+
buffer[len] = tmp / 10 + '0';
buffer[len+1] = tmp - 10 * (tmp / 10) + '0';
}
- len += 2;
+ len += 2;
break;
case 'j':
/* The day of the year (001 - 366). */
@@ -757,7 +757,7 @@ time_format_helper (const gchar *format,
if (tmp == 0) {
tmp = 12;
}
-
+
if (buffer) {
if (tmp > 9) {
buffer[len] = tmp / 10 + '0';
@@ -774,7 +774,7 @@ time_format_helper (const gchar *format,
buffer[len] = month / 10 + '0';
buffer[len+1] = month - 10 * (month / 10) + '0';
}
- len += 2;
+ len += 2;
break;
case 'M':
/* The minute (00 - 59). */
@@ -782,7 +782,7 @@ time_format_helper (const gchar *format,
buffer[len] = min / 10 + '0';
buffer[len+1] = min - 10 * (min / 10) + '0';
}
- len += 2;
+ len += 2;
break;
case 'p':
/* Either 'AM' or 'PM' according to the given time value. */
@@ -814,7 +814,7 @@ time_format_helper (const gchar *format,
buffer[len] = ':';
}
len++;
-
+
if (buffer) {
buffer[len] = min / 10 + '0';
buffer[len+1] = min - 10 * (min / 10) + '0';
@@ -878,16 +878,16 @@ time_format_helper (const gchar *format,
if (buffer) {
buffer[len] = 0;
}
-
+
/* Include the terminating zero. */
return len + 1;
}
/**
* mrp_time_format:
- * @format: format string
+ * @format: format string
* @t: an #mrptime value
- *
+ *
* Formats a string with time values. The following format codes are allowed:
* <informalexample><programlisting>
* %a The abbreviated weekday name (Mon, Tue, ...)
@@ -934,7 +934,7 @@ mrp_time_format (const gchar *format, mrptime t)
/**
* mrp_time_format_locale:
* @t: an #mrptime value
- *
+ *
* Formats a string with time values. For format is the preferred for the
* current locale.
*
@@ -973,7 +973,7 @@ mrp_time2_new (void)
t = g_new0 (MrpTime, 1);
g_date_clear (&t->date, 1);
-
+
return t;
}
@@ -993,7 +993,7 @@ mrp_time2_set_date (MrpTime *t,
g_return_if_fail (year >= 1 && year <= 9999);
g_return_if_fail (month >= 1 && month <= 12);
g_return_if_fail (day >= 1 && day <= 31);
-
+
g_date_set_dmy (&t->date, day, month, year);
}
@@ -1007,7 +1007,7 @@ mrp_time2_set_time (MrpTime *t,
g_return_if_fail (hour >= 0 && hour < 24);
g_return_if_fail (min >= 0 && min < 60);
g_return_if_fail (sec >= 0 && sec < 60);
-
+
t->hour = hour;
t->min = min;
t->sec = sec;
@@ -1023,7 +1023,7 @@ mrp_time2_get_date (MrpTime *t,
g_return_if_fail (year != NULL);
g_return_if_fail (month != NULL);
g_return_if_fail (day != NULL);
-
+
*year = g_date_get_year (&t->date);
*month = g_date_get_month (&t->date);
*day = g_date_get_day (&t->date);
@@ -1039,7 +1039,7 @@ mrp_time2_get_time (MrpTime *t,
g_return_if_fail (hour != NULL);
g_return_if_fail (min != NULL);
g_return_if_fail (sec != NULL);
-
+
*hour = t->hour;
*min = t->min;
*sec = t->sec;
@@ -1076,12 +1076,12 @@ void
mrp_time2_add_seconds (MrpTime *t, gint64 secs)
{
gint days;
-
+
g_return_if_fail (t != NULL);
g_return_if_fail (secs >= 0);
secs += t->sec + SECS_IN_MIN * t->min + SECS_IN_HOUR * t->hour;
-
+
/* Add whole days first. */
days = secs / SECS_IN_DAY;
secs = secs % SECS_IN_DAY;
@@ -1118,7 +1118,7 @@ void
mrp_time2_subtract_seconds (MrpTime *t, gint64 secs)
{
gint days;
-
+
g_return_if_fail (t != NULL);
g_return_if_fail (secs >= 0);
@@ -1189,7 +1189,7 @@ mrp_time2_debug_print (MrpTime *t)
g_date_strftime (str, 128, "%04Y-%02m-%02d",
&t->date);
- g_print ("%s %02d:%02d:%02d\n", str,
+ g_print ("%s %02d:%02d:%02d\n", str,
t->hour,
t->min,
t->sec);
@@ -1217,7 +1217,7 @@ mrp_time2_set_from_string (MrpTime *t,
} else if (len == 16) { /* UTC time, ends in 'Z' */
is_utc = TRUE;
is_date = FALSE;
-
+
if (str[15] != 'Z') {
return FALSE;
}
@@ -1228,32 +1228,32 @@ mrp_time2_set_from_string (MrpTime *t,
} else {
return FALSE;
}
-
+
if (is_date) {
if (sscanf (str, "%04d%02d%02d", &year, &month, &day) != 3) {
return FALSE;
}
} else {
gchar tsep;
-
+
if (sscanf (str,"%04d%02d%02d%c%02d%02d%02d",
&year, &month, &day,
&tsep,
&hour, &minute, &second) != 7) {
return 0;
}
-
+
if (tsep != 'T') {
return FALSE;
}
-
+
}
mrp_time2_set_date (t, year, month, day);
if (!is_date) {
mrp_time2_set_time (t, hour, minute, second);
}
-
+
return TRUE;
}
@@ -1265,7 +1265,7 @@ mrp_time2_to_string (MrpTime *t)
day = g_date_get_day (&t->date);
month = g_date_get_month (&t->date);
year = g_date_get_year (&t->date);
-
+
return g_strdup_printf ("%04d%02d%02dT%02d%02d%02dZ",
year, month, day,
t->hour, t->min, t->sec);
@@ -1287,7 +1287,7 @@ mrp_time2_get_epoch (MrpTime *t)
time_t epoch;
g_date_set_dmy (&date, 1, 1, 1970);
-
+
epoch = SECS_IN_DAY * g_date_days_between (&date, &t->date);
epoch += t->hour * SECS_IN_HOUR + t->min * SECS_IN_MIN + t->sec;
@@ -1299,7 +1299,7 @@ const gchar *
mrp_time2_get_day_name (MrpTime *t)
{
GDateWeekday day;
-
+
g_return_val_if_fail (t != NULL, NULL);
day = g_date_get_weekday (&t->date);
@@ -1307,8 +1307,8 @@ mrp_time2_get_day_name (MrpTime *t)
/* Weekday is mon-sun 1-7, while the array is sun-sat 0-6. */
if (day == 7) {
day = 0;
- }
-
+ }
+
return short_day_names[day];
}
@@ -1336,7 +1336,7 @@ stolen_g_date_get_iso8601_week_of_year (const GDate *d)
/* Formula taken from the Calendar FAQ; the formula was for the
* Julian Period which starts on 1 January 4713 BC, so we add
- * 1,721,425 to the number of days before doing the formula.
+ * 1,721,425 to the number of days before doing the formula.
*/
j = g_date_get_julian (d) + 1721425;
d4 = (j + 31741 - (j % 7)) % 146097 % 36524 % 1461;
@@ -1357,12 +1357,12 @@ mrp_time2_get_week_number (MrpTime *t, gint *y)
week = stolen_g_date_get_iso8601_week_of_year (&t->date);
- /* Calculate the year this week belongs to as it can be different than
+ /* Calculate the year this week belongs to as it can be different than
* the year of the date (e.g. December 31 2002 is in week 1 of 2003).
*/
if(y != NULL) {
year = g_date_get_year (&t->date);
-
+
switch(g_date_get_month (&t->date)) {
case G_DATE_JANUARY:
if(week > 50) {
@@ -1388,9 +1388,9 @@ mrp_time2_align_prev (MrpTime *t, MrpTimeUnit unit)
{
GDateWeekday weekday;
GDateMonth month;
-
+
g_return_if_fail (t != NULL);
-
+
switch (unit) {
case MRP_TIME_UNIT_HOUR:
t->min = 0;
@@ -1406,7 +1406,7 @@ mrp_time2_align_prev (MrpTime *t, MrpTimeUnit unit)
t->hour = 0;
}
break;
-
+
case MRP_TIME_UNIT_HALFDAY:
if (t->hour < 12) {
t->hour = 0;
@@ -1416,7 +1416,7 @@ mrp_time2_align_prev (MrpTime *t, MrpTimeUnit unit)
t->min = 0;
t->sec = 0;
break;
-
+
case MRP_TIME_UNIT_DAY:
t->hour = 0;
t->min = 0;
@@ -1458,7 +1458,7 @@ mrp_time2_align_prev (MrpTime *t, MrpTimeUnit unit)
g_date_set_month (&t->date, 10);
}
break;
-
+
case MRP_TIME_UNIT_HALFYEAR:
g_date_set_day (&t->date, 1);
t->hour = 0;
@@ -1490,7 +1490,7 @@ mrp_time2_align_next (MrpTime *t, MrpTimeUnit unit)
{
GDateWeekday weekday;
GDateMonth month;
-
+
g_return_if_fail (t != NULL);
switch (unit) {
@@ -1516,14 +1516,14 @@ mrp_time2_align_next (MrpTime *t, MrpTimeUnit unit)
mrp_time2_add_days (t, 1);
}
break;
-
+
case MRP_TIME_UNIT_DAY:
t->hour = 0;
t->min = 0;
t->sec = 0;
mrp_time2_add_days (t, 1);
break;
-
+
case MRP_TIME_UNIT_WEEK:
/* FIXME: We currently hardcode monday as week start .*/
weekday = g_date_get_weekday (&t->date);
@@ -1561,7 +1561,7 @@ mrp_time2_align_next (MrpTime *t, MrpTimeUnit unit)
g_date_add_years (&t->date, 1);
}
break;
-
+
case MRP_TIME_UNIT_HALFYEAR:
g_date_set_day (&t->date, 1);
t->hour = 0;
@@ -1575,7 +1575,7 @@ mrp_time2_align_next (MrpTime *t, MrpTimeUnit unit)
g_date_add_years (&t->date, 1);
}
break;
-
+
case MRP_TIME_UNIT_YEAR:
t->hour = 0;
t->min = 0;
diff --git a/libplanner/mrp-time.h b/libplanner/mrp-time.h
index de01157..03b3f0f 100644
--- a/libplanner/mrp-time.h
+++ b/libplanner/mrp-time.h
@@ -146,7 +146,7 @@ time_t mrp_time2_get_epoch (MrpTime *t);
const gchar *mrp_time2_get_day_name (MrpTime *t);
const gchar *mrp_time2_get_month_name (MrpTime *t);
const gchar *mrp_time2_get_month_initial (MrpTime *t);
-gint mrp_time2_get_week_number (MrpTime *t,
+gint mrp_time2_get_week_number (MrpTime *t,
gint *year);
void mrp_time2_align_prev (MrpTime *t,
MrpTimeUnit unit);
diff --git a/libplanner/mrp-types.c b/libplanner/mrp-types.c
index 3391b25..42bffbc 100644
--- a/libplanner/mrp-types.c
+++ b/libplanner/mrp-types.c
@@ -97,18 +97,18 @@ mrp_property_type_get_type (void)
GList *
mrp_string_list_copy (const GList *list)
{
- const GList *l;
+ const GList *l;
GList *copy;
if (!list) {
return NULL;
}
-
+
copy = NULL;
for (l = list; l; l = l->next) {
copy = g_list_prepend (copy, g_strdup (l->data));
}
-
+
return g_list_reverse (copy);
}
@@ -116,15 +116,15 @@ void
mrp_string_list_free (GList *list)
{
GList *l;
-
+
if (!list) {
return;
}
-
+
for (l = list; l; l = l->next) {
g_free (l->data);
}
-
+
g_list_free (list);
}
diff --git a/libplanner/mrp-types.h b/libplanner/mrp-types.h
index 62c34a6..176e1f6 100644
--- a/libplanner/mrp-types.h
+++ b/libplanner/mrp-types.h
@@ -19,7 +19,7 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+
#ifndef __MRP_TYPES_H__
#define __MRP_TYPES_H__
diff --git a/libplanner/mrp-xml.c b/libplanner/mrp-xml.c
index bc4f065..5fc5b83 100644
--- a/libplanner/mrp-xml.c
+++ b/libplanner/mrp-xml.c
@@ -54,22 +54,22 @@ static gboolean xml_validate (xmlDoc *doc,
-static gboolean
+static gboolean
xml_read_context (xmlParserCtxt *ctxt,
MrpProject *project,
GError **error)
{
xmlDoc *doc;
gboolean ret_val;
-
+
xmlParseDocument (ctxt);
-
+
doc = ctxt->myDoc;
if (!doc) {
g_warning ("Could not read XML.");
return FALSE;
}
-
+
if (!ctxt->wellFormed) {
g_warning ("Document not well formed.");
xmlFreeDoc (doc);
@@ -89,15 +89,15 @@ xml_read_context (xmlParserCtxt *ctxt,
ret_val = FALSE;
break;
};
-
+
xmlFreeDoc (doc);
-
+
return ret_val;
}
-static gboolean
-xml_read_string (MrpFileReader *reader,
- const gchar *str,
+static gboolean
+xml_read_string (MrpFileReader *reader,
+ const gchar *str,
MrpProject *project,
GError **error)
{
@@ -118,12 +118,12 @@ xml_read_string (MrpFileReader *reader,
return ret_val;
}
-static XmlType
+static XmlType
xml_locate_type (xmlDoc *doc)
{
XmlType ret_val = XML_TYPE_UNKNOWN;
gchar *filename;
-
+
filename = mrp_paths_get_dtd_dir ("mrproject-0.6.dtd");
if (xml_validate (doc, filename)) {
ret_val = XML_TYPE_MRP_0_6;
@@ -134,30 +134,30 @@ xml_locate_type (xmlDoc *doc)
ret_val = XML_TYPE_MRP_0_5_1;
}
}
-
+
g_free (filename);
return ret_val;
}
-static gboolean
+static gboolean
xml_validate (xmlDoc *doc, const gchar *dtd_path)
{
xmlValidCtxt cvp;
xmlDtd *dtd;
gboolean ret_val;
-
+
g_return_val_if_fail (doc != NULL, FALSE);
g_return_val_if_fail (dtd_path != NULL, FALSE);
-
+
memset (&cvp, 0, sizeof (cvp));
dtd = xmlParseDTD (NULL, dtd_path);
ret_val = xmlValidateDtd (&cvp, doc, dtd);
-
+
xmlFreeDtd (dtd);
-
+
return ret_val;
}
@@ -165,11 +165,11 @@ G_MODULE_EXPORT void
init (MrpFileModule *module, MrpApplication *application)
{
MrpFileReader *reader;
-
+
reader = g_new0 (MrpFileReader, 1);
reader->module = module;
reader->priv = NULL;
-
+
reader->read_string = xml_read_string;
imrp_application_register_reader (application, reader);
diff --git a/libplanner/mrp-xsl.c b/libplanner/mrp-xsl.c
index b80b13e..9ec6357 100644
--- a/libplanner/mrp-xsl.c
+++ b/libplanner/mrp-xsl.c
@@ -52,17 +52,17 @@ static gboolean xml_planner_pre012_write (MrpFileWriter *writer,
GError **error);
-static void xslt_module_gettext (xmlXPathParserContextPtr ctxt,
+static void xslt_module_gettext (xmlXPathParserContextPtr ctxt,
int argc);
-static void xslt_module_getdate (xmlXPathParserContextPtr ctxt,
+static void xslt_module_getdate (xmlXPathParserContextPtr ctxt,
int argc);
-static void xslt_module_shutdown (xsltTransformContextPtr ctxt,
- const xmlChar *uri,
+static void xslt_module_shutdown (xsltTransformContextPtr ctxt,
+ const xmlChar *uri,
void *data);
-static void * xslt_module_init (xsltTransformContextPtr ctxt,
+static void * xslt_module_init (xsltTransformContextPtr ctxt,
const xmlChar *uri);
extern mrptime mrp_time_from_tm (struct tm *tm);
@@ -109,10 +109,10 @@ xslt_module_init (xsltTransformContextPtr ctxt, const xmlChar *uri)
xsltRegisterExtFunction (ctxt, (const xmlChar *)"getdate", uri,
xslt_module_getdate);
- return NULL;
+ return NULL;
}
-
+
static gboolean
html_write (MrpFileWriter *writer,
MrpProject *project,
@@ -136,9 +136,9 @@ html_write (MrpFileWriter *writer,
xmlLoadExtDtdDefaultValue = 1;
exsltRegisterAll ();
- xsltRegisterExtModule((const xmlChar *)"http://www.gnu.org/software/gettext/",
+ xsltRegisterExtModule((const xmlChar *)"http://www.gnu.org/software/gettext/",
xslt_module_init, xslt_module_shutdown);
-
+
filename = mrp_paths_get_stylesheet_dir ("planner2html.xsl");
stylesheet = xsltParseStylesheetFile (filename);
g_free (filename);
@@ -157,13 +157,13 @@ html_write (MrpFileWriter *writer,
_("Export to HTML failed"));
ret = FALSE;
}
-
+
xsltFreeStylesheet (stylesheet);
xmlFree (final_doc);
-
+
return ret;
}
-
+
static gboolean
xml_planner_pre012_write (MrpFileWriter *writer,
MrpProject *project,
@@ -181,7 +181,7 @@ xml_planner_pre012_write (MrpFileWriter *writer,
if (!mrp_project_save_to_xml (project, &xml_project, error)) {
return FALSE;
}
-
+
/* libxml housekeeping */
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
@@ -194,7 +194,7 @@ xml_planner_pre012_write (MrpFileWriter *writer,
doc = xmlParseMemory (xml_project, strlen (xml_project));
final_doc = xsltApplyStylesheet (stylesheet, doc, NULL);
xmlFree (doc);
-
+
ret = TRUE;
if (!final_doc ||
@@ -205,7 +205,7 @@ xml_planner_pre012_write (MrpFileWriter *writer,
_("Export to HTML failed"));
ret = FALSE;
}
-
+
xsltFreeStylesheet (stylesheet);
xmlFree (final_doc);
@@ -216,16 +216,16 @@ G_MODULE_EXPORT void
init (MrpFileModule *module, MrpApplication *application)
{
MrpFileWriter *writer;
-
+
writer = g_new0 (MrpFileWriter, 1);
-
+
/* The HTML writer registration */
writer->module = module;
writer->identifier = "Planner HTML";
writer->mime_type = "text/html";
writer->priv = NULL;
-
+
writer->write = html_write;
imrp_application_register_writer (application, writer);
@@ -233,12 +233,12 @@ init (MrpFileModule *module, MrpApplication *application)
/* The older Planner/Mrproject writer registration */
writer = g_new0 (MrpFileWriter, 1);
-
+
writer->module = module;
writer->identifier = "Planner XML pre-0.12"; /* Don't change unless you change plugin to match */
writer->mime_type = "text/xml";
writer->priv = NULL;
-
+
writer->write = xml_planner_pre012_write;
imrp_application_register_writer (application, writer);
diff --git a/python/plannermodule.c b/python/plannermodule.c
index 52bc6d2..c8e3e7f 100644
--- a/python/plannermodule.c
+++ b/python/plannermodule.c
@@ -17,12 +17,12 @@ DL_EXPORT(void)
initplanner(void)
{
PyObject *m, *d;
-
+
init_pygobject ();
m = Py_InitModule ("planner", planner_functions);
d = PyModule_GetDict (m);
-
+
planner_register_classes (d);
planner_add_constants (m, "MRP_");
diff --git a/python/planneruimodule.c b/python/planneruimodule.c
index 7069810..a52e52d 100644
--- a/python/planneruimodule.c
+++ b/python/planneruimodule.c
@@ -15,12 +15,12 @@ DL_EXPORT(void)
initplannerui(void)
{
PyObject *m, *d;
-
+
init_pygobject ();
m = Py_InitModule ("plannerui", plannerui_functions);
d = PyModule_GetDict (m);
-
+
plannerui_register_classes (d);
if (PyErr_Occurred ()) {
diff --git a/src/eel-canvas-rect.c b/src/eel-canvas-rect.c
index 2b8879a..5037908 100644
--- a/src/eel-canvas-rect.c
+++ b/src/eel-canvas-rect.c
@@ -96,9 +96,9 @@ eel_canvas_rect_update_fill_gc (EelCanvasRect *rect,
GdkColor c;
item = GNOME_CANVAS_ITEM (rect);
-
+
details = rect->details;
-
+
if (details->fill_gc == NULL) {
if (!create) {
return;
@@ -106,7 +106,7 @@ eel_canvas_rect_update_fill_gc (EelCanvasRect *rect,
details->fill_gc =
gdk_gc_new (GTK_WIDGET (item->canvas)->window);
}
-
+
c.pixel = gnome_canvas_get_color_pixel (item->canvas,
details->fill_color);
gdk_gc_set_foreground (details->fill_gc, &c);
@@ -121,9 +121,9 @@ eel_canvas_rect_update_outline_gc (EelCanvasRect *rect,
GdkColor c;
item = GNOME_CANVAS_ITEM (rect);
-
+
details = rect->details;
-
+
if (details->outline_gc == NULL) {
if (!create) {
return;
@@ -131,7 +131,7 @@ eel_canvas_rect_update_outline_gc (EelCanvasRect *rect,
details->outline_gc =
gdk_gc_new (GTK_WIDGET (item->canvas)->window);
}
-
+
c.pixel = gnome_canvas_get_color_pixel (item->canvas,
details->outline_color);
gdk_gc_set_foreground (details->outline_gc, &c);
@@ -156,7 +156,7 @@ eel_canvas_rect_finalize (GObject *object)
EelCanvasRect *rect;
g_return_if_fail (EEL_IS_CANVAS_RECT (object));
-
+
rect = EEL_CANVAS_RECT (object);
g_free (rect->details);
@@ -203,15 +203,15 @@ eel_canvas_rect_set_property (GObject *object,
details->fill_color = g_value_get_uint (value);
eel_canvas_rect_update_fill_gc (rect, FALSE);
-
+
gnome_canvas_item_request_update (item);
break;
-
+
case PROP_OUTLINE_COLOR_RGBA:
details->outline_color = g_value_get_uint (value);
eel_canvas_rect_update_outline_gc (rect, FALSE);
-
+
gnome_canvas_item_request_update (item);
break;
@@ -225,7 +225,7 @@ eel_canvas_rect_set_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
-
+
}
static void
@@ -256,11 +256,11 @@ eel_canvas_rect_get_property (GObject *object,
case PROP_Y2:
g_value_set_double (value, details->y2);
break;
-
+
case PROP_FILL_COLOR_RGBA:
g_value_set_uint (value, details->fill_color);
break;
-
+
case PROP_OUTLINE_COLOR_RGBA:
g_value_set_uint (value, details->outline_color);
break;
@@ -271,7 +271,7 @@ eel_canvas_rect_get_property (GObject *object,
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
- }
+ }
}
static void
@@ -317,7 +317,7 @@ eel_canvas_rect_update (GnomeCanvasItem *item,
/* Update bounding box: */
width_lt = floor (details->width_pixels / 2.0) / item->canvas->pixels_per_unit;
width_rb = ceil (details->width_pixels / 2.0) / item->canvas->pixels_per_unit;
-
+
x1 = details->x1;
y1 = details->y1;
x2 = details->x2;
@@ -340,18 +340,18 @@ eel_canvas_rect_update (GnomeCanvasItem *item,
}
details->last_update_rect = update_rect;
-
+
/* Outline and bounding box */
gnome_canvas_w2c (item->canvas, x1 - width_lt, y1 - width_lt, &cx1, &cy1);
gnome_canvas_w2c (item->canvas, x2 + width_rb, y2 + width_rb, &cx2, &cy2);
-
+
update_rect = make_drect (cx1, cy1, cx2, cy2);
request_redraw_borders (item->canvas, &details->last_outline_update_rect,
(width_lt + width_rb)*item->canvas->pixels_per_unit);
request_redraw_borders (item->canvas, &update_rect,
(width_lt + width_rb)*item->canvas->pixels_per_unit);
details->last_outline_update_rect = update_rect;
-
+
item->x1 = cx1;
item->y1 = cy1;
item->x2 = cx2;
@@ -368,7 +368,7 @@ eel_canvas_rect_realize (GnomeCanvasItem *item)
#endif
rect = EEL_CANVAS_RECT (item);
details = rect->details;
-
+
eel_canvas_rect_update_outline_gc (rect, TRUE);
#ifdef HAVE_RENDER
@@ -405,7 +405,7 @@ eel_canvas_rect_unrealize (GnomeCanvasItem *item)
g_object_unref (details->outline_gc);
details->outline_gc = NULL;
}
-
+
if (details->fill_gc) {
g_object_unref (details->fill_gc);
details->fill_gc = NULL;
@@ -485,7 +485,7 @@ render_rect_alpha (EelCanvasRect *rect,
if (width <= 0 || height <= 0 ) {
return;
}
-
+
details = rect->details;
r = (rgba >> 24) & 0xff;
@@ -499,7 +499,7 @@ render_rect_alpha (EelCanvasRect *rect,
Picture pict;
XRenderPictureAttributes attributes;
XRenderColor color;
-
+
dpy = gdk_x11_drawable_get_xdisplay (drawable);
pict = XRenderCreatePicture (dpy,
@@ -513,12 +513,12 @@ render_rect_alpha (EelCanvasRect *rect,
r = r * a / 255;
g = g * a / 255;
b = b * a / 255;
-
+
color.red = (r << 8) + r;
color.green = (g << 8) + g;
color.blue = (b << 8) + b;
color.alpha = (a << 8) + a;
-
+
XRenderFillRectangle (dpy,
PictOpOver,
pict,
@@ -533,23 +533,23 @@ render_rect_alpha (EelCanvasRect *rect,
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
data = gdk_pixbuf_get_pixels (pixbuf);
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-
+
r = (rgba >> 24) & 0xff;
g = (rgba >> 16) & 0xff;
b = (rgba >> 8) & 0xff;
a = (rgba >> 0) & 0xff;
-
+
for (i = 0; i < width*4; ) {
data[i++] = r;
data[i++] = g;
data[i++] = b;
data[i++] = a;
}
-
+
for (i = 1; i < height; i++) {
memcpy (data + i*rowstride, data, width*4);
}
-
+
gdk_pixbuf_render_to_drawable_alpha (pixbuf,
drawable,
0, 0,
@@ -598,7 +598,7 @@ eel_canvas_rect_draw (GnomeCanvasItem *item,
cy1 = MAX (0, cy1 - y);
cx2 = MIN (width, cx2 - x);
cy2 = MIN (height, cy2 - y);
-
+
if ((details->fill_color & 0xff) != 255) {
render_rect_alpha (rect,
drawable,
@@ -617,10 +617,10 @@ eel_canvas_rect_draw (GnomeCanvasItem *item,
}
/* Box outline: */
-
+
gnome_canvas_w2c (item->canvas, x1, y1, &cx1, &cy1);
gnome_canvas_w2c (item->canvas, x2, y2, &cx2, &cy2);
-
+
/* FIXME: Doesn't handle alpha for outline. Nautilus doesn't currently use this */
gdk_draw_rectangle (drawable,
details->outline_gc,
@@ -658,7 +658,7 @@ eel_canvas_rect_class_init (EelCanvasRectClass *class)
gobject_class = G_OBJECT_CLASS (class);
item_class = GNOME_CANVAS_ITEM_CLASS (class);
-
+
gobject_class->finalize = eel_canvas_rect_finalize;
gobject_class->set_property = eel_canvas_rect_set_property;
gobject_class->get_property = eel_canvas_rect_get_property;
@@ -670,7 +670,7 @@ eel_canvas_rect_class_init (EelCanvasRectClass *class)
item_class->point = eel_canvas_rect_point;
item_class->render = eel_canvas_rect_render;
item_class->bounds = eel_canvas_rect_bounds;
-
+
g_object_class_install_property (gobject_class,
PROP_X1,
g_param_spec_double ("x1", NULL, NULL,
@@ -691,7 +691,7 @@ eel_canvas_rect_class_init (EelCanvasRectClass *class)
g_param_spec_double ("y2", NULL, NULL,
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
-
+
g_object_class_install_property (gobject_class,
PROP_FILL_COLOR_RGBA,
g_param_spec_uint ("fill_color_rgba", NULL, NULL,
diff --git a/src/planner-application.c b/src/planner-application.c
index 31531be..71741a4 100644
--- a/src/planner-application.c
+++ b/src/planner-application.c
@@ -30,7 +30,7 @@
-#define d(x)
+#define d(x)
struct _PlannerApplicationPriv {
GList *windows;
@@ -152,7 +152,7 @@ planner_application_get_type (void)
type = g_type_register_static (MRP_TYPE_APPLICATION,
"PlannerApplication", &info, 0);
}
-
+
return type;
}
@@ -160,16 +160,16 @@ static void
application_class_init (PlannerApplicationClass *klass)
{
GObjectClass *o_class;
-
+
parent_class = g_type_class_peek_parent (klass);
-
+
o_class = (GObjectClass *) klass;
/* GObject signals */
o_class->finalize = application_finalize;
gtk_stock_add_static (stock_items, G_N_ELEMENTS (stock_items));
-
+
}
static void
@@ -180,7 +180,7 @@ application_init (PlannerApplication *app)
priv = g_new0 (PlannerApplicationPriv, 1);
priv->windows = NULL;
-
+
priv->recent_model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_MRU);
egg_recent_model_set_filter_mime_types (priv->recent_model,
"application/x-planner",
@@ -199,7 +199,7 @@ application_finalize (GObject *object)
PlannerApplication *app = PLANNER_APPLICATION (object);
g_object_unref (app->priv->recent_model);
-
+
g_free (app->priv);
if (G_OBJECT_CLASS (parent_class)->finalize) {
@@ -212,16 +212,16 @@ application_window_closed_cb (PlannerWindow *window,
PlannerApplication *application)
{
PlannerApplicationPriv *priv;
-
+
g_return_if_fail (PLANNER_IS_WINDOW (window));
g_return_if_fail (PLANNER_IS_APPLICATION (application));
-
+
priv = application->priv;
-
+
priv->windows = g_list_remove (priv->windows, window);
d(g_print ("Window deleted\n"));
-
+
if (g_list_length (priv->windows) == 0) {
d(g_print ("Number of windows == 0\n"));
gtk_main_quit ();
@@ -233,10 +233,10 @@ planner_application_new (void)
{
PlannerApplication *app;
PlannerApplicationPriv *priv;
-
+
app = PLANNER_APPLICATION (g_object_new (PLANNER_TYPE_APPLICATION, NULL));
priv = app->priv;
-
+
return app;
}
@@ -268,9 +268,9 @@ planner_application_exit (PlannerApplication *app)
PlannerApplicationPriv *priv;
GList *list_cpy;
GList *l;
-
+
g_return_if_fail (PLANNER_IS_APPLICATION (app));
-
+
priv = app->priv;
list_cpy = g_list_copy (priv->windows);
@@ -278,7 +278,7 @@ planner_application_exit (PlannerApplication *app)
for (l = list_cpy; l; l = l->next) {
planner_window_close (PLANNER_WINDOW (l->data));
}
-
+
g_list_free (list_cpy);
}
diff --git a/src/planner-assignment-model.c b/src/planner-assignment-model.c
index ad09897..604e7a7 100644
--- a/src/planner-assignment-model.c
+++ b/src/planner-assignment-model.c
@@ -49,10 +49,10 @@ static void mam_get_value (GtkTreeModel *treemodel,
static void mam_assignment_changed_cb (MrpTask *task,
MrpAssignment *assignment,
PlannerAssignmentModel *model);
-static void mam_resource_added_cb (MrpProject *project,
+static void mam_resource_added_cb (MrpProject *project,
MrpResource *assignment,
PlannerAssignmentModel *model);
-static void mam_resource_removed_cb (MrpProject *project,
+static void mam_resource_removed_cb (MrpProject *project,
MrpResource *resource,
PlannerAssignmentModel *model);
static void mam_resource_notify_cb (MrpResource *resource,
@@ -67,7 +67,7 @@ GType
planner_assignment_model_get_type (void)
{
static GType type = 0;
-
+
if (!type) {
static const GTypeInfo info =
{
@@ -86,7 +86,7 @@ planner_assignment_model_get_type (void)
"PlannerAssignmentModel",
&info, 0);
}
-
+
return type;
}
@@ -95,11 +95,11 @@ mam_class_init (PlannerAssignmentModelClass *klass)
{
GObjectClass *object_class;
PlannerListModelClass *lm_class;
-
+
parent_class = g_type_class_peek_parent (klass);
object_class = G_OBJECT_CLASS (klass);
lm_class = PLANNER_LIST_MODEL_CLASS (klass);
-
+
object_class->finalize = mam_finalize;
lm_class->get_n_columns = mam_get_n_columns;
@@ -111,9 +111,9 @@ static void
mam_init (PlannerAssignmentModel *model)
{
PlannerAssignmentModelPriv *priv;
-
+
priv = g_new0 (PlannerAssignmentModelPriv, 1);
-
+
priv->project = NULL;
model->priv = priv;
@@ -135,7 +135,7 @@ mam_finalize (GObject *object)
g_free (model->priv);
model->priv = NULL;
}
-
+
if (G_OBJECT_CLASS (parent_class)->finalize) {
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -175,14 +175,14 @@ mam_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value)
-{
+{
PlannerAssignmentModel *model;
MrpAssignment *assignment;
MrpResource *resource;
gchar *str;
gint units;
gfloat rate;
-
+
g_return_if_fail (PLANNER_IS_ASSIGNMENT_MODEL (tree_model));
g_return_if_fail (iter != NULL);
@@ -236,7 +236,7 @@ mam_get_value (GtkTreeModel *tree_model,
assignment = mrp_task_get_assignment (model->priv->task, resource);
if (assignment) {
MrpTaskSched sched;
-
+
g_object_get (model->priv->task, "sched", &sched, NULL);
g_value_set_boolean (value, sched == MRP_TASK_SCHED_FIXED_WORK);
} else {
@@ -254,17 +254,17 @@ mam_assignment_changed_cb (MrpTask *task,
PlannerAssignmentModel *model)
{
MrpResource *resource;
-
+
g_return_if_fail (PLANNER_IS_ASSIGNMENT_MODEL (model));
g_return_if_fail (MRP_IS_ASSIGNMENT (assignment));
-
+
resource = mrp_assignment_get_resource (assignment);
planner_list_model_update (PLANNER_LIST_MODEL (model), MRP_OBJECT (resource));
}
static void
-mam_resource_added_cb (MrpProject *project,
+mam_resource_added_cb (MrpProject *project,
MrpResource *resource,
PlannerAssignmentModel *model)
{
@@ -272,15 +272,15 @@ mam_resource_added_cb (MrpProject *project,
g_return_if_fail (MRP_IS_RESOURCE (resource));
planner_list_model_append (PLANNER_LIST_MODEL (model), MRP_OBJECT (resource));
-
- g_signal_connect_object (resource,
+
+ g_signal_connect_object (resource,
"notify",
G_CALLBACK (mam_resource_notify_cb),
model, 0);
}
static void
-mam_resource_removed_cb (MrpProject *project,
+mam_resource_removed_cb (MrpProject *project,
MrpResource *resource,
PlannerAssignmentModel *model)
{
@@ -301,7 +301,7 @@ mam_resource_notify_cb (MrpResource *resource,
{
g_return_if_fail (PLANNER_IS_ASSIGNMENT_MODEL (model));
g_return_if_fail (MRP_IS_RESOURCE (resource));
-
+
planner_list_model_update (PLANNER_LIST_MODEL (model), MRP_OBJECT (resource));
}
@@ -312,9 +312,9 @@ planner_assignment_model_new (MrpTask *task)
PlannerAssignmentModelPriv *priv;
GList *node;
GList *resources;
-
+
model = g_object_new (PLANNER_TYPE_ASSIGNMENT_MODEL, NULL);
-
+
g_return_val_if_fail (PLANNER_IS_ASSIGNMENT_MODEL (model), NULL);
priv = model->priv;
@@ -336,20 +336,20 @@ planner_assignment_model_new (MrpTask *task)
"assignment_added",
G_CALLBACK (mam_assignment_changed_cb),
model, 0);
-
+
g_signal_connect_object (priv->task,
"assignment_removed",
G_CALLBACK (mam_assignment_changed_cb),
model, 0);
- g_signal_connect_object (priv->project,
- "resource_added",
- G_CALLBACK (mam_resource_added_cb),
+ g_signal_connect_object (priv->project,
+ "resource_added",
+ G_CALLBACK (mam_resource_added_cb),
model, 0);
- g_signal_connect_object (priv->project,
- "resource_removed",
- G_CALLBACK (mam_resource_removed_cb),
+ g_signal_connect_object (priv->project,
+ "resource_removed",
+ G_CALLBACK (mam_resource_removed_cb),
model, 0);
return model;
diff --git a/src/planner-calendar-dialog.c b/src/planner-calendar-dialog.c
index c82c846..48a2e2c 100644
--- a/src/planner-calendar-dialog.c
+++ b/src/planner-calendar-dialog.c
@@ -60,7 +60,7 @@ typedef struct {
GtkWidget *working_time_button;
GtkWidget *name_label;
-
+
GtkWidget *calendar;
GtkWidget *option_menu;
@@ -70,7 +70,7 @@ typedef struct {
GtkWidget *from_entry[5];
GtkWidget *to_entry[5];
-
+
/* Data for the little modal "new calendar" dialog. */
GtkWidget *new_ok_button;
GtkWidget *new_copy_radiobutton;
@@ -192,8 +192,8 @@ planner_cal_cmd_day_type (PlannerWindow *main_window,
cmd->day = mrp_day_ref (day);
cmd->old_day = mrp_day_ref (mrp_calendar_get_day (calendar, time, FALSE));
cmd->time = time;
-
- planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
+
+ planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
(main_window),
cmd_base);
return cmd_base;
@@ -226,19 +226,19 @@ cal_cmd_remove_do (PlannerCmd *cmd_base)
for (r = all_resources; r; r = r->next) {
MrpResource *resource = r->data;
MrpCalendar *tmp_cal;
-
+
tmp_cal = mrp_resource_get_calendar (resource);
- if (tmp_cal == cmd->calendar) {
- cmd->resources = g_list_append (cmd->resources,
+ if (tmp_cal == cmd->calendar) {
+ cmd->resources = g_list_append (cmd->resources,
g_object_ref (resource));
- }
+ }
}
cmd->children = g_list_copy (mrp_calendar_get_children (cmd->calendar));
if (cmd->children) {
g_list_foreach (cmd->children, (GFunc) g_object_ref, NULL);
}
-
+
mrp_calendar_remove (cmd->calendar);
return TRUE;
@@ -314,7 +314,7 @@ planner_cal_cmd_remove (PlannerWindow *main_window,
cmd->calendar = g_object_ref (calendar);
cmd->parent = g_object_ref (mrp_calendar_get_parent (cmd->calendar));
- planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
+ planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
(main_window),
cmd_base);
return cmd_base;
@@ -344,12 +344,12 @@ cal_cmd_add_do (PlannerCmd *cmd_base)
cmd->calendar = mrp_calendar_derive (cmd->name, cmd->parent);
g_object_unref (cmd->parent);
cmd->parent = NULL;
- }
+ }
else if (cmd->parent == NULL && cmd->copy != NULL) {
cmd->calendar = mrp_calendar_copy (cmd->name, cmd->copy);
g_object_unref (cmd->copy);
cmd->copy = NULL;
- }
+ }
else if (cmd->parent == NULL && cmd->copy == NULL) {
cmd->calendar = mrp_calendar_new (cmd->name, cmd->project);
cmd->parent = g_object_ref (mrp_calendar_get_parent (cmd->calendar));
@@ -410,8 +410,8 @@ planner_cal_cmd_add (PlannerWindow *main_window,
if (copy != NULL) {
cmd->copy = g_object_ref (copy);
}
-
- planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
+
+ planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
(main_window),
cmd_base);
return cmd_base;
@@ -488,7 +488,7 @@ cal_dialog_option_menu_get_day (GtkWidget *option_menu)
{
GtkWidget *menu;
GtkWidget *item;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
item = gtk_menu_get_active (GTK_MENU (menu));
@@ -502,9 +502,9 @@ cal_dialog_response_cb (GtkWidget *dialog,
{
MrpCalendar *calendar;
GtkWidget *window;
-
+
calendar = cal_dialog_get_selected_calendar (GTK_TREE_VIEW (data->tree_view));
-
+
switch (response) {
case RESPONSE_REMOVE:
/* mrp_calendar_remove (calendar); */
@@ -514,7 +514,7 @@ cal_dialog_response_cb (GtkWidget *dialog,
case RESPONSE_ADD:
cal_dialog_new_dialog_run (data);
break;
-
+
case RESPONSE_WORKING_TIME:
window = planner_working_time_dialog_new (data->main_window, calendar);
@@ -528,7 +528,7 @@ cal_dialog_response_cb (GtkWidget *dialog,
gtk_window_set_modal (GTK_WINDOW (window), TRUE);
gtk_widget_show (window);
break;
-
+
case RESPONSE_DEFAULT_WEEK:
window = planner_default_week_dialog_new (data->main_window, calendar);
@@ -578,7 +578,7 @@ cal_dialog_parent_destroy_cb (GtkWidget *window, GtkWidget *dialog)
{
gtk_widget_destroy (dialog);
}
-
+
GtkWidget *
planner_calendar_dialog_new (PlannerWindow *window)
{
@@ -589,23 +589,23 @@ planner_calendar_dialog_new (PlannerWindow *window)
GtkTreeSelection *selection;
gint i;
gchar *filename;
-
+
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
-
+
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;
}
dialog = glade_xml_get_widget (glade, "calendar_dialog");
-
+
data = g_new0 (DialogData, 1);
data->project = planner_window_get_project (window);
@@ -617,7 +617,7 @@ planner_calendar_dialog_new (PlannerWindow *window)
G_CALLBACK (cal_dialog_parent_destroy_cb),
dialog,
0);
-
+
data->tree_view = glade_xml_get_widget (glade, "treeview");
data->calendar = planner_calendar_new ();
gtk_widget_show (data->calendar);
@@ -630,12 +630,12 @@ planner_calendar_dialog_new (PlannerWindow *window)
g_signal_connect (data->calendar,
"month_changed",
G_CALLBACK (cal_dialog_month_changed_cb),
- data);
+ data);
g_signal_connect (data->calendar,
"day_selected",
G_CALLBACK (cal_dialog_date_selected_cb),
- data);
+ data);
w = glade_xml_get_widget (glade, "calendar_frame");
gtk_container_add (GTK_CONTAINER (w), data->calendar);
@@ -647,23 +647,23 @@ planner_calendar_dialog_new (PlannerWindow *window)
"clicked",
G_CALLBACK (cal_dialog_apply_clicked_cb),
data);
-
+
data->default_week_button = glade_xml_get_widget (glade, "default_week_button");
data->working_time_button = glade_xml_get_widget (glade, "working_time_button");
/* Get the 5 from/to entries. */
for (i = 0; i < 5; i++) {
gchar *tmp;
-
+
tmp = g_strdup_printf ("from%d_entry", i + 1);
data->from_entry[i] = glade_xml_get_widget (glade, tmp);
g_free (tmp);
-
+
tmp = g_strdup_printf ("to%d_entry", i + 1);
data->to_entry[i] = glade_xml_get_widget (glade, tmp);
g_free (tmp);
}
-
+
data->option_menu = glade_xml_get_widget (glade, "optionmenu");
cal_dialog_setup_option_menu (data);
g_signal_connect (data->option_menu,
@@ -682,13 +682,13 @@ planner_calendar_dialog_new (PlannerWindow *window)
"toggled",
G_CALLBACK (cal_dialog_day_types_toggled_cb),
data);
-
+
data->custom_radiobutton = glade_xml_get_widget (glade, "custom_radiobutton");
g_signal_connect (data->custom_radiobutton,
"toggled",
G_CALLBACK (cal_dialog_day_types_toggled_cb),
data);
-
+
g_object_set_data_full (G_OBJECT (dialog),
"data", data,
g_free);
@@ -707,17 +707,17 @@ planner_calendar_dialog_new (PlannerWindow *window)
"day_added",
G_CALLBACK (cal_dialog_project_day_added_cb),
data);
-
+
g_signal_connect (data->project,
"day_removed",
G_CALLBACK (cal_dialog_project_day_removed_cb),
data);
-
+
g_signal_connect (data->project,
"day_changed",
G_CALLBACK (cal_dialog_project_day_changed_cb),
data);
-
+
/* Set the sensitivity of the option menu and entries. */
cal_dialog_update_day_widgets (data);
@@ -795,19 +795,19 @@ cal_dialog_selection_changed_cb (GtkTreeSelection *selection,
if (calendar && num_calendars > 1) {
sensitive = TRUE;
}
-
+
gtk_widget_set_sensitive (data->remove_button, sensitive);
cal_dialog_update_calendar_widgets (data);
cal_dialog_update_day_widgets (data);
-
+
if (data->connected_calendar) {
g_signal_handlers_disconnect_by_func (data->connected_calendar,
cal_dialog_calendar_changed_cb,
data);
data->connected_calendar = NULL;
}
-
+
if (calendar) {
data->connected_calendar = calendar;
@@ -841,7 +841,7 @@ cal_dialog_apply_clicked_cb (GtkWidget *button,
day = NULL;
return;
}
-
+
planner_calendar_get_date (PLANNER_CALENDAR (data->calendar), &y, &m, &d);
t = mrp_time_compose (y, m + 1, d, 0, 0, 0);
/* mrp_calendar_set_days (calendar, t, day, (mrptime) -1); */
@@ -855,7 +855,7 @@ cal_dialog_setup_tree_view (GtkTreeView *tree_view,
GtkTreeModel *model;
GtkCellRenderer *cell;
GtkTreeViewColumn *col;
-
+
model = cal_dialog_create_model (project, tree_view);
gtk_tree_view_set_model (tree_view, model);
@@ -880,7 +880,7 @@ cal_dialog_update_calendar_widgets (DialogData *data)
MrpDay *day;
MrpTime *t;
mrptime time;
-
+
calendar = cal_dialog_get_selected_calendar (GTK_TREE_VIEW (data->tree_view));
if (!calendar) {
gtk_widget_set_sensitive (data->calendar, FALSE);
@@ -943,7 +943,7 @@ cal_dialog_option_menu_changed_cb (GtkWidget *option_menu,
{
gtk_widget_set_sensitive (data->apply_button, TRUE);
}
-
+
static void
cal_dialog_day_types_toggled_cb (GtkWidget *widget,
DialogData *data)
@@ -1005,7 +1005,7 @@ cal_dialog_update_day_widgets (DialogData *data)
g_signal_handlers_block_by_func (data->custom_radiobutton,
cal_dialog_day_types_toggled_cb,
data);
-
+
/* Only make "use base" sensitive if the calendar has a parent. */
root = mrp_project_get_root_calendar (data->project);
if (root == mrp_calendar_get_parent (calendar)) {
@@ -1015,20 +1015,20 @@ cal_dialog_update_day_widgets (DialogData *data)
}
calendar_widget = PLANNER_CALENDAR (data->calendar);
-
+
planner_calendar_get_date (calendar_widget, &y, &m, &d);
t = mrp_time_compose (y, m + 1, d, 0, 0, 0);
-
+
day = mrp_calendar_get_day (calendar, t, FALSE);
if (day == mrp_day_get_use_base ()) {
gtk_widget_set_sensitive (data->option_menu, FALSE);
-
+
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (data->base_radiobutton), TRUE);
} else {
gtk_widget_set_sensitive (data->option_menu, TRUE);
-
+
cal_dialog_option_menu_set_day (data->option_menu, day);
gtk_toggle_button_set_active (
@@ -1040,27 +1040,27 @@ cal_dialog_update_day_widgets (DialogData *data)
if (day == mrp_day_get_use_base ()) {
day = mrp_calendar_get_day (calendar, t, TRUE);
}
-
+
ivals = mrp_calendar_day_get_intervals (calendar, day, TRUE);
-
+
for (i = 0; i < 5; i++) {
gtk_entry_set_text (GTK_ENTRY (data->from_entry[i]), "");
gtk_entry_set_text (GTK_ENTRY (data->to_entry[i]), "");
}
-
+
for (l = ivals, i = 0; l && i < 5; l = l->next, i++) {
MrpInterval *ival;
mrptime start, end;
gchar *str;
-
+
ival = l->data;
-
+
mrp_interval_get_absolute (ival, 0, &start, &end);
-
+
str = mrp_time_format ("%H:%M", start);
gtk_entry_set_text (GTK_ENTRY (data->from_entry[i]), str);
g_free (str);
-
+
str = mrp_time_format ("%H:%M", end);
gtk_entry_set_text (GTK_ENTRY (data->to_entry[i]), str);
g_free (str);
@@ -1088,7 +1088,7 @@ cal_dialog_project_day_added_cb (MrpProject *project,
MrpDay *selected_day;
selected_day = cal_dialog_option_menu_get_day (data->option_menu);
-
+
cal_dialog_setup_option_menu (data);
/* Reselect the same day as before. */
@@ -1143,9 +1143,9 @@ cal_dialog_build_tree (GtkTreeStore *store,
GtkTreeIter iter;
const gchar *name;
GList *children, *l;
-
+
name = mrp_calendar_get_name (calendar);
-
+
gtk_tree_store_append (store, &iter, parent);
gtk_tree_store_set (store,
&iter,
@@ -1153,7 +1153,7 @@ cal_dialog_build_tree (GtkTreeStore *store,
COL_CALENDAR, calendar,
-1);
- children = mrp_calendar_get_children (calendar);
+ children = mrp_calendar_get_children (calendar);
for (l = children; l; l = l->next) {
cal_dialog_build_tree (store, &iter, l->data);
}
@@ -1170,12 +1170,12 @@ cal_dialog_tree_changed (MrpProject *project,
g_return_if_fail (MRP_IS_PROJECT (project));
g_return_if_fail (MRP_IS_CALENDAR (root));
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
-
+
store = GTK_TREE_STORE (gtk_tree_view_get_model (tree_view));
-
+
gtk_tree_store_clear (store);
-
- children = mrp_calendar_get_children (root);
+
+ children = mrp_calendar_get_children (root);
for (l = children; l; l = l->next) {
cal_dialog_build_tree (store, NULL, l->data);
}
@@ -1197,7 +1197,7 @@ cal_dialog_create_model (MrpProject *project,
G_TYPE_OBJECT,
G_TYPE_STRING);
- children = mrp_calendar_get_children (root);
+ children = mrp_calendar_get_children (root);
for (l = children; l; l = l->next) {
cal_dialog_build_tree (store, NULL, l->data);
}
@@ -1207,7 +1207,7 @@ cal_dialog_create_model (MrpProject *project,
G_CALLBACK (cal_dialog_tree_changed),
tree_view,
0);
-
+
return GTK_TREE_MODEL (store);
}
@@ -1233,7 +1233,7 @@ cal_dialog_new_selection_changed_cb (GtkTreeSelection *selection,
} else {
gtk_widget_set_sensitive (data->new_derive_radiobutton, TRUE);
gtk_widget_set_sensitive (data->new_copy_radiobutton, TRUE);
- }
+ }
}
static void
@@ -1244,7 +1244,7 @@ cal_dialog_new_name_changed_cb (GtkEntry *entry,
gboolean sensitive;
name = gtk_entry_get_text (entry);
-
+
sensitive = name[0] != 0;
gtk_widget_set_sensitive (data->new_ok_button, sensitive);
}
@@ -1261,7 +1261,7 @@ cal_dialog_new_dialog_run (DialogData *data)
const gchar *name;
GtkTreePath *path;
gchar *filename;
-
+
filename = mrp_paths_get_glade_dir ("calendar-dialog.glade");
glade = glade_xml_new (filename,
"new_calendar_dialog",
@@ -1281,7 +1281,7 @@ cal_dialog_new_dialog_run (DialogData *data)
data->new_copy_radiobutton = glade_xml_get_widget (glade, "copy_radiobutton");
data->new_derive_radiobutton = glade_xml_get_widget (glade, "derive_radiobutton");
data->new_empty_radiobutton = glade_xml_get_widget (glade, "empty_radiobutton");
-
+
tree_view = glade_xml_get_widget (glade, "treeview");
cal_dialog_setup_tree_view (GTK_TREE_VIEW (tree_view), data->project);
@@ -1299,13 +1299,13 @@ cal_dialog_new_dialog_run (DialogData *data)
path = gtk_tree_path_new_first ();
gtk_tree_selection_select_path (selection, path);
gtk_tree_path_free (path);
-
+
if (!gtk_tree_selection_get_selected (selection, NULL, NULL)) {
gtk_widget_set_sensitive (data->new_derive_radiobutton, FALSE);
gtk_widget_set_sensitive (data->new_copy_radiobutton, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->new_empty_radiobutton), TRUE);
}
-
+
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
name = gtk_entry_get_text (GTK_ENTRY (entry));
@@ -1322,7 +1322,7 @@ cal_dialog_new_dialog_run (DialogData *data)
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->new_empty_radiobutton))) {
/* calendar = mrp_calendar_new (name, data->project); */
planner_cal_cmd_add (data->main_window, name, NULL, NULL);
-
+
}
}
diff --git a/src/planner-calendar-selector.c b/src/planner-calendar-selector.c
index 25e11c1..304c343 100644
--- a/src/planner-calendar-selector.c
+++ b/src/planner-calendar-selector.c
@@ -77,9 +77,9 @@ planner_calendar_selector_new (PlannerWindow *window,
GtkWidget *w;
GtkTreeSelection *selection;
gchar *filename;
-
+
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
-
+
filename = mrp_paths_get_glade_dir ("calendar-dialog.glade");
glade = glade_xml_new (filename,
"calendar_selector",
@@ -91,7 +91,7 @@ planner_calendar_selector_new (PlannerWindow *window,
}
selector = glade_xml_get_widget (glade, "calendar_selector");
-
+
data = g_new0 (DialogData, 1);
data->project = planner_window_get_project (window);
@@ -120,7 +120,7 @@ planner_calendar_selector_new (PlannerWindow *window,
"changed",
G_CALLBACK (cal_selector_selection_changed_cb),
data);
-
+
return selector;
}
@@ -135,7 +135,7 @@ planner_calendar_selector_get_calendar (GtkWidget *dialog)
data = SELECTOR_GET_DATA (dialog);
calendar = cal_selector_get_selected_calendar (GTK_TREE_VIEW (data->tree_view));
-
+
return calendar;
}
@@ -177,7 +177,7 @@ cal_selector_setup_tree_view (GtkTreeView *tree_view,
GtkTreeModel *model;
GtkCellRenderer *cell;
GtkTreeViewColumn *col;
-
+
model = cal_selector_create_model (project, tree_view);
gtk_tree_view_set_model (tree_view, model);
@@ -201,9 +201,9 @@ cal_selector_build_tree (GtkTreeStore *store,
GtkTreeIter iter;
const gchar *name;
GList *children, *l;
-
+
name = mrp_calendar_get_name (calendar);
-
+
gtk_tree_store_append (store, &iter, parent);
gtk_tree_store_set (store,
&iter,
@@ -211,7 +211,7 @@ cal_selector_build_tree (GtkTreeStore *store,
COL_CALENDAR, calendar,
-1);
- children = mrp_calendar_get_children (calendar);
+ children = mrp_calendar_get_children (calendar);
for (l = children; l; l = l->next) {
cal_selector_build_tree (store, &iter, l->data);
}
@@ -228,8 +228,8 @@ cal_selector_tree_changed (MrpProject *project,
store = GTK_TREE_STORE (gtk_tree_view_get_model (tree_view));
gtk_tree_store_clear (store);
-
- children = mrp_calendar_get_children (root);
+
+ children = mrp_calendar_get_children (root);
for (l = children; l; l = l->next) {
cal_selector_build_tree (store, NULL, l->data);
}
@@ -251,7 +251,7 @@ cal_selector_create_model (MrpProject *project,
G_TYPE_OBJECT,
G_TYPE_STRING);
- children = mrp_calendar_get_children (root);
+ children = mrp_calendar_get_children (root);
for (l = children; l; l = l->next) {
cal_selector_build_tree (store, NULL, l->data);
}
@@ -261,6 +261,6 @@ cal_selector_create_model (MrpProject *project,
G_CALLBACK (cal_selector_tree_changed),
tree_view,
0);
-
+
return GTK_TREE_MODEL (store);
}
diff --git a/src/planner-calendar.c b/src/planner-calendar.c
index 3dba787..ba91ab0 100644
--- a/src/planner-calendar.c
+++ b/src/planner-calendar.c
@@ -3,7 +3,7 @@
*
* GTK Calendar Widget
* Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson and Mattias Grönlund
- *
+ *
* lib_date routines
* Copyright (c) 1995, 1996, 1997, 1998 by Steffen Beyer
*
@@ -26,7 +26,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
@@ -73,17 +73,17 @@ static Z_long dates_difference(N_int year1, N_int mm1, N_int dd1,
N_int year2, N_int mm2, N_int dd2);
static N_int weeks_in_year(N_int year);
-static boolean
+static boolean
leap(N_int year)
{
return((((year % 4) == 0) and ((year % 100) != 0)) or ((year % 400) == 0));
}
-static N_int
+static N_int
day_of_week(N_int year, N_int mm, N_int dd)
{
Z_long days;
-
+
days = calc_days(year, mm, dd);
if (days > 0L)
{
@@ -99,7 +99,7 @@ static N_int weeks_in_year(N_int year)
return(52 + ((day_of_week(year,1,1)==4) or (day_of_week(year,12,31)==4)));
}
-static boolean
+static boolean
check_date(N_int year, N_int mm, N_int dd)
{
if (year < 1) return(false);
@@ -108,41 +108,41 @@ check_date(N_int year, N_int mm, N_int dd)
return(true);
}
-static N_int
+static N_int
week_number(N_int year, N_int mm, N_int dd)
{
N_int first;
-
+
first = day_of_week(year,1,1) - 1;
return( (N_int) ( (dates_difference(year,1,1, year,mm,dd) + first) / 7L ) +
(first < 4) );
}
-static Z_long
+static Z_long
year_to_days(N_int year)
{
return( year * 365L + (year / 4) - (year / 100) + (year / 400) );
}
-static Z_long
+static Z_long
calc_days(N_int year, N_int mm, N_int dd)
{
boolean lp;
-
+
if (year < 1) return(0L);
if ((mm < 1) or (mm > 12)) return(0L);
if ((dd < 1) or (dd > month_length[(lp = leap(year))][mm])) return(0L);
return( year_to_days(--year) + days_in_months[lp][mm] + dd );
}
-static boolean
+static boolean
week_of_year(N_int *week, N_int *year, N_int mm, N_int dd)
{
if (check_date(*year,mm,dd))
{
*week = week_number(*year,mm,dd);
- if (*week == 0)
+ if (*week == 0)
*week = weeks_in_year(--(*year));
else if (*week > weeks_in_year(*year))
{
@@ -154,7 +154,7 @@ week_of_year(N_int *week, N_int *year, N_int mm, N_int dd)
return(false);
}
-static Z_long
+static Z_long
dates_difference(N_int year1, N_int mm1, N_int dd1,
N_int year2, N_int mm2, N_int dd2)
{
@@ -235,7 +235,7 @@ struct _PlannerCalendarPrivateData
guint arrow_width;
guint max_month_width;
guint max_year_width;
-
+
guint day_width;
guint week_width;
@@ -246,7 +246,7 @@ struct _PlannerCalendarPrivateData
guint max_label_char_ascent;
guint max_label_char_descent;
guint max_week_char_width;
-
+
guint freeze_count;
/* flags */
@@ -315,7 +315,7 @@ GType
planner_calendar_get_type (void)
{
static GType calendar_type = 0;
-
+
if (!calendar_type)
{
static const GTypeInfo calendar_info =
@@ -334,7 +334,7 @@ planner_calendar_get_type (void)
calendar_type = g_type_register_static (GTK_TYPE_WIDGET, "PlannerCalendar",
&calendar_info, 0);
}
-
+
return calendar_type;
}
@@ -346,9 +346,9 @@ planner_calendar_class_init (PlannerCalendarClass *class)
gobject_class = (GObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
-
+
parent_class = g_type_class_peek_parent (class);
-
+
gobject_class->finalize = planner_calendar_finalize;
widget_class->realize = planner_calendar_realize;
@@ -363,7 +363,7 @@ planner_calendar_class_init (PlannerCalendarClass *class)
widget_class->key_press_event = planner_calendar_key_press;
widget_class->style_set = planner_calendar_style_set;
widget_class->state_changed = planner_calendar_state_changed;
-
+
class->month_changed = NULL;
class->day_selected = NULL;
class->day_selected_double_click = NULL;
@@ -440,10 +440,10 @@ planner_calendar_init (PlannerCalendar *calendar)
time_t tmp_time;
GtkWidget *widget;
PlannerCalendarPrivateData *private_data;
-
+
widget = GTK_WIDGET (calendar);
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
-
+
calendar->private_data = g_malloc (sizeof (PlannerCalendarPrivateData));
private_data = PLANNER_CALENDAR_PRIVATE_DATA (calendar);
@@ -454,7 +454,7 @@ planner_calendar_init (PlannerCalendar *calendar)
strftime ( buffer, sizeof (buffer), "%a", gmtime (&tmp_time));
default_abbreviated_dayname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
}
-
+
if (!default_monthname[0])
for (i=0; i<12; i++)
{
@@ -462,24 +462,24 @@ planner_calendar_init (PlannerCalendar *calendar)
strftime ( buffer, sizeof (buffer), "%B", gmtime (&tmp_time));
default_monthname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
}
-
+
/* Set defaults */
secs = time (NULL);
tm = localtime (&secs);
calendar->month = tm->tm_mon;
calendar->year = 1900 + tm->tm_year;
-
+
for (i=0;i<31;i++)
calendar->marked_date[i] = PLANNER_CALENDAR_MARK_NONE;
calendar->num_marked_dates = 0;
calendar->selected_day = tm->tm_mday;
-
- calendar->display_flags = ( PLANNER_CALENDAR_SHOW_HEADING |
+
+ calendar->display_flags = ( PLANNER_CALENDAR_SHOW_HEADING |
PLANNER_CALENDAR_SHOW_DAY_NAMES );
-
+
calendar->highlight_row = -1;
calendar->highlight_col = -1;
-
+
calendar->focus_row = -1;
calendar->focus_col = -1;
calendar->xor_gc = NULL;
@@ -497,7 +497,7 @@ planner_calendar_init (PlannerCalendar *calendar)
private_data->arrow_width = 10;
private_data->freeze_count = 0;
-
+
private_data->dirty_header = 0;
private_data->dirty_day_names = 0;
private_data->dirty_week = 0;
@@ -518,21 +518,21 @@ column_from_x (PlannerCalendar *calendar,
{
gint c, column;
gint x_left, x_right;
-
+
column = -1;
-
+
for (c = 0; c < 7; c++)
{
x_left = left_x_for_column (calendar, c);
x_right = x_left + PLANNER_CALENDAR_PRIVATE_DATA (calendar)->day_width;
-
+
if (event_x >= x_left && event_x < x_right)
{
column = c;
break;
}
}
-
+
return column;
}
@@ -554,22 +554,22 @@ row_from_y (PlannerCalendar *calendar,
gint r, row;
gint height;
gint y_top, y_bottom;
-
+
height = row_height (calendar);
row = -1;
-
+
for (r = 0; r < 6; r++)
{
y_top = top_y_for_row (calendar, r);
y_bottom = y_top + height;
-
+
if (event_y >= y_top && event_y < y_bottom)
{
row = r;
break;
}
}
-
+
return row;
}
@@ -581,7 +581,7 @@ left_x_for_column (PlannerCalendar *calendar,
{
gint width;
gint x_left;
-
+
if (gtk_widget_get_direction (GTK_WIDGET (calendar)) == GTK_TEXT_DIR_RTL)
column = 6 - column;
@@ -590,7 +590,7 @@ left_x_for_column (PlannerCalendar *calendar,
x_left = CALENDAR_XSEP + (width + DAY_XSEP) * column;
else
x_left = CALENDAR_MARGIN + (width + DAY_XSEP) * column;
-
+
return x_left;
}
@@ -600,8 +600,8 @@ static gint
top_y_for_row (PlannerCalendar *calendar,
gint row)
{
-
- return (PLANNER_CALENDAR_PRIVATE_DATA (calendar)->main_h
+
+ return (PLANNER_CALENDAR_PRIVATE_DATA (calendar)->main_h
- (CALENDAR_MARGIN + (6 - row)
* row_height (calendar)));
}
@@ -616,7 +616,7 @@ draw_arrow_right (GdkWindow *window,
gint size)
{
gint i;
-
+
for (i = 0; i <= size / 2; i++)
{
gdk_draw_line (window, gc,
@@ -637,7 +637,7 @@ draw_arrow_left (GdkWindow *window,
gint size)
{
gint i;
-
+
for (i = 0; i <= size / 2; i++)
{
gdk_draw_line (window, gc,
@@ -652,30 +652,30 @@ static void
planner_calendar_set_month_prev (PlannerCalendar *calendar)
{
gint month_len;
-
+
if (calendar->display_flags & PLANNER_CALENDAR_NO_MONTH_CHANGE)
return;
-
+
if (calendar->month == 0)
{
calendar->month = 11;
calendar->year--;
- }
- else
+ }
+ else
calendar->month--;
-
+
month_len = month_length[leap (calendar->year)][calendar->month + 1];
-
+
planner_calendar_freeze (calendar);
planner_calendar_compute_days (calendar);
-
+
g_signal_emit (calendar,
planner_calendar_signals[PREV_MONTH_SIGNAL],
0);
g_signal_emit (calendar,
planner_calendar_signals[MONTH_CHANGED_SIGNAL],
0);
-
+
if (month_len < calendar->selected_day)
{
calendar->selected_day = 0;
@@ -697,21 +697,21 @@ static void
planner_calendar_set_month_next (PlannerCalendar *calendar)
{
gint month_len;
-
+
g_return_if_fail (GTK_IS_WIDGET (calendar));
-
+
if (calendar->display_flags & PLANNER_CALENDAR_NO_MONTH_CHANGE)
return;
-
-
+
+
if (calendar->month == 11)
{
calendar->month = 0;
calendar->year++;
- }
- else
+ }
+ else
calendar->month++;
-
+
planner_calendar_freeze (calendar);
planner_calendar_compute_days (calendar);
g_signal_emit (calendar,
@@ -720,9 +720,9 @@ planner_calendar_set_month_next (PlannerCalendar *calendar)
g_signal_emit (calendar,
planner_calendar_signals[MONTH_CHANGED_SIGNAL],
0);
-
+
month_len = month_length[leap (calendar->year)][calendar->month + 1];
-
+
if (month_len < calendar->selected_day)
{
calendar->selected_day = 0;
@@ -739,9 +739,9 @@ static void
planner_calendar_set_year_prev (PlannerCalendar *calendar)
{
gint month_len;
-
+
g_return_if_fail (GTK_IS_WIDGET (calendar));
-
+
calendar->year--;
planner_calendar_freeze (calendar);
planner_calendar_compute_days (calendar);
@@ -751,9 +751,9 @@ planner_calendar_set_year_prev (PlannerCalendar *calendar)
g_signal_emit (calendar,
planner_calendar_signals[MONTH_CHANGED_SIGNAL],
0);
-
+
month_len = month_length[leap (calendar->year)][calendar->month + 1];
-
+
if (month_len < calendar->selected_day)
{
calendar->selected_day = 0;
@@ -761,7 +761,7 @@ planner_calendar_set_year_prev (PlannerCalendar *calendar)
}
else
planner_calendar_select_day (calendar, calendar->selected_day);
-
+
gtk_widget_queue_draw (GTK_WIDGET (calendar));
planner_calendar_thaw (calendar);
}
@@ -771,13 +771,13 @@ planner_calendar_set_year_next (PlannerCalendar *calendar)
{
gint month_len;
GtkWidget *widget;
-
+
g_return_if_fail (GTK_IS_WIDGET (calendar));
-
+
widget = GTK_WIDGET (calendar);
-
+
planner_calendar_freeze (calendar);
-
+
calendar->year++;
planner_calendar_compute_days (calendar);
g_signal_emit (calendar,
@@ -786,9 +786,9 @@ planner_calendar_set_year_next (PlannerCalendar *calendar)
g_signal_emit (calendar,
planner_calendar_signals[MONTH_CHANGED_SIGNAL],
0);
-
+
month_len = month_length[leap (calendar->year)][calendar->month + 1];
-
+
if (month_len < calendar->selected_day)
{
calendar->selected_day = 0;
@@ -796,7 +796,7 @@ planner_calendar_set_year_next (PlannerCalendar *calendar)
}
else
planner_calendar_select_day (calendar, calendar->selected_day);
-
+
gtk_widget_queue_draw (GTK_WIDGET (calendar));
planner_calendar_thaw (calendar);
}
@@ -810,33 +810,33 @@ planner_calendar_main_button (GtkWidget *widget,
gint row, col;
gint day_month;
gint day;
-
+
calendar = PLANNER_CALENDAR (widget);
-
+
x = (gint) (event->x);
y = (gint) (event->y);
-
+
row = row_from_y (calendar, y);
col = column_from_x (calendar, x);
/* If row or column isn't found, just return. */
if (row == -1 || col == -1)
return;
-
+
day_month = calendar->day_month[row][col];
if (event->type == GDK_BUTTON_PRESS)
{
day = calendar->day[row][col];
-
+
if (day_month == MONTH_PREV)
planner_calendar_set_month_prev (calendar);
else if (day_month == MONTH_NEXT)
planner_calendar_set_month_next (calendar);
-
+
if (!GTK_WIDGET_HAS_FOCUS (widget))
gtk_widget_grab_focus (widget);
-
+
planner_calendar_select_and_focus_day (calendar, day);
}
@@ -857,9 +857,9 @@ planner_calendar_realize_arrows (GtkWidget *widget)
GdkWindowAttr attributes;
gint attributes_mask;
gint i;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (widget));
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
@@ -886,21 +886,21 @@ planner_calendar_realize_arrows (GtkWidget *widget)
attributes.x = 3;
break;
case ARROW_MONTH_RIGHT:
- attributes.x = (private_data->arrow_width
+ attributes.x = (private_data->arrow_width
+ private_data->max_month_width);
break;
case ARROW_YEAR_LEFT:
attributes.x = (widget->allocation.width - 2 * widget->style->xthickness
- - (3 + 2*private_data->arrow_width
+ - (3 + 2*private_data->arrow_width
+ private_data->max_year_width));
break;
case ARROW_YEAR_RIGHT:
- attributes.x = (widget->allocation.width - 2 * widget->style->xthickness
+ attributes.x = (widget->allocation.width - 2 * widget->style->xthickness
- 3 - private_data->arrow_width);
break;
}
private_data->arrow_win[i] = gdk_window_new (private_data->header_win,
- &attributes,
+ &attributes,
attributes_mask);
private_data->arrow_state[i] = GTK_STATE_NORMAL;
gdk_window_set_background (private_data->arrow_win[i],
@@ -923,9 +923,9 @@ planner_calendar_realize_header (GtkWidget *widget)
PlannerCalendarPrivateData *private_data;
GdkWindowAttr attributes;
gint attributes_mask;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (widget));
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
@@ -944,12 +944,12 @@ planner_calendar_realize_header (GtkWidget *widget)
attributes.height = private_data->header_h - 2 * attributes.y;
private_data->header_win = gdk_window_new (widget->window,
&attributes, attributes_mask);
-
+
gdk_window_set_background (private_data->header_win,
HEADER_BG_COLOR (GTK_WIDGET (calendar)));
gdk_window_show (private_data->header_win);
gdk_window_set_user_data (private_data->header_win, widget);
-
+
}
else
{
@@ -965,9 +965,9 @@ planner_calendar_realize_day_names (GtkWidget *widget)
PlannerCalendarPrivateData *private_data;
GdkWindowAttr attributes;
gint attributes_mask;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (widget));
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
@@ -981,16 +981,16 @@ planner_calendar_realize_day_names (GtkWidget *widget)
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
attributes.x = (widget->style->xthickness + INNER_BORDER);
- attributes.y = private_data->header_h + (widget->style->ythickness
+ attributes.y = private_data->header_h + (widget->style->ythickness
+ INNER_BORDER);
- attributes.width = (widget->allocation.width
- - (widget->style->xthickness + INNER_BORDER)
+ attributes.width = (widget->allocation.width
+ - (widget->style->xthickness + INNER_BORDER)
* 2);
attributes.height = private_data->day_name_h;
private_data->day_name_win = gdk_window_new (widget->window,
- &attributes,
+ &attributes,
attributes_mask);
- gdk_window_set_background (private_data->day_name_win,
+ gdk_window_set_background (private_data->day_name_win,
BACKGROUND_COLOR ( GTK_WIDGET ( calendar)));
gdk_window_show (private_data->day_name_win);
gdk_window_set_user_data (private_data->day_name_win, widget);
@@ -1008,9 +1008,9 @@ planner_calendar_realize_week_numbers (GtkWidget *widget)
PlannerCalendarPrivateData *private_data;
GdkWindowAttr attributes;
gint attributes_mask;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (widget));
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
@@ -1022,20 +1022,20 @@ planner_calendar_realize_week_numbers (GtkWidget *widget)
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
-
+
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
attributes.x = widget->style->xthickness + INNER_BORDER;
- attributes.y = (private_data->header_h + private_data->day_name_h
+ attributes.y = (private_data->header_h + private_data->day_name_h
+ (widget->style->ythickness + INNER_BORDER));
attributes.width = private_data->week_width;
attributes.height = private_data->main_h;
private_data->week_win = gdk_window_new (widget->window,
&attributes, attributes_mask);
- gdk_window_set_background (private_data->week_win,
+ gdk_window_set_background (private_data->week_win,
BACKGROUND_COLOR (GTK_WIDGET (calendar)));
gdk_window_show (private_data->week_win);
gdk_window_set_user_data (private_data->week_win, widget);
- }
+ }
else
{
private_data->week_win = NULL;
@@ -1053,27 +1053,27 @@ planner_calendar_realize (GtkWidget *widget)
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
-
+
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
planner_calendar_compute_days (calendar);
-
+
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
- attributes.event_mask = (gtk_widget_get_events (widget)
+ attributes.event_mask = (gtk_widget_get_events (widget)
| GDK_EXPOSURE_MASK |GDK_KEY_PRESS_MASK);
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
-
+
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (widget->parent->window,
&attributes, attributes_mask);
-
+
widget->style = gtk_style_attach (widget->style, widget->window);
-
+
/* Header window ------------------------------------- */
planner_calendar_realize_header (widget);
/* Day names window --------------------------------- */
@@ -1084,23 +1084,23 @@ planner_calendar_realize (GtkWidget *widget)
attributes.event_mask = (gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
-
+
attributes.x = private_data->week_width + (widget->style->ythickness + INNER_BORDER);
- attributes.y = (private_data->header_h + private_data->day_name_h
+ attributes.y = (private_data->header_h + private_data->day_name_h
+ (widget->style->ythickness + INNER_BORDER));
- attributes.width = (widget->allocation.width - attributes.x
+ attributes.width = (widget->allocation.width - attributes.x
- (widget->style->xthickness + INNER_BORDER));
attributes.height = private_data->main_h;
private_data->main_win = gdk_window_new (widget->window,
&attributes, attributes_mask);
- gdk_window_set_background (private_data->main_win,
+ gdk_window_set_background (private_data->main_win,
BACKGROUND_COLOR ( GTK_WIDGET ( calendar)));
gdk_window_show (private_data->main_win);
gdk_window_set_user_data (private_data->main_win, widget);
gdk_window_set_background (widget->window, BACKGROUND_COLOR (widget));
gdk_window_show (widget->window);
gdk_window_set_user_data (widget->window, widget);
-
+
/* Set widgets gc */
calendar->gc = gdk_gc_new (widget->window);
@@ -1118,10 +1118,10 @@ planner_calendar_unrealize (GtkWidget *widget)
PlannerCalendar *calendar;
PlannerCalendarPrivateData *private_data;
gint i;
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
-
+
if (private_data->header_win)
{
for (i = 0; i < 4; i++)
@@ -1137,31 +1137,31 @@ planner_calendar_unrealize (GtkWidget *widget)
gdk_window_destroy (private_data->header_win);
private_data->header_win = NULL;
}
-
+
if (private_data->week_win)
{
gdk_window_set_user_data (private_data->week_win, NULL);
gdk_window_destroy (private_data->week_win);
- private_data->week_win = NULL;
+ private_data->week_win = NULL;
}
-
+
if (private_data->main_win)
{
gdk_window_set_user_data (private_data->main_win, NULL);
gdk_window_destroy (private_data->main_win);
- private_data->main_win = NULL;
+ private_data->main_win = NULL;
}
if (private_data->day_name_win)
{
gdk_window_set_user_data (private_data->day_name_win, NULL);
gdk_window_destroy (private_data->day_name_win);
- private_data->day_name_win = NULL;
+ private_data->day_name_win = NULL;
}
if (calendar->xor_gc)
g_object_unref (calendar->xor_gc);
if (calendar->gc)
g_object_unref (calendar->gc);
-
+
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
@@ -1183,7 +1183,7 @@ planner_calendar_size_request (GtkWidget *widget,
gint max_header_height = 0;
gint focus_width;
gint focus_padding;
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
gtk_widget_style_get (GTK_WIDGET (widget),
@@ -1192,13 +1192,13 @@ planner_calendar_size_request (GtkWidget *widget,
NULL);
layout = gtk_widget_create_pango_layout (widget, NULL);
-
+
/*
* Calculate the requisition width for the widget.
*/
-
+
/* Header width */
-
+
if (calendar->display_flags & PLANNER_CALENDAR_SHOW_HEADING)
{
private_data->max_month_width = 0;
@@ -1208,36 +1208,36 @@ planner_calendar_size_request (GtkWidget *widget,
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
private_data->max_month_width = MAX (private_data->max_month_width,
logical_rect.width + 8);
- max_header_height = MAX (max_header_height, logical_rect.height);
+ max_header_height = MAX (max_header_height, logical_rect.height);
}
private_data->max_year_width = 0;
for (i=0; i<10; i++)
{
sprintf (buffer, "%d%d%d%d", i,i,i,i);
- pango_layout_set_text (layout, buffer, -1);
+ pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
private_data->max_year_width = MAX (private_data->max_year_width,
logical_rect.width + 8);
- max_header_height = MAX (max_header_height, logical_rect.height);
+ max_header_height = MAX (max_header_height, logical_rect.height);
}
- }
- else
+ }
+ else
{
private_data->max_month_width = 0;
private_data->max_year_width = 0;
}
-
+
if (calendar->display_flags & PLANNER_CALENDAR_NO_MONTH_CHANGE)
- header_width = (private_data->max_month_width
+ header_width = (private_data->max_month_width
+ private_data->max_year_width
+ 3 * 3);
else
- header_width = (private_data->max_month_width
+ header_width = (private_data->max_month_width
+ private_data->max_year_width
+ 4 * private_data->arrow_width + 3 * 3);
/* Mainwindow labels width */
-
+
private_data->max_day_char_width = 0;
private_data->min_day_width = 0;
private_data->max_label_char_ascent = 0;
@@ -1246,19 +1246,19 @@ planner_calendar_size_request (GtkWidget *widget,
for (i = 0; i < 9; i++)
{
sprintf (buffer, "%d%d", i, i);
- pango_layout_set_text (layout, buffer, -1);
+ pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
private_data->min_day_width = MAX (private_data->min_day_width,
logical_rect.width);
private_data->max_day_char_ascent = MAX (private_data->max_label_char_ascent,
PANGO_ASCENT (logical_rect));
- private_data->max_day_char_descent = MAX (private_data->max_label_char_descent,
+ private_data->max_day_char_descent = MAX (private_data->max_label_char_descent,
PANGO_DESCENT (logical_rect));
}
/* We add one to max_day_char_width to be able to make the marked day "bold" */
private_data->max_day_char_width = private_data->min_day_width / 2 + 1;
-
+
if (calendar->display_flags & PLANNER_CALENDAR_SHOW_DAY_NAMES)
for (i = 0; i < 7; i++)
{
@@ -1268,33 +1268,33 @@ planner_calendar_size_request (GtkWidget *widget,
private_data->min_day_width = MAX (private_data->min_day_width, logical_rect.width);
private_data->max_label_char_ascent = MAX (private_data->max_label_char_ascent,
PANGO_ASCENT (logical_rect));
- private_data->max_label_char_descent = MAX (private_data->max_label_char_descent,
+ private_data->max_label_char_descent = MAX (private_data->max_label_char_descent,
PANGO_DESCENT (logical_rect));
}
-
+
private_data->max_week_char_width = 0;
if (calendar->display_flags & PLANNER_CALENDAR_SHOW_WEEK_NUMBERS)
for (i = 0; i < 9; i++)
{
sprintf (buffer, "%d%d", i, i);
- pango_layout_set_text (layout, buffer, -1);
+ pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
private_data->max_week_char_width = MAX (private_data->max_week_char_width,
logical_rect.width / 2);
}
-
+
main_width = (7 * (private_data->min_day_width + (focus_padding + focus_width) * 2) + (DAY_XSEP * 6) + CALENDAR_MARGIN * 2
+ (private_data->max_week_char_width
? private_data->max_week_char_width * 2 + (focus_padding + focus_width) * 2 + CALENDAR_XSEP * 2
: 0));
-
-
+
+
requisition->width = MAX (header_width, main_width + INNER_BORDER * 2) + widget->style->xthickness * 2;
-
+
/*
* Calculate the requisition height for the widget.
*/
-
+
if (calendar->display_flags & PLANNER_CALENDAR_SHOW_HEADING)
{
private_data->header_h = (max_header_height + CALENDAR_YSEP * 2);
@@ -1303,14 +1303,14 @@ planner_calendar_size_request (GtkWidget *widget,
{
private_data->header_h = 0;
}
-
+
if (calendar->display_flags & PLANNER_CALENDAR_SHOW_DAY_NAMES)
{
private_data->day_name_h = (private_data->max_label_char_ascent
+ private_data->max_label_char_descent
+ 2 * (focus_padding + focus_width) + calendar_margin);
calendar_margin = CALENDAR_YSEP;
- }
+ }
else
{
private_data->day_name_h = 0;
@@ -1318,13 +1318,13 @@ planner_calendar_size_request (GtkWidget *widget,
private_data->main_h = (CALENDAR_MARGIN + calendar_margin
+ 6 * (private_data->max_day_char_ascent
- + private_data->max_day_char_descent
+ + private_data->max_day_char_descent
+ 2 * (focus_padding + focus_width))
+ DAY_YSEP * 5);
-
- height = (private_data->header_h + private_data->day_name_h
+
+ height = (private_data->header_h + private_data->day_name_h
+ private_data->main_h);
-
+
requisition->height = height + (widget->style->ythickness + INNER_BORDER) * 2;
g_object_unref (layout);
@@ -1338,12 +1338,12 @@ planner_calendar_size_allocate (GtkWidget *widget,
PlannerCalendarPrivateData *private_data;
gint xthickness = widget->style->xthickness;
gint ythickness = widget->style->xthickness;
-
+
widget->allocation = *allocation;
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
-
+
if (calendar->display_flags & PLANNER_CALENDAR_SHOW_WEEK_NUMBERS)
{
private_data->day_width = (private_data->min_day_width
@@ -1353,8 +1353,8 @@ planner_calendar_size_allocate (GtkWidget *widget,
private_data->week_width = ((allocation->width - (xthickness + INNER_BORDER) * 2
- (CALENDAR_MARGIN * 2) - (DAY_XSEP * 6) - CALENDAR_XSEP * 2 )
- private_data->day_width * 7 + CALENDAR_MARGIN + CALENDAR_XSEP);
- }
- else
+ }
+ else
{
private_data->day_width = (allocation->width
- (xthickness + INNER_BORDER) * 2
@@ -1362,7 +1362,7 @@ planner_calendar_size_allocate (GtkWidget *widget,
- (DAY_XSEP * 6))/7;
private_data->week_width = 0;
}
-
+
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_move_resize (widget->window,
@@ -1379,23 +1379,23 @@ planner_calendar_size_allocate (GtkWidget *widget,
private_data->header_h - 7);
if (private_data->arrow_win[ARROW_MONTH_RIGHT])
gdk_window_move_resize (private_data->arrow_win[ARROW_MONTH_RIGHT],
- (private_data->arrow_width
- + private_data->max_month_width),
+ (private_data->arrow_width
+ + private_data->max_month_width),
3,
private_data->arrow_width,
private_data->header_h - 7);
if (private_data->arrow_win[ARROW_YEAR_LEFT])
gdk_window_move_resize (private_data->arrow_win[ARROW_YEAR_LEFT],
(allocation->width - 2 * xthickness
- - (3 + 2*private_data->arrow_width
+ - (3 + 2*private_data->arrow_width
+ private_data->max_year_width)),
3,
private_data->arrow_width,
private_data->header_h - 7);
if (private_data->arrow_win[ARROW_YEAR_RIGHT])
gdk_window_move_resize (private_data->arrow_win[ARROW_YEAR_RIGHT],
- (allocation->width - 2 * xthickness
- - 3 - private_data->arrow_width),
+ (allocation->width - 2 * xthickness
+ - 3 - private_data->arrow_width),
3,
private_data->arrow_width,
private_data->header_h - 7);
@@ -1416,8 +1416,8 @@ planner_calendar_size_allocate (GtkWidget *widget,
private_data->week_width + (xthickness + INNER_BORDER),
private_data->header_h + private_data->day_name_h
+ (widget->style->ythickness + INNER_BORDER),
- allocation->width
- - private_data->week_width
+ allocation->width
+ - private_data->week_width
- (xthickness + INNER_BORDER) * 2,
private_data->main_h);
}
@@ -1432,18 +1432,18 @@ planner_calendar_expose (GtkWidget *widget,
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
-
+
if (GTK_WIDGET_DRAWABLE (widget))
{
if (event->window == private_data->main_win)
planner_calendar_paint_main (widget);
-
+
if (event->window == private_data->header_win)
planner_calendar_paint_header (widget);
-
+
if (event->window == private_data->day_name_win)
planner_calendar_paint_day_names (widget);
-
+
if (event->window == private_data->week_win)
planner_calendar_paint_week_numbers (widget);
if (event->window == widget->window)
@@ -1453,7 +1453,7 @@ planner_calendar_expose (GtkWidget *widget,
0, 0, widget->allocation.width, widget->allocation.height);
}
}
-
+
return FALSE;
}
@@ -1481,43 +1481,43 @@ planner_calendar_paint_header (GtkWidget *widget)
}
private_data->dirty_header = 0;
gc = calendar->gc;
-
+
/* Clear window */
gdk_window_clear (private_data->header_win);
-
+
header_width = widget->allocation.width - 2 * widget->style->xthickness;
cal_height = widget->allocation.height;
-
+
max_month_width = private_data->max_month_width;
max_year_width = private_data->max_year_width;
-
+
gdk_gc_set_foreground (gc, BACKGROUND_COLOR (GTK_WIDGET (calendar)));
gtk_paint_shadow (widget->style, private_data->header_win,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
NULL, widget, "calendar",
0, 0, header_width, private_data->header_h);
-
-
+
+
sprintf (buffer, "%d", calendar->year);
layout = gtk_widget_create_pango_layout (widget, buffer);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
-
+
/* Draw title */
y = (private_data->header_h - logical_rect.height) / 2;
-
+
/* Draw year and its arrows */
-
+
if (calendar->display_flags & PLANNER_CALENDAR_NO_MONTH_CHANGE)
x = header_width - (3 + max_year_width
- (max_year_width - logical_rect.width)/2);
else
x = header_width - (3 + private_data->arrow_width + max_year_width
- (max_year_width - logical_rect.width)/2);
-
-
+
+
gdk_gc_set_foreground (gc, HEADER_FG_COLOR (GTK_WIDGET (calendar)));
gdk_draw_layout (private_data->header_win, gc, x, y, layout);
-
+
/* Draw month */
sprintf (buffer, "%s", default_monthname[calendar->month]);
pango_layout_set_text (layout, buffer, -1);
@@ -1529,9 +1529,9 @@ planner_calendar_paint_header (GtkWidget *widget)
x = 3 + private_data->arrow_width + (max_month_width - logical_rect.width)/2;
gdk_draw_layout (private_data->header_win, gc, x, y, layout);
-
+
gdk_gc_set_foreground (gc, BACKGROUND_COLOR (GTK_WIDGET (calendar)));
-
+
planner_calendar_paint_arrow (widget, ARROW_MONTH_LEFT);
planner_calendar_paint_arrow (widget, ARROW_MONTH_RIGHT);
planner_calendar_paint_arrow (widget, ARROW_YEAR_LEFT);
@@ -1555,12 +1555,12 @@ planner_calendar_paint_day_names (GtkWidget *widget)
PlannerCalendarPrivateData *private_data;
gint focus_padding;
gint focus_width;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (widget));
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
gc = calendar->gc;
-
+
gtk_widget_style_get (GTK_WIDGET (widget),
"focus-line-width", &focus_width,
"focus-padding", &focus_padding,
@@ -1568,48 +1568,48 @@ planner_calendar_paint_day_names (GtkWidget *widget)
/*
* Handle freeze/thaw functionality
*/
-
+
if (private_data->freeze_count)
{
private_data->dirty_day_names = 1;
return;
}
private_data->dirty_day_names = 0;
-
+
/*
* Clear the window
*/
-
+
gdk_window_clear (private_data->day_name_win);
-
+
day_width = private_data->day_width;
cal_width = widget->allocation.width;
cal_height = widget->allocation.height;
day_wid_sep = day_width + DAY_XSEP;
-
+
/*
* Draw rectangles as inverted background for the labels.
*/
-
+
gdk_gc_set_foreground (gc, SELECTED_BG_COLOR (widget));
gdk_draw_rectangle (private_data->day_name_win, gc, TRUE,
CALENDAR_MARGIN, CALENDAR_MARGIN,
cal_width-CALENDAR_MARGIN * 2,
private_data->day_name_h - CALENDAR_MARGIN);
-
+
if (calendar->display_flags & PLANNER_CALENDAR_SHOW_WEEK_NUMBERS)
gdk_draw_rectangle (private_data->day_name_win, gc, TRUE,
CALENDAR_MARGIN,
private_data->day_name_h - CALENDAR_YSEP,
private_data->week_width - CALENDAR_YSEP - CALENDAR_MARGIN,
CALENDAR_YSEP);
-
+
/*
* Write the labels
*/
layout = gtk_widget_create_pango_layout (widget, NULL);
-
+
gdk_gc_set_foreground (gc, SELECTED_FG_COLOR (widget));
for (i = 0; i < 7; i++)
{
@@ -1624,7 +1624,7 @@ planner_calendar_paint_day_names (GtkWidget *widget)
pango_layout_set_text (layout, buffer, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
- gdk_draw_layout (private_data->day_name_win, gc,
+ gdk_draw_layout (private_data->day_name_win, gc,
(CALENDAR_MARGIN +
+ private_data->week_width
+ (private_data->week_width ? CALENDAR_XSEP : 0)
@@ -1633,7 +1633,7 @@ planner_calendar_paint_day_names (GtkWidget *widget)
CALENDAR_MARGIN + focus_width + focus_padding + logical_rect.y,
layout);
}
-
+
g_object_unref (layout);
}
@@ -1651,39 +1651,39 @@ planner_calendar_paint_week_numbers (GtkWidget *widget)
PangoRectangle logical_rect;
gint focus_padding;
gint focus_width;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (widget));
g_return_if_fail (widget->window != NULL);
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
gc = calendar->gc;
-
+
/*
* Handle freeze/thaw functionality
*/
-
+
if (private_data->freeze_count)
{
private_data->dirty_week = 1;
return;
}
private_data->dirty_week = 0;
-
+
gtk_widget_style_get (GTK_WIDGET (widget),
"focus-line-width", &focus_width,
"focus-padding", &focus_padding,
NULL);
-
+
/*
* Clear the window
*/
-
+
gdk_window_clear (private_data->week_win);
-
+
/*
* Draw a rectangle as inverted background for the labels.
*/
-
+
gdk_gc_set_foreground (gc, SELECTED_BG_COLOR (widget));
if (private_data->day_name_win)
gdk_draw_rectangle (private_data->week_win, gc, TRUE,
@@ -1697,13 +1697,13 @@ planner_calendar_paint_week_numbers (GtkWidget *widget)
CALENDAR_MARGIN,
private_data->week_width - CALENDAR_MARGIN,
private_data->main_h - 2 * CALENDAR_MARGIN);
-
+
/*
* Write the labels
*/
-
+
layout = gtk_widget_create_pango_layout (widget, NULL);
-
+
gdk_gc_set_foreground (gc, SELECTED_FG_COLOR (widget));
day_height = row_height (calendar);
for (row = 0; row < 6; row++)
@@ -1712,7 +1712,7 @@ planner_calendar_paint_week_numbers (GtkWidget *widget)
if (calendar->day[row][6] < 15 && row > 3 && calendar->month == 11)
year++;
- g_return_if_fail (week_of_year (&week, &year,
+ g_return_if_fail (week_of_year (&week, &year,
((calendar->day[row][6] < 15 && row > 3 ? 1 : 0)
+ calendar->month) % 12 + 1, calendar->day[row][6]));
@@ -1728,7 +1728,7 @@ planner_calendar_paint_week_numbers (GtkWidget *widget)
gdk_draw_layout (private_data->week_win, gc, x_loc, y_loc, layout);
}
-
+
g_object_unref (layout);
}
@@ -1738,11 +1738,11 @@ planner_calendar_paint_day_num (GtkWidget *widget,
{
PlannerCalendar *calendar;
gint r, c, row, col;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (widget));
-
+
calendar = PLANNER_CALENDAR (widget);
-
+
row = -1;
col = -1;
for (r = 0; r < 6; r++)
@@ -1753,10 +1753,10 @@ planner_calendar_paint_day_num (GtkWidget *widget,
row = r;
col = c;
}
-
+
g_return_if_fail (row != -1);
g_return_if_fail (col != -1);
-
+
planner_calendar_paint_day (widget, row, col);
}
@@ -1780,7 +1780,7 @@ planner_calendar_paint_day (GtkWidget *widget,
PlannerCalendarPrivateData *private_data;
PangoLayout *layout;
PangoRectangle logical_rect;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (widget));
g_return_if_fail (row < 6);
g_return_if_fail (col < 7);
@@ -1790,40 +1790,40 @@ planner_calendar_paint_day (GtkWidget *widget,
/*
* Handle freeze/thaw functionality
*/
-
+
if (private_data->freeze_count)
{
private_data->dirty_main = 1;
return;
}
-
+
gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL);
day_height = row_height (calendar);
-
+
day_xspace = private_data->day_width - private_data->max_day_char_width*2;
-
+
day = calendar->day[row][col];
-
+
x_left = left_x_for_column (calendar, col);
x_loc = x_left + private_data->day_width / 2 + private_data->max_day_char_width;
-
+
y_top = top_y_for_row (calendar, row);
-
+
gdk_window_clear_area (private_data->main_win, x_left, y_top,
private_data->day_width, day_height);
-
+
gc = calendar->gc;
-
+
if (calendar->day_month[row][col] == MONTH_PREV)
{
gdk_gc_set_foreground (gc, PREV_MONTH_COLOR (GTK_WIDGET (calendar)));
- }
+ }
else if (calendar->day_month[row][col] == MONTH_NEXT)
{
gdk_gc_set_foreground (gc, NEXT_MONTH_COLOR (GTK_WIDGET (calendar)));
- }
- else
+ }
+ else
{
/*
if (calendar->highlight_row == row && calendar->highlight_col == col)
@@ -1833,7 +1833,7 @@ planner_calendar_paint_day (GtkWidget *widget,
private_data->day_width, day_height);
}
*/
- if (calendar->selected_day == day)
+ if (calendar->selected_day == day)
{
gdk_gc_set_foreground (gc, SELECTED_BG_COLOR (GTK_WIDGET (calendar)));
gdk_draw_rectangle (private_data->main_win, gc, TRUE, x_left, y_top,
@@ -1861,7 +1861,7 @@ planner_calendar_paint_day (GtkWidget *widget,
stipple_pattern,
4, 4);
}
-
+
gdk_gc_set_foreground (gc, STRIPED_BG_COLOR (GTK_WIDGET (calendar)));
gdk_gc_set_fill (gc, GDK_STIPPLED);
gdk_gc_set_stipple (gc, stripe_stipple);
@@ -1872,7 +1872,7 @@ planner_calendar_paint_day (GtkWidget *widget,
break;
}
}
-
+
switch (calendar->marked_date[day-1]) {
case PLANNER_CALENDAR_MARK_BOLD:
gdk_gc_set_foreground (gc, MARKED_COLOR (GTK_WIDGET (calendar)));
@@ -1883,18 +1883,18 @@ planner_calendar_paint_day (GtkWidget *widget,
gdk_gc_set_foreground (gc, NORMAL_DAY_COLOR (GTK_WIDGET (calendar)));
break;
}
-
+
if (calendar->selected_day == day)
gdk_gc_set_foreground (gc, SELECTED_FG_COLOR (GTK_WIDGET (calendar)));
else
gdk_gc_set_foreground (gc, & (GTK_WIDGET (calendar)->style->fg[GTK_WIDGET_STATE (calendar)]));
}
-
+
sprintf (buffer, "%d", day);
layout = gtk_widget_create_pango_layout (widget, buffer);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
-
+
x_loc -= logical_rect.width;
y_loc = y_top + (day_height - logical_rect.height) / 2;
@@ -1903,16 +1903,16 @@ planner_calendar_paint_day (GtkWidget *widget,
switch (calendar->marked_date[day-1]) {
case PLANNER_CALENDAR_MARK_BOLD:
- if (calendar->day_month[row][col] == MONTH_CURRENT)
+ if (calendar->day_month[row][col] == MONTH_CURRENT)
gdk_draw_layout (private_data->main_win, gc,
x_loc-1, y_loc, layout);
break;
-
+
default:
break;
}
- if (GTK_WIDGET_HAS_FOCUS (calendar)
+ if (GTK_WIDGET_HAS_FOCUS (calendar)
&& calendar->focus_row == row && calendar->focus_col == col)
{
GtkStateType state;
@@ -1921,14 +1921,14 @@ planner_calendar_paint_day (GtkWidget *widget,
state = GTK_WIDGET_HAS_FOCUS (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE;
else
state = GTK_STATE_NORMAL;
-
- gtk_paint_focus (widget->style,
+
+ gtk_paint_focus (widget->style,
private_data->main_win,
- (calendar->selected_day == day)
- ? GTK_STATE_SELECTED : GTK_STATE_NORMAL,
+ (calendar->selected_day == day)
+ ? GTK_STATE_SELECTED : GTK_STATE_NORMAL,
NULL, widget, "calendar-day",
- x_left, y_top,
- private_data->day_width,
+ x_left, y_top,
+ private_data->day_width,
day_height);
}
@@ -1942,10 +1942,10 @@ planner_calendar_paint_main (GtkWidget *widget)
PlannerCalendar *calendar;
PlannerCalendarPrivateData *private_data;
gint row, col;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (widget));
g_return_if_fail (widget->window != NULL);
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
@@ -1956,9 +1956,9 @@ planner_calendar_paint_main (GtkWidget *widget)
}
private_data->dirty_main = 0;
gdk_window_clear (private_data->main_win);
-
+
/* planner_calendar_compute_days (calendar); */ /* REMOVE later */
-
+
for (col = 0; col < 7; col++)
for (row = 0; row < 6; row++)
planner_calendar_paint_day (widget, row, col);
@@ -1975,29 +1975,29 @@ planner_calendar_compute_days (PlannerCalendar *calendar)
gint row;
gint col;
gint day;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (calendar));
-
+
year = calendar->year;
month = calendar->month + 1;
-
+
ndays_in_month = month_length[leap (year)][month];
-
+
first_day = day_of_week (year, month, 1);
-
+
if (calendar->display_flags & PLANNER_CALENDAR_WEEK_START_MONDAY)
first_day--;
else
first_day %= 7;
-
-
+
+
/* Compute days of previous month */
if (month > 1)
ndays_in_prev_month = month_length[leap (year)][month-1];
else
ndays_in_prev_month = month_length[leap (year)][12];
day = ndays_in_prev_month - first_day + 1;
-
+
row = 0;
if (first_day > 0)
{
@@ -2008,14 +2008,14 @@ planner_calendar_compute_days (PlannerCalendar *calendar)
day++;
}
}
-
+
/* Compute days of current month */
col = first_day;
for (day = 1; day <= ndays_in_month; day++)
{
calendar->day[row][col] = day;
calendar->day_month[row][col] = MONTH_CURRENT;
-
+
col++;
if (col == 7)
{
@@ -2023,7 +2023,7 @@ planner_calendar_compute_days (PlannerCalendar *calendar)
col = 0;
}
}
-
+
/* Compute days of next month */
day = 1;
for (; row <= 5; row++)
@@ -2042,7 +2042,7 @@ planner_calendar_compute_days (PlannerCalendar *calendar)
NAME: planner_calendar_display_options
DESCRIPTION: Set display options (whether to display the
heading and the month headings)
-
+
flags is can be an XOR of:
PLANNER_CALENDAR_SHOW_HEADING
PLANNER_CALENDAR_SHOW_DAY_NAMES
@@ -2059,12 +2059,12 @@ planner_calendar_display_options (PlannerCalendar *calendar,
gint resize = 0;
GtkWidget *widget;
gint i;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (calendar));
-
+
widget = GTK_WIDGET (calendar);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (calendar);
-
+
if (GTK_WIDGET_REALIZED (widget))
{
if ((flags ^ calendar->display_flags) & PLANNER_CALENDAR_NO_MONTH_CHANGE)
@@ -2082,7 +2082,7 @@ planner_calendar_display_options (PlannerCalendar *calendar,
{
if (private_data->arrow_win[i])
{
- gdk_window_set_user_data (private_data->arrow_win[i],
+ gdk_window_set_user_data (private_data->arrow_win[i],
NULL);
gdk_window_destroy (private_data->arrow_win[i]);
private_data->arrow_win[i] = NULL;
@@ -2090,11 +2090,11 @@ planner_calendar_display_options (PlannerCalendar *calendar,
}
}
}
-
+
if ((flags ^ calendar->display_flags) & PLANNER_CALENDAR_SHOW_HEADING)
{
resize++;
-
+
if (flags & PLANNER_CALENDAR_SHOW_HEADING)
{
calendar->display_flags |= PLANNER_CALENDAR_SHOW_HEADING;
@@ -2106,7 +2106,7 @@ planner_calendar_display_options (PlannerCalendar *calendar,
{
if (private_data->arrow_win[i])
{
- gdk_window_set_user_data (private_data->arrow_win[i],
+ gdk_window_set_user_data (private_data->arrow_win[i],
NULL);
gdk_window_destroy (private_data->arrow_win[i]);
private_data->arrow_win[i] = NULL;
@@ -2117,12 +2117,12 @@ planner_calendar_display_options (PlannerCalendar *calendar,
private_data->header_win = NULL;
}
}
-
-
+
+
if ((flags ^ calendar->display_flags) & PLANNER_CALENDAR_SHOW_DAY_NAMES)
{
resize++;
-
+
if (flags & PLANNER_CALENDAR_SHOW_DAY_NAMES)
{
calendar->display_flags |= PLANNER_CALENDAR_SHOW_DAY_NAMES;
@@ -2135,11 +2135,11 @@ planner_calendar_display_options (PlannerCalendar *calendar,
private_data->day_name_win = NULL;
}
}
-
+
if ((flags ^ calendar->display_flags) & PLANNER_CALENDAR_SHOW_WEEK_NUMBERS)
{
resize++;
-
+
if (flags & PLANNER_CALENDAR_SHOW_WEEK_NUMBERS)
{
calendar->display_flags |= PLANNER_CALENDAR_SHOW_WEEK_NUMBERS;
@@ -2152,28 +2152,28 @@ planner_calendar_display_options (PlannerCalendar *calendar,
private_data->week_win = NULL;
}
}
-
+
if ((flags ^ calendar->display_flags) & PLANNER_CALENDAR_WEEK_START_MONDAY)
{
if (calendar->display_flags & PLANNER_CALENDAR_WEEK_START_MONDAY)
calendar->display_flags &= ~PLANNER_CALENDAR_WEEK_START_MONDAY;
else
calendar->display_flags |= PLANNER_CALENDAR_WEEK_START_MONDAY;
-
+
planner_calendar_compute_days (calendar);
planner_calendar_paint_main (GTK_WIDGET (calendar));
if (private_data->day_name_win)
planner_calendar_paint_day_names (GTK_WIDGET (calendar));
}
-
+
calendar->display_flags = flags;
if (resize)
gtk_widget_queue_resize (GTK_WIDGET (calendar));
-
- }
+
+ }
else
calendar->display_flags = flags;
-
+
}
gboolean
@@ -2183,12 +2183,12 @@ planner_calendar_select_month (PlannerCalendar *calendar,
{
g_return_val_if_fail (PLANNER_IS_CALENDAR (calendar), FALSE);
g_return_val_if_fail (month <= 11, FALSE);
-
+
calendar->month = month;
calendar->year = year;
-
+
planner_calendar_compute_days (calendar);
-
+
gtk_widget_queue_draw (GTK_WIDGET (calendar));
g_signal_emit (calendar,
planner_calendar_signals[MONTH_CHANGED_SIGNAL],
@@ -2202,29 +2202,29 @@ planner_calendar_select_day (PlannerCalendar *calendar,
{
g_return_if_fail (PLANNER_IS_CALENDAR (calendar));
g_return_if_fail (day <= 31);
-
+
/* planner_calendar_compute_days (calendar); */
-
+
/* Deselect the old day */
if (calendar->selected_day > 0)
{
gint selected_day;
-
+
selected_day = calendar->selected_day;
calendar->selected_day = 0;
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar)))
planner_calendar_paint_day_num (GTK_WIDGET (calendar), selected_day);
}
-
+
calendar->selected_day = day;
-
+
/* Select the new day */
if (day != 0)
{
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar)))
planner_calendar_paint_day_num (GTK_WIDGET (calendar), day);
}
-
+
g_signal_emit (calendar,
planner_calendar_signals[DAY_SELECTED_SIGNAL],
0);
@@ -2238,11 +2238,11 @@ planner_calendar_select_and_focus_day (PlannerCalendar *calendar,
gint old_focus_col = calendar->focus_col;
gint row;
gint col;
-
+
for (row = 0; row < 6; row ++)
for (col = 0; col < 7; col++)
{
- if (calendar->day_month[row][col] == MONTH_CURRENT
+ if (calendar->day_month[row][col] == MONTH_CURRENT
&& calendar->day[row][col] == day)
{
calendar->focus_row = row;
@@ -2252,7 +2252,7 @@ planner_calendar_select_and_focus_day (PlannerCalendar *calendar,
if (old_focus_row != -1 && old_focus_col != -1)
planner_calendar_paint_day (GTK_WIDGET (calendar), old_focus_row, old_focus_col);
-
+
planner_calendar_select_day (calendar, day);
}
@@ -2260,16 +2260,16 @@ void
planner_calendar_clear_marks (PlannerCalendar *calendar)
{
guint day;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (calendar));
-
+
for (day = 0; day < 31; day++)
{
calendar->marked_date[day] = PLANNER_CALENDAR_MARK_NONE;
}
-
+
calendar->num_marked_dates = 0;
-
+
if (GTK_WIDGET_DRAWABLE (calendar))
{
planner_calendar_paint_main (GTK_WIDGET (calendar));
@@ -2281,18 +2281,18 @@ planner_calendar_unmark_day (PlannerCalendar *calendar,
guint day)
{
g_return_val_if_fail (PLANNER_IS_CALENDAR (calendar), FALSE);
-
+
if (day >= 1 && day <= 31 && calendar->marked_date[day-1] == TRUE)
{
calendar->marked_date[day - 1] = FALSE;
calendar->num_marked_dates--;
}
-
+
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar)))
{
planner_calendar_paint_main (GTK_WIDGET (calendar));
}
-
+
return TRUE;
}
@@ -2303,13 +2303,13 @@ planner_calendar_get_date (PlannerCalendar *calendar,
guint *day)
{
g_return_if_fail (PLANNER_IS_CALENDAR (calendar));
-
+
if (year)
*year = calendar->year;
-
+
if (month)
*month = calendar->month;
-
+
if (day)
*day = calendar->selected_day;
}
@@ -2322,17 +2322,17 @@ planner_calendar_button_press (GtkWidget *widget,
PlannerCalendarPrivateData *private_data;
gint x, y;
void (* action_func) (PlannerCalendar *);
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
-
+
x = (gint) (event->x);
y = (gint) (event->y);
-
+
if (event->window == private_data->main_win)
planner_calendar_main_button (widget, event);
- action_func = NULL;
+ action_func = NULL;
if (event->window == private_data->arrow_win[ARROW_MONTH_LEFT])
action_func = planner_calendar_set_month_prev;
@@ -2346,7 +2346,7 @@ planner_calendar_button_press (GtkWidget *widget,
/* only call the action on single click, not double */
if (action_func && event->type == GDK_BUTTON_PRESS)
(* action_func) (calendar);
-
+
return action_func != NULL;
}
@@ -2359,18 +2359,18 @@ planner_calendar_motion_notify (GtkWidget *widget,
gint event_x, event_y;
gint row, col;
gint old_row, old_col;
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
event_x = (gint) (event->x);
event_y = (gint) (event->y);
-
+
if (event->window == private_data->main_win)
{
-
+
row = row_from_y (calendar, event_y);
col = column_from_x (calendar, event_x);
-
+
if (row != calendar->highlight_row || calendar->highlight_col != col)
{
old_row = calendar->highlight_row;
@@ -2381,10 +2381,10 @@ planner_calendar_motion_notify (GtkWidget *widget,
calendar->highlight_col = -1;
planner_calendar_paint_day (widget, old_row, old_col);
}
-
+
calendar->highlight_row = row;
calendar->highlight_col = col;
-
+
if (row > -1 && col > -1)
planner_calendar_paint_day (widget, row, col);
}
@@ -2398,34 +2398,34 @@ planner_calendar_enter_notify (GtkWidget *widget,
{
PlannerCalendar *calendar;
PlannerCalendarPrivateData *private_data;
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
-
+
if (event->window == private_data->arrow_win[ARROW_MONTH_LEFT])
{
private_data->arrow_state[ARROW_MONTH_LEFT] = GTK_STATE_PRELIGHT;
planner_calendar_paint_arrow (widget, ARROW_MONTH_LEFT);
}
-
+
if (event->window == private_data->arrow_win[ARROW_MONTH_RIGHT])
{
private_data->arrow_state[ARROW_MONTH_RIGHT] = GTK_STATE_PRELIGHT;
planner_calendar_paint_arrow (widget, ARROW_MONTH_RIGHT);
}
-
+
if (event->window == private_data->arrow_win[ARROW_YEAR_LEFT])
{
private_data->arrow_state[ARROW_YEAR_LEFT] = GTK_STATE_PRELIGHT;
planner_calendar_paint_arrow (widget, ARROW_YEAR_LEFT);
}
-
+
if (event->window == private_data->arrow_win[ARROW_YEAR_RIGHT])
{
private_data->arrow_state[ARROW_YEAR_RIGHT] = GTK_STATE_PRELIGHT;
planner_calendar_paint_arrow (widget, ARROW_YEAR_RIGHT);
}
-
+
return TRUE;
}
@@ -2437,10 +2437,10 @@ planner_calendar_leave_notify (GtkWidget *widget,
PlannerCalendarPrivateData *private_data;
gint row;
gint col;
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
-
+
if (event->window == private_data->main_win)
{
row = calendar->highlight_row;
@@ -2450,31 +2450,31 @@ planner_calendar_leave_notify (GtkWidget *widget,
if (row > -1 && col > -1)
planner_calendar_paint_day (widget, row, col);
}
-
+
if (event->window == private_data->arrow_win[ARROW_MONTH_LEFT])
{
private_data->arrow_state[ARROW_MONTH_LEFT] = GTK_STATE_NORMAL;
planner_calendar_paint_arrow (widget, ARROW_MONTH_LEFT);
}
-
+
if (event->window == private_data->arrow_win[ARROW_MONTH_RIGHT])
{
private_data->arrow_state[ARROW_MONTH_RIGHT] = GTK_STATE_NORMAL;
planner_calendar_paint_arrow (widget, ARROW_MONTH_RIGHT);
}
-
+
if (event->window == private_data->arrow_win[ARROW_YEAR_LEFT])
{
private_data->arrow_state[ARROW_YEAR_LEFT] = GTK_STATE_NORMAL;
planner_calendar_paint_arrow (widget, ARROW_YEAR_LEFT);
}
-
+
if (event->window == private_data->arrow_win[ARROW_YEAR_RIGHT])
{
private_data->arrow_state[ARROW_YEAR_RIGHT] = GTK_STATE_NORMAL;
planner_calendar_paint_arrow (widget, ARROW_YEAR_RIGHT);
}
-
+
return TRUE;
}
@@ -2488,7 +2488,7 @@ planner_calendar_paint_arrow (GtkWidget *widget,
PlannerCalendar *calendar;
gint state;
gint width, height;
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
@@ -2502,19 +2502,19 @@ planner_calendar_paint_arrow (GtkWidget *widget,
{
state = private_data->arrow_state[arrow];
gc = calendar->gc;
-
+
gdk_window_clear (window);
gdk_window_set_background (window, &(widget)->style->bg[state]);
gdk_drawable_get_size (window, &width, &height);
gdk_window_clear_area (window,
0,0,
width,height);
-
+
gdk_gc_set_foreground (gc, & (widget)->style->fg[state]);
-
+
if (arrow == ARROW_MONTH_LEFT || arrow == ARROW_YEAR_LEFT)
draw_arrow_left (window, gc, width/2 - 3, height/2 - 4, 8);
- else
+ else
draw_arrow_right (window, gc, width/2 - 2, height/2 - 4, 8);
return;
}
@@ -2524,7 +2524,7 @@ void
planner_calendar_freeze (PlannerCalendar *calendar)
{
g_return_if_fail (PLANNER_IS_CALENDAR (calendar));
-
+
PLANNER_CALENDAR_PRIVATE_DATA (calendar)->freeze_count++;
}
@@ -2534,24 +2534,24 @@ planner_calendar_thaw (PlannerCalendar *calendar)
PlannerCalendarPrivateData *private_data;
g_return_if_fail (PLANNER_IS_CALENDAR (calendar));
-
+
private_data = PLANNER_CALENDAR_PRIVATE_DATA (calendar);
-
+
if (private_data->freeze_count)
if (!(--private_data->freeze_count))
{
if (private_data->dirty_header)
if (GTK_WIDGET_DRAWABLE (calendar))
planner_calendar_paint_header (GTK_WIDGET (calendar));
-
+
if (private_data->dirty_day_names)
if (GTK_WIDGET_DRAWABLE (calendar))
planner_calendar_paint_day_names (GTK_WIDGET (calendar));
-
+
if (private_data->dirty_week)
if (GTK_WIDGET_DRAWABLE (calendar))
planner_calendar_paint_week_numbers (GTK_WIDGET (calendar));
-
+
if (private_data->dirty_main)
if (GTK_WIDGET_DRAWABLE (calendar))
planner_calendar_paint_main (GTK_WIDGET (calendar));
@@ -2564,7 +2564,7 @@ planner_calendar_set_background (GtkWidget *widget)
PlannerCalendar *calendar;
PlannerCalendarPrivateData *private_data;
gint i;
-
+
calendar = PLANNER_CALENDAR (widget);
private_data = PLANNER_CALENDAR_PRIVATE_DATA (widget);
@@ -2573,14 +2573,14 @@ planner_calendar_set_background (GtkWidget *widget)
for (i = 0; i < 4; i++)
{
if (private_data->arrow_win[i])
- gdk_window_set_background (private_data->arrow_win[i],
+ gdk_window_set_background (private_data->arrow_win[i],
HEADER_BG_COLOR (widget));
}
if (private_data->header_win)
- gdk_window_set_background (private_data->header_win,
+ gdk_window_set_background (private_data->header_win,
HEADER_BG_COLOR (widget));
if (private_data->day_name_win)
- gdk_window_set_background (private_data->day_name_win,
+ gdk_window_set_background (private_data->day_name_win,
BACKGROUND_COLOR (widget));
if (private_data->week_win)
gdk_window_set_background (private_data->week_win,
@@ -2590,7 +2590,7 @@ planner_calendar_set_background (GtkWidget *widget)
BACKGROUND_COLOR (widget));
if (widget->window)
gdk_window_set_background (widget->window,
- BACKGROUND_COLOR (widget));
+ BACKGROUND_COLOR (widget));
}
}
@@ -2614,9 +2614,9 @@ planner_calendar_finalize (GObject *object)
{
PlannerCalendarPrivateData *private_data;
private_data = PLANNER_CALENDAR_PRIVATE_DATA (object);
-
+
g_free (private_data);
-
+
if (G_OBJECT_CLASS (parent_class)->finalize)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -2630,10 +2630,10 @@ planner_calendar_key_press (GtkWidget *widget,
gint old_focus_row;
gint old_focus_col;
gint row, col, day;
-
+
calendar = PLANNER_CALENDAR (widget);
return_val = FALSE;
-
+
old_focus_row = calendar->focus_row;
old_focus_col = calendar->focus_col;
@@ -2726,11 +2726,11 @@ planner_calendar_key_press (GtkWidget *widget,
row = calendar->focus_row;
col = calendar->focus_col;
day = calendar->day[row][col];
-
+
if (row > -1 && col > -1)
{
return_val = TRUE;
- planner_calendar_freeze (calendar);
+ planner_calendar_freeze (calendar);
if (calendar->day_month[row][col] == MONTH_PREV)
{
@@ -2742,11 +2742,11 @@ planner_calendar_key_press (GtkWidget *widget,
}
planner_calendar_select_and_focus_day (calendar, day);
-
- planner_calendar_thaw (calendar);
+
+ planner_calendar_thaw (calendar);
}
- }
-
+ }
+
return return_val;
}
@@ -2760,12 +2760,12 @@ planner_calendar_mark_day (PlannerCalendar *calendar,
PlannerCalendarMarkType type)
{
gint index;
-
+
g_return_if_fail (PLANNER_IS_CALENDAR (calendar));
g_return_if_fail (day >= 1 && day <= 31);
index = day - 1;
-
+
if (calendar->marked_date[index] == type) {
return;
}
@@ -2780,7 +2780,7 @@ planner_calendar_mark_day (PlannerCalendar *calendar,
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar))) {
planner_calendar_paint_main (GTK_WIDGET (calendar));
}
-}
+}
diff --git a/src/planner-calendar.h b/src/planner-calendar.h
index 9fb54af..becec0d 100644
--- a/src/planner-calendar.h
+++ b/src/planner-calendar.h
@@ -23,7 +23,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __PLANNER_CALENDAR_H__
@@ -63,34 +63,34 @@ typedef enum
struct _PlannerCalendar
{
GtkWidget widget;
-
+
GtkStyle *header_style;
GtkStyle *label_style;
-
+
gint month;
gint year;
gint selected_day;
-
+
gint day_month[6][7];
gint day[6][7];
-
+
gint num_marked_dates;
gint marked_date[31];
PlannerCalendarDisplayOptions display_flags;
GdkColor marked_date_color[31];
-
+
GdkGC *gc;
GdkGC *xor_gc;
-
+
gint focus_row;
gint focus_col;
-
+
gint highlight_row;
gint highlight_col;
-
+
gpointer private_data;
gchar grow_space [32];
-
+
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
@@ -101,7 +101,7 @@ struct _PlannerCalendar
struct _PlannerCalendarClass
{
GtkWidgetClass parent_class;
-
+
/* Signal handlers */
void (* month_changed) (PlannerCalendar *calendar);
void (* day_selected) (PlannerCalendar *calendar);
@@ -110,14 +110,14 @@ struct _PlannerCalendarClass
void (* next_month) (PlannerCalendar *calendar);
void (* prev_year) (PlannerCalendar *calendar);
void (* next_year) (PlannerCalendar *calendar);
-
+
};
GType planner_calendar_get_type (void) G_GNUC_CONST;
GtkWidget* planner_calendar_new (void);
-gboolean planner_calendar_select_month (PlannerCalendar *calendar,
+gboolean planner_calendar_select_month (PlannerCalendar *calendar,
guint month,
guint year);
void planner_calendar_select_day (PlannerCalendar *calendar,
@@ -130,7 +130,7 @@ void planner_calendar_clear_marks (PlannerCalendar *calendar);
void planner_calendar_display_options (PlannerCalendar *calendar,
PlannerCalendarDisplayOptions flags);
-void planner_calendar_get_date (PlannerCalendar *calendar,
+void planner_calendar_get_date (PlannerCalendar *calendar,
guint *year,
guint *month,
guint *day);
diff --git a/src/planner-canvas-line.c b/src/planner-canvas-line.c
index 2a43e51..40e4522 100644
--- a/src/planner-canvas-line.c
+++ b/src/planner-canvas-line.c
@@ -55,7 +55,7 @@ planner_canvas_line_get_type (void)
type = g_type_register_static (GNOME_TYPE_CANVAS_LINE, "PlannerCanvasLine",
&info, 0);
}
-
+
return type;
}
diff --git a/src/planner-cell-renderer-date.c b/src/planner-cell-renderer-date.c
index 214acd8..b4e238f 100644
--- a/src/planner-cell-renderer-date.c
+++ b/src/planner-cell-renderer-date.c
@@ -99,7 +99,7 @@ GType
planner_cell_renderer_date_get_type (void)
{
static GType cell_text_type = 0;
-
+
if (!cell_text_type) {
static const GTypeInfo cell_text_info = {
sizeof (PlannerCellRendererDateClass),
@@ -112,13 +112,13 @@ planner_cell_renderer_date_get_type (void)
0, /* n_preallocs */
(GInstanceInitFunc) mcrd_init,
};
-
+
cell_text_type = g_type_register_static (PLANNER_TYPE_CELL_RENDERER_POPUP,
"PlannerCellRendererDate",
&cell_text_info,
0);
}
-
+
return cell_text_type;
}
@@ -141,19 +141,19 @@ mcrd_init (PlannerCellRendererDate *date)
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
-
+
date->calendar = gtk_calendar_new ();
popup->focus_window = date->calendar;
gtk_box_pack_start (GTK_BOX (vbox), date->calendar, TRUE, TRUE, 0);
date->constraint_vbox = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), date->constraint_vbox, FALSE, FALSE, 0);
-
+
hbox = gtk_hbox_new (FALSE, 6);
/* I18n: the verb "schedule" here. */
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("Schedule:")),
FALSE, FALSE, 0);
-
+
date->option_menu = gtk_option_menu_new ();
mcrd_setup_option_menu (date->option_menu,
G_CALLBACK (mcrd_constraint_activated_cb),
@@ -165,10 +165,10 @@ mcrd_init (PlannerCellRendererDate *date)
gtk_box_pack_end (GTK_BOX (hbox), date->option_menu, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (date->constraint_vbox), hbox, TRUE, TRUE, 0);
-
+
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (date->constraint_vbox), hbox, FALSE, FALSE, 0);
-
+
bbox = gtk_hbutton_box_new ();
gtk_box_set_spacing (GTK_BOX (bbox), 6);
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
@@ -178,7 +178,7 @@ mcrd_init (PlannerCellRendererDate *date)
g_signal_connect (date->today_button, "clicked",
G_CALLBACK (mcrd_today_clicked),
date);
-
+
button = gtk_button_new_with_label (_("Cancel"));
gtk_container_add (GTK_CONTAINER (bbox), button);
g_signal_connect (button,
@@ -195,7 +195,7 @@ mcrd_init (PlannerCellRendererDate *date)
g_signal_connect (date->calendar, "day-selected",
G_CALLBACK (mcrd_day_selected),
date);
- g_signal_connect (date->calendar, "day-selected-double-click",
+ g_signal_connect (date->calendar, "day-selected-double-click",
G_CALLBACK (mcrd_selected_double_click),
date);
@@ -210,7 +210,7 @@ mcrd_class_init (PlannerCellRendererDateClass *class)
GObjectClass *gobject_class;
popup_class = PLANNER_CELL_RENDERER_POPUP_CLASS (class);
- cell_class = GTK_CELL_RENDERER_CLASS (class);
+ cell_class = GTK_CELL_RENDERER_CLASS (class);
parent_class = PLANNER_CELL_RENDERER_POPUP_CLASS (g_type_class_peek_parent (class));
gobject_class = G_OBJECT_CLASS (class);
@@ -218,7 +218,7 @@ mcrd_class_init (PlannerCellRendererDateClass *class)
gobject_class->get_property = mcrd_get_property;
cell_class->start_editing = mcrd_start_editing;
-
+
popup_class->show_popup = mcrd_show;
popup_class->hide_popup = mcrd_hide;
@@ -242,7 +242,7 @@ mcrd_set_property (GObject *object,
PlannerCellRendererDate *date;
date = PLANNER_CELL_RENDERER_DATE (object);
-
+
switch (param_id) {
case PROP_USE_CONSTRAINT:
date->use_constraint = g_value_get_boolean (value);
@@ -272,7 +272,7 @@ mcrd_get_property (GObject *object,
PlannerCellRendererDate *date;
date = PLANNER_CELL_RENDERER_DATE (object);
-
+
switch (param_id) {
case PROP_USE_CONSTRAINT:
g_value_set_boolean (value, date->use_constraint);
@@ -294,7 +294,7 @@ mcrd_start_editing (GtkCellRenderer *cell,
GtkCellRendererState flags)
{
PLANNER_CELL_RENDERER_POPUP (cell)->editing_canceled = TRUE;
-
+
if (GTK_CELL_RENDERER_CLASS (parent_class)->start_editing) {
return GTK_CELL_RENDERER_CLASS (parent_class)->start_editing (
cell,
@@ -343,9 +343,9 @@ mcrd_show (PlannerCellRendererPopup *cell,
date = PLANNER_CELL_RENDERER_DATE (cell);
mrp_time_decompose (date->time, &year, &month, &day, NULL, NULL, NULL);
-
+
index = 0;
-
+
switch (date->type) {
case MRP_CONSTRAINT_ASAP:
index = 0;
@@ -363,16 +363,16 @@ mcrd_show (PlannerCellRendererPopup *cell,
sensitive = (!date->use_constraint ||
(date->type != MRP_CONSTRAINT_ASAP &&
date->type != MRP_CONSTRAINT_ALAP));
-
+
gtk_widget_set_sensitive (date->calendar, sensitive);
gtk_widget_set_sensitive (date->today_button, sensitive);
-
+
gtk_calendar_clear_marks (GTK_CALENDAR (date->calendar));
gtk_calendar_select_month (GTK_CALENDAR (date->calendar),
month - 1, year);
gtk_calendar_select_day (GTK_CALENDAR (date->calendar), day);
gtk_calendar_mark_day (GTK_CALENDAR (date->calendar), day);
-
+
gtk_option_menu_set_history (GTK_OPTION_MENU (date->option_menu),
index);
}
@@ -385,7 +385,7 @@ planner_cell_renderer_date_new (gboolean use_constraint)
cell = g_object_new (PLANNER_TYPE_CELL_RENDERER_DATE,
"use-constraint", use_constraint,
NULL);
-
+
return GTK_CELL_RENDERER (cell);
}
@@ -395,12 +395,12 @@ mcrd_today_clicked (GtkWidget *button,
{
mrptime today;
gint year, month, day;
-
+
today = mrp_time_current_time ();
mrp_time_decompose (today, &year, &month, &day,
NULL, NULL, NULL);
-
+
gtk_calendar_clear_marks (GTK_CALENDAR (cell->calendar));
gtk_calendar_select_month (GTK_CALENDAR (cell->calendar),
month - 1, year);
@@ -413,7 +413,7 @@ mcrd_selected_double_click (GtkWidget *calendar,
PlannerCellRendererDate *cell)
{
PlannerCellRendererPopup *popup;
-
+
popup = PLANNER_CELL_RENDERER_POPUP (cell);
mcrd_ok_clicked (popup->popup_window, cell);
@@ -424,7 +424,7 @@ mcrd_cancel_clicked (GtkWidget *popup_window,
PlannerCellRendererDate *cell)
{
PlannerCellRendererPopup *popup;
-
+
popup = PLANNER_CELL_RENDERER_POPUP (cell);
popup->editing_canceled = TRUE;
@@ -436,7 +436,7 @@ mcrd_ok_clicked (GtkWidget *popup_window,
PlannerCellRendererDate *cell)
{
PlannerCellRendererPopup *popup;
-
+
popup = PLANNER_CELL_RENDERER_POPUP (cell);
mcrd_day_selected (popup_window, cell);
@@ -496,7 +496,7 @@ mcrd_constraint_activated_cb (GtkWidget *widget,
{
gpointer data;
gboolean sensitive;
-
+
data = g_object_get_data (G_OBJECT (widget), "data");
cell->type = GPOINTER_TO_INT (data);
@@ -504,10 +504,10 @@ mcrd_constraint_activated_cb (GtkWidget *widget,
sensitive = (!cell->use_constraint ||
(cell->type != MRP_CONSTRAINT_ASAP &&
cell->type != MRP_CONSTRAINT_ALAP));
-
+
gtk_widget_set_sensitive (cell->calendar, sensitive);
gtk_widget_set_sensitive (cell->today_button, sensitive);
-
+
/* A bit hackish. Grab focus on the popup window again when the
* optionmenu is activated, since focus is transferred to the optionmenu
* when it's popped up.
@@ -535,7 +535,7 @@ mcrd_setup_option_menu (GtkWidget *option_menu,
if (menu) {
gtk_widget_destroy (menu);
}
-
+
menu = gtk_menu_new ();
va_start (args, str1);
@@ -545,7 +545,7 @@ mcrd_setup_option_menu (GtkWidget *option_menu,
gtk_menu_append (GTK_MENU (menu), menu_item);
type = va_arg (args, gint);
-
+
g_object_set_data (G_OBJECT (menu_item),
"data",
GINT_TO_POINTER (type));
diff --git a/src/planner-cell-renderer-list.c b/src/planner-cell-renderer-list.c
index 7c51793..a0d833e 100644
--- a/src/planner-cell-renderer-list.c
+++ b/src/planner-cell-renderer-list.c
@@ -68,7 +68,7 @@ GType
planner_cell_renderer_list_get_type (void)
{
static GType type = 0;
-
+
if (!type) {
static const GTypeInfo info = {
sizeof (PlannerCellRendererListClass),
@@ -81,13 +81,13 @@ planner_cell_renderer_list_get_type (void)
0, /* n_preallocs */
(GInstanceInitFunc) mcrl_init,
};
-
+
type = g_type_register_static (PLANNER_TYPE_CELL_RENDERER_POPUP,
"PlannerCellRendererList",
&info,
0);
}
-
+
return type;
}
@@ -100,7 +100,7 @@ mcrl_init (PlannerCellRendererList *cell)
GtkTreeSelection *selection;
popup_cell = PLANNER_CELL_RENDERER_POPUP (cell);
-
+
frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (popup_cell->popup_window), frame);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
@@ -108,11 +108,11 @@ mcrl_init (PlannerCellRendererList *cell)
cell->tree_view = gtk_tree_view_new ();
gtk_container_add (GTK_CONTAINER (frame), cell->tree_view);
-
+
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (cell->tree_view), FALSE);
textcell = gtk_cell_renderer_text_new ();
-
+
gtk_tree_view_insert_column_with_attributes (
GTK_TREE_VIEW (cell->tree_view),
0,
@@ -130,7 +130,7 @@ mcrl_init (PlannerCellRendererList *cell)
g_signal_connect (selection, "changed",
G_CALLBACK (mcrl_selection_changed_cb),
cell);
-
+
gtk_widget_show (cell->tree_view);
popup_cell->focus_window = cell->tree_view;
@@ -178,7 +178,7 @@ mcrl_show_popup (PlannerCellRendererPopup *cell,
0, l->data,
-1);
}
-
+
gtk_tree_view_set_model (GTK_TREE_VIEW (list_cell->tree_view), model);
g_object_unref (model);
@@ -201,7 +201,7 @@ mcrl_hide_popup (PlannerCellRendererPopup *cell)
GList *l;
list_cell = PLANNER_CELL_RENDERER_LIST (cell);
-
+
if (parent_class->hide_popup) {
parent_class->hide_popup (cell);
}
@@ -209,11 +209,11 @@ mcrl_hide_popup (PlannerCellRendererPopup *cell)
for (l = list_cell->list; l; l = l->next) {
g_free (l->data);
}
-
+
g_list_free (list_cell->list);
list_cell->list = NULL;
}
-
+
GtkCellRenderer *
planner_cell_renderer_list_new (void)
{
@@ -224,7 +224,7 @@ planner_cell_renderer_list_new (void)
return GTK_CELL_RENDERER (cell);
}
-static void
+static void
mcrl_selection_changed_cb (GtkTreeSelection *selection,
PlannerCellRendererList *cell)
{
@@ -233,7 +233,7 @@ mcrl_selection_changed_cb (GtkTreeSelection *selection,
GtkTreeIter iter;
GtkTreePath *path;
gint *indices;
-
+
selected = gtk_tree_selection_get_selected (selection,
&model,
&iter);
@@ -241,16 +241,16 @@ mcrl_selection_changed_cb (GtkTreeSelection *selection,
if (!selected) {
return;
}
-
+
path = gtk_tree_model_get_path (model, &iter);
indices = gtk_tree_path_get_indices (path);
cell->selected_index = indices[0];
-
+
gtk_tree_path_free (path);
}
-static void
+static void
mcrl_select_index (PlannerCellRendererList *cell,
gint index)
{
@@ -260,10 +260,10 @@ mcrl_select_index (PlannerCellRendererList *cell,
GtkTreePath *path;
tree_view = GTK_TREE_VIEW (cell->tree_view);
-
+
model = gtk_tree_view_get_model (tree_view);
selection = gtk_tree_view_get_selection (tree_view);
-
+
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, index);
@@ -271,7 +271,7 @@ mcrl_select_index (PlannerCellRendererList *cell,
path,
NULL,
FALSE);
-
+
gtk_tree_path_free (path);
}
diff --git a/src/planner-cell-renderer-popup.c b/src/planner-cell-renderer-popup.c
index b3b9411..428252e 100644
--- a/src/planner-cell-renderer-popup.c
+++ b/src/planner-cell-renderer-popup.c
@@ -84,7 +84,7 @@ GType
planner_cell_renderer_popup_get_type (void)
{
static GType cell_text_type = 0;
-
+
if (!cell_text_type) {
static const GTypeInfo cell_text_info = {
sizeof (PlannerCellRendererPopupClass),
@@ -97,13 +97,13 @@ planner_cell_renderer_popup_get_type (void)
0, /* n_preallocs */
(GInstanceInitFunc) mcrp_init,
};
-
+
cell_text_type = g_type_register_static (GTK_TYPE_CELL_RENDERER_TEXT,
"PlannerCellRendererPopup",
&cell_text_info,
0);
}
-
+
return cell_text_type;
}
@@ -113,7 +113,7 @@ mcrp_init (PlannerCellRendererPopup *popup)
popup->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
popup->button_width = -1;
-
+
g_signal_connect (popup->popup_window,
"button-press-event",
G_CALLBACK (mcrp_button_press_event),
@@ -134,9 +134,9 @@ static void
mcrp_class_init (PlannerCellRendererPopupClass *class)
{
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
-
+
parent_class = GTK_CELL_RENDERER_TEXT_CLASS (g_type_class_peek_parent (class));
-
+
cell_class->start_editing = mcrp_start_editing;
cell_class->get_size = mcrp_get_size;
@@ -178,7 +178,7 @@ mcrp_editing_done (GtkCellEditable *editable,
cell->editing_canceled) {
return;
}
-
+
path = g_object_get_data (G_OBJECT (editable),
PLANNER_CELL_RENDERER_POPUP_PATH);
new_text = planner_popup_entry_get_text (PLANNER_POPUP_ENTRY (editable));
@@ -197,7 +197,7 @@ mcrp_style_set (GtkWidget *widget,
/* Invalidate the cache. */
popup->button_width = -1;
}
-
+
static gboolean
mcrp_grab_on_window (GdkWindow *window,
guint32 activate_time)
@@ -248,7 +248,7 @@ mcrp_show_popup (PlannerCellRendererPopup *cell,
y = y2;
button_height = y2 - y1;
-
+
screen_height = gdk_screen_height () - y;
screen_width = gdk_screen_width ();
@@ -305,7 +305,7 @@ mcrp_hide_popup (PlannerCellRendererPopup *cell)
if (cell->editable) {
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (cell->editable));
}
-
+
cell->shown = FALSE;
cell->editing_canceled = FALSE;
}
@@ -317,13 +317,13 @@ mcrp_arrow_clicked (GtkCellEditable *entry,
GtkAllocation alloc;
gint x, y;
const gchar *path;
-
+
if (cell->shown) {
cell->editing_canceled = TRUE;
planner_cell_renderer_popup_hide (cell);
return;
}
-
+
path = g_object_get_data (G_OBJECT (entry),
PLANNER_CELL_RENDERER_POPUP_PATH);
@@ -336,15 +336,15 @@ mcrp_arrow_clicked (GtkCellEditable *entry,
gtk_get_current_event_time ())) {
return;
}
-
+
gtk_editable_select_region (GTK_EDITABLE (PLANNER_POPUP_ENTRY (entry)->entry), 0, 0);
gdk_window_get_origin (GTK_WIDGET (entry)->window, &x, &y);
-
+
alloc = GTK_WIDGET (entry)->allocation;
g_signal_emit (cell, signals[SHOW_POPUP], 0,
- path,
+ path,
x,
y,
x + alloc.width,
@@ -363,24 +363,24 @@ mcrp_start_editing (GtkCellRenderer *cell,
PlannerCellRendererPopup *popup;
GtkWidget *editable;
gchar *text;
-
+
popup = PLANNER_CELL_RENDERER_POPUP (cell);
/* If the cell isn't editable we return NULL. */
if (GTK_CELL_RENDERER_TEXT (popup)->editable == FALSE) {
return NULL;
}
-
+
editable = g_object_new (PLANNER_TYPE_POPUP_ENTRY, NULL);
text = GTK_CELL_RENDERER_TEXT (cell)->text;
planner_popup_entry_set_text (PLANNER_POPUP_ENTRY (editable), text ? text : "");
-
+
g_object_set_data_full (G_OBJECT (editable),
PLANNER_CELL_RENDERER_POPUP_PATH,
g_strdup (path),
g_free);
-
+
gtk_widget_show (editable);
g_signal_connect (editable,
@@ -397,7 +397,7 @@ mcrp_start_editing (GtkCellRenderer *cell,
g_object_add_weak_pointer (G_OBJECT (popup->editable),
(gpointer) &popup->editable);
-
+
return GTK_CELL_EDITABLE (editable);
}
@@ -410,9 +410,9 @@ planner_cell_renderer_popup_new (void)
void
planner_cell_renderer_popup_hide (PlannerCellRendererPopup *cell)
-{
+{
g_return_if_fail (PLANNER_IS_CELL_RENDERER_POPUP (cell));
-
+
g_signal_emit (cell, signals[HIDE_POPUP], 0);
}
@@ -428,11 +428,11 @@ mcrp_get_size (GtkCellRenderer *cell,
PlannerCellRendererPopup *popup;
popup = PLANNER_CELL_RENDERER_POPUP (cell);
-
- if (GTK_CELL_RENDERER_CLASS (parent_class)->get_size) {
+
+ if (GTK_CELL_RENDERER_CLASS (parent_class)->get_size) {
(* GTK_CELL_RENDERER_CLASS (parent_class)->get_size) (cell,
widget,
- cell_area,
+ cell_area,
x_offset,
y_offset,
width,
@@ -443,7 +443,7 @@ mcrp_get_size (GtkCellRenderer *cell,
if (popup->button_width == -1) {
popup->button_width = planner_popup_get_button_width ();
}
-
+
*width += popup->button_width;
}
@@ -464,8 +464,8 @@ mcrp_key_press_event (GtkWidget *popup_window,
cell->editing_canceled = TRUE;
} else {
cell->editing_canceled = FALSE;
- }
-
+ }
+
planner_cell_renderer_popup_hide (cell);
return TRUE;
@@ -485,7 +485,7 @@ mcrp_button_press_event (GtkWidget *widget,
if (event->button != 1) {
return FALSE;
}
-
+
/* If the event happened outside the popup, cancel editing.
*/
@@ -499,7 +499,7 @@ mcrp_button_press_event (GtkWidget *widget,
xoffset += widget->allocation.x;
yoffset += widget->allocation.y;
-
+
alloc = popup->popup_window->allocation;
x1 = alloc.x + xoffset;
y1 = alloc.y + yoffset;
@@ -509,9 +509,9 @@ mcrp_button_press_event (GtkWidget *widget,
if (x > x1 && x < x2 && y > y1 && y < y2) {
return FALSE;
}
-
+
popup->editing_canceled = TRUE;
planner_cell_renderer_popup_hide (popup);
-
+
return FALSE;
}
diff --git a/src/planner-cell-renderer-popup.h b/src/planner-cell-renderer-popup.h
index 0e1b86e..635d8ea 100644
--- a/src/planner-cell-renderer-popup.h
+++ b/src/planner-cell-renderer-popup.h
@@ -20,7 +20,7 @@ struct _PlannerCellRendererPopup
/* Cached width of the popup button. */
gint button_width;
-
+
/* The popup window. */
GtkWidget *popup_window;
@@ -37,14 +37,14 @@ struct _PlannerCellRendererPopup
struct _PlannerCellRendererPopupClass
{
GtkCellRendererTextClass parent_class;
-
+
void (* show_popup) (PlannerCellRendererPopup *cell,
const gchar *path,
gint x1,
gint y1,
gint x2,
gint y2);
-
+
void (* hide_popup) (PlannerCellRendererPopup *cell);
};
diff --git a/src/planner-cmd-manager.c b/src/planner-cmd-manager.c
index 883ff58..c49d2ad 100644
--- a/src/planner-cmd-manager.c
+++ b/src/planner-cmd-manager.c
@@ -26,7 +26,7 @@
struct _PlannerCmdManagerPriv {
gint limit;
-
+
GList *list;
GList *current;
@@ -54,7 +54,7 @@ GType
planner_cmd_manager_get_type (void)
{
static GType type = 0;
-
+
if (!type) {
static const GTypeInfo info = {
sizeof (PlannerCmdManagerClass),
@@ -72,7 +72,7 @@ planner_cmd_manager_get_type (void)
"PlannerCmdManager",
&info, 0);
}
-
+
return type;
}
@@ -80,14 +80,14 @@ static void
cmd_manager_class_init (PlannerCmdManagerClass *klass)
{
GObjectClass *o_class;
-
+
parent_class = g_type_class_peek_parent (klass);
o_class = (GObjectClass *) klass;
-
+
/* GObject functions */
o_class->finalize = cmd_manager_finalize;
-
+
/* Signals */
signals[UNDO_STATE_CHANGED] = g_signal_new (
"undo_state_changed",
@@ -112,7 +112,7 @@ static void
cmd_manager_init (PlannerCmdManager *manager)
{
PlannerCmdManagerPriv *priv;
-
+
priv = g_new0 (PlannerCmdManagerPriv, 1);
manager->priv = priv;
@@ -127,11 +127,11 @@ cmd_manager_finalize (GObject *object)
{
PlannerCmdManager *manager = PLANNER_CMD_MANAGER (object);
PlannerCmdManagerPriv *priv = manager->priv;;
-
+
g_list_foreach (priv->list, (GFunc) cmd_manager_free_func, NULL);
-
+
g_free (manager->priv);
-
+
if (G_OBJECT_CLASS (parent_class)->finalize) {
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -145,25 +145,25 @@ cmd_manager_dump (PlannerCmdManager *manager)
PlannerCmd *cmd;
priv = manager->priv;
-
+
if (!g_getenv ("PLANNER_DEBUG_UNDO")) {
return;
}
-
+
g_print ("--------\n");
-
+
for (l = priv->list; l; l = l->next) {
if (l == priv->current) {
g_print ("*");
} else {
g_print (" ");
- }
+ }
cmd = l->data;
-
+
g_print (" %s\n", cmd->name);
}
-
+
g_print ("\n");
}
@@ -172,14 +172,14 @@ get_undo_cmd (PlannerCmdManager *manager, gboolean next)
{
PlannerCmdManagerPriv *priv = manager->priv;
PlannerCmd *cmd;
-
+
if (priv->current) {
cmd = priv->current->data;
if (next) {
priv->current = priv->current->next;
}
-
+
return cmd;
}
@@ -192,7 +192,7 @@ get_redo_cmd (PlannerCmdManager *manager, gboolean next)
PlannerCmdManagerPriv *priv = manager->priv;
GList *l;
PlannerCmd *cmd;
-
+
if (!priv->current && priv->list) {
l = g_list_last (priv->list);
}
@@ -220,7 +220,7 @@ state_changed (PlannerCmdManager *manager)
{
gchar *name;
PlannerCmd *cmd;
-
+
/* Undo */
cmd = get_undo_cmd (manager, FALSE);
if (cmd) {
@@ -228,11 +228,11 @@ state_changed (PlannerCmdManager *manager)
} else {
name = g_strdup (_("Undo"));
}
-
+
g_signal_emit (manager, signals[UNDO_STATE_CHANGED], 0, cmd != NULL, name);
g_free (name);
-
+
/* Redo */
cmd = get_redo_cmd (manager, FALSE);
if (cmd) {
@@ -240,7 +240,7 @@ state_changed (PlannerCmdManager *manager)
} else {
name = g_strdup (_("Redo"));
}
-
+
g_signal_emit (manager, signals[REDO_STATE_CHANGED], 0, cmd != NULL, name);
g_free (name);
@@ -270,7 +270,7 @@ cmd_manager_ensure_limit (PlannerCmdManager *manager)
priv = manager->priv;
g_return_if_fail (priv->limit > 1);
-
+
/* Don't try to cut when inside a transaction to make this a bit
* simpler.
*/
@@ -288,16 +288,16 @@ cmd_manager_ensure_limit (PlannerCmdManager *manager)
cmd = l->data;
if (cmd->type == PLANNER_CMD_TYPE_END_TRANSACTION) {
- inside_transaction = TRUE;
+ inside_transaction = TRUE;
}
else if (cmd->type == PLANNER_CMD_TYPE_BEGIN_TRANSACTION) {
- inside_transaction = FALSE;
+ inside_transaction = FALSE;
num++;
}
else if (!inside_transaction) {
num++;
}
-
+
if (cmd->type != PLANNER_CMD_TYPE_BEGIN_TRANSACTION && num > priv->limit) {
break;
}
@@ -343,18 +343,18 @@ cmd_manager_insert (PlannerCmdManager *manager,
}
cmd_manager_ensure_limit (manager);
-
+
priv->list = g_list_prepend (priv->list, cmd);
priv->current = priv->list;
cmd->manager = manager;
-
+
if (run_do && cmd->do_func) {
retval = cmd->do_func (cmd);
} else {
retval = TRUE;
}
-
+
cmd_manager_dump (manager);
state_changed (manager);
@@ -390,7 +390,7 @@ planner_cmd_manager_undo (PlannerCmdManager *manager)
if (cmd->undo_func) {
cmd->undo_func (cmd);
}
-
+
cmd_manager_dump (manager);
state_changed (manager);
@@ -421,7 +421,7 @@ planner_cmd_manager_redo (PlannerCmdManager *manager)
if (cmd->do_func) {
cmd->do_func (cmd);
}
-
+
cmd_manager_dump (manager);
state_changed (manager);
@@ -435,7 +435,7 @@ planner_cmd_manager_new (void)
PlannerCmdManager *manager;
manager = g_object_new (PLANNER_TYPE_CMD_MANAGER, NULL);
-
+
return manager;
}
@@ -452,14 +452,14 @@ static gboolean
transaction_cmd_do (PlannerCmd *cmd)
{
PlannerCmd *cmd_sub;
-
+
while (1) {
cmd_sub = get_redo_cmd (cmd->manager, TRUE);
if (!cmd_sub) {
break;
}
-
+
if (cmd_sub->type == PLANNER_CMD_TYPE_END_TRANSACTION) {
break;
}
@@ -467,12 +467,12 @@ transaction_cmd_do (PlannerCmd *cmd)
if (cmd_sub->do_func) {
cmd_sub->do_func (cmd_sub);
}
-
+
g_assert (cmd_sub->type == PLANNER_CMD_TYPE_NORMAL);
}
/* FIXME: need to make sure we handle transactions that doesn't work. */
-
+
return TRUE;
}
@@ -487,7 +487,7 @@ transaction_cmd_undo (PlannerCmd *cmd)
if (!cmd_sub) {
break;
}
-
+
if (cmd_sub->type == PLANNER_CMD_TYPE_BEGIN_TRANSACTION) {
break;
}
@@ -495,7 +495,7 @@ transaction_cmd_undo (PlannerCmd *cmd)
if (cmd_sub->undo_func) {
cmd_sub->undo_func (cmd_sub);
}
-
+
g_assert (cmd_sub->type == PLANNER_CMD_TYPE_NORMAL);
}
}
@@ -506,11 +506,11 @@ planner_cmd_manager_begin_transaction (PlannerCmdManager *manager,
{
PlannerCmdManagerPriv *priv;
PlannerCmd *cmd;
-
+
g_return_val_if_fail (PLANNER_IS_CMD_MANAGER (manager), FALSE);
priv = manager->priv;
-
+
if (priv->inside_transaction) {
g_warning ("Already inside transaction.");
return FALSE;
@@ -525,9 +525,9 @@ planner_cmd_manager_begin_transaction (PlannerCmdManager *manager,
NULL);
cmd->type = PLANNER_CMD_TYPE_BEGIN_TRANSACTION;
-
+
cmd_manager_insert (manager, cmd, FALSE);
-
+
return TRUE;
}
@@ -541,7 +541,7 @@ planner_cmd_manager_end_transaction (PlannerCmdManager *manager)
g_return_val_if_fail (PLANNER_IS_CMD_MANAGER (manager), FALSE);
priv = manager->priv;
-
+
if (!priv->inside_transaction) {
g_warning ("Don't have transaction to end.");
return FALSE;
@@ -567,9 +567,9 @@ planner_cmd_manager_end_transaction (PlannerCmdManager *manager)
transaction_cmd_do,
transaction_cmd_undo,
NULL);
-
+
cmd->type = PLANNER_CMD_TYPE_END_TRANSACTION;
-
+
cmd_manager_insert (manager, cmd, FALSE);
priv->inside_transaction = FALSE;
diff --git a/src/planner-cmd-manager.h b/src/planner-cmd-manager.h
index b89599a..8952692 100644
--- a/src/planner-cmd-manager.h
+++ b/src/planner-cmd-manager.h
@@ -58,9 +58,9 @@ typedef enum {
struct _PlannerCmd {
gchar *name;
-
+
PlannerCmdManager *manager;
-
+
PlannerCmdDoFunc do_func;
PlannerCmdUndoFunc undo_func;
PlannerCmdFreeFunc free_func;
diff --git a/src/planner-column-dialog.c b/src/planner-column-dialog.c
index f941057..4482eda 100644
--- a/src/planner-column-dialog.c
+++ b/src/planner-column-dialog.c
@@ -29,7 +29,7 @@ typedef struct {
PlannerWindow *main_window;
GtkTreeView *edited_tree;
-
+
GtkWidget *dialog;
GtkWidget *visible_tree;
GtkWidget *hidden_tree;
@@ -89,7 +89,7 @@ column_dialog_update_sensitivity (DialogData *data)
model = gtk_tree_view_get_model (GTK_TREE_VIEW (data->visible_tree));
num_rows = gtk_tree_model_iter_n_children (model, NULL);
-
+
if (indices[0] < num_rows - 1) {
down_sensitive = TRUE;
}
@@ -106,7 +106,7 @@ column_dialog_update_sensitivity (DialogData *data)
if (path) {
gtk_tree_path_free (path);
}
-
+
gtk_widget_set_sensitive (data->up_button, visible_sensitive && up_sensitive);
gtk_widget_set_sensitive (data->down_button, visible_sensitive && down_sensitive);
gtk_widget_set_sensitive (data->hide_button, visible_sensitive && hide_sensitive);
@@ -149,19 +149,19 @@ column_dialog_set_selected_column (DialogData *data,
tree = GTK_TREE_VIEW (data->visible_tree);
} else {
tree = GTK_TREE_VIEW (data->hidden_tree);
- }
+ }
model = gtk_tree_view_get_model (tree);
found = FALSE;
-
+
if (gtk_tree_model_get_iter_first (model, &iter)) {
GtkTreeViewColumn *tmp;
-
+
do {
gtk_tree_model_get (model, &iter,
0, &tmp,
-1);
-
+
if (tmp == column) {
found = TRUE;
break;
@@ -182,7 +182,7 @@ column_dialog_get_next_visible_column (DialogData *data, GtkTreeViewColumn *colu
GtkTreeViewColumn *next = NULL;
columns = gtk_tree_view_get_columns (data->edited_tree);
-
+
for (l = columns; l; l = l->next) {
if (l->data == column) {
l = l->next;
@@ -210,7 +210,7 @@ column_dialog_get_prev_visible_column (DialogData *data, GtkTreeViewColumn *colu
GtkTreeViewColumn *prev = NULL;
columns = gtk_tree_view_get_columns (data->edited_tree);
-
+
for (l = columns; l; l = l->next) {
if (l->data == column) {
l = l->prev;
@@ -237,7 +237,7 @@ column_dialog_down_button_clicked_cb (GtkWidget *button,
{
GtkTreeViewColumn *column;
GtkTreeViewColumn *base_column;
-
+
column = column_dialog_get_selected_column (
data, GTK_TREE_VIEW (data->visible_tree));
@@ -251,7 +251,7 @@ column_dialog_down_button_clicked_cb (GtkWidget *button,
column,
base_column);
}
-
+
/* Note: We should probalby not be lazy here and reorder the rows
* instead.
*/
@@ -261,12 +261,12 @@ column_dialog_down_button_clicked_cb (GtkWidget *button,
}
static void
-column_dialog_up_button_clicked_cb (GtkWidget *button,
+column_dialog_up_button_clicked_cb (GtkWidget *button,
DialogData *data)
{
GtkTreeViewColumn *column;
GtkTreeViewColumn *base_column;
-
+
column = column_dialog_get_selected_column (
data, GTK_TREE_VIEW (data->visible_tree));
@@ -292,7 +292,7 @@ column_dialog_up_button_clicked_cb (GtkWidget *button,
}
static void
-column_dialog_hide_button_clicked_cb (GtkWidget *button,
+column_dialog_hide_button_clicked_cb (GtkWidget *button,
DialogData *data)
{
GtkTreeViewColumn *column;
@@ -308,7 +308,7 @@ column_dialog_hide_button_clicked_cb (GtkWidget *button,
/* This is only emitted when columns are reordered, so we do it here. */
g_signal_emit_by_name (data->edited_tree, "columns-changed");
-
+
/* Note: We should probalby not be lazy here and reorder the rows
* instead.
*/
@@ -318,7 +318,7 @@ column_dialog_hide_button_clicked_cb (GtkWidget *button,
}
static void
-column_dialog_show_button_clicked_cb (GtkWidget *button,
+column_dialog_show_button_clicked_cb (GtkWidget *button,
DialogData *data)
{
GtkTreeViewColumn *column;
@@ -344,7 +344,7 @@ column_dialog_show_button_clicked_cb (GtkWidget *button,
}
static void
-column_dialog_cursor_changed_cb (GtkTreeView *tree,
+column_dialog_cursor_changed_cb (GtkTreeView *tree,
DialogData *data)
{
column_dialog_update_sensitivity (data);
@@ -356,7 +356,7 @@ column_dialog_focus_in_event_cb (GtkTreeView *tree,
DialogData *data)
{
column_dialog_update_sensitivity (data);
-
+
return FALSE;
}
@@ -379,7 +379,7 @@ column_dialog_label_cell_data_func (GtkTreeViewColumn *tree_column,
*/
str = g_strdup (gtk_tree_view_column_get_title (column));
label = g_strstrip (str);
-
+
g_object_set (cell,
"text", label,
NULL);
@@ -410,7 +410,7 @@ column_dialog_setup_tree (DialogData *data, GtkTreeView *tree)
cell = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (NULL, cell, NULL);
gtk_tree_view_column_set_cell_data_func (col,
- cell,
+ cell,
column_dialog_label_cell_data_func,
data,
NULL);
@@ -434,7 +434,7 @@ column_dialog_fill_trees (DialogData *data)
gtk_list_store_clear (visible_store);
columns = gtk_tree_view_get_columns (data->edited_tree);
-
+
for (l = columns; l; l = l->next) {
GtkTreeViewColumn *column;
@@ -443,7 +443,7 @@ column_dialog_fill_trees (DialogData *data)
if (g_object_get_data (G_OBJECT (column), "custom")) {
continue;
}
-
+
if (gtk_tree_view_column_get_visible (column)) {
gtk_list_store_append (visible_store, &iter);
gtk_list_store_set (visible_store,
@@ -458,7 +458,7 @@ column_dialog_fill_trees (DialogData *data)
-1);
}
}
-
+
g_list_free (columns);
}
@@ -478,21 +478,21 @@ planner_column_dialog_show (PlannerWindow *window,
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);
-
+
if (!glade) {
g_warning ("Could not create column dialog.");
return;
}
-
+
data = g_new0 (DialogData, 1);
data->main_window = window;
data->edited_tree = edited_tree;
-
+
data->dialog = glade_xml_get_widget (glade, "column_dialog");
gtk_window_set_title (GTK_WINDOW (data->dialog), title);
@@ -506,7 +506,7 @@ planner_column_dialog_show (PlannerWindow *window,
data->down_button = glade_xml_get_widget (glade, "down_button");
data->show_button = glade_xml_get_widget (glade, "show_button");
data->hide_button = glade_xml_get_widget (glade, "hide_button");
-
+
column_dialog_setup_tree (data, GTK_TREE_VIEW (data->hidden_tree));
column_dialog_setup_tree (data, GTK_TREE_VIEW (data->visible_tree));
@@ -520,7 +520,7 @@ planner_column_dialog_show (PlannerWindow *window,
"focus-in-event",
G_CALLBACK (column_dialog_focus_in_event_cb),
data);
-
+
g_signal_connect (data->up_button,
"clicked",
G_CALLBACK (column_dialog_up_button_clicked_cb),
@@ -547,10 +547,10 @@ planner_column_dialog_show (PlannerWindow *window,
g_object_set_data_full (G_OBJECT (data->dialog),
"data", data,
g_free);
-
+
column_dialog_update_sensitivity (data);
gtk_widget_show (data->dialog);
-
+
g_object_unref (glade);
}
diff --git a/src/planner-conf-gconf.c b/src/planner-conf-gconf.c
index 169600f..1b2ce0c 100644
--- a/src/planner-conf-gconf.c
+++ b/src/planner-conf-gconf.c
@@ -46,7 +46,7 @@ conf_get_key (const gchar *key)
return g_strconcat (GCONF_PREFIX, key, NULL);
}
-gboolean
+gboolean
planner_conf_dir_exists (const gchar *dir, GError **error)
{
GConfClient *client;
@@ -54,7 +54,7 @@ planner_conf_dir_exists (const gchar *dir, GError **error)
gboolean ret_val;
client = conf_get_gconf_client ();
-
+
full_dir = conf_get_key (dir);
ret_val = gconf_client_dir_exists (client, full_dir, error);
g_free (full_dir);
@@ -62,7 +62,7 @@ planner_conf_dir_exists (const gchar *dir, GError **error)
return ret_val;
}
-gboolean
+gboolean
planner_conf_get_bool (const gchar *key, GError **error)
{
GConfClient *client;
@@ -70,7 +70,7 @@ planner_conf_get_bool (const gchar *key, GError **error)
gboolean ret_val;
client = conf_get_gconf_client ();
-
+
full_key = conf_get_key (key);
ret_val = gconf_client_get_bool (client, full_key, error);
g_free (full_key);
@@ -86,7 +86,7 @@ planner_conf_get_string (const gchar *key, GError **error)
gchar *ret_val;
client = conf_get_gconf_client ();
-
+
full_key = conf_get_key (key);
ret_val = gconf_client_get_string (client, full_key, error);
g_free (full_key);
@@ -102,7 +102,7 @@ planner_conf_get_int (const gchar *key, GError **error)
gint ret_val;
client = conf_get_gconf_client ();
-
+
full_key = conf_get_key (key);
ret_val = gconf_client_get_int (client, full_key, error);
g_free (full_key);
@@ -110,7 +110,7 @@ planner_conf_get_int (const gchar *key, GError **error)
return ret_val;
}
-gboolean
+gboolean
planner_conf_set_bool (const gchar *key, gboolean value, GError **error)
{
GConfClient *client;
@@ -134,7 +134,7 @@ planner_conf_set_string (const gchar *key, const gchar *value, GError **error)
gboolean ret_val;
client = conf_get_gconf_client ();
-
+
full_key = conf_get_key (key);
ret_val = gconf_client_set_string (client, full_key, value, error);
g_free (full_key);
@@ -150,7 +150,7 @@ planner_conf_set_int (const gchar *key, gint value, GError **error)
gboolean ret_val;
client = conf_get_gconf_client ();
-
+
full_key = conf_get_key (key);
ret_val = gconf_client_set_int (client, full_key, value, error);
g_free (full_key);
diff --git a/src/planner-conf-win32.c b/src/planner-conf-win32.c
index 3933dd8..280898d 100644
--- a/src/planner-conf-win32.c
+++ b/src/planner-conf-win32.c
@@ -32,10 +32,10 @@ planner_conf_dir_exists (const gchar *dir, GError **error)
{
gboolean ret_val;
HKEY hKey;
-
+
ret_val = RegOpenKeyEx (HKEY_CURRENT_USER, WIN32_KEYNAME, 0, KEY_READ, &hKey);
RegCloseKey (hKey);
-
+
return ret_val == ERROR_SUCCESS;
}
@@ -44,7 +44,7 @@ static gboolean planner_conf_create()
gboolean ret_val;
DWORD disp = 0;
HKEY hKey;
-
+
ret_val = RegOpenKeyEx (HKEY_CURRENT_USER, WIN32_KEYNAME, 0, KEY_READ, &hKey);
RegCloseKey (hKey);
if(ret_val == ERROR_SUCCESS)
@@ -66,7 +66,7 @@ planner_conf_get_bool (const gchar *key, GError **error)
gchar *keyBuffer;
glong keyLen;
HKEY hKey;
-
+
RegOpenKeyEx (HKEY_CURRENT_USER, WIN32_KEYNAME, 0, KEY_READ, &hKey);
if (RegQueryValueEx (hKey, key, 0, NULL, NULL, &keyLen) == ERROR_SUCCESS) {
keyBuffer = g_malloc (keyLen + 1);
@@ -109,11 +109,11 @@ planner_conf_get_int (const gchar *key, GError **error)
if(RegQueryValueEx (hKey, key, 0, NULL, NULL, &keyLen) == ERROR_SUCCESS) {
keyBuffer = g_malloc (keyLen + 1);
RegQueryValueEx (hKey, key, 0, NULL, keyBuffer, &keyLen);
-
+
ret_val = g_ascii_strtoull (keyBuffer, NULL, 10);
-
+
g_free (keyBuffer);
-
+
RegCloseKey (hKey);
}
diff --git a/src/planner-conf.h b/src/planner-conf.h
index 99011de..d06535f 100644
--- a/src/planner-conf.h
+++ b/src/planner-conf.h
@@ -24,7 +24,7 @@
gboolean planner_conf_dir_exists (const gchar *dir,
GError **error);
gboolean planner_conf_get_bool (const gchar *key,
- GError **error);
+ GError **error);
gchar * planner_conf_get_string (const gchar *key,
GError **error);
gint planner_conf_get_int (const gchar *key,
diff --git a/src/planner-day-type-dialog.c b/src/planner-day-type-dialog.c
index aff0abc..520a3d4 100644
--- a/src/planner-day-type-dialog.c
+++ b/src/planner-day-type-dialog.c
@@ -62,7 +62,7 @@ typedef struct {
PlannerCmd base;
MrpProject *project;
-
+
gchar *name;
MrpDay *day;
} DayTypeCmdAdd;
@@ -120,7 +120,7 @@ day_type_dialog_response_cb (GtkWidget *dialog,
case RESPONSE_ADD:
day_type_dialog_new_dialog_run (data);
break;
-
+
case RESPONSE_CLOSE:
gtk_widget_destroy (data->dialog);
break;
@@ -150,22 +150,22 @@ planner_day_type_dialog_new (PlannerWindow *window)
GtkTreeViewColumn *col;
GtkTreeSelection *selection;
gchar *filename;
-
+
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
-
+
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;
}
dialog = glade_xml_get_widget (glade, "day_type_dialog");
-
+
data = g_new0 (DialogData, 1);
data->main_window = window;
@@ -177,7 +177,7 @@ planner_day_type_dialog_new (PlannerWindow *window)
G_CALLBACK (day_type_dialog_parent_destroy_cb),
dialog,
0);
-
+
data->tree_view = glade_xml_get_widget (glade, "treeview");
data->remove_button = glade_xml_get_widget (glade, "remove_button");
@@ -194,7 +194,7 @@ planner_day_type_dialog_new (PlannerWindow *window)
0);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->tree_view));
-
+
g_signal_connect (selection,
"changed",
G_CALLBACK (day_type_dialog_selection_changed_cb),
@@ -203,12 +203,12 @@ planner_day_type_dialog_new (PlannerWindow *window)
g_object_set_data_full (G_OBJECT (dialog),
"data", data,
g_free);
-
+
model = day_type_dialog_create_model (data);
gtk_tree_view_set_model (GTK_TREE_VIEW (data->tree_view), model);
day_type_dialog_build_list (data);
-
+
cell = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (
NULL,
@@ -216,7 +216,7 @@ planner_day_type_dialog_new (PlannerWindow *window)
"text", COL_NAME,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (data->tree_view), col);
-
+
g_signal_connect (dialog,
"response",
G_CALLBACK (day_type_dialog_response_cb),
@@ -231,14 +231,14 @@ day_type_dialog_selection_changed_cb (GtkTreeSelection *selection,
{
MrpDay *day;
gboolean sensitive = FALSE;
-
+
day = day_type_dialog_get_selected_day (data);
-
+
if (day != NULL && day != mrp_day_get_work () &&
day != mrp_day_get_nonwork () && day != mrp_day_get_use_base ()) {
sensitive = TRUE;
}
-
+
gtk_widget_set_sensitive (data->remove_button, sensitive);
}
@@ -250,11 +250,11 @@ day_type_dialog_build_list (DialogData *data)
GList *days, *l;
MrpDay *day;
const gchar *name;
-
+
store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (data->tree_view)));
gtk_list_store_clear (store);
-
+
day = mrp_day_get_nonwork ();
name = mrp_day_get_name (day);
@@ -277,9 +277,9 @@ day_type_dialog_build_list (DialogData *data)
days = mrp_day_get_all (data->project);
for (l = days; l; l = l->next) {
day = l->data;
-
+
name = mrp_day_get_name (day);
-
+
gtk_list_store_append (store, &iter);
gtk_list_store_set (store,
&iter,
@@ -293,7 +293,7 @@ static GtkTreeModel *
day_type_dialog_create_model (DialogData *data)
{
GtkListStore *store;
-
+
store = gtk_list_store_new (NUM_COLS,
G_TYPE_STRING,
G_TYPE_INT,
@@ -351,7 +351,7 @@ day_type_dialog_find_day_foreach (GtkTreeModel *model,
data->found_iter = *iter;
return TRUE;
}
-
+
return FALSE;
}
@@ -388,7 +388,7 @@ day_type_dialog_get_selected_day (DialogData *data)
GtkTreeModel *model;
GtkTreeIter iter;
MrpDay *day;
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->tree_view));
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
@@ -411,7 +411,7 @@ day_type_dialog_new_name_changed_cb (GtkEntry *entry,
gboolean sensitive;
name = gtk_entry_get_text (entry);
-
+
sensitive = name[0] != 0;
gtk_widget_set_sensitive (button, sensitive);
}
@@ -473,7 +473,7 @@ day_type_cmd_add_undo (PlannerCmd *cmd_base)
DayTypeCmdAdd *cmd;
cmd = (DayTypeCmdAdd *) cmd_base;
-
+
mrp_day_remove (cmd->project, cmd->day);
cmd->day = NULL;
}
@@ -535,7 +535,7 @@ day_type_cmd_remove_undo (PlannerCmd *cmd_base)
DayTypeCmdRemove *cmd;
cmd = (DayTypeCmdRemove *) cmd_base;
-
+
cmd->day = mrp_day_add (cmd->project, cmd->name, "");
}
@@ -576,6 +576,6 @@ day_type_cmd_remove (DialogData *data,
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (data->main_window),
cmd_base);
-
+
return cmd_base;
}
diff --git a/src/planner-default-week-dialog.c b/src/planner-default-week-dialog.c
index 5b44311..aa5ac18 100644
--- a/src/planner-default-week-dialog.c
+++ b/src/planner-default-week-dialog.c
@@ -117,14 +117,14 @@ default_week_dialog_response_cb (GtkWidget *dialog,
{
MrpDay *day;
gint weekday;
-
+
switch (response) {
case RESPONSE_APPLY:
weekday = default_week_dialog_get_selected_weekday (data);
day = default_week_dialog_get_selected_day (data);
default_week_cmd_edit (data, weekday, day);
-
+
/* mrp_calendar_set_default_days (data->calendar,
weekday, day,
-1);
@@ -159,23 +159,23 @@ planner_default_week_dialog_new (PlannerWindow *window,
GtkWidget *w;
gint i;
gchar *filename;
-
+
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
-
+
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;
}
dialog = glade_xml_get_widget (glade, "default_week_dialog");
-
+
data = g_new0 (DialogData, 1);
data->main_window = window;
@@ -188,15 +188,15 @@ planner_default_week_dialog_new (PlannerWindow *window,
G_CALLBACK (default_week_dialog_parent_destroy_cb),
dialog,
0);
-
+
/* Get the from/to labels. */
for (i = 0; i < 5; i++) {
gchar *tmp;
-
+
tmp = g_strdup_printf ("from%d_label", i + 1);
data->from_label[i] = glade_xml_get_widget (glade, tmp);
g_free (tmp);
-
+
tmp = g_strdup_printf ("to%d_label", i + 1);
data->to_label[i] = glade_xml_get_widget (glade, tmp);
g_free (tmp);
@@ -208,7 +208,7 @@ planner_default_week_dialog_new (PlannerWindow *window,
w = glade_xml_get_widget (glade, "name_label");
gtk_label_set_text (GTK_LABEL (w), mrp_calendar_get_name (calendar));
-
+
data->weekday_option_menu = glade_xml_get_widget (glade, "weekday_optionmenu");
data->day_option_menu = glade_xml_get_widget (glade, "day_optionmenu");
@@ -238,7 +238,7 @@ planner_default_week_dialog_new (PlannerWindow *window,
g_free);
default_week_dialog_update_labels (data);
-
+
return dialog;
}
@@ -260,13 +260,13 @@ default_week_dialog_update_labels (DialogData *data)
if (day == mrp_day_get_use_base ()) {
MrpCalendar *parent;
gint weekday;
-
+
parent = mrp_calendar_get_parent (data->calendar);
if (parent) {
weekday = default_week_dialog_get_selected_weekday (data);
-
+
day = mrp_calendar_get_default_day (parent, weekday);
-
+
ivals = mrp_calendar_day_get_intervals (parent, day, TRUE);
} else {
ivals = NULL;
@@ -289,13 +289,13 @@ default_week_dialog_update_labels (DialogData *data)
gtk_label_set_markup (GTK_LABEL (data->from_label[0]), tmp);
g_free (tmp);
}
-
+
i = 0;
for (l = ivals; l; l = l->next) {
ival = l->data;
-
+
mrp_interval_get_absolute (ival, 0, &start, &end);
-
+
str = mrp_time_format (_("%H:%M"), start);
gtk_label_set_text (GTK_LABEL (data->from_label[i]), str);
g_free (str);
@@ -311,7 +311,7 @@ default_week_dialog_update_labels (DialogData *data)
}
}
}
-
+
static void
default_week_dialog_weekday_selected_cb (GtkOptionMenu *option_menu,
DialogData *data)
@@ -321,7 +321,7 @@ default_week_dialog_weekday_selected_cb (GtkOptionMenu *option_menu,
weekday = default_week_dialog_get_selected_weekday (data);
day = mrp_calendar_get_default_day (data->calendar, weekday);
-
+
default_week_dialog_set_selected_day (data, day);
default_week_dialog_update_labels (data);
@@ -333,7 +333,7 @@ default_week_dialog_day_selected_cb (GtkOptionMenu *option_menu,
{
default_week_dialog_update_labels (data);
}
-
+
static void
default_week_dialog_setup_day_option_menu (GtkOptionMenu *option_menu,
MrpProject *project,
@@ -353,7 +353,7 @@ default_week_dialog_setup_day_option_menu (GtkOptionMenu *option_menu,
parent = mrp_calendar_get_parent (calendar);
root = mrp_project_get_root_calendar (project);
-
+
menu = gtk_option_menu_get_menu (option_menu);
if (menu) {
@@ -375,7 +375,7 @@ default_week_dialog_setup_day_option_menu (GtkOptionMenu *option_menu,
if (parent == root && day == mrp_day_get_use_base ()) {
gtk_widget_set_sensitive (menu_item, FALSE);
}
-
+
g_object_set_data (G_OBJECT (menu_item),
"data",
l->data);
@@ -394,7 +394,7 @@ default_week_dialog_get_selected_weekday (DialogData *data)
GtkWidget *menu;
GtkWidget *item;
gint id;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (data->weekday_option_menu));
item = gtk_menu_get_active (GTK_MENU (menu));
@@ -410,7 +410,7 @@ default_week_dialog_setup_weekday_option_menu (GtkOptionMenu *option_menu)
GtkWidget *menu;
GtkWidget *menu_item;
gint i;
-
+
menu = gtk_option_menu_get_menu (option_menu);
if (menu) {
gtk_widget_destroy (menu);
@@ -423,7 +423,7 @@ default_week_dialog_setup_weekday_option_menu (GtkOptionMenu *option_menu)
gtk_widget_show (menu_item);
gtk_menu_append (GTK_MENU (menu), menu_item);
-
+
g_object_set_data (G_OBJECT (menu_item),
"data",
GINT_TO_POINTER (days[i].day));
@@ -438,7 +438,7 @@ default_week_dialog_get_selected_day (DialogData *data)
{
GtkWidget *menu;
GtkWidget *item;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (data->day_option_menu));
item = gtk_menu_get_active (GTK_MENU (menu));
@@ -454,7 +454,7 @@ default_week_dialog_set_selected_day (DialogData *data,
GtkWidget *item;
GList *children, *l;
gint i;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (data->day_option_menu));
children = GTK_MENU_SHELL (menu)->children;
@@ -506,11 +506,11 @@ default_week_cmd_edit_do (PlannerCmd *cmd_base)
} else {
day = mrp_project_get_calendar_day_by_id (cmd->project, cmd->day_id);
}
-
+
mrp_calendar_set_default_days (cmd->calendar,
cmd->weekday, day,
-1);
-
+
return TRUE;
}
@@ -566,9 +566,9 @@ default_week_cmd_edit (DialogData *data,
} else {
cmd->day_id = mrp_day_get_id (day);
}
-
+
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (data->main_window),
cmd_base);
-
+
return cmd_base;
}
diff --git a/src/planner-eds-plugin.c b/src/planner-eds-plugin.c
index 907ffa3..777f945 100644
--- a/src/planner-eds-plugin.c
+++ b/src/planner-eds-plugin.c
@@ -19,12 +19,12 @@
*
* TODO:
*
- * - Caching answers issues
+ * - Caching answers issues
*/
#include <config.h>
-#include <glib.h>
-#include <glib/gi18n.h>
+#include <glib.h>
+#include <glib/gi18n.h>
#include <string.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkkeysyms.h>
@@ -127,9 +127,9 @@ static gboolean eds_search_key_pressed (GtkEntry *entry,
PlannerPlugin *plugin);
static void eds_column_clicked (GtkTreeViewColumn *treeviewcolumn,
PlannerPlugin *plugin);
-static void eds_group_selected (GtkComboBox *select_group,
+static void eds_group_selected (GtkComboBox *select_group,
PlannerPlugin *plugin);
-static void eds_resource_selected (GtkCellRendererToggle *toggle,
+static void eds_resource_selected (GtkCellRendererToggle *toggle,
const gchar *path_str,
PlannerPlugin *plugin);
static void eds_import_resource (gchar *name,
@@ -141,15 +141,15 @@ static MrpResource * eds_find_resource (PlannerPlugin *plugin,
const gchar *uid,
GList *resources_orig);
static gboolean eds_create_uid_property (PlannerPlugin *plugin);
-static void eds_load_resources (ESourceGroup *group,
+static void eds_load_resources (ESourceGroup *group,
PlannerPlugin *plugin,
const gchar *search);
-static void eds_receive_contacts_cb (EBook *book,
- EBookStatus status,
- GList *contacts,
+static void eds_receive_contacts_cb (EBook *book,
+ EBookStatus status,
+ GList *contacts,
gpointer plugin);
-static void eds_receive_book_cb (EBook *book,
- EBookStatus status,
+static void eds_receive_book_cb (EBook *book,
+ EBookStatus status,
gpointer user_data);
static void eds_plugin_busy (PlannerPlugin *plugin,
gboolean busy);
@@ -175,7 +175,7 @@ gboolean eds_check_query (gpointer data)
{
PlannerPlugin *plugin = data;
- GtkProgressBar *progress = GTK_PROGRESS_BAR (glade_xml_get_widget
+ GtkProgressBar *progress = GTK_PROGRESS_BAR (glade_xml_get_widget
(plugin->priv->glade, "progressbar"));
gtk_progress_bar_pulse (progress);
@@ -184,11 +184,11 @@ gboolean eds_check_query (gpointer data)
}
static void
-eds_plugin_busy (PlannerPlugin *plugin,
+eds_plugin_busy (PlannerPlugin *plugin,
gboolean busy)
{
GdkCursor *cursor;
- GtkProgressBar *progress = GTK_PROGRESS_BAR (glade_xml_get_widget
+ GtkProgressBar *progress = GTK_PROGRESS_BAR (glade_xml_get_widget
(plugin->priv->glade, "progressbar"));
if (busy) {
@@ -199,26 +199,26 @@ eds_plugin_busy (PlannerPlugin *plugin,
}
plugin->priv->pulse = g_timeout_add (check_time, eds_check_query, plugin);
cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_WATCH);
- gtk_widget_set_sensitive
+ gtk_widget_set_sensitive
(glade_xml_get_widget (plugin->priv->glade, "search_box"), FALSE);
- gtk_widget_set_sensitive
+ gtk_widget_set_sensitive
(glade_xml_get_widget (plugin->priv->glade, "progress"), TRUE);
plugin->priv->busy = TRUE;
-
+
} else {
g_source_remove (plugin->priv->pulse);
gtk_progress_bar_set_fraction (progress, 0);
- gtk_widget_set_sensitive
+ gtk_widget_set_sensitive
(glade_xml_get_widget (plugin->priv->glade, "progress"), FALSE);
- gtk_widget_set_sensitive
+ gtk_widget_set_sensitive
(glade_xml_get_widget (plugin->priv->glade, "search_box"), TRUE);
cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_LEFT_PTR);
- plugin->priv->busy = FALSE;
+ plugin->priv->busy = FALSE;
}
- gdk_window_set_cursor (gtk_widget_get_parent_window
- (glade_xml_get_widget (plugin->priv->glade, "ok_button")),
+ gdk_window_set_cursor (gtk_widget_get_parent_window
+ (glade_xml_get_widget (plugin->priv->glade, "ok_button")),
cursor);
}
@@ -273,38 +273,38 @@ eds_plugin_import (GtkAction *action,
priv->resources_tree_view = GTK_TREE_VIEW (glade_xml_get_widget (priv->glade,
"resources"));
- g_signal_connect (glade_xml_get_widget (priv->glade, "ok_button"),
+ g_signal_connect (glade_xml_get_widget (priv->glade, "ok_button"),
"clicked",
G_CALLBACK (eds_ok_button_clicked),
- plugin);
- g_signal_connect (glade_xml_get_widget (priv->glade, "cancel_button"),
+ plugin);
+ g_signal_connect (glade_xml_get_widget (priv->glade, "cancel_button"),
"clicked",
G_CALLBACK (eds_cancel_button_clicked),
plugin);
- g_signal_connect (glade_xml_get_widget (priv->glade, "search_button"),
+ g_signal_connect (glade_xml_get_widget (priv->glade, "search_button"),
"clicked",
G_CALLBACK (eds_search_button_clicked),
plugin);
- g_signal_connect (glade_xml_get_widget (priv->glade, "all_button"),
+ g_signal_connect (glade_xml_get_widget (priv->glade, "all_button"),
"clicked",
G_CALLBACK (eds_all_button_clicked),
plugin);
- g_signal_connect (glade_xml_get_widget (priv->glade, "none_button"),
+ g_signal_connect (glade_xml_get_widget (priv->glade, "none_button"),
"clicked",
G_CALLBACK (eds_none_button_clicked),
plugin);
- g_signal_connect (glade_xml_get_widget (priv->glade, "stop_button"),
+ g_signal_connect (glade_xml_get_widget (priv->glade, "stop_button"),
"clicked",
G_CALLBACK (eds_stop_button_clicked),
plugin);
- g_signal_connect (glade_xml_get_widget (priv->glade, "search_entry"),
+ g_signal_connect (glade_xml_get_widget (priv->glade, "search_entry"),
"key-press-event",
G_CALLBACK (eds_search_key_pressed),
plugin);
-
+
gtk_widget_show (priv->dialog_get_resources);
-
+
gconf_client = gconf_client_get_default ();
source_list = e_source_list_new_for_gconf (gconf_client,
"/apps/evolution/addressbook/sources");
@@ -313,9 +313,9 @@ eds_plugin_import (GtkAction *action,
eds_create_groups_model (groups, plugin);
gtk_combo_box_set_model (priv->select_group, priv->groups_model);
renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->select_group),
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->select_group),
renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (priv->select_group),
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (priv->select_group),
renderer, "text", 0, NULL);
/* g_object_unref (source_list); */
}
@@ -328,7 +328,7 @@ eds_create_groups_model (GSList *groups,
GtkTreeIter iter;
GSList *sl;
const gchar *name;
-
+
if (groups == NULL) {
return;
}
@@ -338,8 +338,8 @@ eds_create_groups_model (GSList *groups,
for (sl = groups; sl; sl = sl->next) {
name = e_source_group_peek_name (sl->data);
gtk_list_store_append (model, &iter);
- gtk_list_store_set (model, &iter,
- COL_GROUP_NAME, name,
+ gtk_list_store_set (model, &iter,
+ COL_GROUP_NAME, name,
COL_GROUP_OBJECT, sl->data, -1);
}
plugin->priv->groups_model = GTK_TREE_MODEL (model);
@@ -347,8 +347,8 @@ eds_create_groups_model (GSList *groups,
/* For now we show all the sources from a group in a List.
Later we will us a Tree to show them usings groups. */
-static void
-eds_load_resources (ESourceGroup *group,
+static void
+eds_load_resources (ESourceGroup *group,
PlannerPlugin *plugin,
const gchar *search)
{
@@ -366,7 +366,7 @@ eds_load_resources (ESourceGroup *group,
if (model) {
gtk_list_store_clear (model);
}
- gtk_widget_set_sensitive (glade_xml_get_widget (priv->glade,
+ gtk_widget_set_sensitive (glade_xml_get_widget (priv->glade,
"search_box"), FALSE);
return;
}
@@ -378,12 +378,12 @@ eds_load_resources (ESourceGroup *group,
guint column_pos;
GtkTreeViewColumn *column;
- model = gtk_list_store_new (NUM_RESOURCE_COLS,
+ model = gtk_list_store_new (NUM_RESOURCE_COLS,
G_TYPE_STRING, /* name */
G_TYPE_STRING, /* email */
G_TYPE_BOOLEAN, /* import */
GDK_TYPE_PIXBUF, /* photo */
- G_TYPE_OBJECT); /* full contact */
+ G_TYPE_OBJECT); /* full contact */
priv->resources_model = GTK_TREE_MODEL (model);
@@ -391,7 +391,7 @@ eds_load_resources (ESourceGroup *group,
priv->resources_model);
/* Name Column with sorting features */
- column_pos = gtk_tree_view_insert_column_with_attributes
+ column_pos = gtk_tree_view_insert_column_with_attributes
(priv->resources_tree_view,
-1, _("Name"),
gtk_cell_renderer_text_new (), "text", COL_RESOURCE_NAME,
@@ -404,14 +404,14 @@ eds_load_resources (ESourceGroup *group,
GINT_TO_POINTER (column_pos-1),
NULL);
gtk_tree_view_column_set_sort_column_id (column, column_pos-1);
- g_signal_connect (gtk_tree_view_get_column
- (priv->resources_tree_view, column_pos-1),
+ g_signal_connect (gtk_tree_view_get_column
+ (priv->resources_tree_view, column_pos-1),
"clicked",
G_CALLBACK (eds_column_clicked),
plugin);
/* Email column with sorting features */
- column_pos = gtk_tree_view_insert_column_with_attributes
+ column_pos = gtk_tree_view_insert_column_with_attributes
(priv->resources_tree_view,
-1, _("Email"),
gtk_cell_renderer_text_new (), "text", COL_RESOURCE_EMAIL,
@@ -424,15 +424,15 @@ eds_load_resources (ESourceGroup *group,
GINT_TO_POINTER (column_pos-1),
NULL);
gtk_tree_view_column_set_sort_column_id (column, column_pos-1);
- g_signal_connect (gtk_tree_view_get_column
- (priv->resources_tree_view, column_pos-1),
+ g_signal_connect (gtk_tree_view_get_column
+ (priv->resources_tree_view, column_pos-1),
"clicked",
G_CALLBACK (eds_column_clicked),
plugin);
-
+
/* Import */
- toggle = gtk_cell_renderer_toggle_new ();
- gtk_tree_view_insert_column_with_attributes
+ toggle = gtk_cell_renderer_toggle_new ();
+ gtk_tree_view_insert_column_with_attributes
(priv->resources_tree_view,
-1, _("Import"),
toggle, "active", COL_RESOURCE_SELECTED,
@@ -442,7 +442,7 @@ eds_load_resources (ESourceGroup *group,
plugin);
/* Photo */
- gtk_tree_view_insert_column_with_attributes
+ gtk_tree_view_insert_column_with_attributes
(priv->resources_tree_view,
-1, _("Photo"),
gtk_cell_renderer_pixbuf_new (), "pixbuf", COL_RESOURCE_PHOTO,
@@ -477,21 +477,21 @@ eds_query_cancelled (PlannerPlugin *plugin,
for (l = plugin->priv->queries_cancelled; l; l = l->next) {
if (!strcmp (uid, l->data)) {
- g_message ("Received answer from a cancelled query: %s (%s)",
+ g_message ("Received answer from a cancelled query: %s (%s)",
(gchar *) l->data, uid);
/* We can receive several answer for a cancelled query
so we must preserver the list */
- /* plugin->priv->queries_cancelled = g_list_remove
+ /* plugin->priv->queries_cancelled = g_list_remove
(plugin->priv->queries_cancelled, l->data); */
return TRUE;
}
}
return FALSE;
}
-
-static void
-eds_receive_book_cb (EBook *client,
- EBookStatus status,
+
+static void
+eds_receive_book_cb (EBook *client,
+ EBookStatus status,
gpointer user_data)
{
PlannerPlugin *plugin;
@@ -515,17 +515,17 @@ eds_receive_book_cb (EBook *client,
if (eds_query_cancelled (plugin, uid)) {
g_message ("Open book query cancelled: %s (%s)", book_uri, uid);
- gtk_widget_set_sensitive (glade_xml_get_widget (plugin->priv->glade,
+ gtk_widget_set_sensitive (glade_xml_get_widget (plugin->priv->glade,
"search_box"), TRUE);
eds_plugin_busy (plugin, FALSE);
- return;
+ return;
}
if (status != E_BOOK_ERROR_OK) {
g_warning ("Problems opening: %s", book_uri);
- gtk_widget_set_sensitive (glade_xml_get_widget (plugin->priv->glade,
+ gtk_widget_set_sensitive (glade_xml_get_widget (plugin->priv->glade,
"search_box"), TRUE);
- eds_plugin_busy (plugin, FALSE);
+ eds_plugin_busy (plugin, FALSE);
return;
}
@@ -535,12 +535,12 @@ eds_receive_book_cb (EBook *client,
async_query = g_new0 (AsyncQuery, 1);
g_free (plugin->priv->current_query_id);
plugin->priv->current_query_id = e_uid_new ();
- async_query->uid = plugin->priv->current_query_id;
+ async_query->uid = plugin->priv->current_query_id;
async_query->plugin = plugin;
- query = e_book_query_any_field_contains (search);
- e_book_async_get_contacts (client, query,
- eds_receive_contacts_cb,
+ query = e_book_query_any_field_contains (search);
+ e_book_async_get_contacts (client, query,
+ eds_receive_contacts_cb,
(gpointer) async_query);
eds_plugin_busy (plugin, TRUE);
@@ -548,9 +548,9 @@ eds_receive_book_cb (EBook *client,
}
static void
-eds_receive_contacts_cb (EBook *book,
- EBookStatus status,
- GList *contacts,
+eds_receive_contacts_cb (EBook *book,
+ EBookStatus status,
+ GList *contacts,
gpointer user_data)
{
GtkTreeIter iter;
@@ -573,8 +573,8 @@ eds_receive_contacts_cb (EBook *book,
g_free (async_query);
if (eds_query_cancelled (plugin, uid)) {
- g_message ("Answer for query cancelled: %s", uid);
- return;
+ g_message ("Answer for query cancelled: %s", uid);
+ return;
}
g_message ("Book status response: %d", status);
@@ -591,7 +591,7 @@ eds_receive_contacts_cb (EBook *book,
g_message ("Resource name: %s\n", name);
email = e_contact_get (l->data, E_CONTACT_EMAIL_1);
gtk_list_store_append (model, &iter);
- gtk_list_store_set (model, &iter,
+ gtk_list_store_set (model, &iter,
COL_RESOURCE_NAME, name,
COL_RESOURCE_EMAIL, email,
COL_RESOURCE_SELECTED, FALSE,
@@ -606,14 +606,14 @@ eds_receive_contacts_cb (EBook *book,
}
static void
-eds_all_button_clicked (GtkButton *button,
+eds_all_button_clicked (GtkButton *button,
PlannerPlugin *plugin)
{
eds_import_change_all (plugin, TRUE);
}
static void
-eds_none_button_clicked (GtkButton *button,
+eds_none_button_clicked (GtkButton *button,
PlannerPlugin *plugin)
{
eds_import_change_all (plugin, FALSE);
@@ -628,14 +628,14 @@ eds_import_change_all (PlannerPlugin *plugin,
gtk_tree_model_get_iter_first (priv->resources_model, &iter);
- if (!gtk_list_store_iter_is_valid (GTK_LIST_STORE (priv->resources_model),
+ if (!gtk_list_store_iter_is_valid (GTK_LIST_STORE (priv->resources_model),
&iter)) {
return;
}
do {
- gtk_list_store_set (GTK_LIST_STORE (priv->resources_model),
- &iter,
+ gtk_list_store_set (GTK_LIST_STORE (priv->resources_model),
+ &iter,
COL_RESOURCE_SELECTED, state,
-1);
} while (gtk_tree_model_iter_next (priv->resources_model, &iter));
@@ -644,7 +644,7 @@ eds_import_change_all (PlannerPlugin *plugin,
static MrpResource *
eds_find_resource (PlannerPlugin *plugin,
const gchar *uid,
- GList *resources_orig)
+ GList *resources_orig)
{
GList *l;
MrpResource *resource = NULL;
@@ -670,7 +670,7 @@ eds_import_resource (gchar *name,
gchar *email,
gchar *uid,
PlannerPlugin *plugin,
- GList *resources_orig)
+ GList *resources_orig)
{
MrpResource *resource;
gchar *note = _("Imported from Evolution Data Server");
@@ -680,9 +680,9 @@ eds_import_resource (gchar *name,
resource = eds_find_resource (plugin, uid, resources_orig);
if (!resource) {
resource = mrp_resource_new ();
- planner_resource_cmd_insert (plugin->main_window, resource);
- mrp_object_set (resource,
- "type", MRP_RESOURCE_TYPE_WORK,
+ planner_resource_cmd_insert (plugin->main_window, resource);
+ mrp_object_set (resource,
+ "type", MRP_RESOURCE_TYPE_WORK,
"units", 1,
"note", g_strdup_printf ("%s:\n%s", note, uid),
"eds-uid", g_strdup (uid),
@@ -690,7 +690,7 @@ eds_import_resource (gchar *name,
} else {
gchar *note_now;
mrp_object_get (resource, "note", ¬e_now, NULL);
- mrp_object_set (resource, "note",
+ mrp_object_set (resource, "note",
g_strdup_printf ("%s\n%s", note_now, note_update), NULL);
g_free (note_now);
}
@@ -704,7 +704,7 @@ eds_import_resource (gchar *name,
}
static void
-eds_group_selected (GtkComboBox *select_group,
+eds_group_selected (GtkComboBox *select_group,
PlannerPlugin *plugin)
{
GtkTreeIter iter;
@@ -720,7 +720,7 @@ eds_group_selected (GtkComboBox *select_group,
}
static void
-eds_resource_selected (GtkCellRendererToggle *toggle,
+eds_resource_selected (GtkCellRendererToggle *toggle,
const gchar *path_str,
PlannerPlugin *plugin)
{
@@ -733,7 +733,7 @@ eds_resource_selected (GtkCellRendererToggle *toggle,
path = gtk_tree_path_new_from_string (path_str);
model = plugin->priv->resources_model;
-
+
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model,
@@ -750,8 +750,8 @@ eds_resource_selected (GtkCellRendererToggle *toggle,
gtk_tree_path_free (path);
}
-static void
-eds_ok_button_clicked (GtkButton *button,
+static void
+eds_ok_button_clicked (GtkButton *button,
PlannerPlugin *plugin)
{
GtkTreeIter iter;
@@ -768,14 +768,14 @@ eds_ok_button_clicked (GtkButton *button,
gtk_tree_model_get_iter_first (priv->resources_model, &iter);
- if (!gtk_list_store_iter_is_valid (GTK_LIST_STORE (priv->resources_model),
+ if (!gtk_list_store_iter_is_valid (GTK_LIST_STORE (priv->resources_model),
&iter)) {
eds_dialog_close (plugin);
return;
}
/* Custom property for e-d-s resource UID */
- if (!mrp_project_has_property (plugin->priv->project,
+ if (!mrp_project_has_property (plugin->priv->project,
MRP_TYPE_RESOURCE, "eds-uid")) {
eds_create_uid_property (plugin);
}
@@ -784,7 +784,7 @@ eds_ok_button_clicked (GtkButton *button,
EContact *contact;
gboolean selected;
- gtk_tree_model_get (priv->resources_model, &iter,
+ gtk_tree_model_get (priv->resources_model, &iter,
COL_RESOURCE_SELECTED, &selected,
COL_RESOURCE_OBJECT, &contact,
-1);
@@ -797,20 +797,20 @@ eds_ok_button_clicked (GtkButton *button,
g_free (name);
g_free (email);
g_free (eds_uid);
- }
+ }
} while (gtk_tree_model_iter_next (priv->resources_model, &iter));
eds_dialog_close (plugin);
}
static void
-eds_cancel_button_clicked (GtkButton *button,
+eds_cancel_button_clicked (GtkButton *button,
PlannerPlugin *plugin)
{
eds_dialog_close (plugin);
}
-static void
+static void
eds_search_button_clicked (GtkButton *button,
PlannerPlugin *plugin)
{
@@ -819,16 +819,16 @@ eds_search_button_clicked (GtkButton *button,
GtkTreeIter iter;
ESourceGroup *group;
- search = gtk_entry_get_text (GTK_ENTRY
+ search = gtk_entry_get_text (GTK_ENTRY
(glade_xml_get_widget (priv->glade,"search_entry")));
if (gtk_combo_box_get_active_iter (priv->select_group, &iter)) {
gtk_tree_model_get (priv->groups_model, &iter, COL_GROUP_OBJECT, &group, -1);
eds_load_resources (group, plugin, search);
- }
+ }
}
-static gboolean
+static gboolean
eds_search_key_pressed (GtkEntry *entry,
GdkEventKey *event,
PlannerPlugin *plugin)
@@ -839,31 +839,31 @@ eds_search_key_pressed (GtkEntry *entry,
if (event->keyval == GDK_Return) {
if (gtk_combo_box_get_active_iter (priv->select_group, &iter)) {
- gtk_tree_model_get (priv->groups_model, &iter,
+ gtk_tree_model_get (priv->groups_model, &iter,
COL_GROUP_OBJECT, &group, -1);
eds_load_resources (group, plugin, gtk_entry_get_text (entry));
- }
+ }
}
return FALSE;
}
-static void
+static void
eds_stop_button_clicked (GtkButton *button,
PlannerPlugin *plugin)
{
- GtkProgressBar *progress = GTK_PROGRESS_BAR
+ GtkProgressBar *progress = GTK_PROGRESS_BAR
(glade_xml_get_widget (plugin->priv->glade, "progressbar"));
g_message ("Cancelling the query: %s", plugin->priv->current_query_id);
- plugin->priv->queries_cancelled =
- g_list_append (plugin->priv->queries_cancelled,
+ plugin->priv->queries_cancelled =
+ g_list_append (plugin->priv->queries_cancelled,
g_strdup (plugin->priv->current_query_id));
gtk_progress_bar_set_text (progress,_("Query cancelled."));
eds_plugin_busy (plugin, FALSE);
}
-static void
+static void
eds_column_clicked (GtkTreeViewColumn *column,
PlannerPlugin *plugin)
{
@@ -873,7 +873,7 @@ eds_column_clicked (GtkTreeViewColumn *column,
if (order == GTK_SORT_ASCENDING) {
new_order = GTK_SORT_DESCENDING;
} else {
- new_order = GTK_SORT_ASCENDING;
+ new_order = GTK_SORT_ASCENDING;
}
gtk_tree_view_column_set_sort_order (column, new_order);
}
@@ -885,7 +885,7 @@ eds_dialog_close (PlannerPlugin *plugin)
GList *l;
/* Cancel the actual query */
- eds_stop_button_clicked
+ eds_stop_button_clicked
(GTK_BUTTON (glade_xml_get_widget (priv->glade, "stop_button")), plugin);
/* Close books with e-d-s */
@@ -908,27 +908,27 @@ eds_dialog_close (PlannerPlugin *plugin)
}
g_object_unref (priv->glade);
-
+
gtk_widget_destroy (priv->dialog_get_resources);
}
/* FIXME: Undo support : planner-property-dialog.c */
static gboolean
eds_create_uid_property (PlannerPlugin *plugin)
-{
+{
MrpProperty *property;
- property = mrp_property_new ("eds-uid",
+ property = mrp_property_new ("eds-uid",
MRP_PROPERTY_TYPE_STRING,
_("Evolution Data Server UID"),
_("Identifier used by Evolution Data Server for resources"),
FALSE);
-
- mrp_project_add_property (plugin->priv->project,
+
+ mrp_project_add_property (plugin->priv->project,
MRP_TYPE_RESOURCE,
property,
FALSE);
- if (!mrp_project_has_property (plugin->priv->project,
+ if (!mrp_project_has_property (plugin->priv->project,
MRP_TYPE_RESOURCE, "eds-uid")) {
return FALSE;
}
@@ -936,15 +936,15 @@ eds_create_uid_property (PlannerPlugin *plugin)
}
/* FIXME: Undo support */
-G_MODULE_EXPORT void
-plugin_init (PlannerPlugin *plugin,
+G_MODULE_EXPORT void
+plugin_init (PlannerPlugin *plugin,
PlannerWindow *main_window)
{
PlannerPluginPriv *priv;
GtkUIManager *ui;
GtkActionGroup *actions;
gchar *filename;
-
+
priv = g_new0 (PlannerPluginPriv, 1);
plugin->priv = priv;
priv->main_window = main_window;
@@ -957,15 +957,15 @@ plugin_init (PlannerPlugin *plugin,
ui = planner_window_get_ui_manager (main_window);
gtk_ui_manager_insert_action_group (ui, actions, 0);
-
+
filename = mrp_paths_get_ui_dir ("eds-plugin.ui");
gtk_ui_manager_add_ui_from_file (ui, filename, NULL);
g_free (filename);
gtk_ui_manager_ensure_update (ui);
}
-G_MODULE_EXPORT void
-plugin_exit (PlannerPlugin *plugin)
+G_MODULE_EXPORT void
+plugin_exit (PlannerPlugin *plugin)
{
GList *l;
diff --git a/src/planner-format.c b/src/planner-format.c
index fc55df7..5c6b1fc 100644
--- a/src/planner-format.c
+++ b/src/planner-format.c
@@ -45,7 +45,7 @@ planner_format_int (gint number)
locality = localeconv ();
grouping = locality->grouping;
-
+
while (number) {
char *group;
switch (*grouping) {
@@ -141,7 +141,7 @@ planner_format_duration_with_day_length (gint duration,
if (day_length == 0) {
return g_strdup ("");
}
-
+
days = duration / day_length;
duration -= days * day_length;
hours = duration / (60*60);
@@ -188,13 +188,13 @@ planner_format_duration (MrpProject *project,
return planner_format_duration_with_day_length (duration, day_length);
}
-gchar *
+gchar *
planner_format_date (mrptime date)
{
gchar *svalue;
if (date == MRP_TIME_INVALID) {
- svalue = g_strdup ("");
+ svalue = g_strdup ("");
} else {
/* i18n: this string is the date nr and month name, displayed
* e.g. in the date cells in the task tree. See
@@ -202,8 +202,8 @@ planner_format_date (mrptime date)
*/
svalue = mrp_time_format (_("%b %e"), date);
}
-
- return svalue;
+
+ return svalue;
}
gchar *
@@ -222,19 +222,19 @@ planner_format_float (gfloat number,
gchar *value;
locality = localeconv ();
-
+
int_part = abs (number);
pow10 = pow (10, precision);
fraction = floor (0.5 + (number - (int) number) * pow10);
fraction = abs (fraction);
-
+
if (fraction >= pow10) {
int_part++;
fraction -= pow10;
}
-
+
str_intpart = planner_format_int (int_part);
if (!strcmp (locality->mon_decimal_point, "")) {
@@ -249,9 +249,9 @@ planner_format_float (gfloat number,
} else {
str_sign = "";
}
-
+
str_fraction = NULL;
-
+
if (fraction == 0) {
if (fill_with_zeroes) {
str_fraction = format_get_n_chars (precision, '0');
@@ -289,14 +289,14 @@ planner_parse_int (const gchar *str)
if (!str || !str[0]) {
return 0;
}
-
+
locality = localeconv ();
sep_len = strlen (locality->thousands_sep);
if (sep_len == 0) {
return atoi (str);
}
-
+
tmp = g_string_new (NULL);
p = str;
@@ -326,7 +326,7 @@ planner_parse_float (const gchar *str)
gchar *dec_point;
gint dec_len;
gint i;
-
+
if (!str || !str[0]) {
return 0.0;
}
@@ -335,7 +335,7 @@ planner_parse_float (const gchar *str)
int_part = planner_parse_int (str);
locality = localeconv ();
-
+
dec_len = strlen (locality->mon_decimal_point);
if (dec_len == 0) {
dec_point = ".";
@@ -351,7 +351,7 @@ planner_parse_float (const gchar *str)
}
p = p + dec_len;
-
+
dec_part = planner_parse_int (p);
i = dec_part;
@@ -364,7 +364,7 @@ planner_parse_float (const gchar *str)
if (dec_factor == 0) {
dec_factor = 1;
}
-
+
return int_part + dec_part / pow (10, dec_factor);
}
@@ -414,28 +414,28 @@ format_get_unit_from_string (const gchar *str)
if (!inited) {
translated_units = g_new0 (Units, num_units);
-
+
for (i = 0; i < num_units; i++) {
tmp = g_utf8_casefold (_(units[i].name), -1);
-
+
translated_units[i].name = tmp;
translated_units[i].unit = units[i].unit;
}
-
+
inited = TRUE;
}
-
+
for (i = 0; i < num_units; i++) {
if (!strncmp (str, translated_units[i].name,
strlen (translated_units[i].name))) {
unit = translated_units[i].unit;
}
}
-
+
if (unit != UNIT_NONE) {
return unit;
}
-
+
/* Try untranslated names as a fallback. */
for (i = 0; i < num_units; i++) {
if (!strncmp (str, units[i].name, strlen (units[i].name))) {
@@ -471,8 +471,8 @@ format_multiply_with_unit (gdouble value,
break;
case UNIT_NONE:
return 0;
- }
-
+ }
+
return floor (value + 0.5);
}
@@ -497,11 +497,11 @@ planner_parse_duration_with_day_length (const gchar *input,
if (!str) {
return 0;
}
-
+
total = 0;
p = str;
while (*p) {
- while (*p && g_unichar_isalpha (g_utf8_get_char (p))) {
+ while (*p && g_unichar_isalpha (g_utf8_get_char (p))) {
p = g_utf8_next_char (p);
}
@@ -513,7 +513,7 @@ planner_parse_duration_with_day_length (const gchar *input,
if (end_ptr == p) {
break;
}
-
+
if (end_ptr) {
unit = format_get_unit_from_string (end_ptr);
@@ -534,12 +534,12 @@ planner_parse_duration_with_day_length (const gchar *input,
if (end_ptr && *end_ptr == 0) {
break;
}
-
+
p = end_ptr + 1;
}
g_free (str);
-
+
return total;
}
diff --git a/src/planner-gantt-background.c b/src/planner-gantt-background.c
index b35c28b..45930dd 100644
--- a/src/planner-gantt-background.c
+++ b/src/planner-gantt-background.c
@@ -57,7 +57,7 @@ struct _PlannerGanttBackgroundPriv {
MrpProject *project;
MrpCalendar *calendar;
mrptime project_start;
-
+
gdouble hscale;
gdouble zoom;
gint row_height;
@@ -127,7 +127,7 @@ planner_gantt_background_get_type (void)
&info,
0);
}
-
+
return type;
}
@@ -232,12 +232,12 @@ gantt_background_finalize (GObject *object)
background = PLANNER_GANTT_BACKGROUND (object);
priv = background->priv;
-
+
if (priv->timeout_id) {
g_source_remove (priv->timeout_id);
priv->timeout_id = 0;
}
-
+
g_free (priv);
background->priv = NULL;
@@ -294,7 +294,7 @@ gantt_background_set_property (GObject *object,
item = GNOME_CANVAS_ITEM (object);
background = PLANNER_GANTT_BACKGROUND (object);
priv = background->priv;
-
+
switch (param_id) {
case PROP_PROJECT:
if (priv->project) {
@@ -303,7 +303,7 @@ gantt_background_set_property (GObject *object,
gantt_background_project_calendar_notify_cb,
background);
}
-
+
priv->project = g_value_get_object (value);
g_signal_connect (priv->project,
@@ -358,7 +358,7 @@ gantt_background_update (GnomeCanvasItem *item,
affine,
clip_path,
flags);
-
+
gantt_background_get_bounds (background, &x1, &y1, &x2, &y2);
gnome_canvas_update_bbox (item, x1, y1, x2, y2);
@@ -375,7 +375,7 @@ gantt_background_realize (GnomeCanvasItem *item)
priv = background->priv;
GNOME_CANVAS_ITEM_CLASS (parent_class)->realize (item);
-
+
priv->fill_gc = gdk_gc_new (item->canvas->layout.bin_window);
gnome_canvas_get_color (item->canvas, "grey96", &color);
gdk_gc_set_foreground (priv->fill_gc, &color);
@@ -451,7 +451,7 @@ gantt_background_unrealize (GnomeCanvasItem *item)
GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize (item);
}
-static gboolean
+static gboolean
gantt_background_update_timeline (gpointer data)
{
PlannerGanttBackground *background;
@@ -459,11 +459,11 @@ gantt_background_update_timeline (gpointer data)
background = PLANNER_GANTT_BACKGROUND (data);
priv = background->priv;
-
+
priv->timeline = mrp_time_current_time ();
-
+
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (background));
-
+
return TRUE;
}
@@ -478,7 +478,7 @@ gantt_background_draw (GnomeCanvasItem *item,
PlannerGanttBackground *background;
PlannerGanttBackgroundPriv *priv;
gint cx1, cx2; /* Canvas pixel coordinates */
- gint cy1, cy2;
+ gint cy1, cy2;
gdouble wx1, wx2; /* World coordinates */
gdouble hscale;
mrptime t0;
@@ -500,7 +500,7 @@ gantt_background_draw (GnomeCanvasItem *item,
}
calendar = mrp_project_get_calendar (priv->project);
-
+
hscale = priv->hscale;
level = planner_scale_clamp_zoom (priv->zoom);
@@ -509,13 +509,13 @@ gantt_background_draw (GnomeCanvasItem *item,
cy1 = y;
cy2 = y + height;
-
+
t1 = floor (wx1 / hscale + 0.5);
t2 = floor (wx2 / hscale + 0.5);
t0 = t1 = mrp_time_align_day (t1 - 24*60*60);
t2 = mrp_time_align_day (t2 + 24*60*60);
-
+
/* Loop through the days between t0 and t2. */
while (t1 <= t2) {
day = mrp_calendar_get_day (calendar, t1, TRUE);
@@ -523,9 +523,9 @@ gantt_background_draw (GnomeCanvasItem *item,
ivals = mrp_calendar_day_get_intervals (calendar, day, TRUE);
ival_prev = t1;
-
+
/* Loop through the intervals for this day. */
- for (l = ivals; l; l = l->next) {
+ for (l = ivals; l; l = l->next) {
ival = l->data;
mrp_interval_get_absolute (ival,
@@ -537,7 +537,7 @@ gantt_background_draw (GnomeCanvasItem *item,
* time interval and the start of the current one,
* i.e. [ival_prev, ival_start].
*/
-
+
wx1 = ival_prev * hscale;
wx2 = ival_start * hscale;
@@ -573,10 +573,10 @@ gantt_background_draw (GnomeCanvasItem *item,
if (ival_prev < t1 && planner_scale_conf[level].nonworking_limit <= t1 - ival_prev) {
wx1 = ival_prev * hscale;
wx2 = t1 * hscale;
-
+
gnome_canvas_w2c (item->canvas, wx1, 0, &cx1, NULL);
gnome_canvas_w2c (item->canvas, wx2, 0, &cx2, NULL);
-
+
gdk_draw_rectangle (drawable,
priv->fill_gc,
TRUE,
@@ -612,13 +612,13 @@ gantt_background_draw (GnomeCanvasItem *item,
}
}
-
+
/* Time line for project start .*/
wx1 = priv->project_start * hscale;
gnome_canvas_w2c (item->canvas, wx1, 0, &cx1, NULL);
#define DASH_LENGTH 8
-
+
if (priv->project_start >= t0 && priv->project_start <= t2) {
gint snap;
@@ -634,7 +634,7 @@ gantt_background_draw (GnomeCanvasItem *item,
cx1 - x,
cy2 + DASH_LENGTH - y);
}
-
+
if (priv->project_start >= t0) {
gchar *str, *tmp;
gint label_width;
@@ -649,9 +649,9 @@ gantt_background_draw (GnomeCanvasItem *item,
g_free (tmp);
g_free (str);
-
+
pango_layout_get_pixel_size (priv->layout, &label_width, NULL);
-
+
gdk_draw_layout (drawable,
GTK_WIDGET (item->canvas)->style->text_gc[GTK_STATE_NORMAL],
cx1 - label_width - 5 - x,
@@ -662,7 +662,7 @@ gantt_background_draw (GnomeCanvasItem *item,
/* Time line for current time .*/
if (priv->timeline >= t0 && priv->timeline <= t2) {
gint snap;
-
+
wx1 = priv->timeline * hscale;
gnome_canvas_w2c (item->canvas, wx1, 0, &cx1, NULL);
@@ -690,7 +690,7 @@ gantt_background_project_calendar_notify_cb (MrpProject *project,
PlannerGanttBackground *background)
{
MrpCalendar *calendar;
-
+
calendar = mrp_project_get_calendar (project);
gantt_background_set_calendar (background, calendar);
diff --git a/src/planner-gantt-background.h b/src/planner-gantt-background.h
index 434bedd..0226049 100644
--- a/src/planner-gantt-background.h
+++ b/src/planner-gantt-background.h
@@ -40,7 +40,7 @@ typedef struct _PlannerGanttBackgroundPriv PlannerGanttBackgroundPriv;
struct _PlannerGanttBackground {
GnomeCanvasItem parent;
- PlannerGanttBackgroundPriv *priv;
+ PlannerGanttBackgroundPriv *priv;
};
struct _PlannerGanttBackgroundClass {
diff --git a/src/planner-gantt-chart.c b/src/planner-gantt-chart.c
index f0cf332..27db952 100644
--- a/src/planner-gantt-chart.c
+++ b/src/planner-gantt-chart.c
@@ -58,7 +58,7 @@ static gdouble f = 1.0;
#define GUIDELINES_PATH_KEY "/views/gantt_view/show_guidelines"
-typedef struct _TreeNode TreeNode;
+typedef struct _TreeNode TreeNode;
typedef void (*TreeFunc) (TreeNode *node, gpointer data);
struct _TreeNode {
@@ -81,13 +81,13 @@ struct _PlannerGanttChartPriv {
GtkAdjustment *hadjustment;
GtkAdjustment *vadjustment;
-
+
GtkTreeModel *model;
TreeNode *tree;
PlannerTaskTree *view;
-
+
GHashTable *relation_hash;
-
+
GnomeCanvasItem *background;
gdouble zoom;
@@ -96,7 +96,7 @@ struct _PlannerGanttChartPriv {
/* Cached height. */
gdouble height;
-
+
mrptime project_start;
mrptime last_time;
@@ -105,7 +105,7 @@ struct _PlannerGanttChartPriv {
/* Critical path. */
gboolean highlight_critical;
-
+
/* Nonstandard days visualization */
gboolean nonstandard_days;
@@ -143,7 +143,7 @@ static void gantt_chart_get_property (GObject *obj
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static void gantt_chart_destroy (GtkObject *object);
+static void gantt_chart_destroy (GtkObject *object);
static void gantt_chart_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gantt_chart_realize (GtkWidget *widget);
@@ -244,7 +244,7 @@ planner_gantt_chart_get_type (void)
type = g_type_register_static (GTK_TYPE_VBOX, "PlannerGanttChart",
&info, 0);
}
-
+
return type;
}
@@ -276,7 +276,7 @@ gantt_chart_class_init (PlannerGanttChartClass *class)
widget_class->size_allocate = gantt_chart_size_allocate;
class->set_scroll_adjustments = gantt_chart_set_adjustments;
-
+
widget_class->set_scroll_adjustments_signal =
g_signal_new ("set_scroll_adjustments",
G_TYPE_FROM_CLASS (object_class),
@@ -336,7 +336,7 @@ static void
gantt_chart_init (PlannerGanttChart *chart)
{
PlannerGanttChartPriv *priv;
-
+
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (chart), FALSE);
priv = g_new0 (PlannerGanttChartPriv, 1);
@@ -348,7 +348,7 @@ gantt_chart_init (PlannerGanttChart *chart)
priv->height_changed = FALSE;
priv->reflow_idle_id = 0;
-
+
gtk_box_set_homogeneous (GTK_BOX (chart), FALSE);
gtk_box_set_spacing (GTK_BOX (chart), 0);
@@ -361,7 +361,7 @@ gantt_chart_init (PlannerGanttChart *chart)
"date_hint_changed",
G_CALLBACK (gantt_chart_header_date_hint_changed_cb),
chart);
-
+
gtk_box_pack_start (GTK_BOX (chart),
GTK_WIDGET (priv->header),
FALSE, /* expand */
@@ -374,7 +374,7 @@ gantt_chart_init (PlannerGanttChart *chart)
/* Easiest way to get access to the chart from the canvas items. */
g_object_set_data (G_OBJECT (priv->canvas), "chart", chart);
-
+
gtk_box_pack_start (GTK_BOX (chart),
GTK_WIDGET (priv->canvas),
TRUE,
@@ -463,7 +463,7 @@ gantt_chart_finalize (GObject *object)
PlannerGanttChart *chart = PLANNER_GANTT_CHART (object);
g_hash_table_destroy (chart->priv->relation_hash);
-
+
g_free (chart->priv);
if (G_OBJECT_CLASS (parent_class)->finalize) {
@@ -510,11 +510,11 @@ gantt_chart_style_set (GtkWidget *widget,
priv = chart->priv;
context = gtk_widget_get_pango_context (widget);
-
+
metrics = pango_context_get_metrics (context,
widget->style->font_desc,
NULL);
-
+
f = 0.2 * pango_font_metrics_get_approximate_char_width (metrics) / PANGO_SCALE;
/* Re-layout with the new factor. */
@@ -538,7 +538,7 @@ gantt_chart_realize (GtkWidget *widget)
if (GTK_WIDGET_CLASS (parent_class)->realize) {
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
}
-
+
/* Set the background to white. */
style = gtk_style_copy (canvas->style);
colormap = gtk_widget_get_colormap (canvas);
@@ -587,7 +587,7 @@ gantt_chart_size_allocate (GtkWidget *widget,
gboolean height_changed;
height_changed = widget->allocation.height != allocation->height;
-
+
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
chart = PLANNER_GANTT_CHART (widget);
@@ -612,22 +612,22 @@ gantt_chart_set_adjustments (PlannerGanttChart *chart,
g_return_if_fail (vadj == NULL || GTK_IS_ADJUSTMENT (vadj));
priv = chart->priv;
-
+
if (hadj == NULL) {
hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
}
if (vadj == NULL) {
vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
}
-
+
if (priv->hadjustment && (priv->hadjustment != hadj)) {
g_object_unref (priv->hadjustment);
}
-
+
if (priv->vadjustment && (priv->vadjustment != vadj)) {
g_object_unref (priv->vadjustment);
}
-
+
if (priv->hadjustment != hadj) {
priv->hadjustment = hadj;
g_object_ref (priv->hadjustment);
@@ -639,15 +639,15 @@ gantt_chart_set_adjustments (PlannerGanttChart *chart,
need_adjust = TRUE;
}
-
+
if (priv->vadjustment != vadj) {
priv->vadjustment = vadj;
g_object_ref (priv->vadjustment);
gtk_object_sink (GTK_OBJECT (priv->vadjustment));
-
+
need_adjust = TRUE;
}
-
+
if (need_adjust) {
gtk_widget_set_scroll_adjustments (GTK_WIDGET (priv->canvas),
hadj,
@@ -704,11 +704,11 @@ gantt_chart_row_inserted (GtkTreeModel *model,
else if (iter == NULL) {
gtk_tree_model_get_iter (model, iter, path);
}
-
+
task = planner_gantt_model_get_task (PLANNER_GANTT_MODEL (model), iter);
node = gantt_chart_insert_task (chart, path, task);
-
+
gantt_chart_reflow (chart, TRUE);
if (free_path) {
@@ -736,10 +736,10 @@ gantt_chart_row_has_child_toggled (GtkTreeModel *model,
path = gtk_tree_model_get_path (model, iter);
free_path = TRUE;
}
-
+
node = gantt_chart_tree_node_at_path (priv->tree, path);
gnome_canvas_item_request_update (node->item);
-
+
if (free_path) {
gtk_tree_path_free (path);
}
@@ -750,7 +750,7 @@ gantt_chart_remove_children (PlannerGanttChart *chart,
TreeNode *node)
{
gint i;
-
+
for (i = 0; i < node->num_children; i++) {
gantt_chart_remove_children (chart, node->children[i]);
}
@@ -771,7 +771,7 @@ gantt_chart_row_deleted (GtkTreeModel *model,
{
PlannerGanttChart *chart = data;
TreeNode *node;
-
+
g_return_if_fail (path != NULL);
node = gantt_chart_tree_node_at_path (chart->priv->tree, path);
@@ -814,7 +814,7 @@ gantt_chart_build_tree_do (PlannerGanttChart *chart,
TreeNode *node;
priv = chart->priv;
-
+
do {
task = planner_gantt_model_get_task (PLANNER_GANTT_MODEL (priv->model), iter);
@@ -824,7 +824,7 @@ gantt_chart_build_tree_do (PlannerGanttChart *chart,
g_hash_table_insert (hash, task, node);
gtk_tree_path_free (path);
-
+
if (gtk_tree_model_iter_children (priv->model, &child, iter)) {
gantt_chart_build_tree_do (chart, &child, hash);
}
@@ -852,31 +852,31 @@ gantt_chart_build_relations (PlannerGanttChart *chart,
do {
task = planner_gantt_model_get_task (
PLANNER_GANTT_MODEL (priv->model), iter);
-
+
relations = mrp_task_get_predecessor_relations (task);
for (l = relations; l; l = l->next) {
relation = l->data;
predecessor = mrp_relation_get_predecessor (relation);
-
+
task_node = g_hash_table_lookup (hash, task);
predecessor_node = g_hash_table_lookup (hash, predecessor);
rel_type = mrp_relation_get_relation_type(relation);
- arrow = gantt_chart_add_relation (chart,
- task_node,
- predecessor_node,
+ arrow = gantt_chart_add_relation (chart,
+ task_node,
+ predecessor_node,
rel_type);
g_hash_table_insert (priv->relation_hash, relation, arrow);
}
-
+
if (gtk_tree_model_iter_children (priv->model, &child, iter)) {
gantt_chart_build_relations (chart, &child, hash);
}
-
+
} while (gtk_tree_model_iter_next (priv->model, iter));
}
@@ -894,12 +894,12 @@ gantt_chart_build_tree (PlannerGanttChart *chart)
}
hash = g_hash_table_new (NULL, NULL);
-
+
gantt_chart_build_tree_do (chart, &iter, hash);
gtk_tree_model_get_iter (chart->priv->model, &iter, path);
gantt_chart_build_relations (chart, &iter, hash);
-
+
gtk_tree_path_free (path);
g_hash_table_destroy (hash);
@@ -910,14 +910,14 @@ static gboolean
node_is_visible (TreeNode *node)
{
g_return_val_if_fail (node->parent != NULL, FALSE);
-
+
while (node->parent) {
if (!node->parent->expanded) {
return FALSE;
}
node = node->parent;
}
-
+
return TRUE;
}
@@ -932,7 +932,7 @@ gantt_chart_reflow_do (PlannerGanttChart *chart, TreeNode *root, gdouble start_y
if (root->children == NULL) {
return 0;
}
-
+
node = root->children[0];
row_y = start_y;
@@ -940,7 +940,7 @@ gantt_chart_reflow_do (PlannerGanttChart *chart, TreeNode *root, gdouble start_y
if (row_height == -1) {
row_height = 23;
}
-
+
for (i = 0; i < root->num_children; i++) {
node = root->children[i];
@@ -973,7 +973,7 @@ gantt_chart_reflow_idle (PlannerGanttChart *chart)
GtkAllocation allocation;
priv = chart->priv;
-
+
if (priv->height_changed || priv->height == -1) {
height = gantt_chart_reflow_do (chart, priv->tree, 0);
priv->height = height;
@@ -982,7 +982,7 @@ gantt_chart_reflow_idle (PlannerGanttChart *chart)
}
allocation = GTK_WIDGET (priv->canvas)->allocation;
-
+
t1 = priv->project_start;
t2 = priv->last_time;
@@ -1023,7 +1023,7 @@ gantt_chart_reflow_idle (PlannerGanttChart *chart)
y1 + height);
if (x1 > -1 && x2 > -1) {
- g_object_set (priv->header,
+ g_object_set (priv->header,
"x1", x1,
"x2", x2,
NULL);
@@ -1057,7 +1057,7 @@ gantt_chart_reflow (PlannerGanttChart *chart, gboolean height_changed)
if (chart->priv->reflow_idle_id != 0) {
return;
}
-
+
chart->priv->reflow_idle_id = g_idle_add ((GSourceFunc) gantt_chart_reflow_idle, chart);
}
@@ -1079,7 +1079,7 @@ gantt_chart_insert_task (PlannerGanttChart *chart,
"zoom", priv->zoom,
NULL);
planner_gantt_row_init_menu (PLANNER_GANTT_ROW (item));
-
+
tree_node = gantt_chart_tree_node_new ();
tree_node->item = item;
tree_node->task = task;
@@ -1090,7 +1090,7 @@ gantt_chart_insert_task (PlannerGanttChart *chart,
"relation-added",
G_CALLBACK (gantt_chart_relation_added),
chart);
-
+
g_signal_connect (task,
"relation-removed",
G_CALLBACK (gantt_chart_relation_removed),
@@ -1152,7 +1152,7 @@ GtkWidget *
planner_gantt_chart_new_with_model (GtkTreeModel *model)
{
PlannerGanttChart *chart;
-
+
chart = PLANNER_GANTT_CHART (gtk_type_new (planner_gantt_chart_get_type ()));
if (model) {
@@ -1184,7 +1184,7 @@ planner_gantt_chart_collapse_row (PlannerGanttChart *chart, GtkTreePath *path)
TreeNode *node;
g_return_if_fail (PLANNER_IS_GANTT_CHART (chart));
-
+
node = gantt_chart_tree_node_at_path (chart->priv->tree, path);
if (node) {
@@ -1208,7 +1208,7 @@ gantt_chart_project_start_changed (MrpProject *project,
g_object_set (chart->priv->background,
"project-start", t,
NULL);
-
+
planner_gantt_chart_reflow_now (chart);
}
@@ -1237,12 +1237,12 @@ gantt_chart_relation_added (MrpTask *task,
predecessor = mrp_relation_get_predecessor (relation);
if (g_getenv ("PLANNER_DEBUG_UNDO_TASK")) {
- g_message ("Adding a new relation arrow (%p): %s (%p) -> %s (%p)",
- relation,
+ g_message ("Adding a new relation arrow (%p): %s (%p) -> %s (%p)",
+ relation,
mrp_task_get_name (predecessor), predecessor,
mrp_task_get_name (task), task);
}
-
+
if (task == predecessor) {
/* We are only interested in the successor task. */
return;
@@ -1253,14 +1253,14 @@ gantt_chart_relation_added (MrpTask *task,
predecessor_path = planner_gantt_model_get_path_from_task (
PLANNER_GANTT_MODEL (chart->priv->model),
predecessor);
-
+
task_node = gantt_chart_tree_node_at_path (chart->priv->tree,
task_path);
predecessor_node = gantt_chart_tree_node_at_path (chart->priv->tree,
predecessor_path);
-
+
rel_type = mrp_relation_get_relation_type (relation);
-
+
arrow = gantt_chart_add_relation (chart,
task_node,
predecessor_node,
@@ -1278,7 +1278,7 @@ gantt_chart_relation_removed (MrpTask *task,
MrpTask *predecessor;
predecessor = mrp_relation_get_predecessor (relation);
-
+
if (task == predecessor) {
/* We are only interested in the successor task. */
return;
@@ -1287,7 +1287,7 @@ gantt_chart_relation_removed (MrpTask *task,
arrow = g_hash_table_lookup (chart->priv->relation_hash, relation);
if (arrow != NULL) {
g_hash_table_remove (chart->priv->relation_hash, relation);
-
+
gtk_object_destroy (GTK_OBJECT (arrow));
gantt_chart_reflow (chart, FALSE);
}
@@ -1308,12 +1308,12 @@ gantt_chart_task_removed (MrpTask *task,
for (l = relations; l; l = l->next) {
gantt_chart_relation_removed (task, l->data, chart);
}
-
+
relations = mrp_task_get_successor_relations (task);
for (l = relations; l; l = l->next) {
gantt_chart_relation_removed (task, l->data, chart);
- }
-
+ }
+
g_signal_handlers_disconnect_by_func (task, gantt_chart_relation_added, chart);
g_signal_handlers_disconnect_by_func (task, gantt_chart_relation_removed, chart);
g_signal_handlers_disconnect_by_func (task, gantt_chart_task_removed, chart);
@@ -1336,17 +1336,17 @@ gantt_chart_task_moved_task_traverse_func (MrpTask *task, PlannerGanttChart *cha
relations = mrp_task_get_predecessor_relations (task);
for (l = relations; l; l = l->next) {
relation = l->data;
-
+
arrow = g_hash_table_lookup (priv->relation_hash, relation);
if (arrow) {
planner_relation_arrow_set_successor (arrow, row);
}
}
-
+
relations = mrp_task_get_successor_relations (task);
for (l = relations; l; l = l->next) {
relation = l->data;
-
+
arrow = g_hash_table_lookup (priv->relation_hash, relation);
if (arrow) {
planner_relation_arrow_set_predecessor (arrow, row);
@@ -1388,7 +1388,7 @@ gantt_chart_add_signal (PlannerGanttChart *chart, gpointer instance, gulong id)
data->instance = instance;
data->id = id;
-
+
chart->priv->signal_ids = g_list_prepend (chart->priv->signal_ids,
data);
}
@@ -1401,7 +1401,7 @@ gantt_chart_disconnect_signals (PlannerGanttChart *chart)
for (l = chart->priv->signal_ids; l; l = l->next) {
data = l->data;
-
+
g_signal_handler_disconnect (data->instance,
data->id);
g_free (data);
@@ -1415,7 +1415,7 @@ PlannerTaskTree *
planner_gantt_chart_get_view (PlannerGanttChart *chart)
{
g_return_val_if_fail (PLANNER_IS_GANTT_CHART (chart), NULL);
-
+
return chart->priv->view;
}
@@ -1423,7 +1423,7 @@ void
planner_gantt_chart_set_view (PlannerGanttChart *chart, PlannerTaskTree *view)
{
g_return_if_fail (PLANNER_IS_TASK_TREE (view));
-
+
chart->priv->view = view;
}
@@ -1443,7 +1443,7 @@ planner_gantt_chart_set_model (PlannerGanttChart *chart,
MrpTask *root;
MrpProject *project;
gulong id;
-
+
g_return_if_fail (PLANNER_IS_GANTT_CHART (chart));
priv = chart->priv;
@@ -1468,7 +1468,7 @@ planner_gantt_chart_set_model (PlannerGanttChart *chart,
root = mrp_project_get_root_task (project);
g_object_set (priv->background, "project", project, NULL);
-
+
id = g_signal_connect (project,
"notify::project-start",
G_CALLBACK (gantt_chart_project_start_changed),
@@ -1500,13 +1500,13 @@ planner_gantt_chart_set_model (PlannerGanttChart *chart,
G_CALLBACK (gantt_chart_row_inserted),
chart);
gantt_chart_add_signal (chart, model, id);
-
+
id = g_signal_connect (model,
"row-deleted",
G_CALLBACK (gantt_chart_row_deleted),
chart);
gantt_chart_add_signal (chart, model, id);
-
+
id = g_signal_connect (model,
"rows-reordered",
G_CALLBACK (gantt_chart_rows_reordered),
@@ -1518,7 +1518,7 @@ planner_gantt_chart_set_model (PlannerGanttChart *chart,
G_CALLBACK (gantt_chart_row_has_child_toggled),
chart);
gantt_chart_add_signal (chart, model, id);
-
+
priv->project_start = mrp_project_get_project_start (project);
g_object_set (priv->background,
@@ -1526,14 +1526,14 @@ planner_gantt_chart_set_model (PlannerGanttChart *chart,
NULL);
priv->last_time = mrp_task_get_finish (root);
-
+
/* Force a reflow initially to avoid visible reflow on
* start-up .
*/
priv->height_changed = TRUE;
planner_gantt_chart_reflow_now (chart);
}
-
+
g_object_notify (G_OBJECT (chart), "model");
}
@@ -1543,7 +1543,7 @@ static TreeNode *
gantt_chart_tree_node_new (void)
{
TreeNode *node;
-
+
node = g_new0 (TreeNode, 1);
node->expanded = TRUE;
@@ -1561,7 +1561,7 @@ gantt_chart_tree_node_insert_path (TreeNode *node, GtkTreePath *path, TreeNode *
for (i = 0; i < depth - 1; i++) {
node = node->children[indices[i]];
}
-
+
node->num_children++;
node->children = g_realloc (node->children, sizeof (gpointer) * node->num_children);
@@ -1610,7 +1610,7 @@ gantt_chart_tree_node_remove (PlannerGanttChart *chart, TreeNode *node)
g_signal_handlers_disconnect_by_func (node->task, gantt_chart_relation_added, chart);
g_signal_handlers_disconnect_by_func (node->task, gantt_chart_relation_removed, chart);
g_signal_handlers_disconnect_by_func (node->task, gantt_chart_task_removed, chart);
-
+
node->parent = NULL;
}
@@ -1630,10 +1630,10 @@ gantt_chart_tree_node_at_path (TreeNode *node, GtkTreePath *path)
if (node->num_children <= indices[i]) {
return NULL;
}
-
+
node = node->children[indices[i]];
}
-
+
return node;
}
@@ -1641,7 +1641,7 @@ void
planner_gantt_chart_scroll_to (PlannerGanttChart *chart, time_t t)
{
/*gint x1, x2;*/
-
+
g_return_if_fail (PLANNER_IS_GANTT_CHART (chart));
/* FIXME: add range check. */
@@ -1652,9 +1652,9 @@ planner_gantt_chart_scroll_to (PlannerGanttChart *chart, time_t t)
x2 = t * chart->priv->hscale;
gnome_canvas_scroll_to (chart->priv->canvas, x2 - x1, 0);
-#endif
+#endif
}
-
+
static void
gantt_chart_tree_traverse (TreeNode *node, TreeFunc func, gpointer data)
{
@@ -1679,7 +1679,7 @@ gantt_chart_get_visible_region (PlannerGanttChart *chart,
{
GnomeCanvas *canvas;
gint cx, cy;
-
+
canvas = chart->priv->canvas;
gnome_canvas_get_scroll_offsets(canvas, &cx, &cy);
@@ -1698,7 +1698,7 @@ gantt_chart_set_scroll_region (PlannerGanttChart *chart,
{
GnomeCanvas *canvas;
gdouble ox1, oy1, ox2, oy2;
-
+
canvas = chart->priv->canvas;
gnome_canvas_get_scroll_region (canvas,
@@ -1706,7 +1706,7 @@ gantt_chart_set_scroll_region (PlannerGanttChart *chart,
&oy1,
&ox2,
&oy2);
-
+
if (ox1 == x1 && oy1 == y1 && ox2 == x2 && oy2 == y2) {
return;
}
@@ -1727,7 +1727,7 @@ gantt_chart_get_row_from_task (PlannerGanttChart *chart,
TreeNode *node;
model = PLANNER_GANTT_MODEL (chart->priv->model);
-
+
path = planner_gantt_model_get_path_from_task (model, task);
node = gantt_chart_tree_node_at_path (chart->priv->tree, path);
@@ -1782,12 +1782,12 @@ gantt_chart_set_zoom (PlannerGanttChart *chart, gdouble zoom)
planner_gantt_chart_reflow_now (chart);
}
-static mrptime
+static mrptime
gantt_chart_get_center (PlannerGanttChart *chart)
{
PlannerGanttChartPriv *priv;
gint x1, width, x;
-
+
priv = chart->priv;
gnome_canvas_get_scroll_offsets (priv->canvas, &x1, NULL);
@@ -1800,12 +1800,12 @@ gantt_chart_get_center (PlannerGanttChart *chart)
return floor (x / SCALE (priv->zoom) + 0.5);
}
-static void
+static void
gantt_chart_set_center (PlannerGanttChart *chart, mrptime t)
{
PlannerGanttChartPriv *priv;
gint x, x1, width;
-
+
priv = chart->priv;
x = floor (t * SCALE (priv->zoom) + 0.5);
@@ -1859,11 +1859,11 @@ planner_gantt_chart_can_zoom (PlannerGanttChart *chart,
g_return_if_fail (PLANNER_IS_GANTT_CHART (chart));
priv = chart->priv;
-
+
if (in) {
*in = (priv->zoom < ZOOM_IN_LIMIT);
}
-
+
if (out) {
*out = (priv->zoom > ZOOM_OUT_LIMIT);
}
@@ -1885,7 +1885,7 @@ planner_gantt_chart_zoom_to_fit (PlannerGanttChart *chart)
if (t == -1) {
return;
}
-
+
alloc = GTK_WIDGET (chart)->allocation.width - PADDING * 2;
zoom = planner_scale_clamp_zoom (ZOOM (alloc / t));
@@ -1901,7 +1901,7 @@ planner_gantt_chart_get_zoom (PlannerGanttChart *chart)
priv = chart->priv;
- return priv->zoom;
+ return priv->zoom;
}
static gint
@@ -1942,7 +1942,7 @@ planner_gantt_chart_set_highlight_critical_tasks (PlannerGanttChart *chart,
gboolean state)
{
PlannerGanttChartPriv *priv;
-
+
g_return_if_fail (PLANNER_IS_GANTT_CHART (chart));
priv = chart->priv;
@@ -1950,9 +1950,9 @@ planner_gantt_chart_set_highlight_critical_tasks (PlannerGanttChart *chart,
if (priv->highlight_critical == state) {
return;
}
-
+
priv->highlight_critical = state;
-
+
gtk_widget_queue_draw (GTK_WIDGET (priv->canvas));
planner_conf_set_bool (CRITICAL_PATH_KEY, state, NULL);
@@ -1980,7 +1980,7 @@ planner_gantt_chart_set_show_guidelines (PlannerGanttChart *chart,
NULL);
gtk_widget_queue_draw (GTK_WIDGET (priv->canvas));
-
+
planner_conf_set_bool (GUIDELINES_PATH_KEY, state, NULL);
}
@@ -2005,7 +2005,7 @@ planner_gantt_chart_set_nonstandard_days (PlannerGanttChart *chart,
gboolean state)
{
PlannerGanttChartPriv *priv;
-
+
g_return_if_fail (PLANNER_IS_GANTT_CHART (chart));
priv = chart->priv;
@@ -2013,9 +2013,9 @@ planner_gantt_chart_set_nonstandard_days (PlannerGanttChart *chart,
if (priv->nonstandard_days == state) {
return;
}
-
+
priv->nonstandard_days = state;
-
+
gtk_widget_queue_draw (GTK_WIDGET (priv->canvas));
planner_conf_set_bool (NOSTDDAYS_PATH_KEY, state, NULL);
diff --git a/src/planner-gantt-header.c b/src/planner-gantt-header.c
index 2a1ba56..a88486e 100644
--- a/src/planner-gantt-header.c
+++ b/src/planner-gantt-header.c
@@ -35,7 +35,7 @@
struct _PlannerGanttHeaderPriv {
GdkWindow *bin_window;
-
+
GtkAdjustment *hadjustment;
PangoLayout *layout;
@@ -45,9 +45,9 @@ struct _PlannerGanttHeaderPriv {
MrpTimeUnit minor_unit;
PlannerScaleFormat minor_format;
-
+
gdouble hscale;
-
+
gint width;
gint height;
@@ -131,7 +131,7 @@ planner_gantt_header_get_type (void)
&planner_gantt_header_info,
0);
}
-
+
return planner_gantt_header_type;
}
@@ -167,9 +167,9 @@ gantt_header_class_init (PlannerGanttHeaderClass *class)
widget_class->leave_notify_event = gantt_header_leave_notify_event;
widget_class->motion_notify_event = gantt_header_motion_notify_event;
-
+
class->set_scroll_adjustments = gantt_header_set_adjustments;
-
+
widget_class->set_scroll_adjustments_signal =
g_signal_new ("set_scroll_adjustments",
G_TYPE_FROM_CLASS (object_class),
@@ -179,7 +179,7 @@ gantt_header_class_init (PlannerGanttHeaderClass *class)
planner_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2,
GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
-
+
/* Properties. */
g_object_class_install_property (
o_class,
@@ -271,7 +271,7 @@ gantt_header_set_zoom (PlannerGanttHeader *header, gdouble zoom)
priv = header->priv;
level = planner_scale_clamp_zoom (zoom);
-
+
priv->major_unit = planner_scale_conf[level].major_unit;
priv->major_format = planner_scale_conf[level].major_format;
@@ -346,7 +346,7 @@ gantt_header_set_property (GObject *object,
if (change_width || change_height) {
gtk_widget_set_size_request (GTK_WIDGET (header),
- priv->width,
+ priv->width,
priv->height);
}
@@ -406,7 +406,7 @@ gantt_header_map (GtkWidget *widget)
PlannerGanttHeader *header;
header = PLANNER_GANTT_HEADER (widget);
-
+
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
gdk_window_show (header->priv->bin_window);
@@ -420,9 +420,9 @@ gantt_header_realize (GtkWidget *widget)
GdkWindowAttr attributes;
GdkGCValues values;
gint attributes_mask;
-
+
header = PLANNER_GANTT_HEADER (widget);
-
+
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
/* Create the main, clipping window. */
@@ -460,12 +460,12 @@ gantt_header_realize (GtkWidget *widget)
&attributes,
attributes_mask);
gdk_window_set_user_data (header->priv->bin_window, widget);
-
+
values.foreground = (widget->style->white.pixel == 0 ?
widget->style->black : widget->style->white);
values.function = GDK_XOR;
values.subwindow_mode = GDK_INCLUDE_INFERIORS;
-
+
widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (widget->window,
&widget->style->base[widget->state]);
@@ -526,7 +526,7 @@ gantt_header_expose_event (GtkWidget *widget,
gint major_width;
GdkGC *gc;
GdkRectangle rect;
-
+
header = PLANNER_GANTT_HEADER (widget);
priv = header->priv;
hscale = priv->hscale;
@@ -550,7 +550,7 @@ gantt_header_expose_event (GtkWidget *widget,
0,
event->area.width + 10,
height);
-
+
gdk_draw_line (event->window,
widget->style->fg_gc[GTK_STATE_INSENSITIVE],
event->area.x,
@@ -578,12 +578,12 @@ gantt_header_expose_event (GtkWidget *widget,
/* Unless it's too thin to make sense. */
goto minor_ticks;
}
-
+
t = mrp_time_align_prev (t0, priv->major_unit);
-
+
while (t <= t1) {
x = floor (t * hscale - priv->x1 + 0.5);
-
+
gdk_draw_line (event->window,
widget->style->fg_gc[GTK_STATE_INSENSITIVE],
x, 0,
@@ -606,7 +606,7 @@ gantt_header_expose_event (GtkWidget *widget,
x + 3,
2,
priv->layout);
-
+
t = mrp_time_align_next (t, priv->major_unit);
}
@@ -617,7 +617,7 @@ gantt_header_expose_event (GtkWidget *widget,
/* Unless it's too thin to make sense. */
goto done;
}
-
+
t = mrp_time_align_prev (t0, priv->minor_unit);
while (t <= t1) {
@@ -635,7 +635,7 @@ gantt_header_expose_event (GtkWidget *widget,
str,
-1);
g_free (str);
-
+
rect.x = x;
rect.width = minor_width;
gdk_gc_set_clip_rectangle (gc, &rect);
@@ -651,7 +651,7 @@ gantt_header_expose_event (GtkWidget *widget,
done:
gdk_gc_unref (gc);
-
+
return TRUE;
}
@@ -663,7 +663,7 @@ gantt_header_motion_notify_event (GtkWidget *widget,
PlannerGanttHeaderPriv *priv;
mrptime t;
char *str;
-
+
header = PLANNER_GANTT_HEADER (widget);
priv = header->priv;
@@ -678,7 +678,7 @@ gantt_header_motion_notify_event (GtkWidget *widget,
} else {
g_free (str);
}
-
+
return FALSE;
}
@@ -698,7 +698,7 @@ gantt_header_leave_notify_event (GtkWidget *widget,
g_free (priv->date_hint);
priv->date_hint = NULL;
}
-
+
return FALSE;
}
@@ -711,11 +711,11 @@ gantt_header_set_adjustments (PlannerGanttHeader *header,
if (hadj == NULL) {
hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
}
-
+
if (header->priv->hadjustment && (header->priv->hadjustment != hadj)) {
gtk_object_unref (GTK_OBJECT (header->priv->hadjustment));
}
-
+
if (header->priv->hadjustment != hadj) {
header->priv->hadjustment = hadj;
gtk_object_ref (GTK_OBJECT (header->priv->hadjustment));
@@ -725,7 +725,7 @@ gantt_header_set_adjustments (PlannerGanttHeader *header,
"value_changed",
G_CALLBACK (gantt_header_adjustment_changed),
header);
-
+
gtk_widget_set_scroll_adjustments (GTK_WIDGET (header),
hadj,
NULL);
diff --git a/src/planner-gantt-model.c b/src/planner-gantt-model.c
index 7fc693c..7e22788 100644
--- a/src/planner-gantt-model.c
+++ b/src/planner-gantt-model.c
@@ -50,7 +50,7 @@ struct _PlannerGanttModelPriv {
typedef struct {
gchar *wbs;
gint wbs_stamp;
-
+
gchar *start;
gchar *finish;
gchar *duration;
@@ -113,7 +113,7 @@ planner_gantt_model_get_type (void)
type = g_type_register_static (G_TYPE_OBJECT,
"PlannerGanttModel",
&info, 0);
-
+
g_type_add_interface_static (type,
GTK_TYPE_TREE_MODEL,
&tree_model_info);
@@ -153,7 +153,7 @@ gantt_model_task_inserted_cb (MrpProject *project,
gboolean has_child_toggled;
value_cache_clear_cache_wbs (model);
-
+
node = g_node_new (task);
g_hash_table_insert (model->priv->task2node, task, node);
@@ -166,7 +166,7 @@ gantt_model_task_inserted_cb (MrpProject *project,
has_child_toggled = (g_node_n_children (parent_node) == 0);
g_node_insert (parent_node, pos, node);
-
+
if (has_child_toggled && parent_node->parent != NULL) {
parent_path = gantt_model_get_path_from_node (model, parent_node);
gantt_model_get_iter (GTK_TREE_MODEL (model), &iter, parent_path);
@@ -181,7 +181,7 @@ gantt_model_task_inserted_cb (MrpProject *project,
gtk_tree_model_row_inserted (GTK_TREE_MODEL (model), path, &iter);
gtk_tree_path_free (path);
-
+
gantt_model_connect_to_task_signals (model, task);
/* Sanity check. */
@@ -191,7 +191,7 @@ gantt_model_task_inserted_cb (MrpProject *project,
g_warning ("Gantt model corrupt.");
}
#endif
-
+
g_signal_emit (model, signals[TASK_ADDED], 0, task);
}
@@ -205,7 +205,7 @@ traverse_remove_subtree (GNode *node,
g_signal_handlers_disconnect_by_func (node->data,
gantt_model_task_prop_changed_cb,
model);
-
+
g_hash_table_remove (model->priv->task2node, node->data);
return FALSE;
@@ -214,7 +214,7 @@ traverse_remove_subtree (GNode *node,
static void
gantt_model_remove_subtree (PlannerGanttModel *model,
GNode *node)
-{
+{
g_node_unlink (node);
g_node_traverse (node,
@@ -244,9 +244,9 @@ gantt_model_task_removed_cb (MrpProject *project,
node = g_hash_table_lookup (model->priv->task2node, task);
if (!node) {
/* This happens if we are already removed when a parent was
- * removed.
+ * removed.
*/
- return;
+ return;
}
value_cache_clear_cache_wbs (model);
@@ -257,16 +257,16 @@ gantt_model_task_removed_cb (MrpProject *project,
g_signal_handlers_disconnect_by_func (task,
gantt_model_task_prop_changed_cb,
model);
-
+
parent_node = node->parent;
-
+
path = gantt_model_get_path_from_node (model, node);
gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path);
has_child_toggled = (g_node_n_children (parent_node) == 1);
gantt_model_remove_subtree (model, node);
-
+
gtk_tree_model_row_deleted (GTK_TREE_MODEL (model), path);
if (has_child_toggled && parent_node->parent != NULL) {
@@ -277,7 +277,7 @@ gantt_model_task_removed_cb (MrpProject *project,
&iter);
gtk_tree_path_free (parent_path);
}
-
+
gtk_tree_path_free (path);
/* Sanity check. */
@@ -302,10 +302,10 @@ gantt_model_reattach_subtasks (GtkTreeModel *tree_model,
GtkTreeIter iter;
gint pos;
gboolean has_child_toggled;
-
+
model = PLANNER_GANTT_MODEL (tree_model);
priv = model->priv;
-
+
parent_node = g_hash_table_lookup (priv->task2node, task);
/* Traverse the subtasks. */
@@ -314,13 +314,13 @@ gantt_model_reattach_subtasks (GtkTreeModel *tree_model,
node = g_hash_table_lookup (priv->task2node, child);
pos = mrp_task_get_position (child);
g_node_insert (parent_node, pos, node);
-
+
has_child_toggled = (g_node_n_children (parent_node) == 1);
-
+
/* Emit has_child_toggled if necessary. */
if (has_child_toggled) {
GtkTreePath *parent_path;
-
+
parent_path = gantt_model_get_path_from_node (model, parent_node);
gantt_model_get_iter (GTK_TREE_MODEL (model), &iter, parent_path);
gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (model),
@@ -328,7 +328,7 @@ gantt_model_reattach_subtasks (GtkTreeModel *tree_model,
&iter);
gtk_tree_path_free (parent_path);
}
-
+
path = planner_gantt_model_get_path_from_task (model, child);
gtk_tree_model_get_iter (tree_model, &iter, path);
gtk_tree_model_row_inserted (tree_model, path, &iter);
@@ -345,7 +345,7 @@ static gboolean
gantt_model_unlink_subtree_cb (GNode *node, gpointer data)
{
g_node_unlink (node);
-
+
return FALSE;
}
@@ -453,7 +453,7 @@ gantt_model_task_notify_cb (MrpTask *task,
strcmp (pspec->name, "work") == 0) {
value_cache_clear (model, task);
}
-
+
path = planner_gantt_model_get_path_from_task (model, task);
gtk_tree_model_get_iter (tree_model, &iter, path);
gtk_tree_model_row_changed (tree_model, path, &iter);
@@ -504,7 +504,7 @@ traverse_setup_tree (MrpTask *task,
g_node_append (node, child_node);
traverse_setup_tree (child_task, child_node);
-
+
child_task = mrp_task_get_next_sibling (child_task);
}
}
@@ -515,7 +515,7 @@ gantt_model_setup_task_tree (PlannerGanttModel *model)
MrpTask *root_task;
GNode *root_node;
- root_task = mrp_project_get_root_task (model->priv->project);
+ root_task = mrp_project_get_root_task (model->priv->project);
root_node = g_node_new (root_task);
traverse_setup_tree (root_task, root_node);
@@ -529,7 +529,7 @@ planner_gantt_model_new (MrpProject *project)
PlannerGanttModel *model;
PlannerGanttModelPriv *priv;
GList *tasks, *l;
-
+
model = PLANNER_GANTT_MODEL (g_object_new (PLANNER_TYPE_GANTT_MODEL, NULL));
priv = model->priv;
@@ -542,13 +542,13 @@ planner_gantt_model_new (MrpProject *project)
-1,
(GNodeTraverseFunc) traverse_insert_task_into_hash,
model);
-
+
g_signal_connect_object (project,
"task-inserted",
G_CALLBACK (gantt_model_task_inserted_cb),
model,
0);
-
+
g_signal_connect_object (project,
"task-removed",
G_CALLBACK (gantt_model_task_removed_cb),
@@ -565,9 +565,9 @@ planner_gantt_model_new (MrpProject *project)
for (l = tasks; l; l = l->next) {
gantt_model_connect_to_task_signals (model, l->data);
}
-
+
g_list_free (tasks);
-
+
return model;
}
@@ -579,7 +579,7 @@ gantt_model_finalize (GObject *object)
g_node_destroy (model->priv->tree);
g_hash_table_destroy (model->priv->task2node);
g_hash_table_destroy (model->priv->task2cache);
-
+
g_free (model->priv);
model->priv = NULL;
@@ -596,7 +596,7 @@ gantt_model_class_init (PlannerGanttModelClass *klass)
object_class = (GObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
-
+
object_class->finalize = gantt_model_finalize;
signals[TASK_ADDED] =
@@ -608,7 +608,7 @@ gantt_model_class_init (PlannerGanttModelClass *klass)
planner_marshal_VOID__OBJECT,
G_TYPE_NONE,
1, MRP_TYPE_TASK);
- signals[TASK_REMOVED] =
+ signals[TASK_REMOVED] =
g_signal_new ("task-removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -651,7 +651,7 @@ gantt_model_get_column_type (GtkTreeModel *tree_model,
case COL_TASK:
return MRP_TYPE_TASK;
case COL_COST:
- return G_TYPE_LONG;
+ return G_TYPE_LONG;
case COL_COMPLETE:
return G_TYPE_INT;
default:
@@ -668,9 +668,9 @@ gantt_model_get_iter (GtkTreeModel *tree_model,
GtkTreeIter parent;
gint *indices;
gint depth, i;
-
+
gantt_model = PLANNER_GANTT_MODEL (tree_model);
-
+
indices = gtk_tree_path_get_indices (path);
depth = gtk_tree_path_get_depth (path);
@@ -701,12 +701,12 @@ gantt_model_get_path_from_node (PlannerGanttModel *model,
GNode *parent;
GNode *child;
gint i = 0;
-
+
g_return_val_if_fail (PLANNER_IS_GANTT_MODEL (model), NULL);
g_return_val_if_fail (node != NULL, NULL);
parent = node->parent;
-
+
if (parent == NULL && node == model->priv->tree) {
return gtk_tree_path_new_root ();
}
@@ -724,7 +724,7 @@ gantt_model_get_path_from_node (PlannerGanttModel *model,
if (path == NULL) {
return NULL;
}
-
+
if (child == NULL) {
gtk_tree_path_free (path);
return NULL;
@@ -743,7 +743,7 @@ gantt_model_get_path_from_node (PlannerGanttModel *model,
gtk_tree_path_free (path);
return NULL;
}
-
+
gtk_tree_path_append_index (path, i);
return path;
@@ -754,7 +754,7 @@ planner_gantt_model_get_path_from_task (PlannerGanttModel *model,
MrpTask *task)
{
GNode *node;
-
+
g_return_val_if_fail (PLANNER_IS_GANTT_MODEL (model), NULL);
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
@@ -763,7 +763,7 @@ planner_gantt_model_get_path_from_task (PlannerGanttModel *model,
if (!node) {
return NULL;
}
-
+
return gantt_model_get_path_from_node (model, node);
}
@@ -772,7 +772,7 @@ gantt_model_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GNode *node;
-
+
g_return_val_if_fail (iter != NULL, NULL);
g_return_val_if_fail (iter->user_data != NULL, NULL);
g_return_val_if_fail (iter->stamp == PLANNER_GANTT_MODEL (tree_model)->stamp, NULL);
@@ -796,7 +796,7 @@ gantt_model_get_value (GtkTreeModel *tree_model,
MrpTaskType type;
const gchar *name;
const gchar *cached_str;
-
+
g_return_if_fail (iter != NULL);
node = iter->user_data;
@@ -806,17 +806,17 @@ gantt_model_get_value (GtkTreeModel *tree_model,
case COL_WBS:
cached_str = value_cache_get_wbs (PLANNER_GANTT_MODEL (tree_model),
task);
-
+
g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, cached_str);
break;
-
+
case COL_NAME:
name = mrp_task_get_name (task);
if (name == NULL) {
name = "";
}
-
+
g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, name);
break;
@@ -830,12 +830,12 @@ gantt_model_get_value (GtkTreeModel *tree_model,
g_value_init (value, G_TYPE_LONG);
g_value_set_long (value, mrp_task_get_finish (task));
break;
-
+
case COL_DURATION:
g_value_init (value, G_TYPE_INT);
g_value_set_int (value, mrp_task_get_duration (task));
break;
-
+
case COL_WORK:
g_value_init (value, G_TYPE_INT);
g_value_set_int (value, mrp_task_get_work (task));
@@ -845,17 +845,17 @@ gantt_model_get_value (GtkTreeModel *tree_model,
t1 = mrp_task_get_finish (task);
t2 = mrp_task_get_latest_finish (task);
project = mrp_object_get_project (MRP_OBJECT (task));
-
+
/* We don't support negative slack */
if (t2 >= t1) {
- /* use summary duration calc since we want to use
+ /* use summary duration calc since we want to use
* the project calendar and ignore resource assignments */
duration = mrp_project_calculate_summary_duration (
project, task, t1, t2);
} else {
duration = 0;
}
-
+
g_value_init (value, G_TYPE_INT);
g_value_set_int (value, duration);
break;
@@ -871,7 +871,7 @@ gantt_model_get_value (GtkTreeModel *tree_model,
case COL_EDITABLE:
type = mrp_task_get_task_type (task);
-
+
g_value_init (value, G_TYPE_BOOLEAN);
if (g_node_n_children (node) > 0) {
g_value_set_boolean (value, FALSE);
@@ -917,7 +917,7 @@ gantt_model_iter_next (GtkTreeModel *tree_model,
iter->user_data = NULL;
return FALSE;
}
-
+
iter->user_data = next;
return TRUE;
}
@@ -937,14 +937,14 @@ gantt_model_iter_children (GtkTreeModel *tree_model,
} else {
node = PLANNER_GANTT_MODEL (tree_model)->priv->tree;
}
-
+
child = g_node_first_child (node);
if (child == NULL) {
iter->user_data = NULL;
return FALSE;
}
-
+
iter->user_data = child;
iter->stamp = PLANNER_GANTT_MODEL (tree_model)->stamp;
return TRUE;
@@ -955,7 +955,7 @@ gantt_model_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GNode *node;
-
+
node = iter->user_data;
return (g_node_n_children (node) > 0);
@@ -989,7 +989,7 @@ gantt_model_iter_nth_child (GtkTreeModel *tree_model,
g_return_val_if_fail (parent_iter == NULL || parent_iter->user_data != NULL, FALSE);
model = PLANNER_GANTT_MODEL (tree_model);
-
+
if (parent_iter == NULL) {
parent = model->priv->tree;
} else {
@@ -1015,9 +1015,9 @@ gantt_model_iter_parent (GtkTreeModel *tree_model,
{
GNode *node_task;
GNode *node_parent;
-
+
node_task = child->user_data;
-
+
node_parent = node_task->parent;
if (node_parent == NULL) {
@@ -1059,7 +1059,7 @@ gantt_model_init (PlannerGanttModel *model)
priv->task2cache = g_hash_table_new_full (NULL, NULL,
NULL,
(GDestroyNotify) value_cache_free);
-
+
do {
model->stamp = g_random_int ();
} while (model->stamp == 0);
@@ -1069,7 +1069,7 @@ MrpProject *
planner_gantt_model_get_project (PlannerGanttModel *model)
{
g_return_val_if_fail (PLANNER_IS_GANTT_MODEL (model), NULL);
-
+
return model->priv->project;
}
@@ -1079,12 +1079,12 @@ planner_gantt_model_get_task (PlannerGanttModel *model,
{
MrpTask *task;
- task = ((GNode *) iter->user_data)->data;
+ task = ((GNode *) iter->user_data)->data;
if (task == NULL) {
/* Shouldn't really happen. */
return NULL;
- } else {
+ } else {
return MRP_TASK (task);
}
}
@@ -1097,13 +1097,13 @@ planner_gantt_model_get_task_from_path (PlannerGanttModel *model,
MrpTask *task = NULL;
g_return_val_if_fail (PLANNER_IS_GANTT_MODEL (model), NULL);
-
+
if (gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path)) {
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
COL_TASK, &task,
-1);
}
-
+
return task;
}
@@ -1143,13 +1143,13 @@ value_cache_get_wbs (PlannerGanttModel *model,
if (!cache->wbs) {
goto update_cache;
}
-
+
if (cache->wbs_stamp != model->priv->wbs_stamp) {
goto update_cache;
}
return cache->wbs;
-
+
update_cache:
string = g_string_sized_new (24);
@@ -1159,15 +1159,15 @@ value_cache_get_wbs (PlannerGanttModel *model,
if (pos != -1) {
g_string_prepend_c (string, '.');
}
-
+
pos = mrp_task_get_position (tmp_task) + 1;
-
+
str = g_strdup_printf ("%d", pos);
g_string_prepend (string, str);
g_free (str);
-
+
tmp_task = mrp_task_get_parent (tmp_task);
-
+
/* Skip the root. */
if (mrp_task_get_parent (tmp_task) == NULL)
break;
@@ -1177,7 +1177,7 @@ value_cache_get_wbs (PlannerGanttModel *model,
cache->wbs = g_string_free (string, FALSE);
cache->wbs_stamp = model->priv->wbs_stamp;
-
+
return cache->wbs;
}
@@ -1205,7 +1205,7 @@ value_cache_get (PlannerGanttModel *model,
g_hash_table_insert (model->priv->task2cache,
task,
cache);
- }
+ }
return cache;
}
diff --git a/src/planner-gantt-print.c b/src/planner-gantt-print.c
index d8f1ffb..fe117a9 100644
--- a/src/planner-gantt-print.c
+++ b/src/planner-gantt-print.c
@@ -56,20 +56,20 @@ struct _PlannerGanttPrintData {
/* Used to get the visible (expanded) tasks. */
GtkTreeView *tree_view;
-
+
/* Settings. */
gboolean show_critical;
gint level;
-
+
MrpTimeUnit major_unit;
PlannerScaleFormat major_format;
-
+
MrpTimeUnit minor_unit;
PlannerScaleFormat minor_format;
-
+
gdouble header_height;
-
+
gint tasks_per_page_with_header;
gint tasks_per_page_without_header;
@@ -79,25 +79,25 @@ struct _PlannerGanttPrintData {
gdouble tree_x1;
gdouble tree_x2;
-
+
gdouble name_x1;
gdouble name_x2;
gdouble work_x1;
gdouble work_x2;
-
+
gdouble row_height;
GHashTable *task_start_coords;
GHashTable *task_finish_coords;
-
+
PangoFontDescription *font;
PangoFontDescription *font_bold;
GList *tasks;
gdouble f;
-
+
/* Summary drawing. */
gdouble summary_height;
gdouble summary_thick;
@@ -109,7 +109,7 @@ struct _PlannerGanttPrintData {
/* Relation arrow drawing. */
gdouble arrow_width;
gdouble arrow_height;
-
+
/* Printed time span. */
mrptime start;
mrptime finish;
@@ -144,7 +144,7 @@ typedef enum {
SUMMARY_MIDDLE,
MILESTONE,
-
+
RELATION_HORIZ,
RELATION_VERT,
RELATION_ARROW_DOWN,
@@ -189,7 +189,7 @@ print_table_header (PlannerGanttPrintData *data)
planner_print_job_show_clipped (data->job,
x, y,
_("Name"),
- data->name_x1 + data->job->x_pad, y - data->row_height,
+ data->name_x1 + data->job->x_pad, y - data->row_height,
data->name_x2 - data->job->x_pad, y + data->row_height);
x = data->work_x1 + data->job->x_pad;
@@ -197,7 +197,7 @@ print_table_header (PlannerGanttPrintData *data)
planner_print_job_show_clipped (data->job,
x, y,
_("Work"),
- data->work_x1 + data->job->x_pad, 0,
+ data->work_x1 + data->job->x_pad, 0,
data->work_x2 - data->job->x_pad, y + data->row_height);
planner_print_job_set_font_regular (data->job);
@@ -221,16 +221,16 @@ print_table_tasks (PlannerGanttPrintData *data,
} else {
last = first + data->tasks_per_page_without_header;
}
-
+
l = g_list_nth (tasks, first);
to = g_list_nth (tasks, last);
i = 1;
cairo_set_line_width (data->job->cr, THIN_LINE_WIDTH);
-
+
while (l && l != to) {
ptask = l->data;
-
+
g_object_get (ptask->task,
"name", &str,
"work", &work,
@@ -244,7 +244,7 @@ print_table_tasks (PlannerGanttPrintData *data,
x = data->name_x1 + data->job->x_pad + ptask->depth * INDENT_FACTOR * data->job->x_pad;
y = i * data->row_height;
-
+
if (header) {
y += data->header_height;
}
@@ -252,18 +252,18 @@ print_table_tasks (PlannerGanttPrintData *data,
planner_print_job_show_clipped (data->job,
x, y - data->row_height / 4,
str,
- data->name_x1 + data->job->x_pad, y - data->row_height,
+ data->name_x1 + data->job->x_pad, y - data->row_height,
data->name_x2 - data->job->x_pad, y);
g_free (str);
-
+
x = data->work_x1 + data->job->x_pad;
-
+
str = planner_format_duration (data->project, work);
planner_print_job_show_clipped (data->job,
x, y - data->row_height / 4,
str,
- data->work_x1 + data->job->x_pad, y - data->row_height,
+ data->work_x1 + data->job->x_pad, y - data->row_height,
data->work_x2 - data->job->x_pad, y);
g_free (str);
@@ -309,7 +309,7 @@ print_time_header (PlannerGanttPrintData *data,
x = x1;
y = y2 - data->row_height / 4;
- planner_print_job_set_font_regular (data->job);
+ planner_print_job_set_font_regular (data->job);
t = mrp_time_align_prev (start, data->major_unit);
width = (mrp_time_align_next (t, data->major_unit) - t) / data->f;
@@ -323,23 +323,23 @@ print_time_header (PlannerGanttPrintData *data,
planner_print_job_lineto (data->job, x, y2);
cairo_stroke (data->job->cr);
}
-
+
str = planner_scale_format_time (t, data->major_unit, data->major_format);
-
+
planner_print_job_show_clipped (data->job,
x + data->job->x_pad, y,
str,
- MAX (x, x1), y1,
+ MAX (x, x1), y1,
x + width, y2);
-
+
g_free (str);
}
-
+
t = mrp_time_align_next (t, data->major_unit);
}
/* Minor scale. */
- x = x1;
+ x = x1;
y = y3 - data->row_height / 4;
t = mrp_time_align_prev (start, data->minor_unit);
@@ -354,18 +354,18 @@ print_time_header (PlannerGanttPrintData *data,
planner_print_job_lineto (data->job, x, y3);
cairo_stroke (data->job->cr);
}
-
+
str = planner_scale_format_time (t, data->minor_unit, data->minor_format);
-
+
planner_print_job_show_clipped (data->job,
x + data->job->x_pad, y,
str,
- MAX (x, x1), y2,
+ MAX (x, x1), y2,
x + width, y3);
-
+
g_free (str);
}
-
+
t = mrp_time_align_next (t, data->minor_unit);
}
}
@@ -392,10 +392,10 @@ foreach_visible_task (GtkTreeModel *model,
if (gtk_tree_path_get_depth (path) == 1 ||
gtk_tree_view_row_expanded (fvd->tree_view, parent_path)) {
gtk_tree_model_get (model,
- iter,
+ iter,
COL_TASK, &task,
-1);
-
+
ptask = g_new0 (PrintTask, 1);
ptask->task = task;
ptask->depth = gtk_tree_path_get_depth (path);
@@ -403,7 +403,7 @@ foreach_visible_task (GtkTreeModel *model,
fvd->list = g_list_prepend (fvd->list, ptask);
}
gtk_tree_path_free (parent_path);
-
+
return FALSE;
}
@@ -417,7 +417,7 @@ gantt_print_get_visible_tasks (PlannerGanttPrintData *data)
fvd.list = NULL;
fvd.tree_view = data->tree_view;
-
+
gtk_tree_model_foreach (model,
foreach_visible_task,
&fvd);
@@ -433,7 +433,7 @@ gantt_print_free_print_tasks (GList *tasks)
for (l = tasks; l; l = l->next) {
g_free (l->data);
}
-}
+}
static GList *
gantt_print_get_relations (PlannerGanttPrintData *data)
@@ -445,7 +445,7 @@ gantt_print_get_relations (PlannerGanttPrintData *data)
tasks = mrp_project_get_all_tasks (data->project);
for (l = tasks; l; l = l->next) {
predecessors = mrp_task_get_predecessor_relations (l->data);
-
+
for (p = predecessors; p; p = p->next) {
relations = g_list_prepend (relations, p->data);
}
@@ -465,7 +465,7 @@ gantt_print_task (PlannerGanttPrintData *data, Element *element)
planner_print_job_lineto (data->job, element->x2, element->y2);
planner_print_job_lineto (data->job, element->x1, element->y2);
cairo_close_path (data->job->cr);
-
+
cairo_save (data->job->cr);
if (data->show_critical && element->is_critical) {
@@ -487,7 +487,7 @@ gantt_print_task (PlannerGanttPrintData *data, Element *element)
gdouble pad;
pad = (element->y2 - element->y1) * 0.25;
-
+
cairo_save (data->job->cr);
cairo_new_path (data->job->cr);
@@ -496,10 +496,10 @@ gantt_print_task (PlannerGanttPrintData *data, Element *element)
planner_print_job_lineto (data->job, element->x_complete, element->y2 - pad);
planner_print_job_lineto (data->job, element->x1, element->y2 - pad);
cairo_close_path (data->job->cr);
-
+
cairo_set_source_rgb (data->job->cr, 135/255.0, 135/255.0, 135/255.0);
cairo_fill (data->job->cr);
-
+
cairo_restore (data->job->cr);
}
}
@@ -529,20 +529,20 @@ gantt_print_get_allocated_resources_string (PlannerGanttPrintData *data,
/* Use the resource short_name in preference to the resource
* name.
*/
- g_object_get (resource,
- "short_name", &name,
+ g_object_get (resource,
+ "short_name", &name,
NULL);
-
+
if (name && name[0] == 0) {
g_free (name);
- g_object_get (resource,
- "name", &name,
+ g_object_get (resource,
+ "name", &name,
NULL);
-
+
if (name && name[0] == 0) {
g_free (name);
-
+
name = g_strdup (_("Unnamed"));
}
}
@@ -553,12 +553,12 @@ gantt_print_get_allocated_resources_string (PlannerGanttPrintData *data,
} else {
name_unit = name;
}
-
+
if (!text) { /* First resource */
text = name_unit;
continue;
}
-
+
tmp_str = g_strdup_printf ("%s, %s", text, name_unit);
g_free (text);
@@ -574,7 +574,7 @@ gantt_print_get_allocated_resources_string (PlannerGanttPrintData *data,
if (width) {
*width = w;
}
-
+
if (str) {
*str = text;
} else {
@@ -597,7 +597,7 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
/* Fourth pass, generate pages. */
col = page_nr % data->cols_of_pages;
row = page_nr / data->cols_of_pages;
-
+
x2 = data->job->width;
planner_print_job_begin_next_page (data->job);
@@ -605,7 +605,7 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
if (row == 0) {
first_task = 0;
} else {
- first_task = data->tasks_per_page_with_header +
+ first_task = data->tasks_per_page_with_header +
data->tasks_per_page_without_header * (row - 1);
}
@@ -615,7 +615,7 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
t2 = data->second_column_start;
cairo_set_line_width (data->job->cr, THIN_LINE_WIDTH);
-
+
planner_print_job_moveto (data->job,
data->tree_x2,
0);
@@ -623,7 +623,7 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
data->tree_x2,
data->job->height);
cairo_stroke (data->job->cr);
-
+
planner_print_job_moveto (data->job,
data->name_x2,
0);
@@ -631,7 +631,7 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
data->name_x2,
data->job->height);
cairo_stroke (data->job->cr);
-
+
print_table_tasks (data,
row == 0,
data->tasks,
@@ -645,23 +645,23 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
page = GET_PAGE (data, row, col);
for (l = page->background_elements; l; l = l->next) {
gdouble dashes[] = { 4, 4 };
-
+
element = l->data;
-
+
switch (element->type) {
case TIMELINE:
cairo_new_path (data->job->cr);
cairo_set_source_rgb (data->job->cr, 150/255.0, 150/255.0, 249/255.0);
-
+
cairo_set_dash (data->job->cr, dashes, 2, 0);
-
+
cairo_set_line_width (data->job->cr, 1);
planner_print_job_moveto (data->job, element->x1, element->y1);
planner_print_job_lineto (data->job, element->x1, element->y2);
cairo_stroke (data->job->cr);
-
+
cairo_set_dash (data->job->cr, NULL, 0, 0);
-
+
break;
case SHADE:
cairo_new_path (data->job->cr);
@@ -670,10 +670,10 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
planner_print_job_lineto (data->job, element->x2, element->y2);
planner_print_job_lineto (data->job, element->x1, element->y2);
cairo_close_path (data->job->cr);
-
+
cairo_set_source_rgb (data->job->cr, 249/255.0, 249/255.0, 249/255.0);
cairo_fill (data->job->cr);
-
+
cairo_set_line_width (data->job->cr, THIN_LINE_WIDTH);
cairo_set_source_rgb (data->job->cr, 150/255.0, 150/255.0, 150/255.0);
planner_print_job_moveto (data->job, element->x1, element->y1);
@@ -684,21 +684,21 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
break;
}
}
-
+
cairo_set_source_rgb (data->job->cr, 0, 0, 0);
-
+
if (row == 0) {
print_time_header (data, x1, x2, t1, t2);
if (col == 0) {
print_table_header (data);
}
}
-
+
for (l = page->elements; l; l = l->next) {
element = l->data;
-
+
cairo_set_source_rgb (data->job->cr, 0, 0, 0);
-
+
switch (element->type) {
case TASK_LEFT:
case TASK_RIGHT:
@@ -718,7 +718,7 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
element->y1 + data->summary_thick);
cairo_close_path (data->job->cr);
cairo_fill (data->job->cr);
-
+
planner_print_job_moveto (data->job,
element->x2,
element->y1 + 2 * data->summary_thick);
@@ -746,7 +746,7 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
element->y1 + data->summary_thick);
cairo_close_path (data->job->cr);
cairo_fill (data->job->cr);
-
+
planner_print_job_moveto (data->job,
element->x2,
element->y1 + 2 * data->summary_thick);
@@ -774,7 +774,7 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
element->y1 + data->summary_thick);
cairo_close_path (data->job->cr);
cairo_fill (data->job->cr);
-
+
planner_print_job_moveto (data->job,
element->x2,
element->y1 + data->summary_thick);
@@ -786,7 +786,7 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
element->y1 + data->summary_thick);
cairo_close_path (data->job->cr);
cairo_fill (data->job->cr);
-
+
planner_print_job_moveto (data->job,
element->x2,
element->y1 + 2 * data->summary_thick);
@@ -883,7 +883,7 @@ planner_gantt_print_do (PlannerGanttPrintData *data, gint page_nr)
break;
}
}
-
+
planner_print_job_finish_page (data->job, TRUE);
}
@@ -932,7 +932,7 @@ planner_gantt_print_data_new (PlannerView *view,
data->show_critical = show_critical;
data->level = level;
-
+
/* Note: This looks hackish, but it's more or less the same equation
* used for the zoom level in the gantt chart, which actually is
* calculated to have a "good feel" :).
@@ -950,13 +950,13 @@ planner_gantt_print_data_new (PlannerView *view,
/* Start and finish of the project. */
data->start = mrp_project_get_project_start (data->project);
-
+
tasks = gantt_print_get_visible_tasks (data);
data->tasks = tasks;
num_tasks = g_list_length (tasks);
data->finish = data->start;
-
+
/* Go through the tasks and get the end time by checking the right-most
* resource label we will print.
*/
@@ -967,7 +967,7 @@ planner_gantt_print_data_new (PlannerView *view,
mrptime finish;
gdouble width;
gdouble name_width;
-
+
g_object_get (task,
"name", &name,
"finish", &finish,
@@ -975,7 +975,7 @@ planner_gantt_print_data_new (PlannerView *view,
ext = planner_print_job_get_extents(data->job, name);
name_width = ext + ptask->depth * INDENT_FACTOR * data->job->x_pad;
-
+
if (max_name_width < name_width) {
max_name_width = name_width;
}
@@ -986,12 +986,12 @@ planner_gantt_print_data_new (PlannerView *view,
g_free (name);
}
-
+
/* TODO: figure out why the width of WW and WORKWO is significant */
data->name_x1 = 0;
ext = planner_print_job_get_extents (data->job, "WW");
data->name_x2 = data->name_x1 + max_name_width + ext;
-
+
data->work_x1 = data->name_x2;
ext = planner_print_job_get_extents (data->job, "WORKWO");
data->work_x2 = data->work_x1 + ext;
@@ -1002,9 +1002,9 @@ planner_gantt_print_data_new (PlannerView *view,
data->second_column_start = data->start + (data->job->width - (data->tree_x2 - data->tree_x1)) * data->f;
data->row_height = 2 * planner_print_job_get_font_height (job);
-
+
data->header_height = 2 * data->row_height + data->row_height / 4;
-
+
/* Calculate drawing "constants". */
data->summary_height = 0.24 * data->row_height;
data->summary_thick = 0.07 * data->row_height;
@@ -1012,36 +1012,36 @@ planner_gantt_print_data_new (PlannerView *view,
data->milestone_size = 0.25 * data->row_height;
data->arrow_height = 0.24 * data->row_height;
data->arrow_width = 0.11 * data->row_height;
-
+
if (num_tasks > 0) {
data->tasks_per_page_without_header = data->job->height / data->row_height;
data->tasks_per_page_with_header = (data->job->height - data->header_height) /
data->row_height;
-
+
data->cols_of_pages = ceil (((data->finish - data->start) /
data->f + data->tree_x2 - data->tree_x1) /
data->job->width);
-
+
data->rows_of_pages = ceil ((num_tasks * data->row_height + data->header_height) /
(data->job->height - data->row_height));
-
+
if (data->tasks_per_page_without_header * (data->rows_of_pages - 2) +
data->tasks_per_page_with_header >= num_tasks) {
data->rows_of_pages--;
}
-
+
data->cols_of_pages = MAX (1, data->cols_of_pages);
data->rows_of_pages = MAX (1, data->rows_of_pages);
-
+
data->pages = g_new0 (Page, data->cols_of_pages * data->rows_of_pages);
}
calendar = mrp_project_get_calendar (data->project);
-
+
num_tasks = g_list_length (data->tasks);
-
+
current_time = mrp_time_current_time();
/* Go through all tasks in a first pass and layout them so that we know
@@ -1060,13 +1060,13 @@ planner_gantt_print_data_new (PlannerView *view,
y0 = 0;
tasks_on_this_page = data->tasks_per_page_without_header;
}
-
+
x1 = data->tree_x2;
/* Loop through the tasks on this row of pages. */
for (i = 0; i < tasks_on_this_page; i++) {
ptask = l->data;
-
+
start = mrp_task_get_work_start (ptask->task);
finish = mrp_task_get_finish (ptask->task);
complete = start + (finish - start) *
@@ -1083,7 +1083,7 @@ planner_gantt_print_data_new (PlannerView *view,
if (!is_summary && type == MRP_TASK_TYPE_MILESTONE) {
finish = start;
}
-
+
d(g_print ("%s: ", name));
g_free (name);
@@ -1093,7 +1093,7 @@ planner_gantt_print_data_new (PlannerView *view,
y1 = y0 + data->row_height * (i + 0.25);
y2 = y1 + 0.5 * data->row_height;
-
+
/* Loop through the columns that this task covers. */
while (t1 <= finish) {
if (col == 0) {
@@ -1110,11 +1110,11 @@ planner_gantt_print_data_new (PlannerView *view,
element->y1 = y1;
element->y2 = y2;
element->is_critical = is_critical;
-
+
/* Identify the cases: only left-most part on
* page, only right-most part, the whole task,
* or only the mid-section.
- */
+ */
if (start >= t1 && start <= t2 && finish > t2) {
/* Left */
d(g_print ("left "));
@@ -1127,7 +1127,7 @@ planner_gantt_print_data_new (PlannerView *view,
} else {
element->type = TASK_LEFT;
}
-
+
element->x1 = x0 + (start - t1) / data->f;
element->x2 = data->job->width;
element->x_complete = x0 + (complete - t1) / data->f;
@@ -1145,7 +1145,7 @@ planner_gantt_print_data_new (PlannerView *view,
} else {
element->type = TASK_RIGHT;
}
-
+
element->x1 = x0;
element->x2 = x0 + (finish - t1) / data->f;
element->x_complete = x0 + (complete - t1) / data->f;
@@ -1163,7 +1163,7 @@ planner_gantt_print_data_new (PlannerView *view,
} else {
element->type = TASK_WHOLE;
}
-
+
element->x1 = x0 + (start - t1) / data->f;
element->x2 = x0 + (finish - t1) / data->f;
element->x_complete = x0 + (complete - t1) / data->f;
@@ -1181,7 +1181,7 @@ planner_gantt_print_data_new (PlannerView *view,
} else {
element->type = TASK_MIDDLE;
}
-
+
element->x1 = x0;
element->x2 = data->job->width;
@@ -1208,7 +1208,7 @@ planner_gantt_print_data_new (PlannerView *view,
task_coord->x = element->x1;
task_coord->y = y1 - (y2 - y1) / 2;
-
+
g_hash_table_insert (data->task_start_coords,
ptask->task,
task_coord);
@@ -1216,7 +1216,7 @@ planner_gantt_print_data_new (PlannerView *view,
default:
break;
}
-
+
switch (element->type) {
case TASK_WHOLE:
case TASK_RIGHT:
@@ -1226,10 +1226,10 @@ planner_gantt_print_data_new (PlannerView *view,
task_coord = g_new0 (TaskCoord, 1);
task_coord->row = row;
task_coord->col = col;
-
+
task_coord->x = element->x2;
task_coord->y = y1 + (y2 - y1) / 2;
-
+
g_hash_table_insert (data->task_finish_coords,
ptask->task,
task_coord);
@@ -1241,7 +1241,7 @@ planner_gantt_print_data_new (PlannerView *view,
page = GET_PAGE (data, row, col);
page->elements = g_list_prepend (page->elements, element);
}
-
+
t1 = t2;
col++;
}
@@ -1275,7 +1275,7 @@ planner_gantt_print_data_new (PlannerView *view,
}
fail:
-
+
l = l->next;
if (!l) {
break;
@@ -1306,7 +1306,7 @@ planner_gantt_print_data_new (PlannerView *view,
if (!pre_coord || !suc_coord) {
continue;
}
-
+
element = g_new0 (Element, 1);
element->x1 = suc_coord->x;
@@ -1341,9 +1341,9 @@ planner_gantt_print_data_new (PlannerView *view,
element->x1 = data->tree_x2;
} else {
element->x1 = 0;
- }
+ }
}
-
+
if (col == suc_coord->col) {
element->x2 = suc_coord->x;
} else {
@@ -1351,7 +1351,7 @@ planner_gantt_print_data_new (PlannerView *view,
}
element->y1 = pre_coord->y;
-
+
page = GET_PAGE (data, row, col);
page->elements = g_list_prepend (page->elements, element);
}
@@ -1366,11 +1366,11 @@ planner_gantt_print_data_new (PlannerView *view,
} else {
top = 0;
}
-
+
if (row == pre_coord->row) {
element->y1 = pre_coord->y;
} else {
- if (pre_coord->row <= suc_coord->row) {
+ if (pre_coord->row <= suc_coord->row) {
element->y1 = top;
} else {
element->y1 = data->job->height;
@@ -1380,13 +1380,13 @@ planner_gantt_print_data_new (PlannerView *view,
if (row == suc_coord->row) {
element->y2 = suc_coord->y + data->row_height / 2;
} else {
- if (pre_coord->row <= suc_coord->row) {
+ if (pre_coord->row <= suc_coord->row) {
element->y2 = data->job->height;
} else {
element->y2 = top;
}
}
-
+
page = GET_PAGE (data, row, suc_coord->col);
page->elements = g_list_prepend (page->elements, element);
}
@@ -1407,7 +1407,7 @@ planner_gantt_print_data_new (PlannerView *view,
for (col = 0; col < data->cols_of_pages; col++) {
mrptime ival_start, ival_end, ival_prev;
-
+
if (col == 0) {
/* Left-most col has the tree. */
x0 = data->tree_x2;
@@ -1416,7 +1416,7 @@ planner_gantt_print_data_new (PlannerView *view,
}
t2 = t0 + (data->job->width - x0) * data->f;
-
+
/* Loop through the days between t0 and t2. */
t1 = mrp_time_align_day(t0);
@@ -1424,11 +1424,11 @@ planner_gantt_print_data_new (PlannerView *view,
gboolean done = FALSE;
day = mrp_calendar_get_day (calendar, t1, TRUE);
-
+
ivals = mrp_calendar_day_get_intervals (calendar, day, TRUE);
ival_prev = t1;
-
+
/* Loop through the non-work intervals for this day */
while (!done)
{
@@ -1448,7 +1448,7 @@ planner_gantt_print_data_new (PlannerView *view,
/* Only consider non-work intervals that are large enough and
* lie (partially) within [t0...t2] */
- if (ival_prev < t2 && ival_start > t0 &&
+ if (ival_prev < t2 && ival_start > t0 &&
planner_scale_conf[data->level].nonworking_limit <= ival_start - ival_prev) {
/* Only draw the part within [t0...t2] */
@@ -1460,7 +1460,7 @@ planner_gantt_print_data_new (PlannerView *view,
element->x1 = x0 + (MAX(t0, ival_prev) - t0) / data->f;
element->x2 = x0 + (MIN(t2, ival_start) - t0) / data->f;
-
+
page = GET_PAGE (data, row, col);
page->background_elements = g_list_prepend (page->background_elements, element);
@@ -1478,16 +1478,16 @@ planner_gantt_print_data_new (PlannerView *view,
element->type = TIMELINE;
element->y1 = data->header_height;
element->y2 = data->job->height;
- element->x1 = x0 + (current_time - t0) / data->f;
+ element->x1 = x0 + (current_time - t0) / data->f;
element->x2 = element->x1;
page = GET_PAGE (data, row, col);
page->background_elements = g_list_prepend (page->background_elements, element);
}
-
+
t0 = t2;
}
}
-
+
return data;
}
@@ -1515,21 +1515,21 @@ void
planner_gantt_print_data_free (PlannerGanttPrintData *data)
{
gint i, num_pages;
-
+
g_return_if_fail (data != NULL);
g_hash_table_destroy (data->task_start_coords);
g_hash_table_destroy (data->task_finish_coords);
-
+
gantt_print_free_print_tasks (data->tasks);
data->tasks = NULL;
num_pages = data->cols_of_pages * data->rows_of_pages;
-
+
for (i = 0; i < num_pages; i++) {
free_page (&data->pages[i]);
}
-
+
g_free (data->pages);
data->pages = NULL;
@@ -1540,6 +1540,6 @@ gint
planner_gantt_print_get_n_pages (PlannerGanttPrintData *data)
{
g_return_val_if_fail (data != NULL, 0);
-
+
return data->cols_of_pages * data->rows_of_pages;
}
diff --git a/src/planner-gantt-row.c b/src/planner-gantt-row.c
index 79d9d17..f4631eb 100644
--- a/src/planner-gantt-row.c
+++ b/src/planner-gantt-row.c
@@ -69,7 +69,7 @@
/* Same gdk_draw_line but with trimmed x1,y1,x2,y2 args. */
#define draw_cut_line(a,b,c,d,e,f) \
- gdk_draw_line ((a), (b), TRSH (c), TRSH (d), TRSH (e), TRSH (f))
+ gdk_draw_line ((a), (b), TRSH (c), TRSH (d), TRSH (e), TRSH (f))
/* Same gdk_draw_layout but with trimmed x,y args. */
#define draw_cut_layout(a,b,c,d,e) \
@@ -139,7 +139,7 @@ struct _PlannerGanttRowPriv {
guint visible : 1;
guint highlight : 1;
-
+
gdouble scale;
gdouble zoom;
@@ -151,11 +151,11 @@ struct _PlannerGanttRowPriv {
* dragging the length of a task.
*/
gdouble x_start;
-
+
gint mouse_over_index;
guint scroll_timeout_id;
-
+
/* Cached values for the geometry of the bar. */
gdouble width;
gdouble height;
@@ -251,26 +251,26 @@ static PlannerCmd *task_cmd_edit_property (PlannerWindow *window,
static GList * gantt_row_get_selected_tasks (GtkTreeSelection *selection);
-static MrpUnitsInterval * mop_get_next_ival (GList **cur,
- gint *is_a_gap,
- GList *start,
+static MrpUnitsInterval * mop_get_next_ival (GList **cur,
+ gint *is_a_gap,
+ GList *start,
MrpUnitsInterval *buf);
-static MrpInterval * mop_get_next_mrp_ival (GList **cur,
- gint *is_a_gap,
- GList *start,
+static MrpInterval * mop_get_next_mrp_ival (GList **cur,
+ gint *is_a_gap,
+ GList *start,
MrpInterval *buf);
static gboolean gantt_draw_tasktime (GdkDrawable *drawable,
GdkGC *gc,
GnomeCanvas *canvas,
- gdouble start_wx,
- gdouble start_wy,
- gdouble end_wx,
- gdouble end_wy,
- gint cy1,
+ gdouble start_wx,
+ gdouble start_wy,
+ gdouble end_wx,
+ gdouble end_wy,
+ gint cy1,
gint cy2,
gint x,
- gint y,
- gboolean is_up,
+ gint y,
+ gboolean is_up,
gchar *colorname);
@@ -315,7 +315,7 @@ planner_gantt_row_get_type (void)
&info,
0);
}
-
+
return type;
}
@@ -336,7 +336,7 @@ gantt_row_class_init (PlannerGanttRowClass *class)
gobject_class->get_property = gantt_row_get_property;
item_class->event = gantt_row_event;
-
+
signals[GEOMETRY_CHANGED] =
g_signal_new ("geometry-changed",
G_TYPE_FROM_CLASS (class),
@@ -346,7 +346,7 @@ gantt_row_class_init (PlannerGanttRowClass *class)
planner_marshal_VOID__DOUBLE_DOUBLE_DOUBLE_DOUBLE,
G_TYPE_NONE, 4,
G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
-
+
signals[VISIBILITY_CHANGED] =
g_signal_new ("visibility-changed",
G_TYPE_FROM_CLASS (class),
@@ -372,7 +372,7 @@ gantt_row_class_init (PlannerGanttRowClass *class)
NULL,
-G_MAXDOUBLE, G_MAXDOUBLE, 7.0,
G_PARAM_WRITABLE));
-
+
g_object_class_install_property
(gobject_class,
PROP_Y,
@@ -400,14 +400,14 @@ gantt_row_class_init (PlannerGanttRowClass *class)
g_param_spec_boolean ("highlight", NULL, NULL,
FALSE,
G_PARAM_READWRITE));
-
+
g_object_class_install_property
(gobject_class,
PROP_MOUSE_OVER_INDEX,
g_param_spec_int ("mouse-over-index", NULL, NULL,
-1, G_MAXINT, -1,
G_PARAM_WRITABLE));
-
+
object_class->destroy = gantt_row_destroy;
item_class->update = gantt_row_update;
@@ -422,10 +422,10 @@ static void
gantt_row_init (PlannerGanttRow *row)
{
PlannerGanttRowPriv *priv;
-
+
row->priv = g_new0 (PlannerGanttRowPriv, 1);
priv = row->priv;
-
+
priv->x = 0.0;
priv->y = 0.0;
priv->width = 0.0;
@@ -457,7 +457,7 @@ gantt_row_destroy (GtkObject *object)
}
g_array_free (priv->resource_widths, FALSE);
-
+
g_free (priv);
row->priv = NULL;
}
@@ -488,7 +488,7 @@ gantt_row_get_bounds (PlannerGanttRow *row,
wy2 = row->priv->y + row->priv->height;
wx2 = MAX (wx2, wx1 + MIN_WIDTH);
-
+
gnome_canvas_item_i2w (item, &wx1, &wy1);
gnome_canvas_item_i2w (item, &wx2, &wy2);
gnome_canvas_w2c (item->canvas, wx1, wy1, &cx1, &cy1);
@@ -518,7 +518,7 @@ recalc_bounds (PlannerGanttRow *row)
old_x = priv->x;
old_x_start = priv->x_start;
old_width = priv->width;
-
+
gantt_row_ensure_layout (row);
pango_layout_get_pixel_size (priv->layout,
@@ -542,13 +542,13 @@ recalc_bounds (PlannerGanttRow *row)
t = mrp_task_get_finish (priv->task);
priv->width = t * priv->scale - priv->x;
}
-
+
t = mrp_task_get_start (priv->task);
priv->x_start = t * priv->scale;
changed = (old_x != priv->x || old_x_start != priv->x_start ||
old_width != priv->width);
-
+
return changed;
}
@@ -566,13 +566,13 @@ gantt_row_set_property (GObject *object,
gdouble tmp_dbl;
gboolean tmp_bool;
gint tmp_int;
-
+
g_return_if_fail (PLANNER_IS_GANTT_ROW (object));
item = GNOME_CANVAS_ITEM (object);
row = PLANNER_GANTT_ROW (object);
priv = row->priv;
-
+
switch (param_id) {
case PROP_SCALE:
tmp_scale = g_value_get_double (value);
@@ -627,7 +627,7 @@ gantt_row_set_property (GObject *object,
G_CALLBACK (gantt_row_notify_cb),
row,
0);
-
+
g_signal_connect_object (priv->task,
"assignment-added",
G_CALLBACK (gantt_row_assignment_added),
@@ -639,7 +639,7 @@ gantt_row_set_property (GObject *object,
G_CALLBACK (gantt_row_assignment_removed),
row,
0);
-
+
gantt_row_connect_all_resources (priv->task, row);
changed = TRUE;
@@ -686,7 +686,7 @@ gantt_row_get_property (GObject *object,
row = PLANNER_GANTT_ROW (object);
priv = row->priv;
-
+
switch (param_id) {
case PROP_SCALE:
g_value_set_double (value, priv->scale);
@@ -748,7 +748,7 @@ gantt_row_update_resources (PlannerGanttRow *row)
priv = row->priv;
task = priv->task;
-
+
g_array_set_size (priv->resource_widths, 0);
/* Measure the spacing between resource names. */
@@ -758,7 +758,7 @@ gantt_row_update_resources (PlannerGanttRow *row)
x = 0;
resources = mrp_task_get_assigned_resources (priv->task);
-
+
for (l = resources; l; l = l->next) {
resource = l->data;
@@ -767,15 +767,15 @@ gantt_row_update_resources (PlannerGanttRow *row)
/* Try short name first. */
name = mrp_resource_get_short_name (resource);
-
+
if (!name || name[0] == 0) {
name = mrp_resource_get_name (resource);
}
-
+
if (!name || name[0] == 0) {
name = _("Unnamed");
}
-
+
g_array_append_val (priv->resource_widths, x);
if (units != 100) {
@@ -788,17 +788,17 @@ gantt_row_update_resources (PlannerGanttRow *row)
pango_layout_get_extents (priv->layout, NULL, &rect);
x += rect.width / PANGO_SCALE;
g_array_append_val (priv->resource_widths, x);
-
+
x += spacing;
-
+
if (text == NULL) { /* First resource */
text = g_strdup_printf ("%s", name_unit);
g_free (name_unit);
continue;
}
-
+
tmp_str = g_strdup_printf ("%s, %s", text, name_unit);
-
+
g_free (text);
g_free (name_unit);
@@ -806,12 +806,12 @@ gantt_row_update_resources (PlannerGanttRow *row)
}
g_list_free (resources);
-
+
if (text == NULL) {
pango_layout_set_text (priv->layout, "", 0);
} else {
pango_layout_set_text (priv->layout, text, -1);
- }
+ }
g_free (text);
}
@@ -846,35 +846,35 @@ gantt_row_realize (GnomeCanvasItem *item)
row = PLANNER_GANTT_ROW (item);
priv = row->priv;
-
+
GNOME_CANVAS_ITEM_CLASS (parent_class)->realize (item);
-
+
if (complete_stipple == NULL) {
complete_stipple = gdk_bitmap_create_from_data (
NULL,
complete_stipple_pattern,
2,
2);
-
+
g_object_add_weak_pointer (G_OBJECT (complete_stipple),
(gpointer) &complete_stipple);
} else {
g_object_ref (complete_stipple);
}
-
+
if (break_stipple == NULL) {
break_stipple = gdk_bitmap_create_from_data (
NULL,
break_stipple_pattern,
6,
1);
-
+
g_object_add_weak_pointer (G_OBJECT (break_stipple),
(gpointer) &break_stipple);
} else {
g_object_ref (break_stipple);
}
-
+
priv->complete_gc = gdk_gc_new (item->canvas->layout.bin_window);
gdk_gc_set_stipple (priv->complete_gc, complete_stipple);
gdk_gc_set_fill (priv->complete_gc, GDK_STIPPLED);
@@ -958,7 +958,7 @@ static MrpUnitsInterval *mop_get_next_ival(GList **cur, gint *is_a_gap, GList *s
{
MrpUnitsInterval *cur_ival;
gint last_end, md;
-
+
if (start) {
*cur = start;
cur_ival = start->data;
@@ -969,9 +969,9 @@ static MrpUnitsInterval *mop_get_next_ival(GList **cur, gint *is_a_gap, GList *s
buf->units = 0;
buf->units_full = 0;
buf->res_n = 0;
-
+
*is_a_gap = 1;
-
+
return (buf);
}
else {
@@ -987,14 +987,14 @@ static MrpUnitsInterval *mop_get_next_ival(GList **cur, gint *is_a_gap, GList *s
if (*is_a_gap == 1) { /* last was a gap */
*is_a_gap = 0;
- return (cur_ival);
+ return (cur_ival);
}
else {
if ((*cur)->next != NULL) {
last_end = cur_ival->end;
*cur = (*cur)->next;
cur_ival = (*cur)->data;
-
+
if (last_end < cur_ival->start) { /* another gap */
buf->start = last_end;
buf->end = cur_ival->start;
@@ -1038,8 +1038,8 @@ static MrpInterval *mop_get_next_mrp_ival(GList **cur, gint *is_a_gap, GList *st
{
MrpInterval *cur_ival;
gint last_end, md;
- mrptime cur_start, cur_end;
-
+ mrptime cur_start, cur_end;
+
if (start) {
*cur = start;
cur_ival = start->data;
@@ -1049,7 +1049,7 @@ static MrpInterval *mop_get_next_mrp_ival(GList **cur, gint *is_a_gap, GList *st
if (md > 0) {
mrp_interval_set_absolute (buf, 0, 0, cur_start);
*is_a_gap = 1;
-
+
return (buf);
}
else {
@@ -1066,7 +1066,7 @@ static MrpInterval *mop_get_next_mrp_ival(GList **cur, gint *is_a_gap, GList *st
if (*is_a_gap == 1) { /* last was a gap */
*is_a_gap = 0;
- return (cur_ival);
+ return (cur_ival);
}
else {
if ((*cur)->next != NULL) {
@@ -1074,7 +1074,7 @@ static MrpInterval *mop_get_next_mrp_ival(GList **cur, gint *is_a_gap, GList *st
*cur = (*cur)->next;
cur_ival = (*cur)->data;
mrp_interval_get_absolute (cur_ival, 0, &cur_start, &cur_end);
-
+
if (last_end < cur_start) { /* another gap */
mrp_interval_set_absolute (buf, 0, last_end, cur_start);
@@ -1090,7 +1090,7 @@ static MrpInterval *mop_get_next_mrp_ival(GList **cur, gint *is_a_gap, GList *st
md = cur_end % (24*60*60);
if (md > 0) {
mrp_interval_set_absolute (buf, 0, cur_end, cur_end - md + (24*60*60));
-
+
*is_a_gap = 1;
*cur = NULL;
return (buf);
@@ -1108,11 +1108,11 @@ static MrpInterval *mop_get_next_mrp_ival(GList **cur, gint *is_a_gap, GList *st
static gboolean gantt_draw_tasktime(GdkDrawable *drawable,
GdkGC *gc,
GnomeCanvas *canvas,
- gdouble start_wx, gdouble start_wy,
- gdouble end_wx, gdouble end_wy,
+ gdouble start_wx, gdouble start_wy,
+ gdouble end_wx, gdouble end_wy,
gint cy1, gint cy2,
- gint x, gint y,
- gboolean is_up,
+ gint x, gint y,
+ gboolean is_up,
gchar *colorname)
{
GdkColor color;
@@ -1122,7 +1122,7 @@ static gboolean gantt_draw_tasktime(GdkDrawable *drawable,
gnome_canvas_w2c (canvas, end_wx, end_wy, &ttime_x2, &ttime_y2);
ttime_x1 -= x; ttime_y1 -= y;
ttime_x2 -= x; ttime_y2 -= y;
-
+
if (ttime_x2 > ttime_x1) {
gnome_canvas_get_color (canvas, colorname, &color);
gdk_gc_set_foreground (gc, &color);
@@ -1135,10 +1135,10 @@ static gboolean gantt_draw_tasktime(GdkDrawable *drawable,
ttime_y1,
ttime_x2 - ttime_x1,
cy1 - ttime_y1);
-
+
gnome_canvas_get_color (canvas, "gray40", &color);
gdk_gc_set_foreground (gc, &color);
-
+
draw_cut_line (drawable, gc, ttime_x1, ttime_y1,
ttime_x2-1, ttime_y1);
draw_cut_line (drawable, gc, ttime_x1, ttime_y1,
@@ -1151,23 +1151,23 @@ static gboolean gantt_draw_tasktime(GdkDrawable *drawable,
ttime_x1, cy2+1,
ttime_x2 - ttime_x1,
ttime_y2 - cy2 - 1);
-
+
gnome_canvas_get_color (canvas, "gray40", &color);
gdk_gc_set_foreground (gc, &color);
-
+
draw_cut_line (drawable, gc, ttime_x1, ttime_y2,
ttime_x2-1, ttime_y2);
draw_cut_line (drawable, gc, ttime_x1, cy2+1,
ttime_x1, ttime_y2);
}
-
+
return (TRUE);
}
else {
return (FALSE);
}
}
-
+
static void
gantt_row_draw (GnomeCanvasItem *item,
GdkDrawable *drawable,
@@ -1179,7 +1179,7 @@ gantt_row_draw (GnomeCanvasItem *item,
PlannerGanttRow *row;
PlannerGanttRowPriv *priv;
PlannerGanttChart *chart;
- gdouble i2w_dx;
+ gdouble i2w_dx;
gdouble i2w_dy;
gdouble dx1, dy1, dx2, dy2, dshay1, dshay2;
gint level;
@@ -1197,7 +1197,7 @@ gantt_row_draw (GnomeCanvasItem *item,
#endif
gint rx1, ry1;
gint rx2, ry2;
- gint cx1, cy1, cx2, cy2;
+ gint cx1, cy1, cx2, cy2;
GList *unit_ivals, *cal_ivals, *cur_unit;
GList *cur_cal = NULL;
@@ -1210,7 +1210,7 @@ gantt_row_draw (GnomeCanvasItem *item,
MrpProject *project;
MrpDay *day;
MrpCalendar *calendar;
- mrptime cal_start, cal_end;
+ mrptime cal_start, cal_end;
gboolean is_before_work;
gboolean shadup_is_cached, shadup_draw_it;
gboolean shaddo_is_cached, shaddo_draw_it;
@@ -1265,28 +1265,28 @@ gantt_row_draw (GnomeCanvasItem *item,
/*
NOTES
-
+
w -> world
i -> item
- c -> canvas
-
+ c -> canvas
+
priv->x = t * scale
*/
-
+
/* Get item area in canvas coordinates. */
i2w_dx = 0.0;
i2w_dy = 0.0;
gnome_canvas_item_i2w (item, &i2w_dx, &i2w_dy);
- dx1 = priv->x;
-
+ dx1 = priv->x;
+
dy1 = priv->y + priv->bar_top;
dx2 = priv->x + priv->width;
dy2 = priv->y + priv->bar_bot;
dx2 = MAX (dx2, dx1 + MIN_WIDTH);
-
+
dshay1 = priv->y + 0.08 * priv->height;
dshay2 = priv->y + 0.92 * priv->height;
gnome_canvas_w2c (item->canvas,
@@ -1305,7 +1305,7 @@ gantt_row_draw (GnomeCanvasItem *item,
cy1 -= y;
cx2 -= x;
cy2 -= y;
-
+
if (cy1 >= cy2 || cx1 >= cx2) {
return;
}
@@ -1358,40 +1358,40 @@ gantt_row_draw (GnomeCanvasItem *item,
rx2 - rx1,
cy2 - cy1);
#endif
-
+
/* Start slices drawer */
unit_ivals = mrp_task_get_unit_ivals (priv->task);
ival_subbuf = mrp_interval_new (0,0);
-
+
is_before_work = TRUE;
shadup_is_cached = FALSE;
shaddo_is_cached = FALSE;
workup_is_cached = FALSE;
workdo_is_cached = FALSE;
- for (i = 0, unit_ival = mop_get_next_ival (&cur_unit, &is_a_gap,
+ for (i = 0, unit_ival = mop_get_next_ival (&cur_unit, &is_a_gap,
unit_ivals, &ival_buf)
; unit_ival && (i == 0 || cur_start < finish) ; i++) {
if (i == 0) {
/* first iteration: read the day when start the task */
day_cur = mrp_time_align_day (unit_ival->start);
-
+
/* extract the intervals of the day */
day = mrp_calendar_get_day (calendar, day_cur, TRUE);
cal_ivals = mrp_calendar_day_get_intervals (calendar, day, TRUE);
-
+
if (cal_ivals == NULL) {
mrp_interval_set_absolute (ival_subbuf, 0, 0, (24*60*60));
is_a_subgap = 1;
cal_ival = ival_subbuf;
}
else {
- for (cal_ival = mop_get_next_mrp_ival (&cur_cal, &is_a_subgap,
+ for (cal_ival = mop_get_next_mrp_ival (&cur_cal, &is_a_subgap,
cal_ivals, ival_subbuf) ;
cal_ival ;
- cal_ival = mop_get_next_mrp_ival (&cur_cal, &is_a_subgap,
+ cal_ival = mop_get_next_mrp_ival (&cur_cal, &is_a_subgap,
NULL, ival_subbuf)) {
mrp_interval_get_absolute (cal_ival, day_cur, &cal_start, &cal_end);
-
+
if (cal_end > unit_ival->start) {
break;
}
@@ -1402,14 +1402,14 @@ gantt_row_draw (GnomeCanvasItem *item,
wunits_is_first = TRUE;
}
g_assert (cal_ival != NULL);
-
+
gnome_canvas_w2c (item->canvas, (cur_start * priv->scale)
+ i2w_dx, i2w_dy, &x_start, &y_dumb);
gnome_canvas_w2c (item->canvas, (cur_end * priv->scale)
+ i2w_dx, i2w_dy, &x_end, &y_dumb);
x_start -= x;
x_end -= x;
-
+
if (is_before_work) {
if (unit_ival->units_full == 0) {
goto cont_shadowloop;
@@ -1417,16 +1417,16 @@ gantt_row_draw (GnomeCanvasItem *item,
else {
is_before_work = FALSE;
}
-
+
}
if (display_nonstandard_days) {
shadup_draw_it = FALSE;
shaddo_draw_it = FALSE;
workup_draw_it = FALSE;
workdo_draw_it = FALSE;
-
- if (unit_ival->res_n == 0 && (!is_a_subgap ||
- (is_a_subgap && planner_scale_conf[level].nonworking_limit
+
+ if (unit_ival->res_n == 0 && (!is_a_subgap ||
+ (is_a_subgap && planner_scale_conf[level].nonworking_limit
> cal_end - cal_start))) {
if (shadup_is_cached == FALSE) {
shadup_start = cur_start;
@@ -1435,7 +1435,7 @@ gantt_row_draw (GnomeCanvasItem *item,
}
else {
if (shadup_is_cached == TRUE) {
- if (planner_scale_conf[level].nonworking_limit <=
+ if (planner_scale_conf[level].nonworking_limit <=
cur_start - shadup_start) {
shadup_end = cur_start;
shadup_draw_it = TRUE;
@@ -1443,11 +1443,11 @@ gantt_row_draw (GnomeCanvasItem *item,
shadup_is_cached = FALSE;
}
}
-
- if (unit_ival->res_n < nres && (!is_a_subgap ||
- (is_a_subgap && planner_scale_conf[level].nonworking_limit
+
+ if (unit_ival->res_n < nres && (!is_a_subgap ||
+ (is_a_subgap && planner_scale_conf[level].nonworking_limit
> cal_end - cal_start))) {
-
+
if (shaddo_is_cached == FALSE) {
shaddo_start = cur_start;
shaddo_is_cached = TRUE;
@@ -1455,7 +1455,7 @@ gantt_row_draw (GnomeCanvasItem *item,
}
else {
if (shaddo_is_cached == TRUE) {
- if (planner_scale_conf[level].nonworking_limit <=
+ if (planner_scale_conf[level].nonworking_limit <=
cur_start - shaddo_start) {
shaddo_end = cur_start;
shaddo_draw_it = TRUE;
@@ -1463,9 +1463,9 @@ gantt_row_draw (GnomeCanvasItem *item,
shaddo_is_cached = FALSE;
}
}
-
+
if ((unit_ival->res_n == nres && is_a_subgap) ||
- (unit_ival->res_n == 0 &&
+ (unit_ival->res_n == 0 &&
(cal_start % (24*60*60) == 0) && (cal_end % (24*60*60) == 0) &&
planner_scale_conf[level].nonworking_limit > cur_end - cur_start)) {
if (workup_is_cached == FALSE) {
@@ -1475,7 +1475,7 @@ gantt_row_draw (GnomeCanvasItem *item,
}
else {
if (workup_is_cached == TRUE) {
- if (planner_scale_conf[level].nonworking_limit <=
+ if (planner_scale_conf[level].nonworking_limit <=
cur_start - workup_start) {
workup_end = cur_start;
workup_draw_it = TRUE;
@@ -1483,12 +1483,12 @@ gantt_row_draw (GnomeCanvasItem *item,
workup_is_cached = FALSE;
}
}
-
+
if ((unit_ival->res_n > 0 && is_a_subgap) ||
- (unit_ival->res_n == 0 &&
+ (unit_ival->res_n == 0 &&
(cal_start % (24*60*60) == 0) && (cal_end % (24*60*60) == 0) &&
planner_scale_conf[level].nonworking_limit > cur_end - cur_start)) {
-
+
if (workdo_is_cached == FALSE) {
workdo_start = cur_start;
workdo_is_cached = TRUE;
@@ -1496,7 +1496,7 @@ gantt_row_draw (GnomeCanvasItem *item,
}
else {
if (workdo_is_cached == TRUE) {
- if (planner_scale_conf[level].nonworking_limit <=
+ if (planner_scale_conf[level].nonworking_limit <=
cur_start - workdo_start) {
workdo_end = cur_start;
workdo_draw_it = TRUE;
@@ -1504,17 +1504,17 @@ gantt_row_draw (GnomeCanvasItem *item,
workdo_is_cached = FALSE;
}
}
-
+
/* Show shadow up. */
if (shadup_draw_it ||
- (shadup_is_cached &&
+ (shadup_is_cached &&
((cur_end % (24*60*60)) == 0))) {
if (!shadup_draw_it && ((cur_end % (24*60*60)) == 0)) {
shadup_end = cur_end;
}
- if (planner_scale_conf[level].nonworking_limit <=
+ if (planner_scale_conf[level].nonworking_limit <=
shadup_end - shadup_start) {
-
+
gantt_draw_tasktime (drawable, priv->ttask_gc, item->canvas,
(shadup_start * priv->scale) + i2w_dx,
dshay1 + i2w_dy,
@@ -1525,17 +1525,17 @@ gantt_row_draw (GnomeCanvasItem *item,
shadup_draw_it = FALSE;
shadup_is_cached = FALSE;
}
-
+
/* Show shadow down. */
if (shaddo_draw_it ||
- (shaddo_is_cached &&
+ (shaddo_is_cached &&
((cur_end % (24*60*60)) == 0))) {
if (!shaddo_draw_it && ((cur_end % (24*60*60)) == 0)) {
shaddo_end = cur_end;
}
- if (planner_scale_conf[level].nonworking_limit <=
+ if (planner_scale_conf[level].nonworking_limit <=
shaddo_end - shaddo_start) {
-
+
gantt_draw_tasktime (drawable, priv->ttask_gc, item->canvas,
(shaddo_start * priv->scale) + i2w_dx,
dshay1 + i2w_dy,
@@ -1546,17 +1546,17 @@ gantt_row_draw (GnomeCanvasItem *item,
shaddo_draw_it = FALSE;
shaddo_is_cached = FALSE;
}
-
+
/* Show work up. */
if (workup_draw_it ||
- (workup_is_cached &&
+ (workup_is_cached &&
((cur_end % (24*60*60)) == 0))) {
if (!workup_draw_it && ((cur_end % (24*60*60)) == 0)) {
workup_end = cur_end;
}
- if (planner_scale_conf[level].nonworking_limit <=
+ if (planner_scale_conf[level].nonworking_limit <=
workup_end - workup_start) {
-
+
gantt_draw_tasktime (drawable, priv->ttask_gc, item->canvas,
(workup_start * priv->scale) + i2w_dx,
dshay1 + i2w_dy,
@@ -1567,15 +1567,15 @@ gantt_row_draw (GnomeCanvasItem *item,
workup_draw_it = FALSE;
workup_is_cached = FALSE;
}
-
+
/* Show work down. */
if (workdo_draw_it ||
- (workdo_is_cached &&
+ (workdo_is_cached &&
((cur_end % (24*60*60)) == 0))) {
if (!workdo_draw_it && ((cur_end % (24*60*60)) == 0)) {
workdo_end = cur_end;
}
- if (planner_scale_conf[level].nonworking_limit <=
+ if (planner_scale_conf[level].nonworking_limit <=
workdo_end - workdo_start) {
gantt_draw_tasktime (drawable, priv->ttask_gc, item->canvas,
@@ -1597,14 +1597,14 @@ gantt_row_draw (GnomeCanvasItem *item,
}
else {
if (unit_ival->res_n == 0) { /* It is a nonworking interval. */
- if (planner_scale_conf[level].nonworking_limit <=
- cur_end - cur_start) {
+ if (planner_scale_conf[level].nonworking_limit <=
+ cur_end - cur_start) {
delta = 1.0;
} /* else it use the last selected value */
}
/* It isn't a nonworking interval. */
- else if (planner_scale_conf[level].nonworking_limit <=
- cur_end - cur_start) { /* Visible non working interval. */
+ else if (planner_scale_conf[level].nonworking_limit <=
+ cur_end - cur_start) { /* Visible non working interval. */
delta = 1.0;
}
else { /* use the last selected value */
@@ -1612,17 +1612,17 @@ gantt_row_draw (GnomeCanvasItem *item,
wunits_is_cached = TRUE;
wunits_x_start = x_start;
wunits_draw_it = FALSE;
- }
+ }
}
}
-
+
topy = floor ((cy1 + ((1.0 - (double)delta) * (double)(cy2 - cy1 - 3))) + 0.5);
if (!highlight_critical || !critical) {
gdk_gc_set_foreground (priv->fill_gc, &priv->color_normal);
} else {
gdk_gc_set_foreground (priv->fill_gc, &priv->color_critical);
}
-
+
if (wunits_draw_it) {
if (wunits_is_cached) {
wunits_is_cached = FALSE;
@@ -1630,7 +1630,7 @@ gantt_row_draw (GnomeCanvasItem *item,
else {
wunits_x_start = x_start;
}
-
+
if ((cy2 - topy - 3) > 0) {
draw_cut_rectangle (drawable,
priv->fill_gc,
@@ -1652,21 +1652,21 @@ gantt_row_draw (GnomeCanvasItem *item,
topy - cy1);
}
}
-
+
cont_shadowloop:
if (display_nonstandard_days) {
last_end = cur_end;
}
wunits_is_first = FALSE;
-
+
if (cur_end == unit_ival->end) {
- if ((unit_ival = mop_get_next_ival (&cur_unit, &is_a_gap,
+ if ((unit_ival = mop_get_next_ival (&cur_unit, &is_a_gap,
NULL, &ival_buf)) == NULL) {
- break;
+ break;
}
}
if (cur_end == cal_end) {
- if ((cal_ival = mop_get_next_mrp_ival (&cur_cal, &is_a_subgap,
+ if ((cal_ival = mop_get_next_mrp_ival (&cur_cal, &is_a_subgap,
NULL, ival_subbuf)) == NULL) {
/* End of the day intervals, read next. */
day_cur += (24*60*60);
@@ -1674,7 +1674,7 @@ gantt_row_draw (GnomeCanvasItem *item,
cal_ivals = mrp_calendar_day_get_intervals (calendar, day, TRUE);
if (cal_ivals) {
/* Not empty day. */
- cal_ival = mop_get_next_mrp_ival (&cur_cal, &is_a_subgap,
+ cal_ival = mop_get_next_mrp_ival (&cur_cal, &is_a_subgap,
cal_ivals, ival_subbuf);
}
else {
@@ -1695,12 +1695,12 @@ gantt_row_draw (GnomeCanvasItem *item,
if (display_nonstandard_days) {
/*
H O L Y D A Y S
- */
+ */
/* Show shad up. */
if (shadup_is_cached) {
shadup_end = last_end;
-
+
gantt_draw_tasktime (drawable, priv->ttask_gc, item->canvas,
(shadup_start * priv->scale) + i2w_dx,
dshay1 + i2w_dy,
@@ -1722,13 +1722,13 @@ gantt_row_draw (GnomeCanvasItem *item,
}
/*
- W O R K
- */
+ W O R K
+ */
/* Show work up. */
if (workup_is_cached) {
workup_end = last_end;
-
+
gantt_draw_tasktime (drawable, priv->ttask_gc, item->canvas,
(workup_start * priv->scale) + i2w_dx,
dshay1 + i2w_dy,
@@ -1768,7 +1768,7 @@ gantt_row_draw (GnomeCanvasItem *item,
gnome_canvas_get_color (item->canvas, "black", &color);
gdk_gc_set_foreground (priv->frame_gc, &color);
-
+
if (ival_subbuf) {
mrp_interval_unref (ival_subbuf);
}
@@ -1794,7 +1794,7 @@ gantt_row_draw (GnomeCanvasItem *item,
if (i == 1) {
gnome_canvas_get_color (item->canvas, "indian red", &color);
gdk_gc_set_foreground (priv->frame_gc, &color);
-
+
gdk_gc_set_line_attributes (priv->frame_gc,
0,
GDK_LINE_ON_OFF_DASH,
@@ -1836,7 +1836,7 @@ gantt_row_draw (GnomeCanvasItem *item,
rx1 + 1,
cy2 - 1);
}
-
+
if (!highlight_critical || !critical) {
gdk_gc_set_foreground (priv->fill_gc, &priv->color_normal_dark);
} else {
@@ -1849,7 +1849,7 @@ gantt_row_draw (GnomeCanvasItem *item,
cy2 - 1,
rx2 - 0,
cy2 - 1);
-
+
if (cx2 == rx2) {
draw_cut_line (drawable,
priv->fill_gc,
@@ -1863,14 +1863,14 @@ gantt_row_draw (GnomeCanvasItem *item,
if (i == 1) {
gnome_canvas_get_color (item->canvas, "red", &color);
gdk_gc_set_foreground (priv->frame_gc, &color);
-
+
gdk_gc_set_line_attributes (priv->frame_gc,
0,
GDK_LINE_ON_OFF_DASH,
GDK_CAP_BUTT,
GDK_JOIN_MITER);
}
-#endif
+#endif
if (cx1 == rx1) {
draw_cut_line (drawable, priv->frame_gc,
cx1, cy1, cx1, cy2);
@@ -1879,7 +1879,7 @@ gantt_row_draw (GnomeCanvasItem *item,
draw_cut_line (drawable, priv->frame_gc,
cx2, cy1, cx2, cy2);
}
-
+
#ifdef WITH_SIMPLE_PRIORITY_SCHEDULING
if (i == 1) {
gantt_row_setup_frame_gc (row, !summary && priv->highlight);
@@ -1895,13 +1895,13 @@ gantt_row_draw (GnomeCanvasItem *item,
points[1].x = cx1 + MILESTONE_SIZE + 1;
points[1].y = cy1 + MILESTONE_SIZE + 1;
-
+
points[2].x = cx1;
points[2].y = cy1 + (MILESTONE_SIZE + 1) * 2;
-
+
points[3].x = cx1 - MILESTONE_SIZE;
points[3].y = cy1 + MILESTONE_SIZE + 1;
-
+
gdk_draw_polygon (drawable,
priv->frame_gc,
TRUE,
@@ -1924,7 +1924,7 @@ gantt_row_draw (GnomeCanvasItem *item,
(rx2 >= cx1 && rx2 <= cx1 + SLOPE)) {
points[0].x = cx1;
points[0].y = summary_y + THICKNESS;
-
+
points[1].x = cx1;
points[1].y = summary_y + THICKNESS + HEIGHT - 1;
@@ -1933,7 +1933,7 @@ gantt_row_draw (GnomeCanvasItem *item,
points[3].x = cx1;
points[3].y = summary_y + THICKNESS;
-
+
gdk_draw_polygon (drawable,
priv->frame_gc,
TRUE,
@@ -1945,7 +1945,7 @@ gantt_row_draw (GnomeCanvasItem *item,
(rx2 >= cx2 - SLOPE && rx2 <= cx2)) {
points[0].x = cx2 + 1;
points[0].y = summary_y + THICKNESS;
-
+
points[1].x = cx2 + 1 - SLOPE;
points[1].y = summary_y + THICKNESS;
@@ -1968,11 +1968,11 @@ gantt_row_draw (GnomeCanvasItem *item,
rx2 = MIN (cx2 + TEXT_PADDING + priv->text_width, width);
if (priv->layout != NULL && rx1 < rx2) {
- /* NOTE: cy1 is the pixel coordinate of the top of the bar.
+ /* NOTE: cy1 is the pixel coordinate of the top of the bar.
subtract round(priv->bar_top) to bring us to the top of the row
add priv->height / 2 to get to the center of the row
subtract priv->text_height / 2 to get to the top of the text */
-
+
draw_cut_layout (drawable,
GTK_WIDGET (item->canvas)->style->text_gc[GTK_STATE_NORMAL],
cx2 + TEXT_PADDING,
@@ -1988,10 +1988,10 @@ gantt_row_draw (GnomeCanvasItem *item,
gantt_row_get_resource_by_index (row,
priv->mouse_over_index,
&x1, &x2);
-
+
x1 += cx2 + TEXT_PADDING;
x2 += cx2 + TEXT_PADDING;
-
+
draw_cut_line (drawable,
GTK_WIDGET (item->canvas)->style->text_gc[GTK_STATE_NORMAL],
x1,
@@ -2015,10 +2015,10 @@ gantt_row_point (GnomeCanvasItem *item,
gint text_width;
gdouble x1, y1, x2, y2;
gdouble dx, dy;
-
+
row = PLANNER_GANTT_ROW (item);
priv = row->priv;
-
+
*actual_item = item;
text_width = priv->text_width;
@@ -2030,7 +2030,7 @@ gantt_row_point (GnomeCanvasItem *item,
y1 = priv->y;
x2 = x1 + priv->width + text_width;
y2 = y1 + priv->height;
-
+
if (x > x1 && x < x2 && y > y1 && y < y2) {
return 0.0;
}
@@ -2053,7 +2053,7 @@ gantt_row_point (GnomeCanvasItem *item,
} else {
dy = 0.0;
}
-
+
return sqrt (dx * dx + dy * dy);
}
@@ -2069,7 +2069,7 @@ gantt_row_bounds (GnomeCanvasItem *item,
row = PLANNER_GANTT_ROW (item);
gantt_row_get_bounds (row, x1, y1, x2, y2);
-
+
if (GNOME_CANVAS_ITEM_CLASS (parent_class)->bounds) {
GNOME_CANVAS_ITEM_CLASS (parent_class)->bounds (item, x1, y1, x2, y2);
}
@@ -2090,7 +2090,7 @@ gantt_row_notify_cb (MrpTask *task, GParamSpec *pspec, PlannerGanttRow *row)
strcmp (pspec->name, "percent-complete")) {
return;
}
-
+
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (row));
}
@@ -2098,20 +2098,20 @@ static void
gantt_row_update_assignment_string (PlannerGanttRow *row)
{
gantt_row_update_resources (row);
-
+
recalc_bounds (row);
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (row));
}
-static void
-gantt_row_assignment_added (MrpTask *task,
+static void
+gantt_row_assignment_added (MrpTask *task,
MrpAssignment *assignment,
PlannerGanttRow *row)
{
MrpResource *resource;
-
+
resource = mrp_assignment_get_resource (assignment);
-
+
g_signal_connect_object (resource, "notify::name",
G_CALLBACK (gantt_row_resource_name_changed),
row, 0);
@@ -2123,12 +2123,12 @@ gantt_row_assignment_added (MrpTask *task,
g_signal_connect_object (assignment, "notify::units",
G_CALLBACK (gantt_row_assignment_units_changed),
row, 0);
-
+
gantt_row_update_assignment_string (row);
}
-static void
-gantt_row_assignment_removed (MrpTask *task,
+static void
+gantt_row_assignment_removed (MrpTask *task,
MrpAssignment *assignment,
PlannerGanttRow *row)
{
@@ -2136,18 +2136,18 @@ gantt_row_assignment_removed (MrpTask *task,
resource = mrp_assignment_get_resource (assignment);
- g_signal_handlers_disconnect_by_func (resource,
+ g_signal_handlers_disconnect_by_func (resource,
gantt_row_resource_name_changed,
row);
-
- g_signal_handlers_disconnect_by_func (resource,
+
+ g_signal_handlers_disconnect_by_func (resource,
gantt_row_resource_short_name_changed,
row);
-
- g_signal_handlers_disconnect_by_func (assignment,
+
+ g_signal_handlers_disconnect_by_func (assignment,
gantt_row_assignment_units_changed,
row);
-
+
gantt_row_update_assignment_string (row);
}
@@ -2186,11 +2186,11 @@ planner_gantt_row_get_geometry (PlannerGanttRow *row,
gdouble *y2)
{
PlannerGanttRowPriv *priv;
-
+
g_return_if_fail (PLANNER_IS_GANTT_ROW (row));
priv = row->priv;
-
+
if (x1) {
*x1 = priv->x;
}
@@ -2214,7 +2214,7 @@ planner_gantt_row_set_visible (PlannerGanttRow *row,
if (is_visible == row->priv->visible) {
return;
}
-
+
row->priv->visible = is_visible;
if (is_visible) {
@@ -2228,7 +2228,7 @@ planner_gantt_row_set_visible (PlannerGanttRow *row,
0,
is_visible);
}
-
+
static void
gantt_row_geometry_changed (PlannerGanttRow *row)
{
@@ -2238,7 +2238,7 @@ gantt_row_geometry_changed (PlannerGanttRow *row)
y1 = row->priv->y;
x2 = x1 + row->priv->width;
y2 = y1 + row->priv->height;
-
+
g_signal_emit (row,
signals[GEOMETRY_CHANGED],
0,
@@ -2251,9 +2251,9 @@ gantt_row_connect_all_resources (MrpTask *task, PlannerGanttRow *row)
{
GList *resources, *node;
MrpResource *resource;
-
+
resources = mrp_task_get_assigned_resources (task);
-
+
for (node = resources; node; node = node->next) {
resource = MRP_RESOURCE (node->data);
@@ -2264,7 +2264,7 @@ gantt_row_connect_all_resources (MrpTask *task, PlannerGanttRow *row)
g_signal_connect_object (resource, "notify::short-name",
G_CALLBACK (gantt_row_resource_short_name_changed),
row, 0);
-
+
}
g_list_free (resources);
@@ -2275,16 +2275,16 @@ gantt_row_disconnect_all_resources (MrpTask *task, PlannerGanttRow *row)
{
GList *resources, *node;
MrpResource *resource;
-
+
resources = mrp_task_get_assigned_resources (task);
-
+
for (node = resources; node; node = node->next) {
resource = MRP_RESOURCE (node->data);
-
+
g_signal_handlers_disconnect_by_func (resource,
gantt_row_resource_name_changed,
row);
-
+
g_signal_handlers_disconnect_by_func (resource,
gantt_row_resource_short_name_changed,
row);
@@ -2293,7 +2293,7 @@ gantt_row_disconnect_all_resources (MrpTask *task, PlannerGanttRow *row)
g_list_free (resources);
}
-static gboolean
+static gboolean
gantt_row_drag_item_to_pointer (PlannerGanttRow *row, gboolean scroll)
{
PlannerGanttChart *chart;
@@ -2314,7 +2314,7 @@ gantt_row_drag_item_to_pointer (PlannerGanttRow *row, gboolean scroll)
canvas = GNOME_CANVAS_ITEM (row)->canvas;
chart = g_object_get_data (G_OBJECT (GNOME_CANVAS_ITEM (row)->canvas), "chart");
-
+
/* Get the current mouse position so that we can decide if the pointer
* is inside the viewport.
*/
@@ -2377,26 +2377,26 @@ gantt_row_drag_item_to_pointer (PlannerGanttRow *row, gboolean scroll)
break;
case STATE_DRAG_LINK:
target_item = gnome_canvas_get_item_at (canvas, wx2, wy2);
-
+
drag_points->coords[0] = drag_wx1;
drag_points->coords[1] = drag_wy1;
drag_points->coords[2] = wx2;
drag_points->coords[3] = wy2;
-
+
gnome_canvas_item_set (drag_item,
"points", drag_points,
NULL);
-
+
if (old_target_item && old_target_item != target_item) {
g_object_set (old_target_item,
"highlight",
FALSE,
NULL);
}
-
+
if (target_item && target_item != GNOME_CANVAS_ITEM(row)) {
const gchar *task_name, *target_name;
-
+
g_object_set (target_item,
"highlight",
TRUE,
@@ -2404,14 +2404,14 @@ gantt_row_drag_item_to_pointer (PlannerGanttRow *row, gboolean scroll)
target_name = mrp_task_get_name (PLANNER_GANTT_ROW (target_item)->priv->task);
task_name = mrp_task_get_name (row->priv->task);
-
+
if (target_name == NULL || target_name[0] == 0) {
target_name = _("No name");
}
if (task_name == NULL || task_name[0] == 0) {
task_name = _("No name");
}
-
+
message = g_strdup_printf (_("Make task '%s' a predecessor of '%s'"),
task_name,
target_name);
@@ -2424,7 +2424,7 @@ gantt_row_drag_item_to_pointer (PlannerGanttRow *row, gboolean scroll)
if (target_item == NULL) {
planner_gantt_chart_status_updated (chart, NULL);
}
-
+
old_target_item = target_item;
break;
default:
@@ -2453,7 +2453,7 @@ gantt_row_drag_item_to_pointer (PlannerGanttRow *row, gboolean scroll)
} else {
dy = 0;
}
-
+
if(dx > 0)
{
planner_gantt_chart_reflow_now(chart);
@@ -2482,7 +2482,7 @@ gantt_row_scroll_timeout_cb (PlannerGanttRow *row)
return gantt_row_drag_item_to_pointer(row, TRUE);
}
-static DragSpot
+static DragSpot
get_drag_spot(gdouble x, gdouble y, PlannerGanttRowPriv *priv)
{
gdouble x2 = priv->x + priv->width;
@@ -2541,11 +2541,11 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
gboolean summary;
MrpTaskType type;
DragSpot drag_spot;
-
+
row = PLANNER_GANTT_ROW (item);
priv = row->priv;
canvas_widget = GTK_WIDGET (item->canvas);
-
+
summary = (mrp_task_get_n_children (priv->task) > 0);
type = mrp_task_get_task_type (priv->task);
@@ -2563,22 +2563,22 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
GtkTreeView *tree_view;
GtkTreeIter iter;
GList *tasks;
-
+
chart = g_object_get_data (G_OBJECT (item->canvas), "chart");
tree = planner_gantt_chart_get_view (chart);
gtk_widget_grab_focus (GTK_WIDGET (tree));
-
+
path = planner_gantt_model_get_path_from_task (
PLANNER_GANTT_MODEL (planner_gantt_chart_get_model (chart)),
priv->task);
tree_view = GTK_TREE_VIEW (tree);
-
+
selection = gtk_tree_view_get_selection (tree_view);
gtk_tree_model_get_iter (gtk_tree_view_get_model (tree_view), &iter, path);
if (!gtk_tree_selection_iter_is_selected (selection, &iter)) {
-
+
gtk_tree_selection_unselect_all (selection);
gtk_tree_selection_select_path (selection, path);
planner_task_tree_set_anchor (tree, path);
@@ -2587,17 +2587,17 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
tasks = gantt_row_get_selected_tasks (selection);
planner_task_popup_update_sensitivity (priv->popup_factory, tasks);
g_list_free (tasks);
-
+
gtk_item_factory_popup (priv->popup_factory,
event->button.x_root,
event->button.y_root,
0,
gtk_get_current_event_time ());
-
+
return TRUE;
}
break;
-
+
case 1:
if (priv->state != STATE_NONE) {
break;
@@ -2608,7 +2608,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
if (type != MRP_TASK_TYPE_MILESTONE &&
!summary && drag_spot == DRAG_DURATION_SPOT) {
guint rgba;
-
+
priv->state = STATE_DRAG_DURATION;
wx1 = priv->x;
@@ -2621,7 +2621,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
/* red green blue alpha */
rgba = (0xb7 << 24) | (0xc3 << 16) | (0xc9 << 8) | (127 << 0);
-
+
if (drag_item == NULL) {
drag_item = gnome_canvas_item_new (gnome_canvas_root (item->canvas),
EEL_TYPE_CANVAS_RECT,
@@ -2663,7 +2663,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
/* red green blue alpha */
rgba = (0xb7 << 24) | (0xc3 << 16) | (0xc9 << 8) | (127 << 0);
-
+
if (drag_item == NULL) {
drag_item = gnome_canvas_item_new (gnome_canvas_root (item->canvas),
EEL_TYPE_CANVAS_RECT,
@@ -2709,7 +2709,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
gnome_canvas_item_hide (drag_item);
/* set limits */
- gnome_canvas_get_scroll_region(item->canvas, &drag_item_wx_min,
+ gnome_canvas_get_scroll_region(item->canvas, &drag_item_wx_min,
&drag_item_wy_min,
&drag_item_wx_max,
&drag_item_wy_max);
@@ -2741,13 +2741,13 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
}
g_list_free (resources);
-
+
return TRUE;
} else {
return FALSE;
}
}
-
+
gnome_canvas_item_grab (item,
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
@@ -2779,9 +2779,9 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
"mouse-over-index",
-1,
NULL);
-
+
return TRUE;
-
+
case GDK_MOTION_NOTIFY:
if (event->motion.is_hint) {
gint x, y;
@@ -2793,7 +2793,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
if (!(priv->state & STATE_DRAG_ANY)) {
drag_spot = get_drag_spot(event->button.x, event->button.y, priv);
- if (type != MRP_TASK_TYPE_MILESTONE && !summary &&
+ if (type != MRP_TASK_TYPE_MILESTONE && !summary &&
( (drag_spot == DRAG_DURATION_SPOT) || (drag_spot == DRAG_COMPLETE_SPOT) ) ) {
if(drag_spot == DRAG_DURATION_SPOT) {
cursor = gdk_cursor_new (GDK_RIGHT_SIDE);
@@ -2837,18 +2837,18 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
gantt_row_drag_item_to_pointer (row, FALSE);
}
-
+
break;
-
+
case GDK_BUTTON_RELEASE: {
PlannerTaskTree *tree;
GtkTreePath *path;
GtkTreeSelection *selection;
-
+
if (event->button.button != 1) {
return FALSE;
}
-
+
if (priv->state == STATE_NONE) {
return TRUE;
}
@@ -2859,7 +2859,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
GValue value = { 0 };
project = mrp_object_get_project (MRP_OBJECT (priv->task));
-
+
duration = MAX (0, (event->button.x - priv->x_start) / priv->scale);
/* Snap to quarters. */
@@ -2876,7 +2876,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
g_value_init (&value, G_TYPE_INT);
g_value_set_int (&value, work);
-
+
task_cmd_edit_property (planner_task_tree_get_window (tree),
tree,
priv->task,
@@ -2910,7 +2910,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
task_cmd_edit_property (planner_task_tree_get_window (tree),
tree,
priv->task,
- "percent_complete",
+ "percent_complete",
&value);
if (priv->scroll_timeout_id) {
@@ -2936,21 +2936,21 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
g_source_remove (priv->scroll_timeout_id);
priv->scroll_timeout_id = 0;
}
-
+
gtk_object_destroy (GTK_OBJECT (drag_item));
drag_item = NULL;
-
+
target_item = gnome_canvas_get_item_at (item->canvas,
event->button.x,
event->button.y);
-
+
if (target_item && target_item != item) {
GError *error = NULL;
PlannerCmd *cmd;
PlannerGanttChart *chart;
PlannerTaskTree *tree;
PlannerWindow *main_window;
-
+
task = priv->task;
target_task = PLANNER_GANTT_ROW (target_item)->priv->task;
@@ -2964,12 +2964,12 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
MRP_RELATION_FS,
0,
&error);
-
+
if (!cmd) {
GtkWidget *dialog;
gnome_canvas_item_ungrab (item, event->button.time);
-
+
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
@@ -2977,31 +2977,31 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
"%s", error->message);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
- g_error_free (error);
+ g_error_free (error);
}
}
-
+
chart = g_object_get_data (G_OBJECT (item->canvas), "chart");
-
+
planner_gantt_chart_status_updated (chart, NULL);
}
- /* We're done, reset the cursor and state, ungrab pointer. */
+ /* We're done, reset the cursor and state, ungrab pointer. */
gdk_window_set_cursor (canvas_widget->window, NULL);
-
+
gnome_canvas_item_ungrab (item, event->button.time);
-
+
/* Select the clicked on task in the treeview */
chart = g_object_get_data (G_OBJECT (item->canvas), "chart");
tree = planner_gantt_chart_get_view (chart);
gtk_widget_grab_focus (GTK_WIDGET (tree));
-
+
path = planner_gantt_model_get_path_from_task (
PLANNER_GANTT_MODEL (planner_gantt_chart_get_model (chart)),
priv->task);
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
-
+
if (!(event->button.state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK))) {
gtk_tree_selection_unselect_all (selection);
gtk_tree_selection_select_path (selection, path);
@@ -3020,7 +3020,7 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
GtkTreePath *anchor;
anchor = planner_task_tree_get_anchor (tree);
-
+
if (anchor) {
gtk_tree_selection_unselect_all (selection);
gtk_tree_selection_select_range(selection, anchor, path);
@@ -3032,12 +3032,12 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
planner_task_tree_set_anchor (tree, path);
}
}
-
+
priv->state = STATE_NONE;
-
+
return TRUE;
}
-
+
case GDK_2BUTTON_PRESS:
if (event->button.button == 1) {
drag_spot = get_drag_spot(event->button.x, event->button.y, priv);
@@ -3045,34 +3045,34 @@ gantt_row_event (GnomeCanvasItem *item, GdkEvent *event)
PlannerTaskTree *tree;
GtkTreePath *path;
GtkTreeSelection *selection;
-
+
chart = g_object_get_data (G_OBJECT (item->canvas), "chart");
tree = planner_gantt_chart_get_view (chart);
gtk_widget_grab_focus (GTK_WIDGET (tree));
-
+
path = planner_gantt_model_get_path_from_task (
PLANNER_GANTT_MODEL (planner_gantt_chart_get_model (chart)),
priv->task);
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
-
+
gtk_tree_selection_unselect_all (selection);
gtk_tree_selection_select_path (selection, path);
planner_task_tree_set_anchor(tree, path);
-
+
planner_task_tree_edit_task (tree, PLANNER_TASK_DIALOG_PAGE_GENERAL);
-
+
return TRUE;
}
}
-
+
default:
break;
}
return FALSE;
}
-
+
static void
eel_gtk_adjustment_set_value (GtkAdjustment *adjustment,
float value)
@@ -3080,7 +3080,7 @@ eel_gtk_adjustment_set_value (GtkAdjustment *adjustment,
float upper_page_start, clamped_value;
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
-
+
upper_page_start = MAX (adjustment->upper - adjustment->page_size,
adjustment->lower);
clamped_value = CLAMP (value, adjustment->lower, upper_page_start);
@@ -3107,7 +3107,7 @@ gantt_row_canvas_scroll (GtkWidget *widget,
*/
old_h_value = hadj->value;
old_v_value = vadj->value;
-
+
eel_gtk_adjustment_set_value (hadj, hadj->value + delta_x);
eel_gtk_adjustment_set_value (vadj, vadj->value + delta_y);
@@ -3128,7 +3128,7 @@ gantt_row_get_resource_index_at (PlannerGanttRow *row,
offset = priv->x + priv->width + TEXT_PADDING;
x -= offset;
-
+
len = priv->resource_widths->len;
for (i = 0; i < len; i += 2) {
left = g_array_index (priv->resource_widths, gint, i);
@@ -3138,7 +3138,7 @@ gantt_row_get_resource_index_at (PlannerGanttRow *row,
return i / 2;
}
}
-
+
return -1;
}
@@ -3159,11 +3159,11 @@ gantt_row_get_resource_by_index (PlannerGanttRow *row,
priv = row->priv;
index *= 2;
-
+
if (index >= priv->resource_widths->len) {
return FALSE;
}
-
+
if (x1) {
*x1 = g_array_index (priv->resource_widths, gint, index);
}
@@ -3182,7 +3182,7 @@ planner_gantt_row_init_menu (PlannerGanttRow *row)
chart = g_object_get_data (G_OBJECT (GNOME_CANVAS_ITEM (row)->canvas), "chart");
tree = planner_gantt_chart_get_view (chart);
-
+
row->priv->popup_factory = planner_task_popup_new (tree);
}
@@ -3202,9 +3202,9 @@ planner_gantt_row_init_menu (PlannerGanttRow *row)
/* Draw non-working intervals shaded. FIXME: Disabled for now. */
if (0) { g_object_get (priv->task, "project", &project, NULL);
-
+
calendar = mrp_project_get_calendar (project);
-
+
/* Get exposed world coordinates. */
gnome_canvas_c2w (item->canvas, x, 0, &wx1, NULL);
gnome_canvas_c2w (item->canvas, x + width, 0, &wx2, NULL);
@@ -3217,22 +3217,22 @@ planner_gantt_row_init_menu (PlannerGanttRow *row)
t2 = mrp_time_align_day (t2 + 24*60*60);
ival_prev = t1;
-
+
gnome_canvas_get_color (item->canvas, "#b7c3c9", &color_break);
gdk_gc_set_foreground (priv->fill_gc, &color_break);
/*g_print ("-------------------\n");*/
-
+
/* Loop through the days between t1 and t2. */
while (t1 <= t2) {
day = mrp_calendar_get_day (calendar, t1, TRUE);
-
+
intervals = mrp_calendar_day_get_intervals (calendar, day, TRUE);
-
+
/* Loop through the intervals for this day. */
for (l = intervals; l; l = l->next) {
ival = l->data;
-
+
mrp_interval_get_absolute (ival,
t1,
&ival_start,
@@ -3242,7 +3242,7 @@ planner_gantt_row_init_menu (PlannerGanttRow *row)
mrp_time_format ("%H:%M", ival_prev),
mrp_time_format ("%H:%M", ival_start),
mrp_time_format ("%a %e %b", ival_prev));*/
-
+
/* Don't draw if the interval is shorter than what we
* want at this zoom level.
*/
@@ -3253,25 +3253,25 @@ planner_gantt_row_init_menu (PlannerGanttRow *row)
*/
wx1 = ival_prev * priv->scale;
wx2 = ival_start * priv->scale;
-
+
gnome_canvas_w2c (item->canvas, wx1, 0, &tx1, NULL);
gnome_canvas_w2c (item->canvas, wx2, 0, &tx2, NULL);
-
+
tx1 -= x;
tx2 -= x;
-
+
/* Don't draw if we're outside the exposed parts
* of the gantt bar.
*/
if (tx1 >= rx2) {
break;
}
-
+
if (tx2 <= rx1) {
ival_prev = ival_end;
continue;
}
-
+
tx1 = MAX (tx1, rx1);
tx2 = MIN (tx2, rx2);
@@ -3284,7 +3284,7 @@ planner_gantt_row_init_menu (PlannerGanttRow *row)
tx2 - tx1,
cy2 - cy1 - 1);
}
-
+
/*gdk_gc_set_foreground (priv->fill_gc, &color_high);
draw_cut_line (drawable,
priv->fill_gc,
@@ -3292,7 +3292,7 @@ planner_gantt_row_init_menu (PlannerGanttRow *row)
cy1 + 1,
tx1,
cy2 - 1);
-
+
draw_cut_line (drawable,
priv->fill_gc,
tx2 - 1,
@@ -3300,10 +3300,10 @@ planner_gantt_row_init_menu (PlannerGanttRow *row)
tx2 - 1,
cy2 - 1);*/
}
-
+
ival_prev = ival_end;
}
-
+
t1 += 60*60*24;
/* Draw the remaining interval if any. */
@@ -3315,10 +3315,10 @@ planner_gantt_row_init_menu (PlannerGanttRow *row)
wx1 = ival_prev * priv->scale;
wx2 = t1 * priv->scale;
-
+
gnome_canvas_w2c (item->canvas, wx1, 0, &tx1, NULL);
gnome_canvas_w2c (item->canvas, wx2, 0, &tx2, NULL);
-
+
tx1 -= x;
tx2 -= x;
@@ -3328,7 +3328,7 @@ planner_gantt_row_init_menu (PlannerGanttRow *row)
if (tx1 >= rx2 || tx2 <= rx1) {
continue;
}
-
+
tx1 = MAX (tx1, rx1);
tx2 = MIN (tx2, rx2);
@@ -3357,10 +3357,10 @@ typedef struct {
PlannerTaskTree *tree;
MrpProject *project;
-
+
GtkTreePath *path;
-
- gchar *property;
+
+ gchar *property;
GValue *value;
GValue *old_value;
} TaskCmdEditProperty;
@@ -3371,7 +3371,7 @@ task_cmd_edit_property_do (PlannerCmd *cmd_base)
TaskCmdEditProperty *cmd;
PlannerGanttModel *model;
MrpTask *task;
-
+
cmd = (TaskCmdEditProperty*) cmd_base;
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (cmd->tree)));
@@ -3390,7 +3390,7 @@ task_cmd_edit_property_undo (PlannerCmd *cmd_base)
TaskCmdEditProperty *cmd;
PlannerGanttModel *model;
MrpTask *task;
-
+
cmd = (TaskCmdEditProperty*) cmd_base;
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (cmd->tree)));
@@ -3405,11 +3405,11 @@ static void
task_cmd_edit_property_free (PlannerCmd *cmd_base)
{
TaskCmdEditProperty *cmd;
-
+
cmd = (TaskCmdEditProperty*) cmd_base;
g_object_unref (cmd->project);
-
+
g_free (cmd->property);
g_value_unset (cmd->value);
g_value_unset (cmd->old_value);
@@ -3444,9 +3444,9 @@ task_cmd_edit_property (PlannerWindow *window,
cmd->project = g_object_ref (planner_window_get_project (window));
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (tree)));
-
+
cmd->path = planner_gantt_model_get_path_from_task (model, task);
-
+
cmd->property = g_strdup (property);
cmd->value = g_new0 (GValue, 1);
@@ -3462,7 +3462,7 @@ task_cmd_edit_property (PlannerWindow *window,
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (window),
cmd_base);
-
+
return cmd_base;
}
@@ -3479,7 +3479,7 @@ gantt_row_get_selected_func (GtkTreeModel *model,
iter,
COL_TASK, &task,
-1);
-
+
*list = g_list_prepend (*list, task);
}
@@ -3487,13 +3487,13 @@ static GList *
gantt_row_get_selected_tasks (GtkTreeSelection *selection)
{
GList *list;
-
+
list = NULL;
gtk_tree_selection_selected_foreach (selection,
gantt_row_get_selected_func,
&list);
-
+
list = g_list_reverse (list);
-
+
return list;
}
diff --git a/src/planner-gantt-row.h b/src/planner-gantt-row.h
index 8ad52b2..eeb2de9 100644
--- a/src/planner-gantt-row.h
+++ b/src/planner-gantt-row.h
@@ -41,7 +41,7 @@ typedef struct _PlannerGanttRowPriv PlannerGanttRowPriv;
struct _PlannerGanttRow {
GnomeCanvasItem parent;
- PlannerGanttRowPriv *priv;
+ PlannerGanttRowPriv *priv;
};
struct _PlannerGanttRowClass {
diff --git a/src/planner-gantt-view.c b/src/planner-gantt-view.c
index 47e5a9e..813f379 100644
--- a/src/planner-gantt-view.c
+++ b/src/planner-gantt-view.c
@@ -186,7 +186,7 @@ static const GtkToggleActionEntry toggle_entries[] = {
NULL, NULL,
G_CALLBACK (gantt_view_highlight_critical_cb), FALSE },
{ "ShowGuideLines", NULL, N_("_Show Guide Lines"),
- NULL, NULL,
+ NULL, NULL,
G_CALLBACK (gantt_view_show_guidelines_cb), FALSE },
{ "NonstandardDays", NULL, N_("_Nonstandard Days"),
NULL, NULL,
@@ -203,7 +203,7 @@ gantt_view_chart_scroll_event (GtkWidget * gki, GdkEventScroll * event, PlannerG
{
gboolean can_in, can_out;
PlannerGanttViewPriv *priv;
-
+
if (event->state & GDK_CONTROL_MASK) {
priv = view->priv;
planner_gantt_chart_can_zoom (PLANNER_GANTT_CHART (priv->gantt), &can_in, &can_out);
@@ -284,7 +284,7 @@ gantt_view_activate (PlannerView *view)
/* Set the initial UI state. */
show_critical = planner_gantt_chart_get_highlight_critical_tasks (
PLANNER_GANTT_CHART (priv->gantt));
-
+
show_nostd_days = planner_gantt_chart_get_nonstandard_days (
PLANNER_GANTT_CHART (priv->gantt));
@@ -322,7 +322,7 @@ gantt_view_deactivate (PlannerView *view)
PlannerGanttViewPriv *priv;
priv = PLANNER_GANTT_VIEW (view)->priv;
-
+
gtk_ui_manager_remove_ui (priv->ui_manager, priv->merged_id);
}
@@ -355,11 +355,11 @@ static const gchar *
gantt_view_get_icon (PlannerView *view)
{
static gchar *filename = NULL;
-
+
if (!filename) {
filename = mrp_paths_get_image_dir ("gantt.png");
}
-
+
return filename;
}
@@ -375,7 +375,7 @@ gantt_view_get_widget (PlannerView *view)
PlannerGanttViewPriv *priv;
priv = PLANNER_GANTT_VIEW (view)->priv;
-
+
if (priv->paned == NULL) {
priv->paned = gantt_view_create_widget (PLANNER_GANTT_VIEW (view));
gtk_widget_show_all (priv->paned);
@@ -391,14 +391,14 @@ gantt_view_print_init (PlannerView *view,
PlannerGanttViewPriv *priv;
gdouble zoom;
gboolean show_critical;
-
+
priv = PLANNER_GANTT_VIEW (view)->priv;
-
+
zoom = planner_gantt_chart_get_zoom (PLANNER_GANTT_CHART (priv->gantt));
show_critical = planner_gantt_chart_get_highlight_critical_tasks (
PLANNER_GANTT_CHART (priv->gantt));
-
+
priv->print_data = planner_gantt_print_data_new (view, job,
GTK_TREE_VIEW (priv->tree),
zoom, show_critical);
@@ -409,7 +409,7 @@ gantt_view_print (PlannerView *view, gint page_nr)
{
PlannerGanttViewPriv *priv;
-
+
priv = PLANNER_GANTT_VIEW (view)->priv;
planner_gantt_print_do (priv->print_data, page_nr);
@@ -421,7 +421,7 @@ gantt_view_print_get_n_pages (PlannerView *view)
PlannerGanttViewPriv *priv;
priv = PLANNER_GANTT_VIEW (view)->priv;
-
+
return planner_gantt_print_get_n_pages (priv->print_data);
}
@@ -432,7 +432,7 @@ gantt_view_print_cleanup (PlannerView *view)
PlannerGanttViewPriv *priv;
priv = PLANNER_GANTT_VIEW (view)->priv;
-
+
planner_gantt_print_data_free (priv->print_data);
priv->print_data = NULL;
}
@@ -482,7 +482,7 @@ gantt_view_project_loaded_cb (MrpProject *project,
planner_task_tree_set_model (PLANNER_TASK_TREE (view->priv->tree),
PLANNER_GANTT_MODEL (model));
-
+
planner_gantt_chart_set_model (PLANNER_GANTT_CHART (view->priv->gantt),
model);
@@ -517,16 +517,16 @@ gantt_view_tree_view_scroll_event_cb (GtkWidget *widget,
}
adj = gtk_tree_view_get_vadjustment (tv);
-
+
if (event->direction == GDK_SCROLL_UP) {
new_value = adj->value - adj->page_increment / 2;
} else {
new_value = adj->value + adj->page_increment / 2;
}
-
+
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
gtk_adjustment_set_value (adj, new_value);
-
+
return TRUE;
}
@@ -562,11 +562,11 @@ gantt_view_create_widget (PlannerGanttView *view)
GtkTreeModel *model;
MrpProject *project;
GtkTreeSelection *selection;
-
+
project = planner_window_get_project (PLANNER_VIEW (view)->main_window);
priv = view->priv;
-
+
g_signal_connect (project,
"loaded",
G_CALLBACK (gantt_view_project_loaded_cb),
@@ -587,8 +587,8 @@ gantt_view_create_widget (PlannerGanttView *view)
* untranslated unless there is a localized term for it.
*/
COL_WBS, _("WBS"),
- COL_NAME, _("Name"),
- COL_START, _("Start"),
+ COL_NAME, _("Name"),
+ COL_START, _("Start"),
COL_FINISH, _("Finish"),
COL_WORK, _("Work"),
COL_DURATION, _("Duration"),
@@ -597,7 +597,7 @@ gantt_view_create_widget (PlannerGanttView *view)
COL_ASSIGNED_TO, _("Assigned to"),
/* i18n: The string "% Complete" will be used in the header
* of a column containing values from 0 upto 100, indicating
- * what part of a task has been completed.
+ * what part of a task has been completed.
* xgettext:no-c-format
*/
COL_COMPLETE, _("% Complete"),
@@ -606,7 +606,7 @@ gantt_view_create_widget (PlannerGanttView *view)
priv->tree = tree;
gantt_view_load_columns (view);
-
+
priv->gantt = planner_gantt_chart_new_with_model (model);
planner_gantt_chart_set_view (PLANNER_GANTT_CHART (priv->gantt),
PLANNER_TASK_TREE (tree));
@@ -615,14 +615,14 @@ gantt_view_create_widget (PlannerGanttView *view)
g_signal_connect (priv->gantt, "scroll-event",
G_CALLBACK (gantt_view_chart_scroll_event), view);
-
+
g_object_unref (model);
g_signal_connect (tree,
"columns-changed",
G_CALLBACK (gantt_view_tree_view_columns_changed_cb),
view);
-
+
g_signal_connect (tree,
"destroy",
G_CALLBACK (gantt_view_tree_view_destroy_cb),
@@ -637,7 +637,7 @@ gantt_view_create_widget (PlannerGanttView *view)
"resource_clicked",
G_CALLBACK (gantt_view_gantt_resource_clicked_cb),
view);
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
@@ -650,7 +650,7 @@ gantt_view_create_widget (PlannerGanttView *view)
"selection_changed",
G_CALLBACK (gantt_view_selection_changed_cb),
view);
-
+
g_signal_connect (tree,
"relation_added",
G_CALLBACK (gantt_view_relations_changed_cb),
@@ -660,9 +660,9 @@ gantt_view_create_widget (PlannerGanttView *view)
"relation_removed",
G_CALLBACK (gantt_view_relations_changed_cb),
view);
-
+
vbox = gtk_vbox_new (FALSE, 3);
-
+
gtk_box_pack_start (GTK_BOX (vbox), tree, TRUE, TRUE, 0);
hadj = gtk_tree_view_get_hadjustment (GTK_TREE_VIEW (tree));
@@ -692,23 +692,23 @@ gantt_view_create_widget (PlannerGanttView *view)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_ALWAYS,
GTK_POLICY_AUTOMATIC);
-
+
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (frame), sw);
-
+
gtk_container_add (GTK_CONTAINER (sw),
GTK_WIDGET (priv->gantt));
gtk_paned_add2 (GTK_PANED (hpaned), frame);
gtk_paned_set_position (GTK_PANED (hpaned), 250);
-
+
g_signal_connect (tree,
"row_expanded",
G_CALLBACK (gantt_view_row_expanded),
priv->gantt);
-
+
g_signal_connect (tree,
"row_collapsed",
G_CALLBACK (gantt_view_row_collapsed),
@@ -722,7 +722,7 @@ gantt_view_create_widget (PlannerGanttView *view)
/* Command callbacks. */
static void
-gantt_view_insert_task_cb (GtkAction *action,
+gantt_view_insert_task_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
@@ -733,7 +733,7 @@ gantt_view_insert_task_cb (GtkAction *action,
}
static void
-gantt_view_insert_tasks_cb (GtkAction *action,
+gantt_view_insert_tasks_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view = PLANNER_GANTT_VIEW (data);
@@ -742,7 +742,7 @@ gantt_view_insert_tasks_cb (GtkAction *action,
}
static void
-gantt_view_remove_task_cb (GtkAction *action,
+gantt_view_remove_task_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
@@ -753,18 +753,18 @@ gantt_view_remove_task_cb (GtkAction *action,
}
static void
-gantt_view_select_all_cb (GtkAction *action,
+gantt_view_select_all_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
-
+
view = PLANNER_GANTT_VIEW (data);
-
+
planner_task_tree_select_all (PLANNER_TASK_TREE (view->priv->tree));
}
static void
-gantt_view_edit_task_cb (GtkAction *action,
+gantt_view_edit_task_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
@@ -776,7 +776,7 @@ gantt_view_edit_task_cb (GtkAction *action,
}
static void
-gantt_view_unlink_task_cb (GtkAction *action,
+gantt_view_unlink_task_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
@@ -799,7 +799,7 @@ gantt_view_link_tasks_cb (GtkAction *action,
}
static void
-gantt_view_indent_task_cb (GtkAction *action,
+gantt_view_indent_task_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
@@ -810,7 +810,7 @@ gantt_view_indent_task_cb (GtkAction *action,
}
static void
-gantt_view_unindent_task_cb (GtkAction *action,
+gantt_view_unindent_task_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
@@ -825,25 +825,25 @@ gantt_view_move_task_up_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
-
+
view = PLANNER_GANTT_VIEW (data);
-
+
planner_task_tree_move_task_up (PLANNER_TASK_TREE (view->priv->tree));
}
-static void
+static void
gantt_view_move_task_down_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
-
+
view = PLANNER_GANTT_VIEW (data);
-
+
planner_task_tree_move_task_down (PLANNER_TASK_TREE (view->priv->tree));
}
static void
-gantt_view_reset_constraint_cb (GtkAction *action,
+gantt_view_reset_constraint_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
@@ -854,12 +854,12 @@ gantt_view_reset_constraint_cb (GtkAction *action,
}
static void
-gantt_view_zoom_to_fit_cb (GtkAction *action,
+gantt_view_zoom_to_fit_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
PlannerGanttViewPriv *priv;
-
+
view = PLANNER_GANTT_VIEW (data);
priv = view->priv;
@@ -869,12 +869,12 @@ gantt_view_zoom_to_fit_cb (GtkAction *action,
}
static void
-gantt_view_zoom_in_cb (GtkAction *action,
+gantt_view_zoom_in_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
PlannerGanttViewPriv *priv;
-
+
view = PLANNER_GANTT_VIEW (data);
priv = view->priv;
@@ -884,12 +884,12 @@ gantt_view_zoom_in_cb (GtkAction *action,
}
static void
-gantt_view_zoom_out_cb (GtkAction *action,
+gantt_view_zoom_out_cb (GtkAction *action,
gpointer data)
{
PlannerGanttView *view;
PlannerGanttViewPriv *priv;
-
+
view = PLANNER_GANTT_VIEW (data);
priv = view->priv;
@@ -905,7 +905,7 @@ gantt_view_highlight_critical_cb (GtkAction *action,
PlannerGanttView *view;
PlannerGanttViewPriv *priv;
gboolean state;
-
+
view = PLANNER_GANTT_VIEW (data);
priv = view->priv;
@@ -927,7 +927,7 @@ gantt_view_nonstandard_days_cb (GtkAction *action,
PlannerGanttView *view;
PlannerGanttViewPriv *priv;
gboolean state;
-
+
view = PLANNER_GANTT_VIEW (data);
priv = view->priv;
@@ -949,7 +949,7 @@ gantt_view_edit_columns_cb (GtkAction *action,
{
PlannerGanttView *view;
PlannerGanttViewPriv *priv;
-
+
view = PLANNER_GANTT_VIEW (data);
priv = view->priv;
@@ -992,7 +992,7 @@ gantt_view_update_row_height (PlannerGanttView *view)
NULL,
&height);
row_height = MAX (row_height, height);
-
+
gtk_tree_view_get_background_area (tv,
path,
col,
@@ -1021,7 +1021,7 @@ gantt_view_expose_cb (GtkWidget *widget,
g_signal_handler_disconnect (view->priv->tree,
view->priv->expose_id);
-
+
return FALSE;
}
@@ -1044,7 +1044,7 @@ gantt_view_tree_style_set_cb (GtkWidget *tree,
}
}
-static void
+static void
gantt_view_selection_changed_cb (PlannerTaskTree *tree, PlannerGanttView *view)
{
g_return_if_fail (PLANNER_IS_VIEW (view));
@@ -1070,7 +1070,7 @@ gantt_view_gantt_resource_clicked_cb (PlannerGanttChart *chart,
dialog = planner_resource_dialog_new (PLANNER_VIEW (view)->main_window, resource);
gtk_widget_show (dialog);
}
-
+
static void
gantt_view_relations_changed_cb (PlannerTaskTree *tree,
MrpTask *task,
@@ -1093,9 +1093,9 @@ gantt_view_update_ui (PlannerGanttView *view)
if (!PLANNER_VIEW (view)->activated) {
return;
}
-
+
priv = view->priv;
-
+
list = planner_task_tree_get_selected_tasks (PLANNER_TASK_TREE (priv->tree));
for (l = list; l; l = l->next) {
@@ -1104,48 +1104,48 @@ gantt_view_update_ui (PlannerGanttView *view)
break;
}
}
-
+
for (l = list; l; l = l->next) {
count_value++;
}
-
+
value = (list != NULL);
link_value = (count_value >= 2);
g_object_set (gtk_action_group_get_action (priv->actions, "EditTask"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "RemoveTask"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "UnlinkTask"),
- "sensitive", rel_value,
+ "sensitive", rel_value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "LinkTasks"),
- "sensitive", link_value,
+ "sensitive", link_value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "IndentTask"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "UnindentTask"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "MoveTaskUp"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "MoveTaskDown"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "ResetConstraint"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_list_free (list);
@@ -1158,7 +1158,7 @@ gantt_view_show_guidelines_cb (GtkAction *action,
PlannerGanttView *view;
PlannerGanttViewPriv *priv;
gboolean state;
-
+
view = PLANNER_GANTT_VIEW (data);
priv = view->priv;
@@ -1180,7 +1180,7 @@ gantt_view_update_zoom_sensitivity (PlannerGanttView *view)
g_object_set (gtk_action_group_get_action (GTK_ACTION_GROUP(view->priv->actions),
"ZoomIn"),
- "sensitive", in,
+ "sensitive", in,
NULL);
g_object_set (gtk_action_group_get_action (GTK_ACTION_GROUP(view->priv->actions),
@@ -1195,7 +1195,7 @@ gantt_view_save_columns (PlannerGanttView *view)
PlannerGanttViewPriv *priv;
priv = view->priv;
-
+
planner_view_column_save_helper (PLANNER_VIEW (view), GTK_TREE_VIEW (priv->tree));
}
@@ -1207,12 +1207,12 @@ gantt_view_load_columns (PlannerGanttView *view)
GtkTreeViewColumn *column;
const gchar *id;
gint i;
-
+
priv = view->priv;
/* Load the columns. */
planner_view_column_load_helper (PLANNER_VIEW (view), GTK_TREE_VIEW (priv->tree));
-
+
/* Make things a bit more robust by setting defaults if we don't get any
* visible columns. Should be done through a schema instead (but we'll
* keep this since a lot of people get bad installations when installing
@@ -1225,7 +1225,7 @@ gantt_view_load_columns (PlannerGanttView *view)
i++;
}
}
-
+
if (i == 0) {
for (l = columns; l; l = l->next) {
column = l->data;
@@ -1238,7 +1238,7 @@ gantt_view_load_columns (PlannerGanttView *view)
if (!id) {
continue;
}
-
+
if (strcmp (id, "wbs") == 0 ||
strcmp (id, "name") == 0 ||
strcmp (id, "work") == 0) {
@@ -1248,7 +1248,7 @@ gantt_view_load_columns (PlannerGanttView *view)
}
}
}
-
+
g_list_free (columns);
}
diff --git a/src/planner-group-dialog.c b/src/planner-group-dialog.c
index 645db24..c0da626 100644
--- a/src/planner-group-dialog.c
+++ b/src/planner-group-dialog.c
@@ -57,7 +57,7 @@ typedef struct {
PlannerCmd base;
MrpGroup *group;
- const gchar *property;
+ const gchar *property;
GValue *value;
GValue *old_value;
} GroupCmdEditProperty;
@@ -83,13 +83,13 @@ typedef struct {
GtkTreeIter *found_iter;
} FindGroupData;
-static void
+static void
group_dialog_free_find_group_data (FindGroupData *data)
{
if (data->found_iter) {
gtk_tree_iter_free (data->found_iter);
}
-
+
g_free (data);
}
@@ -100,16 +100,16 @@ group_dialog_foreach_find_group_func (GtkTreeModel *model,
FindGroupData *data)
{
MrpGroup *group;
-
+
gtk_tree_model_get (model, iter,
GROUP_COL, &group,
-1);
-
+
if (group == data->group) {
data->found_iter = gtk_tree_iter_copy (iter);
return TRUE;
}
-
+
return FALSE;
}
@@ -118,7 +118,7 @@ group_dialog_find_group (GtkTreeView *tree_view, MrpGroup *group)
{
FindGroupData *data;
GtkTreeModel *model;
-
+
data = g_new0 (FindGroupData, 1);
data->group = group;
data->found_iter = NULL;
@@ -132,27 +132,27 @@ group_dialog_find_group (GtkTreeView *tree_view, MrpGroup *group)
if (data->found_iter) {
return data;
}
-
+
g_free (data);
return NULL;
}
-static GtkWidget *
+static GtkWidget *
group_dialog_create (PlannerView *view);
static void group_dialog_setup_tree_view (GtkWidget *dialog);
-static void group_dialog_insert_group_cb (GtkWidget *button,
+static void group_dialog_insert_group_cb (GtkWidget *button,
GtkWidget *dialog);
-static void group_dialog_remove_group_cb (GtkWidget *button,
+static void group_dialog_remove_group_cb (GtkWidget *button,
GtkWidget *dialog);
-static void group_dialog_close_editor_cb (GtkWidget *button,
+static void group_dialog_close_editor_cb (GtkWidget *button,
GtkWidget *dialog);
-static void group_dialog_cell_toggled (GtkCellRendererText *cell,
+static void group_dialog_cell_toggled (GtkCellRendererText *cell,
gchar *path_str,
GtkWindow *dialog);
@@ -163,13 +163,13 @@ static void group_dialog_cell_edited (GtkCellRendererText *cell,
static void group_dialog_add_column (GtkWidget *dialog,
int column,
- char *title,
+ char *title,
guint type,
gint min_width);
static void group_dialog_add_columns (GtkWidget *dialog);
-static void
+static void
group_dialog_selection_changed_cb (GtkTreeSelection *selection,
GtkWidget *dialog);
static GList *
@@ -191,34 +191,34 @@ group_dialog_create (PlannerView *view)
project = planner_window_get_project (data->view->main_window);
data->project = g_object_ref (project);
-
+
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");
-
+
+ dialog = glade_xml_get_widget (gui, "dialog_group_editor");
+
data->tree_view = GTK_TREE_VIEW (
- glade_xml_get_widget (gui,
+ glade_xml_get_widget (gui,
"group_edit_treeview"));
-
+
button = glade_xml_get_widget (gui, "add_group");
g_signal_connect (button, "clicked",
- G_CALLBACK (group_dialog_insert_group_cb),
+ G_CALLBACK (group_dialog_insert_group_cb),
dialog);
-
+
data->remove_button = glade_xml_get_widget (gui, "remove_group");
g_signal_connect (data->remove_button,
"clicked",
- G_CALLBACK (group_dialog_remove_group_cb),
+ G_CALLBACK (group_dialog_remove_group_cb),
dialog);
button = glade_xml_get_widget (gui, "close_editor");
g_signal_connect (button,
"clicked",
- G_CALLBACK (group_dialog_close_editor_cb),
+ G_CALLBACK (group_dialog_close_editor_cb),
dialog);
-
+
g_object_set_data (G_OBJECT (dialog), "data", data);
group_dialog_setup_tree_view (dialog);
@@ -233,14 +233,14 @@ group_dialog_setup_tree_view (GtkWidget *dialog)
GtkTreeModel *model;
GtkTreeModel *sorted_model;
GtkTreeSelection *selection;
-
+
g_return_if_fail (GTK_IS_DIALOG (dialog));
data = g_object_get_data (G_OBJECT (dialog), "data");
model = GTK_TREE_MODEL (planner_group_model_new (data->project));
sorted_model = gtk_tree_model_sort_new_with_model (model);
-
+
gtk_tree_view_set_model (data->tree_view, sorted_model);
selection = gtk_tree_view_get_selection (data->tree_view);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
@@ -251,7 +251,7 @@ group_dialog_setup_tree_view (GtkWidget *dialog)
dialog);
group_dialog_add_columns (dialog);
-
+
g_object_unref (model);
g_object_unref (sorted_model);
}
@@ -264,7 +264,7 @@ group_cmd_insert_do (PlannerCmd *cmd_base)
cmd = (GroupCmdInsert*) cmd_base;
g_assert (MRP_IS_GROUP (cmd->group));
-
+
mrp_project_add_group (cmd->project, cmd->group);
return TRUE;
@@ -274,12 +274,12 @@ static void
group_cmd_insert_undo (PlannerCmd *cmd_base)
{
GroupCmdInsert *cmd;
-
+
cmd = (GroupCmdInsert*) cmd_base;
mrp_project_remove_group (cmd->project,
cmd->group);
-
+
}
@@ -288,7 +288,7 @@ group_cmd_insert_free (PlannerCmd *cmd_base)
{
GroupCmdInsert *cmd;
- cmd = (GroupCmdInsert*) cmd_base;
+ cmd = (GroupCmdInsert*) cmd_base;
cmd->group = NULL;
cmd->project = NULL;
@@ -310,7 +310,7 @@ group_cmd_insert (PlannerView *view)
cmd->project = planner_window_get_project (view->main_window);
- cmd->group = g_object_new (MRP_TYPE_GROUP, NULL);
+ cmd->group = g_object_new (MRP_TYPE_GROUP, NULL);
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (view->main_window),
cmd_base);
@@ -326,11 +326,11 @@ group_dialog_insert_group_cb (GtkWidget *button, GtkWidget *dialog)
GtkTreeModel *model;
GtkTreePath *path;
GroupCmdInsert *cmd;
-
+
g_return_if_fail (GTK_IS_DIALOG (dialog));
data = g_object_get_data (G_OBJECT (dialog), "data");
-
+
cmd = (GroupCmdInsert*) group_cmd_insert (data->view);
if (!GTK_WIDGET_HAS_FOCUS (data->tree_view)) {
@@ -341,15 +341,15 @@ group_dialog_insert_group_cb (GtkWidget *button, GtkWidget *dialog)
if (find_data) {
model = gtk_tree_view_get_model (data->tree_view);
path = gtk_tree_model_get_path (model, find_data->found_iter);
-
+
gtk_tree_view_set_cursor (data->tree_view,
path,
gtk_tree_view_get_column (data->tree_view, 0),
- TRUE);
+ TRUE);
gtk_tree_path_free (path);
group_dialog_free_find_group_data (find_data);
- }
+ }
}
static gboolean
@@ -365,7 +365,7 @@ group_cmd_remove_do (PlannerCmd *cmd_base)
for (l = resources; l; l = l->next) {
MrpGroup *group;
-
+
mrp_object_get (MRP_OBJECT (l->data), "group", &group, NULL);
if (cmd->group == group) {
@@ -377,7 +377,7 @@ group_cmd_remove_do (PlannerCmd *cmd_base)
if (default_group == cmd->group) {
cmd->is_default = TRUE;
}
-
+
mrp_project_remove_group (cmd->project, cmd->group);
return TRUE;
@@ -388,12 +388,12 @@ group_cmd_remove_undo (PlannerCmd *cmd_base)
{
GroupCmdRemove *cmd;
GList *l;
-
+
cmd = (GroupCmdRemove*) cmd_base;
/* We need to recover the group deleted */
g_assert (MRP_IS_GROUP (cmd->group));
-
+
mrp_project_add_group (cmd->project, cmd->group);
/* Now we need to recover all the links of the project
@@ -450,7 +450,7 @@ group_dialog_remove_group_cb (GtkWidget *widget, GtkWidget *dialog)
DialogData *data;
GList *list, *node;
GroupCmdRemove *cmd;
-
+
g_return_if_fail (GTK_IS_DIALOG (dialog));
data = g_object_get_data (G_OBJECT (dialog), "data");
@@ -460,7 +460,7 @@ group_dialog_remove_group_cb (GtkWidget *widget, GtkWidget *dialog)
for (node = list; node; node = node->next) {
cmd = (GroupCmdRemove*) group_cmd_remove (data->view, MRP_GROUP (node->data));
}
-
+
g_list_free (list);
}
@@ -496,7 +496,7 @@ static void
group_cmd_default_undo (PlannerCmd *cmd_base)
{
GroupCmdDefault *cmd;
-
+
cmd = (GroupCmdDefault*) cmd_base;
mrp_object_set (cmd->project, "default-group", cmd->old_group, NULL);
}
@@ -505,7 +505,7 @@ static void
group_cmd_default_free (PlannerCmd *cmd_base)
{
GroupCmdDefault *cmd;
-
+
cmd = (GroupCmdDefault*) cmd_base;
g_object_unref (cmd->group);
@@ -543,7 +543,7 @@ group_cmd_default (PlannerView *view,
static void
-group_dialog_cell_toggled (GtkCellRendererText *cell,
+group_dialog_cell_toggled (GtkCellRendererText *cell,
gchar *path_str,
GtkWindow *dialog)
{
@@ -556,13 +556,13 @@ group_dialog_cell_toggled (GtkCellRendererText *cell,
gint column;
gboolean is_default;
MrpGroup *group;
-
+
data = g_object_get_data (G_OBJECT (dialog), "data");
sorted_model = GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (data->tree_view));
-
+
model = gtk_tree_model_sort_get_model (sorted_model);
-
+
path = gtk_tree_path_new_from_string (path_str);
column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell),
"column"));
@@ -570,11 +570,11 @@ group_dialog_cell_toggled (GtkCellRendererText *cell,
gtk_tree_model_get_iter (GTK_TREE_MODEL (sorted_model),
&sorted_iter, path);
- gtk_tree_model_sort_convert_iter_to_child_iter (sorted_model,
+ gtk_tree_model_sort_convert_iter_to_child_iter (sorted_model,
&iter,
&sorted_iter);
- switch (column) {
+ switch (column) {
case GROUP_COL_GROUP_DEFAULT:
gtk_tree_model_get (model, &iter, column, &is_default, -1);
@@ -589,7 +589,7 @@ group_dialog_cell_toggled (GtkCellRendererText *cell,
g_assert_not_reached ();
}
- gtk_tree_path_free (path);
+ gtk_tree_path_free (path);
}
@@ -598,8 +598,8 @@ group_cmd_edit_property_do (PlannerCmd *cmd_base)
{
GroupCmdEditProperty *cmd;
- cmd = (GroupCmdEditProperty *) cmd_base;
-
+ cmd = (GroupCmdEditProperty *) cmd_base;
+
g_object_set_property (G_OBJECT (cmd->group),
cmd->property,
cmd->value);
@@ -611,7 +611,7 @@ static void
group_cmd_edit_property_undo (PlannerCmd *cmd_base)
{
GroupCmdEditProperty *cmd;
-
+
cmd = (GroupCmdEditProperty *) cmd_base;
g_object_set_property (G_OBJECT (cmd->group),
@@ -623,16 +623,16 @@ static void
group_cmd_edit_property_free (PlannerCmd *cmd_base)
{
GroupCmdEditProperty *cmd;
-
+
cmd = (GroupCmdEditProperty *) cmd_base;
-
+
cmd->group = NULL;
g_value_unset (cmd->value);
g_value_unset (cmd->old_value);
}
static PlannerCmd *
-group_cmd_edit_property (PlannerView *view,
+group_cmd_edit_property (PlannerView *view,
MrpGroup *group,
const gchar *property,
GValue *value)
@@ -662,7 +662,7 @@ group_cmd_edit_property (PlannerView *view,
cmd->property,
cmd->old_value);
- /* FIXME: if old and new value are the same, do nothing
+ /* FIXME: if old and new value are the same, do nothing
How we can compare values?
*/
@@ -673,7 +673,7 @@ group_cmd_edit_property (PlannerView *view,
}
static void
-group_dialog_cell_edited (GtkCellRendererText *cell,
+group_dialog_cell_edited (GtkCellRendererText *cell,
gchar *path_str,
gchar *new_text,
GtkWindow *dialog)
@@ -693,22 +693,22 @@ group_dialog_cell_edited (GtkCellRendererText *cell,
data = g_object_get_data (G_OBJECT (dialog), "data");
sorted_model = GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (data->tree_view));
-
+
model = gtk_tree_model_sort_get_model (sorted_model);
-
+
path = gtk_tree_path_new_from_string (path_str);
column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
gtk_tree_model_get_iter (GTK_TREE_MODEL (sorted_model),
&sorted_iter, path);
-
- gtk_tree_model_sort_convert_iter_to_child_iter (sorted_model,
+
+ gtk_tree_model_sort_convert_iter_to_child_iter (sorted_model,
&iter,
&sorted_iter);
group = MRP_GROUP (planner_list_model_get_object (
PLANNER_LIST_MODEL (model), &iter));
-
+
switch (column) {
case GROUP_COL_NAME:
property = "name";
@@ -739,7 +739,7 @@ group_dialog_cell_edited (GtkCellRendererText *cell,
}
cmd = group_cmd_edit_property (data->view,
- group,
+ group,
property,
&value);
@@ -748,10 +748,10 @@ group_dialog_cell_edited (GtkCellRendererText *cell,
static void
group_dialog_add_column (GtkWidget *dialog,
- int column,
+ int column,
char *title,
guint type,
- gint min_width)
+ gint min_width)
{
DialogData *data;
GtkCellRenderer *cell = NULL;
@@ -763,7 +763,7 @@ group_dialog_add_column (GtkWidget *dialog,
model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (data->tree_view)));
switch (type) {
- case TREE_VIEW_TEXT:
+ case TREE_VIEW_TEXT:
cell = gtk_cell_renderer_text_new ();
g_object_set (cell,
"editable", TRUE,
@@ -794,12 +794,12 @@ group_dialog_add_column (GtkWidget *dialog,
g_assert_not_reached ();
break;
}
-
+
g_object_set_data (G_OBJECT (cell),
"column", GINT_TO_POINTER (column));
column_data = gtk_tree_view_column_new_with_attributes (title, cell,
- tree_type,
+ tree_type,
column,
NULL);
@@ -818,55 +818,55 @@ static void
group_dialog_add_columns (GtkWidget *dialog)
{
group_dialog_add_column (dialog,
- GROUP_COL_NAME,
+ GROUP_COL_NAME,
_("Name"),
TREE_VIEW_TEXT,
100);
group_dialog_add_column (dialog,
- GROUP_COL_MANAGER_NAME,
+ GROUP_COL_MANAGER_NAME,
_("Manager name"),
TREE_VIEW_TEXT,
50);
-
+
group_dialog_add_column (dialog,
- GROUP_COL_MANAGER_PHONE,
+ GROUP_COL_MANAGER_PHONE,
_("Manager phone"),
TREE_VIEW_TEXT,
50);
group_dialog_add_column (dialog,
- GROUP_COL_MANAGER_EMAIL,
+ GROUP_COL_MANAGER_EMAIL,
_("Manager email"),
TREE_VIEW_TEXT,
50);
group_dialog_add_column (dialog,
- GROUP_COL_GROUP_DEFAULT,
+ GROUP_COL_GROUP_DEFAULT,
_("Default"),
TREE_VIEW_ACTIVE,
-1);
}
static void
-group_dialog_selection_changed_cb (GtkTreeSelection *selection,
+group_dialog_selection_changed_cb (GtkTreeSelection *selection,
GtkWidget *dialog)
{
DialogData *data;
GList *list;
gboolean selected = FALSE;
-
+
g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
g_return_if_fail (GTK_IS_WIDGET (dialog));
-
+
data = g_object_get_data (G_OBJECT (dialog), "data");
list = group_dialog_selection_get_list (dialog);
-
+
if (list) {
selected = TRUE;
g_list_free (list);
- }
+ }
gtk_widget_set_sensitive (data->remove_button, selected);
}
@@ -902,13 +902,13 @@ group_dialog_selection_get_list (GtkWidget *dialog)
DialogData *data;
GtkTreeSelection *selection;
GList *list;
-
+
g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
data = g_object_get_data (G_OBJECT (dialog), "data");
-
+
selection = gtk_tree_view_get_selection (data->tree_view);
-
+
list = NULL;
gtk_tree_selection_selected_foreach (
selection,
@@ -922,10 +922,10 @@ GtkWidget *
planner_group_dialog_new (PlannerView *view)
{
GtkWidget *dialog;
-
+
g_return_val_if_fail (PLANNER_IS_VIEW (view), NULL);
dialog = group_dialog_create (view);
-
+
return dialog;
}
diff --git a/src/planner-group-model.c b/src/planner-group-model.c
index 052498e..342cdb7 100644
--- a/src/planner-group-model.c
+++ b/src/planner-group-model.c
@@ -47,11 +47,11 @@ static void mgm_get_value (GtkTreeModel *tree_model,
static void mgm_group_notify_cb (MrpGroup *group,
GParamSpec *pspec,
PlannerGroupModel *model);
-static void mgm_group_added_cb (MrpProject *project,
+static void mgm_group_added_cb (MrpProject *project,
MrpGroup *resource,
PlannerGroupModel *model);
-static void mgm_group_removed_cb (MrpProject *project,
+static void mgm_group_removed_cb (MrpProject *project,
MrpGroup *resource,
PlannerGroupModel *model);
@@ -66,7 +66,7 @@ GType
planner_group_model_get_type (void)
{
static GType rm_type = 0;
-
+
if (!rm_type) {
static const GTypeInfo rm_info =
{
@@ -80,12 +80,12 @@ planner_group_model_get_type (void)
0,
(GInstanceInitFunc) mgm_init,
};
-
+
rm_type = g_type_register_static (PLANNER_TYPE_LIST_MODEL,
- "PlannerGroupModel",
+ "PlannerGroupModel",
&rm_info, 0);
}
-
+
return rm_type;
}
@@ -94,11 +94,11 @@ mgm_class_init (PlannerGroupModelClass *klass)
{
GObjectClass *object_class;
PlannerListModelClass *lm_class;
-
+
parent_class = g_type_class_peek_parent (klass);
object_class = G_OBJECT_CLASS (klass);
lm_class = PLANNER_LIST_MODEL_CLASS (klass);
-
+
object_class->finalize = mgm_finalize;
lm_class->get_n_columns = mgm_get_n_columns;
@@ -110,11 +110,11 @@ static void
mgm_init (PlannerGroupModel *model)
{
PlannerGroupModelPriv *priv;
-
+
priv = g_new0 (PlannerGroupModelPriv, 1);
-
+
priv->project = NULL;
-
+
model->priv = priv;
}
@@ -130,24 +130,24 @@ mgm_finalize (GObject *object)
groups = planner_list_model_get_data (PLANNER_LIST_MODEL (model));
for (l = groups; l; l = l->next) {
- g_signal_handlers_disconnect_by_func (MRP_GROUP (l->data),
+ g_signal_handlers_disconnect_by_func (MRP_GROUP (l->data),
mgm_group_notify_cb,
model);
}
- g_signal_handlers_disconnect_by_func (model->priv->project,
+ g_signal_handlers_disconnect_by_func (model->priv->project,
mgm_group_added_cb,
model);
- g_signal_handlers_disconnect_by_func (model->priv->project,
+ g_signal_handlers_disconnect_by_func (model->priv->project,
mgm_group_removed_cb,
model);
- g_signal_handlers_disconnect_by_func (model->priv->project,
+ g_signal_handlers_disconnect_by_func (model->priv->project,
mgm_default_group_changed_cb,
model);
g_object_unref (model->priv->project);
g_free (model->priv);
model->priv = NULL;
-
+
if (G_OBJECT_CLASS (parent_class)->finalize) {
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -169,7 +169,7 @@ mgm_get_column_type (GtkTreeModel *tree_model,
case GROUP_COL_MANAGER_PHONE:
case GROUP_COL_MANAGER_EMAIL:
return G_TYPE_STRING;
-
+
case GROUP_COL_GROUP_DEFAULT:
return G_TYPE_BOOLEAN;
@@ -198,7 +198,7 @@ mgm_get_value (GtkTreeModel *tree_model,
priv = PLANNER_GROUP_MODEL (tree_model)->priv;
group = MRP_GROUP (planner_list_model_get_object (
PLANNER_LIST_MODEL (tree_model), iter));
-
+
switch (column) {
case GROUP_COL_NAME:
mrp_object_get (group, "name", &str, NULL);
@@ -213,7 +213,7 @@ mgm_get_value (GtkTreeModel *tree_model,
NULL);
is_default = (group == default_group);
-
+
g_value_init (value, G_TYPE_BOOLEAN);
g_value_set_boolean (value, is_default);
@@ -232,7 +232,7 @@ mgm_get_value (GtkTreeModel *tree_model,
g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, str);
g_free (str);
-
+
break;
case GROUP_COL_MANAGER_EMAIL:
@@ -240,13 +240,13 @@ mgm_get_value (GtkTreeModel *tree_model,
g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, str);
g_free (str);
-
+
break;
case GROUP_COL:
g_value_init (value, MRP_TYPE_GROUP);
g_value_set_object (value, group);
-
+
break;
default:
@@ -266,20 +266,20 @@ mgm_group_notify_cb (MrpGroup *group, GParamSpec *pspec, PlannerGroupModel *mode
tree_model = GTK_TREE_MODEL (model);
- path = planner_list_model_get_path (PLANNER_LIST_MODEL (model),
+ path = planner_list_model_get_path (PLANNER_LIST_MODEL (model),
MRP_OBJECT (group));
if (path) {
gtk_tree_model_get_iter (tree_model, &iter, path);
- gtk_tree_model_row_changed (GTK_TREE_MODEL (model),
+ gtk_tree_model_row_changed (GTK_TREE_MODEL (model),
path, &iter);
gtk_tree_path_free (path);
- }
+ }
}
static void
-mgm_group_added_cb (MrpProject *project,
+mgm_group_added_cb (MrpProject *project,
MrpGroup *group,
PlannerGroupModel *model)
{
@@ -301,7 +301,7 @@ mgm_group_removed_cb (MrpProject *project,
g_return_if_fail (PLANNER_IS_GROUP_MODEL (model));
g_return_if_fail (MRP_IS_GROUP (group));
- g_signal_handlers_disconnect_by_func (group,
+ g_signal_handlers_disconnect_by_func (group,
mgm_group_notify_cb,
model);
@@ -320,20 +320,20 @@ mgm_default_group_changed_cb (MrpProject *project,
g_return_if_fail (PLANNER_IS_GROUP_MODEL (model));
- if (group == NULL)
+ if (group == NULL)
return;
groups = planner_list_model_get_data (PLANNER_LIST_MODEL (model));
-
+
i = g_list_index (groups, group);
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, i);
gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path);
-
+
gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, &iter);
-
+
gtk_tree_path_free (path);
}
@@ -343,9 +343,9 @@ planner_group_model_new (MrpProject *project)
PlannerGroupModel *model;
PlannerGroupModelPriv *priv;
GList *groups;
-
+
model = g_object_new (PLANNER_TYPE_GROUP_MODEL, NULL);
-
+
priv = model->priv;
groups = mrp_project_get_groups (project);
@@ -353,19 +353,19 @@ planner_group_model_new (MrpProject *project)
priv->project = g_object_ref (project);
- g_signal_connect_object (project,
- "group_added",
- G_CALLBACK (mgm_group_added_cb),
+ g_signal_connect_object (project,
+ "group_added",
+ G_CALLBACK (mgm_group_added_cb),
model, 0);
- g_signal_connect_object (project,
- "group_removed",
- G_CALLBACK (mgm_group_removed_cb),
+ g_signal_connect_object (project,
+ "group_removed",
+ G_CALLBACK (mgm_group_removed_cb),
model, 0);
- g_signal_connect_object (project,
- "default_group_changed",
- G_CALLBACK (mgm_default_group_changed_cb),
+ g_signal_connect_object (project,
+ "default_group_changed",
+ G_CALLBACK (mgm_default_group_changed_cb),
model, 0);
return model;
diff --git a/src/planner-html-plugin.c b/src/planner-html-plugin.c
index d98e210..bd0a1e0 100644
--- a/src/planner-html-plugin.c
+++ b/src/planner-html-plugin.c
@@ -19,7 +19,7 @@
*/
#include <config.h>
-#include <glib.h>
+#include <glib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@@ -72,7 +72,7 @@ html_plugin_export_do (PlannerPlugin *plugin,
priv = plugin->priv;
project = planner_window_get_project (priv->main_window);
-
+
if (!mrp_project_export (project, path, "Planner HTML", TRUE, NULL)) {
dialog = gtk_message_dialog_new (GTK_WINDOW (priv->main_window),
GTK_DIALOG_MODAL |
@@ -115,15 +115,15 @@ html_plugin_export (GtkAction *action,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (filechooser), GTK_RESPONSE_OK);
-
+
project = planner_window_get_project (priv->main_window);
uri = mrp_project_get_uri (project);
if (!uri) {
gchar *cwd, *tmp;
-
+
cwd = g_get_current_dir ();
tmp = g_strconcat (_("Unnamed"), ".html", NULL);
-
+
filename = g_build_filename (cwd, tmp, NULL);
g_free (cwd);
@@ -142,7 +142,7 @@ html_plugin_export (GtkAction *action,
filename = g_strconcat (tmp, ".html", NULL);
g_free (tmp);
- }
+ }
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filechooser),
filename);
@@ -153,7 +153,7 @@ html_plugin_export (GtkAction *action,
show_button = gtk_check_button_new_with_label (_("Show result in browser"));
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (filechooser), show_button);
-
+
g_free (basename);
g_free (filename);
@@ -175,16 +175,16 @@ html_plugin_export (GtkAction *action,
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
res = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
-
+
switch (res) {
case GTK_RESPONSE_YES:
break;
-
+
case GTK_RESPONSE_NO:
case GTK_RESPONSE_DELETE_EVENT:
g_free (filename);
goto try_again;
-
+
default:
g_assert_not_reached ();
}
@@ -192,7 +192,7 @@ html_plugin_export (GtkAction *action,
show = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_button));
gtk_widget_destroy (filechooser);
-
+
html_plugin_export_do (plugin, filename, show);
g_free (filename);
@@ -203,7 +203,7 @@ html_plugin_export (GtkAction *action,
}
}
-G_MODULE_EXPORT void
+G_MODULE_EXPORT void
plugin_init (PlannerPlugin *plugin,
PlannerWindow *main_window)
{
@@ -211,12 +211,12 @@ plugin_init (PlannerPlugin *plugin,
GtkUIManager *ui;
GtkActionGroup *actions;
gchar *filename;
-
+
priv = g_new0 (PlannerPluginPriv, 1);
plugin->priv = priv;
priv->main_window = main_window;
-
+
actions = gtk_action_group_new ("HTML plugin actions");
gtk_action_group_set_translation_domain (actions, GETTEXT_PACKAGE);
@@ -235,7 +235,7 @@ plugin_init (PlannerPlugin *plugin,
gtk_ui_manager_ensure_update (ui);
}
-G_MODULE_EXPORT void
-plugin_exit (PlannerPlugin *plugin)
+G_MODULE_EXPORT void
+plugin_exit (PlannerPlugin *plugin)
{
}
diff --git a/src/planner-list-model.c b/src/planner-list-model.c
index aa43944..37332fb 100644
--- a/src/planner-list-model.c
+++ b/src/planner-list-model.c
@@ -79,7 +79,7 @@ GType
planner_list_model_get_type (void)
{
static GType type = 0;
-
+
if (!type) {
static const GTypeInfo info =
{
@@ -93,7 +93,7 @@ planner_list_model_get_type (void)
0,
(GInstanceInitFunc) mlm_init,
};
-
+
static const GInterfaceInfo tree_model_info =
{
(GInterfaceInitFunc) mlm_tree_model_init,
@@ -102,14 +102,14 @@ planner_list_model_get_type (void)
};
type = g_type_register_static (G_TYPE_OBJECT,
- "PlannerListModel",
+ "PlannerListModel",
&info, 0);
-
+
g_type_add_interface_static (type,
GTK_TYPE_TREE_MODEL,
&tree_model_info);
}
-
+
return type;
}
@@ -156,7 +156,7 @@ mlm_init (PlannerListModel *model)
do {
priv->stamp = g_random_int ();
} while (priv->stamp == 0);
-
+
model->priv = priv;
priv->data_list = NULL;
}
@@ -171,10 +171,10 @@ mlm_finalize (GObject *object)
g_list_free (priv->data_list);
priv->data_list = NULL;
}
-
+
g_free (model->priv);
model->priv = NULL;
-
+
if (G_OBJECT_CLASS (parent_class)->finalize) {
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -189,24 +189,24 @@ mlm_get_iter (GtkTreeModel *tree_model,
PlannerListModelPriv *priv;
GList *node;
gint i;
-
+
g_return_val_if_fail (PLANNER_IS_LIST_MODEL (tree_model), FALSE);
g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, FALSE);
model = PLANNER_LIST_MODEL (tree_model);
priv = model->priv;
-
+
i = gtk_tree_path_get_indices (path)[0];
if (i >= g_list_length (priv->data_list)) {
return FALSE;
}
-
+
node = g_list_nth (priv->data_list, i);
-
+
iter->stamp = model->priv->stamp;
iter->user_data = node;
-
+
return TRUE;
}
@@ -235,7 +235,7 @@ mlm_get_path (GtkTreeModel *tree_model,
if (node == NULL) {
return NULL;
}
-
+
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, i);
@@ -247,12 +247,12 @@ mlm_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
PlannerListModel *model = PLANNER_LIST_MODEL (tree_model);
-
+
g_return_val_if_fail (PLANNER_IS_LIST_MODEL (tree_model), FALSE);
g_return_val_if_fail (model->priv->stamp == iter->stamp, FALSE);
iter->user_data = G_LIST(iter->user_data)->next;
-
+
return (iter->user_data != NULL);
}
@@ -263,12 +263,12 @@ mlm_iter_children (GtkTreeModel *tree_model,
{
PlannerListModel *model;
PlannerListModelPriv *priv;
-
+
g_return_val_if_fail (PLANNER_IS_LIST_MODEL (tree_model), FALSE);
model = PLANNER_LIST_MODEL (tree_model);
priv = model->priv;
-
+
/* this is a list, nodes have no children */
if (parent) {
return FALSE;
@@ -277,13 +277,13 @@ mlm_iter_children (GtkTreeModel *tree_model,
/* but if parent == NULL we return the list itself as children of the
* "root"
*/
-
+
if (priv->data_list) {
iter->stamp = priv->stamp;
iter->user_data = priv->data_list;
return TRUE;
- }
-
+ }
+
return FALSE;
}
@@ -300,16 +300,16 @@ mlm_iter_n_children (GtkTreeModel *tree_model,
{
PlannerListModel *model;
PlannerListModelPriv *priv;
-
+
g_return_val_if_fail (PLANNER_IS_LIST_MODEL (tree_model), -1);
-
+
model = PLANNER_LIST_MODEL (tree_model);
priv = model->priv;
if (iter == NULL) {
return g_list_length (priv->data_list);
}
-
+
g_return_val_if_fail (priv->stamp == iter->stamp, -1);
return 0;
@@ -329,13 +329,13 @@ mlm_iter_nth_child (GtkTreeModel *tree_model,
model = PLANNER_LIST_MODEL (tree_model);
priv = model->priv;
-
+
if (parent) {
return FALSE;
}
-
+
child = g_list_nth (priv->data_list, n);
-
+
if (child) {
iter->stamp = model->priv->stamp;
iter->user_data = child;
@@ -357,9 +357,9 @@ static gint
mlm_get_n_columns (GtkTreeModel *tree_model)
{
PlannerListModelClass *klass;
-
+
klass = PLANNER_LIST_MODEL_GET_CLASS (tree_model);
-
+
if (klass->get_n_columns) {
return klass->get_n_columns (tree_model);
}
@@ -373,9 +373,9 @@ static GType
mlm_get_column_type (GtkTreeModel *tree_model, gint column)
{
PlannerListModelClass *klass;
-
+
klass = PLANNER_LIST_MODEL_GET_CLASS (tree_model);
-
+
if (klass->get_column_type) {
return klass->get_column_type (tree_model, column);
}
@@ -393,9 +393,9 @@ mlm_get_value (GtkTreeModel *tree_model,
GValue *value)
{
PlannerListModelClass *klass;
-
+
klass = PLANNER_LIST_MODEL_GET_CLASS (tree_model);
-
+
if (klass->get_value) {
klass->get_value (tree_model, iter, column, value);
}
@@ -411,21 +411,21 @@ planner_list_model_append (PlannerListModel *model, MrpObject *object)
g_return_if_fail (PLANNER_IS_LIST_MODEL (model));
g_return_if_fail (MRP_IS_OBJECT (object));
-
+
priv = model->priv;
priv->data_list = g_list_append (priv->data_list,
g_object_ref (object));
-
+
i = g_list_index (priv->data_list, object);
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, i);
gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path);
-
+
gtk_tree_model_row_inserted (GTK_TREE_MODEL (model), path, &iter);
-
+
gtk_tree_path_free (path);
}
@@ -491,9 +491,9 @@ planner_list_model_get_path (PlannerListModel *model, MrpObject *object)
g_return_val_if_fail (MRP_IS_OBJECT (object), NULL);
priv = model->priv;
-
+
index = g_list_index (priv->data_list, object);
-
+
if (index >= 0) {
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, index);
@@ -515,16 +515,16 @@ planner_list_model_set_data (PlannerListModel *model, GList *data)
PlannerListModelPriv *priv;
GList *old_list;
GList *node;
-
+
g_return_if_fail (PLANNER_IS_LIST_MODEL (model));
-
+
priv = model->priv;
/* Remove the old entries */
if (priv->data_list) {
old_list = g_list_copy (priv->data_list);
-
+
for (node = old_list; node; node = node->next) {
planner_list_model_remove (model, MRP_OBJECT (node->data));
}
@@ -543,6 +543,6 @@ GList *
planner_list_model_get_data (PlannerListModel *model)
{
g_return_val_if_fail (PLANNER_IS_LIST_MODEL (model), NULL);
-
+
return model->priv->data_list;
}
diff --git a/src/planner-list-model.h b/src/planner-list-model.h
index 8bc16b0..f20661d 100644
--- a/src/planner-list-model.h
+++ b/src/planner-list-model.h
@@ -43,7 +43,7 @@ typedef struct _PlannerListModelPriv PlannerListModelPriv;
struct _PlannerListModel
{
GObject parent;
-
+
PlannerListModelPriv *priv;
};
@@ -61,9 +61,9 @@ struct _PlannerListModelClass
};
GType planner_list_model_get_type (void) G_GNUC_CONST;
-void planner_list_model_append (PlannerListModel *model,
+void planner_list_model_append (PlannerListModel *model,
MrpObject *object);
-void planner_list_model_remove (PlannerListModel *model,
+void planner_list_model_remove (PlannerListModel *model,
MrpObject *object);
void planner_list_model_update (PlannerListModel *model,
MrpObject *object);
diff --git a/src/planner-main.c b/src/planner-main.c
index f5a2154..2b747cb 100644
--- a/src/planner-main.c
+++ b/src/planner-main.c
@@ -58,8 +58,8 @@ main (int argc, char **argv)
{ NULL }
};
gchar *filename;
-
- bindtextdomain (GETTEXT_PACKAGE, mrp_paths_get_locale_dir ());
+
+ bindtextdomain (GETTEXT_PACKAGE, mrp_paths_get_locale_dir ());
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
@@ -100,7 +100,7 @@ main (int argc, char **argv)
if (geometry != NULL) {
gtk_window_parse_geometry (GTK_WINDOW (main_window), geometry);
}
-
+
gtk_widget_show_all (main_window);
if (argc > 1) {
@@ -124,14 +124,14 @@ main (int argc, char **argv)
} else {
uri = g_filename_to_uri (argv[i], NULL, NULL);
}
-
+
if (uri) {
planner_window_open_in_existing_or_new (
PLANNER_WINDOW (main_window), uri, FALSE);
g_free (uri);
}
}
-
+
i++;
}
}
@@ -139,6 +139,6 @@ main (int argc, char **argv)
gtk_main ();
g_object_unref (application);
-
+
return 0;
}
diff --git a/src/planner-msp-plugin.c b/src/planner-msp-plugin.c
index 39868ac..f6e8bd9 100644
--- a/src/planner-msp-plugin.c
+++ b/src/planner-msp-plugin.c
@@ -37,7 +37,7 @@
typedef struct {
GtkWidget *open_dialog;
-} MspPluginPriv;
+} MspPluginPriv;
static void msp_plugin_open (GtkAction *action,
gpointer user_data);
@@ -52,18 +52,18 @@ static const GtkActionEntry entries[] = {
}
};
-static gboolean
+static gboolean
xml_validate (xmlDoc *doc, const gchar *dtd_path)
{
xmlValidCtxt cvp;
xmlDtd *dtd;
gboolean ret_val;
-
+
memset (&cvp, 0, sizeof (cvp));
dtd = xmlParseDTD (NULL, dtd_path);
ret_val = xmlValidateDtd (&cvp, doc, dtd);
xmlFreeDtd (dtd);
-
+
return ret_val;
}
@@ -94,7 +94,7 @@ msp_plugin_transform (PlannerPlugin *plugin,
xsltFreeStylesheet (stylesheet);
return FALSE;
}
-
+
final_doc = xsltApplyStylesheet (stylesheet, doc, NULL);
xmlFree (doc);
@@ -126,7 +126,7 @@ msp_plugin_transform (PlannerPlugin *plugin,
}
g_free (filename);
-
+
fd = g_file_open_tmp ("planner-msp-XXXXXX", &tmp_name, NULL);
if (fd == -1) {
xsltFreeStylesheet (stylesheet);
@@ -142,7 +142,7 @@ msp_plugin_transform (PlannerPlugin *plugin,
g_free (tmp_name);
return FALSE;
}
-
+
if (xsltSaveResultToFile (file, final_doc, stylesheet) == -1) {
xsltFreeStylesheet (stylesheet);
xmlFree (final_doc);
@@ -157,14 +157,14 @@ msp_plugin_transform (PlannerPlugin *plugin,
uri = g_filename_to_uri (tmp_name, NULL, NULL);
if (uri) {
planner_window_open_in_existing_or_new (plugin->main_window, uri, TRUE);
-
+
project = planner_window_get_project (plugin->main_window) ;
mrp_project_set_uri (project, NULL);
}
unlink (tmp_name);
fclose (file);
-
+
g_free (tmp_name);
g_free (uri);
@@ -175,12 +175,12 @@ static gchar *
msp_plugin_get_last_dir (PlannerPlugin *plugin)
{
gchar *dir;
-
+
dir = planner_conf_get_string (CONF_MSP_PLUGIN_LAST_DIR, NULL);
if (dir == NULL) {
dir = g_strdup (g_get_home_dir ());
}
-
+
return dir;
}
@@ -202,7 +202,7 @@ msp_plugin_get_filename (PlannerPlugin *plugin)
gchar *filename;
window = plugin->main_window;
-
+
file_chooser = gtk_file_chooser_dialog_new (_("Import a File"),
GTK_WINDOW (window),
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -234,7 +234,7 @@ msp_plugin_get_filename (PlannerPlugin *plugin)
if (response == GTK_RESPONSE_OK) {
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser));
}
-
+
gtk_widget_destroy (file_chooser);
if (filename) {
@@ -242,7 +242,7 @@ msp_plugin_get_filename (PlannerPlugin *plugin)
msp_plugin_set_last_dir (plugin, dir);
g_free (dir);
}
-
+
return filename;
}
@@ -260,12 +260,12 @@ msp_plugin_open (GtkAction *action,
g_free (filename);
}
-G_MODULE_EXPORT void
-plugin_exit (void)
+G_MODULE_EXPORT void
+plugin_exit (void)
{
}
-G_MODULE_EXPORT void
+G_MODULE_EXPORT void
plugin_init (PlannerPlugin *plugin,
PlannerWindow *main_window)
{
@@ -273,7 +273,7 @@ plugin_init (PlannerPlugin *plugin,
GtkActionGroup *actions;
GtkUIManager *ui;
gchar *filename;
-
+
priv = g_new0 (MspPluginPriv, 1);
actions = gtk_action_group_new ("MSP plugin actions");
@@ -290,7 +290,7 @@ plugin_init (PlannerPlugin *plugin,
filename = mrp_paths_get_ui_dir ("msp-plugin.ui");
gtk_ui_manager_add_ui_from_file (ui, filename, NULL);
g_free (filename);
-
+
gtk_ui_manager_ensure_update (ui);
}
diff --git a/src/planner-phase-dialog.c b/src/planner-phase-dialog.c
index 70b53d6..b9ad5f5 100644
--- a/src/planner-phase-dialog.c
+++ b/src/planner-phase-dialog.c
@@ -52,7 +52,7 @@ typedef struct {
MrpProject *project;
gchar *phase;
- gboolean is_assigned;
+ gboolean is_assigned;
gint position;
} PhaseCmdRemove;
@@ -119,13 +119,13 @@ static void phase_cmd_remove_free (PlannerCmd *cmd_base
static void
-phase_dialog_notify_phases (MrpProject *project,
+phase_dialog_notify_phases (MrpProject *project,
GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data = DIALOG_GET_DATA (dialog);
GList *list;
-
+
g_return_if_fail (MRP_IS_PROJECT (project));
g_object_get (project, "phases", &list, NULL);
@@ -139,7 +139,7 @@ phase_dialog_response_cb (GtkWidget *dialog,
DialogData *data)
{
gchar *phase;
-
+
switch (response) {
case RESPONSE_REMOVE:
phase = phase_dialog_get_selected_phase (data);
@@ -150,7 +150,7 @@ phase_dialog_response_cb (GtkWidget *dialog,
case RESPONSE_ADD:
phase_dialog_new_dialog_run (data);
break;
-
+
case RESPONSE_CLOSE:
gtk_widget_destroy (data->dialog);
break;
@@ -176,24 +176,24 @@ planner_phase_dialog_new (PlannerWindow *window)
DialogData *data;
GladeXML *glade;
GtkWidget *dialog;
- GtkTreeSelection *selection;
+ GtkTreeSelection *selection;
gchar *filename;
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
-
+
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;
}
dialog = glade_xml_get_widget (glade, "phase_dialog");
-
+
data = g_new0 (DialogData, 1);
data->main_window = window;
@@ -205,13 +205,13 @@ planner_phase_dialog_new (PlannerWindow *window)
G_CALLBACK (phase_dialog_parent_destroy_cb),
dialog,
0);
-
+
data->remove_button = glade_xml_get_widget (glade, "remove_button");
data->tree_view = glade_xml_get_widget (glade, "phase_treeview");
phase_dialog_setup_tree_view (data);
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->tree_view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
@@ -219,7 +219,7 @@ planner_phase_dialog_new (PlannerWindow *window)
"changed",
G_CALLBACK (phase_dialog_selection_changed_cb),
data);
-
+
g_signal_connect (dialog,
"response",
G_CALLBACK (phase_dialog_response_cb),
@@ -239,16 +239,16 @@ phase_dialog_setup_tree_view (DialogData *data)
GtkCellRenderer *cell;
GtkTreeViewColumn *col;
GList *list;
-
+
store = gtk_list_store_new (NUM_COLS,
G_TYPE_STRING);
-
+
g_signal_connect_object (data->project,
"notify::phases",
G_CALLBACK (phase_dialog_notify_phases),
data->dialog,
0);
-
+
gtk_tree_view_set_model (GTK_TREE_VIEW (data->tree_view),
GTK_TREE_MODEL (store));
@@ -263,7 +263,7 @@ phase_dialog_setup_tree_view (DialogData *data)
g_object_get (data->project, "phases", &list, NULL);
phase_dialog_rebuild_model (data, list);
mrp_string_list_free (list);
-
+
gtk_tree_view_expand_all (GTK_TREE_VIEW (data->tree_view));
}
@@ -280,11 +280,11 @@ phase_dialog_rebuild_model (DialogData *data,
store = GTK_LIST_STORE (gtk_tree_view_get_model (tree_view));
gtk_list_store_clear (store);
-
+
if (!list) {
return;
}
-
+
for (l = list; l; l = l->next) {
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
@@ -303,7 +303,7 @@ phase_dialog_get_selected_phase (DialogData *data)
gchar *phase;
tree_view = GTK_TREE_VIEW (data->tree_view);
-
+
selection = gtk_tree_view_get_selection (tree_view);
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
gtk_tree_model_get (model, &iter,
@@ -324,12 +324,12 @@ phase_dialog_set_selected_phase (DialogData *data,
GtkTreeIter iter;
GtkTreePath *path;
GtkTreeModel *model;
-
+
if (phase_dialog_find (data, phase, &iter)) {
model = gtk_tree_view_get_model (GTK_TREE_VIEW (data->tree_view));
-
+
path = gtk_tree_model_get_path (model, &iter);
-
+
gtk_tree_view_set_cursor (GTK_TREE_VIEW (data->tree_view),
path, NULL, FALSE);
@@ -355,7 +355,7 @@ phase_dialog_find_foreach (GtkTreeModel *model,
data->found_iter = *iter;
return TRUE;
}
-
+
return FALSE;
}
@@ -403,7 +403,7 @@ static void
phase_dialog_remove_phase (DialogData *data,
const gchar *phase)
{
- phase_cmd_remove (data->main_window, phase);
+ phase_cmd_remove (data->main_window, phase);
}
/* Handle the little "new phase" dialog. */
@@ -415,7 +415,7 @@ phase_dialog_new_name_changed_cb (GtkEntry *entry,
gboolean sensitive;
name = gtk_entry_get_text (entry);
-
+
sensitive = name && name[0];
gtk_widget_set_sensitive (data->new_ok_button, sensitive);
}
@@ -428,13 +428,13 @@ phase_dialog_new_dialog_run (DialogData *data)
GtkWidget *entry;
const gchar *name;
gchar *filename;
-
+
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");
data->new_ok_button = glade_xml_get_widget (glade, "ok_button");
@@ -447,9 +447,9 @@ phase_dialog_new_dialog_run (DialogData *data)
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
name = gtk_entry_get_text (GTK_ENTRY (entry));
- phase_cmd_insert (data->main_window, (gchar *) name ,-1);
+ phase_cmd_insert (data->main_window, (gchar *) name ,-1);
}
-
+
g_object_unref (glade);
gtk_widget_destroy (dialog);
}
@@ -466,24 +466,24 @@ phase_cmd_insert_do (PlannerCmd *cmd_base)
if (cmd->phase == NULL) {
return FALSE;
}
-
+
g_object_get (cmd->project, "phases", &list, NULL);
-
+
found = FALSE;
-
+
for (l = list; l ; l = l->next) {
- if (strcmp (cmd->phase, (char *) l->data) == 0 ) {
+ if (strcmp (cmd->phase, (char *) l->data) == 0 ) {
found = TRUE;
}
}
if (!found) {
- list = g_list_insert (list, g_strdup (cmd->phase), cmd->position);
+ list = g_list_insert (list, g_strdup (cmd->phase), cmd->position);
g_object_set (cmd->project, "phases", list, NULL);
}
-
+
mrp_string_list_free (list);
-
+
return !found;
}
@@ -520,7 +520,7 @@ phase_cmd_insert_free (PlannerCmd *cmd_base)
{
PhaseCmdInsert *cmd;
- cmd = (PhaseCmdInsert*) cmd_base;
+ cmd = (PhaseCmdInsert*) cmd_base;
g_free (cmd->phase);
@@ -529,9 +529,9 @@ phase_cmd_insert_free (PlannerCmd *cmd_base)
}
static PlannerCmd *
-phase_cmd_insert (PlannerWindow *main_window,
+phase_cmd_insert (PlannerWindow *main_window,
const gchar *phase,
- gint position_hint)
+ gint position_hint)
{
PlannerCmd *cmd_base;
PhaseCmdInsert *cmd;
@@ -547,7 +547,7 @@ phase_cmd_insert (PlannerWindow *main_window,
cmd->project = planner_window_get_project (main_window);
cmd->phase = g_strdup (phase);
-
+
cmd->position = position_hint;
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (main_window),
@@ -570,7 +570,7 @@ phase_cmd_remove_do (PlannerCmd *cmd_base)
if (assigned_phase == cmd->phase) {
cmd->is_assigned = TRUE;
}
-
+
g_object_get (cmd->project, "phases", &list, NULL);
found = FALSE;
@@ -589,7 +589,7 @@ phase_cmd_remove_do (PlannerCmd *cmd_base)
}
mrp_string_list_free (list);
-
+
return !found;
}
@@ -598,17 +598,17 @@ phase_cmd_remove_undo (PlannerCmd *cmd_base)
{
PhaseCmdRemove *cmd;
GList *list;
-
+
cmd = (PhaseCmdRemove*) cmd_base;
g_assert (cmd->phase);
-
+
g_object_get (cmd->project, "phases", &list, NULL);
- list = g_list_insert (list, g_strdup (cmd->phase), cmd->position);
-
+ list = g_list_insert (list, g_strdup (cmd->phase), cmd->position);
+
g_object_set (cmd->project, "phases", list, NULL);
- mrp_string_list_free (list);
-
+ mrp_string_list_free (list);
+
if (cmd->is_assigned) {
mrp_object_set (cmd->project, "phase", cmd->phase, NULL);
}
@@ -629,7 +629,7 @@ phase_cmd_remove_free (PlannerCmd *cmd_base)
}
static PlannerCmd *
-phase_cmd_remove (PlannerWindow *window,
+phase_cmd_remove (PlannerWindow *window,
const gchar *phase)
{
PlannerCmd *cmd_base;
diff --git a/src/planner-plugin-loader.c b/src/planner-plugin-loader.c
index a36fa57..2437364 100644
--- a/src/planner-plugin-loader.c
+++ b/src/planner-plugin-loader.c
@@ -34,16 +34,16 @@ mpl_load (const gchar *file)
PlannerPlugin *plugin;
plugin = g_object_new (PLANNER_TYPE_PLUGIN, NULL);
-
+
plugin->handle = g_module_open (file, 0);
-
+
if (plugin->handle == NULL) {
g_warning (_("Could not open plugin file '%s'\n"),
g_module_error ());
-
+
return NULL;
}
-
+
g_module_symbol (plugin->handle, "plugin_init", (gpointer)&plugin->init);
g_module_symbol (plugin->handle, "plugin_exit", (gpointer)&plugin->exit);
@@ -59,10 +59,10 @@ mpl_load_dir (const gchar *path, PlannerWindow *window)
GList *list = NULL;
dir = g_dir_open (path, 0, NULL);
- if (dir == NULL) {
+ if (dir == NULL) {
return NULL;
}
-
+
while ((name = g_dir_read_name (dir)) != NULL) {
if (g_str_has_suffix (name, G_MODULE_SUFFIX)) {
gchar *plugin_name;
@@ -76,7 +76,7 @@ mpl_load_dir (const gchar *path, PlannerWindow *window)
planner_plugin_init (plugin, window);
}
-
+
g_free (plugin_name);
}
}
@@ -91,10 +91,10 @@ planner_plugin_loader_load (PlannerWindow *window)
{
gchar *path;
GList *list;
-
+
path = mrp_paths_get_plugin_dir (NULL);
list = mpl_load_dir (path, window);
g_free (path);
-
+
return list;
}
diff --git a/src/planner-plugin.h b/src/planner-plugin.h
index 4f10a58..635df66 100644
--- a/src/planner-plugin.h
+++ b/src/planner-plugin.h
@@ -45,7 +45,7 @@ struct _PlannerPlugin {
PlannerWindow *main_window;
PlannerPluginPriv *priv;
-
+
/* Methods. */
void (*init) (PlannerPlugin *plugin,
PlannerWindow *main_window);
diff --git a/src/planner-popup-button.c b/src/planner-popup-button.c
index d66daa9..1881786 100644
--- a/src/planner-popup-button.c
+++ b/src/planner-popup-button.c
@@ -60,7 +60,7 @@ planner_popup_button_class_init (PlannerPopupButtonClass *klass)
toggle_button_class = GTK_TOGGLE_BUTTON_CLASS (klass);
toggle_button_class->toggled = planner_popup_button_toggled;
-
+
signals[POPUP] = g_signal_new ("popup",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -77,7 +77,7 @@ planner_popup_button_class_init (PlannerPopupButtonClass *klass)
planner_marshal_VOID__OBJECT_BOOLEAN,
G_TYPE_NONE, 2,
GTK_TYPE_WIDGET, G_TYPE_BOOLEAN);
-
+
g_type_class_add_private (klass, sizeof (PlannerPopupButtonPriv));
}
@@ -87,7 +87,7 @@ planner_popup_button_init (PlannerPopupButton *button)
PlannerPopupButtonPriv *priv;
priv = GET_PRIV (button);
-
+
priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_resizable (GTK_WINDOW (priv->popup_window), FALSE);
gtk_window_set_screen (GTK_WINDOW (priv->popup_window),
@@ -110,18 +110,18 @@ planner_popup_button_toggled (GtkToggleButton *toggle_button)
popup_button_popup (button);
} else {
popup_button_popdown (button, TRUE);
- }
+ }
}
GtkWidget *
planner_popup_button_new (const gchar *label)
{
GtkWidget *button;
-
+
button = g_object_new (PLANNER_TYPE_POPUP_BUTTON,
"label", label,
NULL);
-
+
return button;
}
@@ -138,23 +138,23 @@ popup_button_press_event_cb (GtkWidget *popup_window,
gint x2, y2;
priv = GET_PRIV (popup_button);
-
+
/* Popdown the window if the click is outside of it. */
-
+
if (event->button != 1) {
return FALSE;
}
-
+
x = event->x_root;
y = event->y_root;
gdk_window_get_root_origin (popup_window->window,
&xoffset,
&yoffset);
-
+
xoffset += popup_window->allocation.x;
yoffset += popup_window->allocation.y;
-
+
alloc = popup_window->allocation;
x1 = alloc.x + xoffset;
y1 = alloc.y + yoffset;
@@ -166,7 +166,7 @@ popup_button_press_event_cb (GtkWidget *popup_window,
}
planner_popup_button_popdown (popup_button, FALSE);
-
+
return FALSE;
}
@@ -190,8 +190,8 @@ popup_button_grab_on_window (GdkWindow *window,
}
static void
-popup_button_position (PlannerPopupButton *button,
- gint *x,
+popup_button_position (PlannerPopupButton *button,
+ gint *x,
gint *y)
{
PlannerPopupButtonPriv *priv;
@@ -202,16 +202,16 @@ popup_button_position (PlannerPopupButton *button,
GdkRectangle monitor;
priv = GET_PRIV (button);
-
+
button_widget = GTK_WIDGET (button);
-
+
gdk_window_get_origin (button_widget->window, x, y);
if (GTK_WIDGET_NO_WINDOW (button_widget)) {
*x += button_widget->allocation.x;
*y += button_widget->allocation.y;
}
-
+
/* The popup should be placed below the button, right-aligned to it. */
*y += button_widget->allocation.height;
*x += button_widget->allocation.width;
@@ -225,14 +225,14 @@ popup_button_position (PlannerPopupButton *button,
monitor_num = gdk_screen_get_monitor_at_window (
screen, GTK_WIDGET (button)->window);
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
-
+
if (*x < monitor.x) {
*x = monitor.x;
}
else if (*x + popup_req.width > monitor.x + monitor.width) {
*x = monitor.x + monitor.width - popup_req.width;
}
-
+
if (*y + popup_req.height > monitor.y + monitor.height) {
*y -= popup_req.height + button_widget->allocation.height;
}
@@ -256,7 +256,7 @@ popup_button_popup (PlannerPopupButton *button)
gtk_widget_show_all (priv->popup_widget);
popup_button_position (button, &x, &y);
-
+
gtk_window_move (GTK_WINDOW (priv->popup_window), x, y);
gtk_widget_show (priv->popup_window);
@@ -264,7 +264,7 @@ popup_button_popup (PlannerPopupButton *button)
if (!popup_button_grab_on_window (GTK_WIDGET (priv->popup_widget)->window,
gtk_get_current_event_time ())) {
-
+
popup_button_popdown (button, FALSE);
return;
}
@@ -283,7 +283,7 @@ popup_button_popdown (PlannerPopupButton *button,
if (!priv->popup_widget) {
return;
}
-
+
gtk_widget_hide (priv->popup_window);
g_object_ref (priv->popup_widget);
@@ -308,7 +308,7 @@ planner_popup_button_popup (PlannerPopupButton *button)
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) {
return;
}
-
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
}
diff --git a/src/planner-popup-entry.c b/src/planner-popup-entry.c
index 7f2647d..2c0a9b6 100644
--- a/src/planner-popup-entry.c
+++ b/src/planner-popup-entry.c
@@ -50,7 +50,7 @@ GtkType
planner_popup_entry_get_type (void)
{
static GtkType widget_type = 0;
-
+
if (!widget_type) {
static const GTypeInfo widget_info = {
sizeof (PlannerPopupEntryClass),
@@ -69,17 +69,17 @@ planner_popup_entry_get_type (void)
NULL, /* interface_finalize */
NULL /* interface_data */
};
-
+
widget_type = g_type_register_static (GTK_TYPE_EVENT_BOX,
"PlannerPopupEntry",
&widget_info,
0);
-
+
g_type_add_interface_static (widget_type,
GTK_TYPE_CELL_EDITABLE,
&cell_editable_info);
}
-
+
return widget_type;
}
@@ -119,7 +119,7 @@ planner_popup_entry_class_init (PlannerPopupEntryClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->key_press_event = mpw_key_press_event;
-
+
parent_class = GTK_EVENT_BOX_CLASS (g_type_class_peek_parent (klass));
signals[ARROW_CLICKED] = g_signal_new
@@ -137,7 +137,7 @@ mpw_arrow_clicked (GtkWidget *button, PlannerPopupEntry *widget)
{
g_signal_emit (widget, signals[ARROW_CLICKED], 0);
}
-
+
/* GtkCellEditable method implementations
*/
static void
@@ -154,10 +154,10 @@ gtk_cell_editable_key_press_event (GtkEntry *entry,
{
if (key_event->keyval == GDK_Escape) {
widget->editing_canceled = TRUE;
-
+
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (widget));
-
+
return TRUE;
}
@@ -170,13 +170,13 @@ mpw_key_press_event (GtkWidget *box,
{
PlannerPopupEntry *widget = PLANNER_POPUP_ENTRY (box);
GdkEvent tmp_event;
-
+
if (key_event->keyval == GDK_Escape) {
widget->editing_canceled = TRUE;
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (widget));
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (widget));
-
+
return TRUE;
}
@@ -187,10 +187,10 @@ mpw_key_press_event (GtkWidget *box,
tmp_event.key.window = widget->entry->window;
tmp_event.key.send_event = TRUE;
-
+
gtk_widget_event (widget->entry, &tmp_event);
- return GTK_WIDGET_CLASS (parent_class)->key_press_event (GTK_WIDGET (widget),
+ return GTK_WIDGET_CLASS (parent_class)->key_press_event (GTK_WIDGET (widget),
key_event);
}
@@ -245,9 +245,9 @@ planner_popup_get_button_width (void)
gint width;
GtkRequisition req;
-
+
window = gtk_window_new (GTK_WINDOW_POPUP);
-
+
button = gtk_button_new ();
gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (window), button);
@@ -260,7 +260,7 @@ planner_popup_get_button_width (void)
gtk_widget_show (window);
gtk_widget_size_request (window, &req);
-
+
width = req.width;
gtk_widget_destroy (window);
diff --git a/src/planner-predecessor-model.c b/src/planner-predecessor-model.c
index 1f92092..7738646 100644
--- a/src/planner-predecessor-model.c
+++ b/src/planner-predecessor-model.c
@@ -57,7 +57,7 @@ GType
planner_predecessor_model_get_type (void)
{
static GType type = 0;
-
+
if (!type) {
static const GTypeInfo info = {
sizeof (PlannerPredecessorModelClass),
@@ -75,7 +75,7 @@ planner_predecessor_model_get_type (void)
"PlannerPredecessorModel",
&info, 0);
}
-
+
return type;
}
@@ -84,11 +84,11 @@ mpm_class_init (PlannerPredecessorModelClass *klass)
{
GObjectClass *object_class;
PlannerListModelClass *lm_class;
-
+
parent_class = g_type_class_peek_parent (klass);
object_class = G_OBJECT_CLASS (klass);
lm_class = PLANNER_LIST_MODEL_CLASS (klass);
-
+
object_class->finalize = mpm_finalize;
lm_class->get_n_columns = mpm_get_n_columns;
@@ -100,7 +100,7 @@ static void
mpm_init (PlannerPredecessorModel *model)
{
PlannerPredecessorModelPriv *priv;
-
+
priv = g_new0 (PlannerPredecessorModelPriv, 1);
priv->project = NULL;
@@ -124,7 +124,7 @@ mpm_finalize (GObject *object)
g_free (model->priv);
model->priv = NULL;
}
-
+
if (G_OBJECT_CLASS (parent_class)->finalize) {
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -157,17 +157,17 @@ mpm_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value)
-{
+{
PlannerPredecessorModel *model;
MrpTask *task;
MrpRelation *relation;
PlannerPredecessorModelPriv *priv;
gchar *str;
-
+
g_return_if_fail (PLANNER_IS_PREDECESSOR_MODEL (tree_model));
g_return_if_fail (iter != NULL);
- model = PLANNER_PREDECESSOR_MODEL (tree_model);
+ model = PLANNER_PREDECESSOR_MODEL (tree_model);
priv = model->priv;
task = G_LIST (iter->user_data)->data;
relation = mrp_task_get_relation (priv->task, task);
@@ -200,7 +200,7 @@ mpm_get_value (GtkTreeModel *tree_model,
g_value_set_string (value, _("SF"));
break;
default:
- g_warning("Unknown relation type %d",
+ g_warning("Unknown relation type %d",
mrp_relation_get_relation_type (relation));
}
break;
@@ -227,12 +227,12 @@ mpm_predecessor_notify_cb (MrpTask *task,
}
static void
-mpm_relation_added_cb (MrpProject *project,
+mpm_relation_added_cb (MrpProject *project,
MrpRelation *relation,
PlannerPredecessorModel *model)
{
MrpTask *predecessor;
-
+
g_return_if_fail (PLANNER_IS_PREDECESSOR_MODEL (model));
predecessor = mrp_relation_get_predecessor (relation);
@@ -243,18 +243,18 @@ mpm_relation_added_cb (MrpProject *project,
if (model->priv->task == predecessor) {
return;
}
-
+
planner_list_model_append (PLANNER_LIST_MODEL (model),
MRP_OBJECT (predecessor));
- g_signal_connect_object (predecessor,
+ g_signal_connect_object (predecessor,
"notify",
G_CALLBACK (mpm_predecessor_notify_cb),
model, 0);
}
static void
-mpm_relation_removed_cb (MrpProject *project,
+mpm_relation_removed_cb (MrpProject *project,
MrpRelation *relation,
PlannerPredecessorModel *model)
{
@@ -274,14 +274,14 @@ mpm_relation_removed_cb (MrpProject *project,
planner_list_model_remove (PLANNER_LIST_MODEL (model),
MRP_OBJECT (predecessor));
- g_signal_handlers_disconnect_by_func (predecessor,
+ g_signal_handlers_disconnect_by_func (predecessor,
mpm_predecessor_notify_cb,
model);
}
-static void
+static void
mpm_predecessor_changed_cb (MrpRelation *relation, GParamSpec *pspec,
- PlannerPredecessorModel *model)
+ PlannerPredecessorModel *model)
{
MrpTask *predecessor;
@@ -323,7 +323,7 @@ planner_predecessor_model_new (MrpTask *task)
model = g_object_new (PLANNER_TYPE_PREDECESSOR_MODEL, NULL);
priv = model->priv;
- priv->task = g_object_ref (task);
+ priv->task = g_object_ref (task);
g_object_get (priv->task, "project", &priv->project, NULL);
@@ -336,8 +336,8 @@ planner_predecessor_model_new (MrpTask *task)
predecessor = mrp_relation_get_predecessor (relation);
tasks = g_list_prepend (tasks, predecessor);
-
- g_signal_connect_object (predecessor,
+
+ g_signal_connect_object (predecessor,
"notify",
G_CALLBACK (mpm_predecessor_notify_cb),
model, 0);
@@ -354,7 +354,7 @@ planner_predecessor_model_new (MrpTask *task)
"relation-added",
G_CALLBACK (mpm_relation_added_cb),
model, 0);
-
+
g_signal_connect_object (priv->task,
"relation-removed",
G_CALLBACK (mpm_relation_removed_cb),
diff --git a/src/planner-print-dialog.c b/src/planner-print-dialog.c
index 568c93b..4e77dad 100644
--- a/src/planner-print-dialog.c
+++ b/src/planner-print-dialog.c
@@ -42,27 +42,27 @@ static gboolean
ensure_dir (void)
{
char *dir;
-
+
dir = g_build_filename (g_get_home_dir (), ".gnome2", NULL);
-
+
if (!g_file_test (dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
if (g_mkdir (dir, 0755) != 0) {
g_free (dir);
return FALSE;
}
}
-
+
g_free (dir);
-
+
dir = g_build_filename (g_get_home_dir (), ".gnome2", "planner", NULL);
-
+
if (!g_file_test (dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
if (g_mkdir (dir, 0755) != 0) {
g_free (dir);
return FALSE;
}
}
-
+
g_free (dir);
return TRUE;
@@ -74,7 +74,7 @@ get_config_filename (void)
if (!ensure_dir ()) {
return NULL;
}
-
+
return g_build_filename (g_get_home_dir (),
".gnome2", "planner",
PLANNER_PRINT_CONFIG_FILE,
@@ -93,7 +93,7 @@ planner_print_dialog_load_page_setup (void)
filename = get_config_filename ();
if(filename) {
key_file = g_key_file_new();
-
+
success = g_key_file_load_from_file (key_file,
filename,
G_KEY_FILE_KEEP_COMMENTS|G_KEY_FILE_KEEP_TRANSLATIONS,
@@ -110,7 +110,7 @@ planner_print_dialog_load_page_setup (void)
g_key_file_free (key_file);
}
-
+
return page_setup;
}
@@ -135,13 +135,13 @@ planner_print_dialog_save_page_setup (GtkPageSetup *page_setup)
gtk_page_setup_to_key_file (page_setup, key_file, NULL);
str = g_key_file_to_data (key_file, NULL, NULL);
g_key_file_free (key_file);
-
+
fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
g_free (filename);
-
+
if (fd >= 0) {
bytes = strlen (str);
-
+
again:
bytes_written = write (fd, str, bytes);
if (bytes_written < 0 && errno == EINTR) {
@@ -150,7 +150,7 @@ planner_print_dialog_save_page_setup (GtkPageSetup *page_setup)
close (fd);
}
-
+
g_free (str);
}
}
@@ -166,7 +166,7 @@ planner_print_dialog_load_print_settings (void)
filename = get_config_filename ();
if(filename) {
key_file = g_key_file_new();
-
+
success = g_key_file_load_from_file (key_file,
filename,
G_KEY_FILE_KEEP_COMMENTS|G_KEY_FILE_KEEP_TRANSLATIONS,
@@ -183,7 +183,7 @@ planner_print_dialog_load_print_settings (void)
g_key_file_free (key_file);
}
-
+
return settings;
}
@@ -208,13 +208,13 @@ planner_print_dialog_save_print_settings (GtkPrintSettings *settings)
gtk_print_settings_to_key_file (settings, key_file, NULL);
str = g_key_file_to_data (key_file, NULL, NULL);
g_key_file_free (key_file);
-
+
fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
g_free (filename);
-
+
if (fd >= 0) {
bytes = strlen (str);
-
+
again:
bytes_written = write (fd, str, bytes);
if (bytes_written < 0 && errno == EINTR) {
@@ -223,7 +223,7 @@ planner_print_dialog_save_print_settings (GtkPrintSettings *settings)
close (fd);
}
-
+
g_free (str);
}
}
@@ -243,8 +243,8 @@ print_dialog_create_page (PlannerWindow *window,
outer_vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (outer_vbox), 8);
-
- str = g_strconcat ("<b>", _("Select the views to print:"), "</b>", NULL);
+
+ str = g_strconcat ("<b>", _("Select the views to print:"), "</b>", NULL);
w = gtk_label_new (str);
g_free (str);
gtk_box_pack_start (GTK_BOX (outer_vbox), w, FALSE, FALSE, 0);
@@ -265,30 +265,30 @@ print_dialog_create_page (PlannerWindow *window,
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (dialog), "summary-button", w);
*/
-
+
for (l = views; l; l = l->next) {
/* Hack. */
if (strcmp (planner_view_get_name (l->data), "resource_usage_view") == 0) {
continue;
}
-
+
w = gtk_check_button_new_with_label (planner_view_get_label (l->data));
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (w), "view", l->data);
- str = g_strdup_printf ("/views/%s/print_enabled",
+ str = g_strdup_printf ("/views/%s/print_enabled",
planner_view_get_name (l->data));
state = planner_conf_get_bool (str, NULL);
g_free (str);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), state);
-
+
buttons = g_list_prepend (buttons, w);
}
g_object_set_data (G_OBJECT (outer_vbox), "buttons", buttons);
-
+
gtk_widget_show_all (outer_vbox);
-
+
return outer_vbox;
}
@@ -303,13 +303,13 @@ planner_print_dialog_get_print_selection (GtkWidget *widget,
gchar *str;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
+
/* button = g_object_get_data (G_OBJECT (dialog), "summary-button");
if (summary) {
*summary = gtk_toggle_button_get_active (button);
}
*/
-
+
buttons = g_object_get_data (G_OBJECT (widget), "buttons");
for (l = buttons; l; l = l->next) {
button = l->data;
@@ -320,9 +320,9 @@ planner_print_dialog_get_print_selection (GtkWidget *widget,
views = g_list_prepend (views, view);
}
- str = g_strdup_printf ("/views/%s/print_enabled",
+ str = g_strdup_printf ("/views/%s/print_enabled",
planner_view_get_name (view));
- planner_conf_set_bool (str,
+ planner_conf_set_bool (str,
gtk_toggle_button_get_active (button),
NULL);
g_free (str);
diff --git a/src/planner-print-job.c b/src/planner-print-job.c
index 1e5b428..d9c9b9e 100644
--- a/src/planner-print-job.c
+++ b/src/planner-print-job.c
@@ -82,7 +82,7 @@ planner_print_job_get_type (void)
0, /* n_preallocs */
(GInstanceInitFunc) print_job_init
};
-
+
type = g_type_register_static (G_TYPE_OBJECT,
"PlannerPrintJob", &info, 0);
}
@@ -90,7 +90,7 @@ planner_print_job_get_type (void)
return type;
}
-static void
+static void
print_job_class_init (PlannerPrintJobClass *klass)
{
GObjectClass *o_class;
@@ -101,7 +101,7 @@ print_job_class_init (PlannerPrintJobClass *klass)
o_class->finalize = print_job_finalize;
}
-static void
+static void
print_job_init (PlannerPrintJob *job)
{
PlannerPrintJobPriv *priv;
@@ -131,9 +131,9 @@ static void
print_job_transform (PlannerPrintJob *job, gdouble *x, gdouble *y)
{
PlannerPrintJobPriv *priv;
-
+
priv = job->priv;
-
+
if (x) {
*x += MARGIN;
}
@@ -149,7 +149,7 @@ print_job_update_size (PlannerPrintJob *job)
PlannerPrintJobPriv *priv;
priv = job->priv;
-
+
job->height = (priv->paper_height -
priv->header_height -
priv->footer_height -
@@ -210,14 +210,14 @@ print_job_begin_print(GtkPrintOperation *operation,
priv->paper_width = gtk_print_context_get_width (context);
print_job_update_size (job);
-
+
planner_print_job_set_font_regular (job);
job->x_pad = planner_print_job_get_extents (job, "#") / 2;
for (l = priv->views; l; l = l->next) {
view = l->data;
planner_view_print_init (view, job);
-
+
n_pages += planner_view_print_get_n_pages (view);
}
gtk_print_operation_set_n_pages (operation, (n_pages > 0) ? n_pages : 1);
@@ -242,10 +242,10 @@ print_job_draw_page (GtkPrintOperation *operation,
l = priv->views;
/* Abort if there is nothing to print.
- *
+ *
* A better solution would be to set the number of pages to print to 0
* in print_job_begin_print, but 0 is not a valid value for
- * gtk_print_operation_set_n_pages.
+ * gtk_print_operation_set_n_pages.
*/
if(!l) {
return;
@@ -269,7 +269,7 @@ print_job_draw_page (GtkPrintOperation *operation,
}
static void
-print_job_end_print (GtkPrintOperation *operation,
+print_job_end_print (GtkPrintOperation *operation,
GtkPrintContext *context,
gpointer user_data)
{
@@ -293,7 +293,7 @@ planner_print_job_new (GtkPrintOperation *gpo, GList *views)
PlannerPrintJobPriv *priv;
job = g_object_new (PLANNER_TYPE_PRINT_JOB, NULL);
-
+
priv = job->priv;
job->operation = g_object_ref (gpo);
@@ -301,7 +301,7 @@ planner_print_job_new (GtkPrintOperation *gpo, GList *views)
priv->header = NULL;
priv->footer = NULL;
-
+
priv->font = pango_font_description_from_string ("Sans Regular 6");
priv->font_height = pango_font_description_get_size (priv->font) / PANGO_SCALE;
@@ -315,11 +315,11 @@ planner_print_job_new (GtkPrintOperation *gpo, GList *views)
G_CALLBACK (print_job_create_custom_widget), job);
g_signal_connect (G_OBJECT (gpo), "custom-widget-apply",
G_CALLBACK (print_job_custom_widget_apply), job);
- g_signal_connect (G_OBJECT (gpo), "begin-print",
+ g_signal_connect (G_OBJECT (gpo), "begin-print",
G_CALLBACK (print_job_begin_print), job);
- g_signal_connect (G_OBJECT (gpo), "draw-page",
+ g_signal_connect (G_OBJECT (gpo), "draw-page",
G_CALLBACK (print_job_draw_page), job);
- g_signal_connect (G_OBJECT (gpo), "end-print",
+ g_signal_connect (G_OBJECT (gpo), "end-print",
G_CALLBACK (print_job_end_print), job);
return job;
@@ -329,14 +329,14 @@ void
planner_print_job_set_header (PlannerPrintJob *job, const gchar *header)
{
PlannerPrintJobPriv *priv;
-
+
g_return_if_fail (PLANNER_IS_PRINT_JOB (job));
priv = job->priv;
g_free (priv->header);
priv->header = NULL;
-
+
if (header) {
priv->header = g_strdup (header);
priv->header_height = priv->font_height * 2;
@@ -351,14 +351,14 @@ void
planner_print_job_set_footer (PlannerPrintJob *job, const gchar *footer)
{
PlannerPrintJobPriv *priv;
-
+
g_return_if_fail (PLANNER_IS_PRINT_JOB (job));
priv = job->priv;
g_free (priv->footer);
priv->footer = NULL;
-
+
if (footer) {
priv->footer = g_strdup (footer);
priv->footer_height = priv->font_height * 2;
@@ -373,7 +373,7 @@ void
planner_print_job_set_total_pages (PlannerPrintJob *job, gint total_pages)
{
g_return_if_fail (PLANNER_IS_PRINT_JOB (job));
-
+
job->priv->total_pages = total_pages;
}
@@ -383,7 +383,7 @@ planner_print_job_moveto (PlannerPrintJob *job, gdouble x, gdouble y)
g_return_if_fail (PLANNER_IS_PRINT_JOB (job));
print_job_transform (job, &x, &y);
-
+
cairo_move_to (job->cr, x, y);
}
@@ -437,7 +437,7 @@ planner_print_job_show_clipped (PlannerPrintJob *job,
gint height;
priv = job->priv;
-
+
x1 = MAX (x1, 0);
x2 = MIN (x2, job->width);
y1 = MAX (y1, 0);
@@ -467,14 +467,14 @@ planner_print_job_show_clipped (PlannerPrintJob *job,
pango_layout_set_text (layout, str, strlen(str));
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
pango_layout_set_width (layout, (x2 - x1) * PANGO_SCALE);
-
+
pango_layout_set_font_description (layout, priv->current_font);
pango_layout_context_changed (layout);
pango_layout_get_pixel_size (layout, NULL, &height);
planner_print_job_moveto (job, x, y - priv->font_height);
-
+
pango_cairo_show_layout (job->cr, layout);
g_object_unref (layout);
@@ -486,9 +486,9 @@ gboolean
planner_print_job_begin_next_page (PlannerPrintJob *job)
{
PlannerPrintJobPriv *priv;
-
+
g_return_val_if_fail (PLANNER_IS_PRINT_JOB (job), FALSE);
-
+
priv = job->priv;
if ((priv->active_page + 1) > priv->total_pages) {
@@ -531,7 +531,7 @@ planner_print_job_finish_page (PlannerPrintJob *job, gboolean draw_border)
cairo_new_path (job->cr);
cairo_set_line_width (job->cr, THIN_LINE_WIDTH);
-
+
planner_print_job_moveto (job, 0, 0);
planner_print_job_lineto (job, job->width, 0);
planner_print_job_lineto (job, job->width, job->height);
@@ -547,7 +547,7 @@ PangoFontDescription *
planner_print_job_get_font (PlannerPrintJob *job)
{
g_return_val_if_fail (PLANNER_IS_PRINT_JOB (job), NULL);
-
+
return job->priv->font;
}
@@ -555,7 +555,7 @@ gdouble
planner_print_job_get_font_height (PlannerPrintJob *job)
{
g_return_val_if_fail (PLANNER_IS_PRINT_JOB (job), 0);
-
+
return job->priv->font_height;
}
@@ -563,11 +563,11 @@ void
planner_print_job_set_font_regular (PlannerPrintJob *job)
{
PlannerPrintJobPriv *priv;
-
+
g_return_if_fail (PLANNER_IS_PRINT_JOB (job));
priv = job->priv;
-
+
priv->current_font = priv->font;
}
@@ -575,11 +575,11 @@ void
planner_print_job_set_font_bold (PlannerPrintJob *job)
{
PlannerPrintJobPriv *priv;
-
+
g_return_if_fail (PLANNER_IS_PRINT_JOB (job));
-
+
priv = job->priv;
-
+
priv->current_font = priv->bold_font;
}
@@ -587,13 +587,13 @@ void
planner_print_job_set_font_italic (PlannerPrintJob *job)
{
PlannerPrintJobPriv *priv;
-
+
g_return_if_fail (PLANNER_IS_PRINT_JOB (job));
-
+
priv = job->priv;
/* FIXME: use italic. */
-
+
priv->current_font = priv->bold_font;
}
@@ -613,7 +613,7 @@ planner_print_job_get_extents (PlannerPrintJob *job, char *text)
pango_layout_context_changed (layout);
pango_layout_get_extents (layout, &ink, NULL);
-
+
g_object_unref (layout);
return ((gdouble)ink.width / PANGO_SCALE);
diff --git a/src/planner-print-job.h b/src/planner-print-job.h
index 82c844f..4c44338 100644
--- a/src/planner-print-job.h
+++ b/src/planner-print-job.h
@@ -61,7 +61,7 @@ struct _PlannerPrintJobClass {
};
GType planner_print_job_get_type (void) G_GNUC_CONST;
-PlannerPrintJob * planner_print_job_new (GtkPrintOperation *gpo,
+PlannerPrintJob * planner_print_job_new (GtkPrintOperation *gpo,
GList *views);
void planner_print_job_set_header (PlannerPrintJob *job,
const gchar *header);
diff --git a/src/planner-project-properties.c b/src/planner-project-properties.c
index 4722186..bb4febd 100644
--- a/src/planner-project-properties.c
+++ b/src/planner-project-properties.c
@@ -53,7 +53,7 @@ typedef struct {
GtkWidget *calendar;
GtkWidget *calendar_window;
-
+
GtkTreeView *properties_tree;
GtkWidget *add_property_button;
GtkWidget *remove_property_button;
@@ -61,27 +61,27 @@ typedef struct {
typedef struct {
PlannerCmd base;
-
+
MrpProject *project;
- gchar *name;
+ gchar *name;
MrpPropertyType type;
gchar *label;
gchar *description;
GType owner;
- gboolean user_defined;
+ gboolean user_defined;
} PropertyCmdAdd;
typedef struct {
PlannerCmd base;
-
+
MrpProject *project;
- gchar *name;
+ gchar *name;
MrpPropertyType type;
gchar *label;
gchar *description;
GType owner;
- gboolean user_defined;
- gchar *old_text;
+ gboolean user_defined;
+ gchar *old_text;
} PropertyCmdRemove;
typedef struct {
@@ -230,8 +230,8 @@ typedef struct {
MrpProject *project;
PropType type;
- gchar *property;
-
+ gchar *property;
+
/* String */
gchar *str;
gchar *str_old;
@@ -239,10 +239,10 @@ typedef struct {
/* Date */
mrptime t;
mrptime t_old;
-
+
/* This won't work... the calendar might be removed and re-added... so
* the pointer will not be the same.
- */
+ */
MrpCalendar *calendar;
MrpCalendar *calendar_old;
} PropertyCmdEdit;
@@ -260,13 +260,13 @@ property_cmd_edit_do (PlannerCmd *cmd_base)
cmd->property, cmd->str,
NULL);
break;
-
+
case PROP_DATE:
g_object_set (cmd->project,
cmd->property, cmd->t,
NULL);
break;
-
+
case PROP_CALENDAR:
g_object_set (cmd->project,
cmd->property, cmd->calendar,
@@ -289,12 +289,12 @@ property_cmd_edit_undo (PlannerCmd *cmd_base)
g_object_set (cmd->project, cmd->property,
cmd->str_old, NULL);
break;
-
+
case PROP_DATE:
g_object_set (cmd->project, cmd->property,
cmd->t_old, NULL);
break;
-
+
case PROP_CALENDAR:
g_object_set (cmd->project, cmd->property,
cmd->calendar_old, NULL);
@@ -319,7 +319,7 @@ property_cmd_edit (DialogData *data,
property_cmd_edit_do,
property_cmd_edit_undo,
NULL /* FIXME */);
-
+
cmd = (PropertyCmdEdit *) cmd_base;
switch (type) {
@@ -328,7 +328,7 @@ property_cmd_edit (DialogData *data,
if (str_value == NULL && cmd->str_old == NULL) {
goto no_change;
}
-
+
if (str_value && cmd->str_old &&
strcmp (str_value, cmd->str_old) == 0) {
goto no_change;
@@ -336,16 +336,16 @@ property_cmd_edit (DialogData *data,
cmd->str = g_strdup (str_value);
break;
-
+
case PROP_DATE:
g_object_get (data->project, property, &cmd->t_old, NULL);
if (time_value == cmd->t_old) {
goto no_change;
}
-
+
cmd->t = time_value;
break;
-
+
case PROP_CALENDAR:
g_object_get (data->project, property, &cmd->calendar_old, NULL);
if (calendar_value == cmd->calendar_old) {
@@ -355,7 +355,7 @@ property_cmd_edit (DialogData *data,
cmd->calendar = calendar_value;
break;
}
-
+
cmd->project = data->project;
cmd->type = type;
cmd->property = g_strdup (property);
@@ -379,7 +379,7 @@ mpp_select_calendar_clicked_cb (GtkWidget *button,
GtkWidget *selector;
gint response;
MrpCalendar *calendar;
-
+
data = DIALOG_GET_DATA (dialog);
selector = planner_calendar_selector_new (
@@ -392,7 +392,7 @@ mpp_select_calendar_clicked_cb (GtkWidget *button,
calendar = planner_calendar_selector_get_calendar (selector);
g_object_set (data->project, "calendar", calendar, NULL);
break;
-
+
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
break;
@@ -460,9 +460,9 @@ mpp_connect_to_project (MrpProject *project, GtkWidget *dialog)
0);
}
-static void
-mpp_project_name_notify_cb (MrpProject *project,
- GParamSpec *pspec,
+static void
+mpp_project_name_notify_cb (MrpProject *project,
+ GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
@@ -483,7 +483,7 @@ mpp_name_set_from_widget (GtkWidget *dialog)
data = DIALOG_GET_DATA (dialog);
str = gtk_entry_get_text (GTK_ENTRY (data->name_entry));
-
+
property_cmd_edit (data, _("Edit Project Name"), PROP_STRING, "name", str, 0, NULL);
}
@@ -493,13 +493,13 @@ mpp_name_focus_out_event_cb (GtkWidget *widget,
GtkWidget *dialog)
{
mpp_name_set_from_widget (dialog);
-
+
return FALSE;
}
-static void
-mpp_project_org_notify_cb (MrpProject *project,
- GParamSpec *pspec,
+static void
+mpp_project_org_notify_cb (MrpProject *project,
+ GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
@@ -508,7 +508,7 @@ mpp_project_org_notify_cb (MrpProject *project,
g_object_get (project, "organization", &org, NULL);
data = DIALOG_GET_DATA (dialog);
gtk_entry_set_text (GTK_ENTRY (data->org_entry), org);
- g_free (org);
+ g_free (org);
}
static void
@@ -516,10 +516,10 @@ mpp_org_set_from_widget (GtkWidget *dialog)
{
DialogData *data;
const gchar *str;
-
+
data = DIALOG_GET_DATA (dialog);
str = gtk_entry_get_text (GTK_ENTRY (data->org_entry));
-
+
property_cmd_edit (data, _("Edit Organization"), PROP_STRING, "organization", str, 0, NULL);
}
@@ -529,15 +529,15 @@ mpp_org_focus_out_event_cb (GtkWidget *widget,
GtkWidget *dialog)
{
mpp_org_set_from_widget (dialog);
-
+
return FALSE;
}
-static void
-mpp_project_manager_notify_cb (MrpProject *project,
- GParamSpec *pspec,
+static void
+mpp_project_manager_notify_cb (MrpProject *project,
+ GParamSpec *pspec,
GtkWidget *dialog)
-{
+{
DialogData *data;
gchar *manager;
@@ -552,10 +552,10 @@ mpp_manager_set_from_widget (GtkWidget *dialog)
{
DialogData *data;
const gchar *str;
-
+
data = DIALOG_GET_DATA (dialog);
str = gtk_entry_get_text (GTK_ENTRY (data->manager_entry));
-
+
property_cmd_edit (data, _("Edit Manager"), PROP_STRING, "manager", str, 0, NULL);
}
@@ -565,7 +565,7 @@ mpp_manager_focus_out_event_cb (GtkWidget *widget,
GtkWidget *dialog)
{
mpp_manager_set_from_widget (dialog);
-
+
return FALSE;
}
@@ -585,7 +585,7 @@ mpp_set_start (GtkWidget *dialog, mrptime start)
static void
mpp_project_start_notify_cb (MrpProject *project,
- GParamSpec *pspec,
+ GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
@@ -609,25 +609,25 @@ mpp_start_set_from_widget (GtkWidget *dialog)
data = DIALOG_GET_DATA (dialog);
str = gtk_entry_get_text (GTK_ENTRY (data->start_entry));
-
+
date = g_date_new ();
g_date_set_parse (date, str);
-
+
if (!g_date_valid (date)) {
return;
}
-
+
year = g_date_get_year (date);
month = g_date_get_month (date);
day = g_date_get_day (date);
-
+
g_date_free (date);
start = mrp_time_compose (year, month, day, 0, 0, 0);
if (start < 0) {
return;
}
-
+
property_cmd_edit (data, _("Edit Project Start"), PROP_DATE, "project-start", NULL, start, NULL);
}
@@ -637,7 +637,7 @@ mpp_start_focus_out_event_cb (GtkWidget *widget,
GtkWidget *dialog)
{
mpp_start_set_from_widget (dialog);
-
+
return FALSE;
}
@@ -661,7 +661,7 @@ mpp_start_save_date (GtkWidget *dialog)
month++;
start = mrp_time_compose (year, month, day, 0, 0, 0);
-
+
property_cmd_edit (data, _("Edit Project Start"), PROP_DATE, "project-start", NULL, start, NULL);
mpp_set_start (dialog, start);
@@ -695,7 +695,7 @@ mpp_start_today_clicked_cb (GtkWidget *button,
mrptime today;
data = DIALOG_GET_DATA (dialog);
-
+
today = mrp_time_current_time ();
mpp_start_set_date (GTK_CALENDAR (data->calendar), today);
}
@@ -722,17 +722,17 @@ mpp_start_button_popup_cb (PlannerPopupButton *popup_button,
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
-
+
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
-
+
data->calendar = gtk_calendar_new ();
gtk_box_pack_start (GTK_BOX (vbox), data->calendar, TRUE, TRUE, 0);
start = mrp_project_get_project_start (data->project);
mpp_start_set_date (GTK_CALENDAR (data->calendar), start);
-
+
bbox = gtk_hbutton_box_new ();
gtk_box_set_spacing (GTK_BOX (bbox), 6);
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
@@ -743,7 +743,7 @@ mpp_start_button_popup_cb (PlannerPopupButton *popup_button,
"clicked",
G_CALLBACK (mpp_start_today_clicked_cb),
dialog);
-
+
button = gtk_button_new_with_label (_("Cancel"));
gtk_container_add (GTK_CONTAINER (bbox), button);
g_signal_connect (button,
@@ -758,7 +758,7 @@ mpp_start_button_popup_cb (PlannerPopupButton *popup_button,
popup_button);
g_signal_connect (data->calendar,
- "day-selected-double-click",
+ "day-selected-double-click",
G_CALLBACK (mpp_start_double_click_cb),
popup_button);
@@ -778,23 +778,23 @@ mpp_start_button_popdown_cb (PlannerPopupButton *button,
if (ok) {
mpp_start_save_date (dialog);
}
-
+
data->calendar = NULL;
gtk_widget_destroy (widget);
}
-static void
-mpp_project_calendar_notify_cb (MrpProject *project,
- GParamSpec *pspec,
+static void
+mpp_project_calendar_notify_cb (MrpProject *project,
+ GParamSpec *pspec,
GtkWidget *dialog)
-{
+{
DialogData *data;
MrpCalendar *calendar;
data = DIALOG_GET_DATA (dialog);
calendar = mrp_project_get_calendar (project);
-
+
gtk_label_set_text (GTK_LABEL (data->calendar_label),
mrp_calendar_get_name (calendar));
}
@@ -807,16 +807,16 @@ mpp_phase_option_menu_changed_cb (GtkOptionMenu *option_menu,
}
static void
-mpp_project_phases_notify_cb (MrpProject *project,
+mpp_project_phases_notify_cb (MrpProject *project,
GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data = DIALOG_GET_DATA (dialog);
-
+
g_signal_handlers_block_by_func (data->phase_option_menu,
mpp_phase_option_menu_changed_cb,
dialog);
-
+
mpp_setup_phases (data);
g_signal_handlers_unblock_by_func (data->phase_option_menu,
@@ -838,12 +838,12 @@ mpp_phase_set_from_widget (GtkWidget *dialog)
item = gtk_menu_get_active (GTK_MENU (menu));
phase = g_object_get_data (G_OBJECT (item), "data");
-
+
property_cmd_edit (data, _("Edit Project Phase"), PROP_STRING, "phase", phase, 0, NULL);
}
static void
-mpp_project_phase_notify_cb (MrpProject *project,
+mpp_project_phase_notify_cb (MrpProject *project,
GParamSpec *pspec,
GtkWidget *dialog)
{
@@ -865,11 +865,11 @@ mpp_setup_phases (DialogData *data)
GtkWidget *menu;
GtkWidget *menu_item;
gchar *phase;
-
+
phases = NULL;
g_object_get (data->project, "phases", &phases, NULL);
-
+
option_menu = GTK_OPTION_MENU (data->phase_option_menu);
menu = gtk_option_menu_get_menu (option_menu);
@@ -887,7 +887,7 @@ mpp_setup_phases (DialogData *data)
menu_item = gtk_menu_item_new_with_label (l->data);
gtk_widget_show (menu_item);
gtk_menu_append (GTK_MENU (menu), menu_item);
-
+
g_object_set_data_full (G_OBJECT (menu_item),
"data",
g_strdup (l->data),
@@ -919,20 +919,20 @@ mpp_set_phase (DialogData *data,
if (phase) {
menu = gtk_option_menu_get_menu (option_menu);
-
+
children = GTK_MENU_SHELL (menu)->children;
for (i = 0, l = children; l; i++, l = l->next) {
item = l->data;
-
+
name = g_object_get_data (G_OBJECT (item), "data");
-
+
if (name && !strcmp (phase, name)) {
gtk_option_menu_set_history (option_menu, i);
return;
}
}
}
-
+
/* If we didn't match, set "None". */
gtk_option_menu_set_history (option_menu, 0);
}
@@ -945,22 +945,22 @@ mpp_setup_properties_list (GtkWidget *dialog)
GtkTreeModel *model;
GtkTreeViewColumn *col;
GtkCellRenderer *cell;
-
+
model = GTK_TREE_MODEL (
gtk_list_store_new (NUM_OF_COLS, G_TYPE_POINTER));
gtk_tree_view_set_model (data->properties_tree, model);
-
+
properties = mrp_project_get_properties_from_type (data->project,
MRP_TYPE_PROJECT);
-
+
for (l = properties; l; l = l->next) {
MrpProperty *property = MRP_PROPERTY (l->data);
GtkTreeIter iter;
-
+
if (!mrp_property_get_user_defined (property)) {
continue;
}
-
+
gtk_list_store_append (GTK_LIST_STORE (model),
&iter);
gtk_list_store_set (GTK_LIST_STORE (model),
@@ -971,30 +971,30 @@ mpp_setup_properties_list (GtkWidget *dialog)
cell = gtk_cell_renderer_text_new ();
g_object_set (cell, "editable", FALSE, NULL);
-
- col = gtk_tree_view_column_new_with_attributes (_("Property"),
+
+ col = gtk_tree_view_column_new_with_attributes (_("Property"),
cell, NULL);
- gtk_tree_view_column_set_cell_data_func (col, cell,
+ gtk_tree_view_column_set_cell_data_func (col, cell,
(GtkTreeCellDataFunc) mpp_property_name_data_func,
dialog, NULL);
gtk_tree_view_append_column (data->properties_tree, col);
-
+
cell = gtk_cell_renderer_text_new ();
g_object_set (cell, "editable", TRUE, NULL);
-
+
col = gtk_tree_view_column_new_with_attributes (_("Value"),
cell, NULL);
- gtk_tree_view_column_set_cell_data_func (col, cell,
+ gtk_tree_view_column_set_cell_data_func (col, cell,
(GtkTreeCellDataFunc) mpp_property_value_data_func,
dialog, NULL);
-
+
g_signal_connect (cell,
"edited",
G_CALLBACK (mpp_property_value_edited),
dialog);
-
+
gtk_tree_view_append_column (data->properties_tree, col);
}
@@ -1006,7 +1006,7 @@ mpp_property_name_data_func (GtkTreeViewColumn *tree_column,
GtkWidget *dialog)
{
MrpProperty *property;
-
+
gtk_tree_model_get (tree_model, iter, COL_PROPERTY, &property, -1);
g_object_set (cell,
@@ -1028,7 +1028,7 @@ mpp_property_value_data_func (GtkTreeViewColumn *tree_column,
gint ivalue;
gfloat fvalue;
/* mrptime tvalue; */
-
+
gtk_tree_model_get (tree_model, iter, COL_PROPERTY, &property, -1);
type = mrp_property_get_property_type (property);
@@ -1038,10 +1038,10 @@ mpp_property_value_data_func (GtkTreeViewColumn *tree_column,
mrp_object_get (data->project,
mrp_property_get_name (property), &svalue,
NULL);
-
+
if (svalue == NULL) {
svalue = g_strdup ("");
- }
+ }
break;
case MRP_PROPERTY_TYPE_INT:
@@ -1061,29 +1061,29 @@ mpp_property_value_data_func (GtkTreeViewColumn *tree_column,
case MRP_PROPERTY_TYPE_DATE:
svalue = g_strdup ("");
-
-
+
+
/* mrp_object_get (data->project, */
/* mrp_property_get_name (property), &tvalue, */
/* NULL); */
/* svalue = planner_format_date (tvalue); */
break;
-
+
case MRP_PROPERTY_TYPE_DURATION:
mrp_object_get (data->project,
mrp_property_get_name (property), &ivalue,
- NULL);
+ NULL);
svalue = planner_format_duration (data->project, ivalue);
break;
-
+
case MRP_PROPERTY_TYPE_COST:
mrp_object_get (data->project,
mrp_property_get_name (property), &fvalue,
- NULL);
+ NULL);
svalue = planner_format_float (fvalue, 2, FALSE);
break;
-
+
default:
g_warning ("Type not implemented.");
svalue = g_strdup ("");
@@ -1095,7 +1095,7 @@ mpp_property_value_data_func (GtkTreeViewColumn *tree_column,
}
static void
-mpp_property_added (MrpProject *project,
+mpp_property_added (MrpProject *project,
GType object_type,
MrpProperty *property,
GtkWidget *dialog)
@@ -1103,14 +1103,14 @@ mpp_property_added (MrpProject *project,
DialogData *data = DIALOG_GET_DATA (dialog);
GtkTreeModel *model;
GtkTreeIter iter;
-
+
model = gtk_tree_view_get_model (data->properties_tree);
if (object_type != MRP_TYPE_PROJECT ||
!mrp_property_get_user_defined (property)) {
return;
}
-/*
+/*
if (gtk_tree_view_get_model (data->properties_tree) != model) {
return;
}
@@ -1135,12 +1135,12 @@ mpp_property_find (GtkTreeModel *model,
PropertyFindData *data)
{
MrpProperty *property;
-
+
gtk_tree_model_get (model, iter,
COL_PROPERTY, &property,
-1);
-
- if (strcmp (mrp_property_get_name (data->property),
+
+ if (strcmp (mrp_property_get_name (data->property),
mrp_property_get_name (property)) == 0) {
data->found_path = gtk_tree_path_copy (path);
data->found_iter = gtk_tree_iter_copy (iter);
@@ -1151,21 +1151,21 @@ mpp_property_find (GtkTreeModel *model,
}
static void
-mpp_property_removed (MrpProject *project,
+mpp_property_removed (MrpProject *project,
MrpProperty *property,
GtkWidget *dialog)
{
DialogData *data = DIALOG_GET_DATA (dialog);
GtkTreeModel *model;
PropertyFindData *find_data;
-
+
model = gtk_tree_view_get_model (data->properties_tree);
-
+
find_data = g_new0 (PropertyFindData, 1);
find_data->property = mrp_property_ref (property);
find_data->found_path = NULL;
find_data->found_iter = NULL;
-
+
gtk_tree_model_foreach (model,
(GtkTreeModelForeachFunc) mpp_property_find,
find_data);
@@ -1176,16 +1176,16 @@ mpp_property_removed (MrpProject *project,
gtk_list_store_remove (GTK_LIST_STORE (model),
find_data->found_iter);
mrp_property_unref (property);
-
+
gtk_tree_iter_free (find_data->found_iter);
gtk_tree_path_free (find_data->found_path);
}
-
+
g_free (find_data);
}
static void
-mpp_property_changed (MrpProject *project,
+mpp_property_changed (MrpProject *project,
GType object_type,
MrpProperty *property,
GtkWidget *dialog)
@@ -1193,22 +1193,22 @@ mpp_property_changed (MrpProject *project,
DialogData *data;
GtkTreeModel *model;
PropertyFindData *find_data;
-
+
/* Check for NULL here and shift the check for GTK_IS_DIALOG further in.
- * The problem is with property_changed due to the way that there are
- * 3 types of properties so if you have different dialogs opened the
+ * The problem is with property_changed due to the way that there are
+ * 3 types of properties so if you have different dialogs opened the
* wrong data can upset the open dialogs.
- */
-
+ */
+
if (object_type == MRP_TYPE_PROJECT) {
data = DIALOG_GET_DATA (dialog);
model = gtk_tree_view_get_model (data->properties_tree);
-
+
find_data = g_new0 (PropertyFindData, 1);
find_data->property = property;
find_data->found_path = NULL;
find_data->found_iter = NULL;
-
+
gtk_tree_model_foreach (model,
(GtkTreeModelForeachFunc) mpp_property_find,
find_data);
@@ -1259,7 +1259,7 @@ mpp_property_dialog_setup_option_menu (GtkWidget *option_menu,
if (menu) {
gtk_widget_destroy (menu);
}
-
+
menu = gtk_menu_new ();
va_start (args, str1);
@@ -1269,7 +1269,7 @@ mpp_property_dialog_setup_option_menu (GtkWidget *option_menu,
gtk_menu_append (GTK_MENU (menu), menu_item);
type = va_arg (args, gint);
-
+
g_object_set_data (G_OBJECT (menu_item),
"data",
GINT_TO_POINTER (type));
@@ -1292,21 +1292,21 @@ mpp_property_dialog_get_selected (GtkWidget *option_menu)
GtkWidget *menu;
GtkWidget *item;
gint ret;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
-
+
item = gtk_menu_get_active (GTK_MENU (menu));
ret = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "data"));
return ret;
-}
+}
static void
mpp_property_dialog_type_selected_cb (GtkWidget *widget, GtkWidget *dialog)
{
gint type;
-
+
type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "data"));
g_object_set_data (G_OBJECT (dialog), "type", GINT_TO_POINTER (type));
@@ -1328,18 +1328,18 @@ mpp_add_property_button_clicked_cb (GtkButton *button, GtkWidget *dialog)
gint response;
gboolean finished = FALSE;
gchar *filename;
-
+
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");
label_entry = glade_xml_get_widget (glade, "label_entry");
name_entry = glade_xml_get_widget (glade, "name_entry");
-
+
g_signal_connect (label_entry,
"focus_out_event",
G_CALLBACK (mpp_property_dialog_label_changed_cb),
@@ -1373,7 +1373,7 @@ mpp_add_property_button_clicked_cb (GtkButton *button, GtkWidget *dialog)
finished = FALSE;
break;
}
-
+
name = gtk_entry_get_text (GTK_ENTRY (name_entry));
if (name == NULL || name[0] == 0) {
finished = FALSE;
@@ -1383,7 +1383,7 @@ mpp_add_property_button_clicked_cb (GtkButton *button, GtkWidget *dialog)
/* FIXME: This is broken wrt UTF-8. */
if (!isalpha(name[0])) {
GtkWidget *dialog;
-
+
dialog = gtk_message_dialog_new (GTK_WINDOW (add_dialog),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
@@ -1392,42 +1392,42 @@ mpp_add_property_button_clicked_cb (GtkButton *button, GtkWidget *dialog)
"start with a letter."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
-
+
finished = FALSE;
break;
}
-
+
w = glade_xml_get_widget (glade, "description_entry");
description = gtk_entry_get_text (GTK_ENTRY (w));
-
+
w = glade_xml_get_widget (glade, "type_menu");
-
+
type = mpp_property_dialog_get_selected (w);
if (type != MRP_PROPERTY_TYPE_NONE) {
property_cmd_add (data->main_window,
- data->project,
- MRP_TYPE_PROJECT,
- name,
+ data->project,
+ MRP_TYPE_PROJECT,
+ name,
type,
label,
description,
TRUE);
}
-
+
finished = TRUE;
break;
-
+
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
finished = TRUE;
break;
-
+
default:
break;
}
}
-
+
gtk_widget_destroy (add_dialog);
}
@@ -1441,9 +1441,9 @@ mpp_remove_property_button_clicked_cb (GtkButton *button, GtkWidget *dialog)
MrpProperty *property;
GtkWidget *remove_dialog;
gint response;
-
+
model = gtk_tree_view_get_model (data->properties_tree);
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->properties_tree));
if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) {
@@ -1462,17 +1462,17 @@ mpp_remove_property_button_clicked_cb (GtkButton *button, GtkWidget *dialog)
_("Do you really want to remove the property '%s' from "
"the project?"),
mrp_property_get_name (property));
-
+
response = gtk_dialog_run (GTK_DIALOG (remove_dialog));
switch (response) {
case GTK_RESPONSE_YES:
property_cmd_remove (data->main_window,
- data->project,
+ data->project,
MRP_TYPE_PROJECT,
mrp_property_get_name (property));
break;
-
+
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
break;
@@ -1496,22 +1496,22 @@ mpp_property_value_edited (GtkCellRendererText *cell,
GtkTreeModel *model;
MrpProperty *property;
MrpProject *project;
-
+
model = gtk_tree_view_get_model (data->properties_tree);
project = data->project;
-
+
path = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter,
COL_PROPERTY, &property,
-1);
-
- property_cmd_value_edited (data->main_window,
+
+ property_cmd_value_edited (data->main_window,
project,
- property,
+ property,
new_text);
-
+
gtk_tree_path_free (path);
}
@@ -1531,7 +1531,7 @@ mpp_dialog_destroy_cb (GtkWidget *dialog,
mpp_manager_set_from_widget (dialog);
mpp_start_set_from_widget (dialog);
}
-
+
GtkWidget *
planner_project_properties_new (PlannerWindow *window)
{
@@ -1544,22 +1544,22 @@ planner_project_properties_new (PlannerWindow *window)
MrpCalendar *calendar;
GtkWidget *hbox;
gchar *filename;
-
+
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
-
+
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;
}
dialog = glade_xml_get_widget (glade, "project_properties");
-
+
data = g_new0 (DialogData, 1);
data->main_window = window;
@@ -1571,7 +1571,7 @@ planner_project_properties_new (PlannerWindow *window)
G_CALLBACK (mpp_parent_destroy_cb),
dialog,
0);
-
+
g_signal_connect_object (window,
"destroy",
G_CALLBACK (mpp_parent_destroy_cb),
@@ -1582,7 +1582,7 @@ planner_project_properties_new (PlannerWindow *window)
"destroy",
G_CALLBACK (mpp_dialog_destroy_cb),
NULL);
-
+
data->name_entry = glade_xml_get_widget (glade, "entry_name");
data->org_entry = glade_xml_get_widget (glade, "entry_org");
data->manager_entry = glade_xml_get_widget (glade, "entry_manager");
@@ -1592,14 +1592,14 @@ planner_project_properties_new (PlannerWindow *window)
data->phase_option_menu = glade_xml_get_widget (glade, "optionmenu_phase");
data->calendar_label = glade_xml_get_widget (glade, "label_calendar");
data->properties_tree = GTK_TREE_VIEW (glade_xml_get_widget (glade, "properties_tree"));
-
+
data->add_property_button = glade_xml_get_widget (glade,
"add_property_button");
data->remove_property_button = glade_xml_get_widget (glade,
"remove_property_button");
gtk_box_pack_start (GTK_BOX (hbox), data->start_button, FALSE, FALSE, 0);
-
+
g_signal_connect (data->start_button,
"popup",
G_CALLBACK (mpp_start_button_popup_cb),
@@ -1609,10 +1609,10 @@ planner_project_properties_new (PlannerWindow *window)
"popdown",
G_CALLBACK (mpp_start_button_popdown_cb),
dialog);
-
+
g_object_set_data_full (G_OBJECT (dialog), "data", data, g_free);
g_object_set_data (G_OBJECT (dialog), "project", data->project);
-
+
g_object_get (data->project,
"name", &name,
"organization", &org,
@@ -1625,7 +1625,7 @@ planner_project_properties_new (PlannerWindow *window)
"focus_out_event",
G_CALLBACK (mpp_start_focus_out_event_cb),
dialog);
-
+
if (name) {
gtk_entry_set_text (GTK_ENTRY (data->name_entry), name);
}
@@ -1679,7 +1679,7 @@ planner_project_properties_new (PlannerWindow *window)
"clicked",
G_CALLBACK (mpp_select_calendar_clicked_cb),
dialog);
-
+
g_free (name);
g_free (manager);
g_free (org);
@@ -1687,7 +1687,7 @@ planner_project_properties_new (PlannerWindow *window)
mpp_connect_to_project (data->project, dialog);
gtk_widget_show_all (dialog);
-
+
g_object_unref (glade);
return dialog;
@@ -1697,15 +1697,15 @@ planner_project_properties_new (PlannerWindow *window)
/*
* Gets the value of a MrpProperty and converts to a string.
- *
+ *
* Return value: A const char *, if found, otherwise NULL.
- * NOTES: This can't be made part of mrp-project.c as it uses planner-format.h
+ * NOTES: This can't be made part of mrp-project.c as it uses planner-format.h
* and thats not in libplanner so a bit messy. Its obviously not able to be in
* mrp-properties.c as thats common to all projects and not just one. So this'll
* have to stay here for now.
*
*/
-
+
const char *
mpp_project_property_get_value_string (MrpProject *project,
MrpProperty *property)
@@ -1714,7 +1714,7 @@ mpp_project_property_get_value_string (MrpProject *project,
gchar *svalue;
gint ivalue;
gfloat fvalue;
-
+
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
g_return_val_if_fail (property != NULL, NULL);
@@ -1725,10 +1725,10 @@ mpp_project_property_get_value_string (MrpProject *project,
mrp_object_get (project,
mrp_property_get_name (property), &svalue,
NULL);
-
+
if (svalue == NULL) {
svalue = g_strdup ("");
- }
+ }
break;
case MRP_PROPERTY_TYPE_INT:
@@ -1748,29 +1748,29 @@ mpp_project_property_get_value_string (MrpProject *project,
case MRP_PROPERTY_TYPE_DATE:
svalue = g_strdup ("");
-
-
+
+
/* mrp_object_get (data->project, */
/* mrp_property_get_name (property), &tvalue, */
/* NULL); */
/* svalue = planner_format_date (tvalue); */
break;
-
+
case MRP_PROPERTY_TYPE_DURATION:
mrp_object_get (project,
mrp_property_get_name (property), &ivalue,
- NULL);
+ NULL);
svalue = planner_format_duration (project, ivalue);
break;
-
+
case MRP_PROPERTY_TYPE_COST:
mrp_object_get (project,
mrp_property_get_name (property), &fvalue,
- NULL);
+ NULL);
svalue = planner_format_float (fvalue, 2, FALSE);
break;
-
+
default:
g_warning ("Property type not implemented.");
svalue = g_strdup ("");
@@ -1786,25 +1786,25 @@ mpp_project_property_set_value_string (MrpProject *project,
{
MrpPropertyType type;
gfloat fvalue;
-
+
type = mrp_property_get_property_type (property);
switch (type) {
case MRP_PROPERTY_TYPE_STRING:
mrp_object_set (MRP_OBJECT (project),
- mrp_property_get_name (property),
+ mrp_property_get_name (property),
text,
NULL);
break;
case MRP_PROPERTY_TYPE_INT:
mrp_object_set (MRP_OBJECT (project),
- mrp_property_get_name (property),
+ mrp_property_get_name (property),
atoi (text),
NULL);
break;
case MRP_PROPERTY_TYPE_FLOAT:
fvalue = g_strtod (text, NULL);
mrp_object_set (MRP_OBJECT (project),
- mrp_property_get_name (property),
+ mrp_property_get_name (property),
fvalue,
NULL);
break;
@@ -1812,11 +1812,11 @@ mpp_project_property_set_value_string (MrpProject *project,
case MRP_PROPERTY_TYPE_DURATION:
/* FIXME: support reading units etc... */
mrp_object_set (MRP_OBJECT (project),
- mrp_property_get_name (property),
+ mrp_property_get_name (property),
atoi (text) *8*60*60,
NULL);
break;
-
+
case MRP_PROPERTY_TYPE_DATE:
/* date = PLANNER_CELL_RENDERER_DATE (cell); */
/* mrp_object_set (MRP_OBJECT (project), */
@@ -1827,7 +1827,7 @@ mpp_project_property_set_value_string (MrpProject *project,
case MRP_PROPERTY_TYPE_COST:
fvalue = g_strtod (text, NULL);
mrp_object_set (MRP_OBJECT (project),
- mrp_property_get_name (property),
+ mrp_property_get_name (property),
fvalue,
NULL);
break;
@@ -1841,7 +1841,7 @@ mpp_project_property_set_value_string (MrpProject *project,
}
return (TRUE);
}
-
+
/* Start of UNDO/REDO routines */
@@ -1850,24 +1850,24 @@ property_cmd_add_do (PlannerCmd *cmd_base)
{
PropertyCmdAdd *cmd;
MrpProperty *property;
-
+
cmd = (PropertyCmdAdd*) cmd_base;
if (cmd->name == NULL) {
return FALSE;
}
- property = mrp_property_new (cmd->name,
+ property = mrp_property_new (cmd->name,
cmd->type,
cmd->label,
cmd->description,
cmd->user_defined);
-
- mrp_project_add_property (cmd->project,
+
+ mrp_project_add_property (cmd->project,
cmd->owner,
property,
- cmd->user_defined);
-
+ cmd->user_defined);
+
/* This functions as a simple success check for the REDO/UNDO stuff. Check if its added. */
if (!mrp_project_has_property (cmd->project, cmd->owner, cmd->name)) {
g_warning ("%s: object of type '%s' still has no property named '%s'",
@@ -1876,20 +1876,20 @@ property_cmd_add_do (PlannerCmd *cmd_base)
cmd->name);
return FALSE;
}
-
- return TRUE;
-
+
+ return TRUE;
+
}
static void
property_cmd_add_undo (PlannerCmd *cmd_base)
{
PropertyCmdAdd *cmd;
-
+
cmd = (PropertyCmdAdd*) cmd_base;
if (cmd->name != NULL) {
- mrp_project_remove_property (cmd->project,
+ mrp_project_remove_property (cmd->project,
cmd->owner,
cmd->name);
/* This functions as a simple success check for the REDO/UNDO stuff. Check if its removed. */
@@ -1899,7 +1899,7 @@ property_cmd_add_undo (PlannerCmd *cmd_base)
g_type_name (cmd->owner),
cmd->name);
}
- }
+ }
}
@@ -1908,7 +1908,7 @@ property_cmd_add_free (PlannerCmd *cmd_base)
{
PropertyCmdAdd *cmd;
- cmd = (PropertyCmdAdd*) cmd_base;
+ cmd = (PropertyCmdAdd*) cmd_base;
g_free (cmd->name);
g_free (cmd->label);
@@ -1916,7 +1916,7 @@ property_cmd_add_free (PlannerCmd *cmd_base)
cmd->project = NULL;
}
-static
+static
PlannerCmd *
property_cmd_add (PlannerWindow *window,
MrpProject *project,
@@ -1930,7 +1930,7 @@ property_cmd_add (PlannerWindow *window,
PlannerCmd *cmd_base;
PropertyCmdAdd *cmd;
-
+
cmd_base = planner_cmd_new (PropertyCmdAdd,
_("Add project property"),
property_cmd_add_do,
@@ -1938,7 +1938,7 @@ property_cmd_add (PlannerWindow *window,
property_cmd_add_free);
cmd = (PropertyCmdAdd *) cmd_base;
-
+
cmd->project = project;
cmd->owner = owner;
cmd->name = g_strdup (name);
@@ -1960,7 +1960,7 @@ property_cmd_remove_do (PlannerCmd *cmd_base)
PropertyCmdRemove *cmd;
cmd = (PropertyCmdRemove*) cmd_base;
-
+
if (!mrp_project_has_property (cmd->project, cmd->owner, cmd->name)) {
g_warning ("%s: object of type '%s' has no property named '%s' to remove",
G_STRLOC,
@@ -1968,7 +1968,7 @@ property_cmd_remove_do (PlannerCmd *cmd_base)
cmd->name);
return FALSE;
}
-
+
mrp_project_remove_property (cmd->project,
cmd->owner,
cmd->name);
@@ -1984,29 +1984,29 @@ property_cmd_remove_undo (PlannerCmd *cmd_base)
MrpProperty *property;
MrpProject *project;
gchar *new_text;
-
+
cmd = (PropertyCmdRemove*) cmd_base;
-
+
if (cmd->name != NULL) {
-
+
project = cmd->project;
new_text = cmd->old_text;
-
- property = mrp_property_new (cmd->name,
+
+ property = mrp_property_new (cmd->name,
cmd->type,
cmd->label,
cmd->description,
cmd->user_defined);
-
- mrp_project_add_property (project,
+
+ mrp_project_add_property (project,
cmd->owner,
property,
cmd->user_defined);
-
- /* Now restore the previous text value We've kept it as new_text so it was easy to cut+paste code */
-
+
+ /* Now restore the previous text value We've kept it as new_text so it was easy to cut+paste code */
+
mpp_project_property_set_value_string (project, property, new_text);
-
+
/* This functions as a simple success check for the REDO/UNDO stuff. Check if its removed. */
if (!mrp_project_has_property (project, cmd->owner, cmd->name)) {
g_warning ("%s: object of type '%s' property named '%s' not restored.",
@@ -2014,7 +2014,7 @@ property_cmd_remove_undo (PlannerCmd *cmd_base)
g_type_name (cmd->owner),
cmd->name);
}
- }
+ }
}
static void
@@ -2040,7 +2040,7 @@ property_cmd_remove (PlannerWindow *window,
PlannerCmd *cmd_base;
PropertyCmdRemove *cmd;
MrpProperty *property;
-
+
cmd_base = planner_cmd_new (PropertyCmdRemove,
_("Remove project property"),
property_cmd_remove_do,
@@ -2048,7 +2048,7 @@ property_cmd_remove (PlannerWindow *window,
property_cmd_remove_free);
cmd = (PropertyCmdRemove *) cmd_base;
-
+
cmd->project = project;
cmd->owner = owner;
cmd->name = g_strdup (name);
@@ -2056,14 +2056,14 @@ property_cmd_remove (PlannerWindow *window,
property = mrp_project_get_property (project,
name,
owner);
-
+
cmd->type = mrp_property_get_property_type (property);
cmd->description = g_strdup (mrp_property_get_description (property));
cmd->label = g_strdup ( mrp_property_get_label (property));
cmd->user_defined = mrp_property_get_user_defined (property);
cmd->old_text = (gchar *) mpp_project_property_get_value_string (project, property);
-
+
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (window),
cmd_base);
@@ -2079,17 +2079,17 @@ property_cmd_value_edited_do (PlannerCmd *cmd_base)
MrpProject *project;
MrpProperty *property;
gchar *new_text;
-
+
cmd = (PropertyCmdValueEdited*) cmd_base;
-
+
project = cmd->project;
property = cmd->property;
new_text = cmd->new_text;
-
+
if (!cmd->property) {
return FALSE;
}
-
+
return (mpp_project_property_set_value_string (project, property, new_text));
}
@@ -2100,13 +2100,13 @@ property_cmd_value_edited_undo (PlannerCmd *cmd_base)
MrpProject *project;
MrpProperty *property;
gchar *new_text;
-
+
cmd = (PropertyCmdValueEdited*) cmd_base;
property = cmd->property;
project = cmd->project;
new_text = cmd->old_text;
-
+
if (cmd->property != NULL) {
mpp_project_property_set_value_string (project, property, new_text);
}
@@ -2121,7 +2121,7 @@ property_cmd_value_edited_free (PlannerCmd *cmd_base)
g_free (cmd->old_text);
g_free (cmd->new_text);
- cmd->property = NULL;
+ cmd->property = NULL;
cmd->project = NULL;
}
@@ -2133,7 +2133,7 @@ property_cmd_value_edited (PlannerWindow *window,
{
PlannerCmd *cmd_base;
PropertyCmdValueEdited *cmd;
-
+
cmd_base = planner_cmd_new (PropertyCmdValueEdited,
_("Edit project property value"),
property_cmd_value_edited_do,
@@ -2141,13 +2141,13 @@ property_cmd_value_edited (PlannerWindow *window,
property_cmd_value_edited_free);
cmd = (PropertyCmdValueEdited *) cmd_base;
-
+
cmd->property = property;
cmd->project = project;
cmd->new_text = g_strdup (new_text);
-
+
cmd->old_text = (gchar *) mpp_project_property_get_value_string (project, property);
-
+
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (window),
cmd_base);
diff --git a/src/planner-property-dialog.c b/src/planner-property-dialog.c
index 55bef5a..242a987 100644
--- a/src/planner-property-dialog.c
+++ b/src/planner-property-dialog.c
@@ -61,20 +61,20 @@ typedef struct {
typedef struct {
PlannerCmd base;
-
+
PlannerWindow *window;
MrpProject *project;
- gchar *name;
+ gchar *name;
MrpPropertyType type;
gchar *label_text;
gchar *description;
GType owner;
- gboolean user_defined;
+ gboolean user_defined;
} PropertyCmdAdd;
typedef struct {
PlannerCmd base;
-
+
MrpProject *project;
gchar *name;
MrpProperty *property;
@@ -82,10 +82,10 @@ typedef struct {
gchar *label_text;
gchar *description;
GType owner;
- gboolean user_defined;
+ gboolean user_defined;
GHashTable *tasks;
- GHashTable *resources;
+ GHashTable *resources;
} PropertyCmdRemove;
typedef struct {
@@ -169,7 +169,7 @@ property_dialog_setup_option_menu (GtkWidget *option_menu,
if (menu) {
gtk_widget_destroy (menu);
}
-
+
menu = gtk_menu_new ();
va_start (args, str1);
@@ -179,7 +179,7 @@ property_dialog_setup_option_menu (GtkWidget *option_menu,
gtk_menu_append (GTK_MENU (menu), menu_item);
type = va_arg (args, gint);
-
+
g_object_set_data (G_OBJECT (menu_item),
"data",
GINT_TO_POINTER (type));
@@ -202,15 +202,15 @@ property_dialog_get_selected (GtkWidget *option_menu)
GtkWidget *menu;
GtkWidget *item;
gint ret;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
-
+
item = gtk_menu_get_active (GTK_MENU (menu));
ret = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "data"));
return ret;
-}
+}
static void
property_dialog_close_cb (GtkWidget *button,
@@ -224,7 +224,7 @@ property_dialog_type_selected_cb (GtkWidget *widget,
GtkWidget *dialog)
{
gint type;
-
+
type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "data"));
g_object_set_data (G_OBJECT (dialog), "type", GINT_TO_POINTER (type));
@@ -266,7 +266,7 @@ property_dialog_add_cb (GtkWidget *button,
gboolean finished = FALSE;
gunichar c;
gchar *filename;
-
+
priv = GET_PRIV (dialog);
filename = mrp_paths_get_glade_dir ("new-property.glade");
@@ -274,12 +274,12 @@ property_dialog_add_cb (GtkWidget *button,
NULL,
NULL);
g_free (filename);
-
+
add_dialog = glade_xml_get_widget (glade, "add_dialog");
label_entry = glade_xml_get_widget (glade, "label_entry");
name_entry = glade_xml_get_widget (glade, "name_entry");
-
+
g_signal_connect (label_entry,
"focus_out_event",
G_CALLBACK (property_dialog_label_changed_cb),
@@ -313,7 +313,7 @@ property_dialog_add_cb (GtkWidget *button,
finished = FALSE;
break;
}
-
+
name = gtk_entry_get_text (GTK_ENTRY (name_entry));
if (name == NULL || name[0] == 0) {
finished = FALSE;
@@ -323,7 +323,7 @@ property_dialog_add_cb (GtkWidget *button,
c = g_utf8_get_char (name);
if (!g_unichar_isalpha (c)) {
GtkWidget *msg_dialog;
-
+
msg_dialog = gtk_message_dialog_new (
GTK_WINDOW (add_dialog),
GTK_DIALOG_MODAL |
@@ -334,22 +334,22 @@ property_dialog_add_cb (GtkWidget *button,
gtk_dialog_run (GTK_DIALOG (msg_dialog));
gtk_widget_destroy (msg_dialog);
-
+
finished = FALSE;
break;
}
-
+
w = glade_xml_get_widget (glade, "description_entry");
description = gtk_entry_get_text (GTK_ENTRY (w));
-
+
w = glade_xml_get_widget (glade, "type_menu");
type = property_dialog_get_selected (w);
-
+
if (type != MRP_PROPERTY_TYPE_NONE) {
property_cmd_add (priv->main_window,
- priv->project,
- priv->owner,
- name,
+ priv->project,
+ priv->owner,
+ name,
type,
label,
description,
@@ -358,17 +358,17 @@ property_dialog_add_cb (GtkWidget *button,
finished = TRUE;
break;
-
+
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
finished = TRUE;
break;
-
+
default:
break;
}
}
-
+
gtk_widget_destroy (add_dialog);
g_object_unref (glade);
}
@@ -382,7 +382,7 @@ property_dialog_remove_cb (GtkWidget *button, GtkWidget *dialog)
gchar *name;
GtkWidget *remove_dialog;
gint response;
-
+
priv = GET_PRIV (dialog);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree));
@@ -403,14 +403,14 @@ property_dialog_remove_cb (GtkWidget *button, GtkWidget *dialog)
_("Do you really want to remove the property '%s' from "
"the project?"),
name);
-
+
response = gtk_dialog_run (GTK_DIALOG (remove_dialog));
switch (response) {
case GTK_RESPONSE_YES:
property_cmd_remove (priv->main_window,
- priv->project,
- priv->owner,
+ priv->project,
+ priv->owner,
name);
break;
@@ -426,10 +426,10 @@ property_dialog_remove_cb (GtkWidget *button, GtkWidget *dialog)
g_free (name);
}
-static void
-property_dialog_label_edited (GtkCellRendererText *cell,
+static void
+property_dialog_label_edited (GtkCellRendererText *cell,
gchar *path_str,
- gchar *new_text,
+ gchar *new_text,
GtkWidget *dialog)
{
PlannerPropertyDialogPriv *priv;
@@ -437,7 +437,7 @@ property_dialog_label_edited (GtkCellRendererText *cell,
GtkTreeIter iter;
GtkTreeModel *model;
MrpProperty *property;
-
+
priv = GET_PRIV (dialog);
model = priv->model;
@@ -450,8 +450,8 @@ property_dialog_label_edited (GtkCellRendererText *cell,
-1);
if (strcmp (new_text, mrp_property_get_label (property)) != 0 ) {
- property_cmd_label_edited (priv->main_window,
- property,
+ property_cmd_label_edited (priv->main_window,
+ property,
priv->project,
priv->owner,
new_text);
@@ -475,13 +475,13 @@ property_dialog_setup_list (GtkWidget *dialog)
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (tree),
GTK_SELECTION_SINGLE);
-
+
gtk_tree_view_set_headers_visible (tree, TRUE);
/* Name */
cell = gtk_cell_renderer_text_new ();
g_object_set (cell, "editable", FALSE, NULL);
-
+
col = gtk_tree_view_column_new_with_attributes (_("Name"),
cell,
"text", COL_NAME,
@@ -489,16 +489,16 @@ property_dialog_setup_list (GtkWidget *dialog)
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_column_set_min_width (col, 100);
gtk_tree_view_append_column (tree, col);
-
+
/* Label */
cell = gtk_cell_renderer_text_new ();
g_object_set (cell, "editable", TRUE, NULL);
-
+
g_signal_connect (cell,
"edited",
G_CALLBACK (property_dialog_label_edited),
dialog);
-
+
col = gtk_tree_view_column_new_with_attributes (_("Label"),
cell,
"text", COL_LABEL,
@@ -510,7 +510,7 @@ property_dialog_setup_list (GtkWidget *dialog)
/* Type */
cell = gtk_cell_renderer_text_new ();
g_object_set (cell, "editable", FALSE, NULL);
-
+
col = gtk_tree_view_column_new_with_attributes (_("Type"),
cell,
"text", COL_TYPE,
@@ -521,10 +521,10 @@ property_dialog_setup_list (GtkWidget *dialog)
/* Create the shop (a type of store). */
priv->shop = g_new0 (MrpPropertyStore, 1);
-
+
model = planner_property_model_new (priv->project, priv->owner, priv->shop);
priv->model = model;
-
+
gtk_tree_view_set_model (tree, model);
}
@@ -575,22 +575,22 @@ planner_property_dialog_new (PlannerWindow *main_window,
g_return_val_if_fail (MRP_IS_PROJECT (project), NULL);
priv = g_new0 (PlannerPropertyDialogPriv, 1);
-
+
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");
gtk_window_set_title (GTK_WINDOW (dialog), title);
-
+
g_object_set_data (G_OBJECT (dialog), "priv", priv);
priv->main_window = main_window;
priv->project = project;
priv->owner = owner;
-
+
property_dialog_setup_widgets (dialog, glade);
g_object_unref (glade);
@@ -603,7 +603,7 @@ property_cmd_add_do (PlannerCmd *cmd_base)
{
PropertyCmdAdd *cmd;
MrpProperty *property;
-
+
cmd = (PropertyCmdAdd*) cmd_base;
/* Why is this check here? */
@@ -611,32 +611,32 @@ property_cmd_add_do (PlannerCmd *cmd_base)
return FALSE;
}
- property = mrp_property_new (cmd->name,
+ property = mrp_property_new (cmd->name,
cmd->type,
cmd->label_text,
cmd->description,
cmd->user_defined);
-
- mrp_project_add_property (cmd->project,
+
+ mrp_project_add_property (cmd->project,
cmd->owner,
property,
- cmd->user_defined);
-
+ cmd->user_defined);
+
if (!mrp_project_has_property (cmd->project, cmd->owner, cmd->name)) {
return FALSE;
}
-
- return TRUE;
+
+ return TRUE;
}
static void
property_cmd_add_undo (PlannerCmd *cmd_base)
{
PropertyCmdAdd *cmd;
-
+
cmd = (PropertyCmdAdd*) cmd_base;
- mrp_project_remove_property (cmd->project,
+ mrp_project_remove_property (cmd->project,
cmd->owner,
cmd->name);
}
@@ -647,7 +647,7 @@ property_cmd_add_free (PlannerCmd *cmd_base)
{
PropertyCmdAdd *cmd;
- cmd = (PropertyCmdAdd*) cmd_base;
+ cmd = (PropertyCmdAdd*) cmd_base;
g_free (cmd->name);
g_free (cmd->label_text);
@@ -697,7 +697,7 @@ property_cmd_remove_do (PlannerCmd *cmd_base)
PropertyCmdRemove *cmd;
cmd = (PropertyCmdRemove*) cmd_base;
-
+
if (!mrp_project_has_property (cmd->project, cmd->owner, cmd->name)) {
return FALSE;
}
@@ -713,18 +713,18 @@ property_cmd_remove_do (PlannerCmd *cmd_base)
mrp_object_get_property (l->data, cmd->property, value);
g_hash_table_insert (cmd->tasks, g_object_ref (l->data), value);
}
-
- }
+
+ }
else if (cmd->owner == MRP_TYPE_RESOURCE && g_hash_table_size (cmd->resources) == 0) {
GList *l, *resources = mrp_project_get_resources (cmd->project);
for (l = resources; l; l = l->next) {
GValue *value = g_new0 (GValue, 1);
g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (cmd->property));
- mrp_object_get_property (l->data, cmd->property, value);
+ mrp_object_get_property (l->data, cmd->property, value);
g_hash_table_insert (cmd->resources, g_object_ref (l->data), value);
}
-
+
}
mrp_project_remove_property (cmd->project,
@@ -752,33 +752,33 @@ static void
property_cmd_remove_undo (PlannerCmd *cmd_base)
{
PropertyCmdRemove *cmd;
-
+
cmd = (PropertyCmdRemove*) cmd_base;
mrp_property_unref (cmd->property);
- cmd->property = mrp_property_new (cmd->name,
+ cmd->property = mrp_property_new (cmd->name,
cmd->type,
cmd->label_text,
cmd->description,
cmd->user_defined);
-
- mrp_project_add_property (cmd->project,
+
+ mrp_project_add_property (cmd->project,
cmd->owner,
cmd->property,
cmd->user_defined);
g_hash_table_foreach (cmd->tasks, property_hash_recover, cmd);
- g_hash_table_foreach (cmd->resources, property_hash_recover, cmd);
+ g_hash_table_foreach (cmd->resources, property_hash_recover, cmd);
}
static void
property_hash_free (gpointer key,
gpointer value,
- gpointer user_data)
+ gpointer user_data)
{
g_object_unref (key);
- g_value_unset ((GValue *) value);
+ g_value_unset ((GValue *) value);
}
static void
@@ -819,7 +819,7 @@ property_cmd_remove (PlannerWindow *window,
property_cmd_remove_free);
cmd = (PropertyCmdRemove *) cmd_base;
-
+
cmd->project = g_object_ref (project);
cmd->owner = owner;
cmd->name = g_strdup (name);
@@ -839,7 +839,7 @@ property_cmd_remove (PlannerWindow *window,
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (window),
cmd_base);
-
+
return cmd_base;
}
@@ -850,17 +850,17 @@ property_cmd_label_edited_do (PlannerCmd *cmd_base)
MrpProperty *property;
cmd = (PropertyCmdLabelEdited*) cmd_base;
-
+
property = mrp_project_get_property (cmd->project,
cmd->name,
cmd->owner);
-
+
if (!property) {
return FALSE;
}
-
+
mrp_property_set_label (property, cmd->new_text);
-
+
return TRUE;
}
@@ -870,7 +870,7 @@ property_cmd_label_edited_undo (PlannerCmd *cmd_base)
{
PropertyCmdLabelEdited *cmd;
MrpProperty *property;
-
+
cmd = (PropertyCmdLabelEdited*) cmd_base;
property = mrp_project_get_property (cmd->project,
@@ -879,7 +879,7 @@ property_cmd_label_edited_undo (PlannerCmd *cmd_base)
if (property != NULL) {
- mrp_property_set_label (property, cmd->old_text);
+ mrp_property_set_label (property, cmd->old_text);
}
}
@@ -915,12 +915,12 @@ property_cmd_label_edited (PlannerWindow *window,
cmd->window = window;
cmd->new_text = g_strdup (new_text);
-
+
cmd->old_text = g_strdup (mrp_property_get_label (property));
cmd->project = project;
cmd->name = g_strdup (mrp_property_get_name (property));
cmd->owner = owner;
-
+
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (window),
cmd_base);
diff --git a/src/planner-property-model.c b/src/planner-property-model.c
index 0aaa73c..a68fc3e 100644
--- a/src/planner-property-model.c
+++ b/src/planner-property-model.c
@@ -39,7 +39,7 @@ property_model_property_added_cb (MrpProject *project,
MrpPropertyType type;
GtkListStore *store;
- if (owner_type != shop->owner_type) {
+ if (owner_type != shop->owner_type) {
return;
}
@@ -47,7 +47,7 @@ property_model_property_added_cb (MrpProject *project,
if (store) {
type = mrp_property_get_property_type (property);
-
+
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
@@ -66,14 +66,14 @@ property_model_property_removed_helper (GtkTreeModel *model,
gpointer data)
{
gchar *name;
-
+
gtk_tree_model_get (model, iter,
COL_NAME, &name,
-1);
-
+
if (!strcmp (name, data)) {
gtk_list_store_remove (GTK_LIST_STORE (model), iter);
-
+
g_free (name);
return TRUE;
}
@@ -93,7 +93,7 @@ property_model_property_removed_cb (MrpProject *project,
(gchar *)mrp_property_get_name (property));
}
-static gboolean
+static gboolean
property_model_property_changed_helper (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
@@ -104,14 +104,14 @@ property_model_property_changed_helper (GtkTreeModel *model,
gchar *name;
g_return_val_if_fail (data != NULL, FALSE);
-
+
property = MRP_PROPERTY (data);
property_name = mrp_property_get_name (property);
-
+
gtk_tree_model_get (model, iter,
COL_NAME, &name,
-1);
-
+
if (!strcmp (name, property_name)) {
gtk_list_store_set (GTK_LIST_STORE (model), iter,
COL_LABEL, mrp_property_get_label (property),
@@ -128,7 +128,7 @@ property_model_property_changed_cb (MrpProject *project,
GtkTreeModel *model)
{
/* Find the iter and update it */
- gtk_tree_model_foreach (model,
+ gtk_tree_model_foreach (model,
property_model_property_changed_helper,
property);
}
@@ -143,25 +143,25 @@ planner_property_model_new (MrpProject *project,
MrpProperty *property;
MrpPropertyType type;
GtkTreeIter iter;
-
+
store = gtk_list_store_new (5,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_POINTER,
G_TYPE_POINTER);
-
+
shop->store = store;
shop->owner_type = owner_type;
- properties = mrp_project_get_properties_from_type (project,
+ properties = mrp_project_get_properties_from_type (project,
owner_type);
for (l = properties; l; l = l->next) {
property = l->data;
type = mrp_property_get_property_type (property);
-
+
gtk_list_store_append (store, &iter);
gtk_list_store_set (store,
&iter,
@@ -172,16 +172,16 @@ planner_property_model_new (MrpProject *project,
-1);
}
- /* We need to know which store to add the property so we pass the shop
- * reference not the store. The shop is a structure that correlates
+ /* We need to know which store to add the property so we pass the shop
+ * reference not the store. The shop is a structure that correlates
* which store currently holds which owner. We don't have to bother with
* this when changing or removing - just adding.
- */
+ */
g_signal_connect (project,
"property_added",
G_CALLBACK (property_model_property_added_cb),
shop);
-
+
g_signal_connect (project,
"property_removed",
G_CALLBACK (property_model_property_removed_cb),
diff --git a/src/planner-python-plugin.c b/src/planner-python-plugin.c
index 0cdb41f..208897d 100644
--- a/src/planner-python-plugin.c
+++ b/src/planner-python-plugin.c
@@ -20,7 +20,7 @@
#include <config.h>
#include <Python.h>
-#include <glib.h>
+#include <glib.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <pygobject.h>
@@ -127,22 +127,22 @@ python_plugin_execute (const gchar *filename,
}
}
-G_MODULE_EXPORT void
+G_MODULE_EXPORT void
plugin_init (PlannerPlugin *plugin, PlannerWindow *main_window)
{
PlannerPluginPriv *priv;
GDir *dir;
gchar *dirname, *full_filename;
const gchar *filename;
-
+
priv = g_new0 (PlannerPluginPriv, 1);
plugin->priv = priv;
priv->main_window = main_window;
priv->scripts = g_hash_table_new (g_str_hash, g_str_equal);
-
+
Py_Initialize ();
-
+
/* Look in ~/.gnome2/planner/python/ and run the scripts that we find */
dirname = g_build_filename (g_get_home_dir(), ".gnome2", "planner", "python", NULL);
dir = g_dir_open (dirname, 0, NULL);
@@ -158,16 +158,16 @@ plugin_init (PlannerPlugin *plugin, PlannerWindow *main_window)
python_plugin_execute (full_filename, main_window, priv->scripts);
g_free (full_filename);
}
-
+
filename = g_dir_read_name (dir);
}
-
+
g_free (dirname);
g_dir_close (dir);
}
-G_MODULE_EXPORT void
-plugin_exit (PlannerPlugin *plugin)
+G_MODULE_EXPORT void
+plugin_exit (PlannerPlugin *plugin)
{
Py_Finalize ();
}
diff --git a/src/planner-relation-arrow.c b/src/planner-relation-arrow.c
index 1690149..2461631 100644
--- a/src/planner-relation-arrow.c
+++ b/src/planner-relation-arrow.c
@@ -38,20 +38,20 @@
SS:
- 1: A
+ 1: A
+--XXXXXX
- B |
+ B |
+---XXXXX
C
-
+
FF:
- 1: A
+ 1: A
XXXXXX----+
| B
XXXXX---+
C
-
+
SF:
1: A (we have a maximum value for A)
@@ -60,7 +60,7 @@ SF:
XXXXX
- 2: A (max value)
+ 2: A (max value)
+-XXXXXX
B | C
+---------------+
@@ -76,11 +76,11 @@ FS:
XXXXX
- 2: A (min value)
+ 2: A (min value)
XXXXXX-+
| B
+---------------+
- | D C
+ | D C
+-XXXXX
E (min value)
@@ -99,7 +99,7 @@ typedef enum {
PLANNER_ARROW_RIGHT,
PLANNER_ARROW_LEFT
} PlannerArrowDir;
-
+
struct _PlannerRelationArrowPriv {
PlannerGanttRow *successor;
PlannerGanttRow *predecessor;
@@ -111,7 +111,7 @@ struct _PlannerRelationArrowPriv {
guint num_points;
PlannerPoint points[6];
PlannerArrowDir arrow_dir;
-
+
gdouble x1;
gdouble y1;
gdouble x2;
@@ -179,7 +179,7 @@ planner_relation_arrow_get_type (void)
&info,
0);
}
-
+
return type;
}
@@ -220,7 +220,7 @@ relation_arrow_init (PlannerRelationArrow *item)
priv = g_new0 (PlannerRelationArrowPriv, 1);
item->priv = priv;
-
+
priv->successor_visible = TRUE;
priv->predecessor_visible = TRUE;
@@ -235,17 +235,17 @@ relation_arrow_finalize (GObject *object)
PlannerRelationArrowPriv *priv;
priv = arrow->priv;
-
+
if (priv->predecessor) {
g_object_remove_weak_pointer (G_OBJECT (priv->predecessor),
(gpointer)&priv->predecessor);
}
-
+
if (priv->successor) {
g_object_remove_weak_pointer (G_OBJECT (priv->successor),
(gpointer)&priv->successor);
}
-
+
g_free (priv);
arrow->priv = NULL;
@@ -268,7 +268,7 @@ relation_arrow_set_property (GObject *object,
case PROP_TYPE:
arrow->priv->type = g_value_get_enum (value);
break;
-
+
default:
break;
}
@@ -291,7 +291,7 @@ relation_arrow_update_line_segments (PlannerRelationArrow *arrow)
&py1,
&px2,
&py2);
-
+
planner_gantt_row_get_geometry (priv->successor,
&sx1,
&sy1,
@@ -300,7 +300,7 @@ relation_arrow_update_line_segments (PlannerRelationArrow *arrow)
if (type == MRP_RELATION_SS) {
priv->num_points = 4;
priv->arrow_dir = PLANNER_ARROW_RIGHT;
-
+
/* LHS of pred */
priv->points[0].x = px1;
priv->points[0].y = py1 + (py2 - py1) / 2;
@@ -317,13 +317,13 @@ relation_arrow_update_line_segments (PlannerRelationArrow *arrow)
priv->points[2].x = px1 - MIN_SPACING - ARROW_SIZE;
priv->points[2].y = sy1 + (sy2 - sy1) / 2;
}
-
+
priv->points[3].x = sx1;
priv->points[3].y = sy1 + (sy2 - sy1) / 2;
-
+
}
else if (type == MRP_RELATION_FF) {
-
+
priv->num_points = 4;
priv->arrow_dir = PLANNER_ARROW_LEFT;
@@ -343,7 +343,7 @@ relation_arrow_update_line_segments (PlannerRelationArrow *arrow)
priv->points[2].x = px2 + MIN_SPACING + ARROW_SIZE;
priv->points[2].y = sy1 + (sy2 - sy1) / 2;
}
-
+
priv->points[3].x = sx2;
priv->points[3].y = sy1 + (sy2 - sy1) / 2;
}
@@ -351,13 +351,13 @@ relation_arrow_update_line_segments (PlannerRelationArrow *arrow)
/* Two cases for SF, as shown at the top of this file. */
if (px1 >= sx2) {
priv->num_points = 3;
-
+
priv->points[0].x = px1;
priv->points[0].y = py1 + (py2 - py1) / 2;
priv->points[1].x = MIN (px1 - MIN_SPACING, sx2);
priv->points[1].y = py1 + (py2 - py1) / 2;
-
+
priv->points[2].x = MIN (px1 - MIN_SPACING, sx2);
if (sy1 > py1) {
priv->points[2].y = sy1;
@@ -366,38 +366,38 @@ relation_arrow_update_line_segments (PlannerRelationArrow *arrow)
priv->points[2].y = sy2;
priv->arrow_dir = PLANNER_ARROW_UP;
}
-
-
+
+
} else {
priv->num_points = 6;
priv->arrow_dir = PLANNER_ARROW_LEFT;
-
+
priv->points[0].x = px1;
priv->points[0].y = py1 + (py2 - py1) / 2;
-
+
priv->points[1].x = px1 - MIN_SPACING;
priv->points[1].y = py1 + (py2 - py1) / 2;
-
+
if (sy1 > py1) {
y = py2 + (py2 - py1) / 2 - 1;
} else {
y = py1 - (py2 - py1) / 2 + 2;
}
-
+
priv->points[2].x = px1 - MIN_SPACING;
priv->points[2].y = y;
-
+
priv->points[3].x = sx2 + ARROW_SIZE + MIN_SPACING;
priv->points[3].y = y;
-
+
priv->points[4].x = sx2 + ARROW_SIZE + MIN_SPACING;
priv->points[4].y = sy1 + (sy2 - sy1) / 2;
-
+
priv->points[5].x = sx2;
priv->points[5].y = sy1 + (sy2 - sy1) / 2;
}
-
-
+
+
} else {
/* Two cases for FS, as shown at the top of this file. */
if (px2 <= sx1) {
@@ -417,8 +417,8 @@ relation_arrow_update_line_segments (PlannerRelationArrow *arrow)
priv->points[2].y = sy2;
priv->arrow_dir = PLANNER_ARROW_UP;
}
-
-
+
+
} else {
priv->num_points = 6;
priv->arrow_dir = PLANNER_ARROW_RIGHT;
@@ -434,13 +434,13 @@ relation_arrow_update_line_segments (PlannerRelationArrow *arrow)
} else {
y = py1 - (py2 - py1) / 2 + 2;
}
-
+
priv->points[2].x = px2 + MIN_SPACING;
priv->points[2].y = y;
priv->points[3].x = sx1 - ARROW_SIZE - MIN_SPACING;
priv->points[3].y = y;
-
+
priv->points[4].x = sx1 - ARROW_SIZE - MIN_SPACING;
priv->points[4].y = sy1 + (sy2 - sy1) / 2;
@@ -469,7 +469,7 @@ relation_arrow_successor_visibility_changed (PlannerGanttRow *row,
PlannerRelationArrow *arrow)
{
arrow->priv->successor_visible = visible;
-
+
if (!visible) {
gnome_canvas_item_hide (GNOME_CANVAS_ITEM (arrow));
} else if (arrow->priv->predecessor_visible) {
@@ -495,23 +495,23 @@ void
planner_relation_arrow_set_predecessor (PlannerRelationArrow *arrow,
PlannerGanttRow *predecessor)
{
- PlannerRelationArrowPriv *priv;
-
+ PlannerRelationArrowPriv *priv;
+
g_return_if_fail (PLANNER_IS_RELATION_ARROW (arrow));
g_return_if_fail (PLANNER_IS_GANTT_ROW (predecessor));
priv = arrow->priv;
-
+
if (priv->predecessor) {
g_object_remove_weak_pointer (G_OBJECT (priv->predecessor),
(gpointer)&priv->predecessor);
- }
-
+ }
+
priv->predecessor = predecessor;
g_object_add_weak_pointer (G_OBJECT (predecessor),
(gpointer)&priv->predecessor);
-
+
g_signal_connect_object (predecessor,
"geometry-changed",
G_CALLBACK (relation_arrow_geometry_changed),
@@ -533,7 +533,7 @@ void
planner_relation_arrow_set_successor (PlannerRelationArrow *arrow,
PlannerGanttRow *successor)
{
- PlannerRelationArrowPriv *priv;
+ PlannerRelationArrowPriv *priv;
g_return_if_fail (PLANNER_IS_RELATION_ARROW (arrow));
g_return_if_fail (PLANNER_IS_GANTT_ROW (successor));
@@ -544,7 +544,7 @@ planner_relation_arrow_set_successor (PlannerRelationArrow *arrow,
g_object_remove_weak_pointer (G_OBJECT (priv->successor),
(gpointer)&priv->successor);
}
-
+
priv->successor = successor;
g_object_add_weak_pointer (G_OBJECT (successor), (gpointer)&priv->successor);
@@ -554,7 +554,7 @@ planner_relation_arrow_set_successor (PlannerRelationArrow *arrow,
G_CALLBACK (relation_arrow_geometry_changed),
arrow,
0);
-
+
g_signal_connect_object (successor,
"visibility-changed",
G_CALLBACK (relation_arrow_successor_visibility_changed),
@@ -575,12 +575,12 @@ planner_relation_arrow_new (PlannerGanttRow *successor,
GnomeCanvasGroup *root;
root = gnome_canvas_root (GNOME_CANVAS_ITEM (successor)->canvas);
-
+
arrow = PLANNER_RELATION_ARROW (
gnome_canvas_item_new (root,
PLANNER_TYPE_RELATION_ARROW,
NULL));
-
+
arrow->priv->type = type;
planner_relation_arrow_set_successor (arrow, successor);
@@ -604,7 +604,7 @@ relation_arrow_get_bounds (PlannerRelationArrow *arrow,
item = GNOME_CANVAS_ITEM (arrow);
priv = arrow->priv;
-
+
/* Get the items bbox in canvas pixel coordinates. */
/* Silence warning. */
@@ -612,7 +612,7 @@ relation_arrow_get_bounds (PlannerRelationArrow *arrow,
wy1 = G_MAXDOUBLE;
wx2 = -G_MAXDOUBLE;
wy2 = -G_MAXDOUBLE;
-
+
for (i = 0; i < priv->num_points; i++) {
wx1 = MIN (wx1, priv->points[i].x);
wy1 = MIN (wy1, priv->points[i].y);
@@ -625,7 +625,7 @@ relation_arrow_get_bounds (PlannerRelationArrow *arrow,
wy1 -= ARROW_SIZE / 2;
wx2 += ARROW_SIZE / 2;
wy2 += ARROW_SIZE / 2;
-
+
gnome_canvas_item_i2w (item, &wx1, &wy1);
gnome_canvas_item_i2w (item, &wx2, &wy2);
gnome_canvas_w2c (item->canvas, wx1, wy1, &cx1, &cy1);
@@ -647,12 +647,12 @@ relation_arrow_update (GnomeCanvasItem *item,
gdouble x1, y1, x2, y2;
arrow = PLANNER_RELATION_ARROW (item);
-
+
GNOME_CANVAS_ITEM_CLASS (parent_class)->update (item,
affine,
clip_path,
flags);
-
+
relation_arrow_get_bounds (arrow, &x1, &y1, &x2, &y2);
gnome_canvas_update_bbox (item, x1, y1, x2, y2);
@@ -735,7 +735,7 @@ relation_arrow_draw (GnomeCanvasItem *item,
GdkGC *gc;
GdkPoint points[4];
gint i;
-
+
arrow = PLANNER_RELATION_ARROW (item);
priv = arrow->priv;
@@ -751,12 +751,12 @@ relation_arrow_draw (GnomeCanvasItem *item,
cy1 = 0;
cx2 = 0;
cy2 = 0;
-
+
#ifdef USE_AFFINE
/* Get item area in canvas coordinates. */
gnome_canvas_item_i2c_affine (item, i2c);
#endif
-
+
for (i = 0; i < priv->num_points - 1; i++) {
#ifdef USE_AFFINE
i1.x = priv->points[i].x;
@@ -778,25 +778,25 @@ relation_arrow_draw (GnomeCanvasItem *item,
dy1 = priv->points[i].y;
dx2 = priv->points[i+1].x;
dy2 = priv->points[i+1].y;
-
+
gnome_canvas_w2c (item->canvas,
dx1 + i2w_dx,
dy1 + i2w_dy,
&cx1,
&cy1);
-
+
gnome_canvas_w2c (item->canvas,
dx2 + i2w_dx,
dy2 + i2w_dy,
&cx2,
&cy2);
-
+
cx1 -= x;
cy1 -= y;
cx2 -= x;
cy2 -= y;
#endif
-
+
gdk_draw_line (drawable,
gc,
cx1,
diff --git a/src/planner-resource-cmd.c b/src/planner-resource-cmd.c
index 3d195da..b175290 100644
--- a/src/planner-resource-cmd.c
+++ b/src/planner-resource-cmd.c
@@ -47,7 +47,7 @@ static void
resource_cmd_insert_undo (PlannerCmd *cmd_base)
{
ResourceCmdInsert *cmd;
-
+
cmd = (ResourceCmdInsert*) cmd_base;
mrp_project_remove_resource (cmd->project,
@@ -82,7 +82,7 @@ planner_resource_cmd_insert (PlannerWindow *main_window,
if (resource == NULL) {
cmd->resource = g_object_new (MRP_TYPE_RESOURCE, NULL);
} else {
- cmd->resource = g_object_ref (resource);
+ cmd->resource = g_object_ref (resource);
}
cmd->project = planner_window_get_project (main_window);
diff --git a/src/planner-resource-dialog.c b/src/planner-resource-dialog.c
index d1fcbc7..4a07823 100644
--- a/src/planner-resource-dialog.c
+++ b/src/planner-resource-dialog.c
@@ -168,7 +168,7 @@ typedef struct {
PlannerCmd base;
MrpResource *resource;
- gchar *property;
+ gchar *property;
GValue *value;
GValue *old_value;
} ResourceCmdEditProperty;
@@ -217,7 +217,7 @@ foreach_find_calendar (GtkTreeModel *model,
data->found_iter = *iter;
return TRUE;
}
-
+
return FALSE;
}
@@ -264,7 +264,7 @@ resource_dialog_setup_option_menu (GtkWidget *option_menu,
if (menu) {
gtk_widget_destroy (menu);
}
-
+
menu = gtk_menu_new ();
va_start (args, str1);
@@ -274,7 +274,7 @@ resource_dialog_setup_option_menu (GtkWidget *option_menu,
gtk_menu_append (GTK_MENU (menu), menu_item);
type = va_arg (args, gint);
-
+
g_object_set_data (G_OBJECT (menu_item),
"data",
GINT_TO_POINTER (type));
@@ -299,7 +299,7 @@ resource_dialog_setup_option_groups (GtkWidget *menu_groups,
GtkWidget *menu_item;
gchar *name;
GList *l;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (menu_groups));
if (menu) {
@@ -341,9 +341,9 @@ resource_dialog_option_menu_get_type_selected (GtkWidget *option_menu)
GtkWidget *menu;
GtkWidget *item;
gint ret;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
-
+
item = gtk_menu_get_active (GTK_MENU (menu));
ret = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "data"));
@@ -357,9 +357,9 @@ resource_dialog_option_menu_get_group_selected (GtkWidget *option_menu)
GtkWidget *menu;
GtkWidget *item;
MrpGroup *ret;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
-
+
item = gtk_menu_get_active (GTK_MENU (menu));
ret = g_object_get_data (G_OBJECT (item), "data");
@@ -448,7 +448,7 @@ resource_cmd_calendar_do (PlannerCmd *cmd_base)
{
ResourceCmdCalendar *cmd;
- cmd = (ResourceCmdCalendar*) cmd_base;
+ cmd = (ResourceCmdCalendar*) cmd_base;
mrp_resource_set_calendar (cmd->resource, cmd->calendar);
@@ -460,7 +460,7 @@ resource_cmd_calendar_undo (PlannerCmd *cmd_base)
{
ResourceCmdCalendar *cmd;
- cmd = (ResourceCmdCalendar*) cmd_base;
+ cmd = (ResourceCmdCalendar*) cmd_base;
mrp_resource_set_calendar (cmd->resource, cmd->old_calendar);
@@ -506,7 +506,7 @@ resource_cmd_edit_calendar (DialogData *data,
if (current_calendar) {
cmd->old_calendar = g_object_ref (current_calendar);
} else {
- cmd->old_calendar = NULL;
+ cmd->old_calendar = NULL;
}
if (calendar) {
@@ -644,7 +644,7 @@ resource_cmd_edit_cost (DialogData *data,
resource_cmd_cost_do,
resource_cmd_cost_undo,
resource_cmd_cost_free);
-
+
cmd = (ResourceCmdEditCost *) cmd_base;
cmd->resource = g_object_ref (data->resource);
@@ -735,7 +735,7 @@ resource_cmd_edit_property (PlannerWindow *main_window,
return cmd_base;
}
-/*
+/*
In text entries we return to the value that exists when focus in.
The new value is already stored in the object
*/
@@ -775,9 +775,9 @@ resource_cmd_edit_property_focus (PlannerWindow *main_window,
return cmd_base;
}
-static void
-resource_dialog_notify_name_cb (MrpResource *resource,
- GParamSpec *pspec,
+static void
+resource_dialog_notify_name_cb (MrpResource *resource,
+ GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
@@ -786,18 +786,18 @@ resource_dialog_notify_name_cb (MrpResource *resource,
g_return_if_fail (MRP_IS_RESOURCE (resource));
data = DIALOG_GET_DATA (dialog);
-
+
g_object_get (data->resource, "name", &name, NULL);
g_signal_handlers_block_by_func (data->name_entry,
- resource_dialog_name_changed_cb,
+ resource_dialog_name_changed_cb,
dialog);
gtk_entry_set_text (GTK_ENTRY (data->name_entry), name);
resource_dialog_update_title (data);
-
- g_signal_handlers_unblock_by_func (data->name_entry,
+
+ g_signal_handlers_unblock_by_func (data->name_entry,
resource_dialog_name_changed_cb,
dialog);
@@ -839,11 +839,11 @@ resource_dialog_name_focus_out_cb (GtkWidget *w,
g_assert (MRP_IS_RESOURCE (data->resource));
focus_in_name = g_object_get_data (G_OBJECT (data->resource),"focus_in_name");
-
+
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, focus_in_name);
- cmd = resource_cmd_edit_property_focus (data->main_window,
+ cmd = resource_cmd_edit_property_focus (data->main_window,
data->resource, "name", &value);
g_free (focus_in_name);
@@ -857,61 +857,61 @@ resource_dialog_name_focus_in_cb (GtkWidget *w,
DialogData *data)
{
gchar *name;
-
+
name = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
-
+
g_object_set_data (G_OBJECT (data->resource), "focus_in_name", name);
return FALSE;
}
-static void
+static void
resource_dialog_short_name_changed_cb (GtkWidget *w,
- DialogData *data)
+ DialogData *data)
{
const gchar *short_name;
short_name = gtk_entry_get_text (GTK_ENTRY (w));
g_signal_handlers_block_by_func (data->resource,
- resource_dialog_notify_short_name_cb,
+ resource_dialog_notify_short_name_cb,
data->dialog);
g_object_set (data->resource, "short_name", short_name, NULL);
g_signal_handlers_unblock_by_func (data->resource,
- resource_dialog_notify_short_name_cb,
+ resource_dialog_notify_short_name_cb,
data->dialog);
}
-static void
-resource_dialog_notify_short_name_cb (MrpResource *resource,
- GParamSpec *pspec,
+static void
+resource_dialog_notify_short_name_cb (MrpResource *resource,
+ GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
gchar *short_name;
-
+
g_return_if_fail (MRP_IS_RESOURCE (resource));
data = DIALOG_GET_DATA (dialog);
-
+
g_object_get (data->resource, "short_name", &short_name, NULL);
- g_signal_handlers_block_by_func (data->short_name_entry,
- resource_dialog_short_name_changed_cb,
+ g_signal_handlers_block_by_func (data->short_name_entry,
+ resource_dialog_short_name_changed_cb,
dialog);
gtk_entry_set_text (GTK_ENTRY (data->short_name_entry), short_name);
- g_signal_handlers_unblock_by_func (data->short_name_entry,
+ g_signal_handlers_unblock_by_func (data->short_name_entry,
resource_dialog_short_name_changed_cb,
dialog);
g_free (short_name);
}
-static gboolean
+static gboolean
resource_dialog_short_name_focus_out_cb (GtkWidget *w,
GdkEventFocus *event,
DialogData *data)
@@ -924,11 +924,11 @@ resource_dialog_short_name_focus_out_cb (GtkWidget *w,
focus_in_short_name = g_object_get_data (G_OBJECT (data->resource),
"focus_in_short_name");
-
+
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, focus_in_short_name);
- cmd = resource_cmd_edit_property_focus (data->main_window,
+ cmd = resource_cmd_edit_property_focus (data->main_window,
data->resource, "short_name", &value);
g_free (focus_in_short_name);
@@ -942,17 +942,17 @@ resource_dialog_short_name_focus_in_cb (GtkWidget *w,
DialogData *data)
{
gchar *name;
-
+
name = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
-
+
g_object_set_data (G_OBJECT (data->resource), "focus_in_short_name", name);
return FALSE;
}
-static void
-resource_dialog_notify_type_cb (MrpResource *resource,
- GParamSpec *pspec,
+static void
+resource_dialog_notify_type_cb (MrpResource *resource,
+ GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
@@ -962,13 +962,13 @@ resource_dialog_notify_type_cb (MrpResource *resource,
g_return_if_fail (MRP_IS_RESOURCE (resource));
data = DIALOG_GET_DATA (dialog);
-
+
g_object_get (data->resource, "type", &type, NULL);
- g_signal_handlers_block_by_func (data->type_menu,
- resource_dialog_type_changed_cb,
+ g_signal_handlers_block_by_func (data->type_menu,
+ resource_dialog_type_changed_cb,
data->dialog);
-
+
switch (type) {
case MRP_RESOURCE_TYPE_NONE:
case MRP_RESOURCE_TYPE_WORK:
@@ -981,7 +981,7 @@ resource_dialog_notify_type_cb (MrpResource *resource,
gtk_option_menu_set_history (GTK_OPTION_MENU (data->type_menu), index);
- g_signal_handlers_unblock_by_func (data->type_menu,
+ g_signal_handlers_unblock_by_func (data->type_menu,
resource_dialog_type_changed_cb,
data->dialog);
}
@@ -992,30 +992,30 @@ resource_dialog_type_changed_cb (GtkWidget *w,
{
MrpResourceType type;
GValue value = { 0 };
- PlannerCmd *cmd;
+ PlannerCmd *cmd;
type = resource_dialog_option_menu_get_type_selected (data->type_menu);
g_value_init (&value, G_TYPE_INT);
g_value_set_int (&value, type);
-
+
g_signal_handlers_block_by_func (data->resource,
- resource_dialog_notify_type_cb,
+ resource_dialog_notify_type_cb,
data->dialog);
cmd = resource_cmd_edit_property (data->main_window, data->resource, "type", &value);
g_signal_handlers_unblock_by_func (data->resource,
- resource_dialog_notify_type_cb,
+ resource_dialog_notify_type_cb,
data->dialog);
g_value_unset (&value);
}
-static void
-resource_dialog_notify_group_cb (MrpResource *resource,
- GParamSpec *pspec,
+static void
+resource_dialog_notify_group_cb (MrpResource *resource,
+ GParamSpec *pspec,
GtkWidget *dialog)
-{
+{
DialogData *data;
MrpProject *project;
MrpGroup *group;
@@ -1025,14 +1025,14 @@ resource_dialog_notify_group_cb (MrpResource *resource,
g_return_if_fail (MRP_IS_RESOURCE (resource));
data = DIALOG_GET_DATA (dialog);
-
+
g_object_get (resource,
"group", &group,
"project", &project,
NULL);
-
- g_signal_handlers_block_by_func (data->group_menu,
- resource_dialog_group_changed_cb,
+
+ g_signal_handlers_block_by_func (data->group_menu,
+ resource_dialog_group_changed_cb,
dialog);
groups = mrp_project_get_groups (project);
@@ -1043,8 +1043,8 @@ resource_dialog_notify_group_cb (MrpResource *resource,
}
gtk_option_menu_set_history (GTK_OPTION_MENU (data->group_menu), index);
-
- g_signal_handlers_unblock_by_func (data->group_menu,
+
+ g_signal_handlers_unblock_by_func (data->group_menu,
resource_dialog_group_changed_cb,
dialog);
}
@@ -1056,44 +1056,44 @@ resource_dialog_group_changed_cb (GtkWidget *w,
MrpGroup *group;
GValue value = { 0 };
PlannerCmd *cmd;
-
+
group = resource_dialog_option_menu_get_group_selected (data->group_menu);
g_value_init (&value, MRP_TYPE_GROUP);
g_value_set_object (&value, group);
g_signal_handlers_block_by_func (data->resource,
- resource_dialog_notify_group_cb,
+ resource_dialog_notify_group_cb,
data->dialog);
cmd = resource_cmd_edit_property (data->main_window, data->resource, "group", &value);
g_signal_handlers_unblock_by_func (data->resource,
- resource_dialog_notify_group_cb,
+ resource_dialog_notify_group_cb,
data->dialog);
g_value_unset (&value);
}
-static void
+static void
resource_dialog_email_changed_cb (GtkWidget *w,
- DialogData *data)
+ DialogData *data)
{
const gchar *email;
GValue value = { 0 };
-
+
email = gtk_entry_get_text (GTK_ENTRY (w));
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, email);
g_signal_handlers_block_by_func (data->resource,
- resource_dialog_notify_email_cb,
+ resource_dialog_notify_email_cb,
data->dialog);
g_object_set (data->resource, "email", email, NULL);
-
+
g_signal_handlers_unblock_by_func (data->resource,
- resource_dialog_notify_email_cb,
+ resource_dialog_notify_email_cb,
data->dialog);
g_value_unset (&value);
}
@@ -1110,15 +1110,15 @@ resource_dialog_email_focus_out_cb (GtkWidget *w,
g_assert (MRP_IS_RESOURCE (data->resource));
focus_in_email = g_object_get_data (G_OBJECT (data->resource), "focus_in_email");
-
+
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, focus_in_email);
- cmd = resource_cmd_edit_property_focus (data->main_window,
+ cmd = resource_cmd_edit_property_focus (data->main_window,
data->resource, "email", &value);
g_free (focus_in_email);
-
+
return FALSE;
}
@@ -1128,35 +1128,35 @@ resource_dialog_email_focus_in_cb (GtkWidget *w,
DialogData *data)
{
gchar *email;
-
+
email = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
-
+
g_object_set_data (G_OBJECT (data->resource), "focus_in_email", email);
return FALSE;
}
-static void
-resource_dialog_notify_email_cb (MrpResource *resource,
- GParamSpec *pspec,
+static void
+resource_dialog_notify_email_cb (MrpResource *resource,
+ GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
gchar *email;
-
+
g_return_if_fail (MRP_IS_RESOURCE (resource));
data = DIALOG_GET_DATA (dialog);
-
+
g_object_get (data->resource, "email", &email, NULL);
- g_signal_handlers_block_by_func (data->email_entry,
- resource_dialog_email_changed_cb,
+ g_signal_handlers_block_by_func (data->email_entry,
+ resource_dialog_email_changed_cb,
dialog);
gtk_entry_set_text (GTK_ENTRY (data->email_entry), email);
- g_signal_handlers_unblock_by_func (data->email_entry,
+ g_signal_handlers_unblock_by_func (data->email_entry,
resource_dialog_email_changed_cb,
dialog);
@@ -1176,7 +1176,7 @@ resource_dialog_resource_cost_focus_out_cb (GtkWidget *w,
cmd = resource_cmd_edit_cost (data, focus_in_cost);
g_free (focus_in_cost);
-
+
return FALSE;
}
@@ -1186,7 +1186,7 @@ resource_dialog_resource_cost_focus_in_cb (GtkWidget *w,
DialogData *data)
{
gchar *cost;
-
+
cost = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
g_object_set_data (G_OBJECT (data->resource), "focus_in_cost", cost);
@@ -1194,9 +1194,9 @@ resource_dialog_resource_cost_focus_in_cb (GtkWidget *w,
return FALSE;
}
-static void
+static void
resource_dialog_cost_changed_cb (GtkWidget *w,
- DialogData *data)
+ DialogData *data)
{
const gchar *cost;
gfloat fvalue;
@@ -1205,39 +1205,39 @@ resource_dialog_cost_changed_cb (GtkWidget *w,
cost = gtk_entry_get_text (GTK_ENTRY (w));
fvalue = planner_parse_float (cost);
-
+
g_value_init (&value, G_TYPE_FLOAT);
g_value_set_float (&value, fvalue);
-
+
g_signal_handlers_block_by_func (data->resource,
- resource_dialog_notify_cost_cb,
+ resource_dialog_notify_cost_cb,
data->dialog);
mrp_object_set (data->resource, "cost", fvalue, NULL);
g_signal_handlers_unblock_by_func (data->resource,
- resource_dialog_notify_cost_cb,
+ resource_dialog_notify_cost_cb,
data->dialog);
g_value_unset (&value);
}
-static void
-resource_dialog_notify_cost_cb (MrpResource *resource,
- GParamSpec *pspec,
+static void
+resource_dialog_notify_cost_cb (MrpResource *resource,
+ GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
gfloat cost;
gchar *str;
-
+
g_return_if_fail (MRP_IS_RESOURCE (resource));
data = DIALOG_GET_DATA (dialog);
-
+
g_object_get (data->resource, "cost", &cost, NULL);
-
- g_signal_handlers_block_by_func (data->cost_entry,
- resource_dialog_cost_changed_cb,
+
+ g_signal_handlers_block_by_func (data->cost_entry,
+ resource_dialog_cost_changed_cb,
dialog);
str = planner_format_float (cost, 2, FALSE);
@@ -1245,14 +1245,14 @@ resource_dialog_notify_cost_cb (MrpResource *resource,
gtk_entry_set_text (GTK_ENTRY (data->cost_entry), str);
g_free (str);
- g_signal_handlers_unblock_by_func (data->cost_entry,
+ g_signal_handlers_unblock_by_func (data->cost_entry,
resource_dialog_cost_changed_cb,
dialog);
}
-static void
-resource_dialog_notify_calendar_cb (MrpResource *resource,
- GParamSpec *pspec,
+static void
+resource_dialog_notify_calendar_cb (MrpResource *resource,
+ GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
@@ -1265,7 +1265,7 @@ resource_dialog_notify_calendar_cb (MrpResource *resource,
data = DIALOG_GET_DATA (dialog);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (data->calendar_tree_view));
-
+
/* Toggle the old calendar off. */
if (resource_dialog_find_calendar (data, data->selected_calendar, &iter)) {
gtk_tree_store_set (GTK_TREE_STORE (model),
@@ -1273,7 +1273,7 @@ resource_dialog_notify_calendar_cb (MrpResource *resource,
COL_SELECTED, FALSE,
-1);
}
-
+
calendar = mrp_resource_get_calendar (data->resource);
/* Find the iter of the new calendar so we can toggle it on. */
@@ -1282,7 +1282,7 @@ resource_dialog_notify_calendar_cb (MrpResource *resource,
&iter,
COL_SELECTED, TRUE,
-1);
-
+
data->selected_calendar = calendar;
}
}
@@ -1303,7 +1303,7 @@ resource_dialog_note_focus_out_cb (GtkWidget *w,
PlannerCmd *cmd;
focus_in_note = g_object_get_data (G_OBJECT (data->resource),"focus_in_note");
-
+
cmd = resource_cmd_edit_note (data, focus_in_note);
g_free (focus_in_note);
@@ -1320,7 +1320,7 @@ resource_dialog_note_focus_in_cb (GtkWidget *w,
g_object_get (data->resource, "note", ¬e, NULL);
- gtk_text_buffer_set_text (data->note_buffer, note, -1);
+ gtk_text_buffer_set_text (data->note_buffer, note, -1);
g_object_set_data (G_OBJECT (data->resource), "focus_in_note", note);
@@ -1328,31 +1328,31 @@ resource_dialog_note_focus_in_cb (GtkWidget *w,
}
static void
-resource_dialog_notify_note_cb (MrpResource *resource,
- GParamSpec *pspec,
+resource_dialog_notify_note_cb (MrpResource *resource,
+ GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
gchar *note;
-
+
g_return_if_fail (MRP_IS_RESOURCE (resource));
g_return_if_fail (GTK_IS_DIALOG (dialog));
data = DIALOG_GET_DATA (dialog);
-
+
g_object_get (resource, "note", ¬e, NULL);
g_signal_handlers_block_by_func (data->note_buffer,
resource_dialog_note_changed_cb,
data);
-
+
gtk_text_buffer_set_text (data->note_buffer, note, -1);
g_signal_handlers_unblock_by_func (data->note_buffer,
resource_dialog_note_changed_cb,
data);
-
- g_free (note);
+
+ g_free (note);
}
static void
@@ -1362,11 +1362,11 @@ resource_dialog_note_changed_cb (GtkWidget *w,
const gchar *note;
GtkTextIter start, end;
GtkTextBuffer *buffer;
-
+
buffer = GTK_TEXT_BUFFER (w);
-
+
gtk_text_buffer_get_bounds (buffer, &start, &end);
-
+
note = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
g_signal_handlers_block_by_func (data->resource,
@@ -1404,9 +1404,9 @@ resource_dialog_note_stamp_clicked_cb (GtkWidget *w,
strftime (stamp, sizeof (stamp), _("%a %d %b %Y, %H:%M\n"), tm);
utf8 = g_locale_to_utf8 (stamp, -1, NULL, NULL, NULL);
-
+
gtk_text_buffer_get_end_iter (data->note_buffer, &end);
-
+
if (!gtk_text_iter_starts_line (&end)) {
gtk_text_buffer_insert (data->note_buffer, &end, "\n", 1);
gtk_text_buffer_get_end_iter (data->note_buffer, &end);
@@ -1425,7 +1425,7 @@ resource_dialog_note_stamp_clicked_cb (GtkWidget *w,
gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (data->note_textview), mark);
- gtk_text_buffer_get_bounds (data->note_buffer, &start, &end);
+ gtk_text_buffer_get_bounds (data->note_buffer, &start, &end);
note = gtk_text_buffer_get_text (data->note_buffer, &start, &end, FALSE);
if (g_getenv ("PLANNER_DEBUG_UNDO_RESOURCE")) {
@@ -1452,14 +1452,14 @@ resource_dialog_calendar_toggled_cb (GtkCellRendererToggle *cell,
PlannerCmd *cmd;
if (g_getenv ("PLANNER_DEBUG_UNDO_RESOURCE")) {
- g_message ("Changing the calendar for the resource %s",
+ g_message ("Changing the calendar for the resource %s",
mrp_resource_get_name (data->resource));
}
-
+
path = gtk_tree_path_new_from_string (path_str);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (data->calendar_tree_view));
-
+
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model,
@@ -1471,7 +1471,7 @@ resource_dialog_calendar_toggled_cb (GtkCellRendererToggle *cell,
if (!selected) {
cmd = resource_cmd_edit_calendar (data, calendar);
}
-
+
gtk_tree_path_free (path);
}
@@ -1483,9 +1483,9 @@ resource_dialog_build_calendar_tree_recurse (GtkTreeStore *store,
GtkTreeIter iter;
const gchar *name;
GList *children, *l;
-
+
name = mrp_calendar_get_name (calendar);
-
+
gtk_tree_store_append (store, &iter, parent);
gtk_tree_store_set (store,
&iter,
@@ -1494,7 +1494,7 @@ resource_dialog_build_calendar_tree_recurse (GtkTreeStore *store,
COL_SELECTED, FALSE,
-1);
- children = mrp_calendar_get_children (calendar);
+ children = mrp_calendar_get_children (calendar);
for (l = children; l; l = l->next) {
resource_dialog_build_calendar_tree_recurse (store, &iter, l->data);
}
@@ -1514,7 +1514,7 @@ resource_dialog_build_calendar_tree (DialogData *data)
root = mrp_project_get_root_calendar (project);
store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (data->calendar_tree_view)));
-
+
gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store,
&iter,
@@ -1523,7 +1523,7 @@ resource_dialog_build_calendar_tree (DialogData *data)
COL_SELECTED, FALSE,
-1);
- children = mrp_calendar_get_children (root);
+ children = mrp_calendar_get_children (root);
for (l = children; l; l = l->next) {
resource_dialog_build_calendar_tree_recurse (store, NULL, l->data);
}
@@ -1531,14 +1531,14 @@ resource_dialog_build_calendar_tree (DialogData *data)
gtk_tree_view_expand_all (GTK_TREE_VIEW (data->calendar_tree_view));
calendar = mrp_resource_get_calendar (data->resource);
-
+
/* Select the current calendar. */
if (resource_dialog_find_calendar (data, calendar, &iter)) {
gtk_tree_store_set (store,
&iter,
COL_SELECTED, TRUE,
-1);
-
+
data->selected_calendar = calendar;
}
}
@@ -1556,9 +1556,9 @@ resource_dialog_calendar_tree_changed_cb (MrpProject *project,
tree_view = GTK_TREE_VIEW (data->calendar_tree_view);
store = GTK_TREE_STORE (gtk_tree_view_get_model (tree_view));
-
+
gtk_tree_store_clear (store);
-
+
resource_dialog_build_calendar_tree (data);
}
@@ -1583,7 +1583,7 @@ resource_dialog_create_calendar_model (DialogData *data)
G_CALLBACK (resource_dialog_calendar_tree_changed_cb),
data->dialog,
0);
-
+
return GTK_TREE_MODEL (store);
}
@@ -1595,10 +1595,10 @@ resource_dialog_setup_calendar_tree_view (DialogData *data)
GtkTreeModel *model;
GtkCellRenderer *cell;
GtkTreeViewColumn *col;
-
+
project = planner_window_get_project (data->main_window);
tree_view = GTK_TREE_VIEW (data->calendar_tree_view);
-
+
model = resource_dialog_create_calendar_model (data);
gtk_tree_view_set_model (tree_view, model);
@@ -1609,20 +1609,20 @@ resource_dialog_setup_calendar_tree_view (DialogData *data)
g_object_set (cell,
"activatable", TRUE,
"radio", TRUE,
- NULL);
-
+ NULL);
+
g_signal_connect (cell,
"toggled",
G_CALLBACK (resource_dialog_calendar_toggled_cb),
data);
-
+
gtk_tree_view_column_pack_start (col, cell, FALSE);
gtk_tree_view_column_set_attributes (col,
cell,
"active", COL_SELECTED,
NULL);
-
+
cell = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (col, cell, FALSE);
@@ -1630,7 +1630,7 @@ resource_dialog_setup_calendar_tree_view (DialogData *data)
cell,
"text", COL_NAME,
NULL);
-
+
gtk_tree_view_append_column (tree_view, col);
resource_dialog_build_calendar_tree (data);
@@ -1683,7 +1683,7 @@ planner_resource_dialog_new (PlannerWindow *window,
GtkWidget *w;
DialogData *data;
gchar *name, *short_name, *email;
- MrpProject *project;
+ MrpProject *project;
MrpGroup *group;
MrpResourceType type;
gfloat cost;
@@ -1704,9 +1704,9 @@ planner_resource_dialog_new (PlannerWindow *window,
gtk_window_present (GTK_WINDOW (dialog));
return dialog;
}
-
+
g_object_get (resource, "project", &project, NULL);
-
+
filename = mrp_paths_get_glade_dir ("resource-dialog.glade");
glade = glade_xml_new (filename,
NULL,
@@ -1719,7 +1719,7 @@ planner_resource_dialog_new (PlannerWindow *window,
}
dialog = glade_xml_get_widget (glade, "resource_dialog");
-
+
data = g_new0 (DialogData, 1);
data->main_window = window;
@@ -1753,17 +1753,17 @@ planner_resource_dialog_new (PlannerWindow *window,
data->cost_entry = glade_xml_get_widget (glade, "entry_cost");
data->calendar_tree_view = glade_xml_get_widget (glade, "calendar_treeview");
data->note_textview = glade_xml_get_widget (glade, "note_textview");
-
+
data->note_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (data->note_textview));
resource_dialog_setup_calendar_tree_view (data);
-
+
g_object_get (data->resource, "note", ¬e, NULL);
if (note) {
gtk_text_buffer_set_text (data->note_buffer, note, -1);
g_free (note);
}
-
+
g_signal_connect (data->note_buffer,
"changed",
G_CALLBACK (resource_dialog_note_changed_cb),
@@ -1778,7 +1778,7 @@ planner_resource_dialog_new (PlannerWindow *window,
"focus_in_event",
G_CALLBACK (resource_dialog_note_focus_in_cb),
data);
-
+
w = glade_xml_get_widget (glade, "calendar_button");
g_signal_connect (w,
@@ -1801,7 +1801,7 @@ planner_resource_dialog_new (PlannerWindow *window,
g_object_set_data_full (G_OBJECT (dialog),
"data", data,
g_free);
-
+
mrp_object_get (MRP_OBJECT (resource),
"name", &name,
"short_name", &short_name,
@@ -1809,7 +1809,7 @@ planner_resource_dialog_new (PlannerWindow *window,
"group", &group,
"email", &email,
"cost", &cost,
- NULL);
+ NULL);
gtk_entry_set_text (GTK_ENTRY (data->name_entry), name);
g_signal_connect (data->name_entry,
@@ -1833,7 +1833,7 @@ planner_resource_dialog_new (PlannerWindow *window,
"changed",
G_CALLBACK (resource_dialog_short_name_changed_cb),
data);
-
+
g_signal_connect (data->short_name_entry,
"focus_out_event",
G_CALLBACK (resource_dialog_short_name_focus_out_cb),
@@ -1843,7 +1843,7 @@ planner_resource_dialog_new (PlannerWindow *window,
"focus_in_event",
G_CALLBACK (resource_dialog_short_name_focus_in_cb),
data);
-
+
resource_dialog_setup_option_menu (data->type_menu,
NULL,
NULL,
@@ -1861,7 +1861,7 @@ planner_resource_dialog_new (PlannerWindow *window,
index = 1;
break;
}
-
+
gtk_option_menu_set_history (GTK_OPTION_MENU (data->type_menu), index);
g_signal_connect (data->type_menu,
@@ -1878,7 +1878,7 @@ planner_resource_dialog_new (PlannerWindow *window,
} else {
index = g_list_index (groups, group) + 1;
}
-
+
gtk_option_menu_set_history (GTK_OPTION_MENU (data->group_menu),
index);
@@ -1904,8 +1904,8 @@ planner_resource_dialog_new (PlannerWindow *window,
G_CALLBACK (resource_dialog_email_focus_in_cb),
data);
- gtk_entry_set_text (GTK_ENTRY (data->cost_entry),
- planner_format_float (cost, 2, FALSE));
+ gtk_entry_set_text (GTK_ENTRY (data->cost_entry),
+ planner_format_float (cost, 2, FALSE));
g_signal_connect (data->cost_entry,
"changed",
@@ -1921,7 +1921,7 @@ planner_resource_dialog_new (PlannerWindow *window,
"focus_in_event",
G_CALLBACK (resource_dialog_resource_cost_focus_in_cb),
data);
-
+
g_free (name);
g_free (short_name);
@@ -1932,6 +1932,6 @@ planner_resource_dialog_new (PlannerWindow *window,
resource_dialog_update_title (data);
g_object_unref (glade);
-
+
return dialog;
}
diff --git a/src/planner-resource-input-dialog.c b/src/planner-resource-input-dialog.c
index d795a0a..b4628b8 100644
--- a/src/planner-resource-input-dialog.c
+++ b/src/planner-resource-input-dialog.c
@@ -36,7 +36,7 @@ typedef struct {
GtkWidget *name_entry;
GtkWidget *short_name_entry;
GtkWidget *email_entry;
- GtkWidget *group_option_menu;
+ GtkWidget *group_option_menu;
} DialogData;
static void resource_input_dialog_setup_groups (DialogData *data);
@@ -57,12 +57,12 @@ resource_input_dialog_get_selected (GtkWidget *option_menu)
GtkWidget *menu;
GtkWidget *item;
MrpGroup *ret;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
if (!menu) {
return NULL;
}
-
+
item = gtk_menu_get_active (GTK_MENU (menu));
ret = g_object_get_data (G_OBJECT (item), "data");
@@ -83,11 +83,11 @@ resource_input_dialog_setup_groups (DialogData *data)
gint index;
option_menu = data->group_option_menu;
-
+
selected_group = resource_input_dialog_get_selected (option_menu);
groups = mrp_project_get_groups (data->project);
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
if (menu) {
@@ -171,31 +171,31 @@ resource_input_dialog_response_cb (GtkWidget *button,
const gchar *short_name;
const gchar *email;
MrpGroup *group;
-
+
switch (response) {
case GTK_RESPONSE_OK:
data = g_object_get_data (G_OBJECT (dialog), "data");
-
+
name = gtk_entry_get_text (GTK_ENTRY (data->name_entry));
short_name = gtk_entry_get_text (GTK_ENTRY (data->short_name_entry));
email = gtk_entry_get_text (GTK_ENTRY (data->email_entry));
group = resource_input_dialog_get_selected (data->group_option_menu);
-
+
resource = g_object_new (MRP_TYPE_RESOURCE,
"name", name,
"short_name", short_name,
"email", email,
"group", group,
NULL);
-
+
/* mrp_project_add_resource (data->project, resource); */
planner_resource_cmd_insert (data->main_window, resource);
-
+
gtk_entry_set_text (GTK_ENTRY (data->name_entry), "");
gtk_entry_set_text (GTK_ENTRY (data->short_name_entry), "");
gtk_entry_set_text (GTK_ENTRY (data->email_entry), "");
-
+
gtk_widget_grab_focus (data->name_entry);
break;
@@ -203,7 +203,7 @@ resource_input_dialog_response_cb (GtkWidget *button,
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (dialog);
break;
-
+
default:
g_assert_not_reached ();
break;
@@ -226,40 +226,40 @@ planner_resource_input_dialog_new (PlannerWindow *main_window)
gchar *filename;
project = planner_window_get_project (main_window);
-
+
data = g_new0 (DialogData, 1);
data->project = g_object_ref (project);
data->main_window = g_object_ref (main_window);
-
+
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");
+
+ dialog = glade_xml_get_widget (gui, "resource_input_dialog");
g_signal_connect (dialog,
"response",
G_CALLBACK (resource_input_dialog_response_cb),
dialog);
-
+
data->name_entry = glade_xml_get_widget (gui, "name_entry");
g_signal_connect (data->name_entry,
"activate",
G_CALLBACK (resource_input_dialog_activate_cb),
dialog);
-
+
data->short_name_entry = glade_xml_get_widget (gui, "short_name_entry");
g_signal_connect (data->short_name_entry,
"activate",
G_CALLBACK (resource_input_dialog_activate_cb),
dialog);
-
+
data->email_entry = glade_xml_get_widget (gui, "email_entry");
g_signal_connect (data->email_entry,
"activate",
G_CALLBACK (resource_input_dialog_activate_cb),
dialog);
-
+
data->group_option_menu = glade_xml_get_widget (gui, "group_optionmenu");
resource_input_dialog_setup_groups (data);
@@ -269,17 +269,17 @@ planner_resource_input_dialog_new (PlannerWindow *main_window)
G_CALLBACK (resource_input_dialog_groups_updated),
dialog,
0);
-
+
g_signal_connect_object (project,
"group_removed",
G_CALLBACK (resource_input_dialog_groups_updated),
dialog,
0);
-
+
g_object_set_data_full (G_OBJECT (dialog),
"data",
data,
resource_input_dialog_free);
-
+
return dialog;
}
diff --git a/src/planner-resource-view.c b/src/planner-resource-view.c
index 1209d48..6fe88d8 100644
--- a/src/planner-resource-view.c
+++ b/src/planner-resource-view.c
@@ -299,7 +299,7 @@ typedef struct {
PlannerCmd base;
MrpResource *resource;
- gchar *property;
+ gchar *property;
GValue *value;
GValue *old_value;
} ResourceCmdEditProperty;
@@ -308,7 +308,7 @@ typedef struct {
PlannerCmd base;
MrpResource *resource;
- MrpProperty *property;
+ MrpProperty *property;
GValue *value;
GValue *old_value;
} ResourceCmdEditCustomProperty;
@@ -390,7 +390,7 @@ static void
resource_view_setup (PlannerView *view, PlannerWindow *main_window)
{
PlannerResourceViewPriv *priv;
-
+
priv = PLANNER_RESOURCE_VIEW (view)->priv;
priv->property_to_column = g_hash_table_new (NULL, NULL);
@@ -428,11 +428,11 @@ static const gchar *
resource_view_get_icon (PlannerView *view)
{
static gchar *filename = NULL;
-
+
if (!filename) {
filename = mrp_paths_get_image_dir ("resources.png");
}
-
+
return filename;
}
@@ -489,10 +489,10 @@ resource_view_get_widget (PlannerView *view)
project = planner_window_get_project (view->main_window);
- g_signal_connect (project,
- "loaded",
- G_CALLBACK (resource_view_project_loaded_cb),
- view);
+ g_signal_connect (project,
+ "loaded",
+ G_CALLBACK (resource_view_project_loaded_cb),
+ view);
g_signal_connect (project,
"property_added",
@@ -503,34 +503,34 @@ resource_view_get_widget (PlannerView *view)
"property_removed",
G_CALLBACK (resource_view_property_removed),
view);
-
- g_signal_connect (project,
+
+ g_signal_connect (project,
"property_changed",
G_CALLBACK (resource_view_property_changed),
view);
- g_signal_connect (project,
+ g_signal_connect (project,
"resource_added",
- G_CALLBACK (resource_view_resource_added_cb),
+ G_CALLBACK (resource_view_resource_added_cb),
view);
- g_signal_connect (project,
- "resource_removed",
- G_CALLBACK (resource_view_resource_removed_cb),
+ g_signal_connect (project,
+ "resource_removed",
+ G_CALLBACK (resource_view_resource_removed_cb),
view);
- model = GTK_TREE_MODEL (gtk_list_store_new (NUM_OF_COLS,
+ model = GTK_TREE_MODEL (gtk_list_store_new (NUM_OF_COLS,
G_TYPE_POINTER));
- resource_table = gtk_tree_view_new_with_model (model);
+ resource_table = gtk_tree_view_new_with_model (model);
priv->tree_view = GTK_TREE_VIEW (resource_table);
resource_view_setup_tree_view (view);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (resource_table));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (resource_table));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
-
+
g_signal_connect (selection, "changed",
G_CALLBACK (resource_view_selection_changed_cb),
view);
@@ -542,7 +542,7 @@ resource_view_get_widget (PlannerView *view)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
-
+
gtk_container_add (GTK_CONTAINER (sw), resource_table);
gtk_container_add (GTK_CONTAINER (frame), sw);
@@ -553,10 +553,10 @@ static void
resource_view_print_init (PlannerView *view, PlannerPrintJob *job)
{
PlannerResourceViewPriv *priv;
-
+
priv = PLANNER_RESOURCE_VIEW (view)->priv;
-
- priv->print_sheet = planner_table_print_sheet_new (view, job,
+
+ priv->print_sheet = planner_table_print_sheet_new (view, job,
priv->tree_view);
}
@@ -588,7 +588,7 @@ typedef struct {
} FindResourceData;
-static void
+static void
resource_view_free_find_resource_data (FindResourceData *data)
{
if (data->found_path) {
@@ -597,7 +597,7 @@ resource_view_free_find_resource_data (FindResourceData *data)
if (data->found_iter) {
gtk_tree_iter_free (data->found_iter);
}
-
+
g_free (data);
}
@@ -608,7 +608,7 @@ resource_view_foreach_find_resource_func (GtkTreeModel *model,
FindResourceData *data)
{
MrpResource *resource;
-
+
gtk_tree_model_get (model, iter,
COL_RESOURCE, &resource,
-1);
@@ -618,7 +618,7 @@ resource_view_foreach_find_resource_func (GtkTreeModel *model,
data->found_iter = gtk_tree_iter_copy (iter);
return TRUE;
}
-
+
return FALSE;
}
@@ -627,7 +627,7 @@ resource_view_find_resource (PlannerView *view, MrpResource *resource)
{
FindResourceData *data;
GtkTreeModel *model;
-
+
data = g_new0 (FindResourceData, 1);
data->resource = resource;
data->found_path = NULL;
@@ -641,7 +641,7 @@ resource_view_find_resource (PlannerView *view, MrpResource *resource)
if (data->found_path) {
return data;
}
-
+
g_free (data);
return NULL;
}
@@ -657,10 +657,10 @@ resource_view_resource_notify_cb (MrpResource *resource,
model = gtk_tree_view_get_model (PLANNER_RESOURCE_VIEW (view)->priv->tree_view);
data = resource_view_find_resource (view, resource);
-
+
if (data) {
- gtk_tree_model_row_changed (GTK_TREE_MODEL (model),
- data->found_path,
+ gtk_tree_model_row_changed (GTK_TREE_MODEL (model),
+ data->found_path,
data->found_iter);
resource_view_free_find_resource_data (data);
@@ -679,10 +679,10 @@ resource_view_resource_prop_changed_cb (MrpResource *resource,
model = gtk_tree_view_get_model (PLANNER_RESOURCE_VIEW (view)->priv->tree_view);
data = resource_view_find_resource (view, resource);
-
+
if (data) {
- gtk_tree_model_row_changed (GTK_TREE_MODEL (model),
- data->found_path,
+ gtk_tree_model_row_changed (GTK_TREE_MODEL (model),
+ data->found_path,
data->found_iter);
resource_view_free_find_resource_data (data);
@@ -690,17 +690,17 @@ resource_view_resource_prop_changed_cb (MrpResource *resource,
}
static void
-resource_view_resource_added_cb (MrpProject *project,
+resource_view_resource_added_cb (MrpProject *project,
MrpResource *resource,
PlannerView *view)
{
GtkTreeModel *model;
GtkTreeIter iter;
-
+
model = gtk_tree_view_get_model (PLANNER_RESOURCE_VIEW (view)->priv->tree_view);
-
+
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
-
+
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
COL_RESOURCE, g_object_ref (resource),
-1);
@@ -714,33 +714,33 @@ resource_view_resource_added_cb (MrpProject *project,
}
static void
-resource_view_resource_removed_cb (MrpProject *project,
+resource_view_resource_removed_cb (MrpProject *project,
MrpResource *resource,
PlannerView *view)
{
GtkTreeModel *model;
FindResourceData *data;
- g_signal_handlers_disconnect_by_func (resource,
+ g_signal_handlers_disconnect_by_func (resource,
resource_view_resource_notify_cb,
view);
- g_signal_handlers_disconnect_by_func (resource,
+ g_signal_handlers_disconnect_by_func (resource,
resource_view_resource_prop_changed_cb,
view);
model = gtk_tree_view_get_model (PLANNER_RESOURCE_VIEW (view)->priv->tree_view);
-
+
data = resource_view_find_resource (view, resource);
if (data) {
gtk_widget_grab_focus (GTK_WIDGET (PLANNER_RESOURCE_VIEW (view)->priv->tree_view));
- gtk_list_store_remove (GTK_LIST_STORE (model),
+ gtk_list_store_remove (GTK_LIST_STORE (model),
data->found_iter);
resource_view_free_find_resource_data (data);
}
}
-static const gchar *
+static const gchar *
resource_view_get_type_string (MrpResourceType type)
{
switch (type) {
@@ -767,7 +767,7 @@ resource_view_get_type_enum (const gchar *type_str)
gchar *work = g_utf8_casefold (_("Work"), -1);
gchar *material = g_utf8_casefold (_("Material"), -1);
MrpResourceType type;
-
+
if (!g_utf8_collate (work, in_str)) {
type = MRP_RESOURCE_TYPE_WORK;
}
@@ -780,14 +780,14 @@ resource_view_get_type_enum (const gchar *type_str)
g_free (in_str);
g_free (work);
g_free (material);
-
+
return type;
}
#endif
/* Command callbacks. */
-static void
+static void
resource_view_popup_insert_resource_cb (gpointer callback_data,
guint action,
GtkWidget *widget)
@@ -795,15 +795,15 @@ resource_view_popup_insert_resource_cb (gpointer callback_data,
resource_view_insert_resource_cb (NULL, callback_data);
}
-static void
+static void
resource_view_popup_remove_resource_cb (gpointer callback_data,
guint action,
GtkWidget *widget)
{
- resource_view_remove_resource_cb (NULL, callback_data);
+ resource_view_remove_resource_cb (NULL, callback_data);
}
-static void
+static void
resource_view_popup_edit_resource_cb (gpointer callback_data,
guint action,
GtkWidget *widget)
@@ -830,17 +830,17 @@ resource_view_insert_resource_cb (GtkAction *action,
if (!GTK_WIDGET_HAS_FOCUS (priv->tree_view)) {
gtk_widget_grab_focus (GTK_WIDGET (priv->tree_view));
}
-
+
find_data = resource_view_find_resource (view, cmd->resource);
if (find_data) {
model = gtk_tree_view_get_model (priv->tree_view);
path = gtk_tree_model_get_path (model, find_data->found_iter);
-
+
gtk_tree_view_set_cursor (priv->tree_view,
path,
gtk_tree_view_get_column (priv->tree_view, 0),
FALSE);
-
+
gtk_tree_path_free (path);
resource_view_free_find_resource_data (find_data);
@@ -859,7 +859,7 @@ resource_view_insert_resources_cb (GtkAction *action,
priv = PLANNER_RESOURCE_VIEW (view)->priv;
project = planner_window_get_project (view->main_window);
-
+
/* We only want one of these dialogs at a time. */
if (priv->resource_input_dialog) {
gtk_window_present (GTK_WINDOW (priv->resource_input_dialog));
@@ -870,7 +870,7 @@ resource_view_insert_resources_cb (GtkAction *action,
gtk_window_set_transient_for (GTK_WINDOW (priv->resource_input_dialog),
GTK_WINDOW (view->main_window));
-
+
gtk_widget_show (priv->resource_input_dialog);
g_object_add_weak_pointer (G_OBJECT (priv->resource_input_dialog),
@@ -888,7 +888,7 @@ resource_cmd_remove_do (PlannerCmd *cmd_base)
assignments = mrp_resource_get_assignments (cmd->resource);
for (l = assignments; l; l = l->next) {
- cmd->assignments = g_list_append (cmd->assignments,
+ cmd->assignments = g_list_append (cmd->assignments,
g_object_ref (l->data));
}
@@ -902,7 +902,7 @@ resource_cmd_remove_undo (PlannerCmd *cmd_base)
{
ResourceCmdRemove *cmd;
GList *l;
-
+
cmd = (ResourceCmdRemove*) cmd_base;
mrp_project_add_resource (cmd->project, cmd->resource);
@@ -934,7 +934,7 @@ resource_cmd_remove_free (PlannerCmd *cmd_base)
}
static PlannerCmd *
-resource_cmd_remove (PlannerView *view,
+resource_cmd_remove (PlannerView *view,
MrpResource *resource)
{
PlannerCmd *cmd_base;
@@ -969,11 +969,11 @@ resource_view_remove_resource_cb (GtkAction *action,
view = PLANNER_VIEW (data);
priv = PLANNER_RESOURCE_VIEW (view)->priv;
-
+
project = planner_window_get_project (view->main_window);
list = resource_view_selection_get_list (view);
-
+
for (node = list; node; node = node->next) {
cmd = (ResourceCmdRemove*) resource_cmd_remove (view, MRP_RESOURCE (node->data));
}
@@ -990,20 +990,20 @@ resource_view_edit_resource_cb (GtkAction *action,
PlannerView *view;
PlannerResourceViewPriv *priv;
MrpResource *resource;
- GtkWidget *dialog;
+ GtkWidget *dialog;
GList *list;
view = PLANNER_VIEW (data);
- priv = PLANNER_RESOURCE_VIEW (view)->priv;
+ priv = PLANNER_RESOURCE_VIEW (view)->priv;
list = resource_view_selection_get_list (view);
-
+
resource = MRP_RESOURCE (list->data);
if (resource) {
dialog = planner_resource_dialog_new (view->main_window, resource);
gtk_widget_show (dialog);
}
-
+
g_list_free (list);
}
@@ -1032,7 +1032,7 @@ resource_view_select_all_cb (GtkAction *action,
view = PLANNER_VIEW (data);
priv = PLANNER_RESOURCE_VIEW (view)->priv;
-
+
selection = gtk_tree_view_get_selection (priv->tree_view);
gtk_tree_selection_select_all (selection);
@@ -1047,20 +1047,20 @@ resource_view_edit_custom_props_cb (GtkAction *action,
MrpProject *project;
view = PLANNER_VIEW (data);
-
+
project = planner_window_get_project (view->main_window);
-
+
dialog = planner_property_dialog_new (view->main_window,
project,
MRP_TYPE_RESOURCE,
_("Edit custom resource properties"));
-
+
gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300);
gtk_widget_show (dialog);
}
static void
-resource_view_update_ui (PlannerView *view)
+resource_view_update_ui (PlannerView *view)
{
PlannerResourceViewPriv *priv;
GList *list;
@@ -1068,27 +1068,27 @@ resource_view_update_ui (PlannerView *view)
priv = PLANNER_RESOURCE_VIEW (view)->priv;
- list = resource_view_selection_get_list (view);
+ list = resource_view_selection_get_list (view);
value = (list != NULL);
g_list_free (list);
if (!view->activated) {
return;
}
-
+
g_object_set (gtk_action_group_get_action (priv->actions, "RemoveResource"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "EditResource"),
- "sensitive", value,
+ "sensitive", value,
NULL);
}
-static void
+static void
resource_view_selection_changed_cb (GtkTreeSelection *selection, PlannerView *view)
{
-
- resource_view_update_ui (view);
+
+ resource_view_update_ui (view);
}
static void
@@ -1135,7 +1135,7 @@ resource_view_button_press_event (GtkTreeView *tv,
gtk_widget_set_sensitive (
gtk_item_factory_get_widget_by_action (factory, POPUP_EDIT), FALSE);
}
-
+
gtk_item_factory_popup (factory, event->x_root, event->y_root,
event->button, event->time);
return TRUE;
@@ -1152,14 +1152,14 @@ resource_view_setup_tree_view (PlannerView *view)
GtkCellRenderer *cell;
tree_view = GTK_TREE_VIEW (PLANNER_RESOURCE_VIEW (view)->priv->tree_view);
-
+
gtk_tree_view_set_rules_hint (tree_view, TRUE);
g_signal_connect (tree_view,
"popup_menu",
G_CALLBACK (resource_view_popup_menu),
view);
-
+
g_signal_connect (tree_view,
"button_press_event",
G_CALLBACK (resource_view_button_press_event),
@@ -1174,13 +1174,13 @@ resource_view_setup_tree_view (PlannerView *view)
gtk_tree_view_column_set_min_width (col, 150);
gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
- gtk_tree_view_column_set_cell_data_func (col, cell,
+ gtk_tree_view_column_set_cell_data_func (col, cell,
resource_view_name_data_func,
NULL, NULL);
g_object_set_data (G_OBJECT (col),
"data-func", resource_view_name_data_func);
g_object_set_data (G_OBJECT (col), "id", "name");
-
+
g_signal_connect (cell,
"edited",
G_CALLBACK (resource_view_cell_name_edited),
@@ -1199,8 +1199,8 @@ resource_view_setup_tree_view (PlannerView *view)
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_min_width (col, 75);
-
- gtk_tree_view_column_set_cell_data_func (col, cell,
+
+ gtk_tree_view_column_set_cell_data_func (col, cell,
resource_view_short_name_data_func,
NULL, NULL);
g_object_set_data (G_OBJECT (col),
@@ -1212,7 +1212,7 @@ resource_view_setup_tree_view (PlannerView *view)
"notify::width",
G_CALLBACK (resource_view_column_notify_width_cb),
view);
-
+
g_signal_connect (cell,
"edited",
G_CALLBACK (resource_view_cell_short_name_edited),
@@ -1224,14 +1224,14 @@ resource_view_setup_tree_view (PlannerView *view)
col = gtk_tree_view_column_new_with_attributes (_("Type"), cell, NULL);
gtk_tree_view_column_set_resizable (col, TRUE);
-
- gtk_tree_view_column_set_cell_data_func (col, cell,
+
+ gtk_tree_view_column_set_cell_data_func (col, cell,
resource_view_type_data_func,
NULL, NULL);
g_object_set_data (G_OBJECT (col),
"data-func", resource_view_type_data_func);
g_object_set_data (G_OBJECT (col), "id", "type");
-
+
gtk_tree_view_append_column (tree_view, col);
g_signal_connect (col,
"notify::width",
@@ -1245,17 +1245,17 @@ resource_view_setup_tree_view (PlannerView *view)
g_signal_connect (cell,
"show-popup",
G_CALLBACK (resource_view_cell_type_show_popup),
- view);
+ view);
/* Group */
cell = planner_cell_renderer_list_new ();
g_object_set (cell, "editable", TRUE, NULL);
- col = gtk_tree_view_column_new_with_attributes (_("Group"),
+ col = gtk_tree_view_column_new_with_attributes (_("Group"),
cell, NULL);
gtk_tree_view_column_set_resizable (col, TRUE);
-
- gtk_tree_view_column_set_cell_data_func (col, cell,
+
+ gtk_tree_view_column_set_cell_data_func (col, cell,
resource_view_group_data_func,
NULL, NULL);
g_object_set_data (G_OBJECT (col),
@@ -1275,11 +1275,11 @@ resource_view_setup_tree_view (PlannerView *view)
g_signal_connect (cell,
"show-popup",
G_CALLBACK (resource_view_cell_group_show_popup),
- view);
+ view);
g_signal_connect_after (cell,
"hide-popup",
G_CALLBACK (resource_view_cell_group_hide_popup),
- view);
+ view);
/* Email */
cell = gtk_cell_renderer_text_new ();
@@ -1289,8 +1289,8 @@ resource_view_setup_tree_view (PlannerView *view)
cell, NULL);
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_column_set_min_width (col, 150);
-
- gtk_tree_view_column_set_cell_data_func (col, cell,
+
+ gtk_tree_view_column_set_cell_data_func (col, cell,
resource_view_email_data_func,
NULL, NULL);
g_object_set_data (G_OBJECT (col),
@@ -1302,7 +1302,7 @@ resource_view_setup_tree_view (PlannerView *view)
"notify::width",
G_CALLBACK (resource_view_column_notify_width_cb),
view);
-
+
g_signal_connect (cell,
"edited",
G_CALLBACK (resource_view_cell_email_edited),
@@ -1316,20 +1316,20 @@ resource_view_setup_tree_view (PlannerView *view)
cell, NULL);
gtk_tree_view_column_set_resizable (col, TRUE);
/*gtk_tree_view_column_set_min_width (col, 150);*/
-
- gtk_tree_view_column_set_cell_data_func (col, cell,
+
+ gtk_tree_view_column_set_cell_data_func (col, cell,
resource_view_cost_data_func,
NULL, NULL);
g_object_set_data (G_OBJECT (col),
"data-func", resource_view_cost_data_func);
g_object_set_data (G_OBJECT (col), "id", "cost");
-
+
gtk_tree_view_append_column (tree_view, col);
g_signal_connect (col,
"notify::width",
G_CALLBACK (resource_view_column_notify_width_cb),
view);
-
+
g_signal_connect (cell,
"edited",
G_CALLBACK (resource_view_cell_cost_edited),
@@ -1337,10 +1337,10 @@ resource_view_setup_tree_view (PlannerView *view)
/*
project = planner_window_get_project (view->main_window);
- properties = mrp_project_get_properties_from_type (project,
+ properties = mrp_project_get_properties_from_type (project,
MRP_TYPE_RESOURCE);
- for (l = properties; l; l = l->next) {
+ for (l = properties; l; l = l->next) {
resource_view_property_added (project, MRP_TYPE_RESOURCE, l->data, view);
}
*/
@@ -1351,7 +1351,7 @@ resource_view_setup_tree_view (PlannerView *view)
"columns-changed",
G_CALLBACK (resource_view_tree_view_columns_changed_cb),
view);
-
+
g_signal_connect (tree_view,
"destroy",
G_CALLBACK (resource_view_tree_view_destroy_cb),
@@ -1432,7 +1432,7 @@ resource_cmd_edit_property (PlannerView *view,
cmd->property,
cmd->old_value);
- /* FIXME: if old and new value are the same, do nothing
+ /* FIXME: if old and new value are the same, do nothing
How we can compare values?
*/
@@ -1513,7 +1513,7 @@ resource_cmd_edit_custom_property (PlannerView *view,
cmd->property,
cmd->old_value);
- /* FIXME: if old and new value are the same, do nothing
+ /* FIXME: if old and new value are the same, do nothing
How we can compare values?
*/
@@ -1535,20 +1535,20 @@ resource_view_cell_name_edited (GtkCellRendererText *cell,
GtkTreeView *tree_view;
GtkTreeModel *model;
GtkTreePath *path;
- GtkTreeIter iter;
+ GtkTreeIter iter;
GValue value = { 0 };
-
+
view = PLANNER_VIEW (user_data);
-
+
tree_view = PLANNER_RESOURCE_VIEW (view)->priv->tree_view;
model = gtk_tree_view_get_model (tree_view);
path = gtk_tree_path_new_from_string (path_string);
-
+
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, COL_RESOURCE, &resource, -1);
-
+
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, new_text);
cmd = resource_cmd_edit_property (view, resource, "name", &value);
@@ -1571,19 +1571,19 @@ resource_view_cell_short_name_edited (GtkCellRendererText *cell,
GtkTreePath *path;
GtkTreeIter iter;
GValue value = { 0 };
-
+
view = PLANNER_RESOURCE_VIEW (user_data);
-
+
tree_view = view->priv->tree_view;
-
+
model = gtk_tree_view_get_model (tree_view);
path = gtk_tree_path_new_from_string (path_string);
-
+
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, COL_RESOURCE, &resource, -1);
-
+
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, new_text);
cmd = resource_cmd_edit_property (PLANNER_VIEW (view), resource, "short_name", &value);
@@ -1607,19 +1607,19 @@ resource_view_cell_email_edited (GtkCellRendererText *cell,
GtkTreePath *path;
GtkTreeIter iter;
GValue value = { 0 };
-
+
view = PLANNER_VIEW (user_data);
-
+
tree_view = PLANNER_RESOURCE_VIEW (view)->priv->tree_view;
-
+
model = gtk_tree_view_get_model (tree_view);
path = gtk_tree_path_new_from_string (path_string);
-
+
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, COL_RESOURCE, &resource, -1);
-
+
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, new_text);
cmd = resource_cmd_edit_property (view, resource, "email", &value);
@@ -1643,19 +1643,19 @@ resource_view_cell_cost_edited (GtkCellRendererText *cell,
GtkTreeIter iter;
GValue value = { 0 };
gfloat fvalue;
-
+
view = PLANNER_VIEW (user_data);
-
+
tree_view = PLANNER_RESOURCE_VIEW (view)->priv->tree_view;
-
+
model = gtk_tree_view_get_model (tree_view);
path = gtk_tree_path_new_from_string (path_string);
-
+
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, COL_RESOURCE, &resource, -1);
-
+
fvalue = planner_parse_float (new_text);
g_value_init (&value, G_TYPE_FLOAT);
g_value_set_float (&value, fvalue);
@@ -1682,22 +1682,22 @@ resource_view_cell_type_edited (PlannerCellRendererList *cell,
GValue value = { 0 };
view = PLANNER_VIEW (user_data);
-
+
tree_view = PLANNER_RESOURCE_VIEW (view)->priv->tree_view;
-
+
model = gtk_tree_view_get_model (tree_view);
path = gtk_tree_path_new_from_string (path_string);
-
+
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, COL_RESOURCE, &resource, -1);
-
+
if (cell->selected_index == 0) {
type = MRP_RESOURCE_TYPE_WORK;
} else {
type = MRP_RESOURCE_TYPE_MATERIAL;
- }
+ }
g_value_init (&value, G_TYPE_INT);
g_value_set_int (&value, type);
@@ -1723,12 +1723,12 @@ resource_view_cell_type_show_popup (PlannerCellRendererList *cell,
MrpResource *resource;
GList *list;
MrpResourceType type;
-
+
tree_view = GTK_TREE_VIEW (PLANNER_RESOURCE_VIEW (view)->priv->tree_view);
model = gtk_tree_view_get_model (tree_view);
path = gtk_tree_path_new_from_string (path_string);
-
+
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, COL_RESOURCE, &resource, -1);
@@ -1736,7 +1736,7 @@ resource_view_cell_type_show_popup (PlannerCellRendererList *cell,
list = NULL;
list = g_list_append (list, g_strdup (_("Work")));
list = g_list_append (list, g_strdup (_("Material")));
-
+
cell->list = list;
mrp_object_get (resource, "type", &type, NULL);
@@ -1768,17 +1768,17 @@ resource_view_cell_group_edited (PlannerCellRendererList *cell,
GValue value = { 0 };
view = PLANNER_VIEW (user_data);
-
+
tree_view = PLANNER_RESOURCE_VIEW (view)->priv->tree_view;
-
+
model = gtk_tree_view_get_model (tree_view);
path = gtk_tree_path_new_from_string (path_string);
-
+
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, COL_RESOURCE, &resource, -1);
-
+
list = g_list_nth (cell->user_data, cell->selected_index);
if (list == NULL) {
/* We should probably parse the string here and set
@@ -1786,28 +1786,28 @@ resource_view_cell_group_edited (PlannerCellRendererList *cell,
*/
return;
}
-
- group = list->data;
+
+ group = list->data;
g_value_init (&value, MRP_TYPE_GROUP);
g_value_set_object (&value, group);
-
+
cmd = resource_cmd_edit_property (view, resource, "group", &value);
g_value_unset (&value);
-
+
gtk_tree_path_free (path);
}
static GValue
resource_view_custom_property_set_value (MrpProperty *property,
- gchar *new_text)
+ gchar *new_text)
{
GValue value = { 0 };
MrpPropertyType type;
gfloat fvalue;
/* FIXME: implement mrp_object_set_property like
- * g_object_set_property that takes a GValue.
+ * g_object_set_property that takes a GValue.
*/
type = mrp_property_get_property_type (property);
@@ -1835,7 +1835,7 @@ resource_view_custom_property_set_value (MrpProperty *property,
g_value_set_int (&value, atoi (new_text) *8*60*60);
break;
-
+
case MRP_PROPERTY_TYPE_DATE:
@@ -1845,8 +1845,8 @@ resource_view_custom_property_set_value (MrpProperty *property,
g_value_init (&value, G_TYPE_FLOAT);
g_value_set_float (&value, fvalue);
- break;
-
+ break;
+
default:
g_assert_not_reached ();
break;
@@ -1855,7 +1855,7 @@ resource_view_custom_property_set_value (MrpProperty *property,
return value;
}
-static void
+static void
resource_view_property_value_edited (GtkCellRendererText *cell,
gchar *path_str,
gchar *new_text,
@@ -1884,7 +1884,7 @@ resource_view_property_value_edited (GtkCellRendererText *cell,
value = resource_view_custom_property_set_value (property, new_text);
cmd = resource_cmd_edit_custom_property (view, resource,
- property,
+ property,
&value);
g_value_unset (&value);
@@ -1951,7 +1951,7 @@ resource_view_cell_group_show_popup (PlannerCellRendererList *cell,
if (current_group == group) {
index = i;
}
-
+
i++;
}
@@ -1971,7 +1971,7 @@ resource_view_cell_group_hide_popup (PlannerCellRendererList *cell,
g_object_unref (l->data);
}
}
-
+
g_list_free (cell->user_data);
cell->user_data = NULL;
}
@@ -1987,8 +1987,8 @@ resource_view_edit_groups_cb (GtkAction *action,
/* FIXME: we have to destroy group_dialog correctly */
if (PLANNER_RESOURCE_VIEW (view)->priv->group_dialog == NULL) {
PLANNER_RESOURCE_VIEW (view)->priv->group_dialog = planner_group_dialog_new (view);
-
- g_signal_connect (PLANNER_RESOURCE_VIEW (view)->priv->group_dialog,
+
+ g_signal_connect (PLANNER_RESOURCE_VIEW (view)->priv->group_dialog,
"destroy",
G_CALLBACK (resource_view_group_dialog_closed),
view);
@@ -2003,16 +2003,16 @@ resource_view_project_loaded_cb (MrpProject *project, PlannerView *view)
GtkTreeModel *model;
GList *resources, *l;
GtkTreeView *tree_view;
-
+
tree_view = PLANNER_RESOURCE_VIEW (view)->priv->tree_view;
-
+
model = GTK_TREE_MODEL (gtk_list_store_new (NUM_OF_COLS,
G_TYPE_POINTER));
resources = mrp_project_get_resources (project);
for (l = resources; l; l = l->next) {
GtkTreeIter iter;
-
+
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model),
&iter,
@@ -2024,15 +2024,15 @@ resource_view_project_loaded_cb (MrpProject *project, PlannerView *view)
g_object_unref (model);
}
-static void
-resource_view_property_added (MrpProject *project,
+static void
+resource_view_property_added (MrpProject *project,
GType object_type,
MrpProperty *property,
PlannerView *view)
{
PlannerResourceViewPriv *priv;
MrpPropertyType type;
- GtkTreeViewColumn *col;
+ GtkTreeViewColumn *col;
GtkCellRenderer *cell;
ColPropertyData *data;
@@ -2046,11 +2046,11 @@ resource_view_property_added (MrpProject *project,
!mrp_property_get_user_defined (property)) {
return;
}
-
+
if (type == MRP_PROPERTY_TYPE_DATE) {
return;
} else {
- cell = gtk_cell_renderer_text_new ();
+ cell = gtk_cell_renderer_text_new ();
}
g_object_set (cell, "editable", TRUE, NULL);
@@ -2064,13 +2064,13 @@ resource_view_property_added (MrpProject *project,
col = gtk_tree_view_column_new ();
gtk_tree_view_column_set_resizable (col, TRUE);
- gtk_tree_view_column_set_title (col,
+ gtk_tree_view_column_set_title (col,
mrp_property_get_label (property));
g_object_set_data (G_OBJECT (col), "custom", GINT_TO_POINTER (TRUE));
-
+
g_hash_table_insert (priv->property_to_column, property, col);
-
+
data->property = property;
data->view = view;
@@ -2089,8 +2089,8 @@ resource_view_property_added (MrpProject *project,
gtk_tree_view_append_column (priv->tree_view, col);
}
-static void
-resource_view_property_removed (MrpProject *project,
+static void
+resource_view_property_removed (MrpProject *project,
MrpProperty *property,
PlannerView *view)
{
@@ -2098,17 +2098,17 @@ resource_view_property_removed (MrpProject *project,
GtkTreeViewColumn *col;
priv = PLANNER_RESOURCE_VIEW (view)->priv;
-
+
col = g_hash_table_lookup (priv->property_to_column, property);
if (col) {
g_hash_table_remove (priv->property_to_column, property);
-
+
gtk_tree_view_remove_column (GTK_TREE_VIEW (priv->tree_view), col);
}
}
static void
-resource_view_property_changed (MrpProject *project,
+resource_view_property_changed (MrpProject *project,
MrpProperty *property,
PlannerView *view)
{
@@ -2116,10 +2116,10 @@ resource_view_property_changed (MrpProject *project,
GtkTreeViewColumn *col;
priv = PLANNER_RESOURCE_VIEW (view)->priv;
-
+
col = g_hash_table_lookup (priv->property_to_column, property);
if (col) {
- gtk_tree_view_column_set_title (col,
+ gtk_tree_view_column_set_title (col,
mrp_property_get_label (property));
}
}
@@ -2127,7 +2127,7 @@ resource_view_property_changed (MrpProject *project,
static void
resource_view_popup_menu (GtkWidget *widget,
PlannerView *view)
-{
+{
PlannerResourceViewPriv *priv;
GtkTreeView *tree;
GtkTreePath *path;
@@ -2137,13 +2137,13 @@ resource_view_popup_menu (GtkWidget *widget,
priv = PLANNER_RESOURCE_VIEW (view)->priv;
tree = GTK_TREE_VIEW (priv->tree_view);
-
+
gtk_tree_view_get_cursor (tree, &path, &column);
gtk_tree_view_get_cell_area (tree,
path,
column,
&rect);
-
+
x = rect.x;
y = rect.y;
@@ -2160,7 +2160,7 @@ resource_view_popup_menu (GtkWidget *widget,
/* Offset so it's not overlapping the cell. */
rect.x = x + 20;
rect.y = y + 20;
-
+
gtk_item_factory_popup (priv->popup_factory,
rect.x, rect.y,
0,
@@ -2176,11 +2176,11 @@ resource_view_name_data_func (GtkTreeViewColumn *tree_column,
{
MrpResource *resource;
gchar *name;
-
+
gtk_tree_model_get (tree_model, iter, COL_RESOURCE, &resource, -1);
g_object_get (resource, "name", &name, NULL);
-
+
g_object_set (cell, "text", name, NULL);
g_free (name);
}
@@ -2194,12 +2194,12 @@ resource_view_type_data_func (GtkTreeViewColumn *tree_column,
{
MrpResource *resource;
gint type;
-
+
gtk_tree_model_get (tree_model, iter, COL_RESOURCE, &resource, -1);
g_object_get (resource, "type", &type, NULL);
-
- g_object_set (cell,
+
+ g_object_set (cell,
"text", resource_view_get_type_string (type),
NULL);
}
@@ -2214,19 +2214,19 @@ resource_view_group_data_func (GtkTreeViewColumn *tree_column,
MrpResource *resource;
MrpGroup *group;
gchar *name;
-
+
gtk_tree_model_get (tree_model, iter, COL_RESOURCE, &resource, -1);
g_object_get (resource, "group", &group, NULL);
-
+
if (!group) {
g_object_set (cell, "text", "", NULL);
return;
}
-
+
g_object_get (group, "name", &name, NULL);
g_object_set (cell, "text", name, NULL);
-
+
g_free (name);
}
@@ -2239,11 +2239,11 @@ resource_view_short_name_data_func (GtkTreeViewColumn *tree_column,
{
MrpResource *resource;
gchar *short_name;
-
+
gtk_tree_model_get (tree_model, iter, COL_RESOURCE, &resource, -1);
g_object_get (resource, "short_name", &short_name, NULL);
-
+
g_object_set (cell, "text", short_name, NULL);
g_free (short_name);
}
@@ -2257,16 +2257,16 @@ resource_view_email_data_func (GtkTreeViewColumn *tree_column,
{
MrpResource *resource;
gchar *email;
-
+
gtk_tree_model_get (tree_model, iter, COL_RESOURCE, &resource, -1);
g_object_get (resource, "email", &email, NULL);
-
+
g_object_set (cell, "text", email, NULL);
g_free (email);
}
-static void
+static void
resource_view_cost_data_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
@@ -2276,17 +2276,17 @@ resource_view_cost_data_func (GtkTreeViewColumn *tree_column,
MrpResource *resource;
gfloat cost;
gchar *cost_text;
-
+
gtk_tree_model_get (tree_model, iter, COL_RESOURCE, &resource, -1);
g_object_get (resource, "cost", &cost, NULL);
cost_text = planner_format_float (cost, 2, FALSE);
-
+
g_object_set (cell, "text", cost_text, NULL);
g_free (cost_text);
}
-static void
+static void
resource_view_property_data_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *model,
@@ -2307,7 +2307,7 @@ resource_view_property_data_func (GtkTreeViewColumn *tree_column,
-1);
/* FIXME: implement mrp_object_get_property like
- * g_object_get_property that takes a GValue.
+ * g_object_get_property that takes a GValue.
*/
type = mrp_property_get_property_type (property);
@@ -2316,10 +2316,10 @@ resource_view_property_data_func (GtkTreeViewColumn *tree_column,
mrp_object_get (object,
mrp_property_get_name (property), &svalue,
NULL);
-
+
if (svalue == NULL) {
svalue = g_strdup ("");
- }
+ }
break;
case MRP_PROPERTY_TYPE_INT:
@@ -2340,10 +2340,10 @@ resource_view_property_data_func (GtkTreeViewColumn *tree_column,
case MRP_PROPERTY_TYPE_DATE:
mrp_object_get (object,
mrp_property_get_name (property), &tvalue,
- NULL);
+ NULL);
svalue = planner_format_date (tvalue);
break;
-
+
case MRP_PROPERTY_TYPE_DURATION:
mrp_object_get (object,
mrp_property_get_name (property), &ivalue,
@@ -2351,15 +2351,15 @@ resource_view_property_data_func (GtkTreeViewColumn *tree_column,
project = planner_window_get_project (PLANNER_VIEW (data)->main_window);
svalue = planner_format_duration (project, ivalue);
break;
-
+
case MRP_PROPERTY_TYPE_COST:
mrp_object_get (object,
mrp_property_get_name (property), &fvalue,
- NULL);
+ NULL);
svalue = planner_format_float (fvalue, 2, FALSE);
break;
-
+
default:
g_warning ("Type not implemented.");
svalue = g_strdup ("");
@@ -2377,13 +2377,13 @@ resource_view_selection_foreach (GtkTreeModel *model,
GList **list)
{
MrpResource *resource;
-
+
gtk_tree_model_get (model, iter,
COL_RESOURCE, &resource,
-1);
*list = g_list_prepend (*list, resource);
-
+
}
static GList *
@@ -2396,11 +2396,11 @@ resource_view_selection_get_list (PlannerView *view)
priv = PLANNER_RESOURCE_VIEW (view)->priv;
ret_list = NULL;
-
+
selection = gtk_tree_view_get_selection (priv->tree_view);
- gtk_tree_selection_selected_foreach (selection,
- (GtkTreeSelectionForeachFunc) resource_view_selection_foreach,
+ gtk_tree_selection_selected_foreach (selection,
+ (GtkTreeSelectionForeachFunc) resource_view_selection_foreach,
&ret_list);
return ret_list;
}
@@ -2412,7 +2412,7 @@ resource_view_save_columns (PlannerResourceView *view)
PlannerResourceViewPriv *priv;
priv = view->priv;
-
+
planner_view_column_save_helper (PLANNER_VIEW (view),
GTK_TREE_VIEW (priv->tree_view));
}
@@ -2425,13 +2425,13 @@ resource_view_load_columns (PlannerResourceView *view)
GtkTreeViewColumn *column;
const gchar *id;
gint i;
-
+
priv = view->priv;
/* Load the columns. */
planner_view_column_load_helper (PLANNER_VIEW (view),
GTK_TREE_VIEW (priv->tree_view));
-
+
/* Make things a bit more robust by setting defaults if we don't get any
* visible columns. Should be done through a schema instead (but we'll
* keep this since a lot of people get bad installations when installing
@@ -2444,7 +2444,7 @@ resource_view_load_columns (PlannerResourceView *view)
i++;
}
}
-
+
if (i == 0) {
for (l = columns; l; l = l->next) {
column = l->data;
@@ -2457,11 +2457,11 @@ resource_view_load_columns (PlannerResourceView *view)
if (!id) {
continue;
}
-
+
gtk_tree_view_column_set_visible (column, TRUE);
}
}
-
+
g_list_free (columns);
}
diff --git a/src/planner-scale-utils.c b/src/planner-scale-utils.c
index aa960ab..aab3e6e 100644
--- a/src/planner-scale-utils.c
+++ b/src/planner-scale-utils.c
@@ -77,7 +77,7 @@ planner_scale_format_time (mrptime t,
mrp_time2_get_date (t2, &year, &month, &day);
mrp_time2_get_time (t2, &hour, &min, &sec);
-
+
switch (unit) {
case MRP_TIME_UNIT_HOUR:
switch (format) {
@@ -94,7 +94,7 @@ planner_scale_format_time (mrptime t,
break;
}
break;
-
+
case MRP_TIME_UNIT_HALFDAY:
switch (format) {
default:
@@ -102,7 +102,7 @@ planner_scale_format_time (mrptime t,
break;
}
break;
-
+
case MRP_TIME_UNIT_DAY:
switch (format) {
case PLANNER_SCALE_FORMAT_SHORT:
@@ -132,7 +132,7 @@ planner_scale_format_time (mrptime t,
case PLANNER_SCALE_FORMAT_MEDIUM:
str = g_strdup_printf (_("Week %d"),
mrp_time2_get_week_number (t2, NULL));
- break;
+ break;
case PLANNER_SCALE_FORMAT_LONG:
/* i18n: Week, year. */
week = mrp_time2_get_week_number (t2, &year),
@@ -160,10 +160,10 @@ planner_scale_format_time (mrptime t,
break;
}
break;
-
+
case MRP_TIME_UNIT_QUARTER:
num = 1 + floor (month / 3);
-
+
switch (format) {
case PLANNER_SCALE_FORMAT_SHORT:
/* i18n: Short "Quarter", preferably 1 letter. */
@@ -172,7 +172,7 @@ planner_scale_format_time (mrptime t,
case PLANNER_SCALE_FORMAT_MEDIUM:
/* i18n: Short "Quarter", preferably 2-3 letters. */
str = g_strdup_printf (_("Qtr %d"), num);
- break;
+ break;
case PLANNER_SCALE_FORMAT_LONG:
/* i18n: Year, short "Quarter", preferably 2-3 letters. */
str = g_strdup_printf (_("%d, Qtr %d"),
@@ -181,7 +181,7 @@ planner_scale_format_time (mrptime t,
break;
}
break;
-
+
case MRP_TIME_UNIT_HALFYEAR:
num = 1 + floor (month / 6);
@@ -211,14 +211,14 @@ planner_scale_format_time (mrptime t,
case MRP_TIME_UNIT_NONE:
str = NULL;
break;
-
+
default:
g_assert_not_reached ();
break;
}
mrp_time2_free (t2);
-
+
return str;
}
diff --git a/src/planner-scale-utils.h b/src/planner-scale-utils.h
index 5ddbcba..5284451 100644
--- a/src/planner-scale-utils.h
+++ b/src/planner-scale-utils.h
@@ -49,7 +49,7 @@ typedef enum {
typedef struct {
MrpTimeUnit major_unit;
PlannerScaleFormat major_format;
-
+
MrpTimeUnit minor_unit;
PlannerScaleFormat minor_format;
diff --git a/src/planner-sidebar.c b/src/planner-sidebar.c
index cd52361..3636306 100644
--- a/src/planner-sidebar.c
+++ b/src/planner-sidebar.c
@@ -80,7 +80,7 @@ planner_sidebar_get_type (void)
planner_sidebar_type = g_type_register_static (GTK_TYPE_FRAME, "PlannerSidebar",
&planner_sidebar_info, 0);
}
-
+
return planner_sidebar_type;
}
@@ -102,7 +102,7 @@ sidebar_class_init (PlannerSidebarClass *class)
object_class->destroy = sidebar_destroy;
widget_class->style_set = sidebar_style_set;
-
+
/* Signals. */
signals[ICON_SELECTED] = g_signal_new
("icon_selected",
@@ -125,14 +125,14 @@ sidebar_init (PlannerSidebar *bar)
"realize",
G_CALLBACK (sidebar_event_box_realize_cb),
bar);
-
+
bar->priv->vbox = gtk_vbox_new (FALSE, 0);
gtk_widget_show (bar->priv->vbox);
-
+
gtk_container_add (GTK_CONTAINER (bar), bar->priv->event_box);
gtk_container_add (GTK_CONTAINER (bar->priv->event_box), bar->priv->vbox);
-
+
gtk_container_set_border_width (GTK_CONTAINER (bar->priv->vbox), 6);
gtk_frame_set_shadow_type (GTK_FRAME (bar), GTK_SHADOW_OUT);
}
@@ -167,16 +167,16 @@ sidebar_hls_to_rgb (gdouble *h,
gdouble saturation;
gdouble m1, m2;
gdouble r, g, b;
-
+
lightness = *l;
saturation = *s;
-
+
if (lightness <= 0.5)
m2 = lightness * (1 + saturation);
else
m2 = lightness + saturation - lightness * saturation;
m1 = 2 * lightness - m2;
-
+
if (saturation == 0) {
*h = lightness;
*l = lightness;
@@ -187,7 +187,7 @@ sidebar_hls_to_rgb (gdouble *h,
hue -= 360;
while (hue < 0)
hue += 360;
-
+
if (hue < 60)
r = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
@@ -196,13 +196,13 @@ sidebar_hls_to_rgb (gdouble *h,
r = m1 + (m2 - m1) * (240 - hue) / 60;
else
r = m1;
-
+
hue = *h;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
-
+
if (hue < 60)
g = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
@@ -211,13 +211,13 @@ sidebar_hls_to_rgb (gdouble *h,
g = m1 + (m2 - m1) * (240 - hue) / 60;
else
g = m1;
-
+
hue = *h - 120;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
-
+
if (hue < 60)
b = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
@@ -226,7 +226,7 @@ sidebar_hls_to_rgb (gdouble *h,
b = m1 + (m2 - m1) * (240 - hue) / 60;
else
b = m1;
-
+
*h = r;
*l = g;
*s = b;
@@ -245,17 +245,17 @@ sidebar_rgb_to_hls (gdouble *r,
gdouble blue;
gdouble h, l, s;
gdouble delta;
-
+
red = *r;
green = *g;
blue = *b;
-
+
if (red > green) {
if (red > blue)
max = red;
else
max = blue;
-
+
if (green < blue)
min = green;
else
@@ -265,23 +265,23 @@ sidebar_rgb_to_hls (gdouble *r,
max = green;
else
max = blue;
-
+
if (red < blue)
min = red;
else
min = blue;
}
-
+
l = (max + min) / 2;
s = 0;
h = 0;
-
+
if (max != min) {
if (l <= 0.5)
s = (max - min) / (max + min);
else
s = (max - min) / (2 - max - min);
-
+
delta = max -min;
if (red == max)
h = (green - blue) / delta;
@@ -289,12 +289,12 @@ sidebar_rgb_to_hls (gdouble *r,
h = 2 + (blue - red) / delta;
else if (blue == max)
h = 4 + (red - green) / delta;
-
+
h *= 60;
if (h < 0.0)
h += 360;
}
-
+
*r = h;
*g = l;
*b = s;
@@ -308,27 +308,27 @@ sidebar_style_shade (GdkColor *a,
gdouble red;
gdouble green;
gdouble blue;
-
+
red = (gdouble) a->red / 65535.0;
green = (gdouble) a->green / 65535.0;
blue = (gdouble) a->blue / 65535.0;
-
+
sidebar_rgb_to_hls (&red, &green, &blue);
-
+
green *= k;
if (green > 1.0)
green = 1.0;
else if (green < 0.0)
green = 0.0;
-
+
blue *= k;
if (blue > 1.0)
blue = 1.0;
else if (blue < 0.0)
blue = 0.0;
-
+
sidebar_hls_to_rgb (&red, &green, &blue);
-
+
b->red = red * 65535.0;
b->green = green * 65535.0;
b->blue = blue * 65535.0;
@@ -340,7 +340,7 @@ sidebar_darken_color (GdkColor *color,
{
GdkColor src = *color;
GdkColor shaded = { 0 };
-
+
while (darken_count) {
sidebar_style_shade (&src, &shaded, 0.93);
src = shaded;
@@ -367,14 +367,14 @@ sidebar_modify_bg (PlannerSidebar *bar)
prelight_color = style->dark[GTK_STATE_PRELIGHT];
sidebar_darken_color (&prelight_color, 4);
-
+
gtk_widget_modify_bg (bar->priv->event_box, GTK_STATE_NORMAL, &normal_color);
for (l = bar->priv->buttons; l; l = l->next) {
entry = l->data;
button = GTK_WIDGET (entry->button);
-
+
gtk_widget_modify_bg (button, GTK_STATE_NORMAL, &normal_color);
gtk_widget_modify_bg (button, GTK_STATE_ACTIVE, &normal_color);
gtk_widget_modify_bg (button, GTK_STATE_PRELIGHT, &prelight_color);
@@ -425,7 +425,7 @@ sidebar_button_toggled_cb (GtkToggleButton *button,
gtk_toggle_button_set_active (button, TRUE);
return;
}
-
+
if (!gtk_toggle_button_get_active (button)) {
return;
}
@@ -438,7 +438,7 @@ sidebar_button_toggled_cb (GtkToggleButton *button,
if (selected_button) {
gtk_toggle_button_set_active (selected_button, FALSE);
}
-
+
g_signal_emit (sidebar, signals[ICON_SELECTED], 0, index);
}
@@ -460,9 +460,9 @@ planner_sidebar_append (PlannerSidebar *sidebar,
g_return_if_fail (PLANNER_IS_SIDEBAR (sidebar));
priv = sidebar->priv;
-
+
entry = g_new0 (ButtonEntry, 1);
-
+
vbox = gtk_vbox_new (FALSE, 0);
image = gtk_image_new_from_file (icon_filename);
@@ -472,14 +472,14 @@ planner_sidebar_append (PlannerSidebar *sidebar,
gtk_button_set_relief (GTK_BUTTON (entry->button), GTK_RELIEF_NONE);
sidebar->priv->buttons = g_list_append (priv->buttons, entry);
-
+
g_signal_connect (entry->button,
"toggled",
G_CALLBACK (sidebar_button_toggled_cb),
sidebar);
gtk_container_add (GTK_CONTAINER (entry->button), image);
-
+
gtk_box_pack_start (GTK_BOX (vbox),
GTK_WIDGET (entry->button),
FALSE,
@@ -529,12 +529,12 @@ planner_sidebar_set_active (PlannerSidebar *sidebar,
if (!entry) {
return;
}
-
+
if (entry->button != priv->selected_button) {
if (priv->selected_button) {
gtk_toggle_button_set_active (priv->selected_button, FALSE);
}
-
+
gtk_toggle_button_set_active (entry->button, TRUE);
priv->selected_button = entry->button;
diff --git a/src/planner-sql-plugin.c b/src/planner-sql-plugin.c
index adaecbf..c130686 100644
--- a/src/planner-sql-plugin.c
+++ b/src/planner-sql-plugin.c
@@ -55,7 +55,7 @@
typedef struct {
GtkWidget *open_dialog;
-} SQLPluginPriv;
+} SQLPluginPriv;
static gint sql_plugin_retrieve_project_id (PlannerPlugin *plugin,
gchar *server,
@@ -100,13 +100,13 @@ static const GtkActionEntry entries[] = {
G_CALLBACK (sql_plugin_save) }
};
-static gboolean
+static gboolean
sql_execute_command (GdaConnection *con, gchar *command)
{
GdaCommand *cmd;
GList *list;
GError *error = NULL;
-
+
cmd = gda_command_new (command, GDA_COMMAND_TYPE_SQL, GDA_COMMAND_OPTION_STOP_ON_ERRORS);
list = gda_connection_execute_command (con, cmd, NULL, &error);
gda_command_free (cmd);
@@ -149,7 +149,7 @@ sql_get_last_error (GdaConnection *connection)
GdaConnectionEvent *error;
const gchar *error_txt;
- g_return_val_if_fail (GDA_IS_CONNECTION (connection),
+ g_return_val_if_fail (GDA_IS_CONNECTION (connection),
_("Can't connect to database server"));
list = (GList *) gda_connection_get_events (connection);
@@ -159,7 +159,7 @@ sql_get_last_error (GdaConnection *connection)
}
error = (GdaConnectionEvent *) g_list_last (list)->data;
-
+
/* FIXME: Poor user, she won't get localized messages */
error_txt = gda_connection_event_get_description (error);
@@ -182,7 +182,7 @@ get_int (GdaDataModel *res, gint row, gint column)
g_warning ("Failed to get a value: (%d,%d)", column, row);
return INT_MAX;
}
-
+
str = gda_value_stringify (value);
i = strtol (str, NULL, 10);
g_free (str);
@@ -200,16 +200,16 @@ get_string (GdaDataModel *res, gint row, gint column)
gchar *ret;
gsize len;
GValue *value;
-
+
value = (GValue *) gda_data_model_get_value_at (res, column, row);
if (value == NULL) {
g_warning ("Failed to get a value: (%d,%d)", column, row);
return "";
}
-
+
str = gda_value_stringify (value);
len = strlen (str);
-
+
if (g_utf8_validate (str, len, NULL)) {
return str;
}
@@ -228,7 +228,7 @@ get_string (GdaDataModel *res, gint row, gint column)
}
g_free (str);
-
+
return ret;
}
@@ -250,7 +250,7 @@ strdup_null_if_empty (const gchar *str)
g_free (tmp);
return NULL;
}
-
+
return tmp;
}
@@ -269,21 +269,21 @@ create_sql_uri (const gchar *server,
gchar *str;
string = g_string_new ("sql://");
-
+
if (server) {
if (login) {
g_string_append (string, login);
-
+
if (password) {
g_string_append_c (string, ':');
g_string_append (string, password);
}
-
+
g_string_append_c (string, '@');
}
-
+
g_string_append (string, server);
-
+
if (port) {
g_string_append_c (string, ':');
g_string_append (string, port);
@@ -293,14 +293,14 @@ create_sql_uri (const gchar *server,
g_string_append_c (string, '#');
g_string_append_printf (string, "db=%s", database);
-
+
if (project_id != -1) {
g_string_append_printf (string, "&id=%d", project_id);
}
-
+
str = string->str;
g_string_free (string, FALSE);
-
+
return str;
}
@@ -313,7 +313,7 @@ show_error_dialog (PlannerPlugin *plugin,
gint response;
window = GTK_WINDOW (plugin->main_window);
-
+
dialog = gtk_message_dialog_new (window,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
@@ -328,11 +328,11 @@ static void
selection_changed_cb (GtkTreeSelection *selection, GtkWidget *ok_button)
{
gboolean sensitive = FALSE;
-
+
if (gtk_tree_selection_count_selected_rows (selection) > 0) {
sensitive = TRUE;
}
-
+
gtk_widget_set_sensitive (ok_button, sensitive);
}
@@ -347,20 +347,20 @@ row_activated_cb (GtkWidget *tree_view,
/* Planner versions:
1.x is always lower than 2.x.
- 0.6 is lower than 0.11
+ 0.6 is lower than 0.11
If 0.11.90 we don't look ".90".
*/
static gboolean
-is_newer_version (const gchar *version_new_txt,
+is_newer_version (const gchar *version_new_txt,
const gchar *version_old_txt)
{
guint subversion_old, subversion_new;
guint version_old, version_new;
gchar **versionv_new, **versionv_old;
- g_return_val_if_fail (version_new_txt != NULL &&
+ g_return_val_if_fail (version_new_txt != NULL &&
version_old_txt != NULL, FALSE);
-
+
version_old = g_ascii_strtod (version_old_txt, NULL);
version_new = g_ascii_strtod (version_new_txt, NULL);
@@ -370,7 +370,7 @@ is_newer_version (const gchar *version_new_txt,
else if (version_old > version_new) {
return FALSE;
}
-
+
/* Need to check subversion */
versionv_old = g_strsplit (version_old_txt,".",-1);
versionv_new = g_strsplit (version_new_txt,".",-1);
@@ -417,7 +417,7 @@ check_database_tables (GdaConnection *conn,
window = GTK_WINDOW (plugin->main_window);
/* Try to get the database version */
- model = sql_execute_query (conn, "SELECT value FROM property_global WHERE prop_name='database_version'");
+ model = sql_execute_query (conn, "SELECT value FROM property_global WHERE prop_name='database_version'");
if (model == NULL) {
create_tables = TRUE;
} else {
@@ -436,7 +436,7 @@ check_database_tables (GdaConnection *conn,
gchar **namev = NULL, **versionv = NULL;
gchar *version;
gchar *sql_file;
-
+
if (!g_str_has_suffix (name, ".sql")) {
continue;
}
@@ -451,7 +451,7 @@ check_database_tables (GdaConnection *conn,
if (is_newer_version (versionv[0], namev[1])) {
if (!strcmp (namev[1], database_version)) {
upgradable = TRUE;
- if (is_newer_version (versionv[0],
+ if (is_newer_version (versionv[0],
max_version_upgrade)) {
if (upgrade_file) {
g_free (upgrade_file);
@@ -476,11 +476,11 @@ check_database_tables (GdaConnection *conn,
g_free (max_version_database);
max_version_database = g_strdup (versionv[0]);
}
-
+
can_create_tables = TRUE;
version = g_strdup (versionv[0]);
g_free (version);
-
+
} else {
if (!database_file) {
database_file = g_strdup (sql_file);
@@ -509,7 +509,7 @@ check_database_tables (GdaConnection *conn,
upgrade_file);
retval = FALSE;
upgradable = FALSE;
- can_create_tables = FALSE;
+ can_create_tables = FALSE;
}
if (!upgradable && !create_tables) {
@@ -525,13 +525,13 @@ check_database_tables (GdaConnection *conn,
_("Database %s needs to be upgraded "
"from version %s to version %s.\n"
"Please backup database before the upgrade."),
- database_name, database_version,
+ database_name, database_version,
max_version_upgrade);
- gtk_dialog_add_buttons ((GtkDialog *) dialog,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- _("Upgrade"), GTK_RESPONSE_YES,
- NULL);
-
+ gtk_dialog_add_buttons ((GtkDialog *) dialog,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ _("Upgrade"), GTK_RESPONSE_YES,
+ NULL);
+
result = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
if (result == GTK_RESPONSE_YES) {
@@ -547,7 +547,7 @@ check_database_tables (GdaConnection *conn,
"\n\nDatabase error: \n%s"),
database_name, upgrade_file,
sql_get_last_error (conn));
-
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
retval = FALSE;
@@ -555,7 +555,7 @@ check_database_tables (GdaConnection *conn,
gchar *query;
sql_execute_command (conn, "DELETE * FROM property_global WHERE prop_name='database_version'");
- query = g_strdup_printf ("INSERT INTO property_global (prop_name, value) VALUES ('database_version','%s')", max_version_upgrade);
+ query = g_strdup_printf ("INSERT INTO property_global (prop_name, value) VALUES ('database_version','%s')", max_version_upgrade);
sql_execute_command (conn, query);
g_free (query);
@@ -585,22 +585,22 @@ check_database_tables (GdaConnection *conn,
GTK_BUTTONS_CLOSE,
_("Can't create tables in database %s"),
database_name);
-
+
result = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
retval = FALSE;
} else {
gchar *query;
-
- query = g_strdup_printf ("INSERT INTO property_global (prop_name, value) VALUES ('database_version','%s')", max_version_database);
-
+
+ query = g_strdup_printf ("INSERT INTO property_global (prop_name, value) VALUES ('database_version','%s')", max_version_database);
+
sql_execute_command (conn, query);
g_free (query);
retval = TRUE;
}
g_free (database_file);
}
-
+
g_free (max_version_upgrade);
g_free (max_version_database);
return retval;
@@ -633,7 +633,7 @@ create_database (const gchar *dsn_name,
window = GTK_WINDOW (plugin->main_window);
/* Use same data but changing the database */
- dsn->cnc_string = g_strdup_printf (CONNECTION_FORMAT_STRING, host, init_database);
+ dsn->cnc_string = g_strdup_printf (CONNECTION_FORMAT_STRING, host, init_database);
gda_config_save_data_source_info (dsn);
client = gda_client_new ();
@@ -648,13 +648,13 @@ create_database (const gchar *dsn_name,
_("Database %s is not setup for Planner. "
"Do you want to do that?"),
db_name);
-
+
result = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
-
+
if (result == GTK_RESPONSE_YES) {
- query = g_strdup_printf ("CREATE DATABASE %s WITH ENCODING = 'UTF8'",
- db_name);
+ query = g_strdup_printf ("CREATE DATABASE %s WITH ENCODING = 'UTF8'",
+ db_name);
sql_execute_command (conn, query);
g_free (query);
retval = TRUE;
@@ -677,7 +677,7 @@ sql_get_tested_connection (const gchar *dsn_name,
const gchar *host,
const gchar *db_name,
GdaClient *client,
- PlannerPlugin *plugin)
+ PlannerPlugin *plugin)
{
GdaConnection *conn = NULL;
gboolean success;
@@ -688,7 +688,7 @@ sql_get_tested_connection (const gchar *dsn_name,
if (conn == NULL) {
if (!create_database (dsn_name, host, db_name, plugin)) {
- str = g_strdup_printf (_("Connection to database '%s %s' failed."),
+ str = g_strdup_printf (_("Connection to database '%s %s' failed."),
db_name, host);
show_error_dialog (plugin, str);
conn = NULL;
@@ -699,15 +699,15 @@ sql_get_tested_connection (const gchar *dsn_name,
if (conn != NULL) {
- success = sql_execute_command (conn, "SET TIME ZONE 'UTC'");
+ success = sql_execute_command (conn, "SET TIME ZONE 'UTC'");
if (!success) {
g_warning ("SET TIME ZONE command failed: %s.",
sql_get_last_error (conn));
goto out;
}
- if (!check_database_tables (conn, plugin)) {
- str = g_strdup_printf (_("Test to tables in database '%s' failed."),
+ if (!check_database_tables (conn, plugin)) {
+ str = g_strdup_printf (_("Test to tables in database '%s' failed."),
db_name);
show_error_dialog (plugin, str);
g_free (str);
@@ -760,8 +760,8 @@ sql_plugin_retrieve_project_id (PlannerPlugin *plugin,
gchar *filename;
db_txt = g_strdup_printf (CONNECTION_FORMAT_STRING,server,database);
- gda_config_save_data_source (dsn_name,
- provider,
+ gda_config_save_data_source (dsn_name,
+ provider,
db_txt,
"planner project", login, password, FALSE);
g_free (db_txt);
@@ -798,13 +798,13 @@ sql_plugin_retrieve_project_id (PlannerPlugin *plugin,
filename = mrp_paths_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");
g_object_unref (gui);
-
+
liststore = gtk_list_store_new (4, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (liststore));
@@ -815,7 +815,7 @@ sql_plugin_retrieve_project_id (PlannerPlugin *plugin,
NULL);
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), col);
-
+
cell = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (_("Project"),
cell,
@@ -823,7 +823,7 @@ sql_plugin_retrieve_project_id (PlannerPlugin *plugin,
NULL);
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), col);
-
+
cell = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (_("Phase"),
cell,
@@ -831,7 +831,7 @@ sql_plugin_retrieve_project_id (PlannerPlugin *plugin,
NULL);
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), col);
-
+
cell = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (_("Revision"),
cell,
@@ -839,12 +839,12 @@ sql_plugin_retrieve_project_id (PlannerPlugin *plugin,
NULL);
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), col);
-
+
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (treeview));
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+
g_signal_connect (selection,
"changed",
G_CALLBACK (selection_changed_cb),
@@ -854,13 +854,13 @@ sql_plugin_retrieve_project_id (PlannerPlugin *plugin,
"row_activated",
G_CALLBACK (row_activated_cb),
ok_button);
-
+
for (i = 0; i < gda_data_model_get_n_rows (model); i++) {
gint id;
gchar *name;
gchar *phase;
gint revision;
-
+
id = get_int (model, i, 0);
name = get_string (model, i, 1);
phase = get_string (model, i, 2);
@@ -871,9 +871,9 @@ sql_plugin_retrieve_project_id (PlannerPlugin *plugin,
g_free (phase);
phase = g_strdup ("");
}
-
+
gtk_list_store_append (GTK_LIST_STORE (liststore), &iter);
- gtk_list_store_set (GTK_LIST_STORE (liststore),
+ gtk_list_store_set (GTK_LIST_STORE (liststore),
&iter,
COL_ID, id,
COL_NAME, name,
@@ -888,16 +888,16 @@ sql_plugin_retrieve_project_id (PlannerPlugin *plugin,
if (gda_data_model_get_n_columns (model) == 0) {
gtk_widget_set_sensitive (ok_button, FALSE);
}
-
+
g_object_unref (model);
sql_execute_command (conn,"CLOSE mycursor");
-
+
gtk_widget_show_all (dialog);
response = gtk_dialog_run (GTK_DIALOG (dialog));
project_id = -1;
-
+
switch (response) {
case GTK_RESPONSE_CANCEL:
case GTK_RESPONSE_DELETE_EVENT:
@@ -908,10 +908,10 @@ sql_plugin_retrieve_project_id (PlannerPlugin *plugin,
}
gtk_tree_model_get (GTK_TREE_MODEL (liststore),
- &iter,
+ &iter,
COL_ID, &project_id,
-1);
-
+
break;
};
@@ -942,7 +942,7 @@ sql_plugin_retrieve_db_values (PlannerPlugin *plugin,
gboolean ret;
application = planner_window_get_application (plugin->main_window);
-
+
filename = mrp_paths_get_glade_dir ("sql.glade");
gui = glade_xml_new (filename, "open_dialog" , NULL);
g_free (filename);
@@ -976,7 +976,7 @@ sql_plugin_retrieve_db_values (PlannerPlugin *plugin,
gtk_entry_set_text (GTK_ENTRY (user_entry), str);
g_free (str);
}
-
+
g_object_unref (gui);
response = gtk_dialog_run (GTK_DIALOG (dialog));
@@ -988,11 +988,11 @@ sql_plugin_retrieve_db_values (PlannerPlugin *plugin,
*database = strdup_null_if_empty (gtk_entry_get_text (GTK_ENTRY (db_entry)));
*login = strdup_null_if_empty (gtk_entry_get_text (GTK_ENTRY (user_entry)));
*password = strdup_null_if_empty (gtk_entry_get_text (GTK_ENTRY (password_entry)));
-
- planner_conf_set_string (CONF_SERVER,
+
+ planner_conf_set_string (CONF_SERVER,
*server ? *server : "",
NULL);
-
+
planner_conf_set_string (CONF_DATABASE,
*database ? *database : "",
NULL);
@@ -1009,7 +1009,7 @@ sql_plugin_retrieve_db_values (PlannerPlugin *plugin,
}
gtk_widget_destroy (dialog);
-
+
return ret;
}
@@ -1039,7 +1039,7 @@ sql_plugin_open (GtkAction *action,
&password)) {
return;
}
-
+
project_id = sql_plugin_retrieve_project_id (plugin,
server,
port,
@@ -1049,7 +1049,7 @@ sql_plugin_open (GtkAction *action,
if (project_id == -1) {
goto fail;
}
-
+
/* Note: The project can change or disappear between the call above and
* below. We handle that case though.
*/
@@ -1059,10 +1059,10 @@ sql_plugin_open (GtkAction *action,
project = planner_window_get_project (plugin->main_window);
window = GTK_WIDGET (plugin->main_window);
application = planner_window_get_application (plugin->main_window);
-
+
if (mrp_project_is_empty (project)) {
GObject *object = G_OBJECT (window);
-
+
if (!mrp_project_load (project, uri, &error)) {
show_error_dialog (plugin, error->message);
g_clear_error (&error);
@@ -1076,29 +1076,29 @@ sql_plugin_open (GtkAction *action,
g_object_set_data_full (object, PASSWORD, password, g_free);
g_free (uri);
-
+
return;
} else {
GObject *object;
-
+
window = planner_application_new_window (application);
project = planner_window_get_project (PLANNER_WINDOW (window));
-
+
object = G_OBJECT (window);
-
+
/* We must get the new plugin object for the new window,
* otherwise we'll pass the wrong window around... a bit
* hackish.
*/
plugin = g_object_get_data (G_OBJECT (window), "sql-plugin");
-
+
if (!mrp_project_load (project, uri, &error)) {
g_warning ("Error: %s", error->message);
g_clear_error (&error);
gtk_widget_destroy (window);
goto fail;
}
-
+
g_object_set_data_full (object, SERVER, server, g_free);
g_object_set_data_full (object, DATABASE, database, g_free);
g_object_set_data_full (object, LOGIN, login, g_free);
@@ -1139,7 +1139,7 @@ sql_plugin_save (GtkAction *action,
gchar *db_txt;
const gchar *dsn_name = "planner-auto";
const gchar *provider = "PostgreSQL";
-
+
project = planner_window_get_project (plugin->main_window);
if (!sql_plugin_retrieve_db_values (plugin,
@@ -1153,8 +1153,8 @@ sql_plugin_save (GtkAction *action,
}
db_txt = g_strdup_printf (CONNECTION_FORMAT_STRING,server,database);
- gda_config_save_data_source (dsn_name,
- provider,
+ gda_config_save_data_source (dsn_name,
+ provider,
db_txt,
"planner project", login, password, FALSE);
g_free (db_txt);
@@ -1175,41 +1175,41 @@ sql_plugin_save (GtkAction *action,
/* First time project */
if (uri_plan == NULL) {
- uri = create_sql_uri (server, port, database, login, password, -1);
- if (!mrp_project_save_as (project, uri, FALSE, &error)) {
+ uri = create_sql_uri (server, port, database, login, password, -1);
+ if (!mrp_project_save_as (project, uri, FALSE, &error)) {
show_error_dialog (plugin, error->message);
g_clear_error (&error);
goto fail;
}
g_free (uri);
-
- }
+
+ }
/* Project was in database */
else if (strncmp (uri_plan, "sql://", 6) == 0) {
- if (!mrp_project_save (project, FALSE, &error)) {
+ if (!mrp_project_save (project, FALSE, &error)) {
show_error_dialog (plugin, error->message);
g_clear_error (&error);
goto fail;
}
- }
+ }
/* Project wasn't in database */
else {
- uri = create_sql_uri (server, port, database, login, password, -1);
- if (!mrp_project_save_as (project, uri, FALSE, &error)) {
+ uri = create_sql_uri (server, port, database, login, password, -1);
+ if (!mrp_project_save_as (project, uri, FALSE, &error)) {
show_error_dialog (plugin, error->message);
g_clear_error (&error);
goto fail;
}
g_free (uri);
}
-
+
object = G_OBJECT (plugin->main_window);
-
+
g_object_set_data_full (object, SERVER, server, g_free);
g_object_set_data_full (object, DATABASE, database, g_free);
g_object_set_data_full (object, LOGIN, login, g_free);
g_object_set_data_full (object, PASSWORD, password, g_free);
-
+
return;
fail:
@@ -1221,12 +1221,12 @@ fail:
g_free (uri);
}
-G_MODULE_EXPORT void
-plugin_exit (void)
+G_MODULE_EXPORT void
+plugin_exit (void)
{
}
-G_MODULE_EXPORT void
+G_MODULE_EXPORT void
plugin_init (PlannerPlugin *plugin,
PlannerWindow *main_window)
{
@@ -1237,17 +1237,17 @@ plugin_init (PlannerPlugin *plugin,
gchar *filename;
gda_init (PACKAGE, VERSION, 0, NULL);
-
+
priv = g_new0 (SQLPluginPriv, 1);
- g_object_set_data (G_OBJECT (main_window),
+ g_object_set_data (G_OBJECT (main_window),
PROJECT_ID,
GINT_TO_POINTER (i));
- g_object_set_data (G_OBJECT (main_window),
+ g_object_set_data (G_OBJECT (main_window),
"sql-plugin-revision",
GINT_TO_POINTER (i));
- g_object_set_data (G_OBJECT (main_window),
+ g_object_set_data (G_OBJECT (main_window),
"sql-plugin",
plugin);
@@ -1266,7 +1266,7 @@ plugin_init (PlannerPlugin *plugin,
filename = mrp_paths_get_ui_dir ("sql-plugin.ui");
gtk_ui_manager_add_ui_from_file (ui, filename, NULL);
g_free (filename);
-
+
gtk_ui_manager_ensure_update (ui);
}
diff --git a/src/planner-table-print-sheet.c b/src/planner-table-print-sheet.c
index 3e7b5a9..eea2e83 100644
--- a/src/planner-table-print-sheet.c
+++ b/src/planner-table-print-sheet.c
@@ -49,7 +49,7 @@ typedef struct {
typedef struct {
GtkTreeViewColumn *tree_column;
gchar *name;
-
+
gdouble width;
gboolean expander_column;
@@ -111,8 +111,8 @@ static void table_print_sheet_fill_page (PlannerTablePrintSheet
static void
-table_print_sheet_print_header_cell (PlannerTablePrintSheet *sheet,
- PrintColumn *column,
+table_print_sheet_print_header_cell (PlannerTablePrintSheet *sheet,
+ PrintColumn *column,
PrintRow *row,
gdouble x,
gdouble y)
@@ -122,17 +122,17 @@ table_print_sheet_print_header_cell (PlannerTablePrintSheet *sheet,
text_x = x + sheet->x_pad;
text_y = y + TEXT_IN_CELL_MULTI * row->height;
-
+
planner_print_job_set_font_bold (sheet->job);
-
+
planner_print_job_text (sheet->job, text_x, text_y, column->name);
-
+
planner_print_job_set_font_regular (sheet->job);
}
static void
table_print_sheet_print_cell (PlannerTablePrintSheet *sheet,
- PrintColumn *column,
+ PrintColumn *column,
PrintRow *row,
gdouble x,
gdouble y)
@@ -144,7 +144,7 @@ table_print_sheet_print_cell (PlannerTablePrintSheet *sheet,
GtkTreeIter iter;
GtkCellRenderer *cell;
PangoWeight weight;
- gint depth = 0;
+ gint depth = 0;
if (row->header) {
table_print_sheet_print_header_cell (sheet, column, row, x, y);
@@ -155,18 +155,18 @@ table_print_sheet_print_cell (PlannerTablePrintSheet *sheet,
if (column->expander_column) {
depth = gtk_tree_path_get_depth (row->path);
}
-
+
model = gtk_tree_view_get_model (sheet->tree_view);
gtk_tree_model_get_iter (model, &iter, row->path);
-
- (* column->data_func) (column->tree_column,
+
+ (* column->data_func) (column->tree_column,
cell,
model,
- &iter,
+ &iter,
column->user_data);
g_object_get (cell,
- "text", &str,
+ "text", &str,
"weight", &weight,
NULL);
g_object_ref_sink (cell);
@@ -175,19 +175,19 @@ table_print_sheet_print_cell (PlannerTablePrintSheet *sheet,
if (!str) {
return;
}
-
+
if (weight == PANGO_WEIGHT_BOLD) {
planner_print_job_set_font_bold (sheet->job);
- }
+ }
d(g_print ("Writing: [%s]\n", str));
text_x = x + sheet->x_pad + INDENT_FACTOR * depth;
text_y = y + TEXT_IN_CELL_MULTI * row->height;
-
+
planner_print_job_text (sheet->job, text_x, text_y, str);
g_free (str);
-
+
planner_print_job_set_font_regular (sheet->job);
}
@@ -196,7 +196,7 @@ table_print_sheet_print_page (PlannerTablePrintSheet *sheet, PrintPage *page)
{
GSList *r, *c;
gdouble x = 0, y = 0;
-
+
planner_print_job_begin_next_page (sheet->job);
cairo_set_line_width (sheet->job->cr, THIN_LINE_WIDTH);
@@ -208,15 +208,15 @@ table_print_sheet_print_page (PlannerTablePrintSheet *sheet, PrintPage *page)
PRINT_ROW (r->data),
x, y);
x += PRINT_COL (c->data)->width;
- planner_print_job_moveto (sheet->job,
- x, y);
- planner_print_job_lineto (sheet->job,
+ planner_print_job_moveto (sheet->job,
+ x, y);
+ planner_print_job_lineto (sheet->job,
x,
y + PRINT_ROW (r->data)->height);
cairo_stroke (sheet->job->cr);
}
-
+
y += PRINT_ROW (r->data)->height;
planner_print_job_moveto (sheet->job, 0, y);
planner_print_job_lineto (sheet->job, x, y);
@@ -235,27 +235,27 @@ table_print_sheet_create_column (PlannerTablePrintSheet *sheet,
{
PrintColumn *column;
gdouble ext;
-
+
column = g_new0 (PrintColumn, 1);
-
+
column->tree_column = tree_column;
column->expander_column = expander_column;
column->name = g_strdup (gtk_tree_view_column_get_title (tree_column));
planner_print_job_set_font_bold (sheet->job);
ext = planner_print_job_get_extents (sheet->job, column->name);
column->width = ext + 3 * sheet->x_pad;
-
+
column->data_func = g_object_get_data (G_OBJECT (tree_column),
"data-func");
column->user_data = g_object_get_data (G_OBJECT (tree_column),
"user-data");
-
+
return column;
}
static gboolean
table_print_sheet_foreach_row (GtkTreeModel *model,
- GtkTreePath *path,
+ GtkTreePath *path,
GtkTreeIter *iter,
gpointer user_data)
{
@@ -267,9 +267,9 @@ table_print_sheet_foreach_row (GtkTreeModel *model,
GtkTreeIter parent_iter;
GtkTreePath *parent_path = NULL;
gdouble ext;
-
+
d(g_print ("%s\n", gtk_tree_path_to_string (path)));
-
+
depth = gtk_tree_path_get_depth (path);
if (gtk_tree_model_iter_parent (model, &parent_iter, iter)) {
@@ -283,9 +283,9 @@ table_print_sheet_foreach_row (GtkTreeModel *model,
row->path = gtk_tree_path_copy (path);
row->height = sheet->row_height;
row->header = FALSE;
-
+
sheet->rows = g_slist_prepend (sheet->rows, row);
-
+
cell = gtk_cell_renderer_text_new ();
/* Loop through the columns to update widths */
@@ -293,7 +293,7 @@ table_print_sheet_foreach_row (GtkTreeModel *model,
PrintColumn *column = PRINT_COL (l->data);
gchar *str;
gdouble extra = 3 * sheet->x_pad;
-
+
(* column->data_func) (column->tree_column,
cell,
model,
@@ -311,7 +311,7 @@ table_print_sheet_foreach_row (GtkTreeModel *model,
if(str) {
ext = planner_print_job_get_extents (sheet->job, str);
}
- column->width = MAX (column->width,
+ column->width = MAX (column->width,
ext
+ extra);
/* d(g_print ("New width: %f\n", column->width)); */
@@ -324,7 +324,7 @@ table_print_sheet_foreach_row (GtkTreeModel *model,
if (parent_path) {
gtk_tree_path_free (parent_path);
}
-
+
return FALSE;
}
@@ -334,7 +334,7 @@ table_print_sheet_create_pages (PlannerTablePrintSheet *sheet)
GSList *l, *p = NULL;
PrintPage *page = NULL;
GSList *rows, *page_row;
-
+
sheet->pages = NULL;
page = g_new0 (PrintPage, 1);
@@ -343,7 +343,7 @@ table_print_sheet_create_pages (PlannerTablePrintSheet *sheet)
page->columns = NULL;
page->rows = NULL;
d(g_print ("sheet_create_pages: Adding a page\n"));
-
+
sheet->pages = g_slist_prepend (sheet->pages, page);
/* Create pages for all columns */
@@ -352,15 +352,15 @@ table_print_sheet_create_pages (PlannerTablePrintSheet *sheet)
if ((column->width + page->width) > sheet->page_width) {
d(g_print ("Switching page: %f > %f\n",
- column->width + page->width,
+ column->width + page->width,
sheet->page_width));
-
+
if (p) {
p->next = NULL;
}
-
+
table_print_sheet_fill_page (sheet, page);
-
+
page = g_new0 (PrintPage, 1);
page->height = 0;
page->width = 0;
@@ -380,11 +380,11 @@ table_print_sheet_create_pages (PlannerTablePrintSheet *sheet)
page_row = g_slist_copy (sheet->pages);
rows = table_print_sheet_add_row_of_pages (sheet,
- page_row,
+ page_row,
rows,
FALSE);
while (rows) {
- rows = table_print_sheet_add_row_of_pages (sheet, page_row,
+ rows = table_print_sheet_add_row_of_pages (sheet, page_row,
rows, TRUE);
}
g_slist_free (page_row);
@@ -403,12 +403,12 @@ table_print_sheet_add_row_of_pages (PlannerTablePrintSheet *sheet,
for (l = rows; l; l = l->next) {
PrintRow *row = PRINT_ROW (l->data);
-
+
if (added_height + row->height > sheet->page_height) {
ret_val = l;
break;
}
-
+
added_height += row->height;
added_rows = g_slist_prepend (added_rows, l->data);
}
@@ -416,14 +416,14 @@ table_print_sheet_add_row_of_pages (PlannerTablePrintSheet *sheet,
if (!l) {
ret_val = NULL;
}
-
+
added_rows = g_slist_reverse (added_rows);
for (l = page_row; l; l = l->next) {
PrintPage *page = PRINT_PAGE (l->data);
if (new_row) {
PrintPage *new_page;
-
+
new_page = g_new0 (PrintPage, 1);
new_page->columns = g_slist_copy (page->columns);
new_page->rows = g_slist_copy (added_rows);
@@ -450,23 +450,23 @@ table_print_sheet_fill_page (PlannerTablePrintSheet *sheet, PrintPage *page)
gdouble extra;
gdouble extra_per_column;
gint columns;
-
+
d(g_print ("Fill page\n"));
extra = sheet->page_width - page->width;
columns = g_slist_length (page->columns);
extra_per_column = extra / columns;
-
+
for (l = page->columns; l; l = l->next) {
PrintColumn *column = PRINT_COL (l->data);
-
+
column->width += extra_per_column;
}
}
PlannerTablePrintSheet *
-planner_table_print_sheet_new (PlannerView *view,
- PlannerPrintJob *job,
+planner_table_print_sheet_new (PlannerView *view,
+ PlannerPrintJob *job,
GtkTreeView *tree_view)
{
PlannerTablePrintSheet *sheet;
@@ -474,7 +474,7 @@ planner_table_print_sheet_new (PlannerView *view,
GList *tree_columns, *l;
PrintRow *row;
gboolean expander_column;
-
+
sheet = g_new0 (PlannerTablePrintSheet, 1);
sheet->view = view;
@@ -495,24 +495,24 @@ planner_table_print_sheet_new (PlannerView *view,
sheet->rows = g_slist_prepend (NULL, row);
model = gtk_tree_view_get_model (tree_view);
-
+
/* Create all the columns */
tree_columns = gtk_tree_view_get_columns (tree_view);
for (l = tree_columns; l; l = l->next) {
PrintColumn *column;
GtkTreeViewColumn *tree_column;
-
+
tree_column = GTK_TREE_VIEW_COLUMN (l->data);
if (!gtk_tree_view_column_get_visible (tree_column)) {
continue;
}
-
+
if (tree_column == gtk_tree_view_get_expander_column (tree_view)) {
expander_column = TRUE;
} else {
expander_column = FALSE;
}
-
+
column = table_print_sheet_create_column (sheet,
tree_column,
expander_column);
@@ -521,9 +521,9 @@ planner_table_print_sheet_new (PlannerView *view,
}
g_list_free (tree_columns);
sheet->columns = g_slist_reverse (sheet->columns);
-
+
/* Create the rows and calculate column widths */
- gtk_tree_model_foreach (model,
+ gtk_tree_model_foreach (model,
table_print_sheet_foreach_row,
sheet);
@@ -535,13 +535,13 @@ planner_table_print_sheet_new (PlannerView *view,
sheet->rows = g_slist_reverse (sheet->rows);
table_print_sheet_create_pages (sheet);
-
+
return sheet;
}
void
-planner_table_print_sheet_output (PlannerTablePrintSheet *sheet,
- gint page_nr)
+planner_table_print_sheet_output (PlannerTablePrintSheet *sheet,
+ gint page_nr)
{
PrintPage *page = PRINT_PAGE(g_slist_nth_data (sheet->pages, page_nr));
g_assert(page != NULL);
@@ -552,7 +552,7 @@ gint
planner_table_print_sheet_get_n_pages (PlannerTablePrintSheet *sheet)
{
d(g_print ("Number of pages: %d\n", g_slist_length (sheet->pages)));
-
+
return g_slist_length (sheet->pages);
}
@@ -574,14 +574,14 @@ planner_table_print_sheet_free (PlannerTablePrintSheet *sheet)
for (l = sheet->columns; l; l = l->next) {
PrintColumn *column = PRINT_COL (l->data);
-
+
g_free (column->name);
g_free (column);
}
for (l = sheet->rows; l; l = l->next) {
PrintRow *row = PRINT_ROW (l->data);
-
+
if (row->path) {
gtk_tree_path_free (row->path);
}
diff --git a/src/planner-task-cmd.c b/src/planner-task-cmd.c
index 8feeb32..cdaa7da 100644
--- a/src/planner-task-cmd.c
+++ b/src/planner-task-cmd.c
@@ -54,8 +54,8 @@ task_cmd_link_do (PlannerCmd *cmd_base)
retval = TRUE;
} else {
cmd->error = error;
- retval = FALSE;
- }
+ retval = FALSE;
+ }
return retval;
}
@@ -64,9 +64,9 @@ static void
task_cmd_link_undo (PlannerCmd *cmd_base)
{
TaskCmdLink *cmd;
-
+
cmd = (TaskCmdLink*) cmd_base;
-
+
mrp_task_remove_predecessor (cmd->after, cmd->before);
}
@@ -107,8 +107,8 @@ planner_task_cmd_link (PlannerWindow *main_window,
cmd->after = g_object_ref (after);
cmd->relationship = relationship;
cmd->lag = lag;
-
- planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
+
+ planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
(main_window),
cmd_base);
@@ -118,14 +118,14 @@ planner_task_cmd_link (PlannerWindow *main_window,
return NULL;
}
- return cmd_base;
+ return cmd_base;
}
static gboolean
task_cmd_unlink_do (PlannerCmd *cmd_base)
{
TaskCmdLink *cmd;
-
+
cmd = (TaskCmdLink*) cmd_base;
mrp_task_remove_predecessor (cmd->after, cmd->before);
@@ -174,7 +174,7 @@ planner_task_cmd_unlink (PlannerWindow *main_window,
task_cmd_unlink_do,
task_cmd_unlink_undo,
task_cmd_unlink_free);
-
+
cmd = (TaskCmdLink *) cmd_base;
cmd->project = g_object_ref (planner_window_get_project (main_window));
@@ -183,8 +183,8 @@ planner_task_cmd_unlink (PlannerWindow *main_window,
cmd->after = g_object_ref (mrp_relation_get_successor (relation));
cmd->relationship = mrp_relation_get_relation_type (relation);
cmd->lag = mrp_relation_get_lag (relation);
-
- planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
+
+ planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
(main_window),
cmd_base);
return cmd_base;
@@ -195,10 +195,10 @@ typedef struct {
MrpProject *project;
- gint position;
+ gint position;
gint work;
gint duration;
-
+
MrpTask *task; /* The inserted task */
MrpTask *parent;
} TaskCmdInsert;
@@ -230,7 +230,7 @@ static void
task_cmd_insert_undo (PlannerCmd *cmd_base)
{
TaskCmdInsert *cmd;
-
+
cmd = (TaskCmdInsert *) cmd_base;
mrp_project_remove_task (cmd->project, cmd->task);
@@ -283,7 +283,7 @@ planner_task_cmd_insert (PlannerWindow *main_window,
if (new_task != NULL) {
cmd->task = g_object_ref (new_task);
}
-
+
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (main_window),
cmd_base);
diff --git a/src/planner-task-date-widget.c b/src/planner-task-date-widget.c
index 75b349d..e0c8b47 100644
--- a/src/planner-task-date-widget.c
+++ b/src/planner-task-date-widget.c
@@ -64,7 +64,7 @@ planner_task_date_widget_class_init (PlannerTaskDateWidgetClass *klass)
NULL, NULL,
planner_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
+
signals[CANCELLED] = g_signal_new ("cancelled",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -72,7 +72,7 @@ planner_task_date_widget_class_init (PlannerTaskDateWidgetClass *klass)
NULL, NULL,
planner_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
+
g_type_class_add_private (klass, sizeof (PlannerTaskDateWidgetPriv));
}
@@ -86,11 +86,11 @@ GtkWidget *
planner_task_date_widget_new (void)
{
GtkWidget *widget;
-
+
widget = g_object_new (PLANNER_TYPE_TASK_DATE_WIDGET,
"shadow_type", GTK_SHADOW_OUT,
NULL);
-
+
return widget;
}
@@ -102,7 +102,7 @@ task_date_widget_today_clicked_cb (GtkWidget *button,
mrptime today;
priv = GET_PRIV (widget);
-
+
today = mrp_time_current_time ();
planner_task_date_widget_set_date (widget, today);
}
@@ -155,7 +155,7 @@ task_date_widget_combo_changed_cb (GtkComboBox *combo,
MrpConstraintType type;
priv = GET_PRIV (widget);
-
+
type = planner_task_date_widget_get_constraint_type (widget);
gtk_widget_set_sensitive (priv->calendar, type != MRP_CONSTRAINT_ASAP);
@@ -202,7 +202,7 @@ task_date_widget_setup (PlannerTaskDateWidget *widget)
"changed",
G_CALLBACK (task_date_widget_combo_changed_cb),
widget);
-
+
priv->today_button = glade_xml_get_widget (glade, "today_button");
g_signal_connect (priv->today_button, "clicked",
G_CALLBACK (task_date_widget_today_clicked_cb),
@@ -218,7 +218,7 @@ task_date_widget_setup (PlannerTaskDateWidget *widget)
G_CALLBACK (task_date_widget_select_clicked_cb),
widget);
- g_signal_connect (priv->calendar, "day-selected-double-click",
+ g_signal_connect (priv->calendar, "day-selected-double-click",
G_CALLBACK (task_date_day_selected_double_click_cb),
widget);
@@ -232,7 +232,7 @@ planner_task_date_widget_set_date (PlannerTaskDateWidget *widget, mrptime t)
gint year, month, day;
priv = GET_PRIV (widget);
-
+
if (!mrp_time_decompose (t, &year, &month, &day, NULL, NULL, NULL)) {
return;
}
@@ -248,10 +248,10 @@ planner_task_date_widget_get_date (PlannerTaskDateWidget *widget)
gint year, month, day;
priv = GET_PRIV (widget);
-
+
gtk_calendar_get_date (GTK_CALENDAR (priv->calendar),
&year, &month, &day);
-
+
month++;
return mrp_time_compose (year, month, day, 0, 0, 0);
}
@@ -264,7 +264,7 @@ planner_task_date_widget_set_constraint_type (PlannerTaskDateWidget *widget,
gint index;
priv = GET_PRIV (widget);
-
+
switch (type) {
case MRP_CONSTRAINT_ASAP:
index = 0;
@@ -300,8 +300,8 @@ planner_task_date_widget_get_constraint_type (PlannerTaskDateWidget *widget)
return MRP_CONSTRAINT_SNET;
case 2:
return MRP_CONSTRAINT_MSO;
- }
-
+ }
+
return MRP_CONSTRAINT_ASAP;
}
diff --git a/src/planner-task-dialog.c b/src/planner-task-dialog.c
index f156c6a..01b9495 100644
--- a/src/planner-task-dialog.c
+++ b/src/planner-task-dialog.c
@@ -197,7 +197,7 @@ typedef struct {
PlannerCmd base;
MrpTask *task;
- gchar *property;
+ gchar *property;
GValue *value;
GValue *old_value;
} TaskCmdEditProperty;
@@ -283,7 +283,7 @@ task_dialog_setup_option_menu (GtkWidget *option_menu,
if (menu) {
gtk_widget_destroy (menu);
}
-
+
menu = gtk_menu_new ();
va_start (args, str1);
@@ -293,7 +293,7 @@ task_dialog_setup_option_menu (GtkWidget *option_menu,
gtk_menu_append (GTK_MENU (menu), menu_item);
type = va_arg (args, gint);
-
+
g_object_set_data (G_OBJECT (menu_item),
"data",
GINT_TO_POINTER (type));
@@ -316,15 +316,15 @@ task_dialog_option_menu_get_selected (GtkWidget *option_menu)
GtkWidget *menu;
GtkWidget *item;
gint ret;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
-
+
item = gtk_menu_get_active (GTK_MENU (menu));
ret = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "data"));
return ret;
-}
+}
#if 0
static void
@@ -334,7 +334,7 @@ task_dialog_option_menu_set_selected (GtkWidget *option_menu, gint data)
GtkWidget *item;
GList *children, *l;
gint i;
-
+
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
children = GTK_MENU_SHELL (menu)->children;
@@ -346,7 +346,7 @@ task_dialog_option_menu_set_selected (GtkWidget *option_menu, gint data)
break;
}
}
-}
+}
#endif
static void
@@ -368,11 +368,11 @@ task_dialog_setup_task_combo (GtkCombo *combo,
GList *children;
GList *l;
const gchar *name;
-
+
if (tasks == NULL) {
return;
}
-
+
strings = NULL;
for (l = tasks; l; l = l->next) {
name = mrp_task_get_name (l->data);
@@ -387,15 +387,15 @@ task_dialog_setup_task_combo (GtkCombo *combo,
strings = g_list_reverse (strings);
gtk_combo_set_popdown_strings (combo, strings);
g_list_free (strings);
-
+
g_object_set_data (G_OBJECT (combo), "selected_task", tasks->data);
-
+
children = GTK_LIST (combo->list)->children;
for (l = children; l; l = l->next) {
g_object_set_data (G_OBJECT (l->data), "task", tasks->data);
tasks = tasks->next;
}
-
+
g_signal_connect (combo->list,
"select-child",
G_CALLBACK (task_dialog_task_combo_select_child_cb),
@@ -531,9 +531,9 @@ task_cmd_edit_type (PlannerWindow *main_window,
task_cmd_edit_type_undo,
task_cmd_edit_type_free);
-
+
cmd = (TaskCmdEditType *) cmd_base;
-
+
cmd->task = g_object_ref (task);
cmd->old_type = old_type;
@@ -658,7 +658,7 @@ task_cmd_edit_constraint (PlannerWindow *main_window,
old_constraint->time == constraint->time) {
return NULL;
}
-
+
cmd_base = planner_cmd_new (TaskCmdEditConstraint,
_("Edit task scheduling"),
task_cmd_edit_constraint_do,
@@ -673,7 +673,7 @@ task_cmd_edit_constraint (PlannerWindow *main_window,
cmd->constraint = *constraint;
g_free (old_constraint);
-
+
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (main_window),
cmd_base);
@@ -744,13 +744,13 @@ task_cmd_assign_add (PlannerWindow *main_window,
task_cmd_assign_add_do,
task_cmd_assign_add_undo,
task_cmd_assign_add_free);
-
+
cmd = (TaskCmdEditAssignment *) cmd_base;
cmd->task = g_object_ref (task);
cmd->resource = g_object_ref (resource);
cmd->old_units = old_units;
cmd->units = units;
-
+
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (main_window),
cmd_base);
@@ -804,12 +804,12 @@ task_cmd_assign_remove (PlannerWindow *main_window,
task_cmd_assign_remove_do,
task_cmd_assign_remove_undo,
task_cmd_assign_remove_free);
-
+
cmd = (TaskCmdEditAssignment *) cmd_base;
cmd->task = g_object_ref (mrp_assignment_get_task (assignment));
cmd->resource = g_object_ref (mrp_assignment_get_resource (assignment));
cmd->units = mrp_assignment_get_units (assignment);
-
+
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (main_window),
cmd_base);
@@ -836,7 +836,7 @@ task_cmd_assign_units_undo (PlannerCmd *cmd_base)
cmd = (TaskCmdEditAssignment *) cmd_base;
g_object_set (cmd->assignment, "units", cmd->old_units, NULL);
-
+
}
static void
@@ -863,14 +863,14 @@ task_cmd_assign_units (PlannerWindow *main_window,
task_cmd_assign_units_do,
task_cmd_assign_units_undo,
task_cmd_assign_units_free);
-
+
cmd = (TaskCmdEditAssignment *) cmd_base;
cmd->task = g_object_ref (mrp_assignment_get_task (assignment));
cmd->resource = g_object_ref (mrp_assignment_get_resource (assignment));
cmd->assignment = assignment;
cmd->units = units;
cmd->old_units = mrp_assignment_get_units (assignment);
-
+
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (main_window),
cmd_base);
@@ -883,7 +883,7 @@ task_cmd_edit_pred_do (PlannerCmd *cmd_base)
GError *error = NULL;
gboolean retval;
TaskCmdEditPredecessor *cmd = (TaskCmdEditPredecessor*) cmd_base;
-
+
mrp_task_remove_predecessor (cmd->task, cmd->old_predecessor);
mrp_task_add_predecessor (cmd->task,
@@ -896,8 +896,8 @@ task_cmd_edit_pred_do (PlannerCmd *cmd_base)
retval = TRUE;
} else {
cmd->error = error;
- retval = FALSE;
- }
+ retval = FALSE;
+ }
return retval;
}
@@ -907,7 +907,7 @@ task_cmd_edit_pred_undo (PlannerCmd *cmd_base)
{
GError *error = NULL;
TaskCmdEditPredecessor *cmd = (TaskCmdEditPredecessor*) cmd_base;
-
+
mrp_task_remove_predecessor (cmd->task, cmd->predecessor);
mrp_task_add_predecessor (cmd->task,
@@ -953,7 +953,7 @@ planner_task_cmd_edit_predecessor (PlannerWindow *main_window,
task_cmd_edit_pred_free);
cmd = (TaskCmdEditPredecessor *) cmd_base;
-
+
cmd->old_predecessor = g_object_ref (old_predecessor);
cmd->predecessor = g_object_ref (predecessor);
cmd->task = g_object_ref (task);
@@ -964,7 +964,7 @@ planner_task_cmd_edit_predecessor (PlannerWindow *main_window,
cmd->rel_type = relationship;
cmd->old_lag = mrp_relation_get_lag (relation);
cmd->lag = lag;
-
+
planner_cmd_manager_insert_and_do (
planner_window_get_cmd_manager (main_window), cmd_base);
@@ -1023,9 +1023,9 @@ task_cmd_edit_lag (PlannerWindow *main_window,
task_cmd_edit_lag_undo,
task_cmd_edit_lag_free);
-
+
cmd = (TaskCmdEditLag *) cmd_base;
-
+
cmd->relation = g_object_ref (relation);
cmd->old_lag = old_lag;
@@ -1050,7 +1050,7 @@ task_cmd_edit_note_do (PlannerCmd *cmd_base)
static void
task_cmd_edit_note_undo (PlannerCmd *cmd_base)
{
-
+
TaskCmdEditNote *cmd = (TaskCmdEditNote*) cmd_base;
g_object_set (cmd->task, "note", cmd->old_note, NULL);
@@ -1121,15 +1121,15 @@ task_dialog_task_name_changed_cb (MrpTask *task, GParamSpec *pspec, GtkWidget *d
{
DialogData *data;
gchar *name;
-
+
data = DIALOG_GET_DATA (dialog);
-
+
g_object_get (task, "name", &name, NULL);
g_signal_handlers_block_by_func (data->name_entry,
task_dialog_name_changed_cb,
dialog);
-
+
gtk_entry_set_text (GTK_ENTRY (data->name_entry), name);
task_dialog_update_title (data);
@@ -1137,7 +1137,7 @@ task_dialog_task_name_changed_cb (MrpTask *task, GParamSpec *pspec, GtkWidget *d
g_signal_handlers_unblock_by_func (data->name_entry,
task_dialog_name_changed_cb,
dialog);
-
+
g_free (name);
}
@@ -1145,18 +1145,18 @@ static void
task_dialog_name_changed_cb (GtkWidget *w, DialogData *data)
{
const gchar *name;
-
+
name = gtk_entry_get_text (GTK_ENTRY (w));
- g_signal_handlers_block_by_func (data->task,
+ g_signal_handlers_block_by_func (data->task,
task_dialog_task_name_changed_cb,
data->dialog);
-
+
g_object_set (data->task, "name", name, NULL);
task_dialog_update_title (data);
- g_signal_handlers_unblock_by_func (data->task,
+ g_signal_handlers_unblock_by_func (data->task,
task_dialog_task_name_changed_cb,
data->dialog);
}
@@ -1173,11 +1173,11 @@ task_dialog_name_focus_out_cb (GtkWidget *w,
g_assert (MRP_IS_TASK (data->task));
focus_in_name = g_object_get_data (G_OBJECT (data->task),"focus_in_name");
-
+
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, focus_in_name);
- cmd = task_cmd_edit_property_focus (data->main_window,
+ cmd = task_cmd_edit_property_focus (data->main_window,
data->task, "name", &value);
g_free (focus_in_name);
@@ -1191,10 +1191,10 @@ task_dialog_name_focus_in_cb (GtkWidget *w,
DialogData *data)
{
gchar *name;
-
+
name = g_strdup (gtk_entry_get_text (GTK_ENTRY (w)));
-
- g_object_set_data (G_OBJECT (data->task),
+
+ g_object_set_data (G_OBJECT (data->task),
"focus_in_name", (gpointer) name);
return FALSE;
@@ -1205,7 +1205,7 @@ task_dialog_task_type_changed_cb (MrpTask *task, GParamSpec *pspec, GtkWidget *d
{
DialogData *data;
MrpTaskType type;
-
+
data = DIALOG_GET_DATA (dialog);
g_object_get (task, "type", &type, NULL);
@@ -1213,9 +1213,9 @@ task_dialog_task_type_changed_cb (MrpTask *task, GParamSpec *pspec, GtkWidget *d
g_signal_handlers_block_by_func (data->milestone_checkbutton,
task_dialog_type_toggled_cb,
dialog);
-
+
if (type == MRP_TASK_TYPE_MILESTONE) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->milestone_checkbutton), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->milestone_checkbutton), TRUE);
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->milestone_checkbutton), FALSE);
}
@@ -1238,14 +1238,14 @@ task_dialog_type_toggled_cb (GtkWidget *w, DialogData *data)
type = MRP_TASK_TYPE_NORMAL;
}
- g_signal_handlers_block_by_func (data->task,
+ g_signal_handlers_block_by_func (data->task,
task_dialog_task_type_changed_cb,
data->dialog);
-
+
/* g_object_set (data->task, "type", type, NULL); */
task_cmd_edit_type (data->main_window, data->task, type);
- g_signal_handlers_unblock_by_func (data->task,
+ g_signal_handlers_unblock_by_func (data->task,
task_dialog_task_type_changed_cb,
data->dialog);
@@ -1257,7 +1257,7 @@ task_dialog_task_sched_changed_cb (MrpTask *task, GParamSpec *pspec, GtkWidget *
{
DialogData *data;
MrpTaskSched sched;
-
+
data = DIALOG_GET_DATA (dialog);
g_object_get (task, "sched", &sched, NULL);
@@ -1269,9 +1269,9 @@ task_dialog_task_sched_changed_cb (MrpTask *task, GParamSpec *pspec, GtkWidget *
if (sched == MRP_TASK_SCHED_FIXED_DURATION) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->fixed_checkbutton), TRUE);
} else {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->fixed_checkbutton), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->fixed_checkbutton), FALSE);
}
-
+
/* Set the toggle */
g_signal_handlers_unblock_by_func (data->fixed_checkbutton,
@@ -1292,14 +1292,14 @@ task_dialog_fixed_toggled_cb (GtkWidget *w, DialogData *data)
sched = MRP_TASK_SCHED_FIXED_WORK;
}
- g_signal_handlers_block_by_func (data->task,
+ g_signal_handlers_block_by_func (data->task,
task_dialog_task_sched_changed_cb,
data->dialog);
/* g_object_set (data->task, "sched", sched, NULL); */
task_cmd_edit_sched (data->main_window, data->task, sched);
- g_signal_handlers_unblock_by_func (data->task,
+ g_signal_handlers_unblock_by_func (data->task,
task_dialog_task_sched_changed_cb,
data->dialog);
@@ -1307,7 +1307,7 @@ task_dialog_fixed_toggled_cb (GtkWidget *w, DialogData *data)
}
static void
-task_dialog_task_work_changed_cb (MrpTask *task,
+task_dialog_task_work_changed_cb (MrpTask *task,
GParamSpec *pspec,
GtkWidget *dialog)
{
@@ -1340,13 +1340,13 @@ task_dialog_work_focus_out_cb (GtkWidget *w,
PlannerCmd *cmd;
g_object_get (data->task, "project", &project, NULL);
-
+
focus_in_work = GPOINTER_TO_INT (
g_object_get_data (G_OBJECT (data->task), "focus_in_work"));
current_work = planner_parse_duration (
project, gtk_entry_get_text (GTK_ENTRY (w)));
-
+
if (focus_in_work == current_work) {
return FALSE;
}
@@ -1355,8 +1355,8 @@ task_dialog_work_focus_out_cb (GtkWidget *w,
g_value_init (&value, G_TYPE_INT);
g_value_set_int (&value, focus_in_work);
-
- cmd = task_cmd_edit_property_focus (data->main_window,
+
+ cmd = task_cmd_edit_property_focus (data->main_window,
data->task, "work",
&value);
@@ -1371,22 +1371,22 @@ task_dialog_work_focus_in_cb (GtkWidget *w,
MrpProject *project;
const gchar *str;
gint work;
-
+
str = gtk_entry_get_text (GTK_ENTRY (w));
g_object_get (data->task, "project", &project, NULL);
-
+
work = planner_parse_duration (project, str);
-
- g_object_set_data (G_OBJECT (data->task),
+
+ g_object_set_data (G_OBJECT (data->task),
"focus_in_work",
GINT_TO_POINTER (work));
-
+
return FALSE;
}
static void
-task_dialog_task_duration_changed_cb (MrpTask *task,
+task_dialog_task_duration_changed_cb (MrpTask *task,
GParamSpec *pspec,
GtkWidget *dialog)
{
@@ -1419,13 +1419,13 @@ task_dialog_duration_focus_out_cb (GtkWidget *w,
PlannerCmd *cmd;
g_object_get (data->task, "project", &project, NULL);
-
+
focus_in_duration = GPOINTER_TO_INT (
g_object_get_data (G_OBJECT (data->task), "focus_in_duration"));
current_duration = planner_parse_duration (
project, gtk_entry_get_text (GTK_ENTRY (w)));
-
+
if (focus_in_duration == current_duration) {
return FALSE;
}
@@ -1434,8 +1434,8 @@ task_dialog_duration_focus_out_cb (GtkWidget *w,
g_value_init (&value, G_TYPE_INT);
g_value_set_int (&value, focus_in_duration);
-
- cmd = task_cmd_edit_property_focus (data->main_window,
+
+ cmd = task_cmd_edit_property_focus (data->main_window,
data->task, "duration",
&value);
@@ -1449,18 +1449,18 @@ task_dialog_duration_focus_in_cb (GtkWidget *w,
{
const gchar *str;
gint duration;
- MrpProject *project;
+ MrpProject *project;
str = gtk_entry_get_text (GTK_ENTRY (w));
g_object_get (data->task, "project", &project, NULL);
-
+
duration = planner_parse_duration (project, str);
-
- g_object_set_data (G_OBJECT (data->task),
+
+ g_object_set_data (G_OBJECT (data->task),
"focus_in_duration",
GINT_TO_POINTER (duration));
-
+
return FALSE;
}
@@ -1474,7 +1474,7 @@ task_dialog_task_constraint_changed_cb (MrpTask *task,
data = DIALOG_GET_DATA (dialog);
task_dialog_update_schedule_label (data);
-}
+}
static void
task_dialog_update_schedule_label (DialogData *data)
@@ -1504,32 +1504,32 @@ task_dialog_update_schedule_label (DialogData *data)
}
gtk_label_set_text (GTK_LABEL (data->schedule_label), str);
-
+
g_free (str);
g_free (time_str);
g_free (constraint);
-}
+}
static void
-task_dialog_task_complete_changed_cb (MrpTask *task,
+task_dialog_task_complete_changed_cb (MrpTask *task,
GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
gshort complete;
-
+
data = DIALOG_GET_DATA (dialog);
-
+
complete = mrp_task_get_percent_complete (task);
-
+
g_signal_handlers_block_by_func (data->complete_spinbutton,
task_dialog_complete_changed_cb,
data);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->complete_spinbutton),
complete);
-
+
g_signal_handlers_unblock_by_func (data->complete_spinbutton,
task_dialog_complete_changed_cb,
data);
@@ -1542,14 +1542,14 @@ task_dialog_complete_changed_cb (GtkWidget *w,
gint complete;
complete = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (w));
-
+
g_signal_handlers_block_by_func (data->task,
task_dialog_task_complete_changed_cb,
data->dialog);
-
+
g_object_set (data->task, "percent_complete", complete, NULL);
- g_signal_handlers_unblock_by_func (data->task,
+ g_signal_handlers_unblock_by_func (data->task,
task_dialog_task_complete_changed_cb,
data->dialog);
}
@@ -1566,7 +1566,7 @@ task_dialog_complete_focus_out_cb (GtkWidget *w,
g_assert (MRP_IS_TASK (data->task));
- focus_in_complete = GPOINTER_TO_INT (g_object_get_data
+ focus_in_complete = GPOINTER_TO_INT (g_object_get_data
(G_OBJECT (data->task), "focus_in_complete"));
gtk_spin_button_update (GTK_SPIN_BUTTON (w));
@@ -1581,7 +1581,7 @@ task_dialog_complete_focus_out_cb (GtkWidget *w,
g_value_init (&value, G_TYPE_UINT);
g_value_set_uint (&value, focus_in_complete);
- cmd = task_cmd_edit_property_focus (data->main_window,
+ cmd = task_cmd_edit_property_focus (data->main_window,
data->task, "percent_complete", &value);
return FALSE;
@@ -1595,32 +1595,32 @@ task_dialog_complete_focus_in_cb (GtkWidget *w,
guint complete;
complete = gtk_spin_button_get_value (GTK_SPIN_BUTTON (w));
-
- g_object_set_data (G_OBJECT (data->task),
+
+ g_object_set_data (G_OBJECT (data->task),
"focus_in_complete", GINT_TO_POINTER (complete));
return FALSE;
}
static void
-task_dialog_task_priority_changed_cb (MrpTask *task,
+task_dialog_task_priority_changed_cb (MrpTask *task,
GParamSpec *pspec,
GtkWidget *dialog)
{
DialogData *data;
gint priority;
-
+
data = DIALOG_GET_DATA (dialog);
-
+
g_object_get (task, "priority", &priority, NULL);
-
+
g_signal_handlers_block_by_func (data->priority_spinbutton,
task_dialog_priority_changed_cb,
data);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->priority_spinbutton),
priority);
-
+
g_signal_handlers_unblock_by_func (data->priority_spinbutton,
task_dialog_priority_changed_cb,
data);
@@ -1633,14 +1633,14 @@ task_dialog_priority_changed_cb (GtkWidget *w,
gint priority;
priority = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (w));
-
+
g_signal_handlers_block_by_func (data->task,
task_dialog_task_priority_changed_cb,
data->dialog);
-
+
g_object_set (data->task, "priority", priority, NULL);
- g_signal_handlers_unblock_by_func (data->task,
+ g_signal_handlers_unblock_by_func (data->task,
task_dialog_task_priority_changed_cb,
data->dialog);
}
@@ -1657,7 +1657,7 @@ task_dialog_priority_focus_out_cb (GtkWidget *w,
g_assert (MRP_IS_TASK (data->task));
- focus_in_priority = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (data->task),
+ focus_in_priority = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (data->task),
"focus_in_priority"));
gtk_spin_button_update (GTK_SPIN_BUTTON (w));
@@ -1672,7 +1672,7 @@ task_dialog_priority_focus_out_cb (GtkWidget *w,
g_value_init (&value, G_TYPE_INT);
g_value_set_int (&value, focus_in_priority);
- cmd = task_cmd_edit_property_focus (data->main_window,
+ cmd = task_cmd_edit_property_focus (data->main_window,
data->task, "priority", &value);
return FALSE;
@@ -1686,8 +1686,8 @@ task_dialog_priority_focus_in_cb (GtkWidget *w,
gint priority;
priority = gtk_spin_button_get_value (GTK_SPIN_BUTTON (w));
-
- g_object_set_data (G_OBJECT (data->task),
+
+ g_object_set_data (G_OBJECT (data->task),
"focus_in_priority", GINT_TO_POINTER (priority));
return FALSE;
@@ -1700,36 +1700,36 @@ task_dialog_task_note_changed_cb (MrpTask *task,
{
DialogData *data;
gchar *note;
-
+
data = DIALOG_GET_DATA (dialog);
-
+
g_object_get (task, "note", ¬e, NULL);
g_signal_handlers_block_by_func (data->note_buffer,
task_dialog_note_changed_cb,
data);
-
+
gtk_text_buffer_set_text (data->note_buffer, note, -1);
g_signal_handlers_unblock_by_func (data->note_buffer,
task_dialog_note_changed_cb,
data);
-
+
g_free (note);
}
-static void
+static void
task_dialog_note_changed_cb (GtkWidget *w,
DialogData *data)
{
const gchar *note;
GtkTextIter start, end;
GtkTextBuffer *buffer;
-
+
buffer = GTK_TEXT_BUFFER (w);
-
+
gtk_text_buffer_get_bounds (buffer, &start, &end);
-
+
note = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
g_signal_handlers_block_by_func (data->task,
@@ -1754,7 +1754,7 @@ task_dialog_note_focus_out_cb (GtkWidget *w,
focus_in_note = g_object_get_data (G_OBJECT (data->task),"focus_in_note");
cmd = task_cmd_edit_note (data, focus_in_note);
-
+
if (g_getenv ("PLANNER_DEBUG_UNDO_TASK")) {
gchar *note;
@@ -1781,9 +1781,9 @@ task_dialog_note_focus_in_cb (GtkWidget *w,
g_message ("Note focus in value: %s", note);
}
- gtk_text_buffer_set_text (data->note_buffer, note, -1);
+ gtk_text_buffer_set_text (data->note_buffer, note, -1);
- g_object_set_data (G_OBJECT (data->task),
+ g_object_set_data (G_OBJECT (data->task),
"focus_in_note", (gpointer) note);
return FALSE;
@@ -1799,7 +1799,7 @@ task_dialog_note_stamp_cb (GtkWidget *w,
gchar stamp[128];
gchar *utf8;
GtkTextMark *mark;
-
+
t = time (NULL);
tm = localtime (&t);
@@ -1808,7 +1808,7 @@ task_dialog_note_stamp_cb (GtkWidget *w,
strftime (stamp, sizeof (stamp), _("%a %d %b %Y, %H:%M\n"), tm);
utf8 = g_locale_to_utf8 (stamp, -1, NULL, NULL, NULL);
-
+
gtk_text_buffer_get_end_iter (data->note_buffer, &end);
if (!gtk_text_iter_starts_line (&end)) {
@@ -1837,11 +1837,11 @@ task_dialog_task_child_added_or_removed_cb (MrpTask *task,
DialogData *data;
data = DIALOG_GET_DATA (dialog);
-
+
task_dialog_update_sensitivity (data);
}
-static GtkWidget *
+static GtkWidget *
task_dialog_predecessor_dialog_new (MrpTask *task,
PlannerWindow *main_window)
{
@@ -1854,7 +1854,7 @@ task_dialog_predecessor_dialog_new (MrpTask *task,
GList *relations, *l;
MrpRelationType rel_type;
MrpConstraint constraint;
-
+
/* check for attempt to add relation when Must Start On constraint is present */
constraint = imrp_task_get_constraint (task);
if (constraint.type == MRP_CONSTRAINT_MSO) {
@@ -1863,13 +1863,13 @@ task_dialog_predecessor_dialog_new (MrpTask *task,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"You cannot add a relationship to a task with a Must Start On constraint.");
-
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
return NULL;
}
-
+
/* check for attempt to add relation when SF or FF already present */
relations = mrp_task_get_predecessor_relations (task);
@@ -1882,7 +1882,7 @@ task_dialog_predecessor_dialog_new (MrpTask *task,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"You cannot add a relationship if a Start to Finish or Finish to Finish relationship already exists.");
-
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -1892,22 +1892,22 @@ task_dialog_predecessor_dialog_new (MrpTask *task,
mrp_object_get (task, "project", &project, NULL);
-
+
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");
-
+
g_object_set_data (G_OBJECT (dialog), "task_main", task);
g_object_set_data (G_OBJECT (dialog), "main_window", main_window);
w = glade_xml_get_widget (glade, "predecessor_combo");
g_object_set_data (G_OBJECT (dialog), "predecessor_combo", w);
-
+
tasks = mrp_project_get_all_tasks (project);
tasks = g_list_remove (tasks, task);
task_dialog_setup_task_combo (GTK_COMBO (w), tasks);
-
+
w = glade_xml_get_widget (glade, "type_optionmenu");
g_object_set_data (G_OBJECT (dialog), "type_optionmenu", w);
@@ -1938,8 +1938,8 @@ task_dialog_predecessor_dialog_new (MrpTask *task,
return dialog;
}
-static void
-task_dialog_new_pred_ok_clicked_cb (GtkWidget *button,
+static void
+task_dialog_new_pred_ok_clicked_cb (GtkWidget *button,
GtkWidget *dialog)
{
PlannerWindow *main_window;
@@ -1947,12 +1947,12 @@ task_dialog_new_pred_ok_clicked_cb (GtkWidget *button,
GtkWidget *w;
GError *error = NULL;
MrpTask *task_main;
- MrpTask *new_task_pred;
- MrpProject *project;
+ MrpTask *new_task_pred;
+ MrpProject *project;
gint lag;
- gint pred_type;
+ gint pred_type;
const gchar *str;
-
+
main_window = g_object_get_data (G_OBJECT (dialog), "main_window");
task_main = g_object_get_data (G_OBJECT (dialog), "task_main");
@@ -1975,13 +1975,13 @@ task_dialog_new_pred_ok_clicked_cb (GtkWidget *button,
g_warning (_("Can't add new predecessor. No task selected!"));
return;
}
-
+
cmd = planner_task_cmd_link (main_window, new_task_pred, task_main,
pred_type, lag, &error);
-
+
if (!cmd) {
GtkWidget *err_dialog;
-
+
err_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
@@ -1989,33 +1989,33 @@ task_dialog_new_pred_ok_clicked_cb (GtkWidget *button,
"%s", error->message);
gtk_dialog_run (GTK_DIALOG (err_dialog));
gtk_widget_destroy (err_dialog);
-
+
g_error_free (error);
} else {
- gtk_widget_destroy (dialog);
+ gtk_widget_destroy (dialog);
}
}
-static void
-task_dialog_new_pred_cancel_clicked_cb (GtkWidget *w,
+static void
+task_dialog_new_pred_cancel_clicked_cb (GtkWidget *w,
GtkWidget *dialog)
{
gtk_widget_destroy (dialog);
-}
+}
-static void
+static void
task_dialog_add_predecessor_cb (GtkWidget *widget,
DialogData *data)
{
GtkWidget *dialog;
-
+
dialog = task_dialog_predecessor_dialog_new (data->task, data->main_window);
if (dialog) {
gtk_widget_show (dialog);
}
}
-static void
+static void
task_dialog_remove_predecessor_cb (GtkWidget *widget,
DialogData *data)
{
@@ -2028,21 +2028,21 @@ task_dialog_remove_predecessor_cb (GtkWidget *widget,
tree = GTK_TREE_VIEW (data->predecessor_list);
model = PLANNER_PREDECESSOR_MODEL (gtk_tree_view_get_model (tree));
-
+
selection = gtk_tree_view_get_selection (tree);
if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) {
return;
}
-
+
predecessor = MRP_TASK (planner_list_model_get_object (PLANNER_LIST_MODEL (model), &iter));
relation = mrp_task_get_relation (data->task, predecessor);
planner_task_cmd_unlink (data->main_window, relation);
}
-static void
-task_dialog_resource_units_cell_edited (GtkCellRendererText *cell,
+static void
+task_dialog_resource_units_cell_edited (GtkCellRendererText *cell,
gchar *path_str,
- gchar *new_text,
+ gchar *new_text,
DialogData *data)
{
GtkTreeView *tree;
@@ -2054,7 +2054,7 @@ task_dialog_resource_units_cell_edited (GtkCellRendererText *cell,
int value;
tree = GTK_TREE_VIEW (data->resource_list);
-
+
model = gtk_tree_view_get_model (tree);
path = gtk_tree_path_new_from_string (path_str);
@@ -2062,7 +2062,7 @@ task_dialog_resource_units_cell_edited (GtkCellRendererText *cell,
gtk_tree_path_free (path);
resource = ((GList *)iter.user_data)->data;
-
+
assignment = mrp_task_get_assignment (data->task, resource);
if (assignment) {
value = atoi (new_text);
@@ -2073,10 +2073,10 @@ task_dialog_resource_units_cell_edited (GtkCellRendererText *cell,
}
}
-static void
-task_dialog_pred_cell_edited (GtkCellRendererText *cell,
+static void
+task_dialog_pred_cell_edited (GtkCellRendererText *cell,
gchar *path_str,
- gchar *new_text,
+ gchar *new_text,
DialogData *data)
{
GtkTreeView *tree;
@@ -2093,17 +2093,17 @@ task_dialog_pred_cell_edited (GtkCellRendererText *cell,
MrpRelationType type, new_type;
tree = GTK_TREE_VIEW (data->predecessor_list);
-
+
model = gtk_tree_view_get_model (tree);
path = gtk_tree_path_new_from_string (path_str);
column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
gtk_tree_model_get_iter (model, &iter, path);
-
+
task_pred = MRP_TASK (planner_list_model_get_object (PLANNER_LIST_MODEL (model),
- &iter));
+ &iter));
task_main = data->task;
-
+
project = mrp_object_get_project (MRP_OBJECT (task_main));
relation = mrp_task_get_relation (task_main, task_pred);
@@ -2123,30 +2123,30 @@ task_dialog_pred_cell_edited (GtkCellRendererText *cell,
new_type = cell_index_to_relation_type (planner_cell->selected_index);
- cmd = planner_task_cmd_edit_predecessor (data->main_window,
+ cmd = planner_task_cmd_edit_predecessor (data->main_window,
task_main, task_pred,
task_pred,
new_type,
lag, &error);
-
+
if (!cmd) {
GtkWidget *dialog;
-
+
dialog = gtk_message_dialog_new (
NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
"%s", error->message);
-
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
-
+
g_error_free (error);
-
+
/* Restore the previous state. */
mrp_task_add_predecessor (task_main,
- task_pred,
+ task_pred,
type,
lag,
NULL);
@@ -2184,14 +2184,14 @@ cell_index_to_relation_type (gint i)
}
}
-static void
+static void
task_dialog_cell_type_show_popup (PlannerCellRendererList *cell,
const gchar *path_string,
gint x1,
gint y1,
gint x2,
gint y2,
- DialogData *data)
+ DialogData *data)
{
GtkTreeView *tree;
GtkTreeModel *model;
@@ -2205,10 +2205,10 @@ task_dialog_cell_type_show_popup (PlannerCellRendererList *cell,
tree = GTK_TREE_VIEW (data->predecessor_list);
model = gtk_tree_view_get_model (tree);
list_model = PLANNER_LIST_MODEL (model);
-
+
path = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (model, &iter, path);
-
+
predecessor = MRP_TASK (planner_list_model_get_object (list_model, &iter));
relation = mrp_task_get_relation (data->task, predecessor);
@@ -2218,7 +2218,7 @@ task_dialog_cell_type_show_popup (PlannerCellRendererList *cell,
list = g_list_append (list, g_strdup (_("FF")));
list = g_list_append (list, g_strdup (_("SS")));
list = g_list_append (list, g_strdup (_("SF")));
-
+
cell->list = list;
switch (mrp_relation_get_relation_type (relation)) {
@@ -2237,7 +2237,7 @@ task_dialog_cell_type_show_popup (PlannerCellRendererList *cell,
default:
cell->selected_index = 0;
break;
- }
+ }
}
static void
@@ -2280,7 +2280,7 @@ task_dialog_schedule_popup_cb (PlannerPopupButton *popup_button,
widget = planner_task_date_widget_new ();
g_object_get (data->task, "constraint", &constraint, NULL);
-
+
planner_task_date_widget_set_constraint_type (PLANNER_TASK_DATE_WIDGET (widget),
constraint->type);
@@ -2290,7 +2290,7 @@ task_dialog_schedule_popup_cb (PlannerPopupButton *popup_button,
}
g_free (constraint);
-
+
g_signal_connect (widget,
"date_selected",
G_CALLBACK (task_dialog_schedule_date_selected_cb),
@@ -2299,9 +2299,9 @@ task_dialog_schedule_popup_cb (PlannerPopupButton *popup_button,
"cancelled",
G_CALLBACK (task_dialog_schedule_cancelled_cb),
popup_button);
-
+
return widget;
-}
+}
static void
task_dialog_schedule_popdown_cb (PlannerPopupButton *popup_button,
@@ -2313,22 +2313,22 @@ task_dialog_schedule_popdown_cb (PlannerPopupButton *popup_button,
GList *relations, *l;
GtkWidget *dialog;
MrpRelationType rel_type;
-
+
if (ok) {
constraint.time = planner_task_date_widget_get_date (PLANNER_TASK_DATE_WIDGET (widget));
constraint.type = planner_task_date_widget_get_constraint_type (PLANNER_TASK_DATE_WIDGET (widget));
-
+
relations = mrp_task_get_predecessor_relations (data->task);
/* check for attempt to add MSO constraint when relations are present */
if (constraint.type == MRP_CONSTRAINT_MSO && relations) {
-
+
dialog = gtk_message_dialog_new (GTK_WINDOW (data->main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"You cannot add a Must Start On constraint with predecessor relations defined for this task.");
-
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gtk_widget_destroy (widget);
@@ -2347,7 +2347,7 @@ task_dialog_schedule_popdown_cb (PlannerPopupButton *popup_button,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"You cannot add a Start No Earlier Than constraint because a Start to Finish or Finish to Finish predecessor relationship exists for this task.");
-
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gtk_widget_destroy (widget);
@@ -2361,7 +2361,7 @@ task_dialog_schedule_popdown_cb (PlannerPopupButton *popup_button,
data->task,
&constraint);
}
-
+
gtk_widget_destroy (widget);
}
@@ -2373,7 +2373,7 @@ task_dialog_setup_widgets (DialogData *data,
gchar *name;
MrpTaskType type;
MrpTaskSched sched;
- gchar *note;
+ gchar *note;
gint int_value;
gchar *str;
GtkWidget *hbox;
@@ -2440,7 +2440,7 @@ task_dialog_setup_widgets (DialogData *data,
"focus_out_event",
G_CALLBACK (task_dialog_work_focus_out_cb),
data);
-
+
data->duration_entry = glade_xml_get_widget (glade, "duration_entry");
g_object_get (data->task, "duration", &int_value, NULL);
str = planner_format_duration (mrp_object_get_project (MRP_OBJECT (data->task)), int_value);
@@ -2489,14 +2489,14 @@ task_dialog_setup_widgets (DialogData *data,
"focus_out_event",
G_CALLBACK (task_dialog_complete_focus_out_cb),
data);
-
+
data->priority_spinbutton = glade_xml_get_widget (glade, "priority_spinbutton");
- g_object_get (data->task, "priority", &int_value, NULL);
+ g_object_get (data->task, "priority", &int_value, NULL);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->priority_spinbutton), int_value);
g_signal_connect (data->priority_spinbutton,
"value_changed",
G_CALLBACK (task_dialog_priority_changed_cb),
- data);
+ data);
g_signal_connect (data->priority_spinbutton,
"focus_in_event",
G_CALLBACK (task_dialog_priority_focus_in_cb),
@@ -2508,7 +2508,7 @@ task_dialog_setup_widgets (DialogData *data,
data->note_textview = glade_xml_get_widget (glade, "note_textview");
- data->note_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (data->note_textview));
+ data->note_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (data->note_textview));
g_object_get (data->task, "note", ¬e, NULL);
if (note) {
@@ -2550,13 +2550,13 @@ task_dialog_assignment_toggled_cb (GtkCellRendererText *cell,
gboolean active;
tree = GTK_TREE_VIEW (data->resource_list);
-
+
g_object_get (cell, "active", &active, NULL);
model = gtk_tree_view_get_model (tree);
path = gtk_tree_path_new_from_string (path_str);
-
+
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_path_free (path);
@@ -2567,12 +2567,12 @@ task_dialog_assignment_toggled_cb (GtkCellRendererText *cell,
task_cmd_assign_add (data->main_window, data->task, resource, 100);
} else {
MrpAssignment *assignment;
-
+
assignment = mrp_task_get_assignment (data->task, resource);
if (assignment) {
task_cmd_assign_remove (data->main_window, assignment);
- }
+ }
}
}
@@ -2607,11 +2607,11 @@ task_dialog_setup_resource_list (DialogData *data)
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (tree),
GTK_SELECTION_SINGLE);
-
+
/* Name */
cell = gtk_cell_renderer_text_new ();
g_object_set (cell, "editable", FALSE, NULL);
-
+
col = gtk_tree_view_column_new_with_attributes (
_("Name"),
cell,
@@ -2621,7 +2621,7 @@ task_dialog_setup_resource_list (DialogData *data)
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_column_set_min_width (col, 200);
gtk_tree_view_append_column (tree, col);
-
+
/* Assigned. */
cell = gtk_cell_renderer_toggle_new ();
g_object_set (cell,
@@ -2632,24 +2632,24 @@ task_dialog_setup_resource_list (DialogData *data)
"toggled",
G_CALLBACK (task_dialog_assignment_toggled_cb),
data);
-
+
col = gtk_tree_view_column_new_with_attributes (
_("Assigned"),
cell,
"active", RESOURCE_ASSIGNMENT_COL_ASSIGNED,
NULL);
-
+
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_append_column (tree, col);
/* Assigned units */
cell = gtk_cell_renderer_text_new ();
-
+
g_signal_connect (cell,
"edited",
G_CALLBACK (task_dialog_resource_units_cell_edited),
data);
-
+
col = gtk_tree_view_column_new_with_attributes (
_("Units"),
cell,
@@ -2662,7 +2662,7 @@ task_dialog_setup_resource_list (DialogData *data)
gtk_tree_view_append_column (tree, col);
model = GTK_TREE_MODEL (planner_assignment_model_new (data->task));
-
+
gtk_tree_view_set_model (tree, model);
}
@@ -2677,7 +2677,7 @@ task_dialog_setup_predecessor_list (DialogData *data)
tree = GTK_TREE_VIEW (data->predecessor_list);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (tree),
GTK_SELECTION_SINGLE);
-
+
/* Name */
cell = planner_cell_renderer_list_new ();
@@ -2694,7 +2694,7 @@ task_dialog_setup_predecessor_list (DialogData *data)
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_column_set_min_width (col, 200);
gtk_tree_view_append_column (tree, col);
-
+
/* Type */
cell = planner_cell_renderer_list_new ();
@@ -2703,7 +2703,7 @@ task_dialog_setup_predecessor_list (DialogData *data)
g_object_set_data (G_OBJECT (cell),
"column",
GINT_TO_POINTER (PREDECESSOR_COL_TYPE));
-
+
g_signal_connect (cell,
"edited",
G_CALLBACK (task_dialog_pred_cell_edited),
@@ -2712,20 +2712,20 @@ task_dialog_setup_predecessor_list (DialogData *data)
g_signal_connect (cell,
"show_popup",
G_CALLBACK (task_dialog_cell_type_show_popup),
- data);
+ data);
g_signal_connect_after (cell,
"hide_popup",
G_CALLBACK (task_dialog_cell_type_hide_popup),
data);
-
+
col = gtk_tree_view_column_new_with_attributes (_("Type"),
cell,
"text", PREDECESSOR_COL_TYPE,
NULL);
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_append_column (tree, col);
-
+
/* Lag */
cell = gtk_cell_renderer_text_new ();
@@ -2739,25 +2739,25 @@ task_dialog_setup_predecessor_list (DialogData *data)
"edited",
G_CALLBACK (task_dialog_pred_cell_edited),
data);
-
+
col = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (col, _("Lag"));
gtk_tree_view_column_pack_start (col,
cell,
TRUE);
-
+
gtk_tree_view_column_set_cell_data_func (col,
cell,
(GtkTreeCellDataFunc) task_dialog_lag_data_func,
data,
NULL);
-
+
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_append_column (tree, col);
-
+
model = planner_predecessor_model_new (data->task);
-
+
gtk_tree_view_set_model (tree, model);
}
@@ -2781,7 +2781,7 @@ task_dialog_connect_to_task (DialogData *data)
G_CALLBACK (task_dialog_task_sched_changed_cb),
data->dialog,
0);
-
+
g_signal_connect_object (data->task,
"notify::note",
G_CALLBACK (task_dialog_task_note_changed_cb),
@@ -2817,7 +2817,7 @@ task_dialog_connect_to_task (DialogData *data)
G_CALLBACK (task_dialog_task_constraint_changed_cb),
data->dialog,
0);
-
+
g_signal_connect_object (data->task,
"child_added",
G_CALLBACK (task_dialog_task_child_added_or_removed_cb),
@@ -2859,7 +2859,7 @@ task_dialog_update_sensitivity (DialogData *data)
gboolean leaf, milestone, fixed;
leaf = (mrp_task_get_n_children (data->task) == 0);
-
+
type = mrp_task_get_task_type (data->task);
milestone = (type == MRP_TASK_TYPE_MILESTONE);
@@ -2870,7 +2870,7 @@ task_dialog_update_sensitivity (DialogData *data)
gtk_widget_set_sensitive (data->schedule_button, leaf);
gtk_widget_set_sensitive (data->fixed_checkbutton, leaf && !milestone);
-
+
gtk_widget_set_sensitive (data->duration_entry, leaf && !milestone && fixed);
gtk_widget_set_sensitive (data->work_entry, leaf && !milestone);
}
@@ -2890,7 +2890,7 @@ task_dialog_update_title (DialogData *data)
}
gtk_window_set_title (GTK_WINDOW (data->dialog), title);
g_free (title);
-}
+}
static void
task_dialog_parent_destroy_cb (GtkWidget *parent,
@@ -2919,7 +2919,7 @@ planner_task_dialog_new (PlannerWindow *window,
MrpProject *project;
MrpCalendar *calendar;
gchar *filename;
-
+
g_return_val_if_fail (MRP_IS_TASK (task), NULL);
if (!dialogs) {
@@ -2942,7 +2942,7 @@ planner_task_dialog_new (PlannerWindow *window,
}
dialog = glade_xml_get_widget (glade, "task_dialog");
-
+
data = g_new0 (DialogData, 1);
data->main_window = window;
@@ -2955,7 +2955,7 @@ planner_task_dialog_new (PlannerWindow *window,
"destroy",
G_CALLBACK (task_dialog_destroy_cb),
data);
-
+
g_signal_connect_object (window,
"destroy",
G_CALLBACK (task_dialog_parent_destroy_cb),
@@ -2971,7 +2971,7 @@ planner_task_dialog_new (PlannerWindow *window,
w = glade_xml_get_widget (glade, "task_notebook");
gtk_notebook_set_current_page (GTK_NOTEBOOK (w), page);
-
+
data->resource_list = glade_xml_get_widget (glade, "resource_list");
task_dialog_setup_resource_list (data);
@@ -2983,7 +2983,7 @@ planner_task_dialog_new (PlannerWindow *window,
"clicked",
G_CALLBACK (task_dialog_add_predecessor_cb),
data);
-
+
w = glade_xml_get_widget (glade, "remove_predecessor_button");
g_signal_connect (w,
"clicked",
@@ -2991,7 +2991,7 @@ planner_task_dialog_new (PlannerWindow *window,
data);
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
-
+
w = glade_xml_get_widget (glade, "name_pad");
gtk_size_group_add_widget (size_group, w);
@@ -3009,15 +3009,15 @@ planner_task_dialog_new (PlannerWindow *window,
g_object_set_data_full (G_OBJECT (dialog),
"data", data,
g_free);
-
+
task_dialog_setup_widgets (data, glade);
task_dialog_update_sensitivity (data);
task_dialog_update_title (data);
-
+
task_dialog_connect_to_task (data);
-
+
g_object_get (task, "project", &project, NULL);
calendar = mrp_project_get_calendar (project);
@@ -3026,6 +3026,6 @@ planner_task_dialog_new (PlannerWindow *window,
G_CALLBACK (task_dialog_calendar_changed_cb),
dialog,
0);
-
+
return dialog;
}
diff --git a/src/planner-task-input-dialog.c b/src/planner-task-input-dialog.c
index 9626878..37c13bd 100644
--- a/src/planner-task-input-dialog.c
+++ b/src/planner-task-input-dialog.c
@@ -57,28 +57,28 @@ task_input_dialog_response_cb (GtkWidget *button,
const gchar *name;
const gchar *workstr;
gint work;
-
+
switch (response) {
case GTK_RESPONSE_OK:
data = g_object_get_data (G_OBJECT (dialog), "data");
-
+
name = gtk_entry_get_text (GTK_ENTRY (data->name_entry));
workstr = gtk_entry_get_text (GTK_ENTRY (data->work_entry));
-
+
work = 60*60*8 * g_strtod (workstr, NULL);
-
+
task = g_object_new (MRP_TYPE_TASK,
"work", work,
"name", name,
NULL);
-
+
/*mrp_project_insert_task (data->project, NULL, -1, task);*/
- planner_task_cmd_insert (data->main_window,
+ planner_task_cmd_insert (data->main_window,
NULL, -1, 0, 0, task);
-
+
gtk_entry_set_text (GTK_ENTRY (data->name_entry), "");
gtk_entry_set_text (GTK_ENTRY (data->work_entry), "");
-
+
gtk_widget_grab_focus (data->name_entry);
break;
@@ -86,7 +86,7 @@ task_input_dialog_response_cb (GtkWidget *button,
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (dialog);
break;
-
+
default:
g_assert_not_reached ();
break;
@@ -114,33 +114,33 @@ planner_task_input_dialog_new (PlannerWindow *main_window)
data->project = g_object_ref (project);
data->main_window = g_object_ref (main_window);
-
+
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");
+
+ dialog = glade_xml_get_widget (gui, "task_input_dialog");
g_signal_connect (dialog,
"response",
G_CALLBACK (task_input_dialog_response_cb),
dialog);
-
+
data->name_entry = glade_xml_get_widget (gui, "name_entry");
g_signal_connect (data->name_entry,
"activate",
G_CALLBACK (task_input_dialog_activate_cb),
dialog);
-
+
data->work_entry = glade_xml_get_widget (gui, "work_entry");
g_signal_connect (data->work_entry,
"activate",
G_CALLBACK (task_input_dialog_activate_cb),
dialog);
-
+
g_object_set_data_full (G_OBJECT (dialog),
"data",
data,
task_input_dialog_free);
-
+
return dialog;
}
diff --git a/src/planner-task-popup.c b/src/planner-task-popup.c
index 7e23c33..4797711 100644
--- a/src/planner-task-popup.c
+++ b/src/planner-task-popup.c
@@ -134,13 +134,13 @@ GtkItemFactory *
planner_task_popup_new (PlannerTaskTree *tree)
{
GtkItemFactory *item_factory;
-
+
item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<main>", NULL);
gtk_item_factory_set_translate_func (item_factory,
task_tree_item_factory_trans,
NULL, NULL);
-
- gtk_item_factory_create_items (item_factory,
+
+ gtk_item_factory_create_items (item_factory,
G_N_ELEMENTS (popup_menu_items),
popup_menu_items, tree);
@@ -164,12 +164,12 @@ planner_task_popup_update_sensitivity (GtkItemFactory *factory,
MrpTask *task;
MrpTaskType type;
gboolean milestone;
-
+
length = g_list_length (tasks);
/* Can always insert task. */
task_popup_set_sensitive (factory, PLANNER_TASK_POPUP_INSERT, TRUE);
-
+
/* Nothing else when nothing is selected. */
if (length == 0) {
task_popup_set_sensitive (factory, PLANNER_TASK_POPUP_SUBTASK, FALSE);
diff --git a/src/planner-task-popup.h b/src/planner-task-popup.h
index f4cf808..eb60a83 100644
--- a/src/planner-task-popup.h
+++ b/src/planner-task-popup.h
@@ -16,7 +16,7 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+
#ifndef __PLANNER_TASK_POPUP_H__
#define __PLANNER_TASK_POPUP_H__
diff --git a/src/planner-task-tree.c b/src/planner-task-tree.c
index f7889c8..3e3c165 100644
--- a/src/planner-task-tree.c
+++ b/src/planner-task-tree.c
@@ -187,10 +187,10 @@ typedef struct {
PlannerTaskTree *tree;
MrpProject *project;
-
+
GtkTreePath *path;
-
- gchar *property;
+
+ gchar *property;
GValue *value;
GValue *old_value;
} TaskCmdEditProperty;
@@ -200,7 +200,7 @@ task_cmd_edit_property_do (PlannerCmd *cmd_base)
{
TaskCmdEditProperty *cmd;
MrpTask *task;
-
+
cmd = (TaskCmdEditProperty*) cmd_base;
task = task_tree_get_task_from_path (cmd->tree, cmd->path);
@@ -217,7 +217,7 @@ task_cmd_edit_property_undo (PlannerCmd *cmd_base)
{
TaskCmdEditProperty *cmd;
MrpTask *task;
-
+
cmd = (TaskCmdEditProperty*) cmd_base;
task = task_tree_get_task_from_path (cmd->tree, cmd->path);
@@ -231,11 +231,11 @@ static void
task_cmd_edit_property_free (PlannerCmd *cmd_base)
{
TaskCmdEditProperty *cmd;
-
+
cmd = (TaskCmdEditProperty*) cmd_base;
g_object_unref (cmd->project);
-
+
g_free (cmd->property);
g_value_unset (cmd->value);
g_value_unset (cmd->old_value);
@@ -270,9 +270,9 @@ task_cmd_edit_property (PlannerWindow *window,
cmd->project = g_object_ref (planner_window_get_project (window));
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (tree)));
-
+
cmd->path = planner_gantt_model_get_path_from_task (model, task);
-
+
cmd->property = g_strdup (property);
cmd->value = g_new0 (GValue, 1);
@@ -288,7 +288,7 @@ task_cmd_edit_property (PlannerWindow *window,
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (window),
cmd_base);
-
+
return cmd_base;
}
@@ -306,10 +306,10 @@ typedef struct {
GList *assignments;
} TaskCmdRemove;
-static gboolean
+static gboolean
is_task_in_project (MrpTask *task, PlannerTaskTree *tree)
{
- PlannerGanttModel *model;
+ PlannerGanttModel *model;
GtkTreePath *path;
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (tree)));
@@ -318,7 +318,7 @@ is_task_in_project (MrpTask *task, PlannerTaskTree *tree)
if (path != NULL) {
gtk_tree_path_free (path);
return TRUE;
- } else {
+ } else {
return FALSE;
}
}
@@ -335,7 +335,7 @@ task_cmd_restore_assignments (TaskCmdRemove *cmd)
{
GList *l;
MrpAssignment *assignment;
- MrpResource *resource;
+ MrpResource *resource;
for (l = cmd->assignments; l; l = l->next) {
assignment = l->data;
@@ -364,7 +364,7 @@ task_cmd_restore_relations (TaskCmdRemove *cmd)
MrpRelation *relation;
MrpTask *rel_task;
GError *error;
-
+
for (l = cmd->predecessors; l; l = l->next) {
relation = l->data;
@@ -374,7 +374,7 @@ task_cmd_restore_relations (TaskCmdRemove *cmd)
continue;
}
- mrp_task_add_predecessor (cmd->task, rel_task,
+ mrp_task_add_predecessor (cmd->task, rel_task,
mrp_relation_get_relation_type (relation),
mrp_relation_get_lag (relation), &error);
}
@@ -384,7 +384,7 @@ task_cmd_restore_relations (TaskCmdRemove *cmd)
rel_task = mrp_relation_get_successor (relation);
if (!is_task_in_project (rel_task, cmd->tree)) {
- continue;
+ continue;
}
mrp_task_add_predecessor (rel_task, cmd->task,
@@ -393,7 +393,7 @@ task_cmd_restore_relations (TaskCmdRemove *cmd)
}
}
-static void
+static void
task_cmd_save_children (TaskCmdRemove *cmd)
{
MrpTask *child;
@@ -404,22 +404,22 @@ task_cmd_save_children (TaskCmdRemove *cmd)
TaskCmdRemove *cmd_child;
GtkTreePath *path;
PlannerGanttModel *model;
-
+
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (cmd->tree)));
-
+
path = planner_gantt_model_get_path_from_task (model, child);
-
+
/* We don't insert this command in the undo manager */
cmd_child = g_new0 (TaskCmdRemove, 1);
cmd_child->tree = cmd->tree;
- cmd_child->project = task_tree_get_project (cmd->tree);
- cmd_child->path = gtk_tree_path_copy (path);
+ cmd_child->project = task_tree_get_project (cmd->tree);
+ cmd_child->path = gtk_tree_path_copy (path);
cmd_child->task = g_object_ref (child);
task_cmd_save_relations (cmd_child);
task_cmd_save_assignments (cmd_child);
-
+
cmd->children = g_list_append (cmd->children, cmd_child);
-
+
task_cmd_save_children (cmd_child);
child = mrp_task_get_next_sibling (child);
@@ -436,31 +436,31 @@ task_cmd_restore_children (TaskCmdRemove *cmd)
GList *l;
for (l = cmd->children; l; l = l->next) {
- TaskCmdRemove *cmd_child;
-
+ TaskCmdRemove *cmd_child;
+
cmd_child = l->data;
path = gtk_tree_path_copy (cmd_child->path);
- model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model
+ model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model
(GTK_TREE_VIEW (cmd_child->tree)));
-
+
depth = gtk_tree_path_get_depth (path);
position = gtk_tree_path_get_indices (path)[depth - 1];
-
+
if (depth > 1) {
gtk_tree_path_up (path);
parent = task_tree_get_task_from_path (cmd_child->tree, path);
} else {
parent = NULL;
}
-
+
gtk_tree_path_free (path);
-
+
mrp_project_insert_task (cmd_child->project,
parent,
position,
cmd_child->task);
-
+
task_cmd_restore_children (cmd_child);
task_cmd_restore_relations (cmd_child);
task_cmd_restore_assignments (cmd_child);
@@ -498,7 +498,7 @@ task_cmd_remove_undo (PlannerCmd *cmd_base)
GtkTreePath *path;
MrpTask *parent;
MrpTask *child_parent;
-
+
cmd = (TaskCmdRemove*) cmd_base;
path = gtk_tree_path_copy (cmd->path);
@@ -513,7 +513,7 @@ task_cmd_remove_undo (PlannerCmd *cmd_base)
} else {
parent = NULL;
}
-
+
gtk_tree_path_free (path);
mrp_project_insert_task (cmd->project,
@@ -555,7 +555,7 @@ task_cmd_remove_free (PlannerCmd *cmd_base)
g_list_foreach (cmd->assignments, (GFunc) g_object_unref, NULL);
g_list_free (cmd->assignments);
-
+
gtk_tree_path_free (cmd->path);
}
@@ -567,13 +567,13 @@ task_cmd_remove (PlannerTaskTree *tree,
PlannerTaskTreePriv *priv = tree->priv;
PlannerCmd *cmd_base;
TaskCmdRemove *cmd;
-
+
cmd_base = planner_cmd_new (TaskCmdRemove,
_("Remove task"),
task_cmd_remove_do,
task_cmd_remove_undo,
task_cmd_remove_free);
-
+
cmd = (TaskCmdRemove *) cmd_base;
cmd->tree = tree;
@@ -618,9 +618,9 @@ task_cmd_constraint_undo (PlannerCmd *cmd_base)
cmd = (TaskCmdConstraint*) cmd_base;
- g_object_set (cmd->task, "constraint",
+ g_object_set (cmd->task, "constraint",
cmd->constraint_old, NULL);
-
+
}
static void
@@ -658,7 +658,7 @@ task_cmd_constraint (PlannerTaskTree *tree,
cmd->constraint->time = constraint.time;
cmd->constraint->type = constraint.type;
- g_object_get (task, "constraint",
+ g_object_get (task, "constraint",
&cmd->constraint_old, NULL);
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (priv->main_window),
@@ -684,9 +684,9 @@ task_cmd_constraint_reset_undo (PlannerCmd *cmd_base)
cmd = (TaskCmdConstraint*) cmd_base;
- g_object_set (cmd->task, "constraint",
+ g_object_set (cmd->task, "constraint",
cmd->constraint_old, NULL);
-
+
}
static void
@@ -717,7 +717,7 @@ task_cmd_reset_constraint (PlannerTaskTree *tree,
cmd->task = g_object_ref (task);
- g_object_get (task, "constraint",
+ g_object_get (task, "constraint",
&cmd->constraint_old, NULL);
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (priv->main_window),
@@ -737,7 +737,7 @@ typedef struct {
MrpTask *sibling_old;
gboolean before;
gboolean before_old;
-
+
MrpTaskType parent_type;
gint parent_work;
gint parent_duration;
@@ -832,7 +832,7 @@ task_cmd_move (PlannerTaskTree *tree,
MrpTask *parent_old;
priv = tree->priv;
-
+
cmd_base = planner_cmd_new (TaskCmdMove,
name,
task_cmd_move_do,
@@ -840,14 +840,14 @@ task_cmd_move (PlannerTaskTree *tree,
task_cmd_move_free);
cmd = (TaskCmdMove *) cmd_base;
-
+
cmd->project = g_object_ref (tree->priv->project);
cmd->task = g_object_ref (task);
if (parent != NULL) {
cmd->parent = g_object_ref (parent);
}
-
+
parent_old = mrp_task_get_parent (task);
if (parent_old != NULL) {
@@ -874,15 +874,15 @@ task_cmd_move (PlannerTaskTree *tree,
} else {
cmd->before_old = TRUE;
}
-
- planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
+
+ planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
(priv->main_window),
cmd_base);
if (cmd->error) {
g_propagate_error (error, cmd->error);
return NULL;
- }
+ }
return cmd_base;
}
@@ -891,7 +891,7 @@ typedef struct {
PlannerCmd base;
MrpTask *task;
- MrpProperty *property;
+ MrpProperty *property;
GValue *value;
GValue *old_value;
} TaskCmdEditCustomProperty;
@@ -953,7 +953,7 @@ task_cmd_edit_custom_property (PlannerTaskTree *tree,
task_cmd_edit_custom_property_do,
task_cmd_edit_custom_property_undo,
task_cmd_edit_custom_property_free);
-
+
cmd = (TaskCmdEditCustomProperty *) cmd_base;
@@ -971,7 +971,7 @@ task_cmd_edit_custom_property (PlannerTaskTree *tree,
cmd->property,
cmd->old_value);
- /* FIXME: if old and new value are the same, do nothing
+ /* FIXME: if old and new value are the same, do nothing
How we can compare values?
*/
@@ -1003,7 +1003,7 @@ planner_task_tree_get_type (void)
type = g_type_register_static (GTK_TYPE_TREE_VIEW, "PlannerTaskTree",
&info, 0);
}
-
+
return type;
}
@@ -1032,16 +1032,16 @@ task_tree_class_init (PlannerTaskTreeClass *klass)
0,
NULL, NULL,
planner_marshal_VOID__OBJECT_OBJECT,
- G_TYPE_NONE,
+ G_TYPE_NONE,
2, MRP_TYPE_TASK, MRP_TYPE_RELATION);
- signals[RELATION_REMOVED] =
+ signals[RELATION_REMOVED] =
g_signal_new ("relation-removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
planner_marshal_VOID__OBJECT_OBJECT,
- G_TYPE_NONE,
+ G_TYPE_NONE,
2, MRP_TYPE_TASK, MRP_TYPE_RELATION);
}
@@ -1049,7 +1049,7 @@ static void
task_tree_init (PlannerTaskTree *tree)
{
PlannerTaskTreePriv *priv;
-
+
priv = g_new0 (PlannerTaskTreePriv, 1);
tree->priv = priv;
@@ -1058,7 +1058,7 @@ task_tree_init (PlannerTaskTree *tree)
priv->anchor = NULL;
gtk_tree_view_set_enable_search (GTK_TREE_VIEW (tree), FALSE);
-
+
g_signal_connect (tree,
"row_activated",
G_CALLBACK (task_tree_row_activated_cb),
@@ -1078,7 +1078,7 @@ task_tree_finalize (GObject *object)
tree = PLANNER_TASK_TREE (object);
priv = tree->priv;
-
+
g_hash_table_destroy (priv->property_to_column);
planner_task_tree_set_anchor (tree, NULL);
@@ -1116,9 +1116,9 @@ static void
task_tree_block_selection_changed (PlannerTaskTree *tree)
{
GtkTreeSelection *selection;
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
-
+
g_signal_handlers_block_by_func (selection,
task_tree_selection_changed_cb,
tree);
@@ -1128,15 +1128,15 @@ static void
task_tree_unblock_selection_changed (PlannerTaskTree *tree)
{
GtkTreeSelection *selection;
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
-
+
g_signal_handlers_unblock_by_func (selection,
task_tree_selection_changed_cb,
tree);
}
-static void
+static void
task_tree_selection_changed_cb (GtkTreeSelection *selection,
PlannerTaskTree *tree)
{
@@ -1147,13 +1147,13 @@ task_tree_selection_changed_cb (GtkTreeSelection *selection,
}
static void
-task_tree_relation_added_cb (MrpTask *task,
- MrpRelation *relation,
+task_tree_relation_added_cb (MrpTask *task,
+ MrpRelation *relation,
PlannerTaskTree *tree)
{
g_return_if_fail (MRP_IS_TASK (task));
g_return_if_fail (MRP_IS_RELATION (relation));
-
+
g_signal_emit (tree, signals[RELATION_ADDED], 0, task, relation);
}
@@ -1164,7 +1164,7 @@ task_tree_relation_removed_cb (MrpTask *task,
{
g_return_if_fail (MRP_IS_TASK (task));
g_return_if_fail (MRP_IS_RELATION (relation));
-
+
g_signal_emit (tree, signals[RELATION_REMOVED], 0, task, relation);
}
@@ -1177,7 +1177,7 @@ task_tree_row_inserted (GtkTreeModel *model,
GtkTreePath *parent;
parent = gtk_tree_path_copy (path);
-
+
gtk_tree_path_up (parent);
gtk_tree_view_expand_row (tree,
@@ -1192,7 +1192,7 @@ task_tree_task_added_cb (PlannerGanttModel *model, MrpTask *task, PlannerTaskTre
{
g_object_ref (task);
- g_signal_connect (task, "relation_added",
+ g_signal_connect (task, "relation_added",
G_CALLBACK (task_tree_relation_added_cb),
tree);
g_signal_connect (task, "relation_removed",
@@ -1227,7 +1227,7 @@ task_tree_tree_view_popup_menu (GtkWidget *widget,
tasks = planner_task_tree_get_selected_tasks (tree);
planner_task_popup_update_sensitivity (tree->priv->popup_factory, tasks);
g_list_free (tasks);
-
+
gtk_tree_view_get_cursor (GTK_TREE_VIEW (tree), &path, &column);
gtk_tree_view_get_cell_area (GTK_TREE_VIEW (tree),
path,
@@ -1250,7 +1250,7 @@ task_tree_tree_view_popup_menu (GtkWidget *widget,
/* Offset so it's not overlapping the cell. */
rect.x = x + 20;
rect.y = y + 20;
-
+
gtk_item_factory_popup (tree->priv->popup_factory,
rect.x, rect.y,
0,
@@ -1267,7 +1267,7 @@ task_tree_tree_view_button_press_event (GtkTreeView *tv,
GtkItemFactory *factory;
GtkTreeIter iter;
GList *tasks;
-
+
priv = tree->priv;
factory = priv->popup_factory;
@@ -1285,9 +1285,9 @@ task_tree_tree_view_button_press_event (GtkTreeView *tv,
tasks = planner_task_tree_get_selected_tasks (tree);
planner_task_popup_update_sensitivity (factory, tasks);
g_list_free (tasks);
-
+
planner_task_tree_set_anchor (tree, path);
-
+
} else {
gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (tv));
@@ -1301,10 +1301,10 @@ task_tree_tree_view_button_press_event (GtkTreeView *tv,
gtk_item_factory_get_widget_by_action (factory, PLANNER_TASK_POPUP_EDIT_RESOURCES), FALSE);
gtk_widget_set_sensitive (
gtk_item_factory_get_widget_by_action (factory, PLANNER_TASK_POPUP_EDIT_TASK), FALSE);
-
+
planner_task_tree_set_anchor (tree, NULL);
}
-
+
gtk_item_factory_popup (factory, event->x_root, event->y_root,
event->button, event->time);
return TRUE;
@@ -1317,7 +1317,7 @@ task_tree_tree_view_button_press_event (GtkTreeView *tv,
}
return FALSE;
}
-
+
return FALSE;
}
@@ -1335,18 +1335,18 @@ task_tree_tree_view_key_release_event (GtkTreeView *tree_view,
GDK_KP_Page_Up | GDK_Pointer_Up | GDK_ISO_Move_Line_Up |
GDK_Down | GDK_Page_Down | GDK_KP_Down | GDK_KP_Page_Down |
GDK_Pointer_Down | GDK_ISO_Move_Line_Down)) {
-
+
GtkTreeSelection *selection = gtk_tree_view_get_selection (tree_view);
GList *list = gtk_tree_selection_get_selected_rows (selection, NULL);
-
+
if (g_list_length (list) == 1) {
planner_task_tree_set_anchor (tree, list->data);
}
-
+
g_list_free (list);
}
}
-
+
return FALSE;
}
@@ -1359,9 +1359,9 @@ task_tree_wbs_data_func (GtkTreeViewColumn *tree_column,
{
PlannerTaskTree *tree;
gchar *str;
-
+
tree = PLANNER_TASK_TREE (data);
-
+
gtk_tree_model_get (tree_model,
iter,
COL_WBS, &str,
@@ -1369,7 +1369,7 @@ task_tree_wbs_data_func (GtkTreeViewColumn *tree_column,
g_object_set (cell,
"text", str,
NULL);
-
+
g_free (str);
}
@@ -1386,7 +1386,7 @@ task_tree_name_data_func (GtkTreeViewColumn *tree_column,
gboolean critical;
tree = PLANNER_TASK_TREE (data);
-
+
gtk_tree_model_get (tree_model,
iter,
COL_TASK, &task,
@@ -1400,7 +1400,7 @@ task_tree_name_data_func (GtkTreeViewColumn *tree_column,
}
g_object_set (cell,
- "text", mrp_task_get_name (task),
+ "text", mrp_task_get_name (task),
"weight", weight,
"foreground", critical ? "indian red" : NULL,
NULL);
@@ -1417,17 +1417,17 @@ task_tree_start_data_func (GtkTreeViewColumn *tree_column,
gint weight;
gboolean editable;
gchar *str;
-
+
gtk_tree_model_get (tree_model,
iter,
COL_START, &start,
COL_WEIGHT, &weight,
- COL_EDITABLE, &editable,
+ COL_EDITABLE, &editable,
-1);
str = planner_format_date (start);
- g_object_set (cell,
+ g_object_set (cell,
"text", str,
"weight", weight,
"editable", editable,
@@ -1453,7 +1453,7 @@ task_tree_finish_data_func (GtkTreeViewColumn *tree_column,
-1);
str = planner_format_date (start);
-
+
g_object_set (cell,
"text", str,
"weight", weight,
@@ -1480,7 +1480,7 @@ task_tree_duration_data_func (GtkTreeViewColumn *tree_column,
task_tree = PLANNER_TASK_TREE (data);
priv = task_tree->priv;
-
+
gtk_tree_model_get (tree_model,
iter,
COL_DURATION, &duration,
@@ -1491,7 +1491,7 @@ task_tree_duration_data_func (GtkTreeViewColumn *tree_column,
type = mrp_task_get_task_type (task);
sched = mrp_task_get_sched (task);
-
+
if (type == MRP_TASK_TYPE_MILESTONE) {
editable = FALSE;
str = g_strdup (_("N/A"));
@@ -1501,8 +1501,8 @@ task_tree_duration_data_func (GtkTreeViewColumn *tree_column,
editable = FALSE;
}
}
-
- g_object_set (cell,
+
+ g_object_set (cell,
"text", str,
"weight", weight,
"editable", editable,
@@ -1578,7 +1578,7 @@ task_tree_assigned_to_data_func (GtkTreeViewColumn *tree_column,
MrpTask *task;
const gchar *name;
- gtk_tree_model_get (tree_model, iter,
+ gtk_tree_model_get (tree_model, iter,
COL_TASK, &task,
-1);
@@ -1648,7 +1648,7 @@ task_tree_work_data_func (GtkTreeViewColumn *tree_column,
type = mrp_task_get_task_type (task);
if (type == MRP_TASK_TYPE_MILESTONE) {
- g_object_set (cell,
+ g_object_set (cell,
"weight", weight,
"editable", FALSE,
"text", _("N/A"),
@@ -1657,8 +1657,8 @@ task_tree_work_data_func (GtkTreeViewColumn *tree_column,
gchar *str;
str = planner_format_duration (tree->priv->project, work);
-
- g_object_set (cell,
+
+ g_object_set (cell,
"weight", weight,
"editable", editable,
"text", str,
@@ -1684,12 +1684,12 @@ task_tree_slack_data_func (GtkTreeViewColumn *tree_column,
COL_SLACK, &slack,
COL_WEIGHT, &weight,
-1);
-
+
str = planner_format_duration (tree->priv->project, slack);
- g_object_set (cell,
+ g_object_set (cell,
"text", str,
- "weight", weight,
+ "weight", weight,
NULL);
g_free (str);
}
@@ -1711,21 +1711,21 @@ task_tree_name_edited (GtkCellRendererText *cell,
task_tree = PLANNER_TASK_TREE (data);
priv = task_tree->priv;
-
+
view = GTK_TREE_VIEW (data);
model = gtk_tree_view_get_model (view);
path = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (model, &iter,
COL_TASK, &task,
-1);
if (strcmp (mrp_task_get_name (task), new_text) != 0) {
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, new_text);
-
+
task_cmd_edit_property (priv->main_window,
task_tree,
task,
@@ -1734,9 +1734,9 @@ task_tree_name_edited (GtkCellRendererText *cell,
g_value_unset (&value);
}
-
+
/*planner_cmd_manager_end_transaction (planner_window_get_cmd_manager (priv->main_window));*/
-
+
gtk_tree_path_free (path);
}
@@ -1756,10 +1756,10 @@ task_tree_complete_edited (GtkCellRendererText *cell,
gint complete;
model = gtk_tree_view_get_model (view);
- path = gtk_tree_path_new_from_string (path_string);
+ path = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (model, &iter,
COL_TASK, &task,
-1);
@@ -1771,7 +1771,7 @@ task_tree_complete_edited (GtkCellRendererText *cell,
if (mrp_task_get_percent_complete (MRP_TASK (task)) != complete) {
g_value_init (&value, G_TYPE_INT);
g_value_set_int (&value, complete);
-
+
task_cmd_edit_property (tree->priv->main_window,
PLANNER_TASK_TREE (view),
task,
@@ -1780,7 +1780,7 @@ task_tree_complete_edited (GtkCellRendererText *cell,
g_value_unset (&value);
}
-
+
gtk_tree_path_free (path);
}
@@ -1806,15 +1806,15 @@ task_tree_start_edited (GtkCellRendererText *cell,
path = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (model, &iter,
COL_TASK, &task,
-1);
constraint.time = date->time;
constraint.type = date->type;
-
+
task_cmd_constraint (tree, task, constraint);
-
+
/* g_object_set (task, "constraint", &constraint, NULL); */
gtk_tree_path_free (path);
@@ -1837,10 +1837,10 @@ task_tree_start_show_popup (PlannerCellRendererDate *cell,
MrpConstraint *constraint;
model = gtk_tree_view_get_model (tree_view);
-
+
path = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (model, &iter,
COL_TASK, &task,
-1);
@@ -1849,7 +1849,7 @@ task_tree_start_show_popup (PlannerCellRendererDate *cell,
NULL);
cell->type = constraint->type;
-
+
if (cell->type == MRP_CONSTRAINT_ASAP) {
start = mrp_task_get_start (task);
cell->time = start;
@@ -1870,7 +1870,7 @@ task_tree_property_date_show_popup (PlannerCellRendererDate *cell,
gint y2,
GtkTreeView *tree_view)
{
-
+
if (cell->time == MRP_TIME_INVALID) {
cell->time = mrp_time_current_time ();
}
@@ -1893,32 +1893,32 @@ task_tree_duration_edited (GtkCellRendererText *cell,
gchar *ptr;
MrpTask *task;
GValue value = { 0 };
-
+
model = gtk_tree_view_get_model (view);
- path = gtk_tree_path_new_from_string (path_string);
+ path = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (model, &iter, path);
seconds_per_day = mrp_calendar_day_get_total_work (
mrp_project_get_calendar (tree->priv->project),
mrp_day_get_work ());
-
+
flt = g_strtod (new_text, &ptr);
if (ptr != NULL) {
duration = flt * seconds_per_day;
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (model, &iter,
COL_TASK, &task,
-1);
g_value_init (&value, G_TYPE_INT);
g_value_set_int (&value, duration);
-
+
task_cmd_edit_property (tree->priv->main_window,
PLANNER_TASK_TREE (view),
task,
"duration",
&value);
}
-
+
gtk_tree_path_free (path);
}
@@ -1935,28 +1935,28 @@ task_tree_work_edited (GtkCellRendererText *cell,
gint work;
MrpTask *task;
GValue value = { 0 };
-
+
view = GTK_TREE_VIEW (data);
-
+
model = gtk_tree_view_get_model (view);
- path = gtk_tree_path_new_from_string (path_string);
+ path = gtk_tree_path_new_from_string (path_string);
gtk_tree_model_get_iter (model, &iter, path);
work = planner_parse_duration (PLANNER_TASK_TREE (view)->priv->project, new_text);
-
- gtk_tree_model_get (model, &iter,
+
+ gtk_tree_model_get (model, &iter,
COL_TASK, &task,
-1);
g_value_init (&value, G_TYPE_INT);
g_value_set_int (&value, work);
-
+
task_cmd_edit_property (PLANNER_TASK_TREE (view)->priv->main_window,
PLANNER_TASK_TREE (view),
task,
"work",
&value);
-
+
gtk_tree_path_free (path);
}
@@ -1982,7 +1982,7 @@ task_tree_property_data_func (GtkTreeViewColumn *tree_column,
-1);
/* FIXME: implement mrp_object_get_property like
- * g_object_get_property that takes a GValue.
+ * g_object_get_property that takes a GValue.
*/
type = mrp_property_get_property_type (property);
@@ -1991,10 +1991,10 @@ task_tree_property_data_func (GtkTreeViewColumn *tree_column,
mrp_object_get (object,
mrp_property_get_name (property), &svalue,
NULL);
-
+
if (svalue == NULL) {
svalue = g_strdup ("");
- }
+ }
break;
case MRP_PROPERTY_TYPE_INT:
@@ -2015,26 +2015,26 @@ task_tree_property_data_func (GtkTreeViewColumn *tree_column,
case MRP_PROPERTY_TYPE_DATE:
mrp_object_get (object,
mrp_property_get_name (property), &tvalue,
- NULL);
+ NULL);
svalue = planner_format_date (tvalue);
break;
-
+
case MRP_PROPERTY_TYPE_DURATION:
mrp_object_get (object,
mrp_property_get_name (property), &ivalue,
- NULL);
+ NULL);
svalue = planner_format_duration (PLANNER_TASK_TREE (data)->priv->project, ivalue);
break;
-
+
case MRP_PROPERTY_TYPE_COST:
mrp_object_get (object,
mrp_property_get_name (property), &fvalue,
- NULL);
+ NULL);
svalue = planner_format_float (fvalue, 2, FALSE);
break;
-
+
default:
g_warning ("Type not implemented.");
svalue = g_strdup ("");
@@ -2048,7 +2048,7 @@ task_tree_property_data_func (GtkTreeViewColumn *tree_column,
static GValue
task_view_custom_property_set_value (MrpProperty *property,
gchar *new_text,
- GtkCellRendererText *cell)
+ GtkCellRendererText *cell)
{
PlannerCellRendererDate *date;
GValue value = { 0 };
@@ -2056,7 +2056,7 @@ task_view_custom_property_set_value (MrpProperty *property,
gfloat fvalue;
/* FIXME: implement mrp_object_set_property like
- * g_object_set_property that takes a GValue.
+ * g_object_set_property that takes a GValue.
*/
type = mrp_property_get_property_type (property);
@@ -2084,13 +2084,13 @@ task_view_custom_property_set_value (MrpProperty *property,
g_value_set_int (&value, atoi (new_text) *8*60*60);
break;
-
+
case MRP_PROPERTY_TYPE_DATE:
date = PLANNER_CELL_RENDERER_DATE (cell);
/* FIXME: Currently custom properties can't be dates. Why? */
/* mrp_object_set (MRP_OBJECT (task),
- mrp_property_get_name (property),
+ mrp_property_get_name (property),
&(date->time),
NULL);*/
break;
@@ -2099,8 +2099,8 @@ task_view_custom_property_set_value (MrpProperty *property,
g_value_init (&value, G_TYPE_FLOAT);
g_value_set_float (&value, fvalue);
- break;
-
+ break;
+
default:
g_assert_not_reached ();
break;
@@ -2109,10 +2109,10 @@ task_view_custom_property_set_value (MrpProperty *property,
return value;
}
-static void
-task_tree_property_value_edited (GtkCellRendererText *cell,
+static void
+task_tree_property_value_edited (GtkCellRendererText *cell,
gchar *path_str,
- gchar *new_text,
+ gchar *new_text,
ColPropertyData *data)
{
PlannerCmd *cmd;
@@ -2122,9 +2122,9 @@ task_tree_property_value_edited (GtkCellRendererText *cell,
MrpProperty *property;
MrpTask *task;
GValue value = { 0 };
-
+
model = gtk_tree_view_get_model (GTK_TREE_VIEW (data->tree));
- property = data->property;
+ property = data->property;
path = gtk_tree_path_new_from_string (path_str);
gtk_tree_model_get_iter (model, &iter, path);
@@ -2149,19 +2149,19 @@ task_tree_property_added (MrpProject *project,
GtkTreeView *tree;
PlannerTaskTreePriv *priv;
MrpPropertyType type;
- GtkTreeViewColumn *col;
+ GtkTreeViewColumn *col;
GtkCellRenderer *cell;
ColPropertyData *data;
priv = task_tree->priv;
-
+
tree = GTK_TREE_VIEW (task_tree);
data = g_new0 (ColPropertyData, 1);
type = mrp_property_get_property_type (property);
- /* The costs are edited in resources view
+ /* The costs are edited in resources view
if (type == MRP_PROPERTY_TYPE_COST) {
return;
} */
@@ -2169,7 +2169,7 @@ task_tree_property_added (MrpProject *project,
if (object_type != MRP_TYPE_TASK) {
return;
}
-
+
if (type == MRP_PROPERTY_TYPE_DATE) {
cell = planner_cell_renderer_date_new (FALSE);
g_signal_connect (cell,
@@ -2177,7 +2177,7 @@ task_tree_property_added (MrpProject *project,
G_CALLBACK (task_tree_property_date_show_popup),
tree);
} else {
- cell = gtk_cell_renderer_text_new ();
+ cell = gtk_cell_renderer_text_new ();
}
g_object_set (cell, "editable", TRUE, NULL);
@@ -2191,13 +2191,13 @@ task_tree_property_added (MrpProject *project,
col = gtk_tree_view_column_new ();
gtk_tree_view_column_set_resizable (col, TRUE);
- gtk_tree_view_column_set_title (col,
+ gtk_tree_view_column_set_title (col,
mrp_property_get_label (property));
g_object_set_data (G_OBJECT (col), "custom", GINT_TO_POINTER (TRUE));
-
+
g_hash_table_insert (priv->property_to_column, property, col);
-
+
data->property = property;
data->tree = task_tree;
@@ -2225,7 +2225,7 @@ task_tree_property_removed (MrpProject *project,
GtkTreeViewColumn *col;
priv = task_tree->priv;
-
+
col = g_hash_table_lookup (priv->property_to_column, property);
if (col) {
g_hash_table_remove (priv->property_to_column, property);
@@ -2243,10 +2243,10 @@ task_tree_property_changed (MrpProject *project,
GtkTreeViewColumn *col;
priv = task_tree->priv;
-
+
col = g_hash_table_lookup (priv->property_to_column, property);
if (col) {
- gtk_tree_view_column_set_title (col,
+ gtk_tree_view_column_set_title (col,
mrp_property_get_label (property));
}
}
@@ -2267,7 +2267,7 @@ planner_task_tree_set_model (PlannerTaskTree *tree,
"task-added",
G_CALLBACK (task_tree_task_added_cb),
tree);
-
+
g_signal_connect (model,
"task-removed",
G_CALLBACK (task_tree_task_removed_cb),
@@ -2285,17 +2285,17 @@ task_tree_setup_tree_view (GtkTreeView *tree,
GtkTreeSelection *selection;
task_tree = PLANNER_TASK_TREE (tree);
-
+
planner_task_tree_set_model (task_tree, model);
gtk_tree_view_set_rules_hint (tree, TRUE);
gtk_tree_view_set_reorderable (tree, TRUE);
-
+
g_signal_connect (tree,
"popup_menu",
G_CALLBACK (task_tree_tree_view_popup_menu),
tree);
-
+
g_signal_connect (tree,
"button_press_event",
G_CALLBACK (task_tree_tree_view_button_press_event),
@@ -2311,13 +2311,13 @@ task_tree_setup_tree_view (GtkTreeView *tree,
g_signal_connect (selection, "changed",
G_CALLBACK (task_tree_selection_changed_cb),
tree);
-
+
if (task_tree->priv->custom_properties) {
g_signal_connect (project,
"property_added",
G_CALLBACK (task_tree_property_added),
tree);
-
+
g_signal_connect (project,
"property_removed",
G_CALLBACK (task_tree_property_removed),
@@ -2355,7 +2355,7 @@ task_tree_add_column (PlannerTaskTree *tree,
switch (column) {
case COL_WBS:
cell = gtk_cell_renderer_text_new ();
-
+
col = gtk_tree_view_column_new_with_attributes (title,
cell,
NULL);
@@ -2389,7 +2389,7 @@ task_tree_add_column (PlannerTaskTree *tree,
g_object_set_data (G_OBJECT (col),
"data-func", task_tree_name_data_func);
g_object_set_data (G_OBJECT (col), "id", "name");
-
+
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_column_set_min_width (col, 100);
expander = TRUE;
@@ -2405,7 +2405,7 @@ task_tree_add_column (PlannerTaskTree *tree,
"show-popup",
G_CALLBACK (task_tree_start_show_popup),
GTK_TREE_VIEW (tree));
-
+
col = gtk_tree_view_column_new_with_attributes (title,
cell,
NULL);
@@ -2419,7 +2419,7 @@ task_tree_add_column (PlannerTaskTree *tree,
"data-func", task_tree_start_data_func);
g_object_set_data (G_OBJECT (col), "id", "start");
break;
-
+
case COL_DURATION:
cell = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (title,
@@ -2463,7 +2463,7 @@ task_tree_add_column (PlannerTaskTree *tree,
G_CALLBACK (task_tree_work_edited),
GTK_TREE_VIEW (tree));
break;
-
+
case COL_SLACK:
cell = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (title,
@@ -2480,14 +2480,14 @@ task_tree_add_column (PlannerTaskTree *tree,
"data-func", task_tree_slack_data_func);
g_object_set_data (G_OBJECT (col), "id", "slack");
break;
-
+
case COL_FINISH:
cell = planner_cell_renderer_date_new (FALSE);
g_signal_connect (cell,
"show-popup",
G_CALLBACK (task_tree_start_show_popup),
GTK_TREE_VIEW (tree));
-
+
col = gtk_tree_view_column_new_with_attributes (title,
cell,
NULL);
@@ -2567,7 +2567,7 @@ task_tree_add_column (PlannerTaskTree *tree,
}
gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
-
+
g_object_set_data (G_OBJECT (col), "user-data", GTK_TREE_VIEW (tree));
gtk_tree_view_append_column (GTK_TREE_VIEW (tree), col);
@@ -2583,7 +2583,7 @@ task_tree_add_column (PlannerTaskTree *tree,
GtkWidget *
planner_task_tree_new (PlannerWindow *main_window,
- PlannerGanttModel *model,
+ PlannerGanttModel *model,
gboolean custom_properties,
gboolean add_newline,
gint first_column,
@@ -2596,11 +2596,11 @@ planner_task_tree_new (PlannerWindow *main_window,
const gchar *title;
gint col;
gchar *tmp;
-
+
tree = g_object_new (PLANNER_TYPE_TASK_TREE, NULL);
project = planner_window_get_project (main_window);
-
+
priv = tree->priv;
priv->custom_properties = custom_properties;
@@ -2622,12 +2622,12 @@ planner_task_tree_new (PlannerWindow *main_window,
} else {
task_tree_add_column (tree, col, title);
}
-
+
col = va_arg (args, gint);
}
va_end (args);
-
+
return GTK_WIDGET (tree);
}
@@ -2665,9 +2665,9 @@ planner_task_tree_insert_subtask (PlannerTaskTree *tree)
} else {
position = 0;
}
-
+
gtk_tree_path_append_index (path, position);
-
+
work = mrp_calendar_day_get_total_work (
mrp_project_get_calendar (tree->priv->project),
mrp_day_get_work ());
@@ -2686,24 +2686,24 @@ planner_task_tree_insert_subtask (PlannerTaskTree *tree)
parent = NULL;
}
- cmd = planner_task_cmd_insert (tree->priv->main_window,
+ cmd = planner_task_cmd_insert (tree->priv->main_window,
parent, position, work, work, NULL);
-
+
if (!GTK_WIDGET_HAS_FOCUS (tree)) {
gtk_widget_grab_focus (GTK_WIDGET (tree));
}
tree_view = GTK_TREE_VIEW (tree);
-
+
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (tree_view));
-
+
gtk_tree_view_set_cursor (tree_view,
path,
gtk_tree_view_get_column (tree_view, 0),
FALSE);
-
+
planner_task_tree_set_anchor (tree, path);
-
+
g_list_free (list);
}
@@ -2722,7 +2722,7 @@ planner_task_tree_insert_task (PlannerTaskTree *tree)
PlannerCmd *cmd;
priv = tree->priv;
-
+
list = planner_task_tree_get_selected_tasks (tree);
if (list == NULL) {
parent = NULL;
@@ -2751,7 +2751,7 @@ planner_task_tree_insert_task (PlannerTaskTree *tree)
/* Put the new task at the end of end of the list. */
root = mrp_project_get_root_task (priv->project);
position = mrp_task_get_n_children (root);
-
+
gtk_tree_path_append_index (path, position);
}
}
@@ -2759,7 +2759,7 @@ planner_task_tree_insert_task (PlannerTaskTree *tree)
work = mrp_calendar_day_get_total_work (
mrp_project_get_calendar (priv->project),
mrp_day_get_work ());
-
+
depth = gtk_tree_path_get_depth (path);
position = gtk_tree_path_get_indices (path)[depth - 1];
@@ -2776,15 +2776,15 @@ planner_task_tree_insert_task (PlannerTaskTree *tree)
parent = NULL;
}
- cmd = planner_task_cmd_insert (tree->priv->main_window,
+ cmd = planner_task_cmd_insert (tree->priv->main_window,
parent, position, work, work, NULL);
-
+
if (!GTK_WIDGET_HAS_FOCUS (tree)) {
gtk_widget_grab_focus (GTK_WIDGET (tree));
}
tree_view = GTK_TREE_VIEW (tree);
-
+
gtk_tree_view_set_cursor (tree_view,
path,
gtk_tree_view_get_column (tree_view, 0),
@@ -2805,7 +2805,7 @@ planner_task_tree_remove_task (PlannerTaskTree *tree)
gboolean many;
priv = tree->priv;
-
+
list = planner_task_tree_get_selected_tasks (tree);
if (list == NULL) {
return;
@@ -2816,7 +2816,7 @@ planner_task_tree_remove_task (PlannerTaskTree *tree)
} else {
many = FALSE;
}
-
+
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (tree)));
if (many) {
@@ -2824,7 +2824,7 @@ planner_task_tree_remove_task (PlannerTaskTree *tree)
planner_window_get_cmd_manager (priv->main_window),
_("Remove tasks"));
}
-
+
for (l = list; l; l = l->next) {
MrpTask *task = l->data;
GtkTreePath *path;
@@ -2837,14 +2837,14 @@ planner_task_tree_remove_task (PlannerTaskTree *tree)
}
gtk_tree_path_free (path);
}
-
+
g_list_free (list);
if (many) {
planner_cmd_manager_end_transaction (
planner_window_get_cmd_manager (priv->main_window));
}
-
+
planner_task_tree_set_anchor (tree, NULL);
}
@@ -2860,9 +2860,9 @@ planner_task_tree_edit_task (PlannerTaskTree *tree, PlannerTaskDialogPage page)
gboolean proceed;
g_return_if_fail (PLANNER_IS_TASK_TREE (tree));
-
+
priv = tree->priv;
-
+
list = planner_task_tree_get_selected_tasks (tree);
if (list == NULL) {
return;
@@ -2887,10 +2887,10 @@ planner_task_tree_edit_task (PlannerTaskTree *tree, PlannerTaskDialogPage page)
_("You are about to open an edit dialog each for %i tasks. "
"Are you sure that you want to do that?"),
i);
-
+
result = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
-
+
switch (result) {
case GTK_RESPONSE_YES:
proceed= TRUE;
@@ -2926,7 +2926,7 @@ planner_task_tree_insert_tasks (PlannerTaskTree *tree)
GtkWidget *widget;
g_return_if_fail (PLANNER_IS_TASK_TREE (tree));
-
+
priv = tree->priv;
/* We only want one of these dialogs per main window. */
@@ -2942,7 +2942,7 @@ planner_task_tree_insert_tasks (PlannerTaskTree *tree)
gtk_widget_show (widget);
g_object_set_data (G_OBJECT (priv->main_window), "input-tasks-dialog", widget);
-
+
g_signal_connect_object (widget,
"destroy",
G_CALLBACK (task_tree_insert_tasks_dialog_destroy_cb),
@@ -2982,25 +2982,25 @@ planner_task_tree_unlink_task (PlannerTaskTree *tree)
} else {
many = FALSE;
}
-
+
if (many) {
planner_cmd_manager_begin_transaction (
planner_window_get_cmd_manager (priv->main_window),
_("Unlink tasks"));
}
-
+
for (l = list; l; l = l->next) {
task = l->data;
relations = g_list_copy (mrp_task_get_predecessor_relations (task));
for (r = relations; r; r = r->next) {
relation = r->data;
-
- planner_task_cmd_unlink (tree->priv->main_window, relation);
+
+ planner_task_cmd_unlink (tree->priv->main_window, relation);
}
g_list_free (relations);
-
+
relations = g_list_copy (mrp_task_get_successor_relations (task));
for (r = relations; r; r = r->next) {
relation = r->data;
@@ -3010,12 +3010,12 @@ planner_task_tree_unlink_task (PlannerTaskTree *tree)
g_list_free (relations);
}
-
+
if (many) {
planner_cmd_manager_end_transaction (
planner_window_get_cmd_manager (priv->main_window));
}
-
+
g_list_free (list);
}
@@ -3030,7 +3030,7 @@ planner_task_tree_link_tasks (PlannerTaskTree *tree,
GtkWidget *dialog;
priv = tree->priv;
-
+
list = planner_task_tree_get_selected_tasks (tree);
if (list == NULL) {
return;
@@ -3039,9 +3039,9 @@ planner_task_tree_link_tasks (PlannerTaskTree *tree,
planner_cmd_manager_begin_transaction (
planner_window_get_cmd_manager (priv->main_window),
_("Link tasks"));
-
+
list = g_list_reverse (list);
-
+
target_task = list->data;
for (l = list->next; l; l = l->next) {
PlannerCmd *cmd;
@@ -3049,7 +3049,7 @@ planner_task_tree_link_tasks (PlannerTaskTree *tree,
task = l->data;
- cmd = planner_task_cmd_link (tree->priv->main_window, task, target_task,
+ cmd = planner_task_cmd_link (tree->priv->main_window, task, target_task,
relationship, 0, &error);
if (!cmd) {
@@ -3062,13 +3062,13 @@ planner_task_tree_link_tasks (PlannerTaskTree *tree,
gtk_widget_destroy (dialog);
g_error_free (error);
}
-
+
target_task = task;
}
planner_cmd_manager_end_transaction (
planner_window_get_cmd_manager (priv->main_window));
-
+
g_list_free (list);
}
@@ -3092,14 +3092,14 @@ planner_task_tree_indent_task (PlannerTaskTree *tree)
project = priv->project;
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (tree)));
-
+
list = planner_task_tree_get_selected_tasks (tree);
if (list == NULL) {
return;
}
-
+
task = list->data;
-
+
new_parent = planner_gantt_model_get_indent_task_target (model, task);
if (new_parent == NULL) {
g_list_free (list);
@@ -3111,7 +3111,7 @@ planner_task_tree_indent_task (PlannerTaskTree *tree)
/* Get a list of tasks that have the same parent as the first one. */
for (l = list; l; l = l->next) {
task = l->data;
-
+
if (mrp_task_get_parent (task) == first_task_parent) {
indent_tasks = g_list_prepend (indent_tasks, task);
}
@@ -3125,7 +3125,7 @@ planner_task_tree_indent_task (PlannerTaskTree *tree)
} else {
many = FALSE;
}
-
+
if (many) {
planner_cmd_manager_begin_transaction (
planner_window_get_cmd_manager (priv->main_window),
@@ -3133,16 +3133,16 @@ planner_task_tree_indent_task (PlannerTaskTree *tree)
}
task_tree_block_selection_changed (tree);
-
+
for (l = indent_tasks; l; l = l->next) {
TaskCmdMove *cmd;
GError *error = NULL;
-
+
task = l->data;
cmd = (TaskCmdMove *) task_cmd_move (tree, _("Indent task"),
task, NULL, new_parent,
- FALSE, &error);
+ FALSE, &error);
if (!cmd) {
dialog = gtk_message_dialog_new (GTK_WINDOW (priv->main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -3150,7 +3150,7 @@ planner_task_tree_indent_task (PlannerTaskTree *tree)
GTK_BUTTONS_OK,
"%s",
error->message);
-
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_error_free (error);
@@ -3171,7 +3171,7 @@ planner_task_tree_indent_task (PlannerTaskTree *tree)
planner_cmd_manager_end_transaction (
planner_window_get_cmd_manager (priv->main_window));
}
-
+
task_tree_unblock_selection_changed (tree);
g_list_free (indent_tasks);
}
@@ -3195,7 +3195,7 @@ planner_task_tree_unindent_task (PlannerTaskTree *tree)
project = priv->project;
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (tree)));
-
+
list = planner_task_tree_get_selected_tasks (tree);
if (list == NULL) {
return;
@@ -3208,17 +3208,17 @@ planner_task_tree_unindent_task (PlannerTaskTree *tree)
new_parent = mrp_task_get_parent (new_parent);
}
if (new_parent == NULL) {
- /* No grandparent to unindent to. */
+ /* No grandparent to unindent to. */
g_list_free (list);
return;
}
-
+
first_task_parent = mrp_task_get_parent (task);
/* Get a list of tasks that have the same parent as the first one. */
for (l = list; l; l = l->next) {
task = l->data;
-
+
if (mrp_task_get_parent (task) == first_task_parent) {
unindent_tasks = g_list_prepend (unindent_tasks, task);
}
@@ -3230,28 +3230,28 @@ planner_task_tree_unindent_task (PlannerTaskTree *tree)
} else {
many = FALSE;
}
-
+
if (many) {
planner_cmd_manager_begin_transaction (
planner_window_get_cmd_manager (priv->main_window),
_("Unindent tasks"));
}
-
+
task_tree_block_selection_changed (tree);
for (l = unindent_tasks; l; l = l->next) {
MrpTask *sibling;
gboolean before;
-
+
task = l->data;
-
+
sibling = mrp_task_get_next_sibling (mrp_task_get_parent (task));
if (sibling) {
before = TRUE;
} else {
before = FALSE;
}
-
+
task_cmd_move (tree, _("Unindent task"),
task, sibling,
new_parent,
@@ -3278,7 +3278,7 @@ planner_task_tree_unindent_task (PlannerTaskTree *tree)
g_list_free (unindent_tasks);
}
-void
+void
planner_task_tree_move_task_up (PlannerTaskTree *tree)
{
PlannerTaskTreePriv *priv;
@@ -3301,10 +3301,10 @@ planner_task_tree_move_task_up (PlannerTaskTree *tree)
if (list == NULL) {
/* Nothing selected */
return;
- }
+ }
task_tree_block_selection_changed (tree);
-
+
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (tree)));
path = planner_task_tree_get_anchor (tree);
@@ -3326,20 +3326,20 @@ planner_task_tree_move_task_up (PlannerTaskTree *tree)
} else {
many = FALSE;
}
-
+
if (many) {
planner_cmd_manager_begin_transaction (
planner_window_get_cmd_manager (priv->main_window),
_("Move tasks up"));
}
-
+
for (l = list; l; l = l->next) {
count++;
task = l->data;
position = mrp_task_get_position (task);
parent = mrp_task_get_parent (task);
-
+
/* We now check if the parent is selected as well me. If it is
* then we skip checks on our position and skip moving because
* its just not relevant.
@@ -3350,7 +3350,7 @@ planner_task_tree_move_task_up (PlannerTaskTree *tree)
* unusual selections e.g. if just 1.1 and 1.1.1.1 selected. To
* do that we need to recurse this selection list.
*/
-
+
skip = FALSE;
for (m = list; m; m = m->next) {
if (m->data == parent ) {
@@ -3358,7 +3358,7 @@ planner_task_tree_move_task_up (PlannerTaskTree *tree)
break;
}
}
-
+
if (position == 0 && count == 1) {
/* We stop everything if at top of list and first task
* else just stop moving this one task.
@@ -3394,12 +3394,12 @@ planner_task_tree_move_task_up (PlannerTaskTree *tree)
planner_cmd_manager_end_transaction (
planner_window_get_cmd_manager (priv->main_window));
}
-
+
task_tree_unblock_selection_changed (tree);
g_list_free (list);
}
-void
+void
planner_task_tree_move_task_down (PlannerTaskTree *tree)
{
PlannerTaskTreePriv *priv;
@@ -3437,7 +3437,7 @@ planner_task_tree_move_task_down (PlannerTaskTree *tree)
}
root = mrp_project_get_root_task (project);
-
+
list = g_list_reverse (list);
proceed = TRUE;
@@ -3452,13 +3452,13 @@ planner_task_tree_move_task_down (PlannerTaskTree *tree)
} else {
many = FALSE;
}
-
+
if (many) {
planner_cmd_manager_begin_transaction (
planner_window_get_cmd_manager (priv->main_window),
_("Move tasks down"));
}
-
+
for (l = list; l; l = l->next) {
count++;
@@ -3469,7 +3469,7 @@ planner_task_tree_move_task_down (PlannerTaskTree *tree)
/* We now check if parent is selected also. If so then we skip
* checks on our position as its not relevant.
*/
-
+
/* FIXME: This checking isn't enough, we need to check if any
* ancestor of the task is selected. The following won't pick up
* unusual selections e.g. if just 1.1 and 1.1.1.1 selected. To
@@ -3493,10 +3493,10 @@ planner_task_tree_move_task_down (PlannerTaskTree *tree)
/* If the parent task was selected then we don't care if
* we are at the bottom of our particular position. Note
* NOT all possible selection cases are catered for.
- */
+ */
proceed = FALSE;
}
-
+
if (!skip && proceed) {
/* Move task from position to position + 1. */
sibling = mrp_task_get_nth_child (parent, position + 1);
@@ -3513,7 +3513,7 @@ planner_task_tree_move_task_down (PlannerTaskTree *tree)
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
for (l = list; l; l = l->next) {
task = l->data;
-
+
path = planner_gantt_model_get_path_from_task (model, task);
gtk_tree_selection_select_path (selection, path);
gtk_tree_path_free (path);
@@ -3529,7 +3529,7 @@ planner_task_tree_move_task_down (PlannerTaskTree *tree)
planner_cmd_manager_end_transaction (
planner_window_get_cmd_manager (priv->main_window));
}
-
+
task_tree_unblock_selection_changed (tree);
g_list_free (list);
}
@@ -3541,31 +3541,31 @@ planner_task_tree_reset_constraint (PlannerTaskTree *tree)
MrpTask *task;
GList *list, *l;
gboolean many;
-
+
priv = tree->priv;
-
+
list = planner_task_tree_get_selected_tasks (tree);
if (!list) {
return;
}
-
+
if (list->next) {
many = TRUE;
} else {
many = FALSE;
}
-
+
if (many) {
planner_cmd_manager_begin_transaction (
planner_window_get_cmd_manager (priv->main_window),
_("Reset task constraints"));
}
-
+
for (l = list; l; l = l->next) {
task = l->data;
task_cmd_reset_constraint (tree, task);
}
-
+
if (many) {
planner_cmd_manager_end_transaction (
planner_window_get_cmd_manager (priv->main_window));
@@ -3580,18 +3580,18 @@ planner_task_tree_reset_all_constraints (PlannerTaskTree *tree)
PlannerTaskTreePriv *priv;
MrpTask *task;
GList *list, *l;
-
+
priv = tree->priv;
list = mrp_project_get_all_tasks (priv->project);
if (!list) {
return;
}
-
+
planner_cmd_manager_begin_transaction (
planner_window_get_cmd_manager (priv->main_window),
_("Reset all task constraints"));
-
+
for (l = list; l; l = l->next) {
task = l->data;
task_cmd_reset_constraint (tree, task);
@@ -3599,7 +3599,7 @@ planner_task_tree_reset_all_constraints (PlannerTaskTree *tree)
planner_cmd_manager_end_transaction (
planner_window_get_cmd_manager (priv->main_window));
-
+
g_list_free (list);
}
@@ -3616,25 +3616,25 @@ task_tree_get_selected_func (GtkTreeModel *model,
iter,
COL_TASK, &task,
-1);
-
+
*list = g_list_prepend (*list, task);
}
GList *
-planner_task_tree_get_selected_tasks (PlannerTaskTree *tree)
+planner_task_tree_get_selected_tasks (PlannerTaskTree *tree)
{
GtkTreeSelection *selection;
GList *list;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
-
+
list = NULL;
gtk_tree_selection_selected_foreach (selection,
task_tree_get_selected_func,
&list);
list = g_list_reverse (list);
-
+
return list;
}
@@ -3668,7 +3668,7 @@ task_tree_get_task_from_path (PlannerTaskTree *tree,
{
PlannerGanttModel *model;
MrpTask *task;
-
+
model = PLANNER_GANTT_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (tree)));
task = planner_gantt_model_get_task_from_path (model, path);
@@ -3684,7 +3684,7 @@ planner_task_tree_set_highlight_critical (PlannerTaskTree *tree,
if (tree->priv->highlight_critical == highlight) {
return;
}
-
+
tree->priv->highlight_critical = highlight;
gtk_widget_queue_draw (GTK_WIDGET (tree));
@@ -3707,7 +3707,7 @@ gboolean
planner_task_tree_get_highlight_critical (PlannerTaskTree *tree)
{
g_return_val_if_fail (PLANNER_IS_TASK_TREE (tree), FALSE);
-
+
return tree->priv->highlight_critical;
}
@@ -3715,7 +3715,7 @@ gboolean
planner_task_tree_get_nonstandard_days (PlannerTaskTree *tree)
{
g_return_val_if_fail (PLANNER_IS_TASK_TREE (tree), FALSE);
-
+
return tree->priv->nonstandard_days;
}
@@ -3724,15 +3724,15 @@ void
planner_task_tree_set_anchor (PlannerTaskTree *tree, GtkTreePath *anchor)
{
g_return_if_fail (PLANNER_IS_TASK_TREE (tree));
-
+
if (tree->priv->anchor) {
gtk_tree_path_free (tree->priv->anchor);
}
-
+
tree->priv->anchor = anchor;
}
-GtkTreePath*
+GtkTreePath*
planner_task_tree_get_anchor (PlannerTaskTree *tree)
{
g_return_val_if_fail (PLANNER_IS_TASK_TREE (tree), FALSE);
@@ -3740,7 +3740,7 @@ planner_task_tree_get_anchor (PlannerTaskTree *tree)
return tree->priv->anchor;
}
-PlannerWindow*
+PlannerWindow*
planner_task_tree_get_window (PlannerTaskTree *tree)
{
g_return_val_if_fail (PLANNER_IS_TASK_TREE (tree), NULL);
diff --git a/src/planner-task-view.c b/src/planner-task-view.c
index 507908d..58e012a 100644
--- a/src/planner-task-view.c
+++ b/src/planner-task-view.c
@@ -206,7 +206,7 @@ task_view_activate (PlannerView *view)
gchar *filename;
priv = PLANNER_TASK_VIEW (view)->priv;
-
+
priv->actions = gtk_action_group_new ("TaskView");
gtk_action_group_set_translation_domain (priv->actions, GETTEXT_PACKAGE);
@@ -240,7 +240,7 @@ task_view_activate (PlannerView *view)
gtk_toggle_action_set_active (
GTK_TOGGLE_ACTION (gtk_action_group_get_action (priv->actions, "NonstandardDays")),
show_nostd_days);
-
+
task_view_selection_changed_cb (PLANNER_TASK_TREE (priv->tree), view);
gtk_widget_grab_focus (priv->tree);
@@ -259,7 +259,7 @@ static void
task_view_setup (PlannerView *view, PlannerWindow *main_window)
{
PlannerTaskViewPriv *priv;
-
+
priv = PLANNER_TASK_VIEW (view)->priv;
priv->ui_manager = planner_window_get_ui_manager (main_window);
@@ -281,11 +281,11 @@ static const gchar *
task_view_get_icon (PlannerView *view)
{
static gchar *filename = NULL;
-
+
if (!filename) {
filename = mrp_paths_get_image_dir ("tasks.png");
}
-
+
return filename;
}
@@ -304,7 +304,7 @@ task_view_get_widget (PlannerView *view)
PlannerGanttModel *model;
priv = PLANNER_TASK_VIEW (view)->priv;
-
+
if (priv->tree == NULL) {
project = planner_window_get_project (view->main_window);
@@ -317,7 +317,7 @@ task_view_get_widget (PlannerView *view)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
-
+
priv->frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (priv->frame), GTK_SHADOW_IN);
@@ -334,8 +334,8 @@ task_view_get_widget (PlannerView *view)
* untranslated unless there is a localized term for it.
*/
COL_WBS, _("WBS"),
- COL_NAME, _("Name"),
- COL_START, _("Start"),
+ COL_NAME, _("Name"),
+ COL_START, _("Start"),
COL_FINISH, _("Finish"),
COL_WORK, _("Work"),
COL_DURATION, _("Duration"),
@@ -344,7 +344,7 @@ task_view_get_widget (PlannerView *view)
COL_ASSIGNED_TO, _("Assigned to"),
/* i18n: The string "% Complete" will be used in the header
* of a column containing values from 0 upto 100, indicating
- * what part of a task has been completed.
+ * what part of a task has been completed.
* xgettext:no-c-format
*/
COL_COMPLETE, _("% Complete"),
@@ -353,9 +353,9 @@ task_view_get_widget (PlannerView *view)
g_object_unref (model);
task_view_load_columns (view);
-
+
gtk_container_add (GTK_CONTAINER (sw), priv->tree);
-
+
g_signal_connect (priv->tree,
"columns-changed",
G_CALLBACK (task_view_tree_view_columns_changed_cb),
@@ -450,7 +450,7 @@ task_view_insert_tasks_cb (GtkAction *action,
}
static void
-task_view_remove_task_cb (GtkAction *action,
+task_view_remove_task_cb (GtkAction *action,
gpointer data)
{
PlannerTaskView *view;
@@ -461,7 +461,7 @@ task_view_remove_task_cb (GtkAction *action,
}
static void
-task_view_edit_task_cb (GtkAction *action,
+task_view_edit_task_cb (GtkAction *action,
gpointer data)
{
PlannerTaskView *view;
@@ -473,18 +473,18 @@ task_view_edit_task_cb (GtkAction *action,
}
static void
-task_view_select_all_cb (GtkAction *action,
+task_view_select_all_cb (GtkAction *action,
gpointer data)
{
PlannerTaskView *view;
-
+
view = PLANNER_TASK_VIEW (data);
-
+
planner_task_tree_select_all (PLANNER_TASK_TREE (view->priv->tree));
}
static void
-task_view_unlink_task_cb (GtkAction *action,
+task_view_unlink_task_cb (GtkAction *action,
gpointer data)
{
PlannerTaskView *view;
@@ -507,7 +507,7 @@ task_view_link_tasks_cb (GtkAction *action,
}
static void
-task_view_indent_task_cb (GtkAction *action,
+task_view_indent_task_cb (GtkAction *action,
gpointer data)
{
PlannerTaskView *view;
@@ -517,30 +517,30 @@ task_view_indent_task_cb (GtkAction *action,
planner_task_tree_indent_task (PLANNER_TASK_TREE (view->priv->tree));
}
-static void
+static void
task_view_move_task_up_cb (GtkAction *action,
gpointer data)
{
PlannerTaskView *view;
view = PLANNER_TASK_VIEW (data);
-
+
planner_task_tree_move_task_up (PLANNER_TASK_TREE (view->priv->tree));
}
-static void
+static void
task_view_move_task_down_cb (GtkAction *action,
gpointer data)
{
PlannerTaskView *view;
-
+
view = PLANNER_TASK_VIEW (data);
planner_task_tree_move_task_down (PLANNER_TASK_TREE (view->priv->tree));
}
static void
-task_view_unindent_task_cb (GtkAction *action,
+task_view_unindent_task_cb (GtkAction *action,
gpointer data)
{
PlannerTaskView *view;
@@ -551,7 +551,7 @@ task_view_unindent_task_cb (GtkAction *action,
}
static void
-task_view_reset_constraint_cb (GtkAction *action,
+task_view_reset_constraint_cb (GtkAction *action,
gpointer data)
{
PlannerTaskView *view;
@@ -562,7 +562,7 @@ task_view_reset_constraint_cb (GtkAction *action,
}
static void
-task_view_edit_custom_props_cb (GtkAction *action,
+task_view_edit_custom_props_cb (GtkAction *action,
gpointer data)
{
PlannerTaskView *view;
@@ -570,14 +570,14 @@ task_view_edit_custom_props_cb (GtkAction *action,
MrpProject *project;
view = PLANNER_TASK_VIEW (data);
-
+
project = planner_window_get_project (PLANNER_VIEW (view)->main_window);
-
+
dialog = planner_property_dialog_new (PLANNER_VIEW (view)->main_window,
project,
MRP_TYPE_TASK,
_("Edit custom task properties"));
-
+
gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300);
gtk_widget_show (dialog);
}
@@ -588,7 +588,7 @@ task_view_highlight_critical_cb (GtkAction *action,
{
PlannerTaskViewPriv *priv;
gboolean state;
-
+
priv = PLANNER_TASK_VIEW (data)->priv;
state = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
@@ -606,7 +606,7 @@ task_view_nonstandard_days_cb (GtkAction *action,
{
PlannerTaskViewPriv *priv;
gboolean state;
-
+
priv = PLANNER_TASK_VIEW (data)->priv;
state = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
@@ -625,16 +625,16 @@ task_view_edit_columns_cb (GtkAction *action,
{
PlannerTaskView *view;
PlannerTaskViewPriv *priv;
-
+
view = PLANNER_TASK_VIEW (data);
priv = view->priv;
-
+
planner_column_dialog_show (PLANNER_VIEW (view)->main_window,
_("Edit Task Columns"),
GTK_TREE_VIEW (priv->tree));
}
-static void
+static void
task_view_selection_changed_cb (PlannerTaskTree *tree, PlannerView *view)
{
task_view_update_ui (view);
@@ -649,16 +649,16 @@ task_view_relations_changed_cb (PlannerTaskTree *tree,
task_view_update_ui (view);
}
-
+
static void
task_view_print_init (PlannerView *view,
PlannerPrintJob *job)
{
PlannerTaskViewPriv *priv;
-
+
priv = PLANNER_TASK_VIEW (view)->priv;
- priv->print_sheet = planner_table_print_sheet_new (PLANNER_VIEW (view), job,
+ priv->print_sheet = planner_table_print_sheet_new (PLANNER_VIEW (view), job,
GTK_TREE_VIEW (priv->tree));
}
@@ -669,7 +669,7 @@ task_view_print (PlannerView *view,
PlannerTaskViewPriv *priv;
priv = PLANNER_TASK_VIEW (view)->priv;
-
+
planner_table_print_sheet_output (priv->print_sheet, page_nr);
}
@@ -679,7 +679,7 @@ task_view_print_get_n_pages (PlannerView *view)
PlannerTaskViewPriv *priv;
priv = PLANNER_TASK_VIEW (view)->priv;
-
+
return planner_table_print_sheet_get_n_pages (priv->print_sheet);
}
@@ -689,7 +689,7 @@ task_view_print_cleanup (PlannerView *view)
PlannerTaskViewPriv *priv;
priv = PLANNER_TASK_VIEW (view)->priv;
-
+
planner_table_print_sheet_free (priv->print_sheet);
priv->print_sheet = NULL;
}
@@ -703,11 +703,11 @@ task_view_update_ui (PlannerView *view)
gboolean rel_value = FALSE;
gboolean link_value = FALSE;
gint count = 0;
-
+
if (!view->activated) {
return;
}
-
+
priv = PLANNER_TASK_VIEW (view)->priv;
list = planner_task_tree_get_selected_tasks (PLANNER_TASK_TREE (priv->tree));
@@ -727,31 +727,31 @@ task_view_update_ui (PlannerView *view)
link_value = (count >= 2);
g_object_set (gtk_action_group_get_action (priv->actions, "EditTask"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "RemoveTask"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "UnlinkTask"),
- "sensitive", rel_value,
+ "sensitive", rel_value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "LinkTasks"),
- "sensitive", link_value,
+ "sensitive", link_value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "IndentTask"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "UnindentTask"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "MoveTaskUp"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "MoveTaskDown"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "ResetConstraint"),
- "sensitive", value,
+ "sensitive", value,
NULL);
g_list_free (list);
@@ -763,7 +763,7 @@ task_view_save_columns (PlannerView *view)
PlannerTaskViewPriv *priv;
priv = PLANNER_TASK_VIEW (view)->priv;
-
+
planner_view_column_save_helper (view, GTK_TREE_VIEW (priv->tree));
}
@@ -780,7 +780,7 @@ task_view_load_columns (PlannerView *view)
/* Load the columns. */
planner_view_column_load_helper (view, GTK_TREE_VIEW (priv->tree));
-
+
/* Make things a bit more robust by setting defaults if we don't get any
* visible columns. Should be done through a schema instead (but we'll
* keep this since a lot of people get bad installations when installing
@@ -805,12 +805,12 @@ task_view_load_columns (PlannerView *view)
id = g_object_get_data (G_OBJECT (column), "id");
g_print ("%s\n", id);
-
+
if (!id) {
continue;
}
-
+
if (strcmp (id, "wbs") == 0 ||
strcmp (id, "name") == 0 ||
strcmp (id, "start") == 0 ||
@@ -828,7 +828,7 @@ task_view_load_columns (PlannerView *view)
}
}
}
-
+
g_list_free (columns);
}
@@ -841,4 +841,3 @@ planner_task_view_new (void)
return view;
}
-
diff --git a/src/planner-test-plugin.c b/src/planner-test-plugin.c
index 07e9bd8..b75d5c4 100644
--- a/src/planner-test-plugin.c
+++ b/src/planner-test-plugin.c
@@ -27,13 +27,13 @@ void plugin_init (PlannerPlugin *plugin,
PlannerWindow *main_window);
void plugin_exit (void);
-G_MODULE_EXPORT void
-plugin_exit (void)
+G_MODULE_EXPORT void
+plugin_exit (void)
{
/* g_message ("Test exit"); */
}
-G_MODULE_EXPORT void
+G_MODULE_EXPORT void
plugin_init (PlannerPlugin *plugin,
PlannerWindow *main_window)
{
diff --git a/src/planner-usage-chart.c b/src/planner-usage-chart.c
index a39fe01..cd90403 100644
--- a/src/planner-usage-chart.c
+++ b/src/planner-usage-chart.c
@@ -323,7 +323,7 @@ usage_chart_init (PlannerUsageChart * chart)
"scale", SCALE (priv->zoom),
"zoom", priv->zoom, NULL);
- gtk_box_pack_start (GTK_BOX (chart), GTK_WIDGET (priv->header), FALSE,
+ gtk_box_pack_start (GTK_BOX (chart), GTK_WIDGET (priv->header), FALSE,
TRUE,
0);
@@ -408,7 +408,7 @@ usage_chart_set_zoom (PlannerUsageChart * chart, gdouble level)
priv = chart->priv;
priv->zoom = level;
-
+
usage_chart_tree_traverse (priv->tree, scale_func, chart);
g_object_set (priv->header,
@@ -556,7 +556,7 @@ usage_chart_get_width (PlannerUsageChart *chart)
chart->priv->last_time == MRP_TIME_INVALID) {
return -1;
}
-
+
return chart->priv->last_time - chart->priv->project_start;
}
@@ -604,7 +604,7 @@ usage_chart_style_set (GtkWidget *widget, GtkStyle *prev_style)
GTK_WIDGET_CLASS (parent_class)->style_set (widget,
prev_style);
}
-
+
chart = PLANNER_USAGE_CHART (widget);
priv = chart->priv;
@@ -734,7 +734,7 @@ usage_chart_set_adjustments (PlannerUsageChart *chart,
gtk_object_sink (GTK_OBJECT (priv->vadjustment));
need_adjust = TRUE;
}
-
+
if (need_adjust) {
gtk_widget_set_scroll_adjustments (GTK_WIDGET (priv->canvas),
hadj, vadj);
@@ -850,7 +850,7 @@ usage_chart_reflow_idle (PlannerUsageChart *chart)
"x2", x2,
NULL);
}
-
+
priv->height_changed = FALSE;
priv->reflow_idle_id = 0;
@@ -975,7 +975,7 @@ planner_usage_chart_set_model (PlannerUsageChart *chart,
usage_chart_disconnect_signals (chart);
g_object_unref (priv->model);
}
-
+
priv->model = model;
if (model) {
g_object_ref (model);
@@ -993,13 +993,13 @@ planner_usage_chart_set_model (PlannerUsageChart *chart,
chart);
usage_chart_add_signal (chart, project, signal_id,
"notify::project-start");
-
+
g_signal_connect (root,
"notify::finish",
G_CALLBACK
(usage_chart_root_finish_changed),
chart);
-
+
signal_id = g_signal_connect (model,
"row-changed",
G_CALLBACK
@@ -1234,7 +1234,7 @@ usage_chart_disconnect_signals (PlannerUsageChart *chart)
g_signal_handler_disconnect (data->instance, data->id);
g_free (data);
}
-
+
g_list_free (chart->priv->signal_ids);
chart->priv->signal_ids = NULL;
}
@@ -1324,7 +1324,7 @@ planner_usage_chart_collapse_all (PlannerUsageChart *chart)
{
TreeNode *node;
int i;
-
+
g_return_if_fail (PLANNER_IS_USAGE_CHART (chart));
node = chart->priv->tree;
@@ -1534,7 +1534,7 @@ planner_usage_chart_setup_root_task (PlannerUsageChart *chart)
project = planner_usage_model_get_project (PLANNER_USAGE_MODEL (priv->model));
root = mrp_project_get_root_task (project);
-
+
g_signal_connect (root,
"notify::finish",
G_CALLBACK
@@ -1542,20 +1542,20 @@ planner_usage_chart_setup_root_task (PlannerUsageChart *chart)
chart);
}
-PlannerUsageTree *
-planner_usage_chart_get_view (PlannerUsageChart *chart)
+PlannerUsageTree *
+planner_usage_chart_get_view (PlannerUsageChart *chart)
{
- g_return_val_if_fail (PLANNER_IS_USAGE_CHART (chart), NULL);
+ g_return_val_if_fail (PLANNER_IS_USAGE_CHART (chart), NULL);
return chart->priv->view;
}
-void
+void
planner_usage_chart_set_view (PlannerUsageChart *chart,
- PlannerUsageTree *view)
+ PlannerUsageTree *view)
{
g_return_if_fail (PLANNER_IS_USAGE_TREE (view));
-
+
/* g_print ("View for Usage configured\n"); */
chart->priv->view = view;
diff --git a/src/planner-usage-chart.h b/src/planner-usage-chart.h
index 4405834..a3bb347 100644
--- a/src/planner-usage-chart.h
+++ b/src/planner-usage-chart.h
@@ -59,7 +59,7 @@ GtkWidget * planner_usage_chart_new_with_model (GtkTreeModel *model);
GtkTreeModel *planner_usage_chart_get_model (PlannerUsageChart *chart);
void planner_usage_chart_set_model (PlannerUsageChart *chart,
GtkTreeModel *model);
-PlannerUsageTree *
+PlannerUsageTree *
planner_usage_chart_get_view (PlannerUsageChart *chart);
void planner_usage_chart_set_view (PlannerUsageChart *chart,
PlannerUsageTree *view);
diff --git a/src/planner-usage-model.c b/src/planner-usage-model.c
index 6f7e78a..397969c 100644
--- a/src/planner-usage-model.c
+++ b/src/planner-usage-model.c
@@ -323,17 +323,17 @@ planner_usage_model_get_path_from_resource (PlannerUsageModel *model,
node);
}
-GtkTreePath *
+GtkTreePath *
planner_usage_model_get_path_from_assignment (PlannerUsageModel *model,
- MrpAssignment *assignment)
+ MrpAssignment *assignment)
{
GNode *node;
-
+
g_return_val_if_fail (PLANNER_IS_USAGE_MODEL (model), NULL);
g_return_val_if_fail (MRP_IS_ASSIGNMENT (assignment), NULL);
-
+
node = g_hash_table_lookup (model->priv->assign2node, assignment);
-
+
return usage_model_get_path_from_node (PLANNER_USAGE_MODEL (model),
node);
}
diff --git a/src/planner-usage-model.h b/src/planner-usage-model.h
index 17c583d..4342650 100644
--- a/src/planner-usage-model.h
+++ b/src/planner-usage-model.h
@@ -60,7 +60,7 @@ GType planner_usage_model_get_type (void) G_GNUC_CON
PlannerUsageModel *planner_usage_model_new (MrpProject *project);
GtkTreePath * planner_usage_model_get_path_from_resource (PlannerUsageModel *model,
MrpResource *resource);
-GtkTreePath * planner_usage_model_get_path_from_assignment
+GtkTreePath * planner_usage_model_get_path_from_assignment
(PlannerUsageModel *model,
MrpAssignment *assignment);
MrpProject * planner_usage_model_get_project (PlannerUsageModel *model);
diff --git a/src/planner-usage-row.c b/src/planner-usage-row.c
index 633d697..f5a1043 100644
--- a/src/planner-usage-row.c
+++ b/src/planner-usage-row.c
@@ -283,14 +283,14 @@ usage_row_class_init (PlannerUsageRowClass * class)
g_param_spec_double ("height", NULL, NULL,
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
-
+
g_object_class_install_property
(gobject_class,
PROP_ASSIGNMENT,
g_param_spec_object ("assignment", NULL, NULL,
MRP_TYPE_ASSIGNMENT,
G_PARAM_READWRITE));
-
+
g_object_class_install_property
(gobject_class,
PROP_RESOURCE,
@@ -400,7 +400,7 @@ get_assignment_bounds (MrpAssignment *assign,
{
MrpTask *task;
mrptime t;
-
+
task = mrp_assignment_get_task (assign);
t = mrp_task_get_work_start (task);
*x_debut = t * scale;
@@ -445,7 +445,7 @@ recalc_bounds (PlannerUsageRow *row)
gdouble x_debut, x_fin, x_debut_real;
gdouble old_x, old_x_start, old_width;
gboolean changed;
-
+
item = GNOME_CANVAS_ITEM (row);
priv = row->priv;
@@ -464,13 +464,13 @@ recalc_bounds (PlannerUsageRow *row)
else {
width = 0;
}
-
+
if (width > 0) {
width += TEXT_PADDING;
}
priv->text_width = width;
-
+
if (priv->assignment) {
get_assignment_bounds (priv->assignment, priv->scale,
&x_debut, &x_fin, &x_debut_real);
@@ -479,7 +479,7 @@ recalc_bounds (PlannerUsageRow *row)
get_resource_bounds (priv->resource, priv->scale, &x_debut,
&x_fin, &x_debut_real);
}
-
+
priv->x = x_debut;
priv->width = x_fin - x_debut;
priv->x_start = x_debut_real;
@@ -568,20 +568,20 @@ usage_row_set_property (GObject *object,
"notify",
G_CALLBACK (usage_row_assignment_notify_cb),
row, 0);
-
+
g_signal_connect_object (tmp_task,
"notify",
G_CALLBACK (usage_row_task_notify_cb),
row, 0);
}
}
- /*
+ /*
* g_signal_connect_object (priv->resource,
* "assignment-added",
* G_CALLBACK (usage_row_res_assignment_added),
* row,
* 0);
- *
+ *
* g_signal_connect_object (priv->resource,
* "assignment-removed",
* G_CALLBACK (usage_row_res_assignment_removed),
@@ -701,13 +701,13 @@ usage_row_update_resources (PlannerUsageRow *row)
PlannerUsageRowPriv *priv;
gint units;
gchar *units_string;
-
+
priv = row->priv;
-
+
units = mrp_assignment_get_units (priv->assignment);
units_string = g_strdup_printf ("%i%%", units);
pango_layout_set_text (priv->layout, units_string, -1);
-
+
g_free (units_string);
}
@@ -754,15 +754,15 @@ usage_row_realize (GnomeCanvasItem * item)
gnome_canvas_get_color (item->canvas, "LightSkyBlue3", &color_normal);
gnome_canvas_get_color (item->canvas, "#9ac7e0", &color_normal_light);
gnome_canvas_get_color (item->canvas, "#7da1b5", &color_normal_dark);
-
+
gnome_canvas_get_color (item->canvas, "indian red", &color_overuse);
gnome_canvas_get_color (item->canvas, "#de6464", &color_overuse_light);
gnome_canvas_get_color (item->canvas, "#ba5454", &color_overuse_dark);
-
+
gnome_canvas_get_color (item->canvas, "grey", &color_underuse);
gnome_canvas_get_color (item->canvas, "#d6d6d6", &color_underuse_light);
gnome_canvas_get_color (item->canvas, "#a8a8a8", &color_underuse_dark);
-
+
gnome_canvas_get_color (item->canvas, "medium sea green", &color_free);
gnome_canvas_get_color (item->canvas, "#43c77e", &color_free_light);
gnome_canvas_get_color (item->canvas, "#359e64", &color_free_dark);
@@ -950,7 +950,7 @@ usage_row_draw_resource_ival (mrptime start,
cr_ystart = cs_ystart + 1;
cr_xend = c_xend;
cr_yend = cs_yend - 1;
-
+
/* Clip to the expose area */
r_xstart = MAX (c_xstart, 0);
r_xend = MIN (c_xend, width);
@@ -1004,7 +1004,7 @@ usage_row_draw_resource_ival (mrptime start,
} else {
gdk_gc_set_foreground (priv->fill_gc, &color_overuse_light);
}
-
+
//gdk_gc_set_foreground (priv->fill_gc, &color_high);
/* Top of the shadow. */
@@ -1012,13 +1012,13 @@ usage_row_draw_resource_ival (mrptime start,
gdk_draw_line (drawable, priv->fill_gc, r_xstart, rs_ystart,
r_xend, rs_ystart);
}
-
+
/* Left of the shadow. */
if (chunk & ROW_START && cs_xstart == rs_xstart) {
gdk_draw_line (drawable, priv->fill_gc, rs_xstart, rs_ystart,
rs_xstart, cs_yend);
}
-
+
if (units == 0) {
gdk_gc_set_foreground (priv->fill_gc, &color_free_dark);
}
@@ -1030,7 +1030,7 @@ usage_row_draw_resource_ival (mrptime start,
} else {
gdk_gc_set_foreground (priv->fill_gc, &color_overuse_dark);
}
-
+
//gdk_gc_set_foreground (priv->fill_gc, &color_shadow);
/* Bottom of the shadow. */
@@ -1038,7 +1038,7 @@ usage_row_draw_resource_ival (mrptime start,
gdk_draw_line (drawable, priv->fill_gc, r_xstart, rs_yend,
r_xend, rs_yend);
}
-
+
/* Right of the shadow. */
if (chunk & ROW_END && cs_xend == rs_xend) {
gdk_draw_line (drawable, priv->fill_gc, rs_xend, rs_ystart,
@@ -1051,25 +1051,25 @@ usage_row_draw_resource_ival (mrptime start,
gdk_draw_line (drawable, priv->fill_gc, c_xstart, rs_ystart, c_xstart,
rr_yend);
}
-
+
/* Top frame. */
if (c_ystart == r_ystart) {
gdk_draw_line (drawable, priv->frame_gc, r_xstart, r_ystart, r_xend,
r_ystart);
}
-
+
/* Bottom frame. */
if (c_yend == r_yend) {
gdk_draw_line (drawable, priv->frame_gc, r_xstart, r_yend, r_xend,
r_yend);
}
-
+
/* Left frame. */
if (chunk & ROW_START && c_xstart == r_xstart) {
gdk_draw_line (drawable, priv->frame_gc, r_xstart, r_ystart,
r_xstart, r_yend);
}
-
+
/* Right frame. */
if (chunk & ROW_END && c_xend == r_xend) {
gdk_draw_line (drawable, priv->frame_gc, r_xend, r_ystart, r_xend,
@@ -1169,7 +1169,7 @@ usage_row_draw_resource (PlannerUsageRow *row,
g_list_free (dates);
if (!(chunk & ROW_END)) {
- chunk |= ROW_END;
+ chunk |= ROW_END;
usage_row_draw_resource_ival (previous_time,
finish,
units,
@@ -1246,11 +1246,11 @@ usage_row_draw_assignment (PlannerUsageRow *row,
if (!summary) {
percent_complete = mrp_task_get_percent_complete (task);
-
+
complete_width = floor ((cx2 - cx1) * (percent_complete / 100.0) + 0.5);
complete_x2 = MIN (cx1 + complete_width, rx2);
}
-
+
if (rx1 <= rx2) {
if (complete_width > 0) {
gnome_canvas_set_stipple_origin (item->canvas,
@@ -1308,7 +1308,7 @@ usage_row_draw_assignment (PlannerUsageRow *row,
priv->frame_gc, rx2, cy1, rx2, cy2);
}
}
-
+
rx1 = MAX (cx2 + TEXT_PADDING, 0);
rx2 = MIN (cx2 + TEXT_PADDING + priv->text_width, width);
@@ -1464,7 +1464,7 @@ usage_row_assignment_notify_cb (MrpAssignment *assignment,
if (!recalc_bounds (row)) {
return;
}
-
+
usage_row_geometry_changed (row);
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (row));
}
@@ -1487,7 +1487,7 @@ usage_row_task_notify_cb (MrpTask *task,
if (!recalc_bounds (row)) {
return;
}
-
+
usage_row_geometry_changed (row);
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (row));
}
@@ -1551,7 +1551,7 @@ usage_row_geometry_changed (PlannerUsageRow * row)
if (row->priv->assignment) {
usage_row_update_resources (row);
}
-
+
x1 = row->priv->x;
y1 = row->priv->y;
x2 = x1 + row->priv->width;
@@ -1578,7 +1578,7 @@ usage_row_event (GnomeCanvasItem *item, GdkEvent *event)
canvas_widget = GTK_WIDGET (item->canvas);
chart = g_object_get_data (G_OBJECT (item->canvas), "chart");
tree = planner_usage_chart_get_view (chart);
-
+
switch (event->type) {
case GDK_BUTTON_PRESS:
if (priv->assignment != NULL) {
@@ -1597,10 +1597,10 @@ usage_row_event (GnomeCanvasItem *item, GdkEvent *event)
tree_view = GTK_TREE_VIEW (tree);
selection = gtk_tree_view_get_selection (tree_view);
-
- gtk_tree_model_get_iter (gtk_tree_view_get_model (tree_view),
+
+ gtk_tree_model_get_iter (gtk_tree_view_get_model (tree_view),
&iter, path);
-
+
if (!gtk_tree_selection_iter_is_selected (selection, &iter)) {
gtk_tree_selection_unselect_all (selection);
gtk_tree_selection_select_path (selection, path);
@@ -1615,16 +1615,16 @@ usage_row_event (GnomeCanvasItem *item, GdkEvent *event)
}
else if (priv->resource != NULL) {
planner_usage_tree_edit_resource (tree);
- }
+ }
}
break;
-
+
default:
break;
}
-
-
+
+
if (TRUE) {
return TRUE;
diff --git a/src/planner-usage-row.h b/src/planner-usage-row.h
index 69e8ba9..ce595f4 100644
--- a/src/planner-usage-row.h
+++ b/src/planner-usage-row.h
@@ -57,4 +57,3 @@ void planner_usage_row_set_visible (PlannerUsageRow *row,
#endif /* __PLANNER_USAGE_ROW_H__ */
-
diff --git a/src/planner-usage-tree.c b/src/planner-usage-tree.c
index 0108b25..8c0bea3 100644
--- a/src/planner-usage-tree.c
+++ b/src/planner-usage-tree.c
@@ -260,7 +260,7 @@ usage_tree_drag_drop_cb (GtkWidget *widget,
guint time)
{
g_signal_stop_emission_by_name (widget, "drag_drop");
-
+
return FALSE;
}
@@ -550,13 +550,13 @@ usage_tree_tree_view_popup_menu (GtkWidget *widget,
gint x, y;
tv = GTK_TREE_VIEW (tree);
-
+
gtk_tree_view_get_cursor (tv, &path, &column);
gtk_tree_view_get_cell_area (tv,
path,
column,
&rect);
-
+
x = rect.x;
y = rect.y;
@@ -573,7 +573,7 @@ usage_tree_tree_view_popup_menu (GtkWidget *widget,
/* Offset so it's not overlapping the cell. */
rect.x = x + 20;
rect.y = y + 20;
-
+
gtk_item_factory_popup (tree->priv->popup_factory,
rect.x, rect.y,
0,
diff --git a/src/planner-usage-view.c b/src/planner-usage-view.c
index eb143a5..5305795 100644
--- a/src/planner-usage-view.c
+++ b/src/planner-usage-view.c
@@ -40,7 +40,7 @@ struct _PlannerUsageViewPriv {
PlannerUsageChart *chart;
/*PlannerUsagePrintData *print_data;*/
-
+
GtkUIManager *ui_manager;
GtkActionGroup *actions;
guint merged_id;
@@ -124,7 +124,7 @@ usage_view_chart_scroll_event (GtkWidget * gki, GdkEventScroll * event, PlannerV
{
gboolean can_in, can_out;
PlannerUsageViewPriv *priv;
-
+
if (event->state & GDK_CONTROL_MASK) {
priv = PLANNER_USAGE_VIEW (view)->priv;
planner_usage_chart_can_zoom (priv->chart, &can_in, &can_out);
@@ -239,11 +239,11 @@ static const gchar *
usage_view_get_icon (PlannerView *view)
{
static gchar *filename = NULL;
-
+
if (!filename) {
filename = mrp_paths_get_image_dir ("resources_usage.png");
}
-
+
return filename;
}
@@ -338,7 +338,7 @@ usage_view_edit_columns_cb (GtkAction *action,
{
PlannerUsageView *view;
PlannerUsageViewPriv *priv;
-
+
view = PLANNER_USAGE_VIEW (data);
priv = view->priv;
@@ -446,7 +446,7 @@ usage_view_create_widget (PlannerView *view)
chart = planner_usage_chart_new_with_model (GTK_TREE_MODEL (model));
priv->chart = PLANNER_USAGE_CHART (chart);
- planner_usage_chart_set_view (PLANNER_USAGE_CHART (priv->chart),
+ planner_usage_chart_set_view (PLANNER_USAGE_CHART (priv->chart),
PLANNER_USAGE_TREE (priv->tree));
gtk_widget_set_events (GTK_WIDGET (priv->chart), GDK_SCROLL_MASK);
@@ -468,12 +468,12 @@ usage_view_create_widget (PlannerView *view)
gtk_paned_add2 (GTK_PANED (hpaned), right_frame);
usage_view_load_columns (PLANNER_USAGE_VIEW (view));
-
+
g_signal_connect (tree,
"columns-changed",
G_CALLBACK (usage_view_tree_view_columns_changed_cb),
view);
-
+
g_signal_connect (tree,
"destroy",
G_CALLBACK (usage_view_tree_view_destroy_cb),
@@ -509,7 +509,7 @@ usage_view_create_widget (PlannerView *view)
"style_set",
G_CALLBACK (usage_view_tree_style_set_cb),
view);
-
+
gtk_tree_view_expand_all (GTK_TREE_VIEW (tree));
planner_usage_chart_expand_all (PLANNER_USAGE_CHART (chart));
@@ -543,7 +543,7 @@ usage_view_update_row_and_header_height (PlannerView *view)
tv = GTK_TREE_VIEW (PLANNER_USAGE_VIEW (view)->priv->tree);
chart = PLANNER_USAGE_VIEW (view)->priv->chart;
-
+
/* Get the row and header heights. */
cols = gtk_tree_view_get_columns (tv);
row_height = 0;
@@ -594,7 +594,7 @@ usage_view_expose_cb (GtkWidget *widget,
g_signal_handler_disconnect (view->priv->tree,
view->priv->expose_id);
-
+
return FALSE;
}
@@ -650,7 +650,7 @@ usage_view_project_loaded_cb (MrpProject *project, PlannerView *view)
if (project == priv->project) {
/* FIXME: Due to the above, we have this hack. */
planner_usage_chart_setup_root_task (priv->chart);
-
+
gtk_tree_view_expand_all (GTK_TREE_VIEW (priv->tree));
planner_usage_chart_expand_all (priv->chart);
return;
@@ -666,7 +666,7 @@ usage_view_project_loaded_cb (MrpProject *project, PlannerView *view)
"expose_event",
G_CALLBACK (usage_view_expose_cb),
view);
-
+
g_object_unref (model);
gtk_tree_view_expand_all (GTK_TREE_VIEW (priv->tree));
@@ -729,13 +729,13 @@ usage_view_update_zoom_sensitivity (PlannerView *view)
gboolean in, out;
priv = PLANNER_USAGE_VIEW (view)->priv;
-
+
planner_usage_chart_can_zoom (priv->chart, &in, &out);
g_object_set (gtk_action_group_get_action (
GTK_ACTION_GROUP (priv->actions),
"ZoomIn"),
- "sensitive", in,
+ "sensitive", in,
NULL);
g_object_set (gtk_action_group_get_action (
@@ -751,7 +751,7 @@ usage_view_save_columns (PlannerUsageView *view)
PlannerUsageViewPriv *priv;
priv = view->priv;
-
+
planner_view_column_save_helper (PLANNER_VIEW (view),
GTK_TREE_VIEW (priv->tree));
}
@@ -764,13 +764,13 @@ usage_view_load_columns (PlannerUsageView *view)
GtkTreeViewColumn *column;
const gchar *id;
gint i;
-
+
priv = view->priv;
/* Load the columns. */
planner_view_column_load_helper (PLANNER_VIEW (view),
GTK_TREE_VIEW (priv->tree));
-
+
/* Make things a bit more robust by setting defaults if we don't get any
* visible columns. Should be done through a schema instead (but we'll
* keep this since a lot of people get bad installations when installing
@@ -783,7 +783,7 @@ usage_view_load_columns (PlannerUsageView *view)
i++;
}
}
-
+
if (i == 0) {
for (l = columns; l; l = l->next) {
column = l->data;
@@ -796,11 +796,11 @@ usage_view_load_columns (PlannerUsageView *view)
if (!id) {
continue;
}
-
+
gtk_tree_view_column_set_visible (column, TRUE);
}
}
-
+
g_list_free (columns);
}
diff --git a/src/planner-util-win32.c b/src/planner-util-win32.c
index 552de13..391a89b 100644
--- a/src/planner-util-win32.c
+++ b/src/planner-util-win32.c
@@ -58,7 +58,7 @@ planner_util_show_help (GError **error)
res = (int) ShellExecute (NULL, "open", file, NULL, NULL, SW_SHOWNORMAL);
g_free (file);
g_free (path);
-
+
if (res <= 32) {
g_set_error (error,
planner_win32_get_quark (),
diff --git a/src/planner-view.c b/src/planner-view.c
index fb536d2..7f0e142 100644
--- a/src/planner-view.c
+++ b/src/planner-view.c
@@ -43,7 +43,7 @@ planner_view_get_label (PlannerView *view)
if (PLANNER_VIEW_GET_CLASS (view)->get_label) {
return PLANNER_VIEW_GET_CLASS (view)->get_label (view);
}
-
+
return NULL;
}
@@ -114,7 +114,7 @@ planner_view_activate (PlannerView *view)
g_return_if_fail (PLANNER_IS_VIEW (view));
view->activated = TRUE;
-
+
if (PLANNER_VIEW_GET_CLASS (view)->activate) {
PLANNER_VIEW_GET_CLASS (view)->activate (view);
}
@@ -148,11 +148,11 @@ gint
planner_view_print_get_n_pages (PlannerView *view)
{
g_return_val_if_fail (PLANNER_IS_VIEW (view), 0);
-
+
if (PLANNER_VIEW_GET_CLASS (view)->print_get_n_pages) {
return PLANNER_VIEW_GET_CLASS (view)->print_get_n_pages (view);
}
-
+
return 0;
}
@@ -251,7 +251,7 @@ planner_view_column_load_helper (PlannerView *view,
column,
l->prev ? l->prev->data : NULL);
}
-
+
g_list_free (columns);
}
@@ -264,7 +264,7 @@ planner_view_column_save_helper (PlannerView *view,
const gchar *id;
gchar *key;
gint i;
-
+
columns = gtk_tree_view_get_columns (tree);
for (i = 0, l = columns; l; i++, l = l->next) {
column = l->data;
@@ -289,7 +289,7 @@ planner_view_column_save_helper (PlannerView *view,
planner_view_get_name (view), id);
planner_conf_set_int (key, i, NULL);
g_free (key);
-
+
key = g_strdup_printf ("/%s/columns/%s/width",
planner_view_get_name (view), id);
planner_conf_set_int (key,
diff --git a/src/planner-view.h b/src/planner-view.h
index a2b28ee..d2e0374 100644
--- a/src/planner-view.h
+++ b/src/planner-view.h
@@ -54,11 +54,11 @@ struct _PlannerViewClass {
PlannerWindow *window);
void (*activate) (PlannerView *view);
void (*deactivate) (PlannerView *view);
-
+
void (*print_init) (PlannerView *view,
PlannerPrintJob *job);
gint (*print_get_n_pages) (PlannerView *view);
- void (*print) (PlannerView *view,
+ void (*print) (PlannerView *view,
gint page_nr);
void (*print_cleanup) (PlannerView *view);
diff --git a/src/planner-window.c b/src/planner-window.c
index 40e1b9c..9af4bad 100644
--- a/src/planner-window.c
+++ b/src/planner-window.c
@@ -198,7 +198,7 @@ static void window_connect_proxy_cb (GtkUIManager *manager,
GtkWidget *proxy,
PlannerWindow *window);
-static void handle_links (GtkAboutDialog *about G_GNUC_UNUSED,
+static void handle_links (GtkAboutDialog *about G_GNUC_UNUSED,
const gchar *link,
gpointer data);
@@ -216,14 +216,14 @@ static void handle_links (GtkAboutDialog *about G_GNUC_UNUSED,
#define VIEW_PATH "/menu/View/Views placeholder"
#define VIEW_GROUP "view group"
-
+
static GtkWindowClass *parent_class = NULL;
static guint signals[LAST_SIGNAL];
static GtkActionEntry entries[] = {
{ "File",
- NULL, N_("_File"), NULL, NULL,
+ NULL, N_("_File"), NULL, NULL,
NULL
},
{ "FileNew",
@@ -261,7 +261,7 @@ static GtkActionEntry entries[] = {
{ "FileExit",
GTK_STOCK_QUIT, N_("_Quit"), "<Control>q", N_("Exit the program"),
G_CALLBACK (window_exit_cb) },
-
+
{ "Edit",
NULL, N_("_Edit"), NULL, NULL,
NULL },
@@ -271,15 +271,15 @@ static GtkActionEntry entries[] = {
{ "EditRedo",
GTK_STOCK_REDO, N_("_Redo"), "<Control>r", N_("Redo the undone action"),
G_CALLBACK (window_redo_cb) },
-
+
{ "View",
NULL, N_("_View"), NULL, NULL,
NULL },
-
+
{ "Actions",
NULL, N_("_Actions"), NULL, NULL,
NULL },
-
+
{ "Project",
NULL, N_("_Project"), NULL, NULL,
NULL },
@@ -295,11 +295,11 @@ static GtkActionEntry entries[] = {
{ "EditProjectProps",
GTK_STOCK_PROPERTIES, N_("_Edit Project Properties"), NULL, N_("Edit the project properties"),
G_CALLBACK (window_project_props_cb) },
-
+
/* { "PreferencesEditPreferences",
NULL, NULL, NULL, NULL,
G_CALLBACK (window_preferences_cb) },*/
-
+
{ "Help",
NULL, N_("_Help"), NULL, NULL,
NULL },
@@ -335,7 +335,7 @@ planner_window_get_type (void)
type = g_type_register_static (GTK_TYPE_WINDOW,
"PlannerWindow", &info, 0);
}
-
+
return type;
}
@@ -343,7 +343,7 @@ static void
window_class_init (PlannerWindowClass *klass)
{
GObjectClass *o_class;
-
+
parent_class = g_type_class_peek_parent (klass);
o_class = (GObjectClass *) klass;
@@ -380,7 +380,7 @@ window_init (PlannerWindow *window)
"drag_data_received",
G_CALLBACK (window_drag_data_received_cb),
window);
-
+
priv->cmd_manager = planner_cmd_manager_new ();
g_signal_connect (priv->cmd_manager,
@@ -439,8 +439,8 @@ planner_window_open_recent_cb (GtkAction *action,
}
static void
-window_add_widget (GtkUIManager *merge,
- GtkWidget *widget,
+window_add_widget (GtkUIManager *merge,
+ GtkWidget *widget,
PlannerWindow *window)
{
PlannerWindowPriv *priv;
@@ -458,7 +458,7 @@ window_add_stock_icon (GtkIconFactory *icon_factory,
gchar *path;
GdkPixbuf *pixbuf;
GtkIconSet *icon_set;
-
+
path = mrp_paths_get_image_dir (filename);
pixbuf = gdk_pixbuf_new_from_file (path, NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
@@ -475,40 +475,40 @@ window_add_stock_icons (void)
if (icon_factory) {
return;
}
-
+
icon_factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (icon_factory);
/* Task/Gantt icons. */
- window_add_stock_icon (icon_factory,
+ window_add_stock_icon (icon_factory,
"planner-stock-insert-task",
"24_insert_task.png");
-
- window_add_stock_icon (icon_factory,
+
+ window_add_stock_icon (icon_factory,
"planner-stock-remove-task",
"24_remove_task.png");
-
- window_add_stock_icon (icon_factory,
+
+ window_add_stock_icon (icon_factory,
"planner-stock-unlink-task",
"24_unlink_task.png");
-
- window_add_stock_icon (icon_factory,
+
+ window_add_stock_icon (icon_factory,
"planner-stock-link-task",
"24_link_task.png");
-
- window_add_stock_icon (icon_factory,
+
+ window_add_stock_icon (icon_factory,
"planner-stock-indent-task",
"24_indent_task.png");
-
- window_add_stock_icon (icon_factory,
+
+ window_add_stock_icon (icon_factory,
"planner-stock-unindent-task",
"24_unindent_task.png");
-
- window_add_stock_icon (icon_factory,
+
+ window_add_stock_icon (icon_factory,
"planner-stock-move-task-up",
"24_task_up.png");
-
- window_add_stock_icon (icon_factory,
+
+ window_add_stock_icon (icon_factory,
"planner-stock-move-task-down",
"24_task_down.png");
@@ -516,7 +516,7 @@ window_add_stock_icons (void)
window_add_stock_icon (icon_factory,
"planner-stock-insert-resource",
"/24_insert_resource.png");
-
+
window_add_stock_icon (icon_factory,
"planner-stock-remove-resource",
"24_remove_resource.png");
@@ -524,7 +524,7 @@ window_add_stock_icons (void)
window_add_stock_icon (icon_factory,
"planner-stock-edit-resource",
"24_edit_resource.png");
-
+
window_add_stock_icon (icon_factory,
"planner-stock-edit-groups",
"24_groups.png");
@@ -555,9 +555,9 @@ window_populate (PlannerWindow *window)
"</ui>";
priv = window->priv;
-
+
window_add_stock_icons ();
-
+
priv->ui_box = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), priv->ui_box);
@@ -579,7 +579,7 @@ window_populate (PlannerWindow *window)
"disconnect_proxy",
G_CALLBACK (window_disconnect_proxy_cb),
window);
-
+
gtk_ui_manager_insert_action_group (priv->ui_manager, priv->actions, 0);
gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_ui_manager_get_accel_group (priv->ui_manager));
@@ -591,18 +591,18 @@ window_populate (PlannerWindow *window)
g_free (filename);
g_object_set (gtk_action_group_get_action (priv->actions, "EditUndo"),
- "sensitive", FALSE,
+ "sensitive", FALSE,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "EditRedo"),
- "sensitive", FALSE,
+ "sensitive", FALSE,
NULL);
g_object_set (gtk_action_group_get_action (priv->actions, "FileSave"),
- "sensitive", FALSE,
+ "sensitive", FALSE,
NULL);
/* Make the Actions menu always visible even when empty. */
g_object_set (gtk_action_group_get_action (priv->actions, "Actions"),
- "hide-if-empty", FALSE,
+ "hide-if-empty", FALSE,
NULL);
/* Handle recent file stuff. */
@@ -620,15 +620,15 @@ window_populate (PlannerWindow *window)
hbox = gtk_hbox_new (FALSE, 0);
priv->sidebar = planner_sidebar_new ();
- gtk_box_pack_start (GTK_BOX (hbox), priv->sidebar, FALSE, TRUE, 0);
- g_signal_connect (priv->sidebar,
+ gtk_box_pack_start (GTK_BOX (hbox), priv->sidebar, FALSE, TRUE, 0);
+ g_signal_connect (priv->sidebar,
"icon-selected",
G_CALLBACK (window_view_selected),
window);
priv->notebook = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), priv->notebook, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), priv->notebook, TRUE, TRUE, 0);
priv->statusbar = gtk_statusbar_new ();
gtk_box_pack_end (GTK_BOX (priv->ui_box), priv->statusbar, FALSE, TRUE, 0);
@@ -645,7 +645,7 @@ window_populate (PlannerWindow *window)
priv->views = g_list_append (priv->views, planner_task_view_new ());
priv->views = g_list_append (priv->views, planner_resource_view_new ());
priv->views = g_list_append (priv->views, planner_usage_view_new ());
-
+
view_num = 0;
xml_string = g_strdup ("");
r_entries = g_new0 (GtkRadioActionEntry, g_list_length (priv->views));
@@ -653,7 +653,7 @@ window_populate (PlannerWindow *window)
view = l->data;
planner_view_setup (view, window);
-
+
view_widget = planner_view_get_widget (view);
gtk_widget_show (view_widget);
@@ -690,7 +690,7 @@ window_populate (PlannerWindow *window)
gtk_ui_manager_add_ui_from_string (priv->ui_manager, xml_string_tmp, -1, NULL);
g_free (xml_string);
g_free (xml_string_tmp);
-
+
gtk_ui_manager_ensure_update (priv->ui_manager);
/* Load plugins. */
@@ -704,20 +704,20 @@ window_populate (PlannerWindow *window)
view_num = 0;
for (l = priv->views; l; l = l->next, view_num++ ) {
view = l->data;
-
+
if (strcmp (str, planner_view_get_name (view)) == 0) {
found = TRUE;
break;
- }
+ }
}
if (!found) {
view_num = 0;
}
-
+
window_view_selected (PLANNER_SIDEBAR (priv->sidebar), view_num, window);
g_free (str);
- } else {
+ } else {
window_view_selected (PLANNER_SIDEBAR (priv->sidebar), 0, window);
}
}
@@ -733,7 +733,7 @@ window_view_selected (PlannerSidebar *sidebar,
GtkAction *action;
priv = window->priv;
-
+
list = g_list_nth (priv->views, index);
if (list != NULL) {
view = list->data;
@@ -744,7 +744,7 @@ window_view_selected (PlannerSidebar *sidebar,
if (view == priv->current_view) {
return;
}
-
+
if (priv->current_view != NULL) {
planner_view_deactivate (priv->current_view);
}
@@ -758,13 +758,13 @@ window_view_selected (PlannerSidebar *sidebar,
g_signal_handlers_block_by_func (sidebar, window_view_selected, window);
planner_sidebar_set_active (PLANNER_SIDEBAR (sidebar), index);
g_signal_handlers_unblock_by_func (sidebar, window_view_selected, window);
-
+
action = gtk_action_group_get_action (priv->view_actions,
planner_view_get_name (view));
if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) ) {
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
}
-
+
priv->current_view = view;
planner_conf_set_string (CONF_ACTIVE_VIEW, planner_view_get_name (view), NULL);
@@ -794,7 +794,7 @@ window_new_cb (GtkAction *action,
PlannerWindow *window;
PlannerWindowPriv *priv;
GtkWidget *new_window;
-
+
window = PLANNER_WINDOW (data);
priv = window->priv;
@@ -807,15 +807,15 @@ get_last_dir (PlannerWindow *window)
{
PlannerWindowPriv *priv;
gchar *last_dir;
-
+
priv = window->priv;
-
+
last_dir = planner_conf_get_string (CONF_LAST_DIR, NULL);
-
+
if (last_dir == NULL) {
last_dir = g_strdup (g_get_home_dir ());
}
-
+
return last_dir;
}
@@ -841,7 +841,7 @@ window_open_cb (GtkAction *action,
NULL);
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (file_chooser), TRUE);
-
+
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("Planner Files"));
gtk_file_filter_add_pattern (filter, "*.planner");
@@ -880,7 +880,7 @@ window_open_cb (GtkAction *action,
g_free (last_dir);
}
}
-
+
for (l = uris; l; l = l->next) {
planner_window_open_in_existing_or_new (window, l->data, FALSE);
}
@@ -888,7 +888,7 @@ window_open_cb (GtkAction *action,
g_slist_foreach (uris, (GFunc) g_free, NULL);
g_slist_free (uris);
}
-
+
gtk_widget_destroy (file_chooser);
}
@@ -922,7 +922,7 @@ window_page_setup_cb (GtkAction *action,
PlannerWindowPriv *priv;
GtkPageSetup *old_page_setup, *new_page_setup;
GtkPrintSettings *settings;
-
+
window = PLANNER_WINDOW (data);
priv = window->priv;
@@ -976,24 +976,24 @@ window_print_cb (GtkAction *action,
print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
} else {
print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
- }
-
+ }
+
res = gtk_print_operation_run (print, print_action, GTK_WINDOW (window), &error);
if (res == GTK_PRINT_OPERATION_RESULT_ERROR) {
GtkWidget *dialog;
-
+
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s", error->message);
g_error_free (error);
-
+
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_widget_show (dialog);
+
+ gtk_widget_show (dialog);
}
else if (res == GTK_PRINT_OPERATION_RESULT_APPLY) {
settings = gtk_print_operation_get_print_settings (print);
@@ -1011,15 +1011,15 @@ window_close_cb (GtkAction *action,
}
static void
-window_exit_cb (GtkAction *action,
+window_exit_cb (GtkAction *action,
gpointer data)
{
PlannerWindow *window;
PlannerWindowPriv *priv;
-
+
window = PLANNER_WINDOW (data);
priv = window->priv;
-
+
planner_application_exit (priv->application);
}
@@ -1033,7 +1033,7 @@ window_redo_cb (GtkAction *action,
window = PLANNER_WINDOW (data);
priv = window->priv;
-
+
planner_cmd_manager_redo (priv->cmd_manager);
}
@@ -1057,10 +1057,10 @@ window_project_props_cb (GtkAction *action,
{
PlannerWindow *window;
PlannerWindowPriv *priv;
-
+
window = PLANNER_WINDOW (data);
priv = window->priv;
-
+
if (priv->properties_dialog) {
gtk_window_present (GTK_WINDOW (priv->properties_dialog));
} else {
@@ -1078,7 +1078,7 @@ window_manage_calendars_cb (GtkAction *action,
gpointer data)
{
PlannerWindow *window;
-
+
window = PLANNER_WINDOW (data);
planner_window_show_calendar_dialog (window);
@@ -1089,7 +1089,7 @@ window_edit_day_types_cb (GtkAction *action,
gpointer data)
{
PlannerWindow *window;
-
+
window = PLANNER_WINDOW (data);
planner_window_show_day_type_dialog (window);
@@ -1101,29 +1101,29 @@ window_edit_phases_cb (GtkAction *action,
{
PlannerWindow *window;
PlannerWindowPriv *priv;
-
+
window = PLANNER_WINDOW (data);
priv = window->priv;
-
+
if (priv->phase_dialog) {
gtk_window_present (GTK_WINDOW (priv->phase_dialog));
} else {
priv->phase_dialog = planner_phase_dialog_new (window);
-
+
g_object_add_weak_pointer (G_OBJECT (priv->phase_dialog),
(gpointer) &priv->phase_dialog);
-
+
gtk_widget_show (priv->phase_dialog);
}
}
static void
-window_help_cb (GtkAction *action,
+window_help_cb (GtkAction *action,
gpointer data)
{
GError *error = NULL;
GtkWidget *dialog;
-
+
if (!planner_util_show_help (&error)) {
dialog = gtk_message_dialog_new (GTK_WINDOW (data),
GTK_DIALOG_MODAL |
@@ -1140,7 +1140,7 @@ window_help_cb (GtkAction *action,
}
static void
-handle_links (GtkAboutDialog *about,
+handle_links (GtkAboutDialog *about,
const gchar *link,
gpointer data)
{
@@ -1156,13 +1156,13 @@ handle_links (GtkAboutDialog *about,
default:
g_assert_not_reached ();
}
-
+
planner_util_show_url (newlink, NULL);
g_free (newlink);
}
static void
-window_about_cb (GtkAction *action,
+window_about_cb (GtkAction *action,
gpointer data)
{
PlannerWindow *window;
@@ -1185,21 +1185,21 @@ window_about_cb (GtkAction *action,
* are more than one, to appear in the about box.
*/
const gchar *translator_credits = N_("translator-credits");
-
+
window = PLANNER_WINDOW (data);
-
+
filename = mrp_paths_get_image_dir ("gnome-planner.png");
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
g_free (filename);
-
- gtk_about_dialog_set_email_hook ((GtkAboutDialogActivateLinkFunc) handle_links,
+
+ gtk_about_dialog_set_email_hook ((GtkAboutDialogActivateLinkFunc) handle_links,
GINT_TO_POINTER (LINK_TYPE_EMAIL), NULL);
-
- gtk_about_dialog_set_url_hook ((GtkAboutDialogActivateLinkFunc) handle_links,
+
+ gtk_about_dialog_set_url_hook ((GtkAboutDialogActivateLinkFunc) handle_links,
GINT_TO_POINTER (LINK_TYPE_URL), NULL);
-
+
gtk_show_about_dialog (GTK_WINDOW (window),
- "name", "Planner",
+ "name", "Planner",
"version", VERSION,
"comments", _("A Project Management application for the GNOME desktop"),
"authors", authors,
@@ -1211,7 +1211,7 @@ window_about_cb (GtkAction *action,
"website-label", _("The Planner Homepage"),
"logo", pixbuf,
NULL);
-
+
if (pixbuf != NULL) {
gdk_pixbuf_unref (pixbuf);
}
@@ -1238,7 +1238,7 @@ window_drag_data_received_cb (GtkWidget *widget,
PlannerWindowPriv *priv;
gchar **uris;
gint i;
-
+
priv = window->priv;
if (data->length < 0 || data->format != 8) {
@@ -1246,7 +1246,7 @@ window_drag_data_received_cb (GtkWidget *widget,
gtk_drag_finish (context, FALSE, FALSE, time);
return;
}
-
+
uris = g_uri_list_extract_uris (data->data);
i = 0;
@@ -1254,7 +1254,7 @@ window_drag_data_received_cb (GtkWidget *widget,
planner_window_open_in_existing_or_new (window, uris[i], FALSE);
i++;
}
-
+
g_strfreev (uris);
gtk_drag_finish (context, TRUE, FALSE, time);
@@ -1294,9 +1294,9 @@ window_redo_state_changed_cb (PlannerCmdManager *manager,
PlannerWindowPriv *priv;
GtkWidget *widget;
GtkWidget *label;
-
+
priv = window->priv;
-
+
g_object_set (gtk_action_group_get_action (priv->actions, "EditRedo"),
"sensitive", state,
NULL);
@@ -1316,16 +1316,16 @@ window_project_needs_saving_changed_cb (MrpProject *project,
PlannerWindow *window)
{
PlannerWindowPriv *priv;
-
+
priv = window->priv;
-
+
if (needs_saving) {
g_timer_reset (priv->last_saved);
}
g_object_set (gtk_action_group_get_action (priv->actions, "FileSave"),
- "sensitive", needs_saving,
- NULL);
+ "sensitive", needs_saving,
+ NULL);
}
static void
@@ -1350,7 +1350,7 @@ window_confirm_exit_run (PlannerWindow *window)
gchar *tmp;
const gchar *uri;
gboolean is_sql = FALSE;
-
+
priv = window->priv;
minutes = (gint) (g_timer_elapsed (priv->last_saved, NULL) / 60);
@@ -1364,7 +1364,7 @@ window_confirm_exit_run (PlannerWindow *window)
"the last minute will be discarded."));
}
else if (hours == 0) {
- time_str =
+ time_str =
g_strdup_printf (ngettext(
"If you don't save, changes made "
"the last %d minute will be "
@@ -1378,7 +1378,7 @@ window_confirm_exit_run (PlannerWindow *window)
"the last hour will be "
"discarded."));
} else {
- time_str =
+ time_str =
g_strdup_printf (ngettext("If you don't save, changes made "
"the last %d hour will be "
"discarded.",
@@ -1388,9 +1388,9 @@ window_confirm_exit_run (PlannerWindow *window)
}
name = window_get_name (window);
-
+
tmp = g_strdup_printf (_("Save changes to document '%s' before closing?"), name);
-
+
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -1400,7 +1400,7 @@ window_confirm_exit_run (PlannerWindow *window)
g_free (name);
g_free (time_str);
g_free (tmp);
-
+
g_object_set (GTK_MESSAGE_DIALOG (dialog)->label,
"use-markup", TRUE,
"wrap", FALSE,
@@ -1412,8 +1412,8 @@ window_confirm_exit_run (PlannerWindow *window)
/* Hack. */
is_sql = TRUE;
}
-
- quit_button = window_create_dialog_button (GTK_STOCK_QUIT,
+
+ quit_button = window_create_dialog_button (GTK_STOCK_QUIT,
_("C_lose without saving"));
gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
quit_button,
@@ -1433,11 +1433,11 @@ window_confirm_exit_run (PlannerWindow *window)
GTK_RESPONSE_YES);
gtk_widget_grab_focus (save_button);
}
-
+
gtk_widget_show_all (dialog);
ret = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
-
+
switch (ret) {
case GTK_RESPONSE_NO: /* Don't save */
return TRUE;
@@ -1463,9 +1463,9 @@ window_do_save (PlannerWindow *window, gboolean force)
const gchar *uri = NULL;
GError *error = NULL;
gint response;
-
+
priv = window->priv;
-
+
uri = mrp_project_get_uri (priv->project);
if (uri == NULL) {
@@ -1480,10 +1480,10 @@ window_do_save (PlannerWindow *window, gboolean force)
GTK_MESSAGE_WARNING,
GTK_BUTTONS_YES_NO,
error->message);
-
+
response = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
-
+
if (response == GTK_RESPONSE_YES) {
return window_do_save (window, TRUE);
}
@@ -1496,14 +1496,14 @@ window_do_save (PlannerWindow *window, gboolean force)
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
error->message);
-
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
-
+
return FALSE;
}
}
-
+
return TRUE;
}
@@ -1532,27 +1532,27 @@ window_do_save_as (PlannerWindow *window)
last_dir = get_last_dir (window);
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (file_chooser), last_dir);
g_free (last_dir);
-
+
response = gtk_dialog_run (GTK_DIALOG (file_chooser));
if (response == GTK_RESPONSE_OK) {
filename = gtk_file_chooser_get_filename (
GTK_FILE_CHOOSER (file_chooser));
}
-
+
gtk_widget_destroy (file_chooser);
if (filename != NULL) {
gboolean success;
GError *error = NULL;
-
+
/* Save the file. */
- success = mrp_project_save_as (window->priv->project, filename,
+ success = mrp_project_save_as (window->priv->project, filename,
FALSE, &error);
if (!success && error->code == MRP_ERROR_SAVE_FILE_EXIST) {
GtkWidget *dialog;
gint ret;
-
+
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
@@ -1561,15 +1561,15 @@ window_do_save_as (PlannerWindow *window)
error->message);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
-
+
ret = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
-
+
switch (ret) {
case GTK_RESPONSE_YES:
- success = mrp_project_save_as (priv->project,
+ success = mrp_project_save_as (priv->project,
filename,
- TRUE,
+ TRUE,
&error);
break;
case GTK_RESPONSE_NO:
@@ -1589,7 +1589,7 @@ window_do_save_as (PlannerWindow *window)
egg_recent_item_unref (item);
} else {
GtkWidget *dialog;
-
+
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
@@ -1606,7 +1606,7 @@ window_do_save_as (PlannerWindow *window)
g_free (last_dir);
g_free (filename);
-
+
return TRUE;
} else {
return FALSE;
@@ -1628,14 +1628,14 @@ window_create_dialog_button (const gchar *icon_name, const gchar *text)
label = gtk_label_new_with_mnemonic (text);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button));
-
+
hbox = gtk_hbox_new (FALSE, 2);
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-
+
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
+
gtk_container_add (GTK_CONTAINER (button), align);
gtk_container_add (GTK_CONTAINER (align), hbox);
gtk_widget_show_all (align);
@@ -1648,16 +1648,16 @@ planner_window_new (PlannerApplication *application)
{
PlannerWindow *window;
PlannerWindowPriv *priv;
-
+
window = g_object_new (PLANNER_TYPE_WINDOW, NULL);
priv = window->priv;
priv->application = g_object_ref (application);
-
+
priv->project = mrp_project_new (MRP_APPLICATION (application));
priv->last_saved = g_timer_new ();
-
+
g_signal_connect (priv->project, "needs_saving_changed",
G_CALLBACK (window_project_needs_saving_changed_cb),
window);
@@ -1665,10 +1665,10 @@ planner_window_new (PlannerApplication *application)
g_signal_connect (priv->project, "notify::name",
G_CALLBACK (window_project_notify_name_cb),
window);
-
+
window_restore_state (window);
- g_signal_connect (window, "delete_event",
+ g_signal_connect (window, "delete_event",
G_CALLBACK (window_delete_event_cb),
NULL);
@@ -1687,12 +1687,12 @@ planner_window_open (PlannerWindow *window,
GError *error = NULL;
GtkWidget *dialog;
EggRecentItem *item;
-
+
g_return_val_if_fail (PLANNER_IS_WINDOW (window), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
priv = window->priv;
-
+
if (!mrp_project_load (priv->project, uri, &error)) {
dialog = gtk_message_dialog_new (
GTK_WINDOW (window),
@@ -1704,7 +1704,7 @@ planner_window_open (PlannerWindow *window,
gtk_widget_destroy (dialog);
return FALSE;
- }
+ }
planner_window_check_version (window);
@@ -1714,10 +1714,10 @@ planner_window_open (PlannerWindow *window,
egg_recent_item_set_mime_type (item, "application/x-planner");
egg_recent_model_add_full (planner_application_get_recent_model (priv->application), item);
egg_recent_item_unref (item);
-
+
window_update_title (window);
}
-
+
return TRUE;
}
@@ -1737,7 +1737,7 @@ planner_window_open_in_existing_or_new (PlannerWindow *window,
if (!filename) {
return FALSE;
}
-
+
if (mrp_project_is_empty (priv->project)) {
ret = planner_window_open (window, filename, internal);
g_free (filename);
@@ -1755,7 +1755,7 @@ planner_window_open_in_existing_or_new (PlannerWindow *window,
return FALSE;
}
}
-
+
g_free (filename);
return FALSE;
@@ -1765,7 +1765,7 @@ GtkUIManager *
planner_window_get_ui_manager (PlannerWindow *window)
{
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
-
+
return window->priv->ui_manager;
}
@@ -1773,7 +1773,7 @@ MrpProject *
planner_window_get_project (PlannerWindow *window)
{
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
-
+
return window->priv->project;
}
@@ -1781,7 +1781,7 @@ PlannerApplication *
planner_window_get_application (PlannerWindow *window)
{
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
-
+
return window->priv->application;
}
@@ -1795,10 +1795,10 @@ planner_window_check_version (PlannerWindow *window)
g_return_if_fail (PLANNER_IS_WINDOW (window));
priv = window->priv;
-
+
version = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (priv->project),
"version"));
-
+
if (version == 1) {
dialog = gtk_message_dialog_new (
GTK_WINDOW (window),
@@ -1846,7 +1846,7 @@ window_get_name (PlannerWindow *window)
g_object_get (priv->project, "name", &name, NULL);
if (name == NULL || name[0] == 0) {
g_free (name);
-
+
if (uri == NULL || uri[0] == 0) {
name = g_strdup (_("Unnamed"));
} else {
@@ -1883,7 +1883,7 @@ planner_window_close (PlannerWindow *window)
{
PlannerWindowPriv *priv;
gboolean close = TRUE;
-
+
g_return_if_fail (PLANNER_IS_WINDOW (window));
priv = window->priv;
@@ -1896,7 +1896,7 @@ planner_window_close (PlannerWindow *window)
window_save_state (window);
g_signal_emit (window, signals[CLOSED], 0, NULL);
-
+
gtk_widget_destroy (GTK_WIDGET (window));
}
}
@@ -1905,11 +1905,11 @@ void
planner_window_show_day_type_dialog (PlannerWindow *window)
{
PlannerWindowPriv *priv;
-
+
g_return_if_fail (PLANNER_IS_WINDOW (window));
priv = window->priv;
-
+
if (priv->day_type_dialog) {
gtk_window_present (GTK_WINDOW (priv->day_type_dialog));
} else {
@@ -1926,19 +1926,19 @@ void
planner_window_show_calendar_dialog (PlannerWindow *window)
{
PlannerWindowPriv *priv;
-
+
g_return_if_fail (PLANNER_IS_WINDOW (window));
priv = window->priv;
-
+
if (priv->calendar_dialog) {
gtk_window_present (GTK_WINDOW (priv->calendar_dialog));
} else {
priv->calendar_dialog = planner_calendar_dialog_new (window);
-
+
g_object_add_weak_pointer (G_OBJECT (priv->calendar_dialog),
(gpointer) &priv->calendar_dialog);
-
+
gtk_widget_show (priv->calendar_dialog);
}
}
@@ -1966,7 +1966,7 @@ PlannerCmdManager *
planner_window_get_cmd_manager (PlannerWindow *window)
{
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
-
+
return window->priv->cmd_manager;
}
@@ -2015,11 +2015,11 @@ window_restore_state (PlannerWindow *window)
priv = window->priv;
exists = planner_conf_dir_exists (CONF_WINDOW_DIR, NULL);
-
- if (exists) {
+
+ if (exists) {
maximized = planner_conf_get_bool (CONF_WINDOW_MAXIMIZED,
NULL);
-
+
if (maximized) {
gtk_window_maximize (GTK_WINDOW (window));
} else {
@@ -2035,7 +2035,7 @@ window_restore_state (PlannerWindow *window)
height = DEFAULT_WINDOW_HEIGHT;
}
- gtk_window_set_default_size (GTK_WINDOW (window),
+ gtk_window_set_default_size (GTK_WINDOW (window),
width, height);
x = planner_conf_get_int (CONF_WINDOW_POS_X,
@@ -2074,7 +2074,7 @@ window_menu_item_select_cb (GtkMenuItem *proxy,
action = g_object_get_data (G_OBJECT (proxy), "gtk-action");
g_return_if_fail (action != NULL);
-
+
g_object_get (action, "tooltip", &message, NULL);
if (message) {
gtk_statusbar_push (GTK_STATUSBAR (priv->statusbar), 0, message);
diff --git a/src/planner-window.h b/src/planner-window.h
index 8086864..53aa4fd 100644
--- a/src/planner-window.h
+++ b/src/planner-window.h
@@ -43,7 +43,7 @@ typedef struct _PlannerWindowPriv PlannerWindowPriv;
struct _PlannerWindow {
GtkWindow parent;
-
+
PlannerWindowPriv *priv;
};
diff --git a/src/planner-working-time-dialog.c b/src/planner-working-time-dialog.c
index 6d0d036..81f134d 100644
--- a/src/planner-working-time-dialog.c
+++ b/src/planner-working-time-dialog.c
@@ -50,7 +50,7 @@ typedef struct {
GtkWidget *tree_view;
GtkWidget *apply_button;
-
+
GtkWidget *from_entry[5];
GtkWidget *to_entry[5];
} DialogData;
@@ -146,7 +146,7 @@ working_time_cmd_edit (PlannerWindow *main_window,
working_time_cmd_edit_do,
working_time_cmd_edit_undo,
working_time_cmd_edit_free);
-
+
cmd = (WorkingTimeCmdEdit *) cmd_base;
cmd->calendar = g_object_ref (calendar);
@@ -155,11 +155,11 @@ working_time_cmd_edit (PlannerWindow *main_window,
cmd->ivals = g_list_copy (ivals);
g_list_foreach (ivals, (GFunc) mrp_interval_ref, NULL);
- cmd->old_ivals = g_list_copy (mrp_calendar_day_get_intervals
+ cmd->old_ivals = g_list_copy (mrp_calendar_day_get_intervals
(cmd->calendar, cmd->day, TRUE));
g_list_foreach (cmd->old_ivals, (GFunc) mrp_interval_ref, NULL);
-
- planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
+
+ planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager
(main_window),
cmd_base);
return cmd_base;
@@ -207,9 +207,9 @@ planner_working_time_dialog_new (PlannerWindow *window,
GtkTreeViewColumn *col;
GtkTreeSelection *selection;
gchar *filename;
-
+
g_return_val_if_fail (PLANNER_IS_WINDOW (window), NULL);
-
+
filename = mrp_paths_get_glade_dir ("calendar-dialog.glade");
glade = glade_xml_new (filename,
"working_time_dialog",
@@ -222,7 +222,7 @@ planner_working_time_dialog_new (PlannerWindow *window,
}
dialog = glade_xml_get_widget (glade, "working_time_dialog");
-
+
data = g_new0 (DialogData, 1);
data->main_window = window;
@@ -236,7 +236,7 @@ planner_working_time_dialog_new (PlannerWindow *window,
G_CALLBACK (working_time_dialog_parent_destroy_cb),
dialog,
0);
-
+
g_signal_connect_object (data->project,
"day_added",
G_CALLBACK (working_time_dialog_type_added_cb),
@@ -248,16 +248,16 @@ planner_working_time_dialog_new (PlannerWindow *window,
G_CALLBACK (working_time_dialog_type_removed_cb),
data->dialog,
0);
-
+
data->tree_view = glade_xml_get_widget (glade, "treeview");
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->tree_view));
-
+
g_signal_connect (selection,
"changed",
G_CALLBACK (working_time_dialog_selection_changed_cb),
data);
-
+
/* Get the 5 from/to entries. */
for (i = 0; i < 5; i++) {
gchar *tmp;
@@ -284,12 +284,12 @@ planner_working_time_dialog_new (PlannerWindow *window,
g_object_set_data_full (G_OBJECT (dialog),
"data", data,
g_free);
-
+
model = working_time_dialog_create_model (data);
gtk_tree_view_set_model (GTK_TREE_VIEW (data->tree_view), model);
working_time_dialog_build_list (data);
-
+
cell = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (
NULL,
@@ -297,7 +297,7 @@ planner_working_time_dialog_new (PlannerWindow *window,
"text", COL_NAME,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (data->tree_view), col);
-
+
g_signal_connect (dialog,
"response",
G_CALLBACK (working_time_dialog_response_cb),
@@ -314,11 +314,11 @@ working_time_dialog_build_list (DialogData *data)
GList *days, *l;
MrpDay *day;
const gchar *name;
-
+
store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (data->tree_view)));
gtk_list_store_clear (store);
-
+
day = mrp_day_get_nonwork ();
name = mrp_day_get_name (day);
@@ -341,9 +341,9 @@ working_time_dialog_build_list (DialogData *data)
days = mrp_day_get_all (data->project);
for (l = days; l; l = l->next) {
day = l->data;
-
+
name = mrp_day_get_name (day);
-
+
gtk_list_store_append (store, &iter);
gtk_list_store_set (store,
&iter,
@@ -357,7 +357,7 @@ static GtkTreeModel *
working_time_dialog_create_model (DialogData *data)
{
GtkListStore *store;
-
+
store = gtk_list_store_new (NUM_COLS,
G_TYPE_STRING,
G_TYPE_INT,
@@ -415,7 +415,7 @@ working_time_dialog_find_day_foreach (GtkTreeModel *model,
data->found_iter = *iter;
return TRUE;
}
-
+
return FALSE;
}
@@ -452,7 +452,7 @@ working_time_dialog_get_selected_day (DialogData *data)
GtkTreeModel *model;
GtkTreeIter iter;
MrpDay *day;
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->tree_view));
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
@@ -475,7 +475,7 @@ working_time_dialog_update_times (DialogData *data)
mrptime start, end;
gint i;
gchar *str;
-
+
day = working_time_dialog_get_selected_day (data);
ivals = mrp_calendar_day_get_intervals (data->calendar, day, TRUE);
@@ -484,16 +484,16 @@ working_time_dialog_update_times (DialogData *data)
gtk_entry_set_text (GTK_ENTRY (data->from_entry[i]), "");
gtk_entry_set_text (GTK_ENTRY (data->to_entry[i]), "");
}
-
+
for (l = ivals, i = 0; l && i < 5; l = l->next, i++) {
ival = l->data;
-
+
mrp_interval_get_absolute (ival, 0, &start, &end);
-
+
str = mrp_time_format ("%R", start);
gtk_entry_set_text (GTK_ENTRY (data->from_entry[i]), str);
g_free (str);
-
+
str = mrp_time_format ("%R", end);
gtk_entry_set_text (GTK_ENTRY (data->to_entry[i]), str);
g_free (str);
@@ -524,7 +524,7 @@ working_time_dialog_apply (DialogData *data)
day = working_time_dialog_get_selected_day (data);
/* FIXME: use locale information to get the time separator. See #412. */
-
+
ivals = NULL;
for (i = 0; i < 5; i++) {
str = gtk_entry_get_text (GTK_ENTRY (data->from_entry[i]));
@@ -569,14 +569,14 @@ working_time_dialog_apply (DialogData *data)
*/
end--;
}
-
+
ival = mrp_interval_new (start, end);
ivals = g_list_append (ivals, ival);
}
}
/* mrp_calendar_day_set_intervals (data->calendar, day, ivals); */
- working_time_cmd_edit (data->main_window, data->calendar, day, ivals);
+ working_time_cmd_edit (data->main_window, data->calendar, day, ivals);
g_list_foreach (ivals, (GFunc) mrp_interval_unref, NULL);
g_list_free (ivals);
diff --git a/src/planner-xml-planner-plugin.c b/src/planner-xml-planner-plugin.c
index e87d627..87a7c8c 100644
--- a/src/planner-xml-planner-plugin.c
+++ b/src/planner-xml-planner-plugin.c
@@ -60,12 +60,12 @@ static gchar *
get_last_dir (void)
{
gchar *last_dir;
-
+
last_dir = planner_conf_get_string (CONF_MAIN_LAST_XML_EXPORT_DIR, NULL);
if (last_dir == NULL) {
last_dir = g_strdup (g_get_home_dir ());
}
-
+
return last_dir;
}
@@ -98,7 +98,7 @@ xml_planner_plugin_export (GtkAction *action,
last_dir = get_last_dir ();
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (file_chooser), last_dir);
g_free (last_dir);
-
+
response = gtk_dialog_run (GTK_DIALOG (file_chooser));
if (response == GTK_RESPONSE_OK) {
filename = gtk_file_chooser_get_filename (
@@ -106,7 +106,7 @@ xml_planner_plugin_export (GtkAction *action,
}
gtk_widget_destroy (file_chooser);
-
+
if (filename) {
if (!g_str_has_suffix (filename, ".mrproject") && !g_str_has_suffix (filename, ".planner")) {
/* Add the old extension for old format files. */
@@ -114,7 +114,7 @@ xml_planner_plugin_export (GtkAction *action,
} else {
real_filename = g_strdup (filename);
}
-
+
if (g_file_test (real_filename, G_FILE_TEST_EXISTS)) {
dialog = gtk_message_dialog_new (GTK_WINDOW (priv->main_window),
GTK_DIALOG_MODAL |
@@ -124,10 +124,10 @@ xml_planner_plugin_export (GtkAction *action,
_("File \"%s\" exists, "
"do you want to overwrite it?"),
real_filename);
-
+
response = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
-
+
switch (response) {
case GTK_RESPONSE_YES:
break;
@@ -136,12 +136,12 @@ xml_planner_plugin_export (GtkAction *action,
goto try_again;
}
}
- }
+ }
if (!filename) {
return;
}
-
+
project = planner_window_get_project (priv->main_window);
if (!mrp_project_export (project, real_filename,
@@ -159,14 +159,14 @@ xml_planner_plugin_export (GtkAction *action,
g_free (filename);
}
-G_MODULE_EXPORT void
+G_MODULE_EXPORT void
plugin_init (PlannerPlugin *plugin, PlannerWindow *main_window)
{
PlannerPluginPriv *priv;
GtkUIManager *ui;
GtkActionGroup *actions;
gchar *filename;
-
+
priv = g_new0 (PlannerPluginPriv, 1);
plugin->priv = priv;
priv->main_window = main_window;
@@ -190,7 +190,7 @@ plugin_init (PlannerPlugin *plugin, PlannerWindow *main_window)
gtk_ui_manager_ensure_update(ui);
}
-G_MODULE_EXPORT void
-plugin_exit (PlannerPlugin *plugin)
+G_MODULE_EXPORT void
+plugin_exit (PlannerPlugin *plugin)
{
}
diff --git a/tests/calendar-test.c b/tests/calendar-test.c
index 439b497..a73b569 100644
--- a/tests/calendar-test.c
+++ b/tests/calendar-test.c
@@ -16,22 +16,22 @@ main (gint argc, gchar **argv)
mrptime time_tue, time_sat, time_sun, time_27nov, time_28nov;
MrpDay *day_a, *day_b, *day_c, *def_1_id;
GList *l = NULL;
-
+
g_type_init ();
app = mrp_application_new ();
project = mrp_project_new (NULL);
-
+
base = mrp_calendar_new ("Base", project);
-
+
interval = mrp_interval_new (0, 10);
l = g_list_prepend (l, interval);
interval = mrp_interval_new (40, 120);
l = g_list_prepend (l, interval);
interval = mrp_interval_new (60, 40);
l = g_list_prepend (l, interval);
-
+
mrp_calendar_day_set_intervals (base, mrp_day_get_work (), l);
/* Setup default week, we might want do this in libmrproject itself? */
@@ -44,7 +44,7 @@ main (gint argc, gchar **argv)
MRP_CALENDAR_DAY_SAT, mrp_day_get_nonwork (),
MRP_CALENDAR_DAY_SUN, mrp_day_get_nonwork (),
-1);
-
+
/* Derive two calendars and copy one */
derive = mrp_calendar_derive ("Derive", base);
copy = mrp_calendar_copy ("Copy", base);
@@ -61,36 +61,36 @@ main (gint argc, gchar **argv)
/****************************************************/
day_a = mrp_calendar_get_day (base, time_tue, TRUE);
day_b = mrp_calendar_get_day (base, time_sat, TRUE);
- CHECK_INTEGER_RESULT (mrp_day_get_id (day_a),
+ CHECK_INTEGER_RESULT (mrp_day_get_id (day_a),
mrp_day_get_id (mrp_day_get_work ()));
CHECK_INTEGER_RESULT (mrp_day_get_id (day_b),
mrp_day_get_id (mrp_day_get_nonwork ()));
-
+
/****************************************************/
/** Check two: Copied calendars default week **/
/****************************************************/
day_a = mrp_calendar_get_day (copy, time_tue, TRUE);
day_b = mrp_calendar_get_day (copy, time_sat, TRUE);
day_c = mrp_calendar_get_day (copy, time_sun, TRUE);
- CHECK_INTEGER_RESULT (mrp_day_get_id (day_a),
+ CHECK_INTEGER_RESULT (mrp_day_get_id (day_a),
mrp_day_get_id (mrp_day_get_work ()));
CHECK_INTEGER_RESULT (mrp_day_get_id (day_b),
mrp_day_get_id (mrp_day_get_nonwork ()));
CHECK_INTEGER_RESULT (mrp_day_get_id (day_c),
mrp_day_get_id (mrp_day_get_nonwork ()));
-
+
/****************************************************/
/** Check three: Own defined day type **/
/****************************************************/
def_1_id = mrp_day_add (NULL, "Define 1", "Own defined day");
-
+
/* Reset the values in the copied calendar */
mrp_calendar_set_default_days (copy,
MRP_CALENDAR_DAY_TUE, def_1_id,
MRP_CALENDAR_DAY_FRI, def_1_id,
MRP_CALENDAR_DAY_SUN, def_1_id,
-1);
-
+
/* Check that it worked fine with our own defined value */
day_a = mrp_calendar_get_day (copy, time_sat, TRUE);
day_b = mrp_calendar_get_day (copy, time_sun, TRUE);
@@ -116,7 +116,7 @@ main (gint argc, gchar **argv)
/** Check five: Using base calendars values **/
/****************************************************/
- /* Set the base calendar day type on Tuesdays to be nonwork
+ /* Set the base calendar day type on Tuesdays to be nonwork
and set the derived calendars type to be USE_BASE */
mrp_calendar_set_default_days (base,
MRP_CALENDAR_DAY_TUE, mrp_day_get_nonwork (),
@@ -149,7 +149,7 @@ main (gint argc, gchar **argv)
day_a = mrp_calendar_get_day (base, time_27nov, TRUE);
day_b = mrp_calendar_get_day (derive, time_27nov, TRUE);
- CHECK_INTEGER_RESULT (mrp_day_get_id (day_a),
+ CHECK_INTEGER_RESULT (mrp_day_get_id (day_a),
mrp_day_get_id (def_1_id));
CHECK_INTEGER_RESULT (mrp_day_get_id (day_b),
mrp_day_get_id (def_1_id));
@@ -160,14 +160,14 @@ main (gint argc, gchar **argv)
day_b = mrp_calendar_get_day (derive, time_27nov, TRUE);
CHECK_INTEGER_RESULT (mrp_day_get_id (day_b),
mrp_day_get_id (mrp_day_get_nonwork ()));
-
+
mrp_calendar_set_days (derive,
time_27nov, mrp_day_get_use_base (),
(mrptime) -1);
day_b = mrp_calendar_get_day (derive, time_27nov, TRUE);
CHECK_INTEGER_RESULT (mrp_day_get_id (day_a),
mrp_day_get_id (day_b));
-
+
return EXIT_SUCCESS;
}
diff --git a/tests/scheduler-test.c b/tests/scheduler-test.c
index cf43125..ec185de 100644
--- a/tests/scheduler-test.c
+++ b/tests/scheduler-test.c
@@ -7,7 +7,7 @@
typedef struct {
mrptime project_start;
-
+
GHashTable *task_hash;
} ProjectData;
@@ -94,7 +94,7 @@ old_xml_get_date (xmlNodePtr node, const char *name)
} else {
t = 0;
}
-
+
return t;
}
@@ -128,7 +128,7 @@ read_task (xmlNodePtr node)
TaskData *task_data;
task_data = g_new0 (TaskData, 1);
-
+
task_data->name = old_xml_get_string (node, "name");
task_data->start = old_xml_get_date (node, "start");
@@ -148,14 +148,14 @@ read_tasks (ProjectData *data, xmlNodePtr node)
for (task = node->children; task; task = task->next) {
if (strcmp (task->name, "task") == 0){
task_data = read_task (task);
-
+
if (g_hash_table_lookup (data->task_hash, task_data->name)) {
g_print ("Duplicate name %s\n", task_data->name);
g_assert_not_reached ();
}
-
+
g_hash_table_insert (data->task_hash, task_data->name, task_data);
-
+
read_tasks (data, task);
}
}
@@ -171,12 +171,12 @@ read_project (const gchar *filename)
data = g_new0 (ProjectData, 1);
data->task_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
+
doc = xmlParseFile (filename);
g_assert (doc != NULL);
-
+
data->project_start = old_xml_get_date (doc->children, "project-start");
-
+
tasks = old_xml_search_child (doc->children, "tasks");
read_tasks (data, tasks);
@@ -192,18 +192,18 @@ check_project (ProjectData *data, MrpProject *project)
/* Project start. */
CHECK_INTEGER_RESULT (mrp_project_get_project_start (project), data->project_start);
-
+
tasks = mrp_project_get_all_tasks (project);
/* Sanity check. */
CHECK_INTEGER_RESULT (g_list_length (tasks), g_hash_table_size (data->task_hash));
-
+
for (l = tasks; l; l = l->next) {
task = l->data;
task_data = g_hash_table_lookup (data->task_hash, mrp_task_get_name (task));
g_assert (task_data != NULL);
-
+
/* Check start and finish. */
CHECK_INTEGER_RESULT (mrp_task_get_start (task), task_data->start);
CHECK_INTEGER_RESULT (mrp_task_get_finish (task), task_data->finish);
@@ -237,22 +237,22 @@ main (gint argc, gchar **argv)
/* Just parse the XML. */
data = read_project (tmp);
-
+
/* Create a project from the same file. */
project = mrp_project_new (app);
g_assert (g_file_get_contents (tmp, &buf, NULL, NULL));
g_assert (mrp_project_load_from_xml (project, buf, NULL));
-
+
g_free (buf);
g_free (tmp);
-
+
/* Reschedule the project and check that the info is correct. */
mrp_project_reschedule (project);
check_project (data, project);
i++;
}
-
+
return EXIT_SUCCESS;
}
diff --git a/tests/self-check.c b/tests/self-check.c
index acc198b..bc00b17 100644
--- a/tests/self-check.c
+++ b/tests/self-check.c
@@ -1,24 +1,24 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
+
self-checks.c: The self-check framework.
-
+
Copyright (C) 1999 Eazel, Inc.
-
+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
This program 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
Library General Public License for more details.
-
+
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-
+
Author: Darin Adler <darin eazel com>
*/
@@ -47,7 +47,7 @@ report_check_failure (char *result, char *expected)
fprintf (stderr, " evaluated: %s\n", current_expression);
fprintf (stderr, " expected: %s\n", expected == NULL ? "NULL" : expected);
fprintf (stderr, " got: %s\n", result == NULL ? "NULL" : result);
-
+
failed = TRUE;
g_free (result);
@@ -76,7 +76,7 @@ void
check_string_result (char *result, const char *expected)
{
gboolean match;
-
+
/* Stricter than eel_strcmp.
* NULL does not match "" in this test.
*/
diff --git a/tests/task-test.c b/tests/task-test.c
index f341f4a..ab9c191 100644
--- a/tests/task-test.c
+++ b/tests/task-test.c
@@ -20,13 +20,13 @@ main (gint argc, gchar **argv)
gboolean success;
MrpTask *root;
MrpRelation *relation;
-
+
g_type_init ();
app = mrp_application_new ();
project_start = mrp_time_from_string ("20020218", NULL);
-
+
project = mrp_project_new (app);
g_object_set (project, "project_start", project_start, NULL);
@@ -72,13 +72,13 @@ main (gint argc, gchar **argv)
g_object_get (task2,
"critical", &critical,
NULL);
-
+
/* Task2 is now critical, task1 not. */
CHECK_BOOLEAN_RESULT (critical, TRUE);
/* Check that start and finish are calculated correctly. */
root = mrp_project_get_root_task (project);
-
+
CHECK_INTEGER_RESULT (mrp_task_get_start (root), project_start);
CHECK_INTEGER_RESULT (mrp_task_get_finish (root), mrp_task_get_finish (task2));
@@ -115,11 +115,11 @@ main (gint argc, gchar **argv)
/* Check that we can't make task2 the parent of task1 with the
* predecessor relation in place
*/
- success = mrp_project_move_task (project,
- task1,
- NULL,
- task2,
- FALSE,
+ success = mrp_project_move_task (project,
+ task1,
+ NULL,
+ task2,
+ FALSE,
NULL);
CHECK_BOOLEAN_RESULT (success, FALSE);
@@ -129,17 +129,17 @@ main (gint argc, gchar **argv)
* This test verifies that a loop is created in the dependency graph by
* this action and that it is detected.
*/
- success = mrp_project_move_task (project,
- task2,
- NULL,
- task1,
- FALSE,
+ success = mrp_project_move_task (project,
+ task2,
+ NULL,
+ task1,
+ FALSE,
NULL);
CHECK_BOOLEAN_RESULT (success, FALSE);
/* Add task3 as parent of task2 and see if we can't make task1 the
- * parent of task3. This test verifies that loops that include direct
+ * parent of task3. This test verifies that loops that include direct
* children but not the parent, are detected.
*/
task3 = g_object_new (MRP_TYPE_TASK,
@@ -157,11 +157,11 @@ main (gint argc, gchar **argv)
NULL);
CHECK_BOOLEAN_RESULT (success, TRUE);
- success = mrp_project_move_task (project,
- task3,
- NULL,
- task1,
- FALSE,
+ success = mrp_project_move_task (project,
+ task3,
+ NULL,
+ task1,
+ FALSE,
NULL);
CHECK_BOOLEAN_RESULT (success, FALSE);
@@ -186,11 +186,11 @@ main (gint argc, gchar **argv)
NULL);
CHECK_BOOLEAN_RESULT (success, TRUE);
- success = mrp_project_move_task (project,
- task4,
- NULL,
- task1,
- FALSE,
+ success = mrp_project_move_task (project,
+ task4,
+ NULL,
+ task1,
+ FALSE,
NULL);
CHECK_BOOLEAN_RESULT (success, FALSE);
@@ -202,7 +202,7 @@ main (gint argc, gchar **argv)
CHECK_POINTER_RESULT (mrp_relation_get_predecessor (relation), task2);
t1 = mrp_task_get_start (task1);
-
+
g_object_set (relation, "lag", DAY, NULL);
/* Check for correct lag set. */
@@ -216,10 +216,10 @@ main (gint argc, gchar **argv)
CHECK_INTEGER_RESULT (mrp_task_get_finish (task2) - mrp_task_get_start (task2), 0);
CHECK_INTEGER_RESULT (mrp_task_get_work (task2), 0);
CHECK_INTEGER_RESULT (mrp_task_get_duration (task2), 0);
-
+
/* More tests needed... */
-
+
return EXIT_SUCCESS;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]