Commit c9f44cc8 authored by Michael Meeks's avatar Michael Meeks Committed by Michael Meeks

add bonobo_shutdown.

2000-07-12  Michael Meeks  <michael@helixcode.com>

	* src/main.c (gnumeric_main): add bonobo_shutdown.

	* src/sheet-object-bonobo.c (sheet_object_bonobo_destroy): unref not
	destroy the bonobo object.

	* src/sheet-object-container.c (item_destroyed): ditto.

	* src/sheet-vector.c (sheet_vector_new): ditto.

2000-07-07  Michael Meeks  <michael@helixcode.com>

	* src/file.c (do_save_as, dialog_query_load_file): make check less
	stringent for fnames if using bonobo.

	* src/functions/fn-financial.c (coupdaybs): add brackets.

	* src/sheet-object.c (sheet_object_stop_editing): NULL the
	current_object.
parent c58d6a1a
2000-07-12 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): add bonobo_shutdown.
* src/sheet-object-bonobo.c (sheet_object_bonobo_destroy): unref not
destroy the bonobo object.
* src/sheet-object-container.c (item_destroyed): ditto.
* src/sheet-vector.c (sheet_vector_new): ditto.
2000-07-07 Michael Meeks <michael@helixcode.com>
* src/file.c (do_save_as, dialog_query_load_file): make check less
stringent for fnames if using bonobo.
* src/functions/fn-financial.c (coupdaybs): add brackets.
* src/sheet-object.c (sheet_object_stop_editing): NULL the
current_object.
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/history.c (history_menu_item_create) : Fix.
......
2000-07-12 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): add bonobo_shutdown.
* src/sheet-object-bonobo.c (sheet_object_bonobo_destroy): unref not
destroy the bonobo object.
* src/sheet-object-container.c (item_destroyed): ditto.
* src/sheet-vector.c (sheet_vector_new): ditto.
2000-07-07 Michael Meeks <michael@helixcode.com>
* src/file.c (do_save_as, dialog_query_load_file): make check less
stringent for fnames if using bonobo.
* src/functions/fn-financial.c (coupdaybs): add brackets.
* src/sheet-object.c (sheet_object_stop_editing): NULL the
current_object.
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/history.c (history_menu_item_create) : Fix.
......
2000-07-12 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): add bonobo_shutdown.
* src/sheet-object-bonobo.c (sheet_object_bonobo_destroy): unref not
destroy the bonobo object.
* src/sheet-object-container.c (item_destroyed): ditto.
* src/sheet-vector.c (sheet_vector_new): ditto.
2000-07-07 Michael Meeks <michael@helixcode.com>
* src/file.c (do_save_as, dialog_query_load_file): make check less
stringent for fnames if using bonobo.
* src/functions/fn-financial.c (coupdaybs): add brackets.
* src/sheet-object.c (sheet_object_stop_editing): NULL the
current_object.
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/history.c (history_menu_item_create) : Fix.
......
2000-07-12 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): add bonobo_shutdown.
* src/sheet-object-bonobo.c (sheet_object_bonobo_destroy): unref not
destroy the bonobo object.
* src/sheet-object-container.c (item_destroyed): ditto.
* src/sheet-vector.c (sheet_vector_new): ditto.
2000-07-07 Michael Meeks <michael@helixcode.com>
* src/file.c (do_save_as, dialog_query_load_file): make check less
stringent for fnames if using bonobo.
* src/functions/fn-financial.c (coupdaybs): add brackets.
* src/sheet-object.c (sheet_object_stop_editing): NULL the
current_object.
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/history.c (history_menu_item_create) : Fix.
......
2000-07-12 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): add bonobo_shutdown.
* src/sheet-object-bonobo.c (sheet_object_bonobo_destroy): unref not
destroy the bonobo object.
* src/sheet-object-container.c (item_destroyed): ditto.
* src/sheet-vector.c (sheet_vector_new): ditto.
2000-07-07 Michael Meeks <michael@helixcode.com>
* src/file.c (do_save_as, dialog_query_load_file): make check less
stringent for fnames if using bonobo.
* src/functions/fn-financial.c (coupdaybs): add brackets.
* src/sheet-object.c (sheet_object_stop_editing): NULL the
current_object.
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/history.c (history_menu_item_create) : Fix.
......
2000-07-12 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): add bonobo_shutdown.
* src/sheet-object-bonobo.c (sheet_object_bonobo_destroy): unref not
destroy the bonobo object.
* src/sheet-object-container.c (item_destroyed): ditto.
* src/sheet-vector.c (sheet_vector_new): ditto.
2000-07-07 Michael Meeks <michael@helixcode.com>
* src/file.c (do_save_as, dialog_query_load_file): make check less
stringent for fnames if using bonobo.
* src/functions/fn-financial.c (coupdaybs): add brackets.
* src/sheet-object.c (sheet_object_stop_editing): NULL the
current_object.
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/history.c (history_menu_item_create) : Fix.
......
2000-07-12 Michael Meeks <michael@helixcode.com>
* src/main.c (gnumeric_main): add bonobo_shutdown.
* src/sheet-object-bonobo.c (sheet_object_bonobo_destroy): unref not
destroy the bonobo object.
* src/sheet-object-container.c (item_destroyed): ditto.
* src/sheet-vector.c (sheet_vector_new): ditto.
2000-07-07 Michael Meeks <michael@helixcode.com>
* src/file.c (do_save_as, dialog_query_load_file): make check less
stringent for fnames if using bonobo.
* src/functions/fn-financial.c (coupdaybs): add brackets.
* src/sheet-object.c (sheet_object_stop_editing): NULL the
current_object.
2000-07-09 Jody Goldberg <jgoldberg@home.com>
* src/history.c (history_menu_item_create) : Fix.
......
2000-07-12 Michael Meeks <michael@helixcode.com>
* ms-escher.c (ms_escher_blip_destroy): unref not destroy bonobo object.
2000-07-06 Jody Goldberg <jgoldberg@home.com>
* ms-obj.c (ms_read_OBJ) : Take an ExcelSheet.
......
......@@ -76,7 +76,7 @@ ms_escher_blip_destroy (EscherBlip *blip)
blip->repo_id = NULL;
#ifdef ENABLE_BONOBO
if (blip->stream)
bonobo_object_destroy (BONOBO_OBJECT (blip->stream));
bonobo_object_unref (BONOBO_OBJECT (blip->stream));
blip->stream = NULL;
#else
g_free (blip->raw_data);
......
......@@ -191,11 +191,12 @@ days_monthly_basis (Value *issue_date, Value *maturity_date, int basis)
}
}
/* Returns the number of days in the coupon period of the settlement date.
/*
* Returns the number of days in the coupon period of the settlement date.
* Currently, returns negative numbers if the branch is not implemented.
*/
static float_t
coupdays(GDate *settlement, GDate *maturity, int freq, int basis)
coupdays (GDate *settlement, GDate *maturity, int freq, int basis)
{
GDateYear sy, my;
GDateMonth sm, mm;
......@@ -215,20 +216,21 @@ coupdays(GDate *settlement, GDate *maturity, int freq, int basis)
case 3:
return 365.0 / freq;
case 1:
sy = g_date_year (settlement);
my = g_date_year (maturity);
sy = g_date_year (settlement);
my = g_date_year (maturity);
sm = g_date_month (settlement);
mm = g_date_month (maturity);
sd = g_date_day (settlement);
md = g_date_day (maturity);
sd = g_date_day (settlement);
md = g_date_day (maturity);
if (freq == 1) {
if (g_date_is_leap_year (sy)) {
if (sm == 1 || sm == 2)
if (sm == 1 || sm == 2) {
if (sm < mm || (sm == mm && sd < md))
return 365.0;
else
return 366.0;
}
if (mm == 1 || mm == 2)
return 366.0;
if (sm < mm || (sm == mm && sd < md))
......@@ -264,7 +266,8 @@ coupdays(GDate *settlement, GDate *maturity, int freq, int basis)
}
}
/* Returns the number of days from the beginning of the coupon period to
/*
* Returns the number of days from the beginning of the coupon period to
* the settlement date. Currently, returns negative numbers if the branch
* is not implemented.
*/
......@@ -276,12 +279,12 @@ coupdaybs(GDate *settlement, GDate *maturity, int freq, int basis)
GDateMonth sm, mm;
GDateDay sd, md;
sy = g_date_year (settlement);
my = g_date_year (maturity);
sy = g_date_year (settlement);
my = g_date_year (maturity);
sm = g_date_month (settlement);
mm = g_date_month (maturity);
sd = g_date_day (settlement);
md = g_date_day (maturity);
sd = g_date_day (settlement);
md = g_date_day (maturity);
months = mm - sm;
......@@ -289,15 +292,18 @@ coupdaybs(GDate *settlement, GDate *maturity, int freq, int basis)
case 0: /* US 30/360 */
days = md - sd;
if (! g_date_is_leap_year (sy) && g_date_is_leap_year(my)
&& mm == 2 && md == 29)
if (! g_date_is_leap_year (sy) &&
g_date_is_leap_year (my) &&
mm == 2 && md == 29)
--days;
else if (g_date_is_leap_year (sy) && ! g_date_is_leap_year(my)
&& mm == 2 && md == 28)
else if (g_date_is_leap_year (sy) &&
!g_date_is_leap_year (my) &&
mm == 2 && md == 28) {
if (sd == 29 && sm == 2)
return 0;
else
days += 2;
}
d = 360 - months*30 - days;
......@@ -309,16 +315,17 @@ coupdaybs(GDate *settlement, GDate *maturity, int freq, int basis)
d = 360;
else
d %= 360;
} else if (freq == 2)
} else if (freq == 2) {
if ((d % 180) == 0 && days)
d = 180;
else
d %= 180;
else
} else {
if ((d % 90) == 0 && days)
d = 90;
else
d %= 90;
}
return d;
case 1:
......@@ -326,8 +333,9 @@ coupdaybs(GDate *settlement, GDate *maturity, int freq, int basis)
case 3:
return -1;
case 4: /* European 30/360 */
if (! g_date_is_leap_year (sy) && g_date_is_leap_year(my)
&& mm == 2 && md == 29)
if (!g_date_is_leap_year (sy) &&
g_date_is_leap_year (my) &&
mm == 2 && md == 29)
return 0;
if (sd == 31)
......
2000-07-06 Michael Meeks <michael@helixcode.com>
* plugin.c (scm_register_function): kill g_strdup leak.
2000-06-29 Michael Meeks <michael@helixcode.com>
* plugin.c (expr_to_scm): use func->name not func->symbol.
......
......@@ -443,7 +443,7 @@ scm_register_function (SCM scm_name, SCM scm_args, SCM scm_help, SCM scm_categor
help = g_new (char *, 1);
*help = g_strdup (SCM_CHARS (scm_help));
cat = function_get_category (g_strdup (SCM_CHARS (scm_category)));
cat = function_get_category (SCM_CHARS (scm_category));
fndef = function_add_args (cat, g_strdup (SCM_CHARS (scm_name)),
g_strdup (SCM_CHARS (scm_args)), NULL,
help, func_marshal_func);
......
......@@ -487,7 +487,7 @@ gnumeric_bonobo_io_probe (const char *filename)
g_warning ("Type detection hack for now");
if ((p = strrchr (filename, '.')) &&
g_strcasecmp (p + 1, "g2"))
!g_strncasecmp (p + 1, "efs", 3))
return TRUE;
else
return FALSE;
......@@ -500,6 +500,6 @@ gnumeric_bonobo_io_init (void)
file_format_register_open (100, desc, gnumeric_bonobo_io_probe,
gnumeric_bonobo_read_workbook);
file_format_register_save (".gnumeric", desc, FILE_FL_AUTO,
file_format_register_save ("", desc, FILE_FL_AUTO,
gnumeric_bonobo_write_workbook);
}
......@@ -239,7 +239,8 @@ file_finish_load (Workbook *wb)
if (wb != NULL) {
workbook_recalc (wb);
/* render and calc size of unrendered cells,
/*
* render and calc size of unrendered cells,
* then calc spans for everything
*/
workbook_calc_spans (wb, SPANCALC_RENDER|SPANCALC_RESIZE);
......@@ -608,11 +609,13 @@ do_save_as (CommandContext *context, Workbook *wb, const char *name)
const char *base;
gboolean success = FALSE;
#ifndef ENABLE_BONOBO
if (*name == 0 || name [strlen (name) - 1] == '/') {
gnumeric_notice (wb, GNOME_MESSAGE_BOX_ERROR,
_("Please enter a file name,\nnot a directory"));
return FALSE;
}
#endif
current_saver = insure_saver (current_saver);
if (!current_saver) {
......@@ -767,9 +770,11 @@ dialog_query_load_file (Workbook *wb)
if (accepted) {
char *name = gtk_file_selection_get_filename (fsel);
#ifndef ENABLE_BONOBO
if (*name && name [strlen (name) - 1] == '/')
result = NULL;
else
#endif
result = g_strdup (name);
} else
result = NULL;
......
......@@ -191,11 +191,12 @@ days_monthly_basis (Value *issue_date, Value *maturity_date, int basis)
}
}
/* Returns the number of days in the coupon period of the settlement date.
/*
* Returns the number of days in the coupon period of the settlement date.
* Currently, returns negative numbers if the branch is not implemented.
*/
static float_t
coupdays(GDate *settlement, GDate *maturity, int freq, int basis)
coupdays (GDate *settlement, GDate *maturity, int freq, int basis)
{
GDateYear sy, my;
GDateMonth sm, mm;
......@@ -215,20 +216,21 @@ coupdays(GDate *settlement, GDate *maturity, int freq, int basis)
case 3:
return 365.0 / freq;
case 1:
sy = g_date_year (settlement);
my = g_date_year (maturity);
sy = g_date_year (settlement);
my = g_date_year (maturity);
sm = g_date_month (settlement);
mm = g_date_month (maturity);
sd = g_date_day (settlement);
md = g_date_day (maturity);
sd = g_date_day (settlement);
md = g_date_day (maturity);
if (freq == 1) {
if (g_date_is_leap_year (sy)) {
if (sm == 1 || sm == 2)
if (sm == 1 || sm == 2) {
if (sm < mm || (sm == mm && sd < md))
return 365.0;
else
return 366.0;
}
if (mm == 1 || mm == 2)
return 366.0;
if (sm < mm || (sm == mm && sd < md))
......@@ -264,7 +266,8 @@ coupdays(GDate *settlement, GDate *maturity, int freq, int basis)
}
}
/* Returns the number of days from the beginning of the coupon period to
/*
* Returns the number of days from the beginning of the coupon period to
* the settlement date. Currently, returns negative numbers if the branch
* is not implemented.
*/
......@@ -276,12 +279,12 @@ coupdaybs(GDate *settlement, GDate *maturity, int freq, int basis)
GDateMonth sm, mm;
GDateDay sd, md;
sy = g_date_year (settlement);
my = g_date_year (maturity);
sy = g_date_year (settlement);
my = g_date_year (maturity);
sm = g_date_month (settlement);
mm = g_date_month (maturity);
sd = g_date_day (settlement);
md = g_date_day (maturity);
sd = g_date_day (settlement);
md = g_date_day (maturity);
months = mm - sm;
......@@ -289,15 +292,18 @@ coupdaybs(GDate *settlement, GDate *maturity, int freq, int basis)
case 0: /* US 30/360 */
days = md - sd;
if (! g_date_is_leap_year (sy) && g_date_is_leap_year(my)
&& mm == 2 && md == 29)
if (! g_date_is_leap_year (sy) &&
g_date_is_leap_year (my) &&
mm == 2 && md == 29)
--days;
else if (g_date_is_leap_year (sy) && ! g_date_is_leap_year(my)
&& mm == 2 && md == 28)
else if (g_date_is_leap_year (sy) &&
!g_date_is_leap_year (my) &&
mm == 2 && md == 28) {
if (sd == 29 && sm == 2)
return 0;
else
days += 2;
}
d = 360 - months*30 - days;
......@@ -309,16 +315,17 @@ coupdaybs(GDate *settlement, GDate *maturity, int freq, int basis)
d = 360;
else
d %= 360;
} else if (freq == 2)
} else if (freq == 2) {
if ((d % 180) == 0 && days)
d = 180;
else
d %= 180;
else
} else {
if ((d % 90) == 0 && days)
d = 90;
else
d %= 90;
}
return d;
case 1:
......@@ -326,8 +333,9 @@ coupdaybs(GDate *settlement, GDate *maturity, int freq, int basis)
case 3:
return -1;
case 4: /* European 30/360 */
if (! g_date_is_leap_year (sy) && g_date_is_leap_year(my)
&& mm == 2 && md == 29)
if (!g_date_is_leap_year (sy) &&
g_date_is_leap_year (my) &&
mm == 2 && md == 29)
return 0;
if (sd == 31)
......
......@@ -235,6 +235,11 @@ gnumeric_main (void *closure, int argc, char *argv [])
global_gnome_font_shutdown ();
gnome_config_drop_all ();
#ifdef ENABLE_BONOBO
bonobo_shutdown ();
#endif
}
#ifdef HAVE_GUILE
......
......@@ -235,6 +235,11 @@ gnumeric_main (void *closure, int argc, char *argv [])
global_gnome_font_shutdown ();
gnome_config_drop_all ();
#ifdef ENABLE_BONOBO
bonobo_shutdown ();
#endif
}
#ifdef HAVE_GUILE
......
......@@ -44,7 +44,7 @@ sheet_object_bonobo_destroy (GtkObject *object)
GTK_OBJECT_CLASS (sheet_object_bonobo_parent_class)->destroy (object);
if (sob->client_site)
bonobo_object_destroy (BONOBO_OBJECT (sob->client_site));
bonobo_object_unref (BONOBO_OBJECT (sob->client_site));
g_free (sob->object_id);
......
......@@ -108,7 +108,7 @@ view_activated_cb (BonoboViewFrame *view_frame, gboolean activated, SheetObject
static void
item_destroyed (GnomeCanvasItem *item, BonoboViewFrame *view_frame)
{
bonobo_object_destroy (BONOBO_OBJECT (view_frame));
bonobo_object_unref (BONOBO_OBJECT (view_frame));
}
static GnomeCanvasItem *
......
......@@ -638,7 +638,11 @@ sheet_button_press (GnumericSheet *gsheet, GdkEventButton *event, Sheet *sheet)
sheet_set_mode_type (sheet, SHEET_MODE_SHEET);
return 1;
}
/*
* FIXME: we need to connect to 'out of scope' type signals here and
* finalize object creation then
*/
gtk_signal_connect (GTK_OBJECT (gsheet), "button_release_event",
GTK_SIGNAL_FUNC (sheet_button_release), sheet);
gtk_signal_connect (GTK_OBJECT (gsheet), "motion_notify_event",
......@@ -844,6 +848,8 @@ sheet_object_stop_editing (SheetObject *so)
if (so == sheet->current_object)
sheet_object_destroy_control_points (sheet);
sheet->current_object = NULL;
}
/*
......
......@@ -359,7 +359,7 @@ sheet_vector_new (Sheet *sheet)
corba_vector = sheet_vector_corba_object_create (BONOBO_OBJECT (sheet_vector));
if (corba_vector == NULL) {
bonobo_object_destroy (BONOBO_OBJECT (sheet_vector));
bonobo_object_unref (BONOBO_OBJECT (sheet_vector));
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment