Commit ea0ffbb9 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Make this smarter. Just append if the requested element is >= len

2004-09-27  Jody Goldberg <jody@gnome.org>

	* src/gutils.c (gnm_ptr_array_insert) : Make this smarter.
	  Just append if the requested element is >= len

	* src/item-grid.c (item_grid_event) : only auto-slide when we're
	  outside.  Inside we handle it locally fixes artificial movement that
	  seems to jump back to the start of the previous row/col

	* src/gnumeric-pane.c (cb_control_point_event) : Store the button that
	  initiated the object drag and check that when releasing.

	* src/commands.c (cmd_paste_copy) : handle pasting objects with no
	  content.

	* src/gutils.h : Fix the name spacing to be gnm_ in all cases.
	  gnumeric_ is too damn big, and we have not business using g_
	* src/gutils.c (gnm_usr_dir) : Check for empty home_dir

	* src/graph.c (gnm_go_data_vector_load_len) : handle missing
	  expression

	* src/gnm-so-filled.c (gnm_so_filled_read_xml_dom) : We still need to
	  Type field even though it is ugly.

	* src/xml-io.c (xml_cellregion_write) : cut-n-paste-o to fix
	  inter-process pasting
	(xml_cellregion_read) : Actually store the resulting objects
	(xml_read_sheet_object) : Don't set the sheet when extracting a
	  cellregion.
