Commit 8259d107 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

GraphSeries is responsible for registering.

2000-09-17  Jody Goldberg <jgoldberg@home.com>

	* src/dialogs/dialog-graph-guru.c (cb_create_series_from_range) :
	  GraphSeries is responsible for registering.

	* src/history.c : Attempt to convert to the new bonobo ui handler.

	* src/graph-series.c (graph_series_eval) : Support string and date
	  series.
	(series_get_name) : New function.
	(impl_vector_scalar_value) : Use it here.
	(impl_vector_date_value) : here
	(impl_vector_string_value) : and here.
	(cb_check_range_for_pure_string) : new function.
	(graph_series_new) : Start guess whether a series is scalar or string.
	(graph_series_servant) : Delete.
	(graph_series_set_subscriber) : Take responsibility for registering
	  with the remote Graph::Manager.

	* src/gnumeric.xml : Remove bogus '/menu/File/open' placeholder
	  Name the '/menu/File/FileHistory' placeholder.

	* src/sheet-object-container.c (sheet_object_container_update_bounds)
	  Fix off by 1 error here.
	(make_container_item) : And here.

	* src/sheet-object.c (sheet_object_add_view) : Renamed from
	  sheet_view_object_realize.
	(sheet_object_remove_view) : Renamed from sheet_view_object_unrealize.
	(control_point_handle_event) : Enable edit popup from control points.
