mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Realign source files gnc-dense-cal*.c/h for spaces
This commit is contained in:
parent
a35af97250
commit
d393c42697
@ -1,34 +1,35 @@
|
|||||||
/*
|
/********************************************************************\
|
||||||
* gnc-dense-cal-model.c
|
* gnc-dense-cal-model.c *
|
||||||
*
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org>
|
* *
|
||||||
*
|
* This program is free software; you can redistribute it and/or *
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* modify it under the terms of the GNU General Public License as *
|
||||||
* under the terms of version 2 and/or version 3 of the GNU General Public License as
|
* published by the Free Software Foundation, under version 2 and *
|
||||||
* published by the Free Software Foundation.
|
* / or version 3 of the License. *
|
||||||
*
|
* *
|
||||||
* As a special exception, permission is granted to link the binary module
|
* As a special exception, permission is granted to link the binary *
|
||||||
* resultant from this code with the OpenSSL project's "OpenSSL" library (or
|
* module resultant from this code with the OpenSSL project's *
|
||||||
* modified versions of it that use the same license as the "OpenSSL"
|
* "OpenSSL" library (or modified versions of it that use the same *
|
||||||
* library), and distribute the linked executable. You must obey the GNU
|
* license as the "OpenSSL" library), and distribute the linked *
|
||||||
* General Public License in all respects for all of the code used other than
|
* executable. You must obey the GNU General Public License in all *
|
||||||
* "OpenSSL". If you modify this file, you may extend this exception to your
|
* respects for all of the code used other than "OpenSSL". If you *
|
||||||
* version of the file, but you are not obligated to do so. If you do not
|
* modify this file, you may extend this exception to your version *
|
||||||
* wish to do so, delete this exception statement from your version of this
|
* of the file, but you are not obligated to do so. If you do not *
|
||||||
* file.
|
* wish to do so, delete this exception statement from your version *
|
||||||
*
|
* of this file. *
|
||||||
* This program is distributed in the hope that it will be useful,
|
* *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* GNU General Public License for more details.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
*
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
* You should have received a copy of the GNU General Public License*
|
* You should have received a copy of the GNU General Public License*
|
||||||
* along with this program; if not, contact:
|
* along with this program; if not, contact: *
|
||||||
*
|
* *
|
||||||
* Free Software Foundation Voice: +1-617-542-5942
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||||
*/
|
\********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -41,7 +42,7 @@ enum { GDCM_ADDED, GDCM_UPDATE, GDCM_REMOVE, LAST_SIGNAL };
|
|||||||
static guint gnc_dense_cal_model_signals[LAST_SIGNAL] = { 0 };
|
static guint gnc_dense_cal_model_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_dense_cal_model_default_init(GncDenseCalModelInterface *g_class)
|
gnc_dense_cal_model_default_init (GncDenseCalModelInterface *g_class)
|
||||||
{
|
{
|
||||||
gnc_dense_cal_model_signals[GDCM_ADDED] = g_signal_new("added",
|
gnc_dense_cal_model_signals[GDCM_ADDED] = g_signal_new("added",
|
||||||
G_TYPE_FROM_CLASS(g_class),
|
G_TYPE_FROM_CLASS(g_class),
|
||||||
@ -80,34 +81,37 @@ gnc_dense_cal_model_default_init(GncDenseCalModelInterface *g_class)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_DEFINE_INTERFACE (GncDenseCalModel, gnc_dense_cal_model, G_TYPE_OBJECT)
|
G_DEFINE_INTERFACE(GncDenseCalModel, gnc_dense_cal_model, G_TYPE_OBJECT)
|
||||||
|
|
||||||
GList*
|
GList*
|
||||||
gnc_dense_cal_model_get_contained(GncDenseCalModel *model)
|
gnc_dense_cal_model_get_contained (GncDenseCalModel *model)
|
||||||
{
|
{
|
||||||
return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_contained)(model);
|
return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_contained)(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar*
|
gchar*
|
||||||
gnc_dense_cal_model_get_name(GncDenseCalModel *model, guint tag)
|
gnc_dense_cal_model_get_name (GncDenseCalModel *model, guint tag)
|
||||||
{
|
{
|
||||||
return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_name)(model, tag);
|
return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_name)(model, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar*
|
gchar*
|
||||||
gnc_dense_cal_model_get_info(GncDenseCalModel *model, guint tag)
|
gnc_dense_cal_model_get_info (GncDenseCalModel *model, guint tag)
|
||||||
{
|
{
|
||||||
return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_info)(model, tag);
|
return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_info)(model, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gnc_dense_cal_model_get_instance_count(GncDenseCalModel *model, guint tag)
|
gnc_dense_cal_model_get_instance_count (GncDenseCalModel *model, guint tag)
|
||||||
{
|
{
|
||||||
return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_instance_count)(model, tag);
|
return (*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_instance_count)(model, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_dense_cal_model_get_instance(GncDenseCalModel *model, guint tag, gint instance_index, GDate *date)
|
gnc_dense_cal_model_get_instance (GncDenseCalModel *model,
|
||||||
|
guint tag,
|
||||||
|
gint instance_index,
|
||||||
|
GDate *date)
|
||||||
{
|
{
|
||||||
(*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_instance)(model, tag, instance_index, date);
|
(*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_instance)(model, tag, instance_index, date);
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
/*
|
/********************************************************************\
|
||||||
* gnc-dense-cal-model.h
|
* gnc-dense-cal-model.h *
|
||||||
*
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org>
|
* *
|
||||||
*
|
* This program is free software; you can redistribute it and/or *
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* modify it under the terms of the GNU General Public License as *
|
||||||
* under the terms of version 2 and/or version 3 of the GNU General Public License as
|
* published by the Free Software Foundation, under version 2 and *
|
||||||
* published by the Free Software Foundation.
|
* / or version 3 of the License. *
|
||||||
*
|
* *
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details. *
|
||||||
*
|
* *
|
||||||
* You should have received a copy of the GNU General Public License*
|
* You should have received a copy of the GNU General Public License*
|
||||||
* along with this program; if not, contact:
|
* along with this program; if not, contact: *
|
||||||
*
|
* *
|
||||||
* Free Software Foundation Voice: +1-617-542-5942
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||||
*/
|
\********************************************************************/
|
||||||
|
|
||||||
#ifndef _GNC_DENSE_CAL_MODEL_H
|
#ifndef _GNC_DENSE_CAL_MODEL_H
|
||||||
#define _GNC_DENSE_CAL_MODEL_H
|
#define _GNC_DENSE_CAL_MODEL_H
|
||||||
@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GNC_TYPE_DENSE_CAL_MODEL (gnc_dense_cal_model_get_type())
|
#define GNC_TYPE_DENSE_CAL_MODEL (gnc_dense_cal_model_get_type ())
|
||||||
G_DECLARE_INTERFACE (GncDenseCalModel, gnc_dense_cal_model, GNC, DENSE_CAL_MODEL, GObject)
|
G_DECLARE_INTERFACE(GncDenseCalModel, gnc_dense_cal_model, GNC, DENSE_CAL_MODEL, GObject)
|
||||||
|
|
||||||
struct _GncDenseCalModelInterface
|
struct _GncDenseCalModelInterface
|
||||||
{
|
{
|
||||||
@ -45,11 +45,14 @@ struct _GncDenseCalModelInterface
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** @return Caller-owned GList (but not elements). The Model-user will free. **/
|
/** @return Caller-owned GList (but not elements). The Model-user will free. **/
|
||||||
GList* gnc_dense_cal_model_get_contained(GncDenseCalModel *model);
|
GList* gnc_dense_cal_model_get_contained (GncDenseCalModel *model);
|
||||||
gchar* gnc_dense_cal_model_get_name(GncDenseCalModel *model, guint tag);
|
gchar* gnc_dense_cal_model_get_name (GncDenseCalModel *model, guint tag);
|
||||||
gchar* gnc_dense_cal_model_get_info(GncDenseCalModel *model, guint tag);
|
gchar* gnc_dense_cal_model_get_info (GncDenseCalModel *model, guint tag);
|
||||||
gint gnc_dense_cal_model_get_instance_count(GncDenseCalModel *model, guint tag);
|
gint gnc_dense_cal_model_get_instance_count (GncDenseCalModel *model, guint tag);
|
||||||
void gnc_dense_cal_model_get_instance(GncDenseCalModel *model, guint tag, gint instance_index, GDate *date);
|
void gnc_dense_cal_model_get_instance (GncDenseCalModel *model,
|
||||||
|
guint tag,
|
||||||
|
gint instance_index,
|
||||||
|
GDate *date);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -1,34 +1,35 @@
|
|||||||
/*
|
/********************************************************************\
|
||||||
* gnc-dense-cal-store.h
|
* gnc-dense-cal-store.h *
|
||||||
*
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org>
|
* *
|
||||||
*
|
* This program is free software; you can redistribute it and/or *
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* modify it under the terms of the GNU General Public License as *
|
||||||
* under the terms of version 2 and/or version 3 of the GNU General Public License as
|
* published by the Free Software Foundation, under version 2 and *
|
||||||
* published by the Free Software Foundation.
|
* / or version 3 of the License. *
|
||||||
*
|
* *
|
||||||
* As a special exception, permission is granted to link the binary module
|
* As a special exception, permission is granted to link the binary *
|
||||||
* resultant from this code with the OpenSSL project's "OpenSSL" library (or
|
* module resultant from this code with the OpenSSL project's *
|
||||||
* modified versions of it that use the same license as the "OpenSSL"
|
* "OpenSSL" library (or modified versions of it that use the same *
|
||||||
* library), and distribute the linked executable. You must obey the GNU
|
* license as the "OpenSSL" library), and distribute the linked *
|
||||||
* General Public License in all respects for all of the code used other than
|
* executable. You must obey the GNU General Public License in all *
|
||||||
* "OpenSSL". If you modify this file, you may extend this exception to your
|
* respects for all of the code used other than "OpenSSL". If you *
|
||||||
* version of the file, but you are not obligated to do so. If you do not
|
* modify this file, you may extend this exception to your version *
|
||||||
* wish to do so, delete this exception statement from your version of this
|
* of the file, but you are not obligated to do so. If you do not *
|
||||||
* file.
|
* wish to do so, delete this exception statement from your version *
|
||||||
*
|
* of this file. *
|
||||||
* This program is distributed in the hope that it will be useful,
|
* *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* GNU General Public License for more details.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
*
|
* GNU General Public License for more details. *
|
||||||
* You should have received a copy of the GNU General Public License
|
* *
|
||||||
* along with this program; if not, contact:
|
* You should have received a copy of the GNU General Public License*
|
||||||
*
|
* along with this program; if not, contact: *
|
||||||
* Free Software Foundation Voice: +1-617-542-5942
|
* *
|
||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||||
*/
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||||
|
\********************************************************************/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
@ -54,20 +55,20 @@ struct _GncDenseCalStore
|
|||||||
GDate **cal_marks;
|
GDate **cal_marks;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gnc_dense_cal_store_iface_init(GncDenseCalModelInterface *iface);
|
static void gnc_dense_cal_store_iface_init (GncDenseCalModelInterface *iface);
|
||||||
static void gnc_dense_cal_store_finalize(GObject *obj);
|
static void gnc_dense_cal_store_finalize (GObject *obj);
|
||||||
|
|
||||||
static GList* gdcs_get_contained(GncDenseCalModel *model);
|
static GList* gdcs_get_contained (GncDenseCalModel *model);
|
||||||
static gchar* gdcs_get_name(GncDenseCalModel *model, guint tag);
|
static gchar* gdcs_get_name (GncDenseCalModel *model, guint tag);
|
||||||
static gchar* gdcs_get_info(GncDenseCalModel *model, guint tag);
|
static gchar* gdcs_get_info (GncDenseCalModel *model, guint tag);
|
||||||
static gint gdcs_get_instance_count(GncDenseCalModel *model, guint tag);
|
static gint gdcs_get_instance_count (GncDenseCalModel *model, guint tag);
|
||||||
static void gdcs_get_instance(GncDenseCalModel *model, guint tag, gint instance_index, GDate *date);
|
static void gdcs_get_instance (GncDenseCalModel *model, guint tag, gint instance_index, GDate *date);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GncDenseCalStore, gnc_dense_cal_store, G_TYPE_OBJECT,
|
G_DEFINE_TYPE_WITH_CODE(GncDenseCalStore, gnc_dense_cal_store, G_TYPE_OBJECT,
|
||||||
G_IMPLEMENT_INTERFACE (GNC_TYPE_DENSE_CAL_MODEL, gnc_dense_cal_store_iface_init))
|
G_IMPLEMENT_INTERFACE(GNC_TYPE_DENSE_CAL_MODEL, gnc_dense_cal_store_iface_init))
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_dense_cal_store_class_init(GncDenseCalStoreClass *klass)
|
gnc_dense_cal_store_class_init (GncDenseCalStoreClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||||
|
|
||||||
@ -75,12 +76,12 @@ gnc_dense_cal_store_class_init(GncDenseCalStoreClass *klass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_dense_cal_store_init(GncDenseCalStore *self)
|
gnc_dense_cal_store_init (GncDenseCalStore *self)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_dense_cal_store_iface_init(GncDenseCalModelInterface *iface)
|
gnc_dense_cal_store_iface_init (GncDenseCalModelInterface *iface)
|
||||||
{
|
{
|
||||||
iface->get_contained = gdcs_get_contained;
|
iface->get_contained = gdcs_get_contained;
|
||||||
iface->get_name = gdcs_get_name;
|
iface->get_name = gdcs_get_name;
|
||||||
@ -90,79 +91,75 @@ gnc_dense_cal_store_iface_init(GncDenseCalModelInterface *iface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GncDenseCalStore*
|
GncDenseCalStore*
|
||||||
gnc_dense_cal_store_new(int num_marks)
|
gnc_dense_cal_store_new (int num_marks)
|
||||||
{
|
{
|
||||||
GncDenseCalStore *model = g_object_new(GNC_TYPE_DENSE_CAL_STORE, NULL);
|
GncDenseCalStore *model = g_object_new (GNC_TYPE_DENSE_CAL_STORE, NULL);
|
||||||
model->num_marks = num_marks;
|
model->num_marks = num_marks;
|
||||||
model->cal_marks = g_new0(GDate*, num_marks);
|
model->cal_marks = g_new0 (GDate*, num_marks);
|
||||||
{
|
{
|
||||||
int i = 0;
|
for (int i = 0; i < model->num_marks; i++)
|
||||||
for (i = 0; i < model->num_marks; i++)
|
|
||||||
{
|
{
|
||||||
model->cal_marks[i] = g_date_new();
|
model->cal_marks[i] = g_date_new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model->num_real_marks = 0;
|
model->num_real_marks = 0;
|
||||||
g_date_clear(&model->start_date, 1);
|
g_date_clear (&model->start_date, 1);
|
||||||
gnc_gdate_set_today (&model->start_date);
|
gnc_gdate_set_today (&model->start_date);
|
||||||
model->end_type = NEVER_END;
|
model->end_type = NEVER_END;
|
||||||
g_date_clear(&model->end_date, 1);
|
g_date_clear (&model->end_date, 1);
|
||||||
gnc_gdate_set_today (&model->end_date);
|
gnc_gdate_set_today (&model->end_date);
|
||||||
model->n_occurrences = 0;
|
model->n_occurrences = 0;
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_dense_cal_store_clear(GncDenseCalStore *model)
|
gnc_dense_cal_store_clear (GncDenseCalStore *model)
|
||||||
{
|
{
|
||||||
model->num_real_marks = 0;
|
model->num_real_marks = 0;
|
||||||
g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
|
g_signal_emit_by_name (model, "update", GUINT_TO_POINTER(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_dense_cal_store_update_name(GncDenseCalStore *model, const gchar *name)
|
gnc_dense_cal_store_update_name (GncDenseCalStore *model, const gchar *name)
|
||||||
{
|
{
|
||||||
if (model->name != NULL)
|
if (model->name != NULL)
|
||||||
{
|
g_free (model->name);
|
||||||
g_free(model->name);
|
|
||||||
}
|
model->name = g_strdup (name);
|
||||||
model->name = g_strdup(name);
|
|
||||||
//g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
|
//g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_dense_cal_store_update_info(GncDenseCalStore *model, const gchar *info)
|
gnc_dense_cal_store_update_info (GncDenseCalStore *model, const gchar *info)
|
||||||
{
|
{
|
||||||
if (model->info != NULL)
|
if (model->info != NULL)
|
||||||
{
|
g_free (model->info);
|
||||||
g_free(model->info);
|
|
||||||
}
|
model->info = g_strdup (info);
|
||||||
model->info = g_strdup(info);
|
|
||||||
//g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
|
//g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdcs_generic_update_recurrences(GncDenseCalStore *trans, GDate *start, GList *recurrences)
|
gdcs_generic_update_recurrences (GncDenseCalStore *trans, GDate *start, GList *recurrences)
|
||||||
{
|
{
|
||||||
int i;
|
int i = 0;
|
||||||
GDate date, next;
|
GDate date, next;
|
||||||
|
|
||||||
date = *start;
|
date = *start;
|
||||||
recurrenceListNextInstance(recurrences, &date, &next);
|
recurrenceListNextInstance (recurrences, &date, &next);
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while ((i < trans->num_marks)
|
while ((i < trans->num_marks)
|
||||||
&& g_date_valid(&next)
|
&& g_date_valid (&next)
|
||||||
/* Do checking against end restriction. */
|
/* Do checking against end restriction. */
|
||||||
&& ((trans->end_type == NEVER_END)
|
&& ((trans->end_type == NEVER_END)
|
||||||
|| (trans->end_type == END_ON_DATE
|
|| (trans->end_type == END_ON_DATE
|
||||||
&& g_date_compare(&next, &trans->end_date) <= 0)
|
&& g_date_compare (&next, &trans->end_date) <= 0)
|
||||||
|| (trans->end_type == END_AFTER_N_OCCS
|
|| (trans->end_type == END_AFTER_N_OCCS
|
||||||
&& i < trans->n_occurrences)))
|
&& i < trans->n_occurrences)))
|
||||||
{
|
{
|
||||||
*trans->cal_marks[i++] = next;
|
*trans->cal_marks[i++] = next;
|
||||||
date = next;
|
date = next;
|
||||||
recurrenceListNextInstance(recurrences, &date, &next);
|
recurrenceListNextInstance (recurrences, &date, &next);
|
||||||
}
|
}
|
||||||
trans->num_real_marks = i;
|
trans->num_real_marks = i;
|
||||||
/* cstim: Previously this was i-1 but that's just plain wrong for
|
/* cstim: Previously this was i-1 but that's just plain wrong for
|
||||||
@ -170,42 +167,50 @@ gdcs_generic_update_recurrences(GncDenseCalStore *trans, GDate *start, GList *re
|
|||||||
* the number of (rest) occurrences exactly! Subtracting one means
|
* the number of (rest) occurrences exactly! Subtracting one means
|
||||||
* we will miss the last one. */
|
* we will miss the last one. */
|
||||||
|
|
||||||
g_signal_emit_by_name(trans, "update", GUINT_TO_POINTER(1));
|
g_signal_emit_by_name (trans, "update", GUINT_TO_POINTER(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_dense_cal_store_update_recurrences_no_end(GncDenseCalStore *model, GDate *start, GList *recurrences)
|
gnc_dense_cal_store_update_recurrences_no_end (GncDenseCalStore *model,
|
||||||
|
GDate *start,
|
||||||
|
GList *recurrences)
|
||||||
{
|
{
|
||||||
model->end_type = NEVER_END;
|
model->end_type = NEVER_END;
|
||||||
gdcs_generic_update_recurrences(model, start, recurrences);
|
gdcs_generic_update_recurrences (model, start, recurrences);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_dense_cal_store_update_recurrences_count_end(GncDenseCalStore *model, GDate *start, GList *recurrences, int num_occur)
|
gnc_dense_cal_store_update_recurrences_count_end (GncDenseCalStore *model,
|
||||||
|
GDate *start,
|
||||||
|
GList *recurrences,
|
||||||
|
int num_occur)
|
||||||
{
|
{
|
||||||
model->end_type = END_AFTER_N_OCCS;
|
model->end_type = END_AFTER_N_OCCS;
|
||||||
model->n_occurrences = num_occur;
|
model->n_occurrences = num_occur;
|
||||||
gdcs_generic_update_recurrences(model, start, recurrences);
|
gdcs_generic_update_recurrences (model, start, recurrences);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_dense_cal_store_update_recurrences_date_end(GncDenseCalStore *model, GDate *start, GList *recurrences, GDate *end_date)
|
gnc_dense_cal_store_update_recurrences_date_end (GncDenseCalStore *model,
|
||||||
|
GDate *start,
|
||||||
|
GList *recurrences,
|
||||||
|
GDate *end_date)
|
||||||
{
|
{
|
||||||
model->end_type = END_ON_DATE;
|
model->end_type = END_ON_DATE;
|
||||||
model->end_date = *end_date;
|
model->end_date = *end_date;
|
||||||
gdcs_generic_update_recurrences(model, start, recurrences);
|
gdcs_generic_update_recurrences (model, start, recurrences);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GList*
|
static GList*
|
||||||
gdcs_get_contained(GncDenseCalModel *model)
|
gdcs_get_contained (GncDenseCalModel *model)
|
||||||
{
|
{
|
||||||
GList *rtn = NULL;
|
GList *rtn = NULL;
|
||||||
rtn = g_list_append(rtn, GUINT_TO_POINTER(1));
|
rtn = g_list_append (rtn, GUINT_TO_POINTER(1));
|
||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar*
|
static gchar*
|
||||||
gdcs_get_name(GncDenseCalModel *model, guint tag)
|
gdcs_get_name (GncDenseCalModel *model, guint tag)
|
||||||
{
|
{
|
||||||
GncDenseCalStore *mdl = GNC_DENSE_CAL_STORE(model);
|
GncDenseCalStore *mdl = GNC_DENSE_CAL_STORE(model);
|
||||||
// assert(tag == 1)
|
// assert(tag == 1)
|
||||||
@ -213,15 +218,15 @@ gdcs_get_name(GncDenseCalModel *model, guint tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gchar*
|
static gchar*
|
||||||
gdcs_get_info(GncDenseCalModel *model, guint tag)
|
gdcs_get_info (GncDenseCalModel *model, guint tag)
|
||||||
{
|
{
|
||||||
GncDenseCalStore *mdl = GNC_DENSE_CAL_STORE(model);
|
GncDenseCalStore *mdl = GNC_DENSE_CAL_STORE(model);
|
||||||
// assert(tag == 1)
|
// assert(tag == 1)
|
||||||
return g_strdup(mdl->info);
|
return g_strdup (mdl->info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gdcs_get_instance_count(GncDenseCalModel *model, guint tag)
|
gdcs_get_instance_count (GncDenseCalModel *model, guint tag)
|
||||||
{
|
{
|
||||||
GncDenseCalStore *mdl = GNC_DENSE_CAL_STORE(model);
|
GncDenseCalStore *mdl = GNC_DENSE_CAL_STORE(model);
|
||||||
// assert(tag == 1)
|
// assert(tag == 1)
|
||||||
@ -229,7 +234,7 @@ gdcs_get_instance_count(GncDenseCalModel *model, guint tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdcs_get_instance(GncDenseCalModel *model, guint tag, gint instance_index, GDate *date)
|
gdcs_get_instance (GncDenseCalModel *model, guint tag, gint instance_index, GDate *date)
|
||||||
{
|
{
|
||||||
GncDenseCalStore *mdl = GNC_DENSE_CAL_STORE(model);
|
GncDenseCalStore *mdl = GNC_DENSE_CAL_STORE(model);
|
||||||
// assert(tag == 1)
|
// assert(tag == 1)
|
||||||
@ -238,36 +243,35 @@ gdcs_get_instance(GncDenseCalModel *model, guint tag, gint instance_index, GDate
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_dense_cal_store_finalize(GObject *obj)
|
gnc_dense_cal_store_finalize (GObject *obj)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
GncDenseCalStore *store;
|
GncDenseCalStore *store;
|
||||||
g_return_if_fail(obj != NULL);
|
g_return_if_fail (obj != NULL);
|
||||||
|
|
||||||
store = GNC_DENSE_CAL_STORE(obj);
|
store = GNC_DENSE_CAL_STORE(obj);
|
||||||
|
|
||||||
if (store->name != NULL)
|
if (store->name != NULL)
|
||||||
{
|
{
|
||||||
g_free(store->name);
|
g_free (store->name);
|
||||||
store->name = NULL;
|
store->name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (store->info != NULL)
|
if (store->info != NULL)
|
||||||
{
|
{
|
||||||
g_free(store->info);
|
g_free (store->info);
|
||||||
store->info = NULL;
|
store->info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < store->num_marks; i++)
|
for (int i = 0; i < store->num_marks; i++)
|
||||||
{
|
{
|
||||||
g_free(store->cal_marks[i]);
|
g_free (store->cal_marks[i]);
|
||||||
store->cal_marks[i] = NULL;
|
store->cal_marks[i] = NULL;
|
||||||
}
|
}
|
||||||
if (store->cal_marks != NULL)
|
if (store->cal_marks != NULL)
|
||||||
{
|
{
|
||||||
g_free(store->cal_marks);
|
g_free (store->cal_marks);
|
||||||
store->cal_marks = NULL;
|
store->cal_marks = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS(gnc_dense_cal_store_parent_class)->finalize(obj);
|
G_OBJECT_CLASS(gnc_dense_cal_store_parent_class)->finalize (obj);
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
/*
|
/********************************************************************\
|
||||||
* gnc-dense-cal-store.h
|
* gnc-dense-cal-store.h *
|
||||||
*
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org>
|
* *
|
||||||
*
|
* This program is free software; you can redistribute it and/or *
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* modify it under the terms of the GNU General Public License as *
|
||||||
* under the terms of version 2 and/or version 3 of the GNU General Public License as
|
* published by the Free Software Foundation, under version 2 and *
|
||||||
* published by the Free Software Foundation.
|
* / or version 3 of the License. *
|
||||||
*
|
* *
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details. *
|
||||||
*
|
* *
|
||||||
* You should have received a copy of the GNU General Public License*
|
* You should have received a copy of the GNU General Public License*
|
||||||
* along with this program; if not, contact:
|
* along with this program; if not, contact: *
|
||||||
*
|
* *
|
||||||
* Free Software Foundation Voice: +1-617-542-5942
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||||
*/
|
\********************************************************************/
|
||||||
|
|
||||||
#ifndef _GNC_DENSE_CAL_STORE_H
|
#ifndef _GNC_DENSE_CAL_STORE_H
|
||||||
#define _GNC_DENSE_CAL_STORE_H
|
#define _GNC_DENSE_CAL_STORE_H
|
||||||
@ -31,19 +31,27 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GNC_TYPE_DENSE_CAL_STORE (gnc_dense_cal_store_get_type())
|
#define GNC_TYPE_DENSE_CAL_STORE (gnc_dense_cal_store_get_type ())
|
||||||
G_DECLARE_FINAL_TYPE (GncDenseCalStore, gnc_dense_cal_store, GNC, DENSE_CAL_STORE, GObject)
|
G_DECLARE_FINAL_TYPE(GncDenseCalStore, gnc_dense_cal_store, GNC, DENSE_CAL_STORE, GObject)
|
||||||
|
|
||||||
typedef enum { NEVER_END, END_ON_DATE, END_AFTER_N_OCCS, BAD_END } gdcs_end_type;
|
typedef enum { NEVER_END, END_ON_DATE, END_AFTER_N_OCCS, BAD_END } gdcs_end_type;
|
||||||
|
|
||||||
GncDenseCalStore* gnc_dense_cal_store_new(int num_marks);
|
GncDenseCalStore* gnc_dense_cal_store_new (int num_marks);
|
||||||
void gnc_dense_cal_store_clear(GncDenseCalStore *model);
|
void gnc_dense_cal_store_clear (GncDenseCalStore *model);
|
||||||
void gnc_dense_cal_store_update_name(GncDenseCalStore *model, const gchar* name);
|
void gnc_dense_cal_store_update_name (GncDenseCalStore *model, const gchar* name);
|
||||||
void gnc_dense_cal_store_update_info(GncDenseCalStore *model, const gchar* info);
|
void gnc_dense_cal_store_update_info (GncDenseCalStore *model, const gchar* info);
|
||||||
|
|
||||||
void gnc_dense_cal_store_update_recurrences_no_end(GncDenseCalStore *model, GDate *start, GList *recurrences);
|
void gnc_dense_cal_store_update_recurrences_no_end (GncDenseCalStore *model,
|
||||||
void gnc_dense_cal_store_update_recurrences_count_end(GncDenseCalStore *model, GDate *start, GList *recurrences, int num_occur);
|
GDate *start,
|
||||||
void gnc_dense_cal_store_update_recurrences_date_end(GncDenseCalStore *model, GDate *start, GList *recurrences, GDate *end_date);
|
GList *recurrences);
|
||||||
|
void gnc_dense_cal_store_update_recurrences_count_end (GncDenseCalStore *model,
|
||||||
|
GDate *start,
|
||||||
|
GList *recurrences,
|
||||||
|
int num_occur);
|
||||||
|
void gnc_dense_cal_store_update_recurrences_date_end (GncDenseCalStore *model,
|
||||||
|
GDate *start,
|
||||||
|
GList *recurrences,
|
||||||
|
GDate *end_date);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -4,8 +4,8 @@
|
|||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* This program is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU General Public License as *
|
* modify it under the terms of the GNU General Public License as *
|
||||||
* published by the Free Software Foundation, under version 2 and/or version 3 of *
|
* published by the Free Software Foundation, under version 2 and *
|
||||||
* the License. *
|
* / or version 3 of the License. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
@ -31,26 +31,26 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GNC_TYPE_DENSE_CAL (gnc_dense_cal_get_type ())
|
#define GNC_TYPE_DENSE_CAL (gnc_dense_cal_get_type ())
|
||||||
G_DECLARE_FINAL_TYPE (GncDenseCal, gnc_dense_cal, GNC, DENSE_CAL, GtkBox)
|
G_DECLARE_FINAL_TYPE (GncDenseCal, gnc_dense_cal, GNC, DENSE_CAL, GtkBox)
|
||||||
|
|
||||||
GtkWidget* gnc_dense_cal_new (GtkWindow *parent);
|
GtkWidget* gnc_dense_cal_new (GtkWindow *parent);
|
||||||
GtkWidget* gnc_dense_cal_new_with_model (GtkWindow *parent,
|
GtkWidget* gnc_dense_cal_new_with_model (GtkWindow *parent,
|
||||||
GncDenseCalModel *model);
|
GncDenseCalModel *model);
|
||||||
void gnc_dense_cal_set_model(GncDenseCal *cal, GncDenseCalModel *model);
|
void gnc_dense_cal_set_model (GncDenseCal *cal, GncDenseCalModel *model);
|
||||||
|
|
||||||
void gnc_dense_cal_set_month(GncDenseCal *dcal, GDateMonth mon);
|
void gnc_dense_cal_set_month (GncDenseCal *dcal, GDateMonth mon);
|
||||||
GDateMonth gnc_dense_cal_get_month( GncDenseCal *dcal );
|
GDateMonth gnc_dense_cal_get_month (GncDenseCal *dcal);
|
||||||
/**
|
/**
|
||||||
* @param year Julian year: 2000 = 2000AD.
|
* @param year Julian year: 2000 = 2000AD.
|
||||||
**/
|
**/
|
||||||
void gnc_dense_cal_set_year( GncDenseCal *dcal, guint year );
|
void gnc_dense_cal_set_year (GncDenseCal *dcal, guint year);
|
||||||
GDateYear gnc_dense_cal_get_year( GncDenseCal *dcal );
|
GDateYear gnc_dense_cal_get_year (GncDenseCal *dcal);
|
||||||
|
|
||||||
void gnc_dense_cal_set_num_months( GncDenseCal *dcal, guint num_months );
|
void gnc_dense_cal_set_num_months (GncDenseCal *dcal, guint num_months);
|
||||||
guint gnc_dense_cal_get_num_months( GncDenseCal *dcal );
|
guint gnc_dense_cal_get_num_months (GncDenseCal *dcal);
|
||||||
|
|
||||||
void gnc_dense_cal_set_months_per_col( GncDenseCal *dcal, guint monthsPerCol );
|
void gnc_dense_cal_set_months_per_col (GncDenseCal *dcal, guint monthsPerCol);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user