parent 1c9f4063
......@@ -10,10 +10,11 @@ Release Critical
debian 272697
: editing text boxes
: handle pasting clipboards with only objects
: kasal's popt patch
: check cancel in paste-special dialog
: editing text boxes
http://bugzilla.gnome.org/show_bug.cgi?id=152528
: No crash when reading broken xls
......
2004-09-27 Jody Goldberg <jody@gnome.org>
* src/gutils.c (gnm_ptr_array_insert) : Make this smarter.
Just append if the requested element is >= len
* src/item-grid.c (item_grid_event) : only auto-slide when we're
outside. Inside we handle it locally fixes artificial movement that
seems to jump back to the start of the previous row/col
* src/gnumeric-pane.c (cb_control_point_event) : Store the button that
initiated the object drag and check that when releasing.
* src/commands.c (cmd_paste_copy) : handle pasting objects with no
content.
* src/gutils.h : Fix the name spacing to be gnm_ in all cases.
gnumeric_ is too damn big, and we have not business using g_
* src/gutils.c (gnm_usr_dir) : Check for empty home_dir
* src/graph.c (gnm_go_data_vector_load_len) : handle missing
expression
* src/gnm-so-filled.c (gnm_so_filled_read_xml_dom) : We still need to
Type field even though it is ugly.
* src/xml-io.c (xml_cellregion_write) : cut-n-paste-o to fix
inter-process pasting
(xml_cellregion_read) : Actually store the resulting objects
(xml_read_sheet_object) : Don't set the sheet when extracting a
cellregion.
2004-09-27 Morten Welinder <terra@gnome.org>
* src/workbook-view.c (wb_view_sendto): Bring !WITH_GNOME case a
......
2004-09-27 Jody Goldberg <jody@gnome.org>
* src/gutils.c (gnm_ptr_array_insert) : Make this smarter.
Just append if the requested element is >= len
* src/item-grid.c (item_grid_event) : only auto-slide when we're
outside. Inside we handle it locally fixes artificial movement that
seems to jump back to the start of the previous row/col
* src/gnumeric-pane.c (cb_control_point_event) : Store the button that
initiated the object drag and check that when releasing.
* src/commands.c (cmd_paste_copy) : handle pasting objects with no
content.
* src/gutils.h : Fix the name spacing to be gnm_ in all cases.
gnumeric_ is too damn big, and we have not business using g_
* src/gutils.c (gnm_usr_dir) : Check for empty home_dir
* src/graph.c (gnm_go_data_vector_load_len) : handle missing
expression
* src/gnm-so-filled.c (gnm_so_filled_read_xml_dom) : We still need to
Type field even though it is ugly.
* src/xml-io.c (xml_cellregion_write) : cut-n-paste-o to fix
inter-process pasting
(xml_cellregion_read) : Actually store the resulting objects
(xml_read_sheet_object) : Don't set the sheet when extracting a
cellregion.
2004-09-27 Morten Welinder <terra@gnome.org>
* src/workbook-view.c (wb_view_sendto): Bring !WITH_GNOME case a
......
......@@ -4244,7 +4244,7 @@ static void
excel_sheet_free (ExcelWriteSheet *esheet)
{
g_slist_free (esheet->textboxes);
g_slist_free_custom (esheet->blips, (GFreeFunc) blipinf_free);
gnm_slist_free_custom (esheet->blips, (GFreeFunc) blipinf_free);
g_free (esheet);
}
......
......@@ -237,7 +237,7 @@ plugin_init_general (ErrorInfo **ret_error)
scm_c_define_gsubr ("gnumeric-funcall", 2, 0, 0, scm_gnumeric_funcall);
scm_c_define_gsubr ("register-function", 5, 0, 0, scm_register_function);
dir = gnumeric_sys_data_dir ("guile");
dir = gnm_sys_data_dir ("guile");
name = g_strconcat (dir, "gnumeric_startup.scm", NULL);
scm_apply (scm_c_eval_string ("(lambda (filename)"
" (if (access? filename R_OK)"
......
......@@ -38,7 +38,7 @@ plugin_init_general (ErrorInfo **ret_error)
*ret_error = NULL;
/* Initialize the Perl interpreter. */
arg = gnumeric_sys_data_dir ("perl");
arg = gnm_sys_data_dir ("perl");
argv[1] = g_strconcat("-I", arg, NULL);
argv[2] = g_strconcat (arg, "startup.pl", NULL);
g_free(arg);
......
......@@ -132,7 +132,7 @@ gnm_py_command_line_finalize (GObject *obj)
{
GnmPyCommandLine *cline = GNM_PY_COMMAND_LINE (obj);
g_list_free_custom (cline->history, g_free);
gnm_list_free_custom (cline->history, g_free);
cline->history = NULL;
parent_class->finalize (obj);
......
......@@ -457,7 +457,7 @@ gnm_app_history_get_list (gboolean force_reload)
if (force_reload) {
GSList *tmp = app->history_list;
app->history_list = NULL;
g_slist_free_custom (tmp, g_free);
gnm_slist_free_custom (tmp, g_free);
} else
return app->history_list;
}
......@@ -488,7 +488,7 @@ gnm_app_history_add (char const *uri)
/* force a reload in case max_entries has changed */
gnm_app_history_get_list (TRUE);
exists = g_slist_find_custom (app->history_list,
uri, g_str_compare);
uri, gnm_str_compare);
if (exists != NULL) {
/* its already the top of the stack no need to do anything */
......@@ -508,13 +508,13 @@ gnm_app_history_add (char const *uri)
while (*ptr != NULL && max_entries-- > 0)
ptr = &((*ptr)->next);
if (*ptr != NULL) {
g_slist_free_custom (*ptr, g_free);
gnm_slist_free_custom (*ptr, g_free);
*ptr = NULL;
}
g_object_notify (G_OBJECT (app), "file-history-list");
gnm_gconf_set_file_history_files (
g_string_slist_copy (app->history_list));
gnm_string_slist_copy (app->history_list));
go_conf_sync ();
}
......
......@@ -2877,7 +2877,7 @@ cmd_paste_copy_finalize (GObject *cmd)
gboolean
cmd_paste_copy (WorkbookControl *wbc,
GnmPasteTarget const *pt, GnmCellRegion *content)
GnmPasteTarget const *pt, GnmCellRegion *cr)
{
GObject *obj;
CmdPasteCopy *me;
......@@ -2894,27 +2894,30 @@ cmd_paste_copy (WorkbookControl *wbc,
me->cmd.cmd_descriptor = g_strdup_printf (_("Pasting into %s"),
range_name (&pt->range));
me->dst = *pt;
me->content = content;
me->content = cr;
me->has_been_through_cycle = FALSE;
me->saved_sizes = NULL;
/* If the input is only objects ignore all this range stuff */
if (cr->cols < 1 || cr->rows < 1) {
/* If the destination is a singleton paste the entire content */
if (range_is_singleton (&me->dst.range)) {
} else if (range_is_singleton (&me->dst.range)) {
if (pt->paste_flags & PASTE_TRANSPOSE) {
me->dst.range.end.col = me->dst.range.start.col + content->rows -1;
me->dst.range.end.row = me->dst.range.start.row + content->cols -1;
me->dst.range.end.col = me->dst.range.start.col + cr->rows -1;
me->dst.range.end.row = me->dst.range.start.row + cr->cols -1;
} else {
me->dst.range.end.col = me->dst.range.start.col + content->cols -1;
me->dst.range.end.row = me->dst.range.start.row + content->rows -1;
me->dst.range.end.col = me->dst.range.start.col + cr->cols -1;
me->dst.range.end.row = me->dst.range.start.row + cr->rows -1;
}
} else if (pt->paste_flags & PASTE_TRANSPOSE) {
/* when transposed single rows or cols get replicated as needed */
if (content->cols == 1 && me->dst.range.start.col == me->dst.range.end.col) {
me->dst.range.end.col = me->dst.range.start.col + content->rows -1;
} else if (content->rows == 1 && me->dst.range.start.row == me->dst.range.end.row) {
me->dst.range.end.row = me->dst.range.start.row + content->cols -1;
if (cr->cols == 1 && me->dst.range.start.col == me->dst.range.end.col) {
me->dst.range.end.col = me->dst.range.start.col + cr->rows -1;
} else if (cr->rows == 1 && me->dst.range.start.row == me->dst.range.end.row) {
me->dst.range.end.row = me->dst.range.start.row + cr->cols -1;
}
} else if (content->cols != 1 || content->rows != 1) {
} else if (cr->cols != 1 || cr->rows != 1) {
/* Note: when the source is a single cell, a single target merge is special */
/* see clipboard.c (clipboard_paste_region) */
GnmRange const *merge = sheet_merge_is_corner (pt->sheet, &me->dst.range.start);
......@@ -2923,22 +2926,22 @@ cmd_paste_copy (WorkbookControl *wbc,
/* enlarge it such that the source fits */
if (pt->paste_flags & PASTE_TRANSPOSE) {
if ((me->dst.range.end.col - me->dst.range.start.col + 1) <
content->rows)
cr->rows)
me->dst.range.end.col =
me->dst.range.start.col + content->rows -1;
me->dst.range.start.col + cr->rows -1;
if ((me->dst.range.end.row - me->dst.range.start.row + 1) <
content->cols)
cr->cols)
me->dst.range.end.row =
me->dst.range.start.row + content->cols -1;
me->dst.range.start.row + cr->cols -1;
} else {
if ((me->dst.range.end.col - me->dst.range.start.col + 1) <
content->cols)
cr->cols)
me->dst.range.end.col =
me->dst.range.start.col + content->cols -1;
me->dst.range.start.col + cr->cols -1;
if ((me->dst.range.end.row - me->dst.range.start.row + 1) <
content->rows)
cr->rows)
me->dst.range.end.row =
me->dst.range.start.row + content->rows -1;
me->dst.range.start.row + cr->rows -1;
}
}
}
......@@ -2952,8 +2955,9 @@ cmd_paste_copy (WorkbookControl *wbc,
return TRUE;
}
/* Check array subdivision & merged regions */
if (sheet_range_splits_region (pt->sheet, &me->dst.range,
/* no need to test if all we have are objects */
if (cr->cols > 0 && cr->rows > 0 &&
sheet_range_splits_region (pt->sheet, &me->dst.range,
NULL, GNM_CMD_CONTEXT (wbc), me->cmd.cmd_descriptor)) {
g_object_unref (G_OBJECT (me));
return TRUE;
......
......@@ -973,7 +973,7 @@ cb_font_underline_changed (G_GNUC_UNUSED GtkWidget *ct,
return FALSE;
for (i = G_N_ELEMENTS (underline_types); i-- > 0; )
if (gnumeric_utf8_collate_casefold (new_text, _(underline_types[i].Cname)) == 0) {
if (gnm_utf8_collate_casefold (new_text, _(underline_types[i].Cname)) == 0) {
res = underline_types[i].ut;
break;
}
......
......@@ -235,8 +235,8 @@ static void
pm_gui_load_directory_page (PluginManagerGUI *pm_gui)
{
GtkTreeIter iter;
char * sys_plugins = gnumeric_sys_plugin_dir ();
char * usr_plugins = gnumeric_usr_plugin_dir ();
char * sys_plugins = gnm_sys_plugin_dir ();
char * usr_plugins = gnm_usr_plugin_dir ();
GSList *plugin_dirs;
gchar const *plugin_path_env;
......@@ -257,7 +257,7 @@ pm_gui_load_directory_page (PluginManagerGUI *pm_gui)
plugin_path_env = g_getenv ("GNUMERIC_PLUGIN_PATH");
if (plugin_path_env != NULL) {
plugin_dirs = g_strsplit_to_slist (plugin_path_env, ":");
plugin_dirs = gnm_strsplit_to_slist (plugin_path_env, ":");
pm_gui_load_directories (pm_gui, plugin_dirs, FALSE);
g_slist_foreach (plugin_dirs, (GFunc)g_free, NULL);
g_slist_free (plugin_dirs);
......@@ -295,11 +295,11 @@ cb_pm_button_directory_add_clicked (G_GNUC_UNUSED GtkButton *button,
}
if (g_slist_find_custom ((GSList *)gnm_app_prefs->plugin_extra_dirs,
path, g_str_compare) == NULL) {
GSList *extra_dirs = g_string_slist_copy (
path, gnm_str_compare) == NULL) {
GSList *extra_dirs = gnm_string_slist_copy (
gnm_app_prefs->plugin_extra_dirs);
GNM_SLIST_PREPEND (extra_dirs, path);
GNM_SLIST_SORT (extra_dirs, g_str_compare);
GNM_SLIST_SORT (extra_dirs, gnm_str_compare);
gnm_gconf_set_plugin_extra_dirs (extra_dirs);
pm_gui_load_directory_page (pm_gui);
......@@ -329,10 +329,10 @@ cb_pm_button_directory_delete_clicked (G_GNUC_UNUSED GtkButton *button,
if (!is_system
&& g_slist_find_custom ((GSList *)gnm_app_prefs->plugin_extra_dirs,
dir_name, g_str_compare) != NULL) {
dir_name, gnm_str_compare) != NULL) {
GSList *extra_dirs = g_string_slist_copy (gnm_app_prefs->plugin_extra_dirs);
GSList *res = g_slist_find_custom (extra_dirs, dir_name, g_str_compare);
GSList *extra_dirs = gnm_string_slist_copy (gnm_app_prefs->plugin_extra_dirs);
GSList *res = g_slist_find_custom (extra_dirs, dir_name, gnm_str_compare);
g_free (res->data);
extra_dirs = g_slist_remove (extra_dirs, res->data);
......@@ -413,7 +413,7 @@ cb_pm_selection_changed (GtkTreeSelection *selection, PluginManagerGUI *pm_gui)
-1);
);
}
g_slist_free_custom (dep_ids, g_free);
gnm_slist_free_custom (dep_ids, g_free);
gtk_tree_store_append (pm_gui->model_details, &iter2, &iter);
gtk_tree_store_set (
......@@ -620,7 +620,7 @@ cb_active_toggled (G_GNUC_UNUSED GtkCellRendererToggle *celltoggle,
}
g_string_free (s, TRUE);
}
g_slist_free_custom (dep_ids, g_free);
gnm_slist_free_custom (dep_ids, g_free);
if (want_activate) {
gnm_plugin_activate (plugin, &error);
......
......@@ -83,7 +83,7 @@ csv_page_global_change (G_GNUC_UNUSED GtkWidget *widget,
strcmp (sepc->str, "") == 0 ? NULL : sepc->str,
sepstr);
g_string_free (sepc, TRUE);
g_slist_free_custom (sepstr, g_free);
gnm_slist_free_custom (sepstr, g_free);
stf_parse_options_csv_set_duplicates (parseoptions,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pagedata->csv.csv_duplicates)));
......
......@@ -645,10 +645,8 @@ expr_name_cmp_by_name (GnmNamedExpr const *a, GnmNamedExpr const *b)
sheetb->name_case_insensitive);
}
if (res == 0) {
/* By name. */
res = gnumeric_utf8_collate_casefold (a->name->str, b->name->str);
}
if (res == 0) /* By name. */
res = gnm_utf8_collate_casefold (a->name->str, b->name->str);
return res;
}
......
......@@ -167,7 +167,7 @@ category_group_list_get (void)
GList *categories, *l;
FormatTemplateCategoryGroup *current_group;
dir_list = g_create_slist (gnm_app_prefs->autoformat.sys_dir,
dir_list = gnm_create_slist (gnm_app_prefs->autoformat.sys_dir,
gnm_app_prefs->autoformat.usr_dir,
NULL);
dir_list = g_slist_concat (dir_list,
......
......@@ -557,8 +557,7 @@ gnm_vrfy_uri_ext (gchar const *std_ext,
*new_uri = g_strconcat (uri, ".", std_ext, NULL);
else {
if (user_ext != NULL && std_ext != NULL)
res = !gnumeric_utf8_collate_casefold (user_ext + 1,
std_ext);
res = !gnm_utf8_collate_casefold (user_ext + 1, std_ext);
*new_uri = g_strdup (uri);
}
g_free (base);
......@@ -612,7 +611,7 @@ gnm_file_opener_register (GnmFileOpener *fo, gint priority)
g_return_if_fail (IS_GNM_FILE_OPENER (fo));
g_return_if_fail (priority >=0 && priority <= 100);
pos = g_list_index_custom (file_opener_priority_list,
pos = gnm_list_index_custom (file_opener_priority_list,
GINT_TO_POINTER (priority),
cmp_int_less_than);
file_opener_priority_list = g_list_insert (
......
......@@ -353,12 +353,13 @@ gnm_so_filled_read_xml_dom (SheetObject *so, char const *typename,
xmlFree (label);
}
if (xml_node_get_int (node, "Type", &type))
sof->is_oval = (type == 102);
if (NULL != (child = e_xml_get_child_by_name (node, "Style"))) /* new version */
return !gog_persist_dom_load (GOG_PERSIST (sof->style), child);
/* Old 1.0 and 1.2 */
if (xml_node_get_int (node, "Type", &type))
sof->is_oval = (type == 102);
xml_node_get_gocolor (node, "OutlineColor", &sof->style->outline.color);
xml_node_get_gocolor (node, "FillColor", &sof->style->fill.pattern.back);
if (xml_node_get_double (node, "Width", &width))
......
......@@ -1144,13 +1144,13 @@ gcanvas_sliding_callback (gpointer data)
* depending on how far outside the bounds of @gcanvas the @event is.
* Usually @canvas == @gcanvas however as long as the canvases share a basis
* space they can be different.
*/
**/
gboolean
gnm_canvas_handle_motion (GnmCanvas *gcanvas,
FooCanvas *canvas, GdkEventMotion *event,
GnmCanvasSlideFlags slide_flags,
GnmCanvasSlideHandler slide_handler,
gpointer user_data)
FooCanvas *canvas, GdkEventMotion *event,
GnmCanvasSlideFlags slide_flags,
GnmCanvasSlideHandler slide_handler,
gpointer user_data)
{
GnmCanvas *gcanvas0, *gcanvas1, *gcanvas3;
int pane, left, top, x, y, width, height;
......
......@@ -634,12 +634,12 @@ gnm_conf_init_extras (void)
tmp = go_conf_load_string (AUTOFORMAT_GCONF_SYS_DIR);
if (tmp == NULL)
tmp = g_strdup ("autoformat-template");
prefs.autoformat.sys_dir = gnumeric_sys_data_dir (tmp);
prefs.autoformat.sys_dir = gnm_sys_data_dir (tmp);
g_free (tmp);
tmp = go_conf_load_string (AUTOFORMAT_GCONF_USR_DIR);
if (tmp == NULL)
tmp = g_strdup ("autoformat-template");
prefs.autoformat.usr_dir = gnumeric_usr_dir (tmp);
prefs.autoformat.usr_dir = gnm_usr_dir (tmp);
g_free (tmp);
prefs.xml_compression_level = go_conf_load_int (
......@@ -808,7 +808,7 @@ gnm_gconf_set_printer_header (gchar const *left, gchar const *middle,
list = g_slist_prepend (list, g_strdup (middle));
list = g_slist_prepend (list, g_strdup (left));
go_conf_set_str_list (PRINTSETUP_GCONF_HEADER, list);
g_slist_free_custom ((GSList *)prefs.printer_header, g_free);
gnm_slist_free_custom ((GSList *)prefs.printer_header, g_free);
prefs.printer_header = list;
}
......@@ -821,7 +821,7 @@ gnm_gconf_set_printer_footer (gchar const *left, gchar const *middle,
list = g_slist_prepend (list, g_strdup (middle));
list = g_slist_prepend (list, g_strdup (left));
go_conf_set_str_list (PRINTSETUP_GCONF_FOOTER, list);
g_slist_free_custom ((GSList *)prefs.printer_footer, g_free);
gnm_slist_free_custom ((GSList *)prefs.printer_footer, g_free);
prefs.printer_footer = list;
}
......@@ -893,10 +893,10 @@ gnm_gconf_set_print_header_formats (GSList *left, GSList *middle,
GSList *right)
{
go_conf_set_str_list (PRINTSETUP_GCONF_HEADER_FORMAT_LEFT, left);
g_slist_free_custom (left, g_free);
gnm_slist_free_custom (left, g_free);
go_conf_set_str_list (PRINTSETUP_GCONF_HEADER_FORMAT_MIDDLE, middle);
g_slist_free_custom (middle, g_free);
gnm_slist_free_custom (middle, g_free);
go_conf_set_str_list (PRINTSETUP_GCONF_HEADER_FORMAT_RIGHT, right);
g_slist_free_custom (right, g_free);
gnm_slist_free_custom (right, g_free);
}
......@@ -208,6 +208,7 @@ gnm_pane_init (GnmPane *pane, SheetControlGUI *scg,
pane->row.canvas = NULL;
pane->drag_object = NULL;
pane->drag_button = 0;
i = G_N_ELEMENTS (pane->control_points);
while (i-- > 0)
pane->control_points[i] = NULL;
......@@ -806,13 +807,15 @@ cb_control_point_event (FooCanvasItem *ctrl_pt, GdkEvent *event, GnmPane *pane)
break;
case GDK_BUTTON_RELEASE:
if (pane->drag_object != so || event->button.button != 1)
if (pane->drag_object != so ||
pane->drag_button != event->button.button)
return FALSE;
cmd_object_move (WORKBOOK_CONTROL (scg_get_wbcg (scg)),
so, &scg->old_anchor, scg->object_was_resized);
gnm_canvas_slide_stop (gcanvas);
pane->drag_object = NULL;
pane->drag_button = 0;
gnm_simple_canvas_ungrab (ctrl_pt, event->button.time);
control_point_set_cursor (scg, ctrl_pt);
sheet_object_update_bounds (so, NULL);
......@@ -838,6 +841,7 @@ cb_control_point_event (FooCanvasItem *ctrl_pt, GdkEvent *event, GnmPane *pane)
}
pane->drag_object = so;
pane->drag_button = event->button.button;
gnm_simple_canvas_grab (ctrl_pt,
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
......@@ -1071,6 +1075,7 @@ cb_sheet_object_canvas_event (FooCanvasItem *view, GdkEvent *event,
if (event->button.button < 3) {
g_return_val_if_fail (pane->drag_object == NULL, FALSE);
pane->drag_object = so;
pane->drag_button = event->button.button;
/* grab the acetate */
gnm_simple_canvas_grab (pane->control_points [8],
......
......@@ -31,6 +31,7 @@ struct _GnumericPane {
GSList *anted_cursors;
SheetObject *drag_object;
int drag_button; /* the button that intiated the object drag */
FooCanvasItem *control_points [9]; /* Control points for the current item */
GdkCursor *mouse_cursor;
......
......@@ -351,7 +351,7 @@ gnm_go_data_vector_load_len (GODataVector *dat)
int old_len = dat->len;
eval_pos_init_dep (&ep, &vec->dep);
if (vec->val == NULL)
if (vec->val == NULL && vec->dep.expression != NULL)
vec->val = gnm_expr_eval (vec->dep.expression, &ep,
GNM_EXPR_EVAL_PERMIT_NON_SCALAR | GNM_EXPR_EVAL_PERMIT_EMPTY);
......
......@@ -626,7 +626,7 @@ gnm_glade_xml_new (GnmCmdContext *cc, char const *gladefile,
g_return_val_if_fail (gladefile != NULL, NULL);
if (!g_path_is_absolute (gladefile)) {
char *d = gnumeric_sys_glade_dir ();
char *d = gnm_sys_glade_dir ();
f = g_build_filename (d, gladefile, NULL);
g_free (d);
} else
......
......@@ -61,9 +61,9 @@ gnumeric_time_counter_pop (void)
/***************************************************************************/
void
g_ptr_array_insert (GPtrArray *array, gpointer value, int index)
gnm_ptr_array_insert (GPtrArray *array, gpointer value, int index)
{
if ((int)array->len != index) {
if (index < (int)array->len) {
int i = array->len - 1;
gpointer last = g_ptr_array_index (array, i);
g_ptr_array_add (array, last);
......@@ -78,31 +78,7 @@ g_ptr_array_insert (GPtrArray *array, gpointer value, int index)
}
/**
* g_create_list:
* @item1: First item.
*
* Creates a GList from NULL-terminated list of arguments.
*
* Return value: created list.
*/
GList *
g_create_list (gpointer item1, ...)
{
va_list args;
GList *list = NULL;
gpointer item;
va_start (args, item1);
for (item = item1; item != NULL; item = va_arg (args, gpointer)) {
list = g_list_prepend (list, item);
}
va_end (args);
return g_list_reverse (list);
}
/**
* g_create_list:
* gnm_create_slist:
* @item1: First item.
*
* Creates a GList from NULL-terminated list of arguments.
......@@ -110,7 +86,7 @@ g_create_list (gpointer item1, ...)
* Return value: created list.
*/
GSList *
g_create_slist (gpointer item1, ...)
gnm_create_slist (gpointer item1, ...)
{
va_list args;
GSList *list = NULL;
......@@ -126,7 +102,7 @@ g_create_slist (gpointer item1, ...)
}
gint
g_list_index_custom (GList *list, gpointer data, GCompareFunc cmp_func)
gnm_list_index_custom (GList *list, gpointer data, GCompareFunc cmp_func)
{
GList *l;
gint i;
......@@ -141,7 +117,7 @@ g_list_index_custom (GList *list, gpointer data, GCompareFunc cmp_func)
}
/**
* g_list_free_custom:
* gnm_list_free_custom:
* @list: list of some items
* @free_func: function freeing list item
*
......@@ -149,7 +125,7 @@ g_list_index_custom (GList *list, gpointer data, GCompareFunc cmp_func)
*
*/
void
g_list_free_custom (GList *list, GFreeFunc free_func)
gnm_list_free_custom (GList *list, GFreeFunc free_func)
{
GList *l;
......@@ -160,12 +136,12 @@ g_list_free_custom (GList *list, GFreeFunc free_func)
}
/**
* g_slist_map:
* gnm_slist_map:
* @list : list of some items
* @map_func : mapping function
*/
GSList *
g_slist_map (GSList const *list, GnmMapFunc map_func)
gnm_slist_map (GSList const *list, GnmMapFunc map_func)
{
GSList *list_copy = NULL;
......@@ -177,18 +153,17 @@ g_slist_map (GSList const *list, GnmMapFunc map_func)
}
/**
* g_strsplit_to_slist:
* gnm_strsplit_to_slist:
* @string: String to split
* @delimiter: Token delimiter
*
* Splits up string into tokens at delim and returns a string list.
*
* Return value: string list which you should free after use using function
* Returns: string list which you should free after use using function
* e_free_string_list().
*
*/
**/
GSList *
g_strsplit_to_slist (gchar const *string, gchar const *delimiter)
gnm_strsplit_to_slist (gchar const *string, gchar const *delimiter)
{
gchar **token_v;
GSList *string_list = NULL;
......@@ -207,15 +182,14 @@ g_strsplit_to_slist (gchar const *string, gchar const *delimiter)
}
/**
* g_slist_free_custom:
* gnm_slist_free_custom:
* @list: list of some items
* @free_func: function freeing list item
*
* Clears a list, calling @free_func for each list item.
*
*/
**/
void
g_slist_free_custom (GSList *list, GFreeFunc free_func)
gnm_slist_free_custom (GSList *list, GFreeFunc free_func)
{
GSList *l;
......@@ -226,7 +200,7 @@ g_slist_free_custom (GSList *list, GFreeFunc free_func)
}
gint
gnumeric_utf8_collate_casefold (const char *a, const char *b)
gnm_utf8_collate_casefold (const char *a, const char *b)
{
char *a2 = g_utf8_casefold (a, -1);
char *b2 = g_utf8_casefold (b, -1);
......@@ -237,14 +211,14 @@ gnumeric_utf8_collate_casefold (const char *a, const char *b)
}
gint
gnumeric_ascii_strcase_equal (gconstpointer v1, gconstpointer v2)
gnm_ascii_strcase_equal (gconstpointer v1, gconstpointer v2)
{
return g_ascii_strcasecmp ((char const *) v1, (char const *)v2) == 0;
}
/* a char* hash function from ASU */
guint
gnumeric_ascii_strcase_hash (gconstpointer v)
gnm_ascii_strcase_hash (gconstpointer v)
{
unsigned const char *s = (unsigned const char *)v;
unsigned const char *p;
......@@ -263,7 +237,7 @@ gnumeric_ascii_strcase_hash (gconstpointer v)
extern char *gnumeric_data_dir;
char *
gnumeric_sys_data_dir (char const *subdir)
gnm_sys_data_dir (char const *subdir)
{
if (subdir == NULL)
return (char *)gnumeric_data_dir;
......@@ -272,7 +246,7 @@ gnumeric_sys_data_dir (char const *subdir)
extern char *gnumeric_lib_dir;
char *
gnumeric_sys_lib_dir (char const *subdir)
gnm_sys_lib_dir (char const *subdir)
{
return g_build_filename (gnumeric_lib_dir, subdir, NULL);
}
......@@ -281,23 +255,23 @@ gnumeric_sys_lib_dir (char const *subdir)
#define PLUGIN_SUFFIX "plugins"
char *
gnumeric_sys_glade_dir (void)
gnm_sys_glade_dir (void)
{
return gnumeric_sys_data_dir (GLADE_SUFFIX);
return gnm_sys_data_dir (GLADE_SUFFIX);
}
char *
gnumeric_sys_plugin_dir (void)
gnm_sys_plugin_dir (void)
{
return gnumeric_sys_lib_dir (PLUGIN_SUFFIX);
return gnm_sys_lib_dir (PLUGIN_SUFFIX);
}