parent 2f343484
......@@ -73,6 +73,15 @@ Long term breakage
- latex : multiline rows not handled properly.
: nor are spans
- SheetObjects : use GtkArg and remove cruft from xml-io.
: Add data member to Class to indicate 'simple' object
types that can be rubber banded directly.
: Add bounding_box_add
bounding_box_remove
to handle shaped objects.
- Parser : The single character '%' is parsed as an expression '0%'
Dialogs
-------
- Use color combos in format dialog.
......
2000-09-17 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_create_series_from_range) :
GraphSeries is responsible for registering.
* src/history.c : Attempt to convert to the new bonobo ui handler.
* src/graph-series.c (graph_series_eval) : Support string and date
series.
(series_get_name) : New function.
(impl_vector_scalar_value) : Use it here.
(impl_vector_date_value) : here
(impl_vector_string_value) : and here.
(cb_check_range_for_pure_string) : new function.
(graph_series_new) : Start guess whether a series is scalar or string.
(graph_series_servant) : Delete.
(graph_series_set_subscriber) : Take responsibility for registering
with the remote Graph::Manager.
* src/gnumeric.xml : Remove bogus '/menu/File/open' placeholder
Name the '/menu/File/FileHistory' placeholder.
* src/sheet-object-container.c (sheet_object_container_update_bounds)
Fix off by 1 error here.
(make_container_item) : And here.
* src/sheet-object.c (sheet_object_add_view) : Renamed from
sheet_view_object_realize.
(sheet_object_remove_view) : Renamed from sheet_view_object_unrealize.
(control_point_handle_event) : Enable edit popup from control points.
2000-09-16 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/autoformat.glade:
......
2000-09-17 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_create_series_from_range) :
GraphSeries is responsible for registering.
* src/history.c : Attempt to convert to the new bonobo ui handler.
* src/graph-series.c (graph_series_eval) : Support string and date
series.
(series_get_name) : New function.
(impl_vector_scalar_value) : Use it here.
(impl_vector_date_value) : here
(impl_vector_string_value) : and here.
(cb_check_range_for_pure_string) : new function.
(graph_series_new) : Start guess whether a series is scalar or string.
(graph_series_servant) : Delete.
(graph_series_set_subscriber) : Take responsibility for registering
with the remote Graph::Manager.
* src/gnumeric.xml : Remove bogus '/menu/File/open' placeholder
Name the '/menu/File/FileHistory' placeholder.
* src/sheet-object-container.c (sheet_object_container_update_bounds)
Fix off by 1 error here.
(make_container_item) : And here.
* src/sheet-object.c (sheet_object_add_view) : Renamed from
sheet_view_object_realize.
(sheet_object_remove_view) : Renamed from sheet_view_object_unrealize.
(control_point_handle_event) : Enable edit popup from control points.
2000-09-16 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/autoformat.glade:
......
2000-09-17 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_create_series_from_range) :
GraphSeries is responsible for registering.
* src/history.c : Attempt to convert to the new bonobo ui handler.
* src/graph-series.c (graph_series_eval) : Support string and date
series.
(series_get_name) : New function.
(impl_vector_scalar_value) : Use it here.
(impl_vector_date_value) : here
(impl_vector_string_value) : and here.
(cb_check_range_for_pure_string) : new function.
(graph_series_new) : Start guess whether a series is scalar or string.
(graph_series_servant) : Delete.
(graph_series_set_subscriber) : Take responsibility for registering
with the remote Graph::Manager.
* src/gnumeric.xml : Remove bogus '/menu/File/open' placeholder
Name the '/menu/File/FileHistory' placeholder.
* src/sheet-object-container.c (sheet_object_container_update_bounds)
Fix off by 1 error here.
(make_container_item) : And here.
* src/sheet-object.c (sheet_object_add_view) : Renamed from
sheet_view_object_realize.
(sheet_object_remove_view) : Renamed from sheet_view_object_unrealize.
(control_point_handle_event) : Enable edit popup from control points.
2000-09-16 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/autoformat.glade:
......
2000-09-17 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_create_series_from_range) :
GraphSeries is responsible for registering.
* src/history.c : Attempt to convert to the new bonobo ui handler.
* src/graph-series.c (graph_series_eval) : Support string and date
series.
(series_get_name) : New function.
(impl_vector_scalar_value) : Use it here.
(impl_vector_date_value) : here
(impl_vector_string_value) : and here.
(cb_check_range_for_pure_string) : new function.
(graph_series_new) : Start guess whether a series is scalar or string.
(graph_series_servant) : Delete.
(graph_series_set_subscriber) : Take responsibility for registering
with the remote Graph::Manager.
* src/gnumeric.xml : Remove bogus '/menu/File/open' placeholder
Name the '/menu/File/FileHistory' placeholder.
* src/sheet-object-container.c (sheet_object_container_update_bounds)
Fix off by 1 error here.
(make_container_item) : And here.
* src/sheet-object.c (sheet_object_add_view) : Renamed from
sheet_view_object_realize.
(sheet_object_remove_view) : Renamed from sheet_view_object_unrealize.
(control_point_handle_event) : Enable edit popup from control points.
2000-09-16 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/autoformat.glade:
......
2000-09-17 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_create_series_from_range) :
GraphSeries is responsible for registering.
* src/history.c : Attempt to convert to the new bonobo ui handler.
* src/graph-series.c (graph_series_eval) : Support string and date
series.
(series_get_name) : New function.
(impl_vector_scalar_value) : Use it here.
(impl_vector_date_value) : here
(impl_vector_string_value) : and here.
(cb_check_range_for_pure_string) : new function.
(graph_series_new) : Start guess whether a series is scalar or string.
(graph_series_servant) : Delete.
(graph_series_set_subscriber) : Take responsibility for registering
with the remote Graph::Manager.
* src/gnumeric.xml : Remove bogus '/menu/File/open' placeholder
Name the '/menu/File/FileHistory' placeholder.
* src/sheet-object-container.c (sheet_object_container_update_bounds)
Fix off by 1 error here.
(make_container_item) : And here.
* src/sheet-object.c (sheet_object_add_view) : Renamed from
sheet_view_object_realize.
(sheet_object_remove_view) : Renamed from sheet_view_object_unrealize.
(control_point_handle_event) : Enable edit popup from control points.
2000-09-16 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/autoformat.glade:
......
2000-09-17 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_create_series_from_range) :
GraphSeries is responsible for registering.
* src/history.c : Attempt to convert to the new bonobo ui handler.
* src/graph-series.c (graph_series_eval) : Support string and date
series.
(series_get_name) : New function.
(impl_vector_scalar_value) : Use it here.
(impl_vector_date_value) : here
(impl_vector_string_value) : and here.
(cb_check_range_for_pure_string) : new function.
(graph_series_new) : Start guess whether a series is scalar or string.
(graph_series_servant) : Delete.
(graph_series_set_subscriber) : Take responsibility for registering
with the remote Graph::Manager.
* src/gnumeric.xml : Remove bogus '/menu/File/open' placeholder
Name the '/menu/File/FileHistory' placeholder.
* src/sheet-object-container.c (sheet_object_container_update_bounds)
Fix off by 1 error here.
(make_container_item) : And here.
* src/sheet-object.c (sheet_object_add_view) : Renamed from
sheet_view_object_realize.
(sheet_object_remove_view) : Renamed from sheet_view_object_unrealize.
(control_point_handle_event) : Enable edit popup from control points.
2000-09-16 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/autoformat.glade:
......
2000-09-17 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-graph-guru.c (cb_create_series_from_range) :
GraphSeries is responsible for registering.
* src/history.c : Attempt to convert to the new bonobo ui handler.
* src/graph-series.c (graph_series_eval) : Support string and date
series.
(series_get_name) : New function.
(impl_vector_scalar_value) : Use it here.
(impl_vector_date_value) : here
(impl_vector_string_value) : and here.
(cb_check_range_for_pure_string) : new function.
(graph_series_new) : Start guess whether a series is scalar or string.
(graph_series_servant) : Delete.
(graph_series_set_subscriber) : Take responsibility for registering
with the remote Graph::Manager.
* src/gnumeric.xml : Remove bogus '/menu/File/open' placeholder
Name the '/menu/File/FileHistory' placeholder.
* src/sheet-object-container.c (sheet_object_container_update_bounds)
Fix off by 1 error here.
(make_container_item) : And here.
* src/sheet-object.c (sheet_object_add_view) : Renamed from
sheet_view_object_realize.
(sheet_object_remove_view) : Renamed from sheet_view_object_unrealize.
(control_point_handle_event) : Enable edit popup from control points.
2000-09-16 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/autoformat.glade:
......
......@@ -11,8 +11,6 @@
_descr="Open a file"
pixtype="stock" pixname="Menu_Open" accel="F3"/>
<placeholder name="open"/>
<menuitem name="FileImport" verb="" _label="_Import..."
_descr="Imports a file"
pixtype="stock" pixname="Menu_Open"/>
......@@ -43,7 +41,7 @@
_descr="Close the current file" pixtype="stock" pixname="Menu_Close"
accel="*Control*w"/>
<placeholder delimit="both"/>
<placeholder name="FileHistory" delimit="both"/>
<menuitem name="FileExit" verb="" _label="E_xit" _descr="Exit the program"
pixtype="stock" pixname="Menu_Exit" accel="*Control*q"/>
......@@ -142,7 +140,6 @@
_label="_Recalculate"
_descr="Recalculate the spreadsheet" accel="F9"/>
<placeholder name="ops"/>
</submenu>
......
......@@ -306,22 +306,14 @@ graph_guru_init_manager (GraphGuruState *state)
static gboolean
cb_create_series_from_range(Sheet *sheet,
Range const *src,
gpointer user_data)
cb_create_series_from_range (Sheet *sheet, Range const *src, gpointer user_data)
{
CORBA_Environment ev;
GNOME_Gnumeric_VectorScalarNotify subscriber;
GraphGuruState *state = user_data;
GraphSeries *series;
Range vector;
int i, count;
CORBA_exception_init (&ev);
vector = *src;
if (state->is_columns) {
count = vector.end.col - vector.start.col;
vector.end.col = vector.start.col;
......@@ -332,10 +324,7 @@ cb_create_series_from_range(Sheet *sheet,
for (i = 0 ; i <= count ; i++) {
series = graph_series_new (sheet, &vector);
subscriber = GNOME_Gnumeric_Graph_Manager_addVectorScalar (
state->manager,
graph_series_servant (series), &ev);
graph_series_set_subscriber (series, subscriber);
graph_series_set_subscriber (series, state->manager);
g_ptr_array_add (state->series, series);
if (state->is_columns)
......@@ -344,7 +333,6 @@ cb_create_series_from_range(Sheet *sheet,
vector.end.row = ++vector.start.row;
}
CORBA_exception_free (&ev);
return TRUE;
}
......
......@@ -11,8 +11,6 @@
_descr="Open a file"
pixtype="stock" pixname="Menu_Open" accel="F3"/>
<placeholder name="open"/>
<menuitem name="FileImport" verb="" _label="_Import..."
_descr="Imports a file"
pixtype="stock" pixname="Menu_Open"/>
......@@ -43,7 +41,7 @@
_descr="Close the current file" pixtype="stock" pixname="Menu_Close"
accel="*Control*w"/>
<placeholder delimit="both"/>
<placeholder name="FileHistory" delimit="both"/>
<menuitem name="FileExit" verb="" _label="E_xit" _descr="Exit the program"
pixtype="stock" pixname="Menu_Exit" accel="*Control*q"/>
......@@ -142,7 +140,6 @@
_label="_Recalculate"
_descr="Recalculate the spreadsheet" accel="F9"/>
<placeholder name="ops"/>
</submenu>
......
......@@ -39,6 +39,7 @@ struct _GraphSeries {
GraphSeriesType type;
gboolean is_column;
Range range; /* TODO : add support for discontinuous */
CORBA_Object vector_ref;
union {
......@@ -169,14 +170,52 @@ graph_series_eval (Dependent *dep)
g_return_if_fail (series != NULL);
CORBA_exception_init (&ev);
GNOME_Gnumeric_VectorScalarNotify_changed (
series->subscriber.scalar,
0, graph_series_seq_scalar (series), &ev);
switch (series->type) {
case SERIES_SCALAR :
GNOME_Gnumeric_VectorScalarNotify_changed (
series->subscriber.scalar,
0, graph_series_seq_scalar (series), &ev);
break;
case SERIES_DATE :
GNOME_Gnumeric_VectorDateNotify_changed (
series->subscriber.date,
0, graph_series_seq_date (series), &ev);
break;
case SERIES_STRING :
GNOME_Gnumeric_VectorStringNotify_changed (
series->subscriber.string,
0, graph_series_seq_string (series), &ev);
break;
default :
g_assert_not_reached ();
}
if (ev._major != CORBA_NO_EXCEPTION)
g_warning ("Problems notifying graph of change %p", series);
CORBA_exception_free (&ev);
}
/******************************************************************************/
static char *
series_get_name (GraphSeries const *series, char const *prefix)
{
static int counter = 0;
++counter;
if (range_has_header (series->dep.sheet, &series->range,
series->is_column)) {
Cell const *cell = sheet_cell_get (series->dep.sheet,
series->range.start.col,
series->range.start.row);
return value_get_as_string (cell->value);
} else
return g_strdup_printf ("%sseries%d", prefix, ++counter);
}
static void
impl_vector_scalar_value (PortableServer_Servant servant,
GNOME_Gnumeric_SeqScalar **values,
......@@ -184,12 +223,15 @@ impl_vector_scalar_value (PortableServer_Servant servant,
CORBA_Environment *ev)
{
GraphSeries *series = SERVANT_TO_GRAPH_SERIES (servant);
char *label;
g_return_if_fail (GRAPH_SERIES (series) != NULL);
g_return_if_fail (series->type == SERIES_SCALAR);
*name = CORBA_string_dup ("BOBO");
label = series_get_name (series, "SCALAR");
*name = CORBA_string_dup (label);
*values = graph_series_seq_scalar (series);
g_free (label);
}
static void
......@@ -199,12 +241,15 @@ impl_vector_date_value (PortableServer_Servant servant,
CORBA_Environment *ev)
{
GraphSeries *series = SERVANT_TO_GRAPH_SERIES (servant);
char *label;
g_return_if_fail (GRAPH_SERIES (series) != NULL);
g_return_if_fail (series->type == SERIES_DATE);
*name = CORBA_string_dup ("BOBO");
label = series_get_name (series, "DATE");
*name = CORBA_string_dup (label);
*values = graph_series_seq_date (series);
g_free (label);
}
static void
......@@ -214,12 +259,15 @@ impl_vector_string_value (PortableServer_Servant servant,
CORBA_Environment *ev)
{
GraphSeries *series = SERVANT_TO_GRAPH_SERIES (servant);
char *label;
g_return_if_fail (GRAPH_SERIES (series) != NULL);
g_return_if_fail (series->type == SERIES_STRING);
*name = CORBA_string_dup ("BOBO");
label = series_get_name (series, "STRING");
*name = CORBA_string_dup (label);
*values = graph_series_seq_string (series);
g_free (label);
}
/******************************************************************************/
......@@ -379,24 +427,42 @@ graph_series_get_dep_type ()
return type;
}
/* TODO:
* Do we need to evaluate this as an expression ?
*/
static Value *
cb_check_range_for_pure_string (Sheet *sheet, int col, int row,
Cell *cell, void *user_data)
{
if (cell == NULL || cell->value->type != VALUE_STRING)
return value_terminate ();
return NULL;
}
GraphSeries *
graph_series_new (Sheet *sheet, Range const *r)
{
CORBA_Environment ev;
PortableServer_Servant serv = CORBA_OBJECT_NIL;
GraphSeries *series;
GraphSeriesType type = SERIES_SCALAR;
GraphSeriesType type;
series = gtk_type_new (graph_series_get_type ());
printf ("series::new () = 0x%p\n", series);
if (sheet_cell_foreach_range (sheet, FALSE,
r->start.col, r->start.row,
r->end.col, r->end.row,
&cb_check_range_for_pure_string,
NULL))
type = SERIES_SCALAR;
else
type = SERIES_STRING;
printf ("series::new (%d) = 0x%p\n", type, series);
series->type = type;
series->is_column = (r->start.col == r->end.col);
if (range_has_header (sheet, r, series->is_column)) {
puts ("has name");
} else {
puts ("generate name");
}
series->range = *r;
series->dep.sheet = sheet;
series->dep.flags = graph_series_get_dep_type ();
......@@ -441,17 +507,38 @@ graph_series_new (Sheet *sheet, Range const *r)
return series;
}
CORBA_Object
graph_series_servant (GraphSeries const *series)
{
g_return_val_if_fail (IS_GRAPH_SERIES (series), CORBA_OBJECT_NIL);
return series->vector_ref;
}
void
graph_series_set_subscriber (GraphSeries *series, CORBA_Object obj)
graph_series_set_subscriber (GraphSeries *series, CORBA_Object graph_manager)
{
CORBA_Environment ev;
GNOME_Gnumeric_Graph_Manager manager = graph_manager;
g_return_if_fail (series->subscriber.scalar == CORBA_OBJECT_NIL);
series->subscriber.scalar = obj;
CORBA_exception_init (&ev);
switch (series->type) {
case SERIES_SCALAR :
series->subscriber.scalar =
GNOME_Gnumeric_Graph_Manager_addVectorScalar (manager,
series->vector_ref, &ev);
break;
case SERIES_DATE :
series->subscriber.scalar =
GNOME_Gnumeric_Graph_Manager_addVectorDate (manager,
series->vector_ref, &ev);
break;
case SERIES_STRING :
series->subscriber.scalar =
GNOME_Gnumeric_Graph_Manager_addVectorString (manager,
series->vector_ref, &ev);
break;
default :
g_assert_not_reached();
}
if (ev._major != CORBA_NO_EXCEPTION)
g_warning ("Problems registering series %p", series);
CORBA_exception_free (&ev);
}
......@@ -7,7 +7,6 @@
typedef struct _GraphSeries GraphSeries;
GraphSeries *graph_series_new (Sheet *sheet, Range const *r);
CORBA_Object graph_series_servant (GraphSeries const *series);
void graph_series_set_subscriber (GraphSeries *series, CORBA_Object obj);
void graph_series_set_subscriber (GraphSeries *series, CORBA_Object manager);
#endif /* GNUMERIC_GRAPH_SERIES_H */
......@@ -63,9 +63,9 @@ file_history_cmd (BonoboUIHandler *uih, Workbook *wb, const char *path)
#endif
/*
* Returns a newly allocated string containing the base name of the file
* Returns a newly allocated string containing the base name of the file
* with any .gnumeric extension stripped off.
*/
*/
static gchar*
history_item_label (const gchar *name, const gint accel_number)
{
......@@ -117,6 +117,7 @@ history_menu_item_create (Workbook *wb, gchar *name, gint accel_number,
}
#endif
#ifndef ENABLE_BONOBO
typedef struct {
GtkWidget *menu;
gint pos;
......@@ -133,8 +134,6 @@ static MenuPos
history_menu_locate_separator (Workbook *wb)
{
MenuPos ret;
#ifndef ENABLE_BONOBO
/*
* xgettext:
* This string must translate to exactly the same strings as the
......@@ -142,30 +141,21 @@ history_menu_locate_separator (Workbook *wb)
* 'File' menu
*/
char const * menu_name = _("File/Print preview");
ret.menu = gnome_app_find_menu_pos (GNOME_APP (wb->toplevel)->menubar,
ret.menu = gnome_app_find_menu_pos (GNOME_APP (wb->toplevel)->menubar,
menu_name, &ret.pos);
#else
ret.menu = NULL;
ret.pos = bonobo_ui_handler_menu_get_pos (wb->priv->uih,
"/File/Print preview");
ret.pos++; /* see NOTE above */
#endif
return ret;
}
/*
* Insert the history separator. Return its position.
*/
/* Insert the history separator. Return its position. */
static MenuPos
history_menu_insert_separator (Workbook *wb)
{
MenuPos ret;
#ifndef ENABLE_BONOBO
GtkWidget *item;
char const * menu_name = _("File/Print preview");
ret.menu = gnome_app_find_menu_pos (GNOME_APP (wb->toplevel)->menubar,
ret.menu = gnome_app_find_menu_pos (GNOME_APP (wb->toplevel)->menubar,
menu_name, &ret.pos);
if (ret.menu != NULL) {
item = gtk_menu_item_new ();
......@@ -175,11 +165,6 @@ history_menu_insert_separator (Workbook *wb)
g_warning ("Probable mis-translation. '%s' : was not found. "
"Does this match the 'File/Print preview' menu exactly ?",
menu_name);
#else
ret = history_menu_locate_separator (wb);
bonobo_ui_handler_menu_new_separator (wb->priv->uih, "/File/histsep",
ret.pos);
#endif
return ret;
}
......@@ -187,7 +172,7 @@ history_menu_insert_separator (Workbook *wb)
* Add the history items list to the file menu for the workbook specified.
*/
static void
history_menu_insert_items (Workbook *wb, MenuPos *mp, GList *name_list)
history_menu_insert_items (Workbook *wb, GList *name_list, MenuPos *mp)
{
gint accel_number;
GList *l;
......@@ -197,25 +182,40 @@ history_menu_insert_items (Workbook *wb, MenuPos *mp, GList *name_list)
/* Add a new menu item for each item in the history list */
accel_number = 1;
for (l = name_list; l; l = l->next)
#ifndef ENABLE_BONOBO
history_menu_item_create (wb, (gchar *)l->data, accel_number++,
mp->menu, (mp->pos)++);
}
#else
{
char *str;
static void
history_menu_insert_items (Workbook *wb, GList *name_list)
{
CORBA_Environment ev;
gint accel_number;
GList *l;
g_return_if_fail (name_list != NULL);
str =
g_strdup_printf ("<placeholder><menuitem name=\"FileHistory%d\" label=\"_%d %s\"/></placeholder>\n",
accel_number, accel_number, l->data);
CORBA_exception_init (&ev);
/* Add a new menu item for each item in the history list */
accel_number = 1;
for (l = name_list; l; l = l->next) {
char *str, *label;
label = history_item_label (l->data, accel_number);
str = g_strdup_printf ("<menuitem name=\"FileHistory%d\" label=\"%s\"/>\n",
accel_number, label);
bonobo_ui_component_set (bonobo_ui_compat_get_component (wb->priv->uih),
bonobo_ui_compat_get_container (wb->priv->uih),
"/menu/File",
str, NULL);
"/menu/File/FileHistory",
str, &ev);
g_free (str);
g_free (label);
++accel_number;
}
#endif
CORBA_exception_free (&ev);
}
#endif
/*
* Remove the history list items from the file menu of the workbook
......@@ -227,11 +227,13 @@ history_menu_remove_items (Workbook *wb, GList *name_list)
gint accel_number = 1;
#ifdef ENABLE_BONOBO
GList *l;
CORBA_Environment ev;
#endif
gchar *label, *path;
#ifndef ENABLE_BONOBO
if (name_list) {
char *label, *path;
label = history_item_label ((gchar *)name_list->data, accel_number);
path = g_strconcat (_("File/"), label, NULL);
gnome_app_remove_menus (GNOME_APP (wb->toplevel), path,
......@@ -240,16 +242,38 @@ history_menu_remove_items (Workbook *wb, GList *name_list)
g_free (path);
}
#else
CORBA_exception_init (&ev);
for (l = name_list; l; l = l->next) {
label = history_item_label ((gchar *)l->data, accel_number++);
path = g_strconcat ("/File/", label, NULL);
bonobo_ui_handler_menu_remove (wb->priv->uih, path);
g_free (label);
char *path;
path = g_strdup_printf ("/menu/File/FileHistory%d", accel_number);
bonobo_ui_component_rm (bonobo_ui_compat_get_component (wb->priv->uih),
bonobo_ui_compat_get_container (wb->priv->uih),
path, &ev);
g_free (path);
}
CORBA_exception_free (&ev);
#endif
}
/*
* Remove the history list items from the file menus of all workbooks.
*
* All changes require that the list is removed and a new one built, because we
* add a digit in front of the file name.
*/
void
history_menu_flush (GList *wl, GList *name_list)
{
GList *l;
/* Update the menus in all open workbooks */
for (l = wl; l; l = g_list_next (l)) {
Workbook *wb = WORKBOOK (